repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/contrib/ComparatorChain.java
ComparatorChain.setComparator
public void setComparator(int index, Comparator<T> comparator) throws IndexOutOfBoundsException { setComparator(index, comparator, false); }
java
public void setComparator(int index, Comparator<T> comparator) throws IndexOutOfBoundsException { setComparator(index, comparator, false); }
[ "public", "void", "setComparator", "(", "int", "index", ",", "Comparator", "<", "T", ">", "comparator", ")", "throws", "IndexOutOfBoundsException", "{", "setComparator", "(", "index", ",", "comparator", ",", "false", ")", ";", "}" ]
Replace the Comparator at the given index, maintaining the existing sortFields order. @param index index of the Comparator to replace @param comparator Comparator to place at the given index @throws IndexOutOfBoundsException if index &lt; 0 or index &gt;= size()
[ "Replace", "the", "Comparator", "at", "the", "given", "index", "maintaining", "the", "existing", "sortFields", "order", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/contrib/ComparatorChain.java#L151-L153
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PerformanceCachingGoogleCloudStorage.java
PerformanceCachingGoogleCloudStorage.getItemInfo
@Override public GoogleCloudStorageItemInfo getItemInfo(StorageResourceId resourceId) throws IOException { // Get the item from cache. GoogleCloudStorageItemInfo item = cache.getItem(resourceId); // If it wasn't in the cache, list all the objects in the parent directory and cache them // and then retrieve it from the cache. if (item == null && resourceId.isStorageObject()) { String bucketName = resourceId.getBucketName(); String objectName = resourceId.getObjectName(); int lastSlashIndex = objectName.lastIndexOf(PATH_DELIMITER); String directoryName = lastSlashIndex >= 0 ? objectName.substring(0, lastSlashIndex + 1) : null; List<GoogleCloudStorageItemInfo> cachedInDirectory = cache.listItems(bucketName, directoryName); filter(cachedInDirectory, bucketName, directoryName, PATH_DELIMITER); // If there are items already cached in directory, do not prefetch with list requests, // because metadata for this directory already could be prefetched if (cachedInDirectory.isEmpty()) { // make just 1 request to prefetch only 1 page of directory items listObjectInfoPage(bucketName, directoryName, PATH_DELIMITER, /* pageToken= */ null); item = cache.getItem(resourceId); } } // If it wasn't in the cache and wasn't cached in directory list request // then request and cache it directly. if (item == null) { item = super.getItemInfo(resourceId); cache.putItem(item); } return item; }
java
@Override public GoogleCloudStorageItemInfo getItemInfo(StorageResourceId resourceId) throws IOException { // Get the item from cache. GoogleCloudStorageItemInfo item = cache.getItem(resourceId); // If it wasn't in the cache, list all the objects in the parent directory and cache them // and then retrieve it from the cache. if (item == null && resourceId.isStorageObject()) { String bucketName = resourceId.getBucketName(); String objectName = resourceId.getObjectName(); int lastSlashIndex = objectName.lastIndexOf(PATH_DELIMITER); String directoryName = lastSlashIndex >= 0 ? objectName.substring(0, lastSlashIndex + 1) : null; List<GoogleCloudStorageItemInfo> cachedInDirectory = cache.listItems(bucketName, directoryName); filter(cachedInDirectory, bucketName, directoryName, PATH_DELIMITER); // If there are items already cached in directory, do not prefetch with list requests, // because metadata for this directory already could be prefetched if (cachedInDirectory.isEmpty()) { // make just 1 request to prefetch only 1 page of directory items listObjectInfoPage(bucketName, directoryName, PATH_DELIMITER, /* pageToken= */ null); item = cache.getItem(resourceId); } } // If it wasn't in the cache and wasn't cached in directory list request // then request and cache it directly. if (item == null) { item = super.getItemInfo(resourceId); cache.putItem(item); } return item; }
[ "@", "Override", "public", "GoogleCloudStorageItemInfo", "getItemInfo", "(", "StorageResourceId", "resourceId", ")", "throws", "IOException", "{", "// Get the item from cache.", "GoogleCloudStorageItemInfo", "item", "=", "cache", ".", "getItem", "(", "resourceId", ")", ";...
This function may return cached copies of GoogleCloudStorageItemInfo.
[ "This", "function", "may", "return", "cached", "copies", "of", "GoogleCloudStorageItemInfo", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PerformanceCachingGoogleCloudStorage.java#L256-L289
cdapio/tigon
tigon-queue/src/main/java/co/cask/tigon/data/transaction/queue/QueueEntryRow.java
QueueEntryRow.getQueueName
public static QueueName getQueueName(String appName, String flowName, byte[] rowBuffer, int rowOffset, int rowLength) { // Entry key is always (salt bytes + 1 MD5 byte + queueName + longWritePointer + intCounter) int queueNameEnd = rowOffset + rowLength - Bytes.SIZEOF_LONG - Bytes.SIZEOF_INT; // <flowlet><source> byte[] idWithinFlow = Arrays.copyOfRange(rowBuffer, rowOffset + HBaseQueueAdmin.SALT_BYTES + 1, queueNameEnd); String idWithinFlowAsString = new String(idWithinFlow, Charsets.US_ASCII); // <flowlet><source> String[] parts = idWithinFlowAsString.split("/"); return QueueName.fromFlowlet(appName, flowName, parts[0], parts[1]); }
java
public static QueueName getQueueName(String appName, String flowName, byte[] rowBuffer, int rowOffset, int rowLength) { // Entry key is always (salt bytes + 1 MD5 byte + queueName + longWritePointer + intCounter) int queueNameEnd = rowOffset + rowLength - Bytes.SIZEOF_LONG - Bytes.SIZEOF_INT; // <flowlet><source> byte[] idWithinFlow = Arrays.copyOfRange(rowBuffer, rowOffset + HBaseQueueAdmin.SALT_BYTES + 1, queueNameEnd); String idWithinFlowAsString = new String(idWithinFlow, Charsets.US_ASCII); // <flowlet><source> String[] parts = idWithinFlowAsString.split("/"); return QueueName.fromFlowlet(appName, flowName, parts[0], parts[1]); }
[ "public", "static", "QueueName", "getQueueName", "(", "String", "appName", ",", "String", "flowName", ",", "byte", "[", "]", "rowBuffer", ",", "int", "rowOffset", ",", "int", "rowLength", ")", "{", "// Entry key is always (salt bytes + 1 MD5 byte + queueName + longWrite...
Extracts the queue name from the KeyValue row, which the row must be a queue entry.
[ "Extracts", "the", "queue", "name", "from", "the", "KeyValue", "row", "which", "the", "row", "must", "be", "a", "queue", "entry", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-queue/src/main/java/co/cask/tigon/data/transaction/queue/QueueEntryRow.java#L115-L129
lionsoul2014/jcseg
jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/Unzipper.java
Unzipper.getAndTick
private Object getAndTick(Keep keep, BitReader bitreader) throws JSONException { try { int width = keep.bitsize(); int integer = bitreader.read(width); Object value = keep.value(integer); if (JSONzip.probe) { JSONzip.log("\"" + value + "\""); JSONzip.log(integer, width); } if (integer >= keep.length) { throw new JSONException("Deep error."); } keep.tick(integer); return value; } catch (Throwable e) { throw new JSONException(e); } }
java
private Object getAndTick(Keep keep, BitReader bitreader) throws JSONException { try { int width = keep.bitsize(); int integer = bitreader.read(width); Object value = keep.value(integer); if (JSONzip.probe) { JSONzip.log("\"" + value + "\""); JSONzip.log(integer, width); } if (integer >= keep.length) { throw new JSONException("Deep error."); } keep.tick(integer); return value; } catch (Throwable e) { throw new JSONException(e); } }
[ "private", "Object", "getAndTick", "(", "Keep", "keep", ",", "BitReader", "bitreader", ")", "throws", "JSONException", "{", "try", "{", "int", "width", "=", "keep", ".", "bitsize", "(", ")", ";", "int", "integer", "=", "bitreader", ".", "read", "(", "wid...
Read enough bits to obtain an integer from the keep, and increase that integer's weight. @param keep The keep providing the context. @param bitreader The bitreader that is the source of bits. @return The value associated with the number. @throws JSONException
[ "Read", "enough", "bits", "to", "obtain", "an", "integer", "from", "the", "keep", "and", "increase", "that", "integer", "s", "weight", "." ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-server/src/main/java/org/lionsoul/jcseg/json/zip/Unzipper.java#L87-L105
aws/aws-sdk-java
aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/MessageMD5ChecksumHandler.java
MessageMD5ChecksumHandler.updateLengthAndBytes
private static void updateLengthAndBytes(MessageDigest digest, String str) throws UnsupportedEncodingException { byte[] utf8Encoded = str.getBytes(UTF8); ByteBuffer lengthBytes = ByteBuffer.allocate(INTEGER_SIZE_IN_BYTES).putInt(utf8Encoded.length); digest.update(lengthBytes.array()); digest.update(utf8Encoded); }
java
private static void updateLengthAndBytes(MessageDigest digest, String str) throws UnsupportedEncodingException { byte[] utf8Encoded = str.getBytes(UTF8); ByteBuffer lengthBytes = ByteBuffer.allocate(INTEGER_SIZE_IN_BYTES).putInt(utf8Encoded.length); digest.update(lengthBytes.array()); digest.update(utf8Encoded); }
[ "private", "static", "void", "updateLengthAndBytes", "(", "MessageDigest", "digest", ",", "String", "str", ")", "throws", "UnsupportedEncodingException", "{", "byte", "[", "]", "utf8Encoded", "=", "str", ".", "getBytes", "(", "UTF8", ")", ";", "ByteBuffer", "len...
Update the digest using a sequence of bytes that consists of the length (in 4 bytes) of the input String and the actual utf8-encoded byte values.
[ "Update", "the", "digest", "using", "a", "sequence", "of", "bytes", "that", "consists", "of", "the", "length", "(", "in", "4", "bytes", ")", "of", "the", "input", "String", "and", "the", "actual", "utf8", "-", "encoded", "byte", "values", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/MessageMD5ChecksumHandler.java#L269-L274
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/internal/resilience/RobustResilienceStrategy.java
RobustResilienceStrategy.putIfAbsentFailure
@Override public V putIfAbsentFailure(K key, V value, StoreAccessException e) { cleanup(key, e); return null; }
java
@Override public V putIfAbsentFailure(K key, V value, StoreAccessException e) { cleanup(key, e); return null; }
[ "@", "Override", "public", "V", "putIfAbsentFailure", "(", "K", "key", ",", "V", "value", ",", "StoreAccessException", "e", ")", "{", "cleanup", "(", "key", ",", "e", ")", ";", "return", "null", ";", "}" ]
Do nothing and return null. @param key the key being put @param value the value being put @param e the triggered failure @return null
[ "Do", "nothing", "and", "return", "null", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/RobustResilienceStrategy.java#L114-L118
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceTypeFactory.java
InstanceTypeFactory.constructFromDescription
public static InstanceType constructFromDescription(String description) { final Matcher m = INSTANCE_TYPE_PATTERN.matcher(description); if (!m.matches()) { LOG.error("Cannot extract instance type from string " + description); return null; } final String identifier = m.group(1); final int numComputeUnits = Integer.parseInt(m.group(2)); final int numCores = Integer.parseInt(m.group(3)); final int memorySize = Integer.parseInt(m.group(4)); final int diskCapacity = Integer.parseInt(m.group(5)); final int pricePerHour = Integer.parseInt(m.group(6)); return new InstanceType(identifier, numComputeUnits, numCores, memorySize, diskCapacity, pricePerHour); }
java
public static InstanceType constructFromDescription(String description) { final Matcher m = INSTANCE_TYPE_PATTERN.matcher(description); if (!m.matches()) { LOG.error("Cannot extract instance type from string " + description); return null; } final String identifier = m.group(1); final int numComputeUnits = Integer.parseInt(m.group(2)); final int numCores = Integer.parseInt(m.group(3)); final int memorySize = Integer.parseInt(m.group(4)); final int diskCapacity = Integer.parseInt(m.group(5)); final int pricePerHour = Integer.parseInt(m.group(6)); return new InstanceType(identifier, numComputeUnits, numCores, memorySize, diskCapacity, pricePerHour); }
[ "public", "static", "InstanceType", "constructFromDescription", "(", "String", "description", ")", "{", "final", "Matcher", "m", "=", "INSTANCE_TYPE_PATTERN", ".", "matcher", "(", "description", ")", ";", "if", "(", "!", "m", ".", "matches", "(", ")", ")", "...
Constructs an {@link InstanceType} object by parsing a hardware description string. @param description the hardware description reflected by this instance type @return an instance type reflecting the given hardware description or <code>null</code> if the description cannot be parsed
[ "Constructs", "an", "{", "@link", "InstanceType", "}", "object", "by", "parsing", "a", "hardware", "description", "string", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceTypeFactory.java#L52-L68
wisdom-framework/wisdom
extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/util/ExtractUtil.java
ExtractUtil.extractValueByName
public static String extractValueByName(List<MemberValuePair> pairs, String name){ for(MemberValuePair pair : pairs){ if(pair.getName().equals(name)){ return pair.getValue().toString(); } } return null; }
java
public static String extractValueByName(List<MemberValuePair> pairs, String name){ for(MemberValuePair pair : pairs){ if(pair.getName().equals(name)){ return pair.getValue().toString(); } } return null; }
[ "public", "static", "String", "extractValueByName", "(", "List", "<", "MemberValuePair", ">", "pairs", ",", "String", "name", ")", "{", "for", "(", "MemberValuePair", "pair", ":", "pairs", ")", "{", "if", "(", "pair", ".", "getName", "(", ")", ".", "equa...
Get the value of a {@link MemberValuePair} present in a list from its name. @param pairs The list of MemberValuePair @param name The name of the MemberValuePair we want to get the value from. @return The value of the MemberValuePair of given name, or null if it's not present in the list.
[ "Get", "the", "value", "of", "a", "{", "@link", "MemberValuePair", "}", "present", "in", "a", "list", "from", "its", "name", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/util/ExtractUtil.java#L242-L249
lessthanoptimal/BoofCV
main/boofcv-io/src/main/java/boofcv/io/UtilIO.java
UtilIO.pathExampleURL
public static URL pathExampleURL( String path ) { try { File fpath = new File(path); if (fpath.isAbsolute()) return fpath.toURI().toURL(); // Assume we are running inside of the project come String pathToBase = getPathToBase(); if( pathToBase != null ) { File pathExample = new File(pathToBase, "data/example/"); if (pathExample.exists()) { return new File(pathExample.getPath(), path).getAbsoluteFile().toURL(); } } // System.out.println("-----------------------"); // maybe we are running inside an app and all data is stored inside as a resource // System.out.println("Attempting to load resource "+path); URL url = UtilIO.class.getClassLoader().getResource(path); if (url == null) { System.err.println(); System.err.println("Can't find data/example directory! There are three likely causes for this problem."); System.err.println(); System.err.println("1) You checked out the source code from git and did not pull the data submodule too."); System.err.println("2) You are trying to run an example from outside the BoofCV directory tree."); System.err.println("3) You are trying to pass in your own image."); System.err.println(); System.err.println("Solutions:"); System.err.println("1) Follow instructions in the boofcv/readme.md file to grab the data directory."); System.err.println("2) Launch the example from inside BoofCV's directory tree!"); System.err.println("3) Don't use this function and just pass in the path directly"); System.exit(1); } return url; } catch (MalformedURLException e) { throw new RuntimeException(e); } }
java
public static URL pathExampleURL( String path ) { try { File fpath = new File(path); if (fpath.isAbsolute()) return fpath.toURI().toURL(); // Assume we are running inside of the project come String pathToBase = getPathToBase(); if( pathToBase != null ) { File pathExample = new File(pathToBase, "data/example/"); if (pathExample.exists()) { return new File(pathExample.getPath(), path).getAbsoluteFile().toURL(); } } // System.out.println("-----------------------"); // maybe we are running inside an app and all data is stored inside as a resource // System.out.println("Attempting to load resource "+path); URL url = UtilIO.class.getClassLoader().getResource(path); if (url == null) { System.err.println(); System.err.println("Can't find data/example directory! There are three likely causes for this problem."); System.err.println(); System.err.println("1) You checked out the source code from git and did not pull the data submodule too."); System.err.println("2) You are trying to run an example from outside the BoofCV directory tree."); System.err.println("3) You are trying to pass in your own image."); System.err.println(); System.err.println("Solutions:"); System.err.println("1) Follow instructions in the boofcv/readme.md file to grab the data directory."); System.err.println("2) Launch the example from inside BoofCV's directory tree!"); System.err.println("3) Don't use this function and just pass in the path directly"); System.exit(1); } return url; } catch (MalformedURLException e) { throw new RuntimeException(e); } }
[ "public", "static", "URL", "pathExampleURL", "(", "String", "path", ")", "{", "try", "{", "File", "fpath", "=", "new", "File", "(", "path", ")", ";", "if", "(", "fpath", ".", "isAbsolute", "(", ")", ")", "return", "fpath", ".", "toURI", "(", ")", "...
Returns an absolute path to the file that is relative to the example directory @param path File path relative to root directory @return Absolute path to file
[ "Returns", "an", "absolute", "path", "to", "the", "file", "that", "is", "relative", "to", "the", "example", "directory" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/UtilIO.java#L44-L81
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java
StrSubstitutor.replaceIn
public boolean replaceIn(final StringBuffer source) { if (source == null) { return false; } return replaceIn(source, 0, source.length()); }
java
public boolean replaceIn(final StringBuffer source) { if (source == null) { return false; } return replaceIn(source, 0, source.length()); }
[ "public", "boolean", "replaceIn", "(", "final", "StringBuffer", "source", ")", "{", "if", "(", "source", "==", "null", ")", "{", "return", "false", ";", "}", "return", "replaceIn", "(", "source", ",", "0", ",", "source", ".", "length", "(", ")", ")", ...
Replaces all the occurrences of variables within the given source buffer with their matching values from the resolver. The buffer is updated with the result. @param source the buffer to replace in, updated, null returns zero @return true if altered
[ "Replaces", "all", "the", "occurrences", "of", "variables", "within", "the", "given", "source", "buffer", "with", "their", "matching", "values", "from", "the", "resolver", ".", "The", "buffer", "is", "updated", "with", "the", "result", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrSubstitutor.java#L621-L626
pebble/pebble-android-sdk
PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java
PebbleKit.registerPebbleConnectedReceiver
public static BroadcastReceiver registerPebbleConnectedReceiver(final Context context, final BroadcastReceiver receiver) { return registerBroadcastReceiverInternal(context, INTENT_PEBBLE_CONNECTED, receiver); }
java
public static BroadcastReceiver registerPebbleConnectedReceiver(final Context context, final BroadcastReceiver receiver) { return registerBroadcastReceiverInternal(context, INTENT_PEBBLE_CONNECTED, receiver); }
[ "public", "static", "BroadcastReceiver", "registerPebbleConnectedReceiver", "(", "final", "Context", "context", ",", "final", "BroadcastReceiver", "receiver", ")", "{", "return", "registerBroadcastReceiverInternal", "(", "context", ",", "INTENT_PEBBLE_CONNECTED", ",", "rece...
A convenience function to assist in programatically registering a broadcast receiver for the 'CONNECTED' intent. To avoid leaking memory, activities registering BroadcastReceivers <em>must</em> unregister them in the Activity's {@link android.app.Activity#onPause()} method. @param context The context in which to register the BroadcastReceiver. @param receiver The receiver to be registered. @return The registered receiver. @see Constants#INTENT_PEBBLE_CONNECTED
[ "A", "convenience", "function", "to", "assist", "in", "programatically", "registering", "a", "broadcast", "receiver", "for", "the", "CONNECTED", "intent", "." ]
train
https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java#L385-L388
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.publish0
private PubsubFuture<List<String>> publish0(final List<Message> messages, final String canonicalTopic) { final String path = canonicalTopic + ":publish"; for (final Message message : messages) { if (!isEncoded(message)) { throw new IllegalArgumentException("Message data must be Base64 encoded: " + message); } } return post("publish", path, PublishRequest.of(messages), readJson(PublishResponse.class) .andThen(PublishResponse::messageIds)); }
java
private PubsubFuture<List<String>> publish0(final List<Message> messages, final String canonicalTopic) { final String path = canonicalTopic + ":publish"; for (final Message message : messages) { if (!isEncoded(message)) { throw new IllegalArgumentException("Message data must be Base64 encoded: " + message); } } return post("publish", path, PublishRequest.of(messages), readJson(PublishResponse.class) .andThen(PublishResponse::messageIds)); }
[ "private", "PubsubFuture", "<", "List", "<", "String", ">", ">", "publish0", "(", "final", "List", "<", "Message", ">", "messages", ",", "final", "String", "canonicalTopic", ")", "{", "final", "String", "path", "=", "canonicalTopic", "+", "\":publish\"", ";"...
Publish a batch of messages. @param messages The batch of messages. @param canonicalTopic The canonical topic to publish on. @return a future that is completed with a list of message ID's for the published messages.
[ "Publish", "a", "batch", "of", "messages", "." ]
train
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L518-L527
bazaarvoice/jolt
complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java
ChainrFactory.fromFile
public static Chainr fromFile( File chainrSpecFile, ChainrInstantiator chainrInstantiator ) { Object chainrSpec; try { FileInputStream fileInputStream = new FileInputStream( chainrSpecFile ); chainrSpec = JsonUtils.jsonToObject( fileInputStream ); } catch ( Exception e ) { throw new RuntimeException( "Unable to load chainr spec file " + chainrSpecFile.getAbsolutePath() ); } return getChainr( chainrInstantiator, chainrSpec ); }
java
public static Chainr fromFile( File chainrSpecFile, ChainrInstantiator chainrInstantiator ) { Object chainrSpec; try { FileInputStream fileInputStream = new FileInputStream( chainrSpecFile ); chainrSpec = JsonUtils.jsonToObject( fileInputStream ); } catch ( Exception e ) { throw new RuntimeException( "Unable to load chainr spec file " + chainrSpecFile.getAbsolutePath() ); } return getChainr( chainrInstantiator, chainrSpec ); }
[ "public", "static", "Chainr", "fromFile", "(", "File", "chainrSpecFile", ",", "ChainrInstantiator", "chainrInstantiator", ")", "{", "Object", "chainrSpec", ";", "try", "{", "FileInputStream", "fileInputStream", "=", "new", "FileInputStream", "(", "chainrSpecFile", ")"...
Builds a Chainr instance using the spec described in the File that is passed in. @param chainrSpecFile The File which contains the chainr spec. @param chainrInstantiator the ChainrInstantiator to use to initialze the Chainr instance @return a Chainr instance
[ "Builds", "a", "Chainr", "instance", "using", "the", "spec", "described", "in", "the", "File", "that", "is", "passed", "in", "." ]
train
https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java#L89-L98
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.createVariable
public Variable createVariable(Object projectIdOrPath, String key, String value, Boolean isProtected, String environmentScope) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("key", key, true) .withParam("value", value, true) .withParam("protected", isProtected) .withParam("environment_scope", environmentScope); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "variables"); return (response.readEntity(Variable.class)); }
java
public Variable createVariable(Object projectIdOrPath, String key, String value, Boolean isProtected, String environmentScope) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("key", key, true) .withParam("value", value, true) .withParam("protected", isProtected) .withParam("environment_scope", environmentScope); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "variables"); return (response.readEntity(Variable.class)); }
[ "public", "Variable", "createVariable", "(", "Object", "projectIdOrPath", ",", "String", "key", ",", "String", "value", ",", "Boolean", "isProtected", ",", "String", "environmentScope", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new...
Create a new project variable. <p>NOTE: Setting the environmentScope is only available on GitLab EE.</p> <pre><code>GitLab Endpoint: POST /projects/:id/variables</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required @param value the value for the variable, required @param isProtected whether the variable is protected, optional @param environmentScope the environment_scope of the variable, optional @return a Variable instance with the newly created variable @throws GitLabApiException if any exception occurs during execution
[ "Create", "a", "new", "project", "variable", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2519-L2528
classgraph/classgraph
src/main/java/io/github/classgraph/TypeArgument.java
TypeArgument.parseList
static List<TypeArgument> parseList(final Parser parser, final String definingClassName) throws ParseException { if (parser.peek() == '<') { parser.expect('<'); final List<TypeArgument> typeArguments = new ArrayList<>(2); while (parser.peek() != '>') { if (!parser.hasMore()) { throw new ParseException(parser, "Missing '>'"); } typeArguments.add(parse(parser, definingClassName)); } parser.expect('>'); return typeArguments; } else { return Collections.emptyList(); } }
java
static List<TypeArgument> parseList(final Parser parser, final String definingClassName) throws ParseException { if (parser.peek() == '<') { parser.expect('<'); final List<TypeArgument> typeArguments = new ArrayList<>(2); while (parser.peek() != '>') { if (!parser.hasMore()) { throw new ParseException(parser, "Missing '>'"); } typeArguments.add(parse(parser, definingClassName)); } parser.expect('>'); return typeArguments; } else { return Collections.emptyList(); } }
[ "static", "List", "<", "TypeArgument", ">", "parseList", "(", "final", "Parser", "parser", ",", "final", "String", "definingClassName", ")", "throws", "ParseException", "{", "if", "(", "parser", ".", "peek", "(", ")", "==", "'", "'", ")", "{", "parser", ...
Parse a list of type arguments. @param parser The parser. @param definingClassName The name of the defining class (for resolving type variables). @return The list of type arguments. @throws ParseException If type signature could not be parsed.
[ "Parse", "a", "list", "of", "type", "arguments", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/TypeArgument.java#L153-L168
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/preference/DiSHPreferenceVectorIndex.java
DiSHPreferenceVectorIndex.maxIntersection
private int maxIntersection(Map<Integer, ModifiableDBIDs> candidates, ModifiableDBIDs set) { int maxDim = -1; ModifiableDBIDs maxIntersection = null; for(Integer nextDim : candidates.keySet()) { DBIDs nextSet = candidates.get(nextDim); ModifiableDBIDs nextIntersection = DBIDUtil.intersection(set, nextSet); if(maxDim < 0 || maxIntersection.size() < nextIntersection.size()) { maxIntersection = nextIntersection; maxDim = nextDim; } } if(maxDim >= 0) { set.clear(); set.addDBIDs(maxIntersection); } return maxDim; }
java
private int maxIntersection(Map<Integer, ModifiableDBIDs> candidates, ModifiableDBIDs set) { int maxDim = -1; ModifiableDBIDs maxIntersection = null; for(Integer nextDim : candidates.keySet()) { DBIDs nextSet = candidates.get(nextDim); ModifiableDBIDs nextIntersection = DBIDUtil.intersection(set, nextSet); if(maxDim < 0 || maxIntersection.size() < nextIntersection.size()) { maxIntersection = nextIntersection; maxDim = nextDim; } } if(maxDim >= 0) { set.clear(); set.addDBIDs(maxIntersection); } return maxDim; }
[ "private", "int", "maxIntersection", "(", "Map", "<", "Integer", ",", "ModifiableDBIDs", ">", "candidates", ",", "ModifiableDBIDs", "set", ")", "{", "int", "maxDim", "=", "-", "1", ";", "ModifiableDBIDs", "maxIntersection", "=", "null", ";", "for", "(", "Int...
Returns the index of the set having the maximum intersection set with the specified set contained in the specified map. @param candidates the map containing the sets @param set the set to intersect with and output the result to @return the set with the maximum size
[ "Returns", "the", "index", "of", "the", "set", "having", "the", "maximum", "intersection", "set", "with", "the", "specified", "set", "contained", "in", "the", "specified", "map", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/preference/DiSHPreferenceVectorIndex.java#L334-L350
osglworks/java-tool
src/main/java/org/osgl/util/FastStr.java
FastStr.unsafeOf
@SuppressWarnings("unused") public static FastStr unsafeOf(char[] buf) { E.NPE(buf); return new FastStr(buf, 0, buf.length); }
java
@SuppressWarnings("unused") public static FastStr unsafeOf(char[] buf) { E.NPE(buf); return new FastStr(buf, 0, buf.length); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "FastStr", "unsafeOf", "(", "char", "[", "]", "buf", ")", "{", "E", ".", "NPE", "(", "buf", ")", ";", "return", "new", "FastStr", "(", "buf", ",", "0", ",", "buf", ".", "length", ...
Construct a FastStr instance from char array without array copying @param buf the char array @return a FastStr instance from the char array
[ "Construct", "a", "FastStr", "instance", "from", "char", "array", "without", "array", "copying" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/FastStr.java#L1674-L1678
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java
NetworkServiceDescriptorAgent.deleteSecurity
@Help(help = "Delete the Security of a NetworkServiceDescriptor with specific id") public void deleteSecurity(final String idNsd, final String idSecurity) throws SDKException { String url = idNsd + "/security" + "/" + idSecurity; requestDelete(url); }
java
@Help(help = "Delete the Security of a NetworkServiceDescriptor with specific id") public void deleteSecurity(final String idNsd, final String idSecurity) throws SDKException { String url = idNsd + "/security" + "/" + idSecurity; requestDelete(url); }
[ "@", "Help", "(", "help", "=", "\"Delete the Security of a NetworkServiceDescriptor with specific id\"", ")", "public", "void", "deleteSecurity", "(", "final", "String", "idNsd", ",", "final", "String", "idSecurity", ")", "throws", "SDKException", "{", "String", "url", ...
Delete a Security object. @param idNsd the NetworkServiceDescriptor's ID @param idSecurity the Security object's ID @throws SDKException if the request fails
[ "Delete", "a", "Security", "object", "." ]
train
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L412-L416
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/VisualContext.java
VisualContext.getFontName
private String getFontName(TermList list, CSSProperty.FontWeight weight, CSSProperty.FontStyle style) { for (Term<?> term : list) { Object value = term.getValue(); if (value instanceof CSSProperty.FontFamily) return ((CSSProperty.FontFamily) value).getAWTValue(); else { String name = lookupFont(value.toString(), weight, style); if (name != null) return name; } } //nothing found, use Serif return java.awt.Font.SERIF; }
java
private String getFontName(TermList list, CSSProperty.FontWeight weight, CSSProperty.FontStyle style) { for (Term<?> term : list) { Object value = term.getValue(); if (value instanceof CSSProperty.FontFamily) return ((CSSProperty.FontFamily) value).getAWTValue(); else { String name = lookupFont(value.toString(), weight, style); if (name != null) return name; } } //nothing found, use Serif return java.awt.Font.SERIF; }
[ "private", "String", "getFontName", "(", "TermList", "list", ",", "CSSProperty", ".", "FontWeight", "weight", ",", "CSSProperty", ".", "FontStyle", "style", ")", "{", "for", "(", "Term", "<", "?", ">", "term", ":", "list", ")", "{", "Object", "value", "=...
Scans a list of font definitions and chooses the first one that is available @param list of terms obtained from the font-family property @return a font name string according to java.awt.Font
[ "Scans", "a", "list", "of", "font", "definitions", "and", "chooses", "the", "first", "one", "that", "is", "available" ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/VisualContext.java#L609-L624
dmerkushov/log-helper
src/main/java/ru/dmerkushov/loghelper/LoggerWrapper.java
LoggerWrapper.logDomNode
public void logDomNode (String msg, Node node, Level level, StackTraceElement caller) { String toLog = (msg != null ? msg + "\n" : "DOM node:\n") + domNodeDescription (node, 0); if (caller != null) { logger.logp (level, caller.getClassName (), caller.getMethodName () + "():" + caller.getLineNumber (), toLog); } else { logger.logp (level, "(UnknownSourceClass)", "(unknownSourceMethod)", toLog); } }
java
public void logDomNode (String msg, Node node, Level level, StackTraceElement caller) { String toLog = (msg != null ? msg + "\n" : "DOM node:\n") + domNodeDescription (node, 0); if (caller != null) { logger.logp (level, caller.getClassName (), caller.getMethodName () + "():" + caller.getLineNumber (), toLog); } else { logger.logp (level, "(UnknownSourceClass)", "(unknownSourceMethod)", toLog); } }
[ "public", "void", "logDomNode", "(", "String", "msg", ",", "Node", "node", ",", "Level", "level", ",", "StackTraceElement", "caller", ")", "{", "String", "toLog", "=", "(", "msg", "!=", "null", "?", "msg", "+", "\"\\n\"", ":", "\"DOM node:\\n\"", ")", "+...
Log a DOM node at a given logging level and a specified caller @param msg The message to show with the node, or null if no message needed @param node @param level @param caller The caller's stack trace element @see ru.dmerkushov.loghelper.StackTraceUtils#getMyStackTraceElement()
[ "Log", "a", "DOM", "node", "at", "a", "given", "logging", "level", "and", "a", "specified", "caller" ]
train
https://github.com/dmerkushov/log-helper/blob/3b7d3d30faa7f1437b27cd07c10fa579a995de23/src/main/java/ru/dmerkushov/loghelper/LoggerWrapper.java#L466-L474
apereo/cas
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/callback/OAuth20TokenAuthorizationResponseBuilder.java
OAuth20TokenAuthorizationResponseBuilder.buildCallbackUrlResponseType
protected ModelAndView buildCallbackUrlResponseType(final AccessTokenRequestDataHolder holder, final String redirectUri, final AccessToken accessToken, final List<NameValuePair> params, final RefreshToken refreshToken, final J2EContext context) throws Exception { val attributes = holder.getAuthentication().getAttributes(); val state = attributes.get(OAuth20Constants.STATE).get(0).toString(); val nonce = attributes.get(OAuth20Constants.NONCE).get(0).toString(); val builder = new URIBuilder(redirectUri); val stringBuilder = new StringBuilder(); val timeToLive = accessTokenExpirationPolicy.getTimeToLive(); stringBuilder.append(OAuth20Constants.ACCESS_TOKEN) .append('=') .append(accessToken.getId()) .append('&') .append(OAuth20Constants.TOKEN_TYPE) .append('=') .append(OAuth20Constants.TOKEN_TYPE_BEARER) .append('&') .append(OAuth20Constants.EXPIRES_IN) .append('=') .append(timeToLive); if (refreshToken != null) { stringBuilder.append('&') .append(OAuth20Constants.REFRESH_TOKEN) .append('=') .append(refreshToken.getId()); } params.forEach(p -> stringBuilder.append('&') .append(p.getName()) .append('=') .append(p.getValue())); if (StringUtils.isNotBlank(state)) { stringBuilder.append('&') .append(OAuth20Constants.STATE) .append('=') .append(EncodingUtils.urlEncode(state)); } if (StringUtils.isNotBlank(nonce)) { stringBuilder.append('&') .append(OAuth20Constants.NONCE) .append('=') .append(EncodingUtils.urlEncode(nonce)); } builder.setFragment(stringBuilder.toString()); val url = builder.toString(); LOGGER.debug("Redirecting to URL [{}]", url); val parameters = new LinkedHashMap<String, String>(); parameters.put(OAuth20Constants.ACCESS_TOKEN, accessToken.getId()); if (refreshToken != null) { parameters.put(OAuth20Constants.REFRESH_TOKEN, refreshToken.getId()); } parameters.put(OAuth20Constants.EXPIRES_IN, timeToLive.toString()); parameters.put(OAuth20Constants.STATE, state); parameters.put(OAuth20Constants.NONCE, nonce); parameters.put(OAuth20Constants.CLIENT_ID, accessToken.getClientId()); return buildResponseModelAndView(context, servicesManager, accessToken.getClientId(), url, parameters); }
java
protected ModelAndView buildCallbackUrlResponseType(final AccessTokenRequestDataHolder holder, final String redirectUri, final AccessToken accessToken, final List<NameValuePair> params, final RefreshToken refreshToken, final J2EContext context) throws Exception { val attributes = holder.getAuthentication().getAttributes(); val state = attributes.get(OAuth20Constants.STATE).get(0).toString(); val nonce = attributes.get(OAuth20Constants.NONCE).get(0).toString(); val builder = new URIBuilder(redirectUri); val stringBuilder = new StringBuilder(); val timeToLive = accessTokenExpirationPolicy.getTimeToLive(); stringBuilder.append(OAuth20Constants.ACCESS_TOKEN) .append('=') .append(accessToken.getId()) .append('&') .append(OAuth20Constants.TOKEN_TYPE) .append('=') .append(OAuth20Constants.TOKEN_TYPE_BEARER) .append('&') .append(OAuth20Constants.EXPIRES_IN) .append('=') .append(timeToLive); if (refreshToken != null) { stringBuilder.append('&') .append(OAuth20Constants.REFRESH_TOKEN) .append('=') .append(refreshToken.getId()); } params.forEach(p -> stringBuilder.append('&') .append(p.getName()) .append('=') .append(p.getValue())); if (StringUtils.isNotBlank(state)) { stringBuilder.append('&') .append(OAuth20Constants.STATE) .append('=') .append(EncodingUtils.urlEncode(state)); } if (StringUtils.isNotBlank(nonce)) { stringBuilder.append('&') .append(OAuth20Constants.NONCE) .append('=') .append(EncodingUtils.urlEncode(nonce)); } builder.setFragment(stringBuilder.toString()); val url = builder.toString(); LOGGER.debug("Redirecting to URL [{}]", url); val parameters = new LinkedHashMap<String, String>(); parameters.put(OAuth20Constants.ACCESS_TOKEN, accessToken.getId()); if (refreshToken != null) { parameters.put(OAuth20Constants.REFRESH_TOKEN, refreshToken.getId()); } parameters.put(OAuth20Constants.EXPIRES_IN, timeToLive.toString()); parameters.put(OAuth20Constants.STATE, state); parameters.put(OAuth20Constants.NONCE, nonce); parameters.put(OAuth20Constants.CLIENT_ID, accessToken.getClientId()); return buildResponseModelAndView(context, servicesManager, accessToken.getClientId(), url, parameters); }
[ "protected", "ModelAndView", "buildCallbackUrlResponseType", "(", "final", "AccessTokenRequestDataHolder", "holder", ",", "final", "String", "redirectUri", ",", "final", "AccessToken", "accessToken", ",", "final", "List", "<", "NameValuePair", ">", "params", ",", "final...
Build callback url response type string. @param holder the holder @param redirectUri the redirect uri @param accessToken the access token @param params the params @param refreshToken the refresh token @param context the context @return the string @throws Exception the exception
[ "Build", "callback", "url", "response", "type", "string", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/callback/OAuth20TokenAuthorizationResponseBuilder.java#L67-L131
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java
EsMarshalling.unmarshallPlanVersion
public static PlanVersionBean unmarshallPlanVersion(Map<String, Object> source) { if (source == null) { return null; } PlanVersionBean bean = new PlanVersionBean(); bean.setVersion(asString(source.get("version"))); bean.setStatus(asEnum(source.get("status"), PlanStatus.class)); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setCreatedOn(asDate(source.get("createdOn"))); bean.setModifiedBy(asString(source.get("modifiedBy"))); bean.setModifiedOn(asDate(source.get("modifiedOn"))); bean.setLockedOn(asDate(source.get("lockedOn"))); postMarshall(bean); return bean; }
java
public static PlanVersionBean unmarshallPlanVersion(Map<String, Object> source) { if (source == null) { return null; } PlanVersionBean bean = new PlanVersionBean(); bean.setVersion(asString(source.get("version"))); bean.setStatus(asEnum(source.get("status"), PlanStatus.class)); bean.setCreatedBy(asString(source.get("createdBy"))); bean.setCreatedOn(asDate(source.get("createdOn"))); bean.setModifiedBy(asString(source.get("modifiedBy"))); bean.setModifiedOn(asDate(source.get("modifiedOn"))); bean.setLockedOn(asDate(source.get("lockedOn"))); postMarshall(bean); return bean; }
[ "public", "static", "PlanVersionBean", "unmarshallPlanVersion", "(", "Map", "<", "String", ",", "Object", ">", "source", ")", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "PlanVersionBean", "bean", "=", "new", "PlanVersionBea...
Unmarshals the given map source into a bean. @param source the source @return the plan version
[ "Unmarshals", "the", "given", "map", "source", "into", "a", "bean", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L864-L878
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java
ElementFilter.exportsIn
public static List<ExportsDirective> exportsIn(Iterable<? extends Directive> directives) { return listFilter(directives, DirectiveKind.EXPORTS, ExportsDirective.class); }
java
public static List<ExportsDirective> exportsIn(Iterable<? extends Directive> directives) { return listFilter(directives, DirectiveKind.EXPORTS, ExportsDirective.class); }
[ "public", "static", "List", "<", "ExportsDirective", ">", "exportsIn", "(", "Iterable", "<", "?", "extends", "Directive", ">", "directives", ")", "{", "return", "listFilter", "(", "directives", ",", "DirectiveKind", ".", "EXPORTS", ",", "ExportsDirective", ".", ...
Returns a list of {@code exports} directives in {@code directives}. @return a list of {@code exports} directives in {@code directives} @param directives the directives to filter @since 9 @spec JPMS
[ "Returns", "a", "list", "of", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L243-L246
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ClassUtils.java
ClassUtils.isAssignable
@GwtIncompatible("incompatible method") public static boolean isAssignable(final Class<?>[] classArray, final Class<?>... toClassArray) { return isAssignable(classArray, toClassArray, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5)); }
java
@GwtIncompatible("incompatible method") public static boolean isAssignable(final Class<?>[] classArray, final Class<?>... toClassArray) { return isAssignable(classArray, toClassArray, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5)); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "boolean", "isAssignable", "(", "final", "Class", "<", "?", ">", "[", "]", "classArray", ",", "final", "Class", "<", "?", ">", "...", "toClassArray", ")", "{", "return", "isAssi...
<p>Checks if an array of Classes can be assigned to another array of Classes.</p> <p>This method calls {@link #isAssignable(Class, Class) isAssignable} for each Class pair in the input arrays. It can be used to check if a set of arguments (the first parameter) are suitably compatible with a set of method parameter types (the second parameter).</p> <p>Unlike the {@link Class#isAssignableFrom(java.lang.Class)} method, this method takes into account widenings of primitive classes and {@code null}s.</p> <p>Primitive widenings allow an int to be assigned to a {@code long}, {@code float} or {@code double}. This method returns the correct result for these cases.</p> <p>{@code Null} may be assigned to any reference type. This method will return {@code true} if {@code null} is passed in and the toClass is non-primitive.</p> <p>Specifically, this method tests whether the type represented by the specified {@code Class} parameter can be converted to the type represented by this {@code Class} object via an identity conversion widening primitive or widening reference conversion. See <em><a href="http://docs.oracle.com/javase/specs/">The Java Language Specification</a></em>, sections 5.1.1, 5.1.2 and 5.1.4 for details.</p> <p><strong>Since Lang 3.0,</strong> this method will default behavior for calculating assignability between primitive and wrapper types <em>corresponding to the running Java version</em>; i.e. autoboxing will be the default behavior in VMs running Java versions &gt; 1.5.</p> @param classArray the array of Classes to check, may be {@code null} @param toClassArray the array of Classes to try to assign into, may be {@code null} @return {@code true} if assignment possible
[ "<p", ">", "Checks", "if", "an", "array", "of", "Classes", "can", "be", "assigned", "to", "another", "array", "of", "Classes", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L648-L651
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_options_PUT
public void billingAccount_line_serviceName_options_PUT(String billingAccount, String serviceName, OvhLineOptions body) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/options"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_line_serviceName_options_PUT(String billingAccount, String serviceName, OvhLineOptions body) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/options"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_line_serviceName_options_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhLineOptions", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/line/{serviceName}/options\""...
Alter this object properties REST: PUT /telephony/{billingAccount}/line/{serviceName}/options @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1710-L1714
hubrick/vertx-rest-client
src/main/java/com/hubrick/vertx/rest/RestClientOptions.java
RestClientOptions.putGlobalHeader
public RestClientOptions putGlobalHeader(String name, String value) { globalHeaders.add(name, value); return this; }
java
public RestClientOptions putGlobalHeader(String name, String value) { globalHeaders.add(name, value); return this; }
[ "public", "RestClientOptions", "putGlobalHeader", "(", "String", "name", ",", "String", "value", ")", "{", "globalHeaders", ".", "add", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add a global header which will be appended to every HTTP request. The headers defined per request will override this headers. @param name The name of the header @param value The value of the header @return a reference to this so multiple method calls can be chained together
[ "Add", "a", "global", "header", "which", "will", "be", "appended", "to", "every", "HTTP", "request", ".", "The", "headers", "defined", "per", "request", "will", "override", "this", "headers", "." ]
train
https://github.com/hubrick/vertx-rest-client/blob/4e6715bc2fb031555fc635adbf94a53b9cfba81e/src/main/java/com/hubrick/vertx/rest/RestClientOptions.java#L134-L137
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/grpc/UfsFallbackBlockWriteHandler.java
UfsFallbackBlockWriteHandler.transferToUfsBlock
private void transferToUfsBlock(BlockWriteRequestContext context, long pos) throws Exception { OutputStream ufsOutputStream = context.getOutputStream(); long sessionId = context.getRequest().getSessionId(); long blockId = context.getRequest().getId(); TempBlockMeta block = mWorker.getBlockStore().getTempBlockMeta(sessionId, blockId); if (block == null) { throw new NotFoundException("block " + blockId + " not found"); } Preconditions.checkState(Files.copy(Paths.get(block.getPath()), ufsOutputStream) == pos); }
java
private void transferToUfsBlock(BlockWriteRequestContext context, long pos) throws Exception { OutputStream ufsOutputStream = context.getOutputStream(); long sessionId = context.getRequest().getSessionId(); long blockId = context.getRequest().getId(); TempBlockMeta block = mWorker.getBlockStore().getTempBlockMeta(sessionId, blockId); if (block == null) { throw new NotFoundException("block " + blockId + " not found"); } Preconditions.checkState(Files.copy(Paths.get(block.getPath()), ufsOutputStream) == pos); }
[ "private", "void", "transferToUfsBlock", "(", "BlockWriteRequestContext", "context", ",", "long", "pos", ")", "throws", "Exception", "{", "OutputStream", "ufsOutputStream", "=", "context", ".", "getOutputStream", "(", ")", ";", "long", "sessionId", "=", "context", ...
Transfers data from block store to UFS. @param context context of this request @param pos number of bytes in block store to write in the UFS block
[ "Transfers", "data", "from", "block", "store", "to", "UFS", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/grpc/UfsFallbackBlockWriteHandler.java#L242-L252
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processPredecessor
private void processPredecessor(Task task, MapRow row) { Task predecessor = m_taskMap.get(row.getUUID("PREDECESSOR_UUID")); if (predecessor != null) { task.addPredecessor(predecessor, row.getRelationType("RELATION_TYPE"), row.getDuration("LAG")); } }
java
private void processPredecessor(Task task, MapRow row) { Task predecessor = m_taskMap.get(row.getUUID("PREDECESSOR_UUID")); if (predecessor != null) { task.addPredecessor(predecessor, row.getRelationType("RELATION_TYPE"), row.getDuration("LAG")); } }
[ "private", "void", "processPredecessor", "(", "Task", "task", ",", "MapRow", "row", ")", "{", "Task", "predecessor", "=", "m_taskMap", ".", "get", "(", "row", ".", "getUUID", "(", "\"PREDECESSOR_UUID\"", ")", ")", ";", "if", "(", "predecessor", "!=", "null...
Extract data for a single predecessor. @param task parent task @param row Synchro predecessor data
[ "Extract", "data", "for", "a", "single", "predecessor", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L396-L403
OpenLiberty/open-liberty
dev/com.ibm.rls.jdbc/src/com/ibm/rls/jdbc/SQLRecoveryLogFactory.java
SQLRecoveryLogFactory.createRecoveryLog
@Override public RecoveryLog createRecoveryLog(CustomLogProperties props, RecoveryAgent agent, RecoveryLogComponent logComp, FailureScope fs) throws InvalidLogPropertiesException { if (tc.isEntryEnabled()) Tr.entry(tc, "createRecoveryLog", new Object[] { props, agent, logComp, fs }); SQLMultiScopeRecoveryLog theLog = new SQLMultiScopeRecoveryLog(props, agent, fs); if (tc.isEntryEnabled()) Tr.exit(tc, "createRecoveryLog", theLog); return theLog; }
java
@Override public RecoveryLog createRecoveryLog(CustomLogProperties props, RecoveryAgent agent, RecoveryLogComponent logComp, FailureScope fs) throws InvalidLogPropertiesException { if (tc.isEntryEnabled()) Tr.entry(tc, "createRecoveryLog", new Object[] { props, agent, logComp, fs }); SQLMultiScopeRecoveryLog theLog = new SQLMultiScopeRecoveryLog(props, agent, fs); if (tc.isEntryEnabled()) Tr.exit(tc, "createRecoveryLog", theLog); return theLog; }
[ "@", "Override", "public", "RecoveryLog", "createRecoveryLog", "(", "CustomLogProperties", "props", ",", "RecoveryAgent", "agent", ",", "RecoveryLogComponent", "logComp", ",", "FailureScope", "fs", ")", "throws", "InvalidLogPropertiesException", "{", "if", "(", "tc", ...
/* createRecoveryLog @param props properties to be associated with the new recovery log (eg DBase config) @param agent RecoveryAgent which provides client service data eg clientId @param logcomp RecoveryLogComponent which can be used by the recovery log to notify failures @param failureScope the failurescope (server) for which this log is to be created @return RecoveryLog or MultiScopeLog to be used for logging @exception InvalidLogPropertiesException thrown if the properties are not consistent with the logFactory
[ "/", "*", "createRecoveryLog" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.rls.jdbc/src/com/ibm/rls/jdbc/SQLRecoveryLogFactory.java#L67-L77
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/reflect/TypeMatcher.java
TypeMatcher.matchValueByName
public static boolean matchValueByName(String expectedType, Object actualValue) { if (expectedType == null) return true; if (actualValue == null) throw new NullPointerException("Actual value cannot be null"); return matchTypeByName(expectedType, actualValue.getClass()); }
java
public static boolean matchValueByName(String expectedType, Object actualValue) { if (expectedType == null) return true; if (actualValue == null) throw new NullPointerException("Actual value cannot be null"); return matchTypeByName(expectedType, actualValue.getClass()); }
[ "public", "static", "boolean", "matchValueByName", "(", "String", "expectedType", ",", "Object", "actualValue", ")", "{", "if", "(", "expectedType", "==", "null", ")", "return", "true", ";", "if", "(", "actualValue", "==", "null", ")", "throw", "new", "NullP...
Matches expected type to a type of a value. @param expectedType an expected type name to match. @param actualValue a value to match its type to the expected one. @return true if types are matching and false if they don't.
[ "Matches", "expected", "type", "to", "a", "type", "of", "a", "value", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/TypeMatcher.java#L74-L81
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/gsi/GlobusCredential.java
GlobusCredential.verify
public void verify() throws GlobusCredentialException { try { String caCertsLocation = "file:" + CoGProperties.getDefault().getCaCertLocations(); String crlPattern = caCertsLocation + "/*.r*"; String sigPolPattern = caCertsLocation + "/*.signing_policy"; KeyStore keyStore = KeyStore.getInstance(GlobusProvider.KEYSTORE_TYPE, GlobusProvider.PROVIDER_NAME); CertStore crlStore = CertStore.getInstance(GlobusProvider.CERTSTORE_TYPE, new ResourceCertStoreParameters(null,crlPattern)); ResourceSigningPolicyStore sigPolStore = new ResourceSigningPolicyStore(new ResourceSigningPolicyStoreParameters(sigPolPattern)); keyStore.load(KeyStoreParametersFactory.createTrustStoreParameters(caCertsLocation)); X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(keyStore, crlStore, sigPolStore, false); X509ProxyCertPathValidator validator = new X509ProxyCertPathValidator(); validator.engineValidate(CertificateUtil.getCertPath(this.cred.getCertificateChain()), parameters); } catch (Exception e) { e.printStackTrace(); throw new GlobusCredentialException(GlobusCredentialException.FAILURE, e.getMessage(), e); } }
java
public void verify() throws GlobusCredentialException { try { String caCertsLocation = "file:" + CoGProperties.getDefault().getCaCertLocations(); String crlPattern = caCertsLocation + "/*.r*"; String sigPolPattern = caCertsLocation + "/*.signing_policy"; KeyStore keyStore = KeyStore.getInstance(GlobusProvider.KEYSTORE_TYPE, GlobusProvider.PROVIDER_NAME); CertStore crlStore = CertStore.getInstance(GlobusProvider.CERTSTORE_TYPE, new ResourceCertStoreParameters(null,crlPattern)); ResourceSigningPolicyStore sigPolStore = new ResourceSigningPolicyStore(new ResourceSigningPolicyStoreParameters(sigPolPattern)); keyStore.load(KeyStoreParametersFactory.createTrustStoreParameters(caCertsLocation)); X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(keyStore, crlStore, sigPolStore, false); X509ProxyCertPathValidator validator = new X509ProxyCertPathValidator(); validator.engineValidate(CertificateUtil.getCertPath(this.cred.getCertificateChain()), parameters); } catch (Exception e) { e.printStackTrace(); throw new GlobusCredentialException(GlobusCredentialException.FAILURE, e.getMessage(), e); } }
[ "public", "void", "verify", "(", ")", "throws", "GlobusCredentialException", "{", "try", "{", "String", "caCertsLocation", "=", "\"file:\"", "+", "CoGProperties", ".", "getDefault", "(", ")", ".", "getCaCertLocations", "(", ")", ";", "String", "crlPattern", "=",...
Verifies the validity of the credentials. All certificate path validation is performed using trusted certificates in default locations. @exception GlobusCredentialException if one of the certificates in the chain expired or if path validiation fails.
[ "Verifies", "the", "validity", "of", "the", "credentials", ".", "All", "certificate", "path", "validation", "is", "performed", "using", "trusted", "certificates", "in", "default", "locations", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/GlobusCredential.java#L158-L174
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseKeepAliveEnabled
private void parseKeepAliveEnabled(Map<Object, Object> props) { boolean flag = this.bKeepAliveEnabled; Object value = props.get(HttpConfigConstants.PROPNAME_KEEPALIVE_ENABLED); if (null != value) { flag = convertBoolean(value); } this.bKeepAliveEnabled = flag; if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: KeepAliveEnabled is " + isKeepAliveEnabled()); } }
java
private void parseKeepAliveEnabled(Map<Object, Object> props) { boolean flag = this.bKeepAliveEnabled; Object value = props.get(HttpConfigConstants.PROPNAME_KEEPALIVE_ENABLED); if (null != value) { flag = convertBoolean(value); } this.bKeepAliveEnabled = flag; if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: KeepAliveEnabled is " + isKeepAliveEnabled()); } }
[ "private", "void", "parseKeepAliveEnabled", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "boolean", "flag", "=", "this", ".", "bKeepAliveEnabled", ";", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNA...
Check the input configuration for the default flag on whether to use persistent connections or not. If this is false, then the other related configuration values will be ignored (such as MaxKeepAliveRequests). @param props
[ "Check", "the", "input", "configuration", "for", "the", "default", "flag", "on", "whether", "to", "use", "persistent", "connections", "or", "not", ".", "If", "this", "is", "false", "then", "the", "other", "related", "configuration", "values", "will", "be", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L490-L500
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/protocol/authentication/DefaultAuthenticationProvider.java
DefaultAuthenticationProvider.processAuthPlugin
public static AuthenticationPlugin processAuthPlugin(String plugin, String password, byte[] authData, Options options) throws SQLException { switch (plugin) { case MYSQL_NATIVE_PASSWORD: return new NativePasswordPlugin(password, authData, options.passwordCharacterEncoding); case MYSQL_OLD_PASSWORD: return new OldPasswordPlugin(password, authData); case MYSQL_CLEAR_PASSWORD: return new ClearPasswordPlugin(password, options.passwordCharacterEncoding); case DIALOG: return new SendPamAuthPacket(password, authData, options.passwordCharacterEncoding); case GSSAPI_CLIENT: return new SendGssApiAuthPacket(authData, options.servicePrincipalName); case MYSQL_ED25519_PASSWORD: return new Ed25519PasswordPlugin(password, authData, options.passwordCharacterEncoding); default: throw new SQLException( "Client does not support authentication protocol requested by server. " + "Consider upgrading MariaDB client. plugin was = " + plugin, "08004", 1251); } }
java
public static AuthenticationPlugin processAuthPlugin(String plugin, String password, byte[] authData, Options options) throws SQLException { switch (plugin) { case MYSQL_NATIVE_PASSWORD: return new NativePasswordPlugin(password, authData, options.passwordCharacterEncoding); case MYSQL_OLD_PASSWORD: return new OldPasswordPlugin(password, authData); case MYSQL_CLEAR_PASSWORD: return new ClearPasswordPlugin(password, options.passwordCharacterEncoding); case DIALOG: return new SendPamAuthPacket(password, authData, options.passwordCharacterEncoding); case GSSAPI_CLIENT: return new SendGssApiAuthPacket(authData, options.servicePrincipalName); case MYSQL_ED25519_PASSWORD: return new Ed25519PasswordPlugin(password, authData, options.passwordCharacterEncoding); default: throw new SQLException( "Client does not support authentication protocol requested by server. " + "Consider upgrading MariaDB client. plugin was = " + plugin, "08004", 1251); } }
[ "public", "static", "AuthenticationPlugin", "processAuthPlugin", "(", "String", "plugin", ",", "String", "password", ",", "byte", "[", "]", "authData", ",", "Options", "options", ")", "throws", "SQLException", "{", "switch", "(", "plugin", ")", "{", "case", "M...
Process AuthenticationSwitch. @param plugin plugin name @param password password @param authData auth data @param options connection string options @return authentication response according to parameters @throws SQLException if error occur.
[ "Process", "AuthenticationSwitch", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/authentication/DefaultAuthenticationProvider.java#L86-L110
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CciConnFactoryCodeGen.java
CciConnFactoryCodeGen.writeConnection
private void writeConnection(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Gets a connection to an EIS instance. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Connection instance the EIS instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get a connection to\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public Connection getConnection() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnClass() + "(new " + def.getMcfDefs() .get(getNumOfMcf()).getConnSpecClass() + "());"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Gets a connection to an EIS instance. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param connSpec Connection parameters and security information specified as " + "ConnectionSpec instance\n"); writeWithIndent(out, indent, " * @return Connection instance the EIS instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get a connection to\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public Connection getConnection(ConnectionSpec connSpec) throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnClass() + "(connSpec);"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeConnection(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Gets a connection to an EIS instance. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return Connection instance the EIS instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get a connection to\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public Connection getConnection() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnClass() + "(new " + def.getMcfDefs() .get(getNumOfMcf()).getConnSpecClass() + "());"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Gets a connection to an EIS instance. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param connSpec Connection parameters and security information specified as " + "ConnectionSpec instance\n"); writeWithIndent(out, indent, " * @return Connection instance the EIS instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException Failed to get a connection to\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public Connection getConnection(ConnectionSpec connSpec) throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "return new " + def.getMcfDefs().get(getNumOfMcf()).getCciConnClass() + "(connSpec);"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeConnection", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "ind...
Output Connection method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "Connection", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CciConnFactoryCodeGen.java#L117-L153
sagiegurari/fax4j
src/main/java/org/fax4j/bridge/AbstractRequestParser.java
AbstractRequestParser.updateFaxJobFromInputData
public void updateFaxJobFromInputData(T inputData,FaxJob faxJob) { if(!this.initialized) { throw new FaxException("Fax bridge not initialized."); } //get fax job this.updateFaxJobFromInputDataImpl(inputData,faxJob); }
java
public void updateFaxJobFromInputData(T inputData,FaxJob faxJob) { if(!this.initialized) { throw new FaxException("Fax bridge not initialized."); } //get fax job this.updateFaxJobFromInputDataImpl(inputData,faxJob); }
[ "public", "void", "updateFaxJobFromInputData", "(", "T", "inputData", ",", "FaxJob", "faxJob", ")", "{", "if", "(", "!", "this", ".", "initialized", ")", "{", "throw", "new", "FaxException", "(", "\"Fax bridge not initialized.\"", ")", ";", "}", "//get fax job",...
This function update the fax job from the input data.<br> This fax job will not have any file data. @param inputData The input data @param faxJob The fax job to update
[ "This", "function", "update", "the", "fax", "job", "from", "the", "input", "data", ".", "<br", ">", "This", "fax", "job", "will", "not", "have", "any", "file", "data", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/bridge/AbstractRequestParser.java#L82-L91
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/LegacyAddress.java
LegacyAddress.fromPubKeyHash
public static LegacyAddress fromPubKeyHash(NetworkParameters params, byte[] hash160) throws AddressFormatException { return new LegacyAddress(params, false, hash160); }
java
public static LegacyAddress fromPubKeyHash(NetworkParameters params, byte[] hash160) throws AddressFormatException { return new LegacyAddress(params, false, hash160); }
[ "public", "static", "LegacyAddress", "fromPubKeyHash", "(", "NetworkParameters", "params", ",", "byte", "[", "]", "hash160", ")", "throws", "AddressFormatException", "{", "return", "new", "LegacyAddress", "(", "params", ",", "false", ",", "hash160", ")", ";", "}...
Construct a {@link LegacyAddress} that represents the given pubkey hash. The resulting address will be a P2PKH type of address. @param params network this address is valid for @param hash160 20-byte pubkey hash @return constructed address
[ "Construct", "a", "{", "@link", "LegacyAddress", "}", "that", "represents", "the", "given", "pubkey", "hash", ".", "The", "resulting", "address", "will", "be", "a", "P2PKH", "type", "of", "address", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/LegacyAddress.java#L84-L86
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/upsert/AbstractUpsertPlugin.java
AbstractUpsertPlugin.addSingleUpsertToSqlMap
protected void addSingleUpsertToSqlMap(Document document, IntrospectedTable introspectedTable) { XmlElement update = new XmlElement("update"); update.addAttribute(new Attribute("id", UPSERT)); update.addAttribute(new Attribute("parameterType", "map")); generateSqlMapContent(introspectedTable, update); document.getRootElement().addElement(update); }
java
protected void addSingleUpsertToSqlMap(Document document, IntrospectedTable introspectedTable) { XmlElement update = new XmlElement("update"); update.addAttribute(new Attribute("id", UPSERT)); update.addAttribute(new Attribute("parameterType", "map")); generateSqlMapContent(introspectedTable, update); document.getRootElement().addElement(update); }
[ "protected", "void", "addSingleUpsertToSqlMap", "(", "Document", "document", ",", "IntrospectedTable", "introspectedTable", ")", "{", "XmlElement", "update", "=", "new", "XmlElement", "(", "\"update\"", ")", ";", "update", ".", "addAttribute", "(", "new", "Attribute...
add update xml element to mapper.xml for upsert @param document The generated xml mapper dom @param introspectedTable The metadata for database table
[ "add", "update", "xml", "element", "to", "mapper", ".", "xml", "for", "upsert" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/plugin/upsert/AbstractUpsertPlugin.java#L91-L99
authorjapps/zerocode
core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java
BasicHttpClient.handleHeaders
public RequestBuilder handleHeaders(Map<String, Object> headers, RequestBuilder requestBuilder) { Map<String, Object> amendedHeaders = amendRequestHeaders(headers); processFrameworkDefault(amendedHeaders, requestBuilder); return requestBuilder; }
java
public RequestBuilder handleHeaders(Map<String, Object> headers, RequestBuilder requestBuilder) { Map<String, Object> amendedHeaders = amendRequestHeaders(headers); processFrameworkDefault(amendedHeaders, requestBuilder); return requestBuilder; }
[ "public", "RequestBuilder", "handleHeaders", "(", "Map", "<", "String", ",", "Object", ">", "headers", ",", "RequestBuilder", "requestBuilder", ")", "{", "Map", "<", "String", ",", "Object", ">", "amendedHeaders", "=", "amendRequestHeaders", "(", "headers", ")",...
The framework will fall back to this default implementation to handle the headers. If you want to override any headers, you can do that by overriding the amendRequestHeaders(headers) method. @param headers @param requestBuilder @return : An effective Apache http request builder object with processed headers.
[ "The", "framework", "will", "fall", "back", "to", "this", "default", "implementation", "to", "handle", "the", "headers", ".", "If", "you", "want", "to", "override", "any", "headers", "you", "can", "do", "that", "by", "overriding", "the", "amendRequestHeaders",...
train
https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java#L236-L240
OpenLiberty/open-liberty
dev/com.ibm.ws.springboot.utility/src/com/ibm/ws/springboot/utility/tasks/BaseCommandTask.java
BaseCommandTask.validateArgumentList
protected void validateArgumentList(String[] args) { checkRequiredArguments(args); // Skip the first argument as it is the task name // Arguments and values come in pairs (expect -password). // Anything outside of that pattern is invalid. // Loop through, jumping in pairs except when we encounter // -password -- that may be an interactive prompt which won't // define a value. for (int i = 1; i < args.length; i++) { String argPair = args[i]; String arg = null; String value = null; if (argPair.contains("=")) { arg = argPair.split("=")[0]; value = getValue(argPair); } else { arg = argPair; } if (!isKnownArgument(arg)) { throw new IllegalArgumentException(getMessage("invalidArg", arg)); } else { if (value == null) { throw new IllegalArgumentException(getMessage("missingValue", arg)); } } } }
java
protected void validateArgumentList(String[] args) { checkRequiredArguments(args); // Skip the first argument as it is the task name // Arguments and values come in pairs (expect -password). // Anything outside of that pattern is invalid. // Loop through, jumping in pairs except when we encounter // -password -- that may be an interactive prompt which won't // define a value. for (int i = 1; i < args.length; i++) { String argPair = args[i]; String arg = null; String value = null; if (argPair.contains("=")) { arg = argPair.split("=")[0]; value = getValue(argPair); } else { arg = argPair; } if (!isKnownArgument(arg)) { throw new IllegalArgumentException(getMessage("invalidArg", arg)); } else { if (value == null) { throw new IllegalArgumentException(getMessage("missingValue", arg)); } } } }
[ "protected", "void", "validateArgumentList", "(", "String", "[", "]", "args", ")", "{", "checkRequiredArguments", "(", "args", ")", ";", "// Skip the first argument as it is the task name", "// Arguments and values come in pairs (expect -password).", "// Anything outside of that pa...
Validates that there are no unknown arguments or values specified to the task. @param args The script arguments @throws IllegalArgumentException if an argument is defined is unknown
[ "Validates", "that", "there", "are", "no", "unknown", "arguments", "or", "values", "specified", "to", "the", "task", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.springboot.utility/src/com/ibm/ws/springboot/utility/tasks/BaseCommandTask.java#L196-L224
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/internal/EC2CredentialsUtils.java
EC2CredentialsUtils.readResource
public String readResource(URI endpoint) throws IOException { return readResource(endpoint, CredentialsEndpointRetryPolicy.NO_RETRY, null); }
java
public String readResource(URI endpoint) throws IOException { return readResource(endpoint, CredentialsEndpointRetryPolicy.NO_RETRY, null); }
[ "public", "String", "readResource", "(", "URI", "endpoint", ")", "throws", "IOException", "{", "return", "readResource", "(", "endpoint", ",", "CredentialsEndpointRetryPolicy", ".", "NO_RETRY", ",", "null", ")", ";", "}" ]
Connects to the given endpoint to read the resource and returns the text contents. If the connection fails, the request will not be retried. @param endpoint The service endpoint to connect to. @return The text payload returned from the Amazon EC2 endpoint service for the specified resource path. @throws IOException If any problems were encountered while connecting to the service for the requested resource path. @throws SdkClientException If the requested service is not found.
[ "Connects", "to", "the", "given", "endpoint", "to", "read", "the", "resource", "and", "returns", "the", "text", "contents", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/internal/EC2CredentialsUtils.java#L81-L83
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.getView
public View getView(int id, int timeout) { View v = null; int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for (int i = 0; i < retryNum; i++) { try { v = super.getView(id); } catch (Exception e) {} if (v != null) { break; } this.sleep(RETRY_PERIOD); } return v; }
java
public View getView(int id, int timeout) { View v = null; int RETRY_PERIOD = 250; int retryNum = timeout / RETRY_PERIOD; for (int i = 0; i < retryNum; i++) { try { v = super.getView(id); } catch (Exception e) {} if (v != null) { break; } this.sleep(RETRY_PERIOD); } return v; }
[ "public", "View", "getView", "(", "int", "id", ",", "int", "timeout", ")", "{", "View", "v", "=", "null", ";", "int", "RETRY_PERIOD", "=", "250", ";", "int", "retryNum", "=", "timeout", "/", "RETRY_PERIOD", ";", "for", "(", "int", "i", "=", "0", ";...
Extend the normal robotium getView to retry every 250ms over 10s to get the view requested @param id Resource id of the view @param timeout amount of time to retry getting the view @return View that we want to find by id
[ "Extend", "the", "normal", "robotium", "getView", "to", "retry", "every", "250ms", "over", "10s", "to", "get", "the", "view", "requested" ]
train
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L114-L130
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/simple/RDBMUserLayoutStore.java
RDBMUserLayoutStore.getLayoutID
private int getLayoutID(final int userId, final int profileId) { return jdbcOperations.execute( (ConnectionCallback<Integer>) con -> { String query = "SELECT LAYOUT_ID " + "FROM UP_USER_PROFILE " + "WHERE USER_ID=? AND PROFILE_ID=?"; int layoutId = 0; PreparedStatement pstmt = con.prepareStatement(query); logger.debug( "getLayoutID(userId={}, profileId={} ): {}", userId, profileId, query); pstmt.setInt(1, userId); pstmt.setInt(2, profileId); try { ResultSet rs = pstmt.executeQuery(); if (rs.next()) { layoutId = rs.getInt(1); if (rs.wasNull()) { layoutId = 0; } } } finally { pstmt.close(); } return layoutId; }); }
java
private int getLayoutID(final int userId, final int profileId) { return jdbcOperations.execute( (ConnectionCallback<Integer>) con -> { String query = "SELECT LAYOUT_ID " + "FROM UP_USER_PROFILE " + "WHERE USER_ID=? AND PROFILE_ID=?"; int layoutId = 0; PreparedStatement pstmt = con.prepareStatement(query); logger.debug( "getLayoutID(userId={}, profileId={} ): {}", userId, profileId, query); pstmt.setInt(1, userId); pstmt.setInt(2, profileId); try { ResultSet rs = pstmt.executeQuery(); if (rs.next()) { layoutId = rs.getInt(1); if (rs.wasNull()) { layoutId = 0; } } } finally { pstmt.close(); } return layoutId; }); }
[ "private", "int", "getLayoutID", "(", "final", "int", "userId", ",", "final", "int", "profileId", ")", "{", "return", "jdbcOperations", ".", "execute", "(", "(", "ConnectionCallback", "<", "Integer", ">", ")", "con", "->", "{", "String", "query", "=", "\"S...
Returns the current layout ID for the user and profile. If the profile doesn't exist or the layout_id field is null 0 is returned. @param userId The userId for the profile @param profileId The profileId for the profile @return The layout_id field or 0 if it does not exist or is null
[ "Returns", "the", "current", "layout", "ID", "for", "the", "user", "and", "profile", ".", "If", "the", "profile", "doesn", "t", "exist", "or", "the", "layout_id", "field", "is", "null", "0", "is", "returned", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/simple/RDBMUserLayoutStore.java#L1491-L1525
davidmoten/rxjava-jdbc
src/main/java/com/github/davidmoten/rx/jdbc/QuerySelect.java
QuerySelect.executeOnce
private <T> Func1<List<Parameter>, Observable<T>> executeOnce( final ResultSetMapper<? extends T> function) { return new Func1<List<Parameter>, Observable<T>>() { @Override public Observable<T> call(List<Parameter> params) { return executeOnce(params, function); } }; }
java
private <T> Func1<List<Parameter>, Observable<T>> executeOnce( final ResultSetMapper<? extends T> function) { return new Func1<List<Parameter>, Observable<T>>() { @Override public Observable<T> call(List<Parameter> params) { return executeOnce(params, function); } }; }
[ "private", "<", "T", ">", "Func1", "<", "List", "<", "Parameter", ">", ",", "Observable", "<", "T", ">", ">", "executeOnce", "(", "final", "ResultSetMapper", "<", "?", "extends", "T", ">", "function", ")", "{", "return", "new", "Func1", "<", "List", ...
Returns a {@link Func1} that itself returns the results of pushing one set of parameters through a select query. @param query @return
[ "Returns", "a", "{", "@link", "Func1", "}", "that", "itself", "returns", "the", "results", "of", "pushing", "one", "set", "of", "parameters", "through", "a", "select", "query", "." ]
train
https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QuerySelect.java#L118-L126
structurizr/java
structurizr-core/src/com/structurizr/model/Container.java
Container.addComponent
public Component addComponent(String name, String description) { return this.addComponent(name, description, null); }
java
public Component addComponent(String name, String description) { return this.addComponent(name, description, null); }
[ "public", "Component", "addComponent", "(", "String", "name", ",", "String", "description", ")", "{", "return", "this", ".", "addComponent", "(", "name", ",", "description", ",", "null", ")", ";", "}" ]
Adds a component to this container. @param name the name of the component @param description a description of the component @return the resulting Component instance @throws IllegalArgumentException if the component name is null or empty, or a component with the same name already exists
[ "Adds", "a", "component", "to", "this", "container", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Container.java#L72-L74
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java
DefaultComparisonFormatter.getFormattedNodeXml
protected String getFormattedNodeXml(final Node nodeToConvert, boolean formatXml) { String formattedNodeXml; try { final int numberOfBlanksToIndent = formatXml ? 2 : -1; final Transformer transformer = createXmlTransformer(numberOfBlanksToIndent); final StringWriter buffer = new StringWriter(); transformer.transform(new DOMSource(nodeToConvert), new StreamResult(buffer)); formattedNodeXml = buffer.toString(); } catch (final Exception e) { formattedNodeXml = "ERROR " + e.getMessage(); } return formattedNodeXml; }
java
protected String getFormattedNodeXml(final Node nodeToConvert, boolean formatXml) { String formattedNodeXml; try { final int numberOfBlanksToIndent = formatXml ? 2 : -1; final Transformer transformer = createXmlTransformer(numberOfBlanksToIndent); final StringWriter buffer = new StringWriter(); transformer.transform(new DOMSource(nodeToConvert), new StreamResult(buffer)); formattedNodeXml = buffer.toString(); } catch (final Exception e) { formattedNodeXml = "ERROR " + e.getMessage(); } return formattedNodeXml; }
[ "protected", "String", "getFormattedNodeXml", "(", "final", "Node", "nodeToConvert", ",", "boolean", "formatXml", ")", "{", "String", "formattedNodeXml", ";", "try", "{", "final", "int", "numberOfBlanksToIndent", "=", "formatXml", "?", "2", ":", "-", "1", ";", ...
Formats a node with the help of an identity XML transformation. @param nodeToConvert the node to format @param formatXml true if the Comparison was generated with {@link org.xmlunit.builder.DiffBuilder#ignoreWhitespace()} - this affects the indentation of the generated output @return the fomatted XML @since XMLUnit 2.4.0
[ "Formats", "a", "node", "with", "the", "help", "of", "an", "identity", "XML", "transformation", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java#L433-L445
GCRC/nunaliit
nunaliit2-auth-cookie/src/main/java/ca/carleton/gcrc/auth/cookie/AuthServlet.java
AuthServlet.performAdjustCookies
private void performAdjustCookies(HttpServletRequest request, HttpServletResponse response) throws Exception { boolean loggedIn = false; User user = null; try { Cookie cookie = getCookieFromRequest(request); if( null != cookie ) { user = CookieAuthentication.verifyCookieString(userRepository, cookie.getValue()); loggedIn = true; } } catch(Exception e) { // Ignore } if( null == user ) { user = userRepository.getDefaultUser(); } acceptRequest(response, loggedIn, user); }
java
private void performAdjustCookies(HttpServletRequest request, HttpServletResponse response) throws Exception { boolean loggedIn = false; User user = null; try { Cookie cookie = getCookieFromRequest(request); if( null != cookie ) { user = CookieAuthentication.verifyCookieString(userRepository, cookie.getValue()); loggedIn = true; } } catch(Exception e) { // Ignore } if( null == user ) { user = userRepository.getDefaultUser(); } acceptRequest(response, loggedIn, user); }
[ "private", "void", "performAdjustCookies", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "Exception", "{", "boolean", "loggedIn", "=", "false", ";", "User", "user", "=", "null", ";", "try", "{", "Cookie", "cookie", ...
Adjusts the information cookie based on the authentication token @param request @param response @throws ServletException @throws IOException
[ "Adjusts", "the", "information", "cookie", "based", "on", "the", "authentication", "token" ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-auth-cookie/src/main/java/ca/carleton/gcrc/auth/cookie/AuthServlet.java#L186-L205
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_timeCondition_serviceName_condition_id_GET
public OvhTimeCondition billingAccount_timeCondition_serviceName_condition_id_GET(String billingAccount, String serviceName, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/timeCondition/{serviceName}/condition/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTimeCondition.class); }
java
public OvhTimeCondition billingAccount_timeCondition_serviceName_condition_id_GET(String billingAccount, String serviceName, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/timeCondition/{serviceName}/condition/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTimeCondition.class); }
[ "public", "OvhTimeCondition", "billingAccount_timeCondition_serviceName_condition_id_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/timeCondition/{...
Get this object properties REST: GET /telephony/{billingAccount}/timeCondition/{serviceName}/condition/{id} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param id [required] Id of the object
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5825-L5830
arxanchain/java-common
src/main/java/com/arxanfintech/common/util/ByteUtils.java
ByteUtils.toBase58
public static String toBase58(byte[] b) { if (b.length == 0) { return ""; } int lz = 0; while (lz < b.length && b[lz] == 0) { ++lz; } StringBuilder s = new StringBuilder(); BigInteger n = new BigInteger(1, b); while (n.compareTo(BigInteger.ZERO) > 0) { BigInteger[] r = n.divideAndRemainder(BigInteger.valueOf(58)); n = r[0]; char digit = b58[r[1].intValue()]; s.append(digit); } while (lz > 0) { --lz; s.append("1"); } return s.reverse().toString(); }
java
public static String toBase58(byte[] b) { if (b.length == 0) { return ""; } int lz = 0; while (lz < b.length && b[lz] == 0) { ++lz; } StringBuilder s = new StringBuilder(); BigInteger n = new BigInteger(1, b); while (n.compareTo(BigInteger.ZERO) > 0) { BigInteger[] r = n.divideAndRemainder(BigInteger.valueOf(58)); n = r[0]; char digit = b58[r[1].intValue()]; s.append(digit); } while (lz > 0) { --lz; s.append("1"); } return s.reverse().toString(); }
[ "public", "static", "String", "toBase58", "(", "byte", "[", "]", "b", ")", "{", "if", "(", "b", ".", "length", "==", "0", ")", "{", "return", "\"\"", ";", "}", "int", "lz", "=", "0", ";", "while", "(", "lz", "<", "b", ".", "length", "&&", "b"...
convert a byte array to a human readable base58 string. Base58 is a Bitcoin specific encoding similar to widely used base64 but avoids using characters of similar shape, such as 1 and l or O an 0 @param b byte data @return base58 data
[ "convert", "a", "byte", "array", "to", "a", "human", "readable", "base58", "string", ".", "Base58", "is", "a", "Bitcoin", "specific", "encoding", "similar", "to", "widely", "used", "base64", "but", "avoids", "using", "characters", "of", "similar", "shape", "...
train
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtils.java#L52-L75
dnsjava/dnsjava
org/xbill/DNS/SimpleResolver.java
SimpleResolver.sendAsync
public Object sendAsync(final Message query, final ResolverListener listener) { final Object id; synchronized (this) { id = new Integer(uniqueID++); } Record question = query.getQuestion(); String qname; if (question != null) qname = question.getName().toString(); else qname = "(none)"; String name = this.getClass() + ": " + qname; Thread thread = new ResolveThread(this, query, id, listener); thread.setName(name); thread.setDaemon(true); thread.start(); return id; }
java
public Object sendAsync(final Message query, final ResolverListener listener) { final Object id; synchronized (this) { id = new Integer(uniqueID++); } Record question = query.getQuestion(); String qname; if (question != null) qname = question.getName().toString(); else qname = "(none)"; String name = this.getClass() + ": " + qname; Thread thread = new ResolveThread(this, query, id, listener); thread.setName(name); thread.setDaemon(true); thread.start(); return id; }
[ "public", "Object", "sendAsync", "(", "final", "Message", "query", ",", "final", "ResolverListener", "listener", ")", "{", "final", "Object", "id", ";", "synchronized", "(", "this", ")", "{", "id", "=", "new", "Integer", "(", "uniqueID", "++", ")", ";", ...
Asynchronously sends a message to a single server, registering a listener to receive a callback on success or exception. Multiple asynchronous lookups can be performed in parallel. Since the callback may be invoked before the function returns, external synchronization is necessary. @param query The query to send @param listener The object containing the callbacks. @return An identifier, which is also a parameter in the callback
[ "Asynchronously", "sends", "a", "message", "to", "a", "single", "server", "registering", "a", "listener", "to", "receive", "a", "callback", "on", "success", "or", "exception", ".", "Multiple", "asynchronous", "lookups", "can", "be", "performed", "in", "parallel"...
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/SimpleResolver.java#L308-L326
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java
AptControlImplementation.initClients
protected ArrayList<AptClientField> initClients() { ArrayList<AptClientField> clients = new ArrayList<AptClientField>(); if ( _implDecl == null || _implDecl.getFields() == null ) return clients; Collection<FieldDeclaration> declaredFields = _implDecl.getFields(); for (FieldDeclaration fieldDecl : declaredFields) { if (fieldDecl.getAnnotation(Client.class) != null) clients.add(new AptClientField(this, fieldDecl)); } return clients; }
java
protected ArrayList<AptClientField> initClients() { ArrayList<AptClientField> clients = new ArrayList<AptClientField>(); if ( _implDecl == null || _implDecl.getFields() == null ) return clients; Collection<FieldDeclaration> declaredFields = _implDecl.getFields(); for (FieldDeclaration fieldDecl : declaredFields) { if (fieldDecl.getAnnotation(Client.class) != null) clients.add(new AptClientField(this, fieldDecl)); } return clients; }
[ "protected", "ArrayList", "<", "AptClientField", ">", "initClients", "(", ")", "{", "ArrayList", "<", "AptClientField", ">", "clients", "=", "new", "ArrayList", "<", "AptClientField", ">", "(", ")", ";", "if", "(", "_implDecl", "==", "null", "||", "_implDecl...
Initializes the list of ClientFields declared directly by this ControlImpl
[ "Initializes", "the", "list", "of", "ClientFields", "declared", "directly", "by", "this", "ControlImpl" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java#L188-L202
mikepenz/Materialize
library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java
ColorHolder.applyToOr
public void applyToOr(TextView textView, ColorStateList colorDefault) { if (mColorInt != 0) { textView.setTextColor(mColorInt); } else if (mColorRes != -1) { textView.setTextColor(ContextCompat.getColor(textView.getContext(), mColorRes)); } else if (colorDefault != null) { textView.setTextColor(colorDefault); } }
java
public void applyToOr(TextView textView, ColorStateList colorDefault) { if (mColorInt != 0) { textView.setTextColor(mColorInt); } else if (mColorRes != -1) { textView.setTextColor(ContextCompat.getColor(textView.getContext(), mColorRes)); } else if (colorDefault != null) { textView.setTextColor(colorDefault); } }
[ "public", "void", "applyToOr", "(", "TextView", "textView", ",", "ColorStateList", "colorDefault", ")", "{", "if", "(", "mColorInt", "!=", "0", ")", "{", "textView", ".", "setTextColor", "(", "mColorInt", ")", ";", "}", "else", "if", "(", "mColorRes", "!="...
a small helper to set the text color to a textView null save @param textView @param colorDefault
[ "a", "small", "helper", "to", "set", "the", "text", "color", "to", "a", "textView", "null", "save" ]
train
https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/holder/ColorHolder.java#L89-L97
line/armeria
core/src/main/java/com/linecorp/armeria/server/auth/HttpAuthService.java
HttpAuthService.newDecorator
@SafeVarargs public static Function<Service<HttpRequest, HttpResponse>, HttpAuthService> newDecorator(Authorizer<HttpRequest>... authorizers) { return newDecorator(ImmutableList.copyOf(requireNonNull(authorizers, "authorizers"))); }
java
@SafeVarargs public static Function<Service<HttpRequest, HttpResponse>, HttpAuthService> newDecorator(Authorizer<HttpRequest>... authorizers) { return newDecorator(ImmutableList.copyOf(requireNonNull(authorizers, "authorizers"))); }
[ "@", "SafeVarargs", "public", "static", "Function", "<", "Service", "<", "HttpRequest", ",", "HttpResponse", ">", ",", "HttpAuthService", ">", "newDecorator", "(", "Authorizer", "<", "HttpRequest", ">", "...", "authorizers", ")", "{", "return", "newDecorator", "...
Creates a new HTTP authorization {@link Service} decorator using the specified {@link Authorizer}s. @param authorizers the array of {@link Authorizer}s.
[ "Creates", "a", "new", "HTTP", "authorization", "{", "@link", "Service", "}", "decorator", "using", "the", "specified", "{", "@link", "Authorizer", "}", "s", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/auth/HttpAuthService.java#L61-L65
andrehertwig/admintool
admin-tools-core/src/main/java/de/chandre/admintool/core/controller/AbstractAdminController.java
AbstractAdminController.resolveLocale
protected void resolveLocale(Locale language, HttpServletRequest request, HttpServletResponse response){ final LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request); localeResolver.setLocale(request, response, language); }
java
protected void resolveLocale(Locale language, HttpServletRequest request, HttpServletResponse response){ final LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request); localeResolver.setLocale(request, response, language); }
[ "protected", "void", "resolveLocale", "(", "Locale", "language", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "final", "LocaleResolver", "localeResolver", "=", "RequestContextUtils", ".", "getLocaleResolver", "(", "request", ")...
manually resolve of locale ... to request. useful for path variables @param language @param request @param response
[ "manually", "resolve", "of", "locale", "...", "to", "request", ".", "useful", "for", "path", "variables" ]
train
https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-core/src/main/java/de/chandre/admintool/core/controller/AbstractAdminController.java#L149-L152
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java
GraphBackedSearchIndexer.onAdd
@Override public void onAdd(Collection<? extends IDataType> dataTypes) throws AtlasException { AtlasGraphManagement management = provider.get().getManagementSystem(); for (IDataType dataType : dataTypes) { if (LOG.isDebugEnabled()) { LOG.debug("Creating indexes for type name={}, definition={}", dataType.getName(), dataType.getClass()); } try { addIndexForType(management, dataType); LOG.info("Index creation for type {} complete", dataType.getName()); } catch (Throwable throwable) { LOG.error("Error creating index for type {}", dataType, throwable); //Rollback indexes if any failure rollback(management); throw new IndexCreationException("Error while creating index for type " + dataType, throwable); } } //Commit indexes commit(management); }
java
@Override public void onAdd(Collection<? extends IDataType> dataTypes) throws AtlasException { AtlasGraphManagement management = provider.get().getManagementSystem(); for (IDataType dataType : dataTypes) { if (LOG.isDebugEnabled()) { LOG.debug("Creating indexes for type name={}, definition={}", dataType.getName(), dataType.getClass()); } try { addIndexForType(management, dataType); LOG.info("Index creation for type {} complete", dataType.getName()); } catch (Throwable throwable) { LOG.error("Error creating index for type {}", dataType, throwable); //Rollback indexes if any failure rollback(management); throw new IndexCreationException("Error while creating index for type " + dataType, throwable); } } //Commit indexes commit(management); }
[ "@", "Override", "public", "void", "onAdd", "(", "Collection", "<", "?", "extends", "IDataType", ">", "dataTypes", ")", "throws", "AtlasException", "{", "AtlasGraphManagement", "management", "=", "provider", ".", "get", "(", ")", ".", "getManagementSystem", "(",...
This is upon adding a new type to Store. @param dataTypes data type @throws AtlasException
[ "This", "is", "upon", "adding", "a", "new", "type", "to", "Store", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java#L226-L248
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.setStyle
public static boolean setStyle(MarkerOptions markerOptions, StyleRow style) { boolean styleSet = false; if (style != null) { Color color = style.getColorOrDefault(); float hue = color.getHue(); markerOptions.icon(BitmapDescriptorFactory.defaultMarker(hue)); styleSet = true; } return styleSet; }
java
public static boolean setStyle(MarkerOptions markerOptions, StyleRow style) { boolean styleSet = false; if (style != null) { Color color = style.getColorOrDefault(); float hue = color.getHue(); markerOptions.icon(BitmapDescriptorFactory.defaultMarker(hue)); styleSet = true; } return styleSet; }
[ "public", "static", "boolean", "setStyle", "(", "MarkerOptions", "markerOptions", ",", "StyleRow", "style", ")", "{", "boolean", "styleSet", "=", "false", ";", "if", "(", "style", "!=", "null", ")", "{", "Color", "color", "=", "style", ".", "getColorOrDefaul...
Set the style into the marker options @param markerOptions marker options @param style style row @return true if style was set into the marker options
[ "Set", "the", "style", "into", "the", "marker", "options" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L328-L340
StanKocken/EfficientAdapter
efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java
ViewHelper.setVisibility
public static void setVisibility(EfficientCacheView cacheView, int viewId, int visibility) { View view = cacheView.findViewByIdEfficient(viewId); if (view != null) { view.setVisibility(visibility); } }
java
public static void setVisibility(EfficientCacheView cacheView, int viewId, int visibility) { View view = cacheView.findViewByIdEfficient(viewId); if (view != null) { view.setVisibility(visibility); } }
[ "public", "static", "void", "setVisibility", "(", "EfficientCacheView", "cacheView", ",", "int", "viewId", ",", "int", "visibility", ")", "{", "View", "view", "=", "cacheView", ".", "findViewByIdEfficient", "(", "viewId", ")", ";", "if", "(", "view", "!=", "...
Equivalent to calling View.setVisibility @param cacheView The cache of views to get the view from @param viewId The id of the view whose visibility should change @param visibility The new visibility for the view
[ "Equivalent", "to", "calling", "View", ".", "setVisibility" ]
train
https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java#L24-L29
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java
Metric.averageExistingDatapoints
public void averageExistingDatapoints(Map<Long, Double> datapoints) { if (datapoints != null) { for(Entry<Long, Double> entry : datapoints.entrySet()){ _datapoints.put(entry.getKey(), entry.getValue()); } } }
java
public void averageExistingDatapoints(Map<Long, Double> datapoints) { if (datapoints != null) { for(Entry<Long, Double> entry : datapoints.entrySet()){ _datapoints.put(entry.getKey(), entry.getValue()); } } }
[ "public", "void", "averageExistingDatapoints", "(", "Map", "<", "Long", ",", "Double", ">", "datapoints", ")", "{", "if", "(", "datapoints", "!=", "null", ")", "{", "for", "(", "Entry", "<", "Long", ",", "Double", ">", "entry", ":", "datapoints", ".", ...
If current set already has a value at that timestamp then replace the latest average value for that timestamp at coinciding cutoff boundary, else adds the new data points to the current set. @param datapoints The set of data points to add. If null or empty, no operation is performed.
[ "If", "current", "set", "already", "has", "a", "value", "at", "that", "timestamp", "then", "replace", "the", "latest", "average", "value", "for", "that", "timestamp", "at", "coinciding", "cutoff", "boundary", "else", "adds", "the", "new", "data", "points", "...
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java#L248-L255
agapsys/embedded-servlet-container
src/main/java/com/agapsys/jee/ServletContainer.java
ServletContainer.registerServlet
public final SC registerServlet(Class<? extends HttpServlet> servletClass) { WebServlet webServlet = servletClass.getAnnotation(WebServlet.class); if (webServlet == null) throw new IllegalArgumentException(String.format("Missing annotation '%s' for class '%s'", WebFilter.class.getName(), servletClass.getName())); String[] urlPatterns = webServlet.value(); if (urlPatterns.length == 0) urlPatterns = webServlet.urlPatterns(); if (urlPatterns.length == 0) throw new IllegalArgumentException(String.format("Missing pattern mapping for '%s'", servletClass.getName())); for (String urlPattern : urlPatterns) { registerServlet(servletClass, urlPattern); } return (SC) this; }
java
public final SC registerServlet(Class<? extends HttpServlet> servletClass) { WebServlet webServlet = servletClass.getAnnotation(WebServlet.class); if (webServlet == null) throw new IllegalArgumentException(String.format("Missing annotation '%s' for class '%s'", WebFilter.class.getName(), servletClass.getName())); String[] urlPatterns = webServlet.value(); if (urlPatterns.length == 0) urlPatterns = webServlet.urlPatterns(); if (urlPatterns.length == 0) throw new IllegalArgumentException(String.format("Missing pattern mapping for '%s'", servletClass.getName())); for (String urlPattern : urlPatterns) { registerServlet(servletClass, urlPattern); } return (SC) this; }
[ "public", "final", "SC", "registerServlet", "(", "Class", "<", "?", "extends", "HttpServlet", ">", "servletClass", ")", "{", "WebServlet", "webServlet", "=", "servletClass", ".", "getAnnotation", "(", "WebServlet", ".", "class", ")", ";", "if", "(", "webServle...
Registers a servlet. @param servletClass servlet class to be registered. This class must be annotated with {@linkplain WebServlet}. @return this.
[ "Registers", "a", "servlet", "." ]
train
https://github.com/agapsys/embedded-servlet-container/blob/28314a2600ad8550ed2c901d8e35d86583c26bb0/src/main/java/com/agapsys/jee/ServletContainer.java#L360-L380
BlueBrain/bluima
modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/tools/tokenize/TokenizerME.java
TokenizerME.tokenizePos
public Span[] tokenizePos(String d) { Span[] tokens = split(d); newTokens.clear(); tokProbs.clear(); for (int i = 0, il = tokens.length; i < il; i++) { Span s = tokens[i]; String tok = d.substring(s.getStart(), s.getEnd()); // Can't tokenize single characters if (tok.length() < 2) { newTokens.add(s); tokProbs.add(ONE); } else if (useAlphaNumericOptimization() && alphaNumeric.matcher(tok).matches()) { newTokens.add(s); tokProbs.add(ONE); } else { int start = s.getStart(); int end = s.getEnd(); final int origStart = s.getStart(); double tokenProb = 1.0; for (int j = origStart + 1; j < end; j++) { double[] probs = model.eval(cg.getContext(new ObjectIntPair(tok, j - origStart))); String best = model.getBestOutcome(probs); //System.err.println("TokenizerME: "+tok.substring(0,j-origStart)+"^"+tok.substring(j-origStart)+" "+best+" "+probs[model.getIndex(best)]); tokenProb *= probs[model.getIndex(best)]; if (best.equals(TokContextGenerator.SPLIT)) { newTokens.add(new Span(start, j)); tokProbs.add(new Double(tokenProb)); start = j; tokenProb = 1.0; } } newTokens.add(new Span(start, end)); tokProbs.add(new Double(tokenProb)); } } Span[] spans = new Span[newTokens.size()]; newTokens.toArray(spans); return spans; }
java
public Span[] tokenizePos(String d) { Span[] tokens = split(d); newTokens.clear(); tokProbs.clear(); for (int i = 0, il = tokens.length; i < il; i++) { Span s = tokens[i]; String tok = d.substring(s.getStart(), s.getEnd()); // Can't tokenize single characters if (tok.length() < 2) { newTokens.add(s); tokProbs.add(ONE); } else if (useAlphaNumericOptimization() && alphaNumeric.matcher(tok).matches()) { newTokens.add(s); tokProbs.add(ONE); } else { int start = s.getStart(); int end = s.getEnd(); final int origStart = s.getStart(); double tokenProb = 1.0; for (int j = origStart + 1; j < end; j++) { double[] probs = model.eval(cg.getContext(new ObjectIntPair(tok, j - origStart))); String best = model.getBestOutcome(probs); //System.err.println("TokenizerME: "+tok.substring(0,j-origStart)+"^"+tok.substring(j-origStart)+" "+best+" "+probs[model.getIndex(best)]); tokenProb *= probs[model.getIndex(best)]; if (best.equals(TokContextGenerator.SPLIT)) { newTokens.add(new Span(start, j)); tokProbs.add(new Double(tokenProb)); start = j; tokenProb = 1.0; } } newTokens.add(new Span(start, end)); tokProbs.add(new Double(tokenProb)); } } Span[] spans = new Span[newTokens.size()]; newTokens.toArray(spans); return spans; }
[ "public", "Span", "[", "]", "tokenizePos", "(", "String", "d", ")", "{", "Span", "[", "]", "tokens", "=", "split", "(", "d", ")", ";", "newTokens", ".", "clear", "(", ")", ";", "tokProbs", ".", "clear", "(", ")", ";", "for", "(", "int", "i", "=...
Tokenizes the string. @param d The string to be tokenized. @return A span array containing individual tokens as elements.
[ "Tokenizes", "the", "string", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/tools/tokenize/TokenizerME.java#L108-L150
landawn/AbacusUtil
src/com/landawn/abacus/util/Maps.java
Maps.removeEntries
public static boolean removeEntries(final Map<?, ?> map, final Map<?, ?> entriesToRemove) { if (N.isNullOrEmpty(map) || N.isNullOrEmpty(entriesToRemove)) { return false; } final int originalSize = map.size(); for (Map.Entry<?, ?> entry : entriesToRemove.entrySet()) { if (N.equals(map.get(entry.getKey()), entry.getValue())) { map.remove(entry.getKey()); } } return map.size() < originalSize; }
java
public static boolean removeEntries(final Map<?, ?> map, final Map<?, ?> entriesToRemove) { if (N.isNullOrEmpty(map) || N.isNullOrEmpty(entriesToRemove)) { return false; } final int originalSize = map.size(); for (Map.Entry<?, ?> entry : entriesToRemove.entrySet()) { if (N.equals(map.get(entry.getKey()), entry.getValue())) { map.remove(entry.getKey()); } } return map.size() < originalSize; }
[ "public", "static", "boolean", "removeEntries", "(", "final", "Map", "<", "?", ",", "?", ">", "map", ",", "final", "Map", "<", "?", ",", "?", ">", "entriesToRemove", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "map", ")", "||", "N", ".", ...
The the entries from the specified <code>Map</code> @param map @param entriesToRemove @return <code>true</code> if any key/value was removed, otherwise <code>false</code>.
[ "The", "the", "entries", "from", "the", "specified", "<code", ">", "Map<", "/", "code", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Maps.java#L575-L589
meertensinstituut/mtas
src/main/java/mtas/parser/function/util/MtasFunctionParserFunction.java
MtasFunctionParserFunction.getResponse
public final MtasFunctionParserFunctionResponse getResponse(long[] args, long n) { if (dataType.equals(CodecUtil.DATA_TYPE_LONG)) { try { long l = getValueLong(args, n); return new MtasFunctionParserFunctionResponseLong(l, true); } catch (IOException e) { log.debug(e); return new MtasFunctionParserFunctionResponseLong(0, false); } } else if (dataType.equals(CodecUtil.DATA_TYPE_DOUBLE)) { try { double d = getValueDouble(args, n); return new MtasFunctionParserFunctionResponseDouble(d, true); } catch (IOException e) { log.debug(e); return new MtasFunctionParserFunctionResponseDouble(0, false); } } else { return null; } }
java
public final MtasFunctionParserFunctionResponse getResponse(long[] args, long n) { if (dataType.equals(CodecUtil.DATA_TYPE_LONG)) { try { long l = getValueLong(args, n); return new MtasFunctionParserFunctionResponseLong(l, true); } catch (IOException e) { log.debug(e); return new MtasFunctionParserFunctionResponseLong(0, false); } } else if (dataType.equals(CodecUtil.DATA_TYPE_DOUBLE)) { try { double d = getValueDouble(args, n); return new MtasFunctionParserFunctionResponseDouble(d, true); } catch (IOException e) { log.debug(e); return new MtasFunctionParserFunctionResponseDouble(0, false); } } else { return null; } }
[ "public", "final", "MtasFunctionParserFunctionResponse", "getResponse", "(", "long", "[", "]", "args", ",", "long", "n", ")", "{", "if", "(", "dataType", ".", "equals", "(", "CodecUtil", ".", "DATA_TYPE_LONG", ")", ")", "{", "try", "{", "long", "l", "=", ...
Gets the response. @param args the args @param n the n @return the response
[ "Gets", "the", "response", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/parser/function/util/MtasFunctionParserFunction.java#L57-L78
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.removeToNextSeparator
public boolean removeToNextSeparator(Issue issue, IXtextDocument document, String separator) throws BadLocationException { // Skip spaces after the identifier until the separator int index = issue.getOffset() + issue.getLength(); char c = document.getChar(index); while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } // Test if it next non-space character is the separator final boolean foundSeparator = document.getChar(index) == separator.charAt(0); if (foundSeparator) { index++; c = document.getChar(index); // Skip the previous spaces while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } final int newLength = index - issue.getOffset(); document.replace(issue.getOffset(), newLength, ""); //$NON-NLS-1$ } return foundSeparator; }
java
public boolean removeToNextSeparator(Issue issue, IXtextDocument document, String separator) throws BadLocationException { // Skip spaces after the identifier until the separator int index = issue.getOffset() + issue.getLength(); char c = document.getChar(index); while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } // Test if it next non-space character is the separator final boolean foundSeparator = document.getChar(index) == separator.charAt(0); if (foundSeparator) { index++; c = document.getChar(index); // Skip the previous spaces while (Character.isWhitespace(c)) { index++; c = document.getChar(index); } final int newLength = index - issue.getOffset(); document.replace(issue.getOffset(), newLength, ""); //$NON-NLS-1$ } return foundSeparator; }
[ "public", "boolean", "removeToNextSeparator", "(", "Issue", "issue", ",", "IXtextDocument", "document", ",", "String", "separator", ")", "throws", "BadLocationException", "{", "// Skip spaces after the identifier until the separator", "int", "index", "=", "issue", ".", "g...
Remove the element related to the issue, and the whitespaces after the element until the given separator. @param issue the issue. @param document the document. @param separator the separator to consider. @return <code>true</code> if the separator was found, <code>false</code> if not. @throws BadLocationException if there is a problem with the location of the element.
[ "Remove", "the", "element", "related", "to", "the", "issue", "and", "the", "whitespaces", "after", "the", "element", "until", "the", "given", "separator", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L383-L409
Coveros/selenified
src/main/java/com/coveros/selenified/application/WaitFor.java
WaitFor.alertMatches
public void alertMatches(double seconds, String expectedAlertPattern) { try { double timeTook = popup(seconds); timeTook = popupMatches(seconds - timeTook, expectedAlertPattern); checkAlertMatches(expectedAlertPattern, seconds, timeTook); } catch (TimeoutException e) { checkAlertMatches(expectedAlertPattern, seconds, seconds); } }
java
public void alertMatches(double seconds, String expectedAlertPattern) { try { double timeTook = popup(seconds); timeTook = popupMatches(seconds - timeTook, expectedAlertPattern); checkAlertMatches(expectedAlertPattern, seconds, timeTook); } catch (TimeoutException e) { checkAlertMatches(expectedAlertPattern, seconds, seconds); } }
[ "public", "void", "alertMatches", "(", "double", "seconds", ",", "String", "expectedAlertPattern", ")", "{", "try", "{", "double", "timeTook", "=", "popup", "(", "seconds", ")", ";", "timeTook", "=", "popupMatches", "(", "seconds", "-", "timeTook", ",", "exp...
Waits up to the provided wait time for an alert present on the page has content matching the expected patten. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param expectedAlertPattern the expected text of the alert @param seconds the number of seconds to wait
[ "Waits", "up", "to", "the", "provided", "wait", "time", "for", "an", "alert", "present", "on", "the", "page", "has", "content", "matching", "the", "expected", "patten", ".", "This", "information", "will", "be", "logged", "and", "recorded", "with", "a", "sc...
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L510-L518
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/SignalManager.java
SignalManager.signalReady
public void signalReady(Constraints viewConstraints) { try { rootFileSystem.mkdirs(signalDirectory); } catch (IOException e) { throw new DatasetIOException("Unable to create signal manager directory: " + signalDirectory, e); } String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); try{ // create the output stream to overwrite the current contents, if the directory or file // exists it will be overwritten to get a new timestamp FSDataOutputStream os = rootFileSystem.create(signalPath, true); os.close(); } catch (IOException e) { throw new DatasetIOException("Could not access signal path: " + signalPath, e); } }
java
public void signalReady(Constraints viewConstraints) { try { rootFileSystem.mkdirs(signalDirectory); } catch (IOException e) { throw new DatasetIOException("Unable to create signal manager directory: " + signalDirectory, e); } String normalizedConstraints = getNormalizedConstraints(viewConstraints); Path signalPath = new Path(signalDirectory, normalizedConstraints); try{ // create the output stream to overwrite the current contents, if the directory or file // exists it will be overwritten to get a new timestamp FSDataOutputStream os = rootFileSystem.create(signalPath, true); os.close(); } catch (IOException e) { throw new DatasetIOException("Could not access signal path: " + signalPath, e); } }
[ "public", "void", "signalReady", "(", "Constraints", "viewConstraints", ")", "{", "try", "{", "rootFileSystem", ".", "mkdirs", "(", "signalDirectory", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "DatasetIOException", "(", "\"Unab...
Create a signal for the specified constraints. @param viewConstraints The constraints to create a signal for. @throws DatasetException if the signal could not be created.
[ "Create", "a", "signal", "for", "the", "specified", "constraints", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/SignalManager.java#L66-L85
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getApps
public List<OneLoginApp> getApps(HashMap<String, String> queryParameters) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getApps(queryParameters, this.maxResults); }
java
public List<OneLoginApp> getApps(HashMap<String, String> queryParameters) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getApps(queryParameters, this.maxResults); }
[ "public", "List", "<", "OneLoginApp", ">", "getApps", "(", "HashMap", "<", "String", ",", "String", ">", "queryParameters", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "return", "getApps", "(", "queryParameter...
Gets a list of OneLoginApp resources. @param queryParameters Query parameters of the Resource Parameters to filter the result of the list @return List of OneLoginApp @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.OneLoginApp @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/apps/get-apps">Get Apps documentation</a>
[ "Gets", "a", "list", "of", "OneLoginApp", "resources", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L1647-L1649
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/MbeanImplCodeGen.java
MbeanImplCodeGen.writeVars
private void writeVars(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/** JNDI name */\n"); writeWithIndent(out, indent, "private static final String JNDI_NAME = \"java:/eis/" + def.getDefaultValue() + "\";\n\n"); writeWithIndent(out, indent, "/** MBeanServer instance */\n"); writeWithIndent(out, indent, "private MBeanServer mbeanServer;\n\n"); writeWithIndent(out, indent, "/** Object Name */\n"); writeWithIndent(out, indent, "private String objectName;\n\n"); writeWithIndent(out, indent, "/** The actual ObjectName instance */\n"); writeWithIndent(out, indent, "private ObjectName on;\n\n"); writeWithIndent(out, indent, "/** Registered */\n"); writeWithIndent(out, indent, "private boolean registered;\n\n"); }
java
private void writeVars(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/** JNDI name */\n"); writeWithIndent(out, indent, "private static final String JNDI_NAME = \"java:/eis/" + def.getDefaultValue() + "\";\n\n"); writeWithIndent(out, indent, "/** MBeanServer instance */\n"); writeWithIndent(out, indent, "private MBeanServer mbeanServer;\n\n"); writeWithIndent(out, indent, "/** Object Name */\n"); writeWithIndent(out, indent, "private String objectName;\n\n"); writeWithIndent(out, indent, "/** The actual ObjectName instance */\n"); writeWithIndent(out, indent, "private ObjectName on;\n\n"); writeWithIndent(out, indent, "/** Registered */\n"); writeWithIndent(out, indent, "private boolean registered;\n\n"); }
[ "private", "void", "writeVars", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/** JNDI name */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",",...
Output class vars @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "class", "vars" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/MbeanImplCodeGen.java#L124-L141
UrielCh/ovh-java-sdk
ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java
ApiOvhRouter.serviceName_privateLink_peerServiceName_PUT
public void serviceName_privateLink_peerServiceName_PUT(String serviceName, String peerServiceName, OvhPrivateLink body) throws IOException { String qPath = "/router/{serviceName}/privateLink/{peerServiceName}"; StringBuilder sb = path(qPath, serviceName, peerServiceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_privateLink_peerServiceName_PUT(String serviceName, String peerServiceName, OvhPrivateLink body) throws IOException { String qPath = "/router/{serviceName}/privateLink/{peerServiceName}"; StringBuilder sb = path(qPath, serviceName, peerServiceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_privateLink_peerServiceName_PUT", "(", "String", "serviceName", ",", "String", "peerServiceName", ",", "OvhPrivateLink", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/router/{serviceName}/privateLink/{peerServiceName}\"", ...
Alter this object properties REST: PUT /router/{serviceName}/privateLink/{peerServiceName} @param body [required] New object properties @param serviceName [required] The internal name of your Router offer @param peerServiceName [required] Service name of the other side of this link
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java#L331-L335
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java
RecommendationsInner.resetAllFiltersForWebAppAsync
public Observable<Void> resetAllFiltersForWebAppAsync(String resourceGroupName, String siteName) { return resetAllFiltersForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> resetAllFiltersForWebAppAsync(String resourceGroupName, String siteName) { return resetAllFiltersForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "resetAllFiltersForWebAppAsync", "(", "String", "resourceGroupName", ",", "String", "siteName", ")", "{", "return", "resetAllFiltersForWebAppWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ")", ".", "map", ...
Reset all recommendation opt-out settings for an app. Reset all recommendation opt-out settings for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Reset", "all", "recommendation", "opt", "-", "out", "settings", "for", "an", "app", ".", "Reset", "all", "recommendation", "opt", "-", "out", "settings", "for", "an", "app", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1146-L1153
mfornos/humanize
humanize-slim/src/main/java/humanize/Humanize.java
Humanize.paceFormat
public static String paceFormat(final Number value, final long interval) { ResourceBundle b = context.get().getBundle(); PaceParameters params = PaceParameters.begin(b.getString("pace.one")) .none(b.getString("pace.none")) .many(b.getString("pace.many")) .interval(interval); return paceFormat(value, params); }
java
public static String paceFormat(final Number value, final long interval) { ResourceBundle b = context.get().getBundle(); PaceParameters params = PaceParameters.begin(b.getString("pace.one")) .none(b.getString("pace.none")) .many(b.getString("pace.many")) .interval(interval); return paceFormat(value, params); }
[ "public", "static", "String", "paceFormat", "(", "final", "Number", "value", ",", "final", "long", "interval", ")", "{", "ResourceBundle", "b", "=", "context", ".", "get", "(", ")", ".", "getBundle", "(", ")", ";", "PaceParameters", "params", "=", "PacePar...
Matches a pace (value and interval) with a logical time frame. Very useful for slow paces. e.g. heartbeats, ingested calories, hyperglycemic crises. @param value The number of occurrences within the specified interval @param interval The interval in milliseconds @return an human readable textual representation of the pace
[ "Matches", "a", "pace", "(", "value", "and", "interval", ")", "with", "a", "logical", "time", "frame", ".", "Very", "useful", "for", "slow", "paces", ".", "e", ".", "g", ".", "heartbeats", "ingested", "calories", "hyperglycemic", "crises", "." ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L2071-L2081
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentProperty.java
CmsXmlContentProperty.firstNotNull
private static <T> T firstNotNull(T o1, T o2) { if (o1 != null) { return o1; } return o2; }
java
private static <T> T firstNotNull(T o1, T o2) { if (o1 != null) { return o1; } return o2; }
[ "private", "static", "<", "T", ">", "T", "firstNotNull", "(", "T", "o1", ",", "T", "o2", ")", "{", "if", "(", "o1", "!=", "null", ")", "{", "return", "o1", ";", "}", "return", "o2", ";", "}" ]
Gets the fist non-null value.<p> @param o1 the first value @param o2 the second value @return the first non-null value
[ "Gets", "the", "fist", "non", "-", "null", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentProperty.java#L261-L267
Netflix/zuul
zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java
SessionContext.set
public void set(String key, Object value) { if (value != null) put(key, value); else remove(key); }
java
public void set(String key, Object value) { if (value != null) put(key, value); else remove(key); }
[ "public", "void", "set", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "put", "(", "key", ",", "value", ")", ";", "else", "remove", "(", "key", ")", ";", "}" ]
puts the key, value into the map. a null value will remove the key from the map @param key @param value
[ "puts", "the", "key", "value", "into", "the", "map", ".", "a", "null", "value", "will", "remove", "the", "key", "from", "the", "map" ]
train
https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/zuul/context/SessionContext.java#L138-L141
craterdog/java-general-utilities
src/main/java/craterdog/utils/ByteUtils.java
ByteUtils.doubleToBytes
static public int doubleToBytes(double s, byte[] buffer, int index) { long bits = Double.doubleToRawLongBits(s); int length = longToBytes(bits, buffer, index); return length; }
java
static public int doubleToBytes(double s, byte[] buffer, int index) { long bits = Double.doubleToRawLongBits(s); int length = longToBytes(bits, buffer, index); return length; }
[ "static", "public", "int", "doubleToBytes", "(", "double", "s", ",", "byte", "[", "]", "buffer", ",", "int", "index", ")", "{", "long", "bits", "=", "Double", ".", "doubleToRawLongBits", "(", "s", ")", ";", "int", "length", "=", "longToBytes", "(", "bi...
This function converts a double into its corresponding byte format and inserts it into the specified buffer at the specified index. @param s The double to be converted. @param buffer The byte array. @param index The index in the array to begin inserting bytes. @return The number of bytes inserted.
[ "This", "function", "converts", "a", "double", "into", "its", "corresponding", "byte", "format", "and", "inserts", "it", "into", "the", "specified", "buffer", "at", "the", "specified", "index", "." ]
train
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L429-L433
adohe/etcd4j
src/main/java/com/xqbase/etcd4j/EtcdClient.java
EtcdClient.createDir
public void createDir(String key, int ttl, Boolean prevExist) throws EtcdClientException { Preconditions.checkNotNull(key); List<BasicNameValuePair> data = Lists.newArrayList(); data.add(new BasicNameValuePair("dir", String.valueOf(true))); if (ttl > 0) { data.add(new BasicNameValuePair("ttl", String.valueOf(ttl))); } if (prevExist != null) { data.add(new BasicNameValuePair("prevExist", String.valueOf(prevExist))); } put(key, data, null, new int[]{200, 201}); }
java
public void createDir(String key, int ttl, Boolean prevExist) throws EtcdClientException { Preconditions.checkNotNull(key); List<BasicNameValuePair> data = Lists.newArrayList(); data.add(new BasicNameValuePair("dir", String.valueOf(true))); if (ttl > 0) { data.add(new BasicNameValuePair("ttl", String.valueOf(ttl))); } if (prevExist != null) { data.add(new BasicNameValuePair("prevExist", String.valueOf(prevExist))); } put(key, data, null, new int[]{200, 201}); }
[ "public", "void", "createDir", "(", "String", "key", ",", "int", "ttl", ",", "Boolean", "prevExist", ")", "throws", "EtcdClientException", "{", "Preconditions", ".", "checkNotNull", "(", "key", ")", ";", "List", "<", "BasicNameValuePair", ">", "data", "=", "...
Create directories with optional ttl and prevExist(update dir ttl) @param key the key @param ttl the ttl @param prevExist exists before @throws EtcdClientException
[ "Create", "directories", "with", "optional", "ttl", "and", "prevExist", "(", "update", "dir", "ttl", ")" ]
train
https://github.com/adohe/etcd4j/blob/8d30ae9aa5da32d8e78287d61e69861c63538629/src/main/java/com/xqbase/etcd4j/EtcdClient.java#L185-L198
lemire/JavaFastPFOR
src/main/java/me/lemire/integercompression/Util.java
Util.maxbits
public static int maxbits(int[] i, int pos, int length) { int mask = 0; for (int k = pos; k < pos + length; ++k) mask |= i[k]; return bits(mask); }
java
public static int maxbits(int[] i, int pos, int length) { int mask = 0; for (int k = pos; k < pos + length; ++k) mask |= i[k]; return bits(mask); }
[ "public", "static", "int", "maxbits", "(", "int", "[", "]", "i", ",", "int", "pos", ",", "int", "length", ")", "{", "int", "mask", "=", "0", ";", "for", "(", "int", "k", "=", "pos", ";", "k", "<", "pos", "+", "length", ";", "++", "k", ")", ...
Compute the maximum of the integer logarithms (ceil(log(x+1)) of a range of value @param i source array @param pos starting position @param length number of integers to consider @return integer logarithm
[ "Compute", "the", "maximum", "of", "the", "integer", "logarithms", "(", "ceil", "(", "log", "(", "x", "+", "1", "))", "of", "a", "range", "of", "value" ]
train
https://github.com/lemire/JavaFastPFOR/blob/ffeea61ab2fdb3854da7b0a557f8d22d674477f4/src/main/java/me/lemire/integercompression/Util.java#L36-L41
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-data/deeplearning4j-datavec-iterators/src/main/java/org/deeplearning4j/datasets/datavec/SequenceRecordReaderDataSetIterator.java
SequenceRecordReaderDataSetIterator.loadFromMetaData
public DataSet loadFromMetaData(List<RecordMetaData> list) throws IOException { if (underlying == null) { SequenceRecord r = recordReader.loadSequenceFromMetaData(list.get(0)); initializeUnderlying(r); } //Two cases: single vs. multiple reader... List<RecordMetaData> l = new ArrayList<>(list.size()); if (singleSequenceReaderMode) { for (RecordMetaData m : list) { l.add(new RecordMetaDataComposableMap(Collections.singletonMap(READER_KEY, m))); } } else { for (RecordMetaData m : list) { RecordMetaDataComposable rmdc = (RecordMetaDataComposable) m; Map<String, RecordMetaData> map = new HashMap<>(2); map.put(READER_KEY, rmdc.getMeta()[0]); map.put(READER_KEY_LABEL, rmdc.getMeta()[1]); l.add(new RecordMetaDataComposableMap(map)); } } return mdsToDataSet(underlying.loadFromMetaData(l)); }
java
public DataSet loadFromMetaData(List<RecordMetaData> list) throws IOException { if (underlying == null) { SequenceRecord r = recordReader.loadSequenceFromMetaData(list.get(0)); initializeUnderlying(r); } //Two cases: single vs. multiple reader... List<RecordMetaData> l = new ArrayList<>(list.size()); if (singleSequenceReaderMode) { for (RecordMetaData m : list) { l.add(new RecordMetaDataComposableMap(Collections.singletonMap(READER_KEY, m))); } } else { for (RecordMetaData m : list) { RecordMetaDataComposable rmdc = (RecordMetaDataComposable) m; Map<String, RecordMetaData> map = new HashMap<>(2); map.put(READER_KEY, rmdc.getMeta()[0]); map.put(READER_KEY_LABEL, rmdc.getMeta()[1]); l.add(new RecordMetaDataComposableMap(map)); } } return mdsToDataSet(underlying.loadFromMetaData(l)); }
[ "public", "DataSet", "loadFromMetaData", "(", "List", "<", "RecordMetaData", ">", "list", ")", "throws", "IOException", "{", "if", "(", "underlying", "==", "null", ")", "{", "SequenceRecord", "r", "=", "recordReader", ".", "loadSequenceFromMetaData", "(", "list"...
Load a multiple sequence examples to a DataSet, using the provided RecordMetaData instances. @param list List of RecordMetaData instances to load from. Should have been produced by the record reader provided to the SequenceRecordReaderDataSetIterator constructor @return DataSet with the specified examples @throws IOException If an error occurs during loading of the data
[ "Load", "a", "multiple", "sequence", "examples", "to", "a", "DataSet", "using", "the", "provided", "RecordMetaData", "instances", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-datavec-iterators/src/main/java/org/deeplearning4j/datasets/datavec/SequenceRecordReaderDataSetIterator.java#L462-L485
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_OffSetCurve.java
ST_OffSetCurve.computeOffsetCurve
public static Geometry computeOffsetCurve(Geometry geometry, double offset, BufferParameters bufferParameters) { ArrayList<LineString> lineStrings = new ArrayList<LineString>(); for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if (subGeom.getDimension() == 1) { lineStringOffSetCurve(lineStrings, (LineString) subGeom, offset, bufferParameters); } else { geometryOffSetCurve(lineStrings, subGeom, offset, bufferParameters); } } if (!lineStrings.isEmpty()) { if (lineStrings.size() == 1) { return lineStrings.get(0); } else { return geometry.getFactory().createMultiLineString(lineStrings.toArray(new LineString[0])); } } return null; }
java
public static Geometry computeOffsetCurve(Geometry geometry, double offset, BufferParameters bufferParameters) { ArrayList<LineString> lineStrings = new ArrayList<LineString>(); for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if (subGeom.getDimension() == 1) { lineStringOffSetCurve(lineStrings, (LineString) subGeom, offset, bufferParameters); } else { geometryOffSetCurve(lineStrings, subGeom, offset, bufferParameters); } } if (!lineStrings.isEmpty()) { if (lineStrings.size() == 1) { return lineStrings.get(0); } else { return geometry.getFactory().createMultiLineString(lineStrings.toArray(new LineString[0])); } } return null; }
[ "public", "static", "Geometry", "computeOffsetCurve", "(", "Geometry", "geometry", ",", "double", "offset", ",", "BufferParameters", "bufferParameters", ")", "{", "ArrayList", "<", "LineString", ">", "lineStrings", "=", "new", "ArrayList", "<", "LineString", ">", ...
Method to compute the offset line @param geometry @param offset @param bufferParameters @return
[ "Method", "to", "compute", "the", "offset", "line" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/buffer/ST_OffSetCurve.java#L121-L139
belaban/JGroups
src/org/jgroups/util/MessageBatch.java
MessageBatch.replaceIf
public int replaceIf(Predicate<Message> filter, Message replacement, boolean match_all) { if(filter == null) return 0; int matched=0; for(int i=0; i < index; i++) { if(filter.test(messages[i])) { messages[i]=replacement; matched++; if(!match_all) break; } } return matched; }
java
public int replaceIf(Predicate<Message> filter, Message replacement, boolean match_all) { if(filter == null) return 0; int matched=0; for(int i=0; i < index; i++) { if(filter.test(messages[i])) { messages[i]=replacement; matched++; if(!match_all) break; } } return matched; }
[ "public", "int", "replaceIf", "(", "Predicate", "<", "Message", ">", "filter", ",", "Message", "replacement", ",", "boolean", "match_all", ")", "{", "if", "(", "filter", "==", "null", ")", "return", "0", ";", "int", "matched", "=", "0", ";", "for", "("...
Replaces all messages that match a given filter with a replacement message @param filter the filter. If null, no changes take place. Note that filter needs to be able to handle null msgs @param replacement the replacement message. Can be null, which essentially removes all messages matching filter @param match_all whether to replace the first or all matches @return the number of matched messages
[ "Replaces", "all", "messages", "that", "match", "a", "given", "filter", "with", "a", "replacement", "message" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/MessageBatch.java#L215-L228
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java
PnPInfinitesimalPlanePoseEstimation.process
public boolean process( List<AssociatedPair> points ) { if( points.size() < estimateHomography.getMinimumPoints()) throw new IllegalArgumentException("At least "+estimateHomography.getMinimumPoints()+" must be provided"); // center location of points in model zeroMeanWorldPoints(points); // make sure there are no accidental references to the original points points = pointsAdj.toList(); if( !estimateHomography.process(points,H) ) return false; // make sure H[2,2] == 1 CommonOps_DDRM.divide(H,H.get(2,2)); // Jacobian of pi(H[u_0 1]^T) at u_0 = 0 // pi is plane to image transform J.a11 = H.unsafe_get(0,0) - H.unsafe_get(2,0)*H.unsafe_get(0,2); J.a12 = H.unsafe_get(0,1) - H.unsafe_get(2,1)*H.unsafe_get(0,2); J.a21 = H.unsafe_get(1,0) - H.unsafe_get(2,0)*H.unsafe_get(1,2); J.a22 = H.unsafe_get(1,1) - H.unsafe_get(2,1)*H.unsafe_get(1,2); // v = (H[0,1],H[1,2]) = pi(H[u_0 1]^T) at u_0 = 0 // projection of u_0 into normalized coordinates v1 = H.unsafe_get(0,2); v2 = H.unsafe_get(1,2); // Solve for rotations IPPE(pose0.R,pose1.R); // Solve for translations estimateTranslation(pose0.R,points,pose0.T); estimateTranslation(pose1.R,points,pose1.T); // compute the reprojection error for each pose error0 = computeError(points,pose0); error1 = computeError(points,pose1); // Make sure the best pose is the first one if( error0 > error1 ) { double e = error0; error0 = error1; error1 = e; Se3_F64 s = pose0;pose0 = pose1; pose1 = s; } // Undo centering adjustment center3.set(-center.x,-center.y,0); GeometryMath_F64.addMult(pose0.T,pose0.R,center3,pose0.T); GeometryMath_F64.addMult(pose1.T,pose1.R,center3,pose1.T); return true; }
java
public boolean process( List<AssociatedPair> points ) { if( points.size() < estimateHomography.getMinimumPoints()) throw new IllegalArgumentException("At least "+estimateHomography.getMinimumPoints()+" must be provided"); // center location of points in model zeroMeanWorldPoints(points); // make sure there are no accidental references to the original points points = pointsAdj.toList(); if( !estimateHomography.process(points,H) ) return false; // make sure H[2,2] == 1 CommonOps_DDRM.divide(H,H.get(2,2)); // Jacobian of pi(H[u_0 1]^T) at u_0 = 0 // pi is plane to image transform J.a11 = H.unsafe_get(0,0) - H.unsafe_get(2,0)*H.unsafe_get(0,2); J.a12 = H.unsafe_get(0,1) - H.unsafe_get(2,1)*H.unsafe_get(0,2); J.a21 = H.unsafe_get(1,0) - H.unsafe_get(2,0)*H.unsafe_get(1,2); J.a22 = H.unsafe_get(1,1) - H.unsafe_get(2,1)*H.unsafe_get(1,2); // v = (H[0,1],H[1,2]) = pi(H[u_0 1]^T) at u_0 = 0 // projection of u_0 into normalized coordinates v1 = H.unsafe_get(0,2); v2 = H.unsafe_get(1,2); // Solve for rotations IPPE(pose0.R,pose1.R); // Solve for translations estimateTranslation(pose0.R,points,pose0.T); estimateTranslation(pose1.R,points,pose1.T); // compute the reprojection error for each pose error0 = computeError(points,pose0); error1 = computeError(points,pose1); // Make sure the best pose is the first one if( error0 > error1 ) { double e = error0; error0 = error1; error1 = e; Se3_F64 s = pose0;pose0 = pose1; pose1 = s; } // Undo centering adjustment center3.set(-center.x,-center.y,0); GeometryMath_F64.addMult(pose0.T,pose0.R,center3,pose0.T); GeometryMath_F64.addMult(pose1.T,pose1.R,center3,pose1.T); return true; }
[ "public", "boolean", "process", "(", "List", "<", "AssociatedPair", ">", "points", ")", "{", "if", "(", "points", ".", "size", "(", ")", "<", "estimateHomography", ".", "getMinimumPoints", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"At...
Estimates the transform from world coordinate system to camera given known points and observations. For each observation p1=World 3D location. z=0 is implicit. p2=Observed location of points in image in normalized image coordinates @param points List of world coordinates in 2D (p1) and normalized image coordinates (p2) @return true if successful or false if it fails to estimate
[ "Estimates", "the", "transform", "from", "world", "coordinate", "system", "to", "camera", "given", "known", "points", "and", "observations", ".", "For", "each", "observation", "p1", "=", "World", "3D", "location", ".", "z", "=", "0", "is", "implicit", ".", ...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java#L115-L166
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java
AccountManager.createAccount
public void createAccount(Localpart username, String password, Map<String, String> attributes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { if (!connection().isSecureConnection() && !allowSensitiveOperationOverInsecureConnection) { throw new IllegalStateException("Creating account over insecure connection"); } if (username == null) { throw new IllegalArgumentException("Username must not be null"); } if (StringUtils.isNullOrEmpty(password)) { throw new IllegalArgumentException("Password must not be null"); } attributes.put("username", username.toString()); attributes.put("password", password); Registration reg = new Registration(attributes); reg.setType(IQ.Type.set); reg.setTo(connection().getXMPPServiceDomain()); createStanzaCollectorAndSend(reg).nextResultOrThrow(); }
java
public void createAccount(Localpart username, String password, Map<String, String> attributes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { if (!connection().isSecureConnection() && !allowSensitiveOperationOverInsecureConnection) { throw new IllegalStateException("Creating account over insecure connection"); } if (username == null) { throw new IllegalArgumentException("Username must not be null"); } if (StringUtils.isNullOrEmpty(password)) { throw new IllegalArgumentException("Password must not be null"); } attributes.put("username", username.toString()); attributes.put("password", password); Registration reg = new Registration(attributes); reg.setType(IQ.Type.set); reg.setTo(connection().getXMPPServiceDomain()); createStanzaCollectorAndSend(reg).nextResultOrThrow(); }
[ "public", "void", "createAccount", "(", "Localpart", "username", ",", "String", "password", ",", "Map", "<", "String", ",", "String", ">", "attributes", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedE...
Creates a new account using the specified username, password and account attributes. The attributes Map must contain only String name/value pairs and must also have values for all required attributes. @param username the username. @param password the password. @param attributes the account attributes. @throws XMPPErrorException if an error occurs creating the account. @throws NoResponseException if there was no response from the server. @throws NotConnectedException @throws InterruptedException @see #getAccountAttributes()
[ "Creates", "a", "new", "account", "using", "the", "specified", "username", "password", "and", "account", "attributes", ".", "The", "attributes", "Map", "must", "contain", "only", "String", "name", "/", "value", "pairs", "and", "must", "also", "have", "values",...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/AccountManager.java#L271-L289
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.beginStartAsync
public Observable<Void> beginStartAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName) { return beginStartWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginStartAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName) { return beginStartWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginStartAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ")", "{", "return", "beginStartWithSe...
Starts an environment by starting all resources inside the environment. This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Starts", "an", "environment", "by", "starting", "all", "resources", "inside", "the", "environment", ".", "This", "operation", "can", "take", "a", "while", "to", "complete", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L1510-L1517
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyDecoder.java
KeyDecoder.decodeIntegerObjDesc
public static Integer decodeIntegerObjDesc(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeIntDesc(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static Integer decodeIntegerObjDesc(byte[] src, int srcOffset) throws CorruptEncodingException { try { int b = src[srcOffset]; if (b == NULL_BYTE_HIGH || b == NULL_BYTE_LOW) { return null; } return decodeIntDesc(src, srcOffset + 1); } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "Integer", "decodeIntegerObjDesc", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "int", "b", "=", "src", "[", "srcOffset", "]", ";", "if", "(", "b", "==", "NULL_BYTE_H...
Decodes a signed Integer object from exactly 1 or 5 bytes, as encoded for descending order. If null is returned, then 1 byte was read. @param src source of encoded bytes @param srcOffset offset into source array @return signed Integer object or null
[ "Decodes", "a", "signed", "Integer", "object", "from", "exactly", "1", "or", "5", "bytes", "as", "encoded", "for", "descending", "order", ".", "If", "null", "is", "returned", "then", "1", "byte", "was", "read", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L58-L70
alkacon/opencms-core
src/org/opencms/ade/contenteditor/CmsWidgetUtil.java
CmsWidgetUtil.collectWidgetInfo
public static WidgetInfo collectWidgetInfo(I_CmsXmlContentValue value) { CmsXmlContentDefinition contentDef = value.getDocument().getContentDefinition(); String path = value.getPath(); return collectWidgetInfo(contentDef, path); }
java
public static WidgetInfo collectWidgetInfo(I_CmsXmlContentValue value) { CmsXmlContentDefinition contentDef = value.getDocument().getContentDefinition(); String path = value.getPath(); return collectWidgetInfo(contentDef, path); }
[ "public", "static", "WidgetInfo", "collectWidgetInfo", "(", "I_CmsXmlContentValue", "value", ")", "{", "CmsXmlContentDefinition", "contentDef", "=", "value", ".", "getDocument", "(", ")", ".", "getContentDefinition", "(", ")", ";", "String", "path", "=", "value", ...
Collects widget information for a given content value.<p> @param value a content value @return the widget information for the given value
[ "Collects", "widget", "information", "for", "a", "given", "content", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsWidgetUtil.java#L214-L219
lastaflute/lastaflute
src/main/java/org/lastaflute/web/servlet/request/scoped/ScopedMessageHandler.java
ScopedMessageHandler.addGlobal
public void addGlobal(String messageKey, Object... args) { assertObjectNotNull("messageKey", messageKey); doAddMessages(prepareUserMessages(globalPropertyKey, messageKey, args)); }
java
public void addGlobal(String messageKey, Object... args) { assertObjectNotNull("messageKey", messageKey); doAddMessages(prepareUserMessages(globalPropertyKey, messageKey, args)); }
[ "public", "void", "addGlobal", "(", "String", "messageKey", ",", "Object", "...", "args", ")", "{", "assertObjectNotNull", "(", "\"messageKey\"", ",", "messageKey", ")", ";", "doAddMessages", "(", "prepareUserMessages", "(", "globalPropertyKey", ",", "messageKey", ...
Add message as global user messages to rear of existing messages. <br> This message will be deleted immediately after display if you use e.g. la:errors. @param messageKey The message key to be added. (NotNull) @param args The varying array of arguments for the message. (NullAllowed, EmptyAllowed)
[ "Add", "message", "as", "global", "user", "messages", "to", "rear", "of", "existing", "messages", ".", "<br", ">", "This", "message", "will", "be", "deleted", "immediately", "after", "display", "if", "you", "use", "e", ".", "g", ".", "la", ":", "errors",...
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/servlet/request/scoped/ScopedMessageHandler.java#L105-L108
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_cron_GET
public ArrayList<Long> serviceName_cron_GET(String serviceName, String command, String description, String email, OvhLanguageEnum language) throws IOException { String qPath = "/hosting/web/{serviceName}/cron"; StringBuilder sb = path(qPath, serviceName); query(sb, "command", command); query(sb, "description", description); query(sb, "email", email); query(sb, "language", language); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
java
public ArrayList<Long> serviceName_cron_GET(String serviceName, String command, String description, String email, OvhLanguageEnum language) throws IOException { String qPath = "/hosting/web/{serviceName}/cron"; StringBuilder sb = path(qPath, serviceName); query(sb, "command", command); query(sb, "description", description); query(sb, "email", email); query(sb, "language", language); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_cron_GET", "(", "String", "serviceName", ",", "String", "command", ",", "String", "description", ",", "String", "email", ",", "OvhLanguageEnum", "language", ")", "throws", "IOException", "{", "String", "qPath",...
Crons on your hosting REST: GET /hosting/web/{serviceName}/cron @param description [required] Filter the value of description property (like) @param command [required] Filter the value of command property (like) @param language [required] Filter the value of language property (=) @param email [required] Filter the value of email property (like) @param serviceName [required] The internal name of your hosting
[ "Crons", "on", "your", "hosting" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2125-L2134
chrisruffalo/ee-config
src/main/java/com/github/chrisruffalo/eeconfig/resources/BeanResolver.java
BeanResolver.resolveBeanWithDefaultClass
@SuppressWarnings("unchecked") public <B, T extends B, D extends B> B resolveBeanWithDefaultClass(Class<T> typeToResolve, Class<D> defaultType) { // if type to resolve is null, do nothing, not even the default if(typeToResolve == null) { return null; } // get candidate resolve types Set<Bean<?>> candidates = this.manager.getBeans(typeToResolve); // if no candidates are available, resolve // using next class up if(!candidates.iterator().hasNext()) { this.logger.trace("No candidates for: {}", typeToResolve.getName()); // try and resolve only the default type return resolveBeanWithDefaultClass(defaultType, null); } this.logger.trace("Requesting resolution on: {}", typeToResolve.getName()); // get candidate Bean<?> bean = candidates.iterator().next(); CreationalContext<?> context = this.manager.createCreationalContext(bean); Type type = (Type) bean.getTypes().iterator().next(); B result = (B)this.manager.getReference(bean, type, context); this.logger.trace("Resolved to: {}", result.getClass().getName()); return result; }
java
@SuppressWarnings("unchecked") public <B, T extends B, D extends B> B resolveBeanWithDefaultClass(Class<T> typeToResolve, Class<D> defaultType) { // if type to resolve is null, do nothing, not even the default if(typeToResolve == null) { return null; } // get candidate resolve types Set<Bean<?>> candidates = this.manager.getBeans(typeToResolve); // if no candidates are available, resolve // using next class up if(!candidates.iterator().hasNext()) { this.logger.trace("No candidates for: {}", typeToResolve.getName()); // try and resolve only the default type return resolveBeanWithDefaultClass(defaultType, null); } this.logger.trace("Requesting resolution on: {}", typeToResolve.getName()); // get candidate Bean<?> bean = candidates.iterator().next(); CreationalContext<?> context = this.manager.createCreationalContext(bean); Type type = (Type) bean.getTypes().iterator().next(); B result = (B)this.manager.getReference(bean, type, context); this.logger.trace("Resolved to: {}", result.getClass().getName()); return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "B", ",", "T", "extends", "B", ",", "D", "extends", "B", ">", "B", "resolveBeanWithDefaultClass", "(", "Class", "<", "T", ">", "typeToResolve", ",", "Class", "<", "D", ">", "defaultType", ...
Resolve managed bean for given type @param typeToResolve @param defaultType @return
[ "Resolve", "managed", "bean", "for", "given", "type" ]
train
https://github.com/chrisruffalo/ee-config/blob/6cdc59e2117e97c1997b79a19cbfaa284027e60c/src/main/java/com/github/chrisruffalo/eeconfig/resources/BeanResolver.java#L33-L63
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java
CacheSetUtil.removes
public static Single<Long> removes(String key, Set members) { return removes(CacheService.CACHE_CONFIG_BEAN, key, members); }
java
public static Single<Long> removes(String key, Set members) { return removes(CacheService.CACHE_CONFIG_BEAN, key, members); }
[ "public", "static", "Single", "<", "Long", ">", "removes", "(", "String", "key", ",", "Set", "members", ")", "{", "return", "removes", "(", "CacheService", ".", "CACHE_CONFIG_BEAN", ",", "key", ",", "members", ")", ";", "}" ]
remove the given elements from the cache set @param key the key @param members element to be removed @return the removed elements count
[ "remove", "the", "given", "elements", "from", "the", "cache", "set" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheSetUtil.java#L202-L204
biezhi/anima
src/main/java/io/github/biezhi/anima/Anima.java
Anima.deleteBatch
@SafeVarargs public static <T extends Model, S extends Serializable> void deleteBatch(Class<T> model, S... ids) { atomic(() -> Arrays.stream(ids) .forEach(new AnimaQuery<>(model)::deleteById)) .catchException(e -> log.error("Batch save model error, message: {}", e)); }
java
@SafeVarargs public static <T extends Model, S extends Serializable> void deleteBatch(Class<T> model, S... ids) { atomic(() -> Arrays.stream(ids) .forEach(new AnimaQuery<>(model)::deleteById)) .catchException(e -> log.error("Batch save model error, message: {}", e)); }
[ "@", "SafeVarargs", "public", "static", "<", "T", "extends", "Model", ",", "S", "extends", "Serializable", ">", "void", "deleteBatch", "(", "Class", "<", "T", ">", "model", ",", "S", "...", "ids", ")", "{", "atomic", "(", "(", ")", "->", "Arrays", "....
Batch delete model @param model model class type @param ids mode primary id array @param <T> @param <S>
[ "Batch", "delete", "model" ]
train
https://github.com/biezhi/anima/blob/d6655e47ac4c08d9d7f961ac0569062bead8b1ed/src/main/java/io/github/biezhi/anima/Anima.java#L417-L422
JodaOrg/joda-beans
src/main/java/org/joda/beans/ser/SerOptional.java
SerOptional.extractValue
public static Object extractValue(MetaProperty<?> metaProp, Bean bean) { Object value = metaProp.get(bean); if (value != null) { Object[] helpers = OPTIONALS.get(metaProp.propertyType()); if (helpers != null) { try { boolean present = (Boolean) ((Method) helpers[2]).invoke(value); if (present) { value = ((Method) helpers[3]).invoke(value); } else { value = null; } } catch (Exception ex) { throw new RuntimeException(ex); } } } return value; }
java
public static Object extractValue(MetaProperty<?> metaProp, Bean bean) { Object value = metaProp.get(bean); if (value != null) { Object[] helpers = OPTIONALS.get(metaProp.propertyType()); if (helpers != null) { try { boolean present = (Boolean) ((Method) helpers[2]).invoke(value); if (present) { value = ((Method) helpers[3]).invoke(value); } else { value = null; } } catch (Exception ex) { throw new RuntimeException(ex); } } } return value; }
[ "public", "static", "Object", "extractValue", "(", "MetaProperty", "<", "?", ">", "metaProp", ",", "Bean", "bean", ")", "{", "Object", "value", "=", "metaProp", ".", "get", "(", "bean", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "Object", ...
Extracts the value of the property from a bean, unwrapping any optional. @param metaProp the property to query, not null @param bean the bean to query, not null @return the value of the property, with any optional wrapper removed
[ "Extracts", "the", "value", "of", "the", "property", "from", "a", "bean", "unwrapping", "any", "optional", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/SerOptional.java#L102-L120
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java
JDBC4CallableStatement.setTime
@Override public void setTime(String parameterName, Time x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public void setTime(String parameterName, Time x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "void", "setTime", "(", "String", "parameterName", ",", "Time", "x", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Sets the designated parameter to the given java.sql.Time value.
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "java", ".", "sql", ".", "Time", "value", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L887-L892
h2oai/h2o-3
h2o-mapreduce-generic/src/main/java/water/hadoop/H2OYarnDiagnostic.java
H2OYarnDiagnostic.diagnose
public static void diagnose(String applicationId, String queueName, int numNodes, int nodeMemoryMb, int numNodesStarted) throws Exception { H2OYarnDiagnostic client = new H2OYarnDiagnostic(); client.applicationId = applicationId; client.queueName = queueName; client.numNodes = numNodes; client.nodeMemoryMb = nodeMemoryMb; client.nodeVirtualCores = 1; client.numNodesStarted = numNodesStarted; client.run(); }
java
public static void diagnose(String applicationId, String queueName, int numNodes, int nodeMemoryMb, int numNodesStarted) throws Exception { H2OYarnDiagnostic client = new H2OYarnDiagnostic(); client.applicationId = applicationId; client.queueName = queueName; client.numNodes = numNodes; client.nodeMemoryMb = nodeMemoryMb; client.nodeVirtualCores = 1; client.numNodesStarted = numNodesStarted; client.run(); }
[ "public", "static", "void", "diagnose", "(", "String", "applicationId", ",", "String", "queueName", ",", "int", "numNodes", ",", "int", "nodeMemoryMb", ",", "int", "numNodesStarted", ")", "throws", "Exception", "{", "H2OYarnDiagnostic", "client", "=", "new", "H2...
The assumption is this method doesn't get called unless a problem occurred. @param queueName YARN queue name @param numNodes Requested number of worker containers (not including AM) @param nodeMemoryMb Requested worker container size @param numNodesStarted Number of containers that actually got started before giving up @throws Exception
[ "The", "assumption", "is", "this", "method", "doesn", "t", "get", "called", "unless", "a", "problem", "occurred", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-mapreduce-generic/src/main/java/water/hadoop/H2OYarnDiagnostic.java#L54-L63
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java
LatLongUtils.longitudeDistance
public static double longitudeDistance(int meters, double latitude) { return (meters * 360) / (2 * Math.PI * EQUATORIAL_RADIUS * Math.cos(Math.toRadians(latitude))); }
java
public static double longitudeDistance(int meters, double latitude) { return (meters * 360) / (2 * Math.PI * EQUATORIAL_RADIUS * Math.cos(Math.toRadians(latitude))); }
[ "public", "static", "double", "longitudeDistance", "(", "int", "meters", ",", "double", "latitude", ")", "{", "return", "(", "meters", "*", "360", ")", "/", "(", "2", "*", "Math", ".", "PI", "*", "EQUATORIAL_RADIUS", "*", "Math", ".", "cos", "(", "Math...
Calculates the amount of degrees of longitude for a given distance in meters. @param meters distance in meters @param latitude the latitude at which the calculation should be performed @return longitude degrees
[ "Calculates", "the", "amount", "of", "degrees", "of", "longitude", "for", "a", "given", "distance", "in", "meters", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/LatLongUtils.java#L211-L213
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/scheduler/SourcePartitionedScheduler.java
SourcePartitionedScheduler.newSourcePartitionedSchedulerAsStageScheduler
public static StageScheduler newSourcePartitionedSchedulerAsStageScheduler( SqlStageExecution stage, PlanNodeId partitionedNode, SplitSource splitSource, SplitPlacementPolicy splitPlacementPolicy, int splitBatchSize) { SourcePartitionedScheduler sourcePartitionedScheduler = new SourcePartitionedScheduler(stage, partitionedNode, splitSource, splitPlacementPolicy, splitBatchSize, false); sourcePartitionedScheduler.startLifespan(Lifespan.taskWide(), NOT_PARTITIONED); return new StageScheduler() { @Override public ScheduleResult schedule() { ScheduleResult scheduleResult = sourcePartitionedScheduler.schedule(); sourcePartitionedScheduler.drainCompletelyScheduledLifespans(); return scheduleResult; } @Override public void close() { sourcePartitionedScheduler.close(); } }; }
java
public static StageScheduler newSourcePartitionedSchedulerAsStageScheduler( SqlStageExecution stage, PlanNodeId partitionedNode, SplitSource splitSource, SplitPlacementPolicy splitPlacementPolicy, int splitBatchSize) { SourcePartitionedScheduler sourcePartitionedScheduler = new SourcePartitionedScheduler(stage, partitionedNode, splitSource, splitPlacementPolicy, splitBatchSize, false); sourcePartitionedScheduler.startLifespan(Lifespan.taskWide(), NOT_PARTITIONED); return new StageScheduler() { @Override public ScheduleResult schedule() { ScheduleResult scheduleResult = sourcePartitionedScheduler.schedule(); sourcePartitionedScheduler.drainCompletelyScheduledLifespans(); return scheduleResult; } @Override public void close() { sourcePartitionedScheduler.close(); } }; }
[ "public", "static", "StageScheduler", "newSourcePartitionedSchedulerAsStageScheduler", "(", "SqlStageExecution", "stage", ",", "PlanNodeId", "partitionedNode", ",", "SplitSource", "splitSource", ",", "SplitPlacementPolicy", "splitPlacementPolicy", ",", "int", "splitBatchSize", ...
Obtains an instance of {@code SourcePartitionedScheduler} suitable for use as a stage scheduler. <p> This returns an ungrouped {@code SourcePartitionedScheduler} that requires minimal management from the caller, which is ideal for use as a stage scheduler.
[ "Obtains", "an", "instance", "of", "{" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/scheduler/SourcePartitionedScheduler.java#L129-L154
DDTH/ddth-kafka
src/main/java/com/github/ddth/kafka/KafkaClient.java
KafkaClient.seekToEnd
public boolean seekToEnd(String consumerGroupId, String topic) { KafkaMsgConsumer consumer = getKafkaConsumer(consumerGroupId, false); return consumer.seekToEnd(topic); }
java
public boolean seekToEnd(String consumerGroupId, String topic) { KafkaMsgConsumer consumer = getKafkaConsumer(consumerGroupId, false); return consumer.seekToEnd(topic); }
[ "public", "boolean", "seekToEnd", "(", "String", "consumerGroupId", ",", "String", "topic", ")", "{", "KafkaMsgConsumer", "consumer", "=", "getKafkaConsumer", "(", "consumerGroupId", ",", "false", ")", ";", "return", "consumer", ".", "seekToEnd", "(", "topic", "...
Seeks to the end of all assigned partitions of a topic. @param consumerGroupId @param topic @return {@code true} if the consumer has subscribed to the specified topic, {@code false} otherwise. @since 1.2.0
[ "Seeks", "to", "the", "end", "of", "all", "assigned", "partitions", "of", "a", "topic", "." ]
train
https://github.com/DDTH/ddth-kafka/blob/aaeb8536e28a109ac0b69022f0ea4bbf5696b76f/src/main/java/com/github/ddth/kafka/KafkaClient.java#L448-L451
lagom/lagom
service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/RequestHeader.java
RequestHeader.withPrincipal
public RequestHeader withPrincipal(Principal principal) { return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, Optional.ofNullable(principal), headers, lowercaseHeaders); }
java
public RequestHeader withPrincipal(Principal principal) { return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, Optional.ofNullable(principal), headers, lowercaseHeaders); }
[ "public", "RequestHeader", "withPrincipal", "(", "Principal", "principal", ")", "{", "return", "new", "RequestHeader", "(", "method", ",", "uri", ",", "protocol", ",", "acceptedResponseProtocols", ",", "Optional", ".", "ofNullable", "(", "principal", ")", ",", "...
Return a copy of this request header with the principal set. @param principal The principal to set. @return A copy of this request header.
[ "Return", "a", "copy", "of", "this", "request", "header", "with", "the", "principal", "set", "." ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/RequestHeader.java#L127-L129
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/overlay/ItemizedOverlay.java
ItemizedOverlay.boundToHotspot
protected Drawable boundToHotspot(final Drawable marker, HotspotPlace hotspot) { if (hotspot == null) { hotspot = HotspotPlace.BOTTOM_CENTER; } final int markerWidth = marker.getIntrinsicWidth(); final int markerHeight = marker.getIntrinsicHeight(); final int offsetX; final int offsetY; switch(hotspot) { default: case NONE: case LEFT_CENTER: case UPPER_LEFT_CORNER: case LOWER_LEFT_CORNER: offsetX = 0; break; case CENTER: case BOTTOM_CENTER: case TOP_CENTER: offsetX = -markerWidth / 2; break; case RIGHT_CENTER: case UPPER_RIGHT_CORNER: case LOWER_RIGHT_CORNER: offsetX = -markerWidth; break; } switch (hotspot) { default: case NONE: case TOP_CENTER: case UPPER_LEFT_CORNER: case UPPER_RIGHT_CORNER: offsetY = 0; break; case CENTER: case RIGHT_CENTER: case LEFT_CENTER: offsetY = -markerHeight / 2; break; case BOTTOM_CENTER: case LOWER_RIGHT_CORNER: case LOWER_LEFT_CORNER: offsetY = -markerHeight; break; } marker.setBounds(offsetX, offsetY, offsetX + markerWidth, offsetY + markerHeight); return marker; }
java
protected Drawable boundToHotspot(final Drawable marker, HotspotPlace hotspot) { if (hotspot == null) { hotspot = HotspotPlace.BOTTOM_CENTER; } final int markerWidth = marker.getIntrinsicWidth(); final int markerHeight = marker.getIntrinsicHeight(); final int offsetX; final int offsetY; switch(hotspot) { default: case NONE: case LEFT_CENTER: case UPPER_LEFT_CORNER: case LOWER_LEFT_CORNER: offsetX = 0; break; case CENTER: case BOTTOM_CENTER: case TOP_CENTER: offsetX = -markerWidth / 2; break; case RIGHT_CENTER: case UPPER_RIGHT_CORNER: case LOWER_RIGHT_CORNER: offsetX = -markerWidth; break; } switch (hotspot) { default: case NONE: case TOP_CENTER: case UPPER_LEFT_CORNER: case UPPER_RIGHT_CORNER: offsetY = 0; break; case CENTER: case RIGHT_CENTER: case LEFT_CENTER: offsetY = -markerHeight / 2; break; case BOTTOM_CENTER: case LOWER_RIGHT_CORNER: case LOWER_LEFT_CORNER: offsetY = -markerHeight; break; } marker.setBounds(offsetX, offsetY, offsetX + markerWidth, offsetY + markerHeight); return marker; }
[ "protected", "Drawable", "boundToHotspot", "(", "final", "Drawable", "marker", ",", "HotspotPlace", "hotspot", ")", "{", "if", "(", "hotspot", "==", "null", ")", "{", "hotspot", "=", "HotspotPlace", ".", "BOTTOM_CENTER", ";", "}", "final", "int", "markerWidth"...
Adjusts a drawable's bounds so that (0,0) is a pixel in the location described by the hotspot parameter. Useful for "pin"-like graphics. For convenience, returns the same drawable that was passed in. @param marker the drawable to adjust @param hotspot the hotspot for the drawable @return the same drawable that was passed in.
[ "Adjusts", "a", "drawable", "s", "bounds", "so", "that", "(", "0", "0", ")", "is", "a", "pixel", "in", "the", "location", "described", "by", "the", "hotspot", "parameter", ".", "Useful", "for", "pin", "-", "like", "graphics", ".", "For", "convenience", ...
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/ItemizedOverlay.java#L346-L394
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeColorWithDefault
@Pure public static Integer getAttributeColorWithDefault(Node document, Integer defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeColorWithDefault(document, true, defaultValue, path); }
java
@Pure public static Integer getAttributeColorWithDefault(Node document, Integer defaultValue, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeColorWithDefault(document, true, defaultValue, path); }
[ "@", "Pure", "public", "static", "Integer", "getAttributeColorWithDefault", "(", "Node", "document", ",", "Integer", "defaultValue", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", ...
Replies the color that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. Be careful about the fact that the names are case sensitives. @param document is the XML document to explore. @param path is the list of and ended by the attribute's name. @param defaultValue is the default value to reply. @return the color of the specified attribute.
[ "Replies", "the", "color", "that", "corresponds", "to", "the", "specified", "attribute", "s", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L481-L485
VoltDB/voltdb
src/frontend/org/voltdb/expressions/ExpressionUtil.java
ExpressionUtil.getType
private static String getType(Database db, VoltXMLElement elm) { final String type = elm.getStringAttribute("valuetype", ""); if (! type.isEmpty()) { return type; } else if (elm.name.equals("columnref")) { final String tblName = elm.getStringAttribute("table", ""); final int colIndex = elm.getIntAttribute("index", 0); return StreamSupport.stream(db.getTables().spliterator(), false) .filter(tbl -> tbl.getTypeName().equals(tblName)) .findAny() .flatMap(tbl -> StreamSupport.stream(tbl.getColumns().spliterator(), false) .filter(col -> col.getIndex() == colIndex) .findAny()) .map(Column::getType) .map(typ -> VoltType.get((byte) ((int)typ)).getName()) .orElse(""); } else { return ""; } }
java
private static String getType(Database db, VoltXMLElement elm) { final String type = elm.getStringAttribute("valuetype", ""); if (! type.isEmpty()) { return type; } else if (elm.name.equals("columnref")) { final String tblName = elm.getStringAttribute("table", ""); final int colIndex = elm.getIntAttribute("index", 0); return StreamSupport.stream(db.getTables().spliterator(), false) .filter(tbl -> tbl.getTypeName().equals(tblName)) .findAny() .flatMap(tbl -> StreamSupport.stream(tbl.getColumns().spliterator(), false) .filter(col -> col.getIndex() == colIndex) .findAny()) .map(Column::getType) .map(typ -> VoltType.get((byte) ((int)typ)).getName()) .orElse(""); } else { return ""; } }
[ "private", "static", "String", "getType", "(", "Database", "db", ",", "VoltXMLElement", "elm", ")", "{", "final", "String", "type", "=", "elm", ".", "getStringAttribute", "(", "\"valuetype\"", ",", "\"\"", ")", ";", "if", "(", "!", "type", ".", "isEmpty", ...
Get the underlying type of the VoltXMLElement node. Need reference to the catalog for PVE @param db catalog @param elm element under inspection @return string representation of the element node
[ "Get", "the", "underlying", "type", "of", "the", "VoltXMLElement", "node", ".", "Need", "reference", "to", "the", "catalog", "for", "PVE" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/ExpressionUtil.java#L120-L140
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageAdvancedForm.java
CmsImageAdvancedForm.fillContent
public void fillContent(CmsImageInfoBean imageInfo, CmsJSONMap imageAttributes, boolean initialFill) { for (Entry<Attribute, I_CmsFormWidget> entry : m_fields.entrySet()) { String val = imageAttributes.getString(entry.getKey().name()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) { if ((entry.getKey() == Attribute.linkPath) && val.startsWith(CmsCoreProvider.get().getVfsPrefix())) { entry.getValue().setFormValueAsString(val.substring(CmsCoreProvider.get().getVfsPrefix().length())); } else { entry.getValue().setFormValueAsString(val); } } } }
java
public void fillContent(CmsImageInfoBean imageInfo, CmsJSONMap imageAttributes, boolean initialFill) { for (Entry<Attribute, I_CmsFormWidget> entry : m_fields.entrySet()) { String val = imageAttributes.getString(entry.getKey().name()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) { if ((entry.getKey() == Attribute.linkPath) && val.startsWith(CmsCoreProvider.get().getVfsPrefix())) { entry.getValue().setFormValueAsString(val.substring(CmsCoreProvider.get().getVfsPrefix().length())); } else { entry.getValue().setFormValueAsString(val); } } } }
[ "public", "void", "fillContent", "(", "CmsImageInfoBean", "imageInfo", ",", "CmsJSONMap", "imageAttributes", ",", "boolean", "initialFill", ")", "{", "for", "(", "Entry", "<", "Attribute", ",", "I_CmsFormWidget", ">", "entry", ":", "m_fields", ".", "entrySet", "...
Displays the provided image information.<p> @param imageInfo the image information @param imageAttributes the image attributes @param initialFill flag to indicate that a new image has been selected
[ "Displays", "the", "provided", "image", "information", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageAdvancedForm.java#L192-L204
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/PoolBase.java
PoolBase.setNetworkTimeout
private void setNetworkTimeout(final Connection connection, final long timeoutMs) throws SQLException { if (isNetworkTimeoutSupported == TRUE) { connection.setNetworkTimeout(netTimeoutExecutor, (int) timeoutMs); } }
java
private void setNetworkTimeout(final Connection connection, final long timeoutMs) throws SQLException { if (isNetworkTimeoutSupported == TRUE) { connection.setNetworkTimeout(netTimeoutExecutor, (int) timeoutMs); } }
[ "private", "void", "setNetworkTimeout", "(", "final", "Connection", "connection", ",", "final", "long", "timeoutMs", ")", "throws", "SQLException", "{", "if", "(", "isNetworkTimeoutSupported", "==", "TRUE", ")", "{", "connection", ".", "setNetworkTimeout", "(", "n...
Set the network timeout, if <code>isUseNetworkTimeout</code> is <code>true</code> and the driver supports it. @param connection the connection to set the network timeout on @param timeoutMs the number of milliseconds before timeout @throws SQLException throw if the connection.setNetworkTimeout() call throws
[ "Set", "the", "network", "timeout", "if", "<code", ">", "isUseNetworkTimeout<", "/", "code", ">", "is", "<code", ">", "true<", "/", "code", ">", "and", "the", "driver", "supports", "it", "." ]
train
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java#L549-L554
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignCreator.java
ExitSignCreator.postProcess
@Override void postProcess(TextView textView, List<BannerComponentNode> bannerComponentNodes) { if (exitNumber != null) { LayoutInflater inflater = (LayoutInflater) textView.getContext().getSystemService(Context .LAYOUT_INFLATER_SERVICE); ViewGroup root = (ViewGroup) textView.getParent(); TextView exitSignView; if (modifier.equals(LEFT)) { exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_left, root, false); } else { exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_right, root, false); } exitSignView.setText(exitNumber); textViewUtils.setImageSpan(textView, exitSignView, startIndex, startIndex + exitNumber .length()); } }
java
@Override void postProcess(TextView textView, List<BannerComponentNode> bannerComponentNodes) { if (exitNumber != null) { LayoutInflater inflater = (LayoutInflater) textView.getContext().getSystemService(Context .LAYOUT_INFLATER_SERVICE); ViewGroup root = (ViewGroup) textView.getParent(); TextView exitSignView; if (modifier.equals(LEFT)) { exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_left, root, false); } else { exitSignView = (TextView) inflater.inflate(R.layout.exit_sign_view_right, root, false); } exitSignView.setText(exitNumber); textViewUtils.setImageSpan(textView, exitSignView, startIndex, startIndex + exitNumber .length()); } }
[ "@", "Override", "void", "postProcess", "(", "TextView", "textView", ",", "List", "<", "BannerComponentNode", ">", "bannerComponentNodes", ")", "{", "if", "(", "exitNumber", "!=", "null", ")", "{", "LayoutInflater", "inflater", "=", "(", "LayoutInflater", ")", ...
One coordinator should override this method, and this should be the coordinator which populates the textView with text. @param textView to populate @param bannerComponentNodes containing instructions
[ "One", "coordinator", "should", "override", "this", "method", "and", "this", "should", "be", "the", "coordinator", "which", "populates", "the", "textView", "with", "text", "." ]
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/ExitSignCreator.java#L48-L69