repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java
BackendServiceClient.deleteSignedUrlKeyBackendService
@BetaApi public final Operation deleteSignedUrlKeyBackendService(String backendService, String keyName) { """ Deletes a key for validating requests with signed URLs for this backend service. <p>Sample code: <pre><code> try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) { ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); String keyName = ""; Operation response = backendServiceClient.deleteSignedUrlKeyBackendService(backendService.toString(), keyName); } </code></pre> @param backendService Name of the BackendService resource to which the Signed URL Key should be added. The name should conform to RFC1035. @param keyName The name of the Signed URL Key to delete. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ DeleteSignedUrlKeyBackendServiceHttpRequest request = DeleteSignedUrlKeyBackendServiceHttpRequest.newBuilder() .setBackendService(backendService) .setKeyName(keyName) .build(); return deleteSignedUrlKeyBackendService(request); }
java
@BetaApi public final Operation deleteSignedUrlKeyBackendService(String backendService, String keyName) { DeleteSignedUrlKeyBackendServiceHttpRequest request = DeleteSignedUrlKeyBackendServiceHttpRequest.newBuilder() .setBackendService(backendService) .setKeyName(keyName) .build(); return deleteSignedUrlKeyBackendService(request); }
[ "@", "BetaApi", "public", "final", "Operation", "deleteSignedUrlKeyBackendService", "(", "String", "backendService", ",", "String", "keyName", ")", "{", "DeleteSignedUrlKeyBackendServiceHttpRequest", "request", "=", "DeleteSignedUrlKeyBackendServiceHttpRequest", ".", "newBuilder", "(", ")", ".", "setBackendService", "(", "backendService", ")", ".", "setKeyName", "(", "keyName", ")", ".", "build", "(", ")", ";", "return", "deleteSignedUrlKeyBackendService", "(", "request", ")", ";", "}" ]
Deletes a key for validating requests with signed URLs for this backend service. <p>Sample code: <pre><code> try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) { ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]"); String keyName = ""; Operation response = backendServiceClient.deleteSignedUrlKeyBackendService(backendService.toString(), keyName); } </code></pre> @param backendService Name of the BackendService resource to which the Signed URL Key should be added. The name should conform to RFC1035. @param keyName The name of the Signed URL Key to delete. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Deletes", "a", "key", "for", "validating", "requests", "with", "signed", "URLs", "for", "this", "backend", "service", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendServiceClient.java#L568-L577
amzn/ion-java
src/com/amazon/ion/Timestamp.java
Timestamp.addDay
public final Timestamp addDay(int amount) { """ Returns a timestamp relative to this one by the given number of days. @param amount a number of days. """ long delta = (long) amount * 24 * 60 * 60 * 1000; return addMillisForPrecision(delta, Precision.DAY, false); }
java
public final Timestamp addDay(int amount) { long delta = (long) amount * 24 * 60 * 60 * 1000; return addMillisForPrecision(delta, Precision.DAY, false); }
[ "public", "final", "Timestamp", "addDay", "(", "int", "amount", ")", "{", "long", "delta", "=", "(", "long", ")", "amount", "*", "24", "*", "60", "*", "60", "*", "1000", ";", "return", "addMillisForPrecision", "(", "delta", ",", "Precision", ".", "DAY", ",", "false", ")", ";", "}" ]
Returns a timestamp relative to this one by the given number of days. @param amount a number of days.
[ "Returns", "a", "timestamp", "relative", "to", "this", "one", "by", "the", "given", "number", "of", "days", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L2443-L2447
hdbeukel/james-core
src/main/java/org/jamesframework/core/search/Search.java
Search.setStopCriterionCheckPeriod
public void setStopCriterionCheckPeriod(long period, TimeUnit timeUnit) { """ Instructs the search to check its stop criteria at regular intervals separated by the given period. For the default period, see {@link StopCriterionChecker}, which is used internally for this purpose. The period should be at least 1 millisecond, else the stop criterion checker may thrown an exception when the search is started. Note that this method may only be called when the search is idle. <p> Regardless of the specified period, the stop criteria are also checked after each search step. @param period time between subsequent stop criterion checks (&gt; 0) @param timeUnit corresponding time unit @throws SearchException if the search is not idle @throws IllegalArgumentException if the given period is not strictly positive """ // acquire status lock synchronized(statusLock){ // assert idle assertIdle("Cannot modify stop criterion check period."); // pass new settings to checker stopCriterionChecker.setPeriod(period, timeUnit); // log LOGGER.debug("{}: set stop criterion check period to {} ms", this, timeUnit.toMillis(period)); } }
java
public void setStopCriterionCheckPeriod(long period, TimeUnit timeUnit){ // acquire status lock synchronized(statusLock){ // assert idle assertIdle("Cannot modify stop criterion check period."); // pass new settings to checker stopCriterionChecker.setPeriod(period, timeUnit); // log LOGGER.debug("{}: set stop criterion check period to {} ms", this, timeUnit.toMillis(period)); } }
[ "public", "void", "setStopCriterionCheckPeriod", "(", "long", "period", ",", "TimeUnit", "timeUnit", ")", "{", "// acquire status lock", "synchronized", "(", "statusLock", ")", "{", "// assert idle", "assertIdle", "(", "\"Cannot modify stop criterion check period.\"", ")", ";", "// pass new settings to checker", "stopCriterionChecker", ".", "setPeriod", "(", "period", ",", "timeUnit", ")", ";", "// log", "LOGGER", ".", "debug", "(", "\"{}: set stop criterion check period to {} ms\"", ",", "this", ",", "timeUnit", ".", "toMillis", "(", "period", ")", ")", ";", "}", "}" ]
Instructs the search to check its stop criteria at regular intervals separated by the given period. For the default period, see {@link StopCriterionChecker}, which is used internally for this purpose. The period should be at least 1 millisecond, else the stop criterion checker may thrown an exception when the search is started. Note that this method may only be called when the search is idle. <p> Regardless of the specified period, the stop criteria are also checked after each search step. @param period time between subsequent stop criterion checks (&gt; 0) @param timeUnit corresponding time unit @throws SearchException if the search is not idle @throws IllegalArgumentException if the given period is not strictly positive
[ "Instructs", "the", "search", "to", "check", "its", "stop", "criteria", "at", "regular", "intervals", "separated", "by", "the", "given", "period", ".", "For", "the", "default", "period", "see", "{", "@link", "StopCriterionChecker", "}", "which", "is", "used", "internally", "for", "this", "purpose", ".", "The", "period", "should", "be", "at", "least", "1", "millisecond", "else", "the", "stop", "criterion", "checker", "may", "thrown", "an", "exception", "when", "the", "search", "is", "started", ".", "Note", "that", "this", "method", "may", "only", "be", "called", "when", "the", "search", "is", "idle", ".", "<p", ">", "Regardless", "of", "the", "specified", "period", "the", "stop", "criteria", "are", "also", "checked", "after", "each", "search", "step", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/Search.java#L596-L606
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/InventoryItem.java
InventoryItem.setContent
public void setContent(java.util.Collection<java.util.Map<String, String>> content) { """ <p> The inventory data of the inventory type. </p> @param content The inventory data of the inventory type. """ if (content == null) { this.content = null; return; } this.content = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(content); }
java
public void setContent(java.util.Collection<java.util.Map<String, String>> content) { if (content == null) { this.content = null; return; } this.content = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(content); }
[ "public", "void", "setContent", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", ">", "content", ")", "{", "if", "(", "content", "==", "null", ")", "{", "this", ".", "content", "=", "null", ";", "return", ";", "}", "this", ".", "content", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", ">", "(", "content", ")", ";", "}" ]
<p> The inventory data of the inventory type. </p> @param content The inventory data of the inventory type.
[ "<p", ">", "The", "inventory", "data", "of", "the", "inventory", "type", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/InventoryItem.java#L282-L289
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getTag
public Tag getTag(UUID projectId, UUID tagId, GetTagOptionalParameter getTagOptionalParameter) { """ Get information about a specific tag. @param projectId The project this tag belongs to @param tagId The tag id @param getTagOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the Tag object if successful. """ return getTagWithServiceResponseAsync(projectId, tagId, getTagOptionalParameter).toBlocking().single().body(); }
java
public Tag getTag(UUID projectId, UUID tagId, GetTagOptionalParameter getTagOptionalParameter) { return getTagWithServiceResponseAsync(projectId, tagId, getTagOptionalParameter).toBlocking().single().body(); }
[ "public", "Tag", "getTag", "(", "UUID", "projectId", ",", "UUID", "tagId", ",", "GetTagOptionalParameter", "getTagOptionalParameter", ")", "{", "return", "getTagWithServiceResponseAsync", "(", "projectId", ",", "tagId", ",", "getTagOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Get information about a specific tag. @param projectId The project this tag belongs to @param tagId The tag id @param getTagOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the Tag object if successful.
[ "Get", "information", "about", "a", "specific", "tag", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L777-L779
pmwmedia/tinylog
tinylog-impl/src/main/java/org/tinylog/writers/RollingFileWriter.java
RollingFileWriter.canBeContinued
private static boolean canBeContinued(final String fileName, final List<Policy> policies) { """ Checks if an already existing log file can be continued. @param fileName Log file @param policies Policies that should be applied @return {@code true} if the passed log file can be continued, {@code false} if a new log file should be started """ boolean result = true; for (Policy policy : policies) { result &= policy.continueExistingFile(fileName); } return result; }
java
private static boolean canBeContinued(final String fileName, final List<Policy> policies) { boolean result = true; for (Policy policy : policies) { result &= policy.continueExistingFile(fileName); } return result; }
[ "private", "static", "boolean", "canBeContinued", "(", "final", "String", "fileName", ",", "final", "List", "<", "Policy", ">", "policies", ")", "{", "boolean", "result", "=", "true", ";", "for", "(", "Policy", "policy", ":", "policies", ")", "{", "result", "&=", "policy", ".", "continueExistingFile", "(", "fileName", ")", ";", "}", "return", "result", ";", "}" ]
Checks if an already existing log file can be continued. @param fileName Log file @param policies Policies that should be applied @return {@code true} if the passed log file can be continued, {@code false} if a new log file should be started
[ "Checks", "if", "an", "already", "existing", "log", "file", "can", "be", "continued", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/writers/RollingFileWriter.java#L206-L212
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java
SyntheticStorableReferenceBuilder.copyFromMaster
@Deprecated public void copyFromMaster(Storable indexEntry, S master) throws FetchException { """ Sets all the properties of the given index entry, using the applicable properties of the given master. @param indexEntry index entry whose properties will be set @param master source of property values @deprecated call getReferenceAccess """ getReferenceAccess().copyFromMaster(indexEntry, master); }
java
@Deprecated public void copyFromMaster(Storable indexEntry, S master) throws FetchException { getReferenceAccess().copyFromMaster(indexEntry, master); }
[ "@", "Deprecated", "public", "void", "copyFromMaster", "(", "Storable", "indexEntry", ",", "S", "master", ")", "throws", "FetchException", "{", "getReferenceAccess", "(", ")", ".", "copyFromMaster", "(", "indexEntry", ",", "master", ")", ";", "}" ]
Sets all the properties of the given index entry, using the applicable properties of the given master. @param indexEntry index entry whose properties will be set @param master source of property values @deprecated call getReferenceAccess
[ "Sets", "all", "the", "properties", "of", "the", "given", "index", "entry", "using", "the", "applicable", "properties", "of", "the", "given", "master", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java#L366-L369
elki-project/elki
elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/invertedlist/InMemoryInvertedIndex.java
InMemoryInvertedIndex.indexDense
private void indexDense(DBIDRef ref, V obj) { """ Index a single (dense) instance. @param ref Object reference @param obj Object to index. """ double len = 0.; for(int dim = 0, max = obj.getDimensionality(); dim < max; dim++) { final double val = obj.doubleValue(dim); if(val == 0. || val != val) { continue; } len += val * val; getOrCreateColumn(dim).add(val, ref); } length.put(ref, FastMath.sqrt(len)); }
java
private void indexDense(DBIDRef ref, V obj) { double len = 0.; for(int dim = 0, max = obj.getDimensionality(); dim < max; dim++) { final double val = obj.doubleValue(dim); if(val == 0. || val != val) { continue; } len += val * val; getOrCreateColumn(dim).add(val, ref); } length.put(ref, FastMath.sqrt(len)); }
[ "private", "void", "indexDense", "(", "DBIDRef", "ref", ",", "V", "obj", ")", "{", "double", "len", "=", "0.", ";", "for", "(", "int", "dim", "=", "0", ",", "max", "=", "obj", ".", "getDimensionality", "(", ")", ";", "dim", "<", "max", ";", "dim", "++", ")", "{", "final", "double", "val", "=", "obj", ".", "doubleValue", "(", "dim", ")", ";", "if", "(", "val", "==", "0.", "||", "val", "!=", "val", ")", "{", "continue", ";", "}", "len", "+=", "val", "*", "val", ";", "getOrCreateColumn", "(", "dim", ")", ".", "add", "(", "val", ",", "ref", ")", ";", "}", "length", ".", "put", "(", "ref", ",", "FastMath", ".", "sqrt", "(", "len", ")", ")", ";", "}" ]
Index a single (dense) instance. @param ref Object reference @param obj Object to index.
[ "Index", "a", "single", "(", "dense", ")", "instance", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/invertedlist/InMemoryInvertedIndex.java#L146-L157
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java
ArrayUtil.readShort
public static short readShort(byte b[], int offset) { """ Unserializes a short from a byte array at a specific offset in big-endian order @param b byte array from which to read a short value. @param offset offset within byte array to start reading. @return short read from byte array. """ int retValue; retValue = b[offset++] << 8; retValue |= b[offset] & 0xff; return (short)retValue; }
java
public static short readShort(byte b[], int offset) { int retValue; retValue = b[offset++] << 8; retValue |= b[offset] & 0xff; return (short)retValue; }
[ "public", "static", "short", "readShort", "(", "byte", "b", "[", "]", ",", "int", "offset", ")", "{", "int", "retValue", ";", "retValue", "=", "b", "[", "offset", "++", "]", "<<", "8", ";", "retValue", "|=", "b", "[", "offset", "]", "&", "0xff", ";", "return", "(", "short", ")", "retValue", ";", "}" ]
Unserializes a short from a byte array at a specific offset in big-endian order @param b byte array from which to read a short value. @param offset offset within byte array to start reading. @return short read from byte array.
[ "Unserializes", "a", "short", "from", "a", "byte", "array", "at", "a", "specific", "offset", "in", "big", "-", "endian", "order" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L118-L125
vipshop/vjtools
vjkit/src/main/java/com/vip/vjtools/vjkit/concurrent/limiter/RateLimiterUtil.java
RateLimiterUtil.create
public static RateLimiter create(double permitsPerSecond, double maxBurstSeconds, boolean filledWithToken) throws ReflectiveOperationException { """ 一个用来定制RateLimiter的方法。 @param permitsPerSecond 每秒允许的请求书,可看成QPS @param maxBurstSeconds 最大的突发缓冲时间。用来应对突发流量。Guava的实现默认是1s。permitsPerSecond * maxBurstSeconds的数量,就是闲置时预留的缓冲token数量 @param filledWithToken 是否需要创建时就保留有permitsPerSecond * maxBurstSeconds的token """ Class<?> sleepingStopwatchClass = Class .forName("com.google.common.util.concurrent.RateLimiter$SleepingStopwatch"); Method createStopwatchMethod = sleepingStopwatchClass.getDeclaredMethod("createFromSystemTimer"); createStopwatchMethod.setAccessible(true); Object stopwatch = createStopwatchMethod.invoke(null); Class<?> burstyRateLimiterClass = Class .forName("com.google.common.util.concurrent.SmoothRateLimiter$SmoothBursty"); Constructor<?> burstyRateLimiterConstructor = burstyRateLimiterClass.getDeclaredConstructors()[0]; burstyRateLimiterConstructor.setAccessible(true); // set maxBurstSeconds RateLimiter rateLimiter = (RateLimiter) burstyRateLimiterConstructor.newInstance(stopwatch, maxBurstSeconds); rateLimiter.setRate(permitsPerSecond); if (filledWithToken) { // set storedPermits setField(rateLimiter, "storedPermits", permitsPerSecond * maxBurstSeconds); } return rateLimiter; }
java
public static RateLimiter create(double permitsPerSecond, double maxBurstSeconds, boolean filledWithToken) throws ReflectiveOperationException { Class<?> sleepingStopwatchClass = Class .forName("com.google.common.util.concurrent.RateLimiter$SleepingStopwatch"); Method createStopwatchMethod = sleepingStopwatchClass.getDeclaredMethod("createFromSystemTimer"); createStopwatchMethod.setAccessible(true); Object stopwatch = createStopwatchMethod.invoke(null); Class<?> burstyRateLimiterClass = Class .forName("com.google.common.util.concurrent.SmoothRateLimiter$SmoothBursty"); Constructor<?> burstyRateLimiterConstructor = burstyRateLimiterClass.getDeclaredConstructors()[0]; burstyRateLimiterConstructor.setAccessible(true); // set maxBurstSeconds RateLimiter rateLimiter = (RateLimiter) burstyRateLimiterConstructor.newInstance(stopwatch, maxBurstSeconds); rateLimiter.setRate(permitsPerSecond); if (filledWithToken) { // set storedPermits setField(rateLimiter, "storedPermits", permitsPerSecond * maxBurstSeconds); } return rateLimiter; }
[ "public", "static", "RateLimiter", "create", "(", "double", "permitsPerSecond", ",", "double", "maxBurstSeconds", ",", "boolean", "filledWithToken", ")", "throws", "ReflectiveOperationException", "{", "Class", "<", "?", ">", "sleepingStopwatchClass", "=", "Class", ".", "forName", "(", "\"com.google.common.util.concurrent.RateLimiter$SleepingStopwatch\"", ")", ";", "Method", "createStopwatchMethod", "=", "sleepingStopwatchClass", ".", "getDeclaredMethod", "(", "\"createFromSystemTimer\"", ")", ";", "createStopwatchMethod", ".", "setAccessible", "(", "true", ")", ";", "Object", "stopwatch", "=", "createStopwatchMethod", ".", "invoke", "(", "null", ")", ";", "Class", "<", "?", ">", "burstyRateLimiterClass", "=", "Class", ".", "forName", "(", "\"com.google.common.util.concurrent.SmoothRateLimiter$SmoothBursty\"", ")", ";", "Constructor", "<", "?", ">", "burstyRateLimiterConstructor", "=", "burstyRateLimiterClass", ".", "getDeclaredConstructors", "(", ")", "[", "0", "]", ";", "burstyRateLimiterConstructor", ".", "setAccessible", "(", "true", ")", ";", "// set maxBurstSeconds", "RateLimiter", "rateLimiter", "=", "(", "RateLimiter", ")", "burstyRateLimiterConstructor", ".", "newInstance", "(", "stopwatch", ",", "maxBurstSeconds", ")", ";", "rateLimiter", ".", "setRate", "(", "permitsPerSecond", ")", ";", "if", "(", "filledWithToken", ")", "{", "// set storedPermits", "setField", "(", "rateLimiter", ",", "\"storedPermits\"", ",", "permitsPerSecond", "*", "maxBurstSeconds", ")", ";", "}", "return", "rateLimiter", ";", "}" ]
一个用来定制RateLimiter的方法。 @param permitsPerSecond 每秒允许的请求书,可看成QPS @param maxBurstSeconds 最大的突发缓冲时间。用来应对突发流量。Guava的实现默认是1s。permitsPerSecond * maxBurstSeconds的数量,就是闲置时预留的缓冲token数量 @param filledWithToken 是否需要创建时就保留有permitsPerSecond * maxBurstSeconds的token
[ "一个用来定制RateLimiter的方法。" ]
train
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/concurrent/limiter/RateLimiterUtil.java#L29-L52
Impetus/Kundera
src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBObjectMapper.java
CouchDBObjectMapper.getJsonPrimitive
private static JsonElement getJsonPrimitive(Object value, Class clazz) { """ Gets the json primitive. @param value the value @param clazz the clazz @return the json primitive """ if (value != null) { if (clazz.isAssignableFrom(Number.class) || value instanceof Number) { return new JsonPrimitive((Number) value); } else if (clazz.isAssignableFrom(Boolean.class) || value instanceof Boolean) { return new JsonPrimitive((Boolean) value); } else if (clazz.isAssignableFrom(Character.class) || value instanceof Character) { return new JsonPrimitive((Character) value); } else if (clazz.isAssignableFrom(byte[].class) || value instanceof byte[]) { return new JsonPrimitive(PropertyAccessorFactory.STRING.fromBytes(String.class, (byte[]) value)); } else { return new JsonPrimitive(PropertyAccessorHelper.getString(value)); } }
java
private static JsonElement getJsonPrimitive(Object value, Class clazz) { if (value != null) { if (clazz.isAssignableFrom(Number.class) || value instanceof Number) { return new JsonPrimitive((Number) value); } else if (clazz.isAssignableFrom(Boolean.class) || value instanceof Boolean) { return new JsonPrimitive((Boolean) value); } else if (clazz.isAssignableFrom(Character.class) || value instanceof Character) { return new JsonPrimitive((Character) value); } else if (clazz.isAssignableFrom(byte[].class) || value instanceof byte[]) { return new JsonPrimitive(PropertyAccessorFactory.STRING.fromBytes(String.class, (byte[]) value)); } else { return new JsonPrimitive(PropertyAccessorHelper.getString(value)); } }
[ "private", "static", "JsonElement", "getJsonPrimitive", "(", "Object", "value", ",", "Class", "clazz", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "clazz", ".", "isAssignableFrom", "(", "Number", ".", "class", ")", "||", "value", "instanceof", "Number", ")", "{", "return", "new", "JsonPrimitive", "(", "(", "Number", ")", "value", ")", ";", "}", "else", "if", "(", "clazz", ".", "isAssignableFrom", "(", "Boolean", ".", "class", ")", "||", "value", "instanceof", "Boolean", ")", "{", "return", "new", "JsonPrimitive", "(", "(", "Boolean", ")", "value", ")", ";", "}", "else", "if", "(", "clazz", ".", "isAssignableFrom", "(", "Character", ".", "class", ")", "||", "value", "instanceof", "Character", ")", "{", "return", "new", "JsonPrimitive", "(", "(", "Character", ")", "value", ")", ";", "}", "else", "if", "(", "clazz", ".", "isAssignableFrom", "(", "byte", "[", "]", ".", "class", ")", "||", "value", "instanceof", "byte", "[", "]", ")", "{", "return", "new", "JsonPrimitive", "(", "PropertyAccessorFactory", ".", "STRING", ".", "fromBytes", "(", "String", ".", "class", ",", "(", "byte", "[", "]", ")", "value", ")", ")", ";", "}", "else", "{", "return", "new", "JsonPrimitive", "(", "PropertyAccessorHelper", ".", "getString", "(", "value", ")", ")", ";", "}", "}" ]
Gets the json primitive. @param value the value @param clazz the clazz @return the json primitive
[ "Gets", "the", "json", "primitive", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBObjectMapper.java#L440-L464
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/datasource/AppSummaryService.java
AppSummaryService.getNumberRunsScratch
long getNumberRunsScratch(Map<byte[], byte[]> rawFamily) { """ interprets the number of runs based on number of columns in raw col family @param {@link Result} @return number of runs """ long numberRuns = 0L; if (rawFamily != null) { numberRuns = rawFamily.size(); } if (numberRuns == 0L) { LOG.error("Number of runs in scratch column family can't be 0," + " if processing within TTL"); throw new ProcessingException("Number of runs is 0"); } return numberRuns; }
java
long getNumberRunsScratch(Map<byte[], byte[]> rawFamily) { long numberRuns = 0L; if (rawFamily != null) { numberRuns = rawFamily.size(); } if (numberRuns == 0L) { LOG.error("Number of runs in scratch column family can't be 0," + " if processing within TTL"); throw new ProcessingException("Number of runs is 0"); } return numberRuns; }
[ "long", "getNumberRunsScratch", "(", "Map", "<", "byte", "[", "]", ",", "byte", "[", "]", ">", "rawFamily", ")", "{", "long", "numberRuns", "=", "0L", ";", "if", "(", "rawFamily", "!=", "null", ")", "{", "numberRuns", "=", "rawFamily", ".", "size", "(", ")", ";", "}", "if", "(", "numberRuns", "==", "0L", ")", "{", "LOG", ".", "error", "(", "\"Number of runs in scratch column family can't be 0,\"", "+", "\" if processing within TTL\"", ")", ";", "throw", "new", "ProcessingException", "(", "\"Number of runs is 0\"", ")", ";", "}", "return", "numberRuns", ";", "}" ]
interprets the number of runs based on number of columns in raw col family @param {@link Result} @return number of runs
[ "interprets", "the", "number", "of", "runs", "based", "on", "number", "of", "columns", "in", "raw", "col", "family" ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/AppSummaryService.java#L288-L299
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java
Shape.isWholeArray
public static boolean isWholeArray(int rank, int... dimension) { """ Returns true if the dimension is null or the dimension length is 1 and the first entry is {@link Integer#MAX_VALUE} @param rank the rank of the input array @param dimension the dimensions specified @return true if the dimension length is equal to the rank, the dimension is null or the dimension length is 1 and the first entry is {@link Integer#MAX_VALUE} """ return rank == 0 || dimension == null || dimension.length == 0 || (dimension.length == 1 && dimension[0] == Integer.MAX_VALUE) || dimension.length == rank; }
java
public static boolean isWholeArray(int rank, int... dimension){ return rank == 0 || dimension == null || dimension.length == 0 || (dimension.length == 1 && dimension[0] == Integer.MAX_VALUE) || dimension.length == rank; }
[ "public", "static", "boolean", "isWholeArray", "(", "int", "rank", ",", "int", "...", "dimension", ")", "{", "return", "rank", "==", "0", "||", "dimension", "==", "null", "||", "dimension", ".", "length", "==", "0", "||", "(", "dimension", ".", "length", "==", "1", "&&", "dimension", "[", "0", "]", "==", "Integer", ".", "MAX_VALUE", ")", "||", "dimension", ".", "length", "==", "rank", ";", "}" ]
Returns true if the dimension is null or the dimension length is 1 and the first entry is {@link Integer#MAX_VALUE} @param rank the rank of the input array @param dimension the dimensions specified @return true if the dimension length is equal to the rank, the dimension is null or the dimension length is 1 and the first entry is {@link Integer#MAX_VALUE}
[ "Returns", "true", "if", "the", "dimension", "is", "null", "or", "the", "dimension", "length", "is", "1", "and", "the", "first", "entry", "is", "{", "@link", "Integer#MAX_VALUE", "}", "@param", "rank", "the", "rank", "of", "the", "input", "array", "@param", "dimension", "the", "dimensions", "specified" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L348-L351
apache/flink
flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java
MemorySegment.putShortBigEndian
public final void putShortBigEndian(int index, short value) { """ Writes the given short integer value (16 bit, 2 bytes) to the given position in big-endian byte order. This method's speed depends on the system's native byte order, and it is possibly slower than {@link #putShort(int, short)}. For most cases (such as transient storage in memory or serialization for I/O and network), it suffices to know that the byte order in which the value is written is the same as the one in which it is read, and {@link #putShort(int, short)} is the preferable choice. @param index The position at which the value will be written. @param value The short value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2. """ if (LITTLE_ENDIAN) { putShort(index, Short.reverseBytes(value)); } else { putShort(index, value); } }
java
public final void putShortBigEndian(int index, short value) { if (LITTLE_ENDIAN) { putShort(index, Short.reverseBytes(value)); } else { putShort(index, value); } }
[ "public", "final", "void", "putShortBigEndian", "(", "int", "index", ",", "short", "value", ")", "{", "if", "(", "LITTLE_ENDIAN", ")", "{", "putShort", "(", "index", ",", "Short", ".", "reverseBytes", "(", "value", ")", ")", ";", "}", "else", "{", "putShort", "(", "index", ",", "value", ")", ";", "}", "}" ]
Writes the given short integer value (16 bit, 2 bytes) to the given position in big-endian byte order. This method's speed depends on the system's native byte order, and it is possibly slower than {@link #putShort(int, short)}. For most cases (such as transient storage in memory or serialization for I/O and network), it suffices to know that the byte order in which the value is written is the same as the one in which it is read, and {@link #putShort(int, short)} is the preferable choice. @param index The position at which the value will be written. @param value The short value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2.
[ "Writes", "the", "given", "short", "integer", "value", "(", "16", "bit", "2", "bytes", ")", "to", "the", "given", "position", "in", "big", "-", "endian", "byte", "order", ".", "This", "method", "s", "speed", "depends", "on", "the", "system", "s", "native", "byte", "order", "and", "it", "is", "possibly", "slower", "than", "{", "@link", "#putShort", "(", "int", "short", ")", "}", ".", "For", "most", "cases", "(", "such", "as", "transient", "storage", "in", "memory", "or", "serialization", "for", "I", "/", "O", "and", "network", ")", "it", "suffices", "to", "know", "that", "the", "byte", "order", "in", "which", "the", "value", "is", "written", "is", "the", "same", "as", "the", "one", "in", "which", "it", "is", "read", "and", "{", "@link", "#putShort", "(", "int", "short", ")", "}", "is", "the", "preferable", "choice", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L668-L674
janus-project/guava.janusproject.io
guava/src/com/google/common/util/concurrent/Uninterruptibles.java
Uninterruptibles.putUninterruptibly
public static <E> void putUninterruptibly(BlockingQueue<E> queue, E element) { """ Invokes {@code queue.}{@link BlockingQueue#put(Object) put(element)} uninterruptibly. @throws ClassCastException if the class of the specified element prevents it from being added to the given queue @throws IllegalArgumentException if some property of the specified element prevents it from being added to the given queue """ boolean interrupted = false; try { while (true) { try { queue.put(element); return; } catch (InterruptedException e) { interrupted = true; } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }
java
public static <E> void putUninterruptibly(BlockingQueue<E> queue, E element) { boolean interrupted = false; try { while (true) { try { queue.put(element); return; } catch (InterruptedException e) { interrupted = true; } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } }
[ "public", "static", "<", "E", ">", "void", "putUninterruptibly", "(", "BlockingQueue", "<", "E", ">", "queue", ",", "E", "element", ")", "{", "boolean", "interrupted", "=", "false", ";", "try", "{", "while", "(", "true", ")", "{", "try", "{", "queue", ".", "put", "(", "element", ")", ";", "return", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "interrupted", "=", "true", ";", "}", "}", "}", "finally", "{", "if", "(", "interrupted", ")", "{", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "}", "}", "}" ]
Invokes {@code queue.}{@link BlockingQueue#put(Object) put(element)} uninterruptibly. @throws ClassCastException if the class of the specified element prevents it from being added to the given queue @throws IllegalArgumentException if some property of the specified element prevents it from being added to the given queue
[ "Invokes", "{", "@code", "queue", ".", "}", "{", "@link", "BlockingQueue#put", "(", "Object", ")", "put", "(", "element", ")", "}", "uninterruptibly", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/util/concurrent/Uninterruptibles.java#L244-L260
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deletePatternAnyEntityModel
public OperationStatus deletePatternAnyEntityModel(UUID appId, String versionId, UUID entityId) { """ Deletes a Pattern.Any entity extractor from the application. @param appId The application ID. @param versionId The version ID. @param entityId The Pattern.Any entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful. """ return deletePatternAnyEntityModelWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body(); }
java
public OperationStatus deletePatternAnyEntityModel(UUID appId, String versionId, UUID entityId) { return deletePatternAnyEntityModelWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body(); }
[ "public", "OperationStatus", "deletePatternAnyEntityModel", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "deletePatternAnyEntityModelWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Deletes a Pattern.Any entity extractor from the application. @param appId The application ID. @param versionId The version ID. @param entityId The Pattern.Any entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Deletes", "a", "Pattern", ".", "Any", "entity", "extractor", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10650-L10652
michel-kraemer/gradle-download-task
src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java
DownloadAction.performDownload
private void performDownload(HttpResponse response, File destFile) throws IOException { """ Save an HTTP response to a file @param response the response to save @param destFile the destination file @throws IOException if the response could not be downloaded """ HttpEntity entity = response.getEntity(); if (entity == null) { return; } //get content length long contentLength = entity.getContentLength(); if (contentLength >= 0) { size = toLengthText(contentLength); } processedBytes = 0; loggedKb = 0; //open stream and start downloading InputStream is = entity.getContent(); streamAndMove(is, destFile); }
java
private void performDownload(HttpResponse response, File destFile) throws IOException { HttpEntity entity = response.getEntity(); if (entity == null) { return; } //get content length long contentLength = entity.getContentLength(); if (contentLength >= 0) { size = toLengthText(contentLength); } processedBytes = 0; loggedKb = 0; //open stream and start downloading InputStream is = entity.getContent(); streamAndMove(is, destFile); }
[ "private", "void", "performDownload", "(", "HttpResponse", "response", ",", "File", "destFile", ")", "throws", "IOException", "{", "HttpEntity", "entity", "=", "response", ".", "getEntity", "(", ")", ";", "if", "(", "entity", "==", "null", ")", "{", "return", ";", "}", "//get content length", "long", "contentLength", "=", "entity", ".", "getContentLength", "(", ")", ";", "if", "(", "contentLength", ">=", "0", ")", "{", "size", "=", "toLengthText", "(", "contentLength", ")", ";", "}", "processedBytes", "=", "0", ";", "loggedKb", "=", "0", ";", "//open stream and start downloading", "InputStream", "is", "=", "entity", ".", "getContent", "(", ")", ";", "streamAndMove", "(", "is", ",", "destFile", ")", ";", "}" ]
Save an HTTP response to a file @param response the response to save @param destFile the destination file @throws IOException if the response could not be downloaded
[ "Save", "an", "HTTP", "response", "to", "a", "file" ]
train
https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java#L297-L316
michael-rapp/AndroidBottomSheet
library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java
DraggableView.isScrollUpEvent
private boolean isScrollUpEvent(final float x, final float y, @NonNull final ViewGroup viewGroup) { """ Returns, whether a touch event at a specific position targets a view, which can be scrolled up. @param x The horizontal position of the touch event in pixels as a {@link Float} value @param y The vertical position of the touch event in pixels as a {@link Float} value @param viewGroup The view group, which should be used to search for scrollable child views, as an instance of the class {@link ViewGroup}. The view group may not be null @return True, if the touch event targets a view, which can be scrolled up, false otherwise """ int location[] = new int[2]; viewGroup.getLocationOnScreen(location); if (x >= location[0] && x <= location[0] + viewGroup.getWidth() && y >= location[1] && y <= location[1] + viewGroup.getHeight()) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View view = viewGroup.getChildAt(i); if (view.canScrollVertically(-1)) { return true; } else if (view instanceof ViewGroup) { return isScrollUpEvent(x, y, (ViewGroup) view); } } } return false; }
java
private boolean isScrollUpEvent(final float x, final float y, @NonNull final ViewGroup viewGroup) { int location[] = new int[2]; viewGroup.getLocationOnScreen(location); if (x >= location[0] && x <= location[0] + viewGroup.getWidth() && y >= location[1] && y <= location[1] + viewGroup.getHeight()) { for (int i = 0; i < viewGroup.getChildCount(); i++) { View view = viewGroup.getChildAt(i); if (view.canScrollVertically(-1)) { return true; } else if (view instanceof ViewGroup) { return isScrollUpEvent(x, y, (ViewGroup) view); } } } return false; }
[ "private", "boolean", "isScrollUpEvent", "(", "final", "float", "x", ",", "final", "float", "y", ",", "@", "NonNull", "final", "ViewGroup", "viewGroup", ")", "{", "int", "location", "[", "]", "=", "new", "int", "[", "2", "]", ";", "viewGroup", ".", "getLocationOnScreen", "(", "location", ")", ";", "if", "(", "x", ">=", "location", "[", "0", "]", "&&", "x", "<=", "location", "[", "0", "]", "+", "viewGroup", ".", "getWidth", "(", ")", "&&", "y", ">=", "location", "[", "1", "]", "&&", "y", "<=", "location", "[", "1", "]", "+", "viewGroup", ".", "getHeight", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "viewGroup", ".", "getChildCount", "(", ")", ";", "i", "++", ")", "{", "View", "view", "=", "viewGroup", ".", "getChildAt", "(", "i", ")", ";", "if", "(", "view", ".", "canScrollVertically", "(", "-", "1", ")", ")", "{", "return", "true", ";", "}", "else", "if", "(", "view", "instanceof", "ViewGroup", ")", "{", "return", "isScrollUpEvent", "(", "x", ",", "y", ",", "(", "ViewGroup", ")", "view", ")", ";", "}", "}", "}", "return", "false", ";", "}" ]
Returns, whether a touch event at a specific position targets a view, which can be scrolled up. @param x The horizontal position of the touch event in pixels as a {@link Float} value @param y The vertical position of the touch event in pixels as a {@link Float} value @param viewGroup The view group, which should be used to search for scrollable child views, as an instance of the class {@link ViewGroup}. The view group may not be null @return True, if the touch event targets a view, which can be scrolled up, false otherwise
[ "Returns", "whether", "a", "touch", "event", "at", "a", "specific", "position", "targets", "a", "view", "which", "can", "be", "scrolled", "up", "." ]
train
https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L166-L185
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/Sources.java
Sources.asURL
public static URL asURL(Class<?> contextClass, String resourceName) { """ Returns the given source as an {@link URL} @param contextClass @param resourceName @return """ return Resources.getResource(contextClass, resourceName); }
java
public static URL asURL(Class<?> contextClass, String resourceName) { return Resources.getResource(contextClass, resourceName); }
[ "public", "static", "URL", "asURL", "(", "Class", "<", "?", ">", "contextClass", ",", "String", "resourceName", ")", "{", "return", "Resources", ".", "getResource", "(", "contextClass", ",", "resourceName", ")", ";", "}" ]
Returns the given source as an {@link URL} @param contextClass @param resourceName @return
[ "Returns", "the", "given", "source", "as", "an", "{", "@link", "URL", "}" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Sources.java#L170-L172
leadware/jpersistence-tools
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorMethodExpressionExecutor.java
DAOValidatorMethodExpressionExecutor.invoke
public Object invoke(String methodName, Object...parameters) { """ Methode d'execution de la methode @param methodName Nom de la methode a executer @param parameters Parametres de la methode @return Valeur de retour """ // Si le nom de la methode est vide if(methodName == null || methodName.trim().length() == 0) return null; // Obtention de la methode Method method = methods.get(methodName.trim()); // Si la methode n'existe pas if(method == null) return null; try { // Apel Object result = method.invoke(this, parameters); // On retourne le resultat return result; } catch (Exception e) { // On retourne null return null; } }
java
public Object invoke(String methodName, Object...parameters) { // Si le nom de la methode est vide if(methodName == null || methodName.trim().length() == 0) return null; // Obtention de la methode Method method = methods.get(methodName.trim()); // Si la methode n'existe pas if(method == null) return null; try { // Apel Object result = method.invoke(this, parameters); // On retourne le resultat return result; } catch (Exception e) { // On retourne null return null; } }
[ "public", "Object", "invoke", "(", "String", "methodName", ",", "Object", "...", "parameters", ")", "{", "// Si le nom de la methode est vide\r", "if", "(", "methodName", "==", "null", "||", "methodName", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "return", "null", ";", "// Obtention de la methode\r", "Method", "method", "=", "methods", ".", "get", "(", "methodName", ".", "trim", "(", ")", ")", ";", "// Si la methode n'existe pas\r", "if", "(", "method", "==", "null", ")", "return", "null", ";", "try", "{", "// Apel\r", "Object", "result", "=", "method", ".", "invoke", "(", "this", ",", "parameters", ")", ";", "// On retourne le resultat\r", "return", "result", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// On retourne null\r", "return", "null", ";", "}", "}" ]
Methode d'execution de la methode @param methodName Nom de la methode a executer @param parameters Parametres de la methode @return Valeur de retour
[ "Methode", "d", "execution", "de", "la", "methode" ]
train
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorMethodExpressionExecutor.java#L117-L141
looly/hutool
hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java
AbsSetting.getBool
public Boolean getBool(String key, String group, Boolean defaultValue) { """ 获取波尔型型属性值 @param key 属性名 @param group 分组名 @param defaultValue 默认值 @return 属性值 """ return Convert.toBool(getByGroup(key, group), defaultValue); }
java
public Boolean getBool(String key, String group, Boolean defaultValue) { return Convert.toBool(getByGroup(key, group), defaultValue); }
[ "public", "Boolean", "getBool", "(", "String", "key", ",", "String", "group", ",", "Boolean", "defaultValue", ")", "{", "return", "Convert", ".", "toBool", "(", "getByGroup", "(", "key", ",", "group", ")", ",", "defaultValue", ")", ";", "}" ]
获取波尔型型属性值 @param key 属性名 @param group 分组名 @param defaultValue 默认值 @return 属性值
[ "获取波尔型型属性值" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L188-L190
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.convertNormToPixel
public static Point2D_F64 convertNormToPixel(CameraModel param , Point2D_F64 norm , Point2D_F64 pixel ) { """ <p> Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then {@link PinholeNtoP_F64} should be used instead. </p> NOTE: norm and pixel can be the same instance. @param param Intrinsic camera parameters @param norm Normalized image coordinate. @param pixel Optional storage for output. If null a new instance will be declared. @return pixel image coordinate """ return convertNormToPixel(param,norm.x,norm.y,pixel); }
java
public static Point2D_F64 convertNormToPixel(CameraModel param , Point2D_F64 norm , Point2D_F64 pixel ) { return convertNormToPixel(param,norm.x,norm.y,pixel); }
[ "public", "static", "Point2D_F64", "convertNormToPixel", "(", "CameraModel", "param", ",", "Point2D_F64", "norm", ",", "Point2D_F64", "pixel", ")", "{", "return", "convertNormToPixel", "(", "param", ",", "norm", ".", "x", ",", "norm", ".", "y", ",", "pixel", ")", ";", "}" ]
<p> Convenient function for converting from normalized image coordinates to the original image pixel coordinate. If speed is a concern then {@link PinholeNtoP_F64} should be used instead. </p> NOTE: norm and pixel can be the same instance. @param param Intrinsic camera parameters @param norm Normalized image coordinate. @param pixel Optional storage for output. If null a new instance will be declared. @return pixel image coordinate
[ "<p", ">", "Convenient", "function", "for", "converting", "from", "normalized", "image", "coordinates", "to", "the", "original", "image", "pixel", "coordinate", ".", "If", "speed", "is", "a", "concern", "then", "{", "@link", "PinholeNtoP_F64", "}", "should", "be", "used", "instead", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L410-L412
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/servlet/ServletOperationSet.java
ServletOperationSet.getOperation
public ServletOperation getOperation(SlingHttpServletRequest request, Method method) { """ Retrieves the servlet operation requested for the used HTTP method. Looks in the selectors for a operation and gives their implementation in the extensions context. @param request the servlet request @param method the requested HTTP method @return the operation or 'null', if the requested combination of selector and extension has no implementation for the given HTTP method """ ServletOperation operation = null; E extension = RequestUtil.getExtension(request, defaultExtension); Map<E, O> extensionDefaults = operationDefaults.get(method); if (extensionDefaults != null) { O defaultOperation = extensionDefaults.get(extension); if (defaultOperation != null) { Map<E, Map<O, ServletOperation>> extensions = operationMap.get(method); if (extensions != null) { Map<O, ServletOperation> operations = extensions.get(extension); if (operations != null) { operation = operations.get(RequestUtil.getSelector(request, defaultOperation)); } } } } return operation; }
java
public ServletOperation getOperation(SlingHttpServletRequest request, Method method) { ServletOperation operation = null; E extension = RequestUtil.getExtension(request, defaultExtension); Map<E, O> extensionDefaults = operationDefaults.get(method); if (extensionDefaults != null) { O defaultOperation = extensionDefaults.get(extension); if (defaultOperation != null) { Map<E, Map<O, ServletOperation>> extensions = operationMap.get(method); if (extensions != null) { Map<O, ServletOperation> operations = extensions.get(extension); if (operations != null) { operation = operations.get(RequestUtil.getSelector(request, defaultOperation)); } } } } return operation; }
[ "public", "ServletOperation", "getOperation", "(", "SlingHttpServletRequest", "request", ",", "Method", "method", ")", "{", "ServletOperation", "operation", "=", "null", ";", "E", "extension", "=", "RequestUtil", ".", "getExtension", "(", "request", ",", "defaultExtension", ")", ";", "Map", "<", "E", ",", "O", ">", "extensionDefaults", "=", "operationDefaults", ".", "get", "(", "method", ")", ";", "if", "(", "extensionDefaults", "!=", "null", ")", "{", "O", "defaultOperation", "=", "extensionDefaults", ".", "get", "(", "extension", ")", ";", "if", "(", "defaultOperation", "!=", "null", ")", "{", "Map", "<", "E", ",", "Map", "<", "O", ",", "ServletOperation", ">", ">", "extensions", "=", "operationMap", ".", "get", "(", "method", ")", ";", "if", "(", "extensions", "!=", "null", ")", "{", "Map", "<", "O", ",", "ServletOperation", ">", "operations", "=", "extensions", ".", "get", "(", "extension", ")", ";", "if", "(", "operations", "!=", "null", ")", "{", "operation", "=", "operations", ".", "get", "(", "RequestUtil", ".", "getSelector", "(", "request", ",", "defaultOperation", ")", ")", ";", "}", "}", "}", "}", "return", "operation", ";", "}" ]
Retrieves the servlet operation requested for the used HTTP method. Looks in the selectors for a operation and gives their implementation in the extensions context. @param request the servlet request @param method the requested HTTP method @return the operation or 'null', if the requested combination of selector and extension has no implementation for the given HTTP method
[ "Retrieves", "the", "servlet", "operation", "requested", "for", "the", "used", "HTTP", "method", ".", "Looks", "in", "the", "selectors", "for", "a", "operation", "and", "gives", "their", "implementation", "in", "the", "extensions", "context", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/servlet/ServletOperationSet.java#L51-L68
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateExplicitListItem
public OperationStatus updateExplicitListItem(UUID appId, String versionId, UUID entityId, long itemId, UpdateExplicitListItemOptionalParameter updateExplicitListItemOptionalParameter) { """ Updates an explicit list item for a Pattern.Any entity. @param appId The application ID. @param versionId The version ID. @param entityId The Pattern.Any entity extractor ID. @param itemId The explicit list item ID. @param updateExplicitListItemOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful. """ return updateExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, itemId, updateExplicitListItemOptionalParameter).toBlocking().single().body(); }
java
public OperationStatus updateExplicitListItem(UUID appId, String versionId, UUID entityId, long itemId, UpdateExplicitListItemOptionalParameter updateExplicitListItemOptionalParameter) { return updateExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, itemId, updateExplicitListItemOptionalParameter).toBlocking().single().body(); }
[ "public", "OperationStatus", "updateExplicitListItem", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "long", "itemId", ",", "UpdateExplicitListItemOptionalParameter", "updateExplicitListItemOptionalParameter", ")", "{", "return", "updateExplicitListItemWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ",", "itemId", ",", "updateExplicitListItemOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates an explicit list item for a Pattern.Any entity. @param appId The application ID. @param versionId The version ID. @param entityId The Pattern.Any entity extractor ID. @param itemId The explicit list item ID. @param updateExplicitListItemOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Updates", "an", "explicit", "list", "item", "for", "a", "Pattern", ".", "Any", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L14063-L14065
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/Comapi.java
Comapi.initialise
public static void initialise(@NonNull Application app, @NonNull ComapiConfig config, Callback<ComapiClient> callback) { """ Build SDK client. Can be called only once in onCreate callback on Application class. """ String error = checkIfCanInitialise(app, config, false); if (!TextUtils.isEmpty(error) && callback != null) { callback.error(new Exception(error)); } ComapiClient client = new ComapiClient(config); CallbackAdapter adapter = config.getCallbackAdapter() != null ? config.getCallbackAdapter() : new CallbackAdapter(); client.initialise(app, adapter, callback); }
java
public static void initialise(@NonNull Application app, @NonNull ComapiConfig config, Callback<ComapiClient> callback) { String error = checkIfCanInitialise(app, config, false); if (!TextUtils.isEmpty(error) && callback != null) { callback.error(new Exception(error)); } ComapiClient client = new ComapiClient(config); CallbackAdapter adapter = config.getCallbackAdapter() != null ? config.getCallbackAdapter() : new CallbackAdapter(); client.initialise(app, adapter, callback); }
[ "public", "static", "void", "initialise", "(", "@", "NonNull", "Application", "app", ",", "@", "NonNull", "ComapiConfig", "config", ",", "Callback", "<", "ComapiClient", ">", "callback", ")", "{", "String", "error", "=", "checkIfCanInitialise", "(", "app", ",", "config", ",", "false", ")", ";", "if", "(", "!", "TextUtils", ".", "isEmpty", "(", "error", ")", "&&", "callback", "!=", "null", ")", "{", "callback", ".", "error", "(", "new", "Exception", "(", "error", ")", ")", ";", "}", "ComapiClient", "client", "=", "new", "ComapiClient", "(", "config", ")", ";", "CallbackAdapter", "adapter", "=", "config", ".", "getCallbackAdapter", "(", ")", "!=", "null", "?", "config", ".", "getCallbackAdapter", "(", ")", ":", "new", "CallbackAdapter", "(", ")", ";", "client", ".", "initialise", "(", "app", ",", "adapter", ",", "callback", ")", ";", "}" ]
Build SDK client. Can be called only once in onCreate callback on Application class.
[ "Build", "SDK", "client", ".", "Can", "be", "called", "only", "once", "in", "onCreate", "callback", "on", "Application", "class", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/Comapi.java#L45-L55
apiman/apiman
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/AbstractJpaStorage.java
AbstractJpaStorage.executeCountQuery
protected <T> int executeCountQuery(SearchCriteriaBean criteria, EntityManager entityManager, Class<T> type) { """ Gets a count of the number of rows that would be returned by the search. @param criteria @param entityManager @param type """ CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Long> countQuery = builder.createQuery(Long.class); Root<T> from = countQuery.from(type); countQuery.select(builder.count(from)); applySearchCriteriaToQuery(criteria, builder, countQuery, from, true); TypedQuery<Long> query = entityManager.createQuery(countQuery); return query.getSingleResult().intValue(); }
java
protected <T> int executeCountQuery(SearchCriteriaBean criteria, EntityManager entityManager, Class<T> type) { CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<Long> countQuery = builder.createQuery(Long.class); Root<T> from = countQuery.from(type); countQuery.select(builder.count(from)); applySearchCriteriaToQuery(criteria, builder, countQuery, from, true); TypedQuery<Long> query = entityManager.createQuery(countQuery); return query.getSingleResult().intValue(); }
[ "protected", "<", "T", ">", "int", "executeCountQuery", "(", "SearchCriteriaBean", "criteria", ",", "EntityManager", "entityManager", ",", "Class", "<", "T", ">", "type", ")", "{", "CriteriaBuilder", "builder", "=", "entityManager", ".", "getCriteriaBuilder", "(", ")", ";", "CriteriaQuery", "<", "Long", ">", "countQuery", "=", "builder", ".", "createQuery", "(", "Long", ".", "class", ")", ";", "Root", "<", "T", ">", "from", "=", "countQuery", ".", "from", "(", "type", ")", ";", "countQuery", ".", "select", "(", "builder", ".", "count", "(", "from", ")", ")", ";", "applySearchCriteriaToQuery", "(", "criteria", ",", "builder", ",", "countQuery", ",", "from", ",", "true", ")", ";", "TypedQuery", "<", "Long", ">", "query", "=", "entityManager", ".", "createQuery", "(", "countQuery", ")", ";", "return", "query", ".", "getSingleResult", "(", ")", ".", "intValue", "(", ")", ";", "}" ]
Gets a count of the number of rows that would be returned by the search. @param criteria @param entityManager @param type
[ "Gets", "a", "count", "of", "the", "number", "of", "rows", "that", "would", "be", "returned", "by", "the", "search", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/AbstractJpaStorage.java#L313-L321
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.serviceName_activateZone_POST
public void serviceName_activateZone_POST(String serviceName, Boolean minimized) throws IOException { """ Activate the DNS zone for this domain REST: POST /domain/{serviceName}/activateZone @param minimized [required] Create only mandatory records @param serviceName [required] The internal name of your domain """ String qPath = "/domain/{serviceName}/activateZone"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "minimized", minimized); exec(qPath, "POST", sb.toString(), o); }
java
public void serviceName_activateZone_POST(String serviceName, Boolean minimized) throws IOException { String qPath = "/domain/{serviceName}/activateZone"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "minimized", minimized); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "serviceName_activateZone_POST", "(", "String", "serviceName", ",", "Boolean", "minimized", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/{serviceName}/activateZone\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"minimized\"", ",", "minimized", ")", ";", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "}" ]
Activate the DNS zone for this domain REST: POST /domain/{serviceName}/activateZone @param minimized [required] Create only mandatory records @param serviceName [required] The internal name of your domain
[ "Activate", "the", "DNS", "zone", "for", "this", "domain" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1346-L1352
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java
IterUtil.join
public static <T> String join(Iterable<T> iterable, CharSequence conjunction) { """ 以 conjunction 为分隔符将集合转换为字符串 @param <T> 集合元素类型 @param iterable {@link Iterable} @param conjunction 分隔符 @return 连接后的字符串 """ if (null == iterable) { return null; } return join(iterable.iterator(), conjunction); }
java
public static <T> String join(Iterable<T> iterable, CharSequence conjunction) { if (null == iterable) { return null; } return join(iterable.iterator(), conjunction); }
[ "public", "static", "<", "T", ">", "String", "join", "(", "Iterable", "<", "T", ">", "iterable", ",", "CharSequence", "conjunction", ")", "{", "if", "(", "null", "==", "iterable", ")", "{", "return", "null", ";", "}", "return", "join", "(", "iterable", ".", "iterator", "(", ")", ",", "conjunction", ")", ";", "}" ]
以 conjunction 为分隔符将集合转换为字符串 @param <T> 集合元素类型 @param iterable {@link Iterable} @param conjunction 分隔符 @return 连接后的字符串
[ "以", "conjunction", "为分隔符将集合转换为字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L262-L267
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
BaseTable.doLocalCriteria
public boolean doLocalCriteria(StringBuffer strFilter, boolean bIncludeFileName, Vector<BaseField> vParamList) { """ Set up/do the local criteria. This is only here to accommodate local file systems that can't handle REMOTE criteria. All you have to do here to handle the remote criteria locally is to call: return record.handleRemoteCriteria(xx, yy). """ // Default BaseListener if (this.isTable()) // For tables, do the remote criteria now return this.getRecord().handleRemoteCriteria(strFilter, bIncludeFileName, vParamList); // If can't handle remote else return true; // Record okay, don't skip it }
java
public boolean doLocalCriteria(StringBuffer strFilter, boolean bIncludeFileName, Vector<BaseField> vParamList) { // Default BaseListener if (this.isTable()) // For tables, do the remote criteria now return this.getRecord().handleRemoteCriteria(strFilter, bIncludeFileName, vParamList); // If can't handle remote else return true; // Record okay, don't skip it }
[ "public", "boolean", "doLocalCriteria", "(", "StringBuffer", "strFilter", ",", "boolean", "bIncludeFileName", ",", "Vector", "<", "BaseField", ">", "vParamList", ")", "{", "// Default BaseListener", "if", "(", "this", ".", "isTable", "(", ")", ")", "// For tables, do the remote criteria now", "return", "this", ".", "getRecord", "(", ")", ".", "handleRemoteCriteria", "(", "strFilter", ",", "bIncludeFileName", ",", "vParamList", ")", ";", "// If can't handle remote", "else", "return", "true", ";", "// Record okay, don't skip it", "}" ]
Set up/do the local criteria. This is only here to accommodate local file systems that can't handle REMOTE criteria. All you have to do here to handle the remote criteria locally is to call: return record.handleRemoteCriteria(xx, yy).
[ "Set", "up", "/", "do", "the", "local", "criteria", ".", "This", "is", "only", "here", "to", "accommodate", "local", "file", "systems", "that", "can", "t", "handle", "REMOTE", "criteria", ".", "All", "you", "have", "to", "do", "here", "to", "handle", "the", "remote", "criteria", "locally", "is", "to", "call", ":", "return", "record", ".", "handleRemoteCriteria", "(", "xx", "yy", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L219-L225
qiujuer/Genius-Android
caprice/graphics/src/main/java/net/qiujuer/genius/graphics/Blur.java
Blur.onStackBlur
public static Bitmap onStackBlur(Bitmap original, int radius) { """ StackBlur By Jni Bitmap @param original Original Image @param radius Blur radius @return Image Bitmap """ Bitmap bitmap = checkSource(original, radius); // Return this none blur if (radius == 1) { return bitmap; } //Jni BitMap Blur nativeStackBlurBitmap(bitmap, radius); return (bitmap); }
java
public static Bitmap onStackBlur(Bitmap original, int radius) { Bitmap bitmap = checkSource(original, radius); // Return this none blur if (radius == 1) { return bitmap; } //Jni BitMap Blur nativeStackBlurBitmap(bitmap, radius); return (bitmap); }
[ "public", "static", "Bitmap", "onStackBlur", "(", "Bitmap", "original", ",", "int", "radius", ")", "{", "Bitmap", "bitmap", "=", "checkSource", "(", "original", ",", "radius", ")", ";", "// Return this none blur", "if", "(", "radius", "==", "1", ")", "{", "return", "bitmap", ";", "}", "//Jni BitMap Blur", "nativeStackBlurBitmap", "(", "bitmap", ",", "radius", ")", ";", "return", "(", "bitmap", ")", ";", "}" ]
StackBlur By Jni Bitmap @param original Original Image @param radius Blur radius @return Image Bitmap
[ "StackBlur", "By", "Jni", "Bitmap" ]
train
https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/graphics/src/main/java/net/qiujuer/genius/graphics/Blur.java#L48-L60
alibaba/jstorm
jstorm-core/src/main/java/storm/trident/Stream.java
Stream.slidingWindow
public Stream slidingWindow(BaseWindowedBolt.Duration windowDuration, BaseWindowedBolt.Duration slidingInterval, WindowsStoreFactory windowStoreFactory, Fields inputFields, Aggregator aggregator, Fields functionFields) { """ Returns a stream of tuples which are aggregated results of a window which slides at duration of {@code slidingInterval} and completes a window at {@code windowDuration} @param windowDuration represents window duration configuration @param inputFields projected fields for aggregator @param aggregator aggregator to run on the window of tuples to compute the result and emit to the stream. @param functionFields fields of values to emit with aggregation. @return the new stream with this operation. """ return window(SlidingDurationWindow.of(windowDuration, slidingInterval), windowStoreFactory, inputFields, aggregator, functionFields); }
java
public Stream slidingWindow(BaseWindowedBolt.Duration windowDuration, BaseWindowedBolt.Duration slidingInterval, WindowsStoreFactory windowStoreFactory, Fields inputFields, Aggregator aggregator, Fields functionFields) { return window(SlidingDurationWindow.of(windowDuration, slidingInterval), windowStoreFactory, inputFields, aggregator, functionFields); }
[ "public", "Stream", "slidingWindow", "(", "BaseWindowedBolt", ".", "Duration", "windowDuration", ",", "BaseWindowedBolt", ".", "Duration", "slidingInterval", ",", "WindowsStoreFactory", "windowStoreFactory", ",", "Fields", "inputFields", ",", "Aggregator", "aggregator", ",", "Fields", "functionFields", ")", "{", "return", "window", "(", "SlidingDurationWindow", ".", "of", "(", "windowDuration", ",", "slidingInterval", ")", ",", "windowStoreFactory", ",", "inputFields", ",", "aggregator", ",", "functionFields", ")", ";", "}" ]
Returns a stream of tuples which are aggregated results of a window which slides at duration of {@code slidingInterval} and completes a window at {@code windowDuration} @param windowDuration represents window duration configuration @param inputFields projected fields for aggregator @param aggregator aggregator to run on the window of tuples to compute the result and emit to the stream. @param functionFields fields of values to emit with aggregation. @return the new stream with this operation.
[ "Returns", "a", "stream", "of", "tuples", "which", "are", "aggregated", "results", "of", "a", "window", "which", "slides", "at", "duration", "of", "{", "@code", "slidingInterval", "}", "and", "completes", "a", "window", "at", "{", "@code", "windowDuration", "}" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/storm/trident/Stream.java#L653-L656
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/Assembler.java
Assembler.if_tcmpne
public void if_tcmpne(TypeMirror type, String target) throws IOException { """ ne succeeds if and only if value1 != value2 <p>Stack: ..., value1, value2 =&gt; ... @param type @param target @throws IOException """ pushType(type); if_tcmpne(target); popType(); }
java
public void if_tcmpne(TypeMirror type, String target) throws IOException { pushType(type); if_tcmpne(target); popType(); }
[ "public", "void", "if_tcmpne", "(", "TypeMirror", "type", ",", "String", "target", ")", "throws", "IOException", "{", "pushType", "(", "type", ")", ";", "if_tcmpne", "(", "target", ")", ";", "popType", "(", ")", ";", "}" ]
ne succeeds if and only if value1 != value2 <p>Stack: ..., value1, value2 =&gt; ... @param type @param target @throws IOException
[ "ne", "succeeds", "if", "and", "only", "if", "value1", "!", "=", "value2", "<p", ">", "Stack", ":", "...", "value1", "value2", "=", "&gt", ";", "..." ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/Assembler.java#L572-L577
landawn/AbacusUtil
src/com/landawn/abacus/util/SQLExecutor.java
SQLExecutor.createTableIfNotExists
public boolean createTableIfNotExists(final String tableName, final String schema) { """ Returns {@code true} if succeed to create table, otherwise {@code false} is returned. @param tableName @param schema @return """ Connection conn = getConnection(); try { return JdbcUtil.createTableIfNotExists(conn, tableName, schema); } finally { closeQuietly(conn); } }
java
public boolean createTableIfNotExists(final String tableName, final String schema) { Connection conn = getConnection(); try { return JdbcUtil.createTableIfNotExists(conn, tableName, schema); } finally { closeQuietly(conn); } }
[ "public", "boolean", "createTableIfNotExists", "(", "final", "String", "tableName", ",", "final", "String", "schema", ")", "{", "Connection", "conn", "=", "getConnection", "(", ")", ";", "try", "{", "return", "JdbcUtil", ".", "createTableIfNotExists", "(", "conn", ",", "tableName", ",", "schema", ")", ";", "}", "finally", "{", "closeQuietly", "(", "conn", ")", ";", "}", "}" ]
Returns {@code true} if succeed to create table, otherwise {@code false} is returned. @param tableName @param schema @return
[ "Returns", "{", "@code", "true", "}", "if", "succeed", "to", "create", "table", "otherwise", "{", "@code", "false", "}", "is", "returned", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/SQLExecutor.java#L3264-L3272
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java
SqlExecutor.callQuery
public static ResultSet callQuery(Connection conn, String sql, Object... params) throws SQLException { """ 执行调用存储过程<br> 此方法不会关闭Connection @param conn 数据库连接对象 @param sql SQL @param params 参数 @return ResultSet @throws SQLException SQL执行异常 @since 4.1.4 """ CallableStatement proc = null; try { proc = StatementUtil.prepareCall(conn, sql, params); return proc.executeQuery(); } finally { DbUtil.close(proc); } }
java
public static ResultSet callQuery(Connection conn, String sql, Object... params) throws SQLException { CallableStatement proc = null; try { proc = StatementUtil.prepareCall(conn, sql, params); return proc.executeQuery(); } finally { DbUtil.close(proc); } }
[ "public", "static", "ResultSet", "callQuery", "(", "Connection", "conn", ",", "String", "sql", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "CallableStatement", "proc", "=", "null", ";", "try", "{", "proc", "=", "StatementUtil", ".", "prepareCall", "(", "conn", ",", "sql", ",", "params", ")", ";", "return", "proc", ".", "executeQuery", "(", ")", ";", "}", "finally", "{", "DbUtil", ".", "close", "(", "proc", ")", ";", "}", "}" ]
执行调用存储过程<br> 此方法不会关闭Connection @param conn 数据库连接对象 @param sql SQL @param params 参数 @return ResultSet @throws SQLException SQL执行异常 @since 4.1.4
[ "执行调用存储过程<br", ">", "此方法不会关闭Connection" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L94-L102
zerodhatech/javakiteconnect
kiteconnect/src/com/zerodhatech/models/User.java
User.parseArray
public User parseArray(User user, JSONObject response) throws JSONException { """ Parses array details of product, exchange and order_type from json response. @param response is the json response from server. @param user is the object to which data is copied to from json response. @return User is the pojo of parsed data. """ JSONArray productArray = response.getJSONArray("products"); user.products = new String[productArray.length()]; for(int i = 0; i < productArray.length(); i++) { user.products[i] = productArray.getString(i); } JSONArray exchangesArray = response.getJSONArray("exchanges"); user.exchanges = new String[exchangesArray.length()]; for (int j = 0; j < exchangesArray.length(); j++){ user.exchanges[j] = exchangesArray.getString(j); } JSONArray orderTypeArray = response.getJSONArray("order_types"); user.orderTypes = new String[orderTypeArray.length()]; for(int k = 0; k < orderTypeArray.length(); k++){ user.orderTypes[k] = orderTypeArray.getString(k); } return user; }
java
public User parseArray(User user, JSONObject response) throws JSONException { JSONArray productArray = response.getJSONArray("products"); user.products = new String[productArray.length()]; for(int i = 0; i < productArray.length(); i++) { user.products[i] = productArray.getString(i); } JSONArray exchangesArray = response.getJSONArray("exchanges"); user.exchanges = new String[exchangesArray.length()]; for (int j = 0; j < exchangesArray.length(); j++){ user.exchanges[j] = exchangesArray.getString(j); } JSONArray orderTypeArray = response.getJSONArray("order_types"); user.orderTypes = new String[orderTypeArray.length()]; for(int k = 0; k < orderTypeArray.length(); k++){ user.orderTypes[k] = orderTypeArray.getString(k); } return user; }
[ "public", "User", "parseArray", "(", "User", "user", ",", "JSONObject", "response", ")", "throws", "JSONException", "{", "JSONArray", "productArray", "=", "response", ".", "getJSONArray", "(", "\"products\"", ")", ";", "user", ".", "products", "=", "new", "String", "[", "productArray", ".", "length", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "productArray", ".", "length", "(", ")", ";", "i", "++", ")", "{", "user", ".", "products", "[", "i", "]", "=", "productArray", ".", "getString", "(", "i", ")", ";", "}", "JSONArray", "exchangesArray", "=", "response", ".", "getJSONArray", "(", "\"exchanges\"", ")", ";", "user", ".", "exchanges", "=", "new", "String", "[", "exchangesArray", ".", "length", "(", ")", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "exchangesArray", ".", "length", "(", ")", ";", "j", "++", ")", "{", "user", ".", "exchanges", "[", "j", "]", "=", "exchangesArray", ".", "getString", "(", "j", ")", ";", "}", "JSONArray", "orderTypeArray", "=", "response", ".", "getJSONArray", "(", "\"order_types\"", ")", ";", "user", ".", "orderTypes", "=", "new", "String", "[", "orderTypeArray", ".", "length", "(", ")", "]", ";", "for", "(", "int", "k", "=", "0", ";", "k", "<", "orderTypeArray", ".", "length", "(", ")", ";", "k", "++", ")", "{", "user", ".", "orderTypes", "[", "k", "]", "=", "orderTypeArray", ".", "getString", "(", "k", ")", ";", "}", "return", "user", ";", "}" ]
Parses array details of product, exchange and order_type from json response. @param response is the json response from server. @param user is the object to which data is copied to from json response. @return User is the pojo of parsed data.
[ "Parses", "array", "details", "of", "product", "exchange", "and", "order_type", "from", "json", "response", "." ]
train
https://github.com/zerodhatech/javakiteconnect/blob/4a3f15ff2c8a1b3b6ec61799f8bb047e4dfeb92d/kiteconnect/src/com/zerodhatech/models/User.java#L77-L97
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/SystemInformation.java
SystemInformation.run
public VoltTable[] run(SystemProcedureExecutionContext ctx, String selector) throws VoltAbortException { """ Returns the cluster info requested by the provided selector @param ctx Internal. Not exposed to the end-user. @param selector Selector requested @return The property/value table for the provided selector @throws VoltAbortException """ VoltTable[] results; // This selector provides the old @SystemInformation behavior if (selector.toUpperCase().equals("OVERVIEW")) { results = getOverviewInfo(); } else if (selector.toUpperCase().equals("DEPLOYMENT")) { results = getDeploymentInfo(); } else { throw new VoltAbortException(String.format("Invalid @SystemInformation selector %s.", selector)); } return results; }
java
public VoltTable[] run(SystemProcedureExecutionContext ctx, String selector) throws VoltAbortException { VoltTable[] results; // This selector provides the old @SystemInformation behavior if (selector.toUpperCase().equals("OVERVIEW")) { results = getOverviewInfo(); } else if (selector.toUpperCase().equals("DEPLOYMENT")) { results = getDeploymentInfo(); } else { throw new VoltAbortException(String.format("Invalid @SystemInformation selector %s.", selector)); } return results; }
[ "public", "VoltTable", "[", "]", "run", "(", "SystemProcedureExecutionContext", "ctx", ",", "String", "selector", ")", "throws", "VoltAbortException", "{", "VoltTable", "[", "]", "results", ";", "// This selector provides the old @SystemInformation behavior", "if", "(", "selector", ".", "toUpperCase", "(", ")", ".", "equals", "(", "\"OVERVIEW\"", ")", ")", "{", "results", "=", "getOverviewInfo", "(", ")", ";", "}", "else", "if", "(", "selector", ".", "toUpperCase", "(", ")", ".", "equals", "(", "\"DEPLOYMENT\"", ")", ")", "{", "results", "=", "getDeploymentInfo", "(", ")", ";", "}", "else", "{", "throw", "new", "VoltAbortException", "(", "String", ".", "format", "(", "\"Invalid @SystemInformation selector %s.\"", ",", "selector", ")", ")", ";", "}", "return", "results", ";", "}" ]
Returns the cluster info requested by the provided selector @param ctx Internal. Not exposed to the end-user. @param selector Selector requested @return The property/value table for the provided selector @throws VoltAbortException
[ "Returns", "the", "cluster", "info", "requested", "by", "the", "provided", "selector" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/SystemInformation.java#L241-L261
alexcojocaru/elasticsearch-maven-plugin
src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/util/ProcessUtil.java
ProcessUtil.getElasticsearchPid
public static String getElasticsearchPid(String baseDir) { """ Read the ES PID from the pid file and return it. @param baseDir the base directory where the pid file is @return """ try { String pid = new String(Files.readAllBytes(Paths.get(baseDir, "pid"))); return pid; } catch (IOException e) { throw new IllegalStateException( String.format( "Cannot read the PID of the Elasticsearch process from the pid file in directory '%s'", baseDir), e); } }
java
public static String getElasticsearchPid(String baseDir) { try { String pid = new String(Files.readAllBytes(Paths.get(baseDir, "pid"))); return pid; } catch (IOException e) { throw new IllegalStateException( String.format( "Cannot read the PID of the Elasticsearch process from the pid file in directory '%s'", baseDir), e); } }
[ "public", "static", "String", "getElasticsearchPid", "(", "String", "baseDir", ")", "{", "try", "{", "String", "pid", "=", "new", "String", "(", "Files", ".", "readAllBytes", "(", "Paths", ".", "get", "(", "baseDir", ",", "\"pid\"", ")", ")", ")", ";", "return", "pid", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "String", ".", "format", "(", "\"Cannot read the PID of the Elasticsearch process from the pid file in directory '%s'\"", ",", "baseDir", ")", ",", "e", ")", ";", "}", "}" ]
Read the ES PID from the pid file and return it. @param baseDir the base directory where the pid file is @return
[ "Read", "the", "ES", "PID", "from", "the", "pid", "file", "and", "return", "it", "." ]
train
https://github.com/alexcojocaru/elasticsearch-maven-plugin/blob/c283053cf99dc6b6d411b58629364b6aae62b7f8/src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/util/ProcessUtil.java#L97-L112
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/validate/MapSchema.java
MapSchema.performValidation
@SuppressWarnings("unchecked") @Override protected void performValidation(String path, Object value, List<ValidationResult> results) { """ Validates a given value against the schema and configured validation rules. @param path a dot notation path to the value. @param value a value to be validated. @param results a list with validation results to add new results. """ String name = path != null ? path : "value"; value = ObjectReader.getValue(value); super.performValidation(path, value, results); if (value == null) return; if (value instanceof Map<?, ?>) { Map<Object, Object> map = (Map<Object, Object>) value; for (Object key : map.keySet()) { String elementPath = path == null || path.length() == 0 ? key.toString() : path + "." + key; performTypeValidation(elementPath, _keyType, key, results); performTypeValidation(elementPath, _valueType, map.get(key), results); } } else { results.add(new ValidationResult(path, ValidationResultType.Error, "VALUE_ISNOT_MAP", name + " type must be Map", "Map", value.getClass())); } }
java
@SuppressWarnings("unchecked") @Override protected void performValidation(String path, Object value, List<ValidationResult> results) { String name = path != null ? path : "value"; value = ObjectReader.getValue(value); super.performValidation(path, value, results); if (value == null) return; if (value instanceof Map<?, ?>) { Map<Object, Object> map = (Map<Object, Object>) value; for (Object key : map.keySet()) { String elementPath = path == null || path.length() == 0 ? key.toString() : path + "." + key; performTypeValidation(elementPath, _keyType, key, results); performTypeValidation(elementPath, _valueType, map.get(key), results); } } else { results.add(new ValidationResult(path, ValidationResultType.Error, "VALUE_ISNOT_MAP", name + " type must be Map", "Map", value.getClass())); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "protected", "void", "performValidation", "(", "String", "path", ",", "Object", "value", ",", "List", "<", "ValidationResult", ">", "results", ")", "{", "String", "name", "=", "path", "!=", "null", "?", "path", ":", "\"value\"", ";", "value", "=", "ObjectReader", ".", "getValue", "(", "value", ")", ";", "super", ".", "performValidation", "(", "path", ",", "value", ",", "results", ")", ";", "if", "(", "value", "==", "null", ")", "return", ";", "if", "(", "value", "instanceof", "Map", "<", "?", ",", "?", ">", ")", "{", "Map", "<", "Object", ",", "Object", ">", "map", "=", "(", "Map", "<", "Object", ",", "Object", ">", ")", "value", ";", "for", "(", "Object", "key", ":", "map", ".", "keySet", "(", ")", ")", "{", "String", "elementPath", "=", "path", "==", "null", "||", "path", ".", "length", "(", ")", "==", "0", "?", "key", ".", "toString", "(", ")", ":", "path", "+", "\".\"", "+", "key", ";", "performTypeValidation", "(", "elementPath", ",", "_keyType", ",", "key", ",", "results", ")", ";", "performTypeValidation", "(", "elementPath", ",", "_valueType", ",", "map", ".", "get", "(", "key", ")", ",", "results", ")", ";", "}", "}", "else", "{", "results", ".", "add", "(", "new", "ValidationResult", "(", "path", ",", "ValidationResultType", ".", "Error", ",", "\"VALUE_ISNOT_MAP\"", ",", "name", "+", "\" type must be Map\"", ",", "\"Map\"", ",", "value", ".", "getClass", "(", ")", ")", ")", ";", "}", "}" ]
Validates a given value against the schema and configured validation rules. @param path a dot notation path to the value. @param value a value to be validated. @param results a list with validation results to add new results.
[ "Validates", "a", "given", "value", "against", "the", "schema", "and", "configured", "validation", "rules", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/validate/MapSchema.java#L90-L113
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java
EndianNumbers.toBEDouble
@Pure @Inline(value = "Double.longBitsToDouble(EndianNumbers.toBELong($1, $2, $3, $4, $5, $6, $7, $8))", imported = { """ Converting eight bytes to a Big Endian double. @param b1 the first byte. @param b2 the second byte. @param b3 the third byte. @param b4 the fourth byte. @param b5 the fifth byte. @param b6 the sixth byte. @param b7 the seventh byte. @param b8 the eighth byte. @return the conversion result """EndianNumbers.class}) public static double toBEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) { return Double.longBitsToDouble(toBELong(b1, b2, b3, b4, b5, b6, b7, b8)); }
java
@Pure @Inline(value = "Double.longBitsToDouble(EndianNumbers.toBELong($1, $2, $3, $4, $5, $6, $7, $8))", imported = {EndianNumbers.class}) public static double toBEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) { return Double.longBitsToDouble(toBELong(b1, b2, b3, b4, b5, b6, b7, b8)); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"Double.longBitsToDouble(EndianNumbers.toBELong($1, $2, $3, $4, $5, $6, $7, $8))\"", ",", "imported", "=", "{", "EndianNumbers", ".", "class", "}", ")", "public", "static", "double", "toBEDouble", "(", "int", "b1", ",", "int", "b2", ",", "int", "b3", ",", "int", "b4", ",", "int", "b5", ",", "int", "b6", ",", "int", "b7", ",", "int", "b8", ")", "{", "return", "Double", ".", "longBitsToDouble", "(", "toBELong", "(", "b1", ",", "b2", ",", "b3", ",", "b4", ",", "b5", ",", "b6", ",", "b7", ",", "b8", ")", ")", ";", "}" ]
Converting eight bytes to a Big Endian double. @param b1 the first byte. @param b2 the second byte. @param b3 the third byte. @param b4 the fourth byte. @param b5 the fifth byte. @param b6 the sixth byte. @param b7 the seventh byte. @param b8 the eighth byte. @return the conversion result
[ "Converting", "eight", "bytes", "to", "a", "Big", "Endian", "double", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L165-L170
arxanchain/java-common
src/main/java/com/arxanfintech/common/util/HashUtil.java
HashUtil.calcNewAddr
public static byte[] calcNewAddr(byte[] addr, byte[] nonce) { """ The way to calculate new address @param addr - creating addres @param nonce - nonce of creating address @return new address """ byte[] encSender = RLP.encodeElement(addr); byte[] encNonce = RLP.encodeBigInteger(new BigInteger(1, nonce)); return sha3omit12(RLP.encodeList(encSender, encNonce)); }
java
public static byte[] calcNewAddr(byte[] addr, byte[] nonce) { byte[] encSender = RLP.encodeElement(addr); byte[] encNonce = RLP.encodeBigInteger(new BigInteger(1, nonce)); return sha3omit12(RLP.encodeList(encSender, encNonce)); }
[ "public", "static", "byte", "[", "]", "calcNewAddr", "(", "byte", "[", "]", "addr", ",", "byte", "[", "]", "nonce", ")", "{", "byte", "[", "]", "encSender", "=", "RLP", ".", "encodeElement", "(", "addr", ")", ";", "byte", "[", "]", "encNonce", "=", "RLP", ".", "encodeBigInteger", "(", "new", "BigInteger", "(", "1", ",", "nonce", ")", ")", ";", "return", "sha3omit12", "(", "RLP", ".", "encodeList", "(", "encSender", ",", "encNonce", ")", ")", ";", "}" ]
The way to calculate new address @param addr - creating addres @param nonce - nonce of creating address @return new address
[ "The", "way", "to", "calculate", "new", "address" ]
train
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/HashUtil.java#L123-L129
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/adapter/PropertyAdapter.java
PropertyAdapter.convertExample
public static Object convertExample(String value, String type) { """ Convert a string {@code value} to specified {@code type}. @param value value to convert @param type target conversion type @return converted value as object """ if (value == null) { return null; } try { switch (type) { case "integer": return Integer.valueOf(value); case "number": return Float.valueOf(value); case "boolean": return Boolean.valueOf(value); case "string": return value; default: return value; } } catch (NumberFormatException e) { throw new RuntimeException(String.format("Value '%s' cannot be converted to '%s'", value, type), e); } }
java
public static Object convertExample(String value, String type) { if (value == null) { return null; } try { switch (type) { case "integer": return Integer.valueOf(value); case "number": return Float.valueOf(value); case "boolean": return Boolean.valueOf(value); case "string": return value; default: return value; } } catch (NumberFormatException e) { throw new RuntimeException(String.format("Value '%s' cannot be converted to '%s'", value, type), e); } }
[ "public", "static", "Object", "convertExample", "(", "String", "value", ",", "String", "type", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "switch", "(", "type", ")", "{", "case", "\"integer\"", ":", "return", "Integer", ".", "valueOf", "(", "value", ")", ";", "case", "\"number\"", ":", "return", "Float", ".", "valueOf", "(", "value", ")", ";", "case", "\"boolean\"", ":", "return", "Boolean", ".", "valueOf", "(", "value", ")", ";", "case", "\"string\"", ":", "return", "value", ";", "default", ":", "return", "value", ";", "}", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "String", ".", "format", "(", "\"Value '%s' cannot be converted to '%s'\"", ",", "value", ",", "type", ")", ",", "e", ")", ";", "}", "}" ]
Convert a string {@code value} to specified {@code type}. @param value value to convert @param type target conversion type @return converted value as object
[ "Convert", "a", "string", "{", "@code", "value", "}", "to", "specified", "{", "@code", "type", "}", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/adapter/PropertyAdapter.java#L129-L150
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java
StreamSegmentReadIndex.beginMerge
void beginMerge(long offset, StreamSegmentReadIndex sourceStreamSegmentIndex) { """ Executes Step 1 of the 2-Step Merge Process. The StreamSegments are merged (Source->Target@Offset) in Metadata and a ReadIndex Redirection is put in place. At this stage, the Source still exists as a physical object in Storage, and we need to keep its ReadIndex around, pointing to the old object. @param offset The offset within the StreamSegment to merge at. @param sourceStreamSegmentIndex The Read Index to begin merging. @throws NullPointerException If data is null. @throws IllegalStateException If the current StreamSegment is a child StreamSegment. @throws IllegalArgumentException If the operation would cause writing beyond the StreamSegment's Length. @throws IllegalArgumentException If the offset is invalid (does not match the previous append offset). @throws IllegalArgumentException If sourceStreamSegmentIndex refers to a StreamSegment that is already merged. @throws IllegalArgumentException If sourceStreamSegmentIndex refers to a StreamSegment that has a different parent StreamSegment than the current index's one. """ long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "beginMerge", offset, sourceStreamSegmentIndex.traceObjectId); Exceptions.checkNotClosed(this.closed, this); Exceptions.checkArgument(!sourceStreamSegmentIndex.isMerged(), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex is already merged."); SegmentMetadata sourceMetadata = sourceStreamSegmentIndex.metadata; Exceptions.checkArgument(sourceMetadata.isSealed(), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex refers to a StreamSegment that is not sealed."); long sourceLength = sourceStreamSegmentIndex.getSegmentLength(); RedirectIndexEntry newEntry = new RedirectIndexEntry(offset, sourceStreamSegmentIndex); if (sourceLength == 0) { // Nothing to do. Just record that there is a merge for this source Segment id. return; } // Metadata check can be done outside the write lock. // Adding at the end means that we always need to "catch-up" with Length. Check to see if adding // this entry will make us catch up to it or not. long ourLength = getSegmentLength(); long endOffset = offset + sourceLength; Exceptions.checkArgument(endOffset <= ourLength, "offset", "The given range of bytes(%d-%d) is beyond the StreamSegment Length (%d).", offset, endOffset, ourLength); // Check and record the merger (optimistically). synchronized (this.lock) { Exceptions.checkArgument(!this.pendingMergers.containsKey(sourceMetadata.getId()), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex is already merged or in the process of being merged into this one."); this.pendingMergers.put(sourceMetadata.getId(), new PendingMerge(newEntry.key())); } try { appendEntry(newEntry); } catch (Exception ex) { // If the merger failed, roll back the markers. synchronized (this.lock) { this.pendingMergers.remove(sourceMetadata.getId()); } throw ex; } LoggerHelpers.traceLeave(log, this.traceObjectId, "beginMerge", traceId); }
java
void beginMerge(long offset, StreamSegmentReadIndex sourceStreamSegmentIndex) { long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "beginMerge", offset, sourceStreamSegmentIndex.traceObjectId); Exceptions.checkNotClosed(this.closed, this); Exceptions.checkArgument(!sourceStreamSegmentIndex.isMerged(), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex is already merged."); SegmentMetadata sourceMetadata = sourceStreamSegmentIndex.metadata; Exceptions.checkArgument(sourceMetadata.isSealed(), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex refers to a StreamSegment that is not sealed."); long sourceLength = sourceStreamSegmentIndex.getSegmentLength(); RedirectIndexEntry newEntry = new RedirectIndexEntry(offset, sourceStreamSegmentIndex); if (sourceLength == 0) { // Nothing to do. Just record that there is a merge for this source Segment id. return; } // Metadata check can be done outside the write lock. // Adding at the end means that we always need to "catch-up" with Length. Check to see if adding // this entry will make us catch up to it or not. long ourLength = getSegmentLength(); long endOffset = offset + sourceLength; Exceptions.checkArgument(endOffset <= ourLength, "offset", "The given range of bytes(%d-%d) is beyond the StreamSegment Length (%d).", offset, endOffset, ourLength); // Check and record the merger (optimistically). synchronized (this.lock) { Exceptions.checkArgument(!this.pendingMergers.containsKey(sourceMetadata.getId()), "sourceStreamSegmentIndex", "Given StreamSegmentReadIndex is already merged or in the process of being merged into this one."); this.pendingMergers.put(sourceMetadata.getId(), new PendingMerge(newEntry.key())); } try { appendEntry(newEntry); } catch (Exception ex) { // If the merger failed, roll back the markers. synchronized (this.lock) { this.pendingMergers.remove(sourceMetadata.getId()); } throw ex; } LoggerHelpers.traceLeave(log, this.traceObjectId, "beginMerge", traceId); }
[ "void", "beginMerge", "(", "long", "offset", ",", "StreamSegmentReadIndex", "sourceStreamSegmentIndex", ")", "{", "long", "traceId", "=", "LoggerHelpers", ".", "traceEnterWithContext", "(", "log", ",", "this", ".", "traceObjectId", ",", "\"beginMerge\"", ",", "offset", ",", "sourceStreamSegmentIndex", ".", "traceObjectId", ")", ";", "Exceptions", ".", "checkNotClosed", "(", "this", ".", "closed", ",", "this", ")", ";", "Exceptions", ".", "checkArgument", "(", "!", "sourceStreamSegmentIndex", ".", "isMerged", "(", ")", ",", "\"sourceStreamSegmentIndex\"", ",", "\"Given StreamSegmentReadIndex is already merged.\"", ")", ";", "SegmentMetadata", "sourceMetadata", "=", "sourceStreamSegmentIndex", ".", "metadata", ";", "Exceptions", ".", "checkArgument", "(", "sourceMetadata", ".", "isSealed", "(", ")", ",", "\"sourceStreamSegmentIndex\"", ",", "\"Given StreamSegmentReadIndex refers to a StreamSegment that is not sealed.\"", ")", ";", "long", "sourceLength", "=", "sourceStreamSegmentIndex", ".", "getSegmentLength", "(", ")", ";", "RedirectIndexEntry", "newEntry", "=", "new", "RedirectIndexEntry", "(", "offset", ",", "sourceStreamSegmentIndex", ")", ";", "if", "(", "sourceLength", "==", "0", ")", "{", "// Nothing to do. Just record that there is a merge for this source Segment id.", "return", ";", "}", "// Metadata check can be done outside the write lock.", "// Adding at the end means that we always need to \"catch-up\" with Length. Check to see if adding", "// this entry will make us catch up to it or not.", "long", "ourLength", "=", "getSegmentLength", "(", ")", ";", "long", "endOffset", "=", "offset", "+", "sourceLength", ";", "Exceptions", ".", "checkArgument", "(", "endOffset", "<=", "ourLength", ",", "\"offset\"", ",", "\"The given range of bytes(%d-%d) is beyond the StreamSegment Length (%d).\"", ",", "offset", ",", "endOffset", ",", "ourLength", ")", ";", "// Check and record the merger (optimistically).", "synchronized", "(", "this", ".", "lock", ")", "{", "Exceptions", ".", "checkArgument", "(", "!", "this", ".", "pendingMergers", ".", "containsKey", "(", "sourceMetadata", ".", "getId", "(", ")", ")", ",", "\"sourceStreamSegmentIndex\"", ",", "\"Given StreamSegmentReadIndex is already merged or in the process of being merged into this one.\"", ")", ";", "this", ".", "pendingMergers", ".", "put", "(", "sourceMetadata", ".", "getId", "(", ")", ",", "new", "PendingMerge", "(", "newEntry", ".", "key", "(", ")", ")", ")", ";", "}", "try", "{", "appendEntry", "(", "newEntry", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "// If the merger failed, roll back the markers.", "synchronized", "(", "this", ".", "lock", ")", "{", "this", ".", "pendingMergers", ".", "remove", "(", "sourceMetadata", ".", "getId", "(", ")", ")", ";", "}", "throw", "ex", ";", "}", "LoggerHelpers", ".", "traceLeave", "(", "log", ",", "this", ".", "traceObjectId", ",", "\"beginMerge\"", ",", "traceId", ")", ";", "}" ]
Executes Step 1 of the 2-Step Merge Process. The StreamSegments are merged (Source->Target@Offset) in Metadata and a ReadIndex Redirection is put in place. At this stage, the Source still exists as a physical object in Storage, and we need to keep its ReadIndex around, pointing to the old object. @param offset The offset within the StreamSegment to merge at. @param sourceStreamSegmentIndex The Read Index to begin merging. @throws NullPointerException If data is null. @throws IllegalStateException If the current StreamSegment is a child StreamSegment. @throws IllegalArgumentException If the operation would cause writing beyond the StreamSegment's Length. @throws IllegalArgumentException If the offset is invalid (does not match the previous append offset). @throws IllegalArgumentException If sourceStreamSegmentIndex refers to a StreamSegment that is already merged. @throws IllegalArgumentException If sourceStreamSegmentIndex refers to a StreamSegment that has a different parent StreamSegment than the current index's one.
[ "Executes", "Step", "1", "of", "the", "2", "-", "Step", "Merge", "Process", ".", "The", "StreamSegments", "are", "merged", "(", "Source", "-", ">", "Target@Offset", ")", "in", "Metadata", "and", "a", "ReadIndex", "Redirection", "is", "put", "in", "place", ".", "At", "this", "stage", "the", "Source", "still", "exists", "as", "a", "physical", "object", "in", "Storage", "and", "we", "need", "to", "keep", "its", "ReadIndex", "around", "pointing", "to", "the", "old", "object", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java#L374-L414
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/DetectDescribeAssociate.java
DetectDescribeAssociate.pruneTracks
private void pruneTracks(SetTrackInfo<Desc> info, GrowQueue_I32 unassociated) { """ If there are too many unassociated tracks, randomly select some of those tracks and drop them """ if( unassociated.size > maxInactiveTracks ) { // make the first N elements the ones which will be dropped int numDrop = unassociated.size-maxInactiveTracks; for (int i = 0; i < numDrop; i++) { int selected = rand.nextInt(unassociated.size-i)+i; int a = unassociated.get(i); unassociated.data[i] = unassociated.data[selected]; unassociated.data[selected] = a; } List<PointTrack> dropList = new ArrayList<>(); for (int i = 0; i < numDrop; i++) { dropList.add( info.tracks.get(unassociated.get(i)) ); } for (int i = 0; i < dropList.size(); i++) { dropTrack(dropList.get(i)); } } }
java
private void pruneTracks(SetTrackInfo<Desc> info, GrowQueue_I32 unassociated) { if( unassociated.size > maxInactiveTracks ) { // make the first N elements the ones which will be dropped int numDrop = unassociated.size-maxInactiveTracks; for (int i = 0; i < numDrop; i++) { int selected = rand.nextInt(unassociated.size-i)+i; int a = unassociated.get(i); unassociated.data[i] = unassociated.data[selected]; unassociated.data[selected] = a; } List<PointTrack> dropList = new ArrayList<>(); for (int i = 0; i < numDrop; i++) { dropList.add( info.tracks.get(unassociated.get(i)) ); } for (int i = 0; i < dropList.size(); i++) { dropTrack(dropList.get(i)); } } }
[ "private", "void", "pruneTracks", "(", "SetTrackInfo", "<", "Desc", ">", "info", ",", "GrowQueue_I32", "unassociated", ")", "{", "if", "(", "unassociated", ".", "size", ">", "maxInactiveTracks", ")", "{", "// make the first N elements the ones which will be dropped", "int", "numDrop", "=", "unassociated", ".", "size", "-", "maxInactiveTracks", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numDrop", ";", "i", "++", ")", "{", "int", "selected", "=", "rand", ".", "nextInt", "(", "unassociated", ".", "size", "-", "i", ")", "+", "i", ";", "int", "a", "=", "unassociated", ".", "get", "(", "i", ")", ";", "unassociated", ".", "data", "[", "i", "]", "=", "unassociated", ".", "data", "[", "selected", "]", ";", "unassociated", ".", "data", "[", "selected", "]", "=", "a", ";", "}", "List", "<", "PointTrack", ">", "dropList", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numDrop", ";", "i", "++", ")", "{", "dropList", ".", "add", "(", "info", ".", "tracks", ".", "get", "(", "unassociated", ".", "get", "(", "i", ")", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dropList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "dropTrack", "(", "dropList", ".", "get", "(", "i", ")", ")", ";", "}", "}", "}" ]
If there are too many unassociated tracks, randomly select some of those tracks and drop them
[ "If", "there", "are", "too", "many", "unassociated", "tracks", "randomly", "select", "some", "of", "those", "tracks", "and", "drop", "them" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/DetectDescribeAssociate.java#L174-L192
diirt/util
src/main/java/org/epics/util/array/ListNumbers.java
ListNumbers.linearListFromRange
public static ListNumber linearListFromRange(final double minValue, final double maxValue, final int size) { """ Creates a list of equally spaced values given the range and the number of elements. <p> Note that, due to rounding errors in double precision, the difference between the elements may not be exactly the same. @param minValue the first value in the list @param maxValue the last value in the list @param size the size of the list @return a new list """ if (size <= 0) { throw new IllegalArgumentException("Size must be positive (was " + size + " )"); } return new LinearListDoubleFromRange(size, minValue, maxValue); }
java
public static ListNumber linearListFromRange(final double minValue, final double maxValue, final int size) { if (size <= 0) { throw new IllegalArgumentException("Size must be positive (was " + size + " )"); } return new LinearListDoubleFromRange(size, minValue, maxValue); }
[ "public", "static", "ListNumber", "linearListFromRange", "(", "final", "double", "minValue", ",", "final", "double", "maxValue", ",", "final", "int", "size", ")", "{", "if", "(", "size", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Size must be positive (was \"", "+", "size", "+", "\" )\"", ")", ";", "}", "return", "new", "LinearListDoubleFromRange", "(", "size", ",", "minValue", ",", "maxValue", ")", ";", "}" ]
Creates a list of equally spaced values given the range and the number of elements. <p> Note that, due to rounding errors in double precision, the difference between the elements may not be exactly the same. @param minValue the first value in the list @param maxValue the last value in the list @param size the size of the list @return a new list
[ "Creates", "a", "list", "of", "equally", "spaced", "values", "given", "the", "range", "and", "the", "number", "of", "elements", ".", "<p", ">", "Note", "that", "due", "to", "rounding", "errors", "in", "double", "precision", "the", "difference", "between", "the", "elements", "may", "not", "be", "exactly", "the", "same", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/array/ListNumbers.java#L151-L156
azkaban/azkaban
azkaban-common/src/main/java/azkaban/project/DirectoryYamlFlowLoader.java
DirectoryYamlFlowLoader.loadProjectFlow
@Override public ValidationReport loadProjectFlow(final Project project, final File projectDir) { """ Loads all project flows from the directory. @param project The project. @param projectDir The directory to load flows from. @return the validation report. """ convertYamlFiles(projectDir); FlowLoaderUtils.checkJobProperties(project.getId(), this.props, this.jobPropsMap, this.errors); return FlowLoaderUtils.generateFlowLoaderReport(this.errors); }
java
@Override public ValidationReport loadProjectFlow(final Project project, final File projectDir) { convertYamlFiles(projectDir); FlowLoaderUtils.checkJobProperties(project.getId(), this.props, this.jobPropsMap, this.errors); return FlowLoaderUtils.generateFlowLoaderReport(this.errors); }
[ "@", "Override", "public", "ValidationReport", "loadProjectFlow", "(", "final", "Project", "project", ",", "final", "File", "projectDir", ")", "{", "convertYamlFiles", "(", "projectDir", ")", ";", "FlowLoaderUtils", ".", "checkJobProperties", "(", "project", ".", "getId", "(", ")", ",", "this", ".", "props", ",", "this", ".", "jobPropsMap", ",", "this", ".", "errors", ")", ";", "return", "FlowLoaderUtils", ".", "generateFlowLoaderReport", "(", "this", ".", "errors", ")", ";", "}" ]
Loads all project flows from the directory. @param project The project. @param projectDir The directory to load flows from. @return the validation report.
[ "Loads", "all", "project", "flows", "from", "the", "directory", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/project/DirectoryYamlFlowLoader.java#L111-L116
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java
GraphBackedMetadataRepository.addTrait
@Override @GraphTransaction public void addTrait(List<String> entityGuids, ITypedStruct traitInstance) throws RepositoryException { """ Adds a new trait to the list of entities represented by their respective guids @param entityGuids list of globally unique identifier for the entities @param traitInstance trait instance that needs to be added to entities @throws RepositoryException """ Preconditions.checkNotNull(entityGuids, "entityGuids list cannot be null"); Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null"); if (LOG.isDebugEnabled()) { LOG.debug("Adding a new trait={} for entities={}", traitInstance.getTypeName(), entityGuids); } GraphTransactionInterceptor.lockObjectAndReleasePostCommit(entityGuids); for (String entityGuid : entityGuids) { addTraitImpl(entityGuid, traitInstance); } }
java
@Override @GraphTransaction public void addTrait(List<String> entityGuids, ITypedStruct traitInstance) throws RepositoryException { Preconditions.checkNotNull(entityGuids, "entityGuids list cannot be null"); Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null"); if (LOG.isDebugEnabled()) { LOG.debug("Adding a new trait={} for entities={}", traitInstance.getTypeName(), entityGuids); } GraphTransactionInterceptor.lockObjectAndReleasePostCommit(entityGuids); for (String entityGuid : entityGuids) { addTraitImpl(entityGuid, traitInstance); } }
[ "@", "Override", "@", "GraphTransaction", "public", "void", "addTrait", "(", "List", "<", "String", ">", "entityGuids", ",", "ITypedStruct", "traitInstance", ")", "throws", "RepositoryException", "{", "Preconditions", ".", "checkNotNull", "(", "entityGuids", ",", "\"entityGuids list cannot be null\"", ")", ";", "Preconditions", ".", "checkNotNull", "(", "traitInstance", ",", "\"Trait instance cannot be null\"", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Adding a new trait={} for entities={}\"", ",", "traitInstance", ".", "getTypeName", "(", ")", ",", "entityGuids", ")", ";", "}", "GraphTransactionInterceptor", ".", "lockObjectAndReleasePostCommit", "(", "entityGuids", ")", ";", "for", "(", "String", "entityGuid", ":", "entityGuids", ")", "{", "addTraitImpl", "(", "entityGuid", ",", "traitInstance", ")", ";", "}", "}" ]
Adds a new trait to the list of entities represented by their respective guids @param entityGuids list of globally unique identifier for the entities @param traitInstance trait instance that needs to be added to entities @throws RepositoryException
[ "Adds", "a", "new", "trait", "to", "the", "list", "of", "entities", "represented", "by", "their", "respective", "guids" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedMetadataRepository.java#L306-L320
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/MetaFieldUtil.java
MetaFieldUtil.toMetaFieldInfoArray
public static MetaFieldInfo[] toMetaFieldInfoArray(Class type, Object obj, String stringForNullValues, boolean ignoreAnnotatedName, boolean recursive) { """ Returns a new MetaFieldInfo array of all Fields annotated with MetaField in the object type. The object must be an instance of the type, otherwise this method may throw a runtime exception. Optionally, this method can recursively search the object to provide a deep view of the entire class. @param type The class type of the object @param obj The runtime instance of the object to search. It must be an instance of the type. If its a subclass of the type, this method will only return MetaFields of the type passed in. @param stringForNullValues If a field is null, this is the string to swap in as the String value vs. "null" showing up. @param ignoreAnnotatedName Whether to ignore the name of the MetaField and always return the field name instead. If false, this method will use the annotated name if it exists, otherwise it'll use the field name. @param recursive If true, this method will recursively search any fields to see if they also contain MetaField annotations. If they do, this method will include those in its returned array. @return The MetaFieldInfo array """ return internalToMetaFieldInfoArray(type, obj, null, null, stringForNullValues, ignoreAnnotatedName, recursive); }
java
public static MetaFieldInfo[] toMetaFieldInfoArray(Class type, Object obj, String stringForNullValues, boolean ignoreAnnotatedName, boolean recursive) { return internalToMetaFieldInfoArray(type, obj, null, null, stringForNullValues, ignoreAnnotatedName, recursive); }
[ "public", "static", "MetaFieldInfo", "[", "]", "toMetaFieldInfoArray", "(", "Class", "type", ",", "Object", "obj", ",", "String", "stringForNullValues", ",", "boolean", "ignoreAnnotatedName", ",", "boolean", "recursive", ")", "{", "return", "internalToMetaFieldInfoArray", "(", "type", ",", "obj", ",", "null", ",", "null", ",", "stringForNullValues", ",", "ignoreAnnotatedName", ",", "recursive", ")", ";", "}" ]
Returns a new MetaFieldInfo array of all Fields annotated with MetaField in the object type. The object must be an instance of the type, otherwise this method may throw a runtime exception. Optionally, this method can recursively search the object to provide a deep view of the entire class. @param type The class type of the object @param obj The runtime instance of the object to search. It must be an instance of the type. If its a subclass of the type, this method will only return MetaFields of the type passed in. @param stringForNullValues If a field is null, this is the string to swap in as the String value vs. "null" showing up. @param ignoreAnnotatedName Whether to ignore the name of the MetaField and always return the field name instead. If false, this method will use the annotated name if it exists, otherwise it'll use the field name. @param recursive If true, this method will recursively search any fields to see if they also contain MetaField annotations. If they do, this method will include those in its returned array. @return The MetaFieldInfo array
[ "Returns", "a", "new", "MetaFieldInfo", "array", "of", "all", "Fields", "annotated", "with", "MetaField", "in", "the", "object", "type", ".", "The", "object", "must", "be", "an", "instance", "of", "the", "type", "otherwise", "this", "method", "may", "throw", "a", "runtime", "exception", ".", "Optionally", "this", "method", "can", "recursively", "search", "the", "object", "to", "provide", "a", "deep", "view", "of", "the", "entire", "class", "." ]
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/MetaFieldUtil.java#L138-L140
jamesagnew/hapi-fhir
hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java
AbstractJaxRsResourceProvider.findCompartment
@GET @Path("/ { """ Compartment Based Access @param id the resource to which the compartment belongs @param compartment the compartment @return the repsonse @see <a href="https://www.hl7.org/fhir/http.html#search">https://www.hl7.org/fhir/http.html#search</a> @see <a href="https://www.hl7.org/fhir/compartments.html#compartment">https://www.hl7.org/fhir/compartments.html#compartment</a> """id}/{compartment}") public Response findCompartment(@PathParam("id") final String id, @PathParam("compartment") final String compartment) throws IOException { final Builder theRequest = getResourceRequest(RequestTypeEnum.GET, RestOperationTypeEnum.SEARCH_TYPE).id(id).compartment( compartment); return execute(theRequest, compartment); }
java
@GET @Path("/{id}/{compartment}") public Response findCompartment(@PathParam("id") final String id, @PathParam("compartment") final String compartment) throws IOException { final Builder theRequest = getResourceRequest(RequestTypeEnum.GET, RestOperationTypeEnum.SEARCH_TYPE).id(id).compartment( compartment); return execute(theRequest, compartment); }
[ "@", "GET", "@", "Path", "(", "\"/{id}/{compartment}\"", ")", "public", "Response", "findCompartment", "(", "@", "PathParam", "(", "\"id\"", ")", "final", "String", "id", ",", "@", "PathParam", "(", "\"compartment\"", ")", "final", "String", "compartment", ")", "throws", "IOException", "{", "final", "Builder", "theRequest", "=", "getResourceRequest", "(", "RequestTypeEnum", ".", "GET", ",", "RestOperationTypeEnum", ".", "SEARCH_TYPE", ")", ".", "id", "(", "id", ")", ".", "compartment", "(", "compartment", ")", ";", "return", "execute", "(", "theRequest", ",", "compartment", ")", ";", "}" ]
Compartment Based Access @param id the resource to which the compartment belongs @param compartment the compartment @return the repsonse @see <a href="https://www.hl7.org/fhir/http.html#search">https://www.hl7.org/fhir/http.html#search</a> @see <a href="https://www.hl7.org/fhir/compartments.html#compartment">https://www.hl7.org/fhir/compartments.html#compartment</a>
[ "Compartment", "Based", "Access" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L272-L279
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.addDescription
protected void addDescription(PackageDoc pkg, Content dlTree, SearchIndexItem si) { """ Add one line summary comment for the package. @param pkg the package to be documented @param dlTree the content tree to which the description will be added """ Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))); si.setLabel(utils.getPackageName(pkg)); si.setCategory(getResource("doclet.Packages").toString()); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(getResource("doclet.package")); dt.addContent(" " + pkg.name()); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(pkg, dd); dlTree.addContent(dd); }
java
protected void addDescription(PackageDoc pkg, Content dlTree, SearchIndexItem si) { Content link = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg))); si.setLabel(utils.getPackageName(pkg)); si.setCategory(getResource("doclet.Packages").toString()); Content dt = HtmlTree.DT(link); dt.addContent(" - "); dt.addContent(getResource("doclet.package")); dt.addContent(" " + pkg.name()); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addSummaryComment(pkg, dd); dlTree.addContent(dd); }
[ "protected", "void", "addDescription", "(", "PackageDoc", "pkg", ",", "Content", "dlTree", ",", "SearchIndexItem", "si", ")", "{", "Content", "link", "=", "getPackageLink", "(", "pkg", ",", "new", "StringContent", "(", "utils", ".", "getPackageName", "(", "pkg", ")", ")", ")", ";", "si", ".", "setLabel", "(", "utils", ".", "getPackageName", "(", "pkg", ")", ")", ";", "si", ".", "setCategory", "(", "getResource", "(", "\"doclet.Packages\"", ")", ".", "toString", "(", ")", ")", ";", "Content", "dt", "=", "HtmlTree", ".", "DT", "(", "link", ")", ";", "dt", ".", "addContent", "(", "\" - \"", ")", ";", "dt", ".", "addContent", "(", "getResource", "(", "\"doclet.package\"", ")", ")", ";", "dt", ".", "addContent", "(", "\" \"", "+", "pkg", ".", "name", "(", ")", ")", ";", "dlTree", ".", "addContent", "(", "dt", ")", ";", "Content", "dd", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "DD", ")", ";", "addSummaryComment", "(", "pkg", ",", "dd", ")", ";", "dlTree", ".", "addContent", "(", "dd", ")", ";", "}" ]
Add one line summary comment for the package. @param pkg the package to be documented @param dlTree the content tree to which the description will be added
[ "Add", "one", "line", "summary", "comment", "for", "the", "package", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java#L187-L199
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java
WebhooksInner.beginUpdate
public WebhookInner beginUpdate(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) { """ Updates a webhook with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param webhookName The name of the webhook. @param webhookUpdateParameters The parameters for updating a webhook. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the WebhookInner object if successful. """ return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).toBlocking().single().body(); }
java
public WebhookInner beginUpdate(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).toBlocking().single().body(); }
[ "public", "WebhookInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "webhookName", ",", "WebhookUpdateParameters", "webhookUpdateParameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "webhookName", ",", "webhookUpdateParameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates a webhook with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param webhookName The name of the webhook. @param webhookUpdateParameters The parameters for updating a webhook. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the WebhookInner object if successful.
[ "Updates", "a", "webhook", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L654-L656
buschmais/jqa-rdbms-plugin
src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java
AbstractSchemaScannerPlugin.createForeignKeys
private void createForeignKeys(Set<ForeignKey> allForeignKeys, Map<Column, ColumnDescriptor> allColumns, Store store) { """ Create the foreign key descriptors. @param allForeignKeys All collected foreign keys. @param allColumns All collected columns. @param store The store. """ // Foreign keys for (ForeignKey foreignKey : allForeignKeys) { ForeignKeyDescriptor foreignKeyDescriptor = store.create(ForeignKeyDescriptor.class); foreignKeyDescriptor.setName(foreignKey.getName()); foreignKeyDescriptor.setDeferrability(foreignKey.getDeferrability().name()); foreignKeyDescriptor.setDeleteRule(foreignKey.getDeleteRule().name()); foreignKeyDescriptor.setUpdateRule(foreignKey.getUpdateRule().name()); for (ForeignKeyColumnReference columnReference : foreignKey.getColumnReferences()) { ForeignKeyReferenceDescriptor keyReferenceDescriptor = store.create(ForeignKeyReferenceDescriptor.class); // foreign key table and column Column foreignKeyColumn = columnReference.getForeignKeyColumn(); ColumnDescriptor foreignKeyColumnDescriptor = allColumns.get(foreignKeyColumn); keyReferenceDescriptor.setForeignKeyColumn(foreignKeyColumnDescriptor); // primary key table and column Column primaryKeyColumn = columnReference.getPrimaryKeyColumn(); ColumnDescriptor primaryKeyColumnDescriptor = allColumns.get(primaryKeyColumn); keyReferenceDescriptor.setPrimaryKeyColumn(primaryKeyColumnDescriptor); foreignKeyDescriptor.getForeignKeyReferences().add(keyReferenceDescriptor); } } }
java
private void createForeignKeys(Set<ForeignKey> allForeignKeys, Map<Column, ColumnDescriptor> allColumns, Store store) { // Foreign keys for (ForeignKey foreignKey : allForeignKeys) { ForeignKeyDescriptor foreignKeyDescriptor = store.create(ForeignKeyDescriptor.class); foreignKeyDescriptor.setName(foreignKey.getName()); foreignKeyDescriptor.setDeferrability(foreignKey.getDeferrability().name()); foreignKeyDescriptor.setDeleteRule(foreignKey.getDeleteRule().name()); foreignKeyDescriptor.setUpdateRule(foreignKey.getUpdateRule().name()); for (ForeignKeyColumnReference columnReference : foreignKey.getColumnReferences()) { ForeignKeyReferenceDescriptor keyReferenceDescriptor = store.create(ForeignKeyReferenceDescriptor.class); // foreign key table and column Column foreignKeyColumn = columnReference.getForeignKeyColumn(); ColumnDescriptor foreignKeyColumnDescriptor = allColumns.get(foreignKeyColumn); keyReferenceDescriptor.setForeignKeyColumn(foreignKeyColumnDescriptor); // primary key table and column Column primaryKeyColumn = columnReference.getPrimaryKeyColumn(); ColumnDescriptor primaryKeyColumnDescriptor = allColumns.get(primaryKeyColumn); keyReferenceDescriptor.setPrimaryKeyColumn(primaryKeyColumnDescriptor); foreignKeyDescriptor.getForeignKeyReferences().add(keyReferenceDescriptor); } } }
[ "private", "void", "createForeignKeys", "(", "Set", "<", "ForeignKey", ">", "allForeignKeys", ",", "Map", "<", "Column", ",", "ColumnDescriptor", ">", "allColumns", ",", "Store", "store", ")", "{", "// Foreign keys", "for", "(", "ForeignKey", "foreignKey", ":", "allForeignKeys", ")", "{", "ForeignKeyDescriptor", "foreignKeyDescriptor", "=", "store", ".", "create", "(", "ForeignKeyDescriptor", ".", "class", ")", ";", "foreignKeyDescriptor", ".", "setName", "(", "foreignKey", ".", "getName", "(", ")", ")", ";", "foreignKeyDescriptor", ".", "setDeferrability", "(", "foreignKey", ".", "getDeferrability", "(", ")", ".", "name", "(", ")", ")", ";", "foreignKeyDescriptor", ".", "setDeleteRule", "(", "foreignKey", ".", "getDeleteRule", "(", ")", ".", "name", "(", ")", ")", ";", "foreignKeyDescriptor", ".", "setUpdateRule", "(", "foreignKey", ".", "getUpdateRule", "(", ")", ".", "name", "(", ")", ")", ";", "for", "(", "ForeignKeyColumnReference", "columnReference", ":", "foreignKey", ".", "getColumnReferences", "(", ")", ")", "{", "ForeignKeyReferenceDescriptor", "keyReferenceDescriptor", "=", "store", ".", "create", "(", "ForeignKeyReferenceDescriptor", ".", "class", ")", ";", "// foreign key table and column", "Column", "foreignKeyColumn", "=", "columnReference", ".", "getForeignKeyColumn", "(", ")", ";", "ColumnDescriptor", "foreignKeyColumnDescriptor", "=", "allColumns", ".", "get", "(", "foreignKeyColumn", ")", ";", "keyReferenceDescriptor", ".", "setForeignKeyColumn", "(", "foreignKeyColumnDescriptor", ")", ";", "// primary key table and column", "Column", "primaryKeyColumn", "=", "columnReference", ".", "getPrimaryKeyColumn", "(", ")", ";", "ColumnDescriptor", "primaryKeyColumnDescriptor", "=", "allColumns", ".", "get", "(", "primaryKeyColumn", ")", ";", "keyReferenceDescriptor", ".", "setPrimaryKeyColumn", "(", "primaryKeyColumnDescriptor", ")", ";", "foreignKeyDescriptor", ".", "getForeignKeyReferences", "(", ")", ".", "add", "(", "keyReferenceDescriptor", ")", ";", "}", "}", "}" ]
Create the foreign key descriptors. @param allForeignKeys All collected foreign keys. @param allColumns All collected columns. @param store The store.
[ "Create", "the", "foreign", "key", "descriptors", "." ]
train
https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L233-L254
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/utility/UI/CurvedArrow.java
CurvedArrow.setStart
public void setStart(int x1, int y1) { """ Sets the start point. @param x1 the x coordinate of the start point @param y1 the y coordinate of the start point """ start.x = x1; start.y = y1; needsRefresh = true; }
java
public void setStart(int x1, int y1) { start.x = x1; start.y = y1; needsRefresh = true; }
[ "public", "void", "setStart", "(", "int", "x1", ",", "int", "y1", ")", "{", "start", ".", "x", "=", "x1", ";", "start", ".", "y", "=", "y1", ";", "needsRefresh", "=", "true", ";", "}" ]
Sets the start point. @param x1 the x coordinate of the start point @param y1 the y coordinate of the start point
[ "Sets", "the", "start", "point", "." ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/utility/UI/CurvedArrow.java#L90-L94
alkacon/opencms-core
src/org/opencms/jsp/CmsJspNavBuilder.java
CmsJspNavBuilder.getNavigationForResource
public CmsJspNavElement getNavigationForResource(String sitePath, CmsResourceFilter reourceFilter) { """ Returns a navigation element for the named resource.<p> @param sitePath the resource name to get the navigation information for, must be a full path name, e.g. "/docs/index.html" @param reourceFilter the resource filter @return a navigation element for the given resource """ return getNavigationForResource(sitePath, reourceFilter, false); }
java
public CmsJspNavElement getNavigationForResource(String sitePath, CmsResourceFilter reourceFilter) { return getNavigationForResource(sitePath, reourceFilter, false); }
[ "public", "CmsJspNavElement", "getNavigationForResource", "(", "String", "sitePath", ",", "CmsResourceFilter", "reourceFilter", ")", "{", "return", "getNavigationForResource", "(", "sitePath", ",", "reourceFilter", ",", "false", ")", ";", "}" ]
Returns a navigation element for the named resource.<p> @param sitePath the resource name to get the navigation information for, must be a full path name, e.g. "/docs/index.html" @param reourceFilter the resource filter @return a navigation element for the given resource
[ "Returns", "a", "navigation", "element", "for", "the", "named", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspNavBuilder.java#L607-L610
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.rotateXYZ
public Matrix4x3f rotateXYZ(Vector3f angles) { """ Apply rotation of <code>angles.x</code> radians about the X axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and followed by a rotation of <code>angles.z</code> radians about the Z axis. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>M * R</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the rotation will be applied first! <p> This method is equivalent to calling: <code>rotateX(angles.x).rotateY(angles.y).rotateZ(angles.z)</code> @param angles the Euler angles @return this """ return rotateXYZ(angles.x, angles.y, angles.z); }
java
public Matrix4x3f rotateXYZ(Vector3f angles) { return rotateXYZ(angles.x, angles.y, angles.z); }
[ "public", "Matrix4x3f", "rotateXYZ", "(", "Vector3f", "angles", ")", "{", "return", "rotateXYZ", "(", "angles", ".", "x", ",", "angles", ".", "y", ",", "angles", ".", "z", ")", ";", "}" ]
Apply rotation of <code>angles.x</code> radians about the X axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and followed by a rotation of <code>angles.z</code> radians about the Z axis. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>M * R</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the rotation will be applied first! <p> This method is equivalent to calling: <code>rotateX(angles.x).rotateY(angles.y).rotateZ(angles.z)</code> @param angles the Euler angles @return this
[ "Apply", "rotation", "of", "<code", ">", "angles", ".", "x<", "/", "code", ">", "radians", "about", "the", "X", "axis", "followed", "by", "a", "rotation", "of", "<code", ">", "angles", ".", "y<", "/", "code", ">", "radians", "about", "the", "Y", "axis", "and", "followed", "by", "a", "rotation", "of", "<code", ">", "angles", ".", "z<", "/", "code", ">", "radians", "about", "the", "Z", "axis", ".", "<p", ">", "When", "used", "with", "a", "right", "-", "handed", "coordinate", "system", "the", "produced", "rotation", "will", "rotate", "a", "vector", "counter", "-", "clockwise", "around", "the", "rotation", "axis", "when", "viewing", "along", "the", "negative", "axis", "direction", "towards", "the", "origin", ".", "When", "used", "with", "a", "left", "-", "handed", "coordinate", "system", "the", "rotation", "is", "clockwise", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "R<", "/", "code", ">", "the", "rotation", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "R<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "R", "*", "v<", "/", "code", ">", "the", "rotation", "will", "be", "applied", "first!", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", ":", "<code", ">", "rotateX", "(", "angles", ".", "x", ")", ".", "rotateY", "(", "angles", ".", "y", ")", ".", "rotateZ", "(", "angles", ".", "z", ")", "<", "/", "code", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L3521-L3523
JavaMoney/jsr354-api
src/main/java/javax/money/AbstractContextBuilder.java
AbstractContextBuilder.importContext
public B importContext(AbstractContext context, boolean overwriteDuplicates) { """ Apply all attributes on the given context. @param context the context to be applied, not null. @param overwriteDuplicates flag, if existing entries should be overwritten. @return this Builder, for chaining """ for (Map.Entry<String, Object> en : context.data.entrySet()) { if (overwriteDuplicates) { this.data.put(en.getKey(), en.getValue()); }else{ this.data.putIfAbsent(en.getKey(), en.getValue()); } } return (B) this; }
java
public B importContext(AbstractContext context, boolean overwriteDuplicates){ for (Map.Entry<String, Object> en : context.data.entrySet()) { if (overwriteDuplicates) { this.data.put(en.getKey(), en.getValue()); }else{ this.data.putIfAbsent(en.getKey(), en.getValue()); } } return (B) this; }
[ "public", "B", "importContext", "(", "AbstractContext", "context", ",", "boolean", "overwriteDuplicates", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "en", ":", "context", ".", "data", ".", "entrySet", "(", ")", ")", "{", "if", "(", "overwriteDuplicates", ")", "{", "this", ".", "data", ".", "put", "(", "en", ".", "getKey", "(", ")", ",", "en", ".", "getValue", "(", ")", ")", ";", "}", "else", "{", "this", ".", "data", ".", "putIfAbsent", "(", "en", ".", "getKey", "(", ")", ",", "en", ".", "getValue", "(", ")", ")", ";", "}", "}", "return", "(", "B", ")", "this", ";", "}" ]
Apply all attributes on the given context. @param context the context to be applied, not null. @param overwriteDuplicates flag, if existing entries should be overwritten. @return this Builder, for chaining
[ "Apply", "all", "attributes", "on", "the", "given", "context", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContextBuilder.java#L48-L57
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/runtime/Context.java
Context.deepCopy
public Context deepCopy() { """ Make a deep copy of the context, using Value.deepCopy. Every concrete subclass must implements its own version of this method. @return """ Context below = null; if (outer != null) { below = outer.deepCopy(); } Context result = new Context(assistantFactory, location, title, below); result.threadState = threadState; for (ILexNameToken var : keySet()) { Value v = get(var); result.put(var, v.deepCopy()); } return result; }
java
public Context deepCopy() { Context below = null; if (outer != null) { below = outer.deepCopy(); } Context result = new Context(assistantFactory, location, title, below); result.threadState = threadState; for (ILexNameToken var : keySet()) { Value v = get(var); result.put(var, v.deepCopy()); } return result; }
[ "public", "Context", "deepCopy", "(", ")", "{", "Context", "below", "=", "null", ";", "if", "(", "outer", "!=", "null", ")", "{", "below", "=", "outer", ".", "deepCopy", "(", ")", ";", "}", "Context", "result", "=", "new", "Context", "(", "assistantFactory", ",", "location", ",", "title", ",", "below", ")", ";", "result", ".", "threadState", "=", "threadState", ";", "for", "(", "ILexNameToken", "var", ":", "keySet", "(", ")", ")", "{", "Value", "v", "=", "get", "(", "var", ")", ";", "result", ".", "put", "(", "var", ",", "v", ".", "deepCopy", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Make a deep copy of the context, using Value.deepCopy. Every concrete subclass must implements its own version of this method. @return
[ "Make", "a", "deep", "copy", "of", "the", "context", "using", "Value", ".", "deepCopy", ".", "Every", "concrete", "subclass", "must", "implements", "its", "own", "version", "of", "this", "method", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/Context.java#L151-L170
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.warnv
public void warnv(Throwable t, String format, Object... params) { """ Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. @param t the throwable @param format the message format string @param params the parameters """ doLog(Level.WARN, FQCN, format, params, t); }
java
public void warnv(Throwable t, String format, Object... params) { doLog(Level.WARN, FQCN, format, params, t); }
[ "public", "void", "warnv", "(", "Throwable", "t", ",", "String", "format", ",", "Object", "...", "params", ")", "{", "doLog", "(", "Level", ".", "WARN", ",", "FQCN", ",", "format", ",", "params", ",", "t", ")", ";", "}" ]
Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. @param t the throwable @param format the message format string @param params the parameters
[ "Issue", "a", "log", "message", "with", "a", "level", "of", "WARN", "using", "{", "@link", "java", ".", "text", ".", "MessageFormat", "}", "-", "style", "formatting", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1343-L1345
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java
TransactionContext.commitAsync
public CompletableFuture<Void> commitAsync() { """ Asynchronously commits the transaction @return a CompletableFuture for the commit operation """ if (this.messagingFactory == null) { CompletableFuture<Void> exceptionCompletion = new CompletableFuture<>(); exceptionCompletion.completeExceptionally(new ServiceBusException(false, "MessagingFactory should not be null")); return exceptionCompletion; } return this.messagingFactory.endTransactionAsync(this, true); }
java
public CompletableFuture<Void> commitAsync() { if (this.messagingFactory == null) { CompletableFuture<Void> exceptionCompletion = new CompletableFuture<>(); exceptionCompletion.completeExceptionally(new ServiceBusException(false, "MessagingFactory should not be null")); return exceptionCompletion; } return this.messagingFactory.endTransactionAsync(this, true); }
[ "public", "CompletableFuture", "<", "Void", ">", "commitAsync", "(", ")", "{", "if", "(", "this", ".", "messagingFactory", "==", "null", ")", "{", "CompletableFuture", "<", "Void", ">", "exceptionCompletion", "=", "new", "CompletableFuture", "<>", "(", ")", ";", "exceptionCompletion", ".", "completeExceptionally", "(", "new", "ServiceBusException", "(", "false", ",", "\"MessagingFactory should not be null\"", ")", ")", ";", "return", "exceptionCompletion", ";", "}", "return", "this", ".", "messagingFactory", ".", "endTransactionAsync", "(", "this", ",", "true", ")", ";", "}" ]
Asynchronously commits the transaction @return a CompletableFuture for the commit operation
[ "Asynchronously", "commits", "the", "transaction" ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/TransactionContext.java#L56-L64
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.applyPattern
public void applyPattern(String pattern, MessagePattern.ApostropheMode aposMode) { """ <strong>[icu]</strong> Sets the ApostropheMode and the pattern used by this message format. Parses the pattern and caches Format objects for simple argument types. Patterns and their interpretation are specified in the <a href="#patterns">class description</a>. <p> This method is best used only once on a given object to avoid confusion about the mode, and after constructing the object with an empty pattern string to minimize overhead. @param pattern the pattern for this message format @param aposMode the new ApostropheMode @throws IllegalArgumentException if the pattern is invalid @see MessagePattern.ApostropheMode """ if (msgPattern == null) { msgPattern = new MessagePattern(aposMode); } else if (aposMode != msgPattern.getApostropheMode()) { msgPattern.clearPatternAndSetApostropheMode(aposMode); } applyPattern(pattern); }
java
public void applyPattern(String pattern, MessagePattern.ApostropheMode aposMode) { if (msgPattern == null) { msgPattern = new MessagePattern(aposMode); } else if (aposMode != msgPattern.getApostropheMode()) { msgPattern.clearPatternAndSetApostropheMode(aposMode); } applyPattern(pattern); }
[ "public", "void", "applyPattern", "(", "String", "pattern", ",", "MessagePattern", ".", "ApostropheMode", "aposMode", ")", "{", "if", "(", "msgPattern", "==", "null", ")", "{", "msgPattern", "=", "new", "MessagePattern", "(", "aposMode", ")", ";", "}", "else", "if", "(", "aposMode", "!=", "msgPattern", ".", "getApostropheMode", "(", ")", ")", "{", "msgPattern", ".", "clearPatternAndSetApostropheMode", "(", "aposMode", ")", ";", "}", "applyPattern", "(", "pattern", ")", ";", "}" ]
<strong>[icu]</strong> Sets the ApostropheMode and the pattern used by this message format. Parses the pattern and caches Format objects for simple argument types. Patterns and their interpretation are specified in the <a href="#patterns">class description</a>. <p> This method is best used only once on a given object to avoid confusion about the mode, and after constructing the object with an empty pattern string to minimize overhead. @param pattern the pattern for this message format @param aposMode the new ApostropheMode @throws IllegalArgumentException if the pattern is invalid @see MessagePattern.ApostropheMode
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Sets", "the", "ApostropheMode", "and", "the", "pattern", "used", "by", "this", "message", "format", ".", "Parses", "the", "pattern", "and", "caches", "Format", "objects", "for", "simple", "argument", "types", ".", "Patterns", "and", "their", "interpretation", "are", "specified", "in", "the", "<a", "href", "=", "#patterns", ">", "class", "description<", "/", "a", ">", ".", "<p", ">", "This", "method", "is", "best", "used", "only", "once", "on", "a", "given", "object", "to", "avoid", "confusion", "about", "the", "mode", "and", "after", "constructing", "the", "object", "with", "an", "empty", "pattern", "string", "to", "minimize", "overhead", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L474-L481
berkesa/datatree-promise
src/main/java/io/datatree/Promise.java
Promise.waitFor
public Tree waitFor(long timeout, TimeUnit unit) throws Exception { """ Waits if necessary for this future to complete, and then returns its result. It's a blocking operation, do not use this method unless it is absolutely necessary for something. Rather use the "then" and "catchError" methods. @param timeout the maximum time to wait @param unit the time unit of the timeout argument @return result Tree structure @throws Exception any (interruption, execution, user-level, etc.) exception """ try { return future.get(timeout, unit); } catch (ExecutionException outerError) { Throwable cause = outerError.getCause(); if (cause != null && cause instanceof Exception) { throw (Exception) cause; } throw outerError; } }
java
public Tree waitFor(long timeout, TimeUnit unit) throws Exception { try { return future.get(timeout, unit); } catch (ExecutionException outerError) { Throwable cause = outerError.getCause(); if (cause != null && cause instanceof Exception) { throw (Exception) cause; } throw outerError; } }
[ "public", "Tree", "waitFor", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "Exception", "{", "try", "{", "return", "future", ".", "get", "(", "timeout", ",", "unit", ")", ";", "}", "catch", "(", "ExecutionException", "outerError", ")", "{", "Throwable", "cause", "=", "outerError", ".", "getCause", "(", ")", ";", "if", "(", "cause", "!=", "null", "&&", "cause", "instanceof", "Exception", ")", "{", "throw", "(", "Exception", ")", "cause", ";", "}", "throw", "outerError", ";", "}", "}" ]
Waits if necessary for this future to complete, and then returns its result. It's a blocking operation, do not use this method unless it is absolutely necessary for something. Rather use the "then" and "catchError" methods. @param timeout the maximum time to wait @param unit the time unit of the timeout argument @return result Tree structure @throws Exception any (interruption, execution, user-level, etc.) exception
[ "Waits", "if", "necessary", "for", "this", "future", "to", "complete", "and", "then", "returns", "its", "result", ".", "It", "s", "a", "blocking", "operation", "do", "not", "use", "this", "method", "unless", "it", "is", "absolutely", "necessary", "for", "something", ".", "Rather", "use", "the", "then", "and", "catchError", "methods", "." ]
train
https://github.com/berkesa/datatree-promise/blob/d9093bdb549f69b83b3eff5e29cd511f2014f177/src/main/java/io/datatree/Promise.java#L784-L794
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java
SSLUtils.createRestClientSSLContext
@Nullable public static SSLContext createRestClientSSLContext(Configuration config) throws Exception { """ Creates an SSL context for clients against the external REST endpoint. """ final RestSSLContextConfigMode configMode; if (isRestSSLAuthenticationEnabled(config)) { configMode = RestSSLContextConfigMode.MUTUAL; } else { configMode = RestSSLContextConfigMode.CLIENT; } return createRestSSLContext(config, configMode); }
java
@Nullable public static SSLContext createRestClientSSLContext(Configuration config) throws Exception { final RestSSLContextConfigMode configMode; if (isRestSSLAuthenticationEnabled(config)) { configMode = RestSSLContextConfigMode.MUTUAL; } else { configMode = RestSSLContextConfigMode.CLIENT; } return createRestSSLContext(config, configMode); }
[ "@", "Nullable", "public", "static", "SSLContext", "createRestClientSSLContext", "(", "Configuration", "config", ")", "throws", "Exception", "{", "final", "RestSSLContextConfigMode", "configMode", ";", "if", "(", "isRestSSLAuthenticationEnabled", "(", "config", ")", ")", "{", "configMode", "=", "RestSSLContextConfigMode", ".", "MUTUAL", ";", "}", "else", "{", "configMode", "=", "RestSSLContextConfigMode", ".", "CLIENT", ";", "}", "return", "createRestSSLContext", "(", "config", ",", "configMode", ")", ";", "}" ]
Creates an SSL context for clients against the external REST endpoint.
[ "Creates", "an", "SSL", "context", "for", "clients", "against", "the", "external", "REST", "endpoint", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/net/SSLUtils.java#L343-L353
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/PipelineApi.java
PipelineApi.createPipelineSchedule
public PipelineSchedule createPipelineSchedule(Object projectIdOrPath, PipelineSchedule pipelineSchedule) throws GitLabApiException { """ create a pipeline schedule for a project. <pre><code>POST /projects/:id/pipeline_schedules</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param pipelineSchedule a PipelineSchedule instance to create @return the added PipelineSchedule instance @throws GitLabApiException if any exception occurs """ GitLabApiForm formData = new GitLabApiForm() .withParam("description", pipelineSchedule.getDescription(), true) .withParam("ref", pipelineSchedule.getRef(), true) .withParam("cron", pipelineSchedule.getCron(), true) .withParam("cron_timezone", pipelineSchedule.getCronTimezone(), false) .withParam("active", pipelineSchedule.getActive(), false); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules"); return (response.readEntity(PipelineSchedule.class)); }
java
public PipelineSchedule createPipelineSchedule(Object projectIdOrPath, PipelineSchedule pipelineSchedule) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("description", pipelineSchedule.getDescription(), true) .withParam("ref", pipelineSchedule.getRef(), true) .withParam("cron", pipelineSchedule.getCron(), true) .withParam("cron_timezone", pipelineSchedule.getCronTimezone(), false) .withParam("active", pipelineSchedule.getActive(), false); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules"); return (response.readEntity(PipelineSchedule.class)); }
[ "public", "PipelineSchedule", "createPipelineSchedule", "(", "Object", "projectIdOrPath", ",", "PipelineSchedule", "pipelineSchedule", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"description\"", ",", "pipelineSchedule", ".", "getDescription", "(", ")", ",", "true", ")", ".", "withParam", "(", "\"ref\"", ",", "pipelineSchedule", ".", "getRef", "(", ")", ",", "true", ")", ".", "withParam", "(", "\"cron\"", ",", "pipelineSchedule", ".", "getCron", "(", ")", ",", "true", ")", ".", "withParam", "(", "\"cron_timezone\"", ",", "pipelineSchedule", ".", "getCronTimezone", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"active\"", ",", "pipelineSchedule", ".", "getActive", "(", ")", ",", "false", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"pipeline_schedules\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "PipelineSchedule", ".", "class", ")", ")", ";", "}" ]
create a pipeline schedule for a project. <pre><code>POST /projects/:id/pipeline_schedules</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param pipelineSchedule a PipelineSchedule instance to create @return the added PipelineSchedule instance @throws GitLabApiException if any exception occurs
[ "create", "a", "pipeline", "schedule", "for", "a", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/PipelineApi.java#L395-L406
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDate.java
LocalDate.atTime
public LocalDateTime atTime(int hour, int minute, int second) { """ Combines this date with a time to create a {@code LocalDateTime}. <p> This returns a {@code LocalDateTime} formed from this date at the specified hour, minute and second. The nanosecond field will be set to zero. The individual time fields must be within their valid range. All possible combinations of date and time are valid. @param hour the hour-of-day to use, from 0 to 23 @param minute the minute-of-hour to use, from 0 to 59 @param second the second-of-minute to represent, from 0 to 59 @return the local date-time formed from this date and the specified time, not null @throws DateTimeException if the value of any field is out of range """ return atTime(LocalTime.of(hour, minute, second)); }
java
public LocalDateTime atTime(int hour, int minute, int second) { return atTime(LocalTime.of(hour, minute, second)); }
[ "public", "LocalDateTime", "atTime", "(", "int", "hour", ",", "int", "minute", ",", "int", "second", ")", "{", "return", "atTime", "(", "LocalTime", ".", "of", "(", "hour", ",", "minute", ",", "second", ")", ")", ";", "}" ]
Combines this date with a time to create a {@code LocalDateTime}. <p> This returns a {@code LocalDateTime} formed from this date at the specified hour, minute and second. The nanosecond field will be set to zero. The individual time fields must be within their valid range. All possible combinations of date and time are valid. @param hour the hour-of-day to use, from 0 to 23 @param minute the minute-of-hour to use, from 0 to 59 @param second the second-of-minute to represent, from 0 to 59 @return the local date-time formed from this date and the specified time, not null @throws DateTimeException if the value of any field is out of range
[ "Combines", "this", "date", "with", "a", "time", "to", "create", "a", "{", "@code", "LocalDateTime", "}", ".", "<p", ">", "This", "returns", "a", "{", "@code", "LocalDateTime", "}", "formed", "from", "this", "date", "at", "the", "specified", "hour", "minute", "and", "second", ".", "The", "nanosecond", "field", "will", "be", "set", "to", "zero", ".", "The", "individual", "time", "fields", "must", "be", "within", "their", "valid", "range", ".", "All", "possible", "combinations", "of", "date", "and", "time", "are", "valid", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDate.java#L1736-L1738
geomajas/geomajas-project-geometry
core/src/main/java/org/geomajas/geometry/service/GeometryIndexService.java
GeometryIndexService.getGeometryType
public String getGeometryType(Geometry geometry, GeometryIndex index) throws GeometryIndexNotFoundException { """ What is the geometry type of the sub-geometry pointed to by the given index? If the index points to a vertex or edge, the geometry type at the parent level is returned. @param geometry The geometry wherein to search. @param index The index pointing to a vertex/edge/sub-geometry. In the case of a vertex/edge, the parent geometry type is returned. If index is null, the type of the given geometry is returned. @return The geometry type as defined in the {@link Geometry} class. @throws GeometryIndexNotFoundException Thrown in case the index points to a non-existing sub-geometry. """ if (index != null && index.getType() == GeometryIndexType.TYPE_GEOMETRY) { if (geometry.getGeometries() != null && geometry.getGeometries().length > index.getValue()) { return getGeometryType(geometry.getGeometries()[index.getValue()], index.getChild()); } else { throw new GeometryIndexNotFoundException("Can't find the geometry referred to in the given index."); } } return geometry.getGeometryType(); }
java
public String getGeometryType(Geometry geometry, GeometryIndex index) throws GeometryIndexNotFoundException { if (index != null && index.getType() == GeometryIndexType.TYPE_GEOMETRY) { if (geometry.getGeometries() != null && geometry.getGeometries().length > index.getValue()) { return getGeometryType(geometry.getGeometries()[index.getValue()], index.getChild()); } else { throw new GeometryIndexNotFoundException("Can't find the geometry referred to in the given index."); } } return geometry.getGeometryType(); }
[ "public", "String", "getGeometryType", "(", "Geometry", "geometry", ",", "GeometryIndex", "index", ")", "throws", "GeometryIndexNotFoundException", "{", "if", "(", "index", "!=", "null", "&&", "index", ".", "getType", "(", ")", "==", "GeometryIndexType", ".", "TYPE_GEOMETRY", ")", "{", "if", "(", "geometry", ".", "getGeometries", "(", ")", "!=", "null", "&&", "geometry", ".", "getGeometries", "(", ")", ".", "length", ">", "index", ".", "getValue", "(", ")", ")", "{", "return", "getGeometryType", "(", "geometry", ".", "getGeometries", "(", ")", "[", "index", ".", "getValue", "(", ")", "]", ",", "index", ".", "getChild", "(", ")", ")", ";", "}", "else", "{", "throw", "new", "GeometryIndexNotFoundException", "(", "\"Can't find the geometry referred to in the given index.\"", ")", ";", "}", "}", "return", "geometry", ".", "getGeometryType", "(", ")", ";", "}" ]
What is the geometry type of the sub-geometry pointed to by the given index? If the index points to a vertex or edge, the geometry type at the parent level is returned. @param geometry The geometry wherein to search. @param index The index pointing to a vertex/edge/sub-geometry. In the case of a vertex/edge, the parent geometry type is returned. If index is null, the type of the given geometry is returned. @return The geometry type as defined in the {@link Geometry} class. @throws GeometryIndexNotFoundException Thrown in case the index points to a non-existing sub-geometry.
[ "What", "is", "the", "geometry", "type", "of", "the", "sub", "-", "geometry", "pointed", "to", "by", "the", "given", "index?", "If", "the", "index", "points", "to", "a", "vertex", "or", "edge", "the", "geometry", "type", "at", "the", "parent", "level", "is", "returned", "." ]
train
https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryIndexService.java#L317-L326
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/Convolution1DUtils.java
Convolution1DUtils.getSameModeTopLeftPadding
public static int getSameModeTopLeftPadding(int outSize, int inSize, int kernel, int strides, int dilation) { """ Get top padding for same mode only. @param outSize Output size (length 2 array, height dimension first) @param inSize Input size (length 2 array, height dimension first) @param kernel Kernel size (length 2 array, height dimension first) @param strides Strides (length 2 array, height dimension first) @param dilation Dilation (length 2 array, height dimension first) @return Top left padding (length 2 array, height dimension first) """ int eKernel = effectiveKernelSize(kernel, dilation); //Note that padBottom is 1 bigger than this if bracketed term is not divisible by 2 int outPad = ((outSize - 1) * strides + eKernel - inSize) / 2; Preconditions.checkState(outPad >= 0, "Invalid padding values calculated: %s - " + "layer configuration is invalid? Input size %s, output size %s, kernel %s, " + "strides %s, dilation %s", outPad, inSize, outSize, kernel, strides, dilation); return outPad; }
java
public static int getSameModeTopLeftPadding(int outSize, int inSize, int kernel, int strides, int dilation) { int eKernel = effectiveKernelSize(kernel, dilation); //Note that padBottom is 1 bigger than this if bracketed term is not divisible by 2 int outPad = ((outSize - 1) * strides + eKernel - inSize) / 2; Preconditions.checkState(outPad >= 0, "Invalid padding values calculated: %s - " + "layer configuration is invalid? Input size %s, output size %s, kernel %s, " + "strides %s, dilation %s", outPad, inSize, outSize, kernel, strides, dilation); return outPad; }
[ "public", "static", "int", "getSameModeTopLeftPadding", "(", "int", "outSize", ",", "int", "inSize", ",", "int", "kernel", ",", "int", "strides", ",", "int", "dilation", ")", "{", "int", "eKernel", "=", "effectiveKernelSize", "(", "kernel", ",", "dilation", ")", ";", "//Note that padBottom is 1 bigger than this if bracketed term is not divisible by 2", "int", "outPad", "=", "(", "(", "outSize", "-", "1", ")", "*", "strides", "+", "eKernel", "-", "inSize", ")", "/", "2", ";", "Preconditions", ".", "checkState", "(", "outPad", ">=", "0", ",", "\"Invalid padding values calculated: %s - \"", "+", "\"layer configuration is invalid? Input size %s, output size %s, kernel %s, \"", "+", "\"strides %s, dilation %s\"", ",", "outPad", ",", "inSize", ",", "outSize", ",", "kernel", ",", "strides", ",", "dilation", ")", ";", "return", "outPad", ";", "}" ]
Get top padding for same mode only. @param outSize Output size (length 2 array, height dimension first) @param inSize Input size (length 2 array, height dimension first) @param kernel Kernel size (length 2 array, height dimension first) @param strides Strides (length 2 array, height dimension first) @param dilation Dilation (length 2 array, height dimension first) @return Top left padding (length 2 array, height dimension first)
[ "Get", "top", "padding", "for", "same", "mode", "only", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/Convolution1DUtils.java#L201-L209
google/closure-templates
java/src/com/google/template/soy/pysrc/internal/InternalPyExprUtils.java
InternalPyExprUtils.wrapAsSanitizedContent
static PyExpr wrapAsSanitizedContent(SanitizedContentKind contentKind, PyExpr pyExpr) { """ Wraps an expression with the proper SanitizedContent constructor. @param contentKind The kind of sanitized content. @param pyExpr The expression to wrap. """ String sanitizer = NodeContentKinds.toPySanitizedContentOrdainer(contentKind); String approval = "sanitize.IActuallyUnderstandSoyTypeSafetyAndHaveSecurityApproval(" + "'Internally created Sanitization.')"; return new PyExpr( sanitizer + "(" + pyExpr.getText() + ", approval=" + approval + ")", Integer.MAX_VALUE); }
java
static PyExpr wrapAsSanitizedContent(SanitizedContentKind contentKind, PyExpr pyExpr) { String sanitizer = NodeContentKinds.toPySanitizedContentOrdainer(contentKind); String approval = "sanitize.IActuallyUnderstandSoyTypeSafetyAndHaveSecurityApproval(" + "'Internally created Sanitization.')"; return new PyExpr( sanitizer + "(" + pyExpr.getText() + ", approval=" + approval + ")", Integer.MAX_VALUE); }
[ "static", "PyExpr", "wrapAsSanitizedContent", "(", "SanitizedContentKind", "contentKind", ",", "PyExpr", "pyExpr", ")", "{", "String", "sanitizer", "=", "NodeContentKinds", ".", "toPySanitizedContentOrdainer", "(", "contentKind", ")", ";", "String", "approval", "=", "\"sanitize.IActuallyUnderstandSoyTypeSafetyAndHaveSecurityApproval(\"", "+", "\"'Internally created Sanitization.')\"", ";", "return", "new", "PyExpr", "(", "sanitizer", "+", "\"(\"", "+", "pyExpr", ".", "getText", "(", ")", "+", "\", approval=\"", "+", "approval", "+", "\")\"", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Wraps an expression with the proper SanitizedContent constructor. @param contentKind The kind of sanitized content. @param pyExpr The expression to wrap.
[ "Wraps", "an", "expression", "with", "the", "proper", "SanitizedContent", "constructor", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/InternalPyExprUtils.java#L32-L39
google/closure-compiler
src/com/google/javascript/jscomp/graph/LinkedDirectedGraph.java
LinkedDirectedGraph.isConnectedInDirection
@Override public boolean isConnectedInDirection(N n1, E edgeValue, N n2) { """ DiGraphNode look ups can be expensive for a large graph operation, prefer the version below that takes DiGraphNodes, if you have them available. """ return isConnectedInDirection(n1, Predicates.equalTo(edgeValue), n2); }
java
@Override public boolean isConnectedInDirection(N n1, E edgeValue, N n2) { return isConnectedInDirection(n1, Predicates.equalTo(edgeValue), n2); }
[ "@", "Override", "public", "boolean", "isConnectedInDirection", "(", "N", "n1", ",", "E", "edgeValue", ",", "N", "n2", ")", "{", "return", "isConnectedInDirection", "(", "n1", ",", "Predicates", ".", "equalTo", "(", "edgeValue", ")", ",", "n2", ")", ";", "}" ]
DiGraphNode look ups can be expensive for a large graph operation, prefer the version below that takes DiGraphNodes, if you have them available.
[ "DiGraphNode", "look", "ups", "can", "be", "expensive", "for", "a", "large", "graph", "operation", "prefer", "the", "version", "below", "that", "takes", "DiGraphNodes", "if", "you", "have", "them", "available", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/LinkedDirectedGraph.java#L235-L238
jenkinsci/github-plugin
src/main/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriber.java
PingGHEventSubscriber.onEvent
@Override protected void onEvent(GHEvent event, String payload) { """ Logs repo on ping event @param event only PING event @param payload payload of gh-event. Never blank """ GHEventPayload.Ping ping; try { ping = GitHub.offline().parseEventPayload(new StringReader(payload), GHEventPayload.Ping.class); } catch (IOException e) { LOGGER.warn("Received malformed PingEvent: " + payload, e); return; } GHRepository repository = ping.getRepository(); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getHtmlUrl()); monitor.resolveProblem(GitHubRepositoryName.create(repository.getHtmlUrl().toExternalForm())); } else { GHOrganization organization = ping.getOrganization(); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getUrl()); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } }
java
@Override protected void onEvent(GHEvent event, String payload) { GHEventPayload.Ping ping; try { ping = GitHub.offline().parseEventPayload(new StringReader(payload), GHEventPayload.Ping.class); } catch (IOException e) { LOGGER.warn("Received malformed PingEvent: " + payload, e); return; } GHRepository repository = ping.getRepository(); if (repository != null) { LOGGER.info("{} webhook received from repo <{}>!", event, repository.getHtmlUrl()); monitor.resolveProblem(GitHubRepositoryName.create(repository.getHtmlUrl().toExternalForm())); } else { GHOrganization organization = ping.getOrganization(); if (organization != null) { LOGGER.info("{} webhook received from org <{}>!", event, organization.getUrl()); } else { LOGGER.warn("{} webhook received with unexpected payload", event); } } }
[ "@", "Override", "protected", "void", "onEvent", "(", "GHEvent", "event", ",", "String", "payload", ")", "{", "GHEventPayload", ".", "Ping", "ping", ";", "try", "{", "ping", "=", "GitHub", ".", "offline", "(", ")", ".", "parseEventPayload", "(", "new", "StringReader", "(", "payload", ")", ",", "GHEventPayload", ".", "Ping", ".", "class", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOGGER", ".", "warn", "(", "\"Received malformed PingEvent: \"", "+", "payload", ",", "e", ")", ";", "return", ";", "}", "GHRepository", "repository", "=", "ping", ".", "getRepository", "(", ")", ";", "if", "(", "repository", "!=", "null", ")", "{", "LOGGER", ".", "info", "(", "\"{} webhook received from repo <{}>!\"", ",", "event", ",", "repository", ".", "getHtmlUrl", "(", ")", ")", ";", "monitor", ".", "resolveProblem", "(", "GitHubRepositoryName", ".", "create", "(", "repository", ".", "getHtmlUrl", "(", ")", ".", "toExternalForm", "(", ")", ")", ")", ";", "}", "else", "{", "GHOrganization", "organization", "=", "ping", ".", "getOrganization", "(", ")", ";", "if", "(", "organization", "!=", "null", ")", "{", "LOGGER", ".", "info", "(", "\"{} webhook received from org <{}>!\"", ",", "event", ",", "organization", ".", "getUrl", "(", ")", ")", ";", "}", "else", "{", "LOGGER", ".", "warn", "(", "\"{} webhook received with unexpected payload\"", ",", "event", ")", ";", "}", "}", "}" ]
Logs repo on ping event @param event only PING event @param payload payload of gh-event. Never blank
[ "Logs", "repo", "on", "ping", "event" ]
train
https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/webhook/subscriber/PingGHEventSubscriber.java#L62-L83
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X500Name.java
X500Name.countQuotes
static int countQuotes(String string, int from, int to) { """ /* Counts double quotes in string. Escaped quotes are ignored. """ int count = 0; int escape = 0; for (int i = from; i < to; i++) { if (string.charAt(i) == '"' && escape % 2 == 0) { count++; } escape = (string.charAt(i) == '\\') ? escape + 1 : 0; } return count; }
java
static int countQuotes(String string, int from, int to) { int count = 0; int escape = 0; for (int i = from; i < to; i++) { if (string.charAt(i) == '"' && escape % 2 == 0) { count++; } escape = (string.charAt(i) == '\\') ? escape + 1 : 0; } return count; }
[ "static", "int", "countQuotes", "(", "String", "string", ",", "int", "from", ",", "int", "to", ")", "{", "int", "count", "=", "0", ";", "int", "escape", "=", "0", ";", "for", "(", "int", "i", "=", "from", ";", "i", "<", "to", ";", "i", "++", ")", "{", "if", "(", "string", ".", "charAt", "(", "i", ")", "==", "'", "'", "&&", "escape", "%", "2", "==", "0", ")", "{", "count", "++", ";", "}", "escape", "=", "(", "string", ".", "charAt", "(", "i", ")", "==", "'", "'", ")", "?", "escape", "+", "1", ":", "0", ";", "}", "return", "count", ";", "}" ]
/* Counts double quotes in string. Escaped quotes are ignored.
[ "/", "*", "Counts", "double", "quotes", "in", "string", ".", "Escaped", "quotes", "are", "ignored", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X500Name.java#L1024-L1036
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/TableRow.java
TableRow.appendXMLToTable
public void appendXMLToTable(final XMLUtil util, final Appendable appendable) throws IOException { """ Write the XML dataStyles for this object.<br> This is used while writing the ODS file. @param util a util for XML writing @param appendable where to write the XML @throws IOException If an I/O error occurs """ this.appendRowOpenTag(util, appendable); int nullFieldCounter = 0; final int size = this.cells.usedSize(); for (int c = 0; c < size; c++) { final TableCell cell = this.cells.get(c); if (this.hasNoValue(cell)) { nullFieldCounter++; continue; } this.appendRepeatedCell(util, appendable, nullFieldCounter); nullFieldCounter = 0; cell.appendXMLToTableRow(util, appendable); } appendable.append("</table:table-row>"); }
java
public void appendXMLToTable(final XMLUtil util, final Appendable appendable) throws IOException { this.appendRowOpenTag(util, appendable); int nullFieldCounter = 0; final int size = this.cells.usedSize(); for (int c = 0; c < size; c++) { final TableCell cell = this.cells.get(c); if (this.hasNoValue(cell)) { nullFieldCounter++; continue; } this.appendRepeatedCell(util, appendable, nullFieldCounter); nullFieldCounter = 0; cell.appendXMLToTableRow(util, appendable); } appendable.append("</table:table-row>"); }
[ "public", "void", "appendXMLToTable", "(", "final", "XMLUtil", "util", ",", "final", "Appendable", "appendable", ")", "throws", "IOException", "{", "this", ".", "appendRowOpenTag", "(", "util", ",", "appendable", ")", ";", "int", "nullFieldCounter", "=", "0", ";", "final", "int", "size", "=", "this", ".", "cells", ".", "usedSize", "(", ")", ";", "for", "(", "int", "c", "=", "0", ";", "c", "<", "size", ";", "c", "++", ")", "{", "final", "TableCell", "cell", "=", "this", ".", "cells", ".", "get", "(", "c", ")", ";", "if", "(", "this", ".", "hasNoValue", "(", "cell", ")", ")", "{", "nullFieldCounter", "++", ";", "continue", ";", "}", "this", ".", "appendRepeatedCell", "(", "util", ",", "appendable", ",", "nullFieldCounter", ")", ";", "nullFieldCounter", "=", "0", ";", "cell", ".", "appendXMLToTableRow", "(", "util", ",", "appendable", ")", ";", "}", "appendable", ".", "append", "(", "\"</table:table-row>\"", ")", ";", "}" ]
Write the XML dataStyles for this object.<br> This is used while writing the ODS file. @param util a util for XML writing @param appendable where to write the XML @throws IOException If an I/O error occurs
[ "Write", "the", "XML", "dataStyles", "for", "this", "object", ".", "<br", ">", "This", "is", "used", "while", "writing", "the", "ODS", "file", "." ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableRow.java#L113-L130
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.read
public static String read(FileChannel fileChannel, Charset charset) throws IORuntimeException { """ 从FileChannel中读取内容 @param fileChannel 文件管道 @param charset 字符集 @return 内容 @throws IORuntimeException IO异常 """ MappedByteBuffer buffer; try { buffer = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, fileChannel.size()).load(); } catch (IOException e) { throw new IORuntimeException(e); } return StrUtil.str(buffer, charset); }
java
public static String read(FileChannel fileChannel, Charset charset) throws IORuntimeException { MappedByteBuffer buffer; try { buffer = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0, fileChannel.size()).load(); } catch (IOException e) { throw new IORuntimeException(e); } return StrUtil.str(buffer, charset); }
[ "public", "static", "String", "read", "(", "FileChannel", "fileChannel", ",", "Charset", "charset", ")", "throws", "IORuntimeException", "{", "MappedByteBuffer", "buffer", ";", "try", "{", "buffer", "=", "fileChannel", ".", "map", "(", "FileChannel", ".", "MapMode", ".", "READ_ONLY", ",", "0", ",", "fileChannel", ".", "size", "(", ")", ")", ".", "load", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IORuntimeException", "(", "e", ")", ";", "}", "return", "StrUtil", ".", "str", "(", "buffer", ",", "charset", ")", ";", "}" ]
从FileChannel中读取内容 @param fileChannel 文件管道 @param charset 字符集 @return 内容 @throws IORuntimeException IO异常
[ "从FileChannel中读取内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L505-L513
flow/caustic
api/src/main/java/com/flowpowered/caustic/api/util/TextureAtlas.java
TextureAtlas.findUsableRegion
private RegionData findUsableRegion(int width, int height) { """ Attempts to find a usable region of this {@link TextureAtlas} @param width Width of the region @param height Height of the region @return The data for a valid region, null if none found. """ final int imageWidth = image.getWidth(); final int imageHeight = image.getHeight(); for (int y = 0; y < imageHeight - height; y++) { for (int x = 0; x < imageWidth - width; x++) { final RegionData data = new RegionData(x, y, width, height); if (!intersectsOtherTexture(data)) { return data; } } } return null; }
java
private RegionData findUsableRegion(int width, int height) { final int imageWidth = image.getWidth(); final int imageHeight = image.getHeight(); for (int y = 0; y < imageHeight - height; y++) { for (int x = 0; x < imageWidth - width; x++) { final RegionData data = new RegionData(x, y, width, height); if (!intersectsOtherTexture(data)) { return data; } } } return null; }
[ "private", "RegionData", "findUsableRegion", "(", "int", "width", ",", "int", "height", ")", "{", "final", "int", "imageWidth", "=", "image", ".", "getWidth", "(", ")", ";", "final", "int", "imageHeight", "=", "image", ".", "getHeight", "(", ")", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "imageHeight", "-", "height", ";", "y", "++", ")", "{", "for", "(", "int", "x", "=", "0", ";", "x", "<", "imageWidth", "-", "width", ";", "x", "++", ")", "{", "final", "RegionData", "data", "=", "new", "RegionData", "(", "x", ",", "y", ",", "width", ",", "height", ")", ";", "if", "(", "!", "intersectsOtherTexture", "(", "data", ")", ")", "{", "return", "data", ";", "}", "}", "}", "return", "null", ";", "}" ]
Attempts to find a usable region of this {@link TextureAtlas} @param width Width of the region @param height Height of the region @return The data for a valid region, null if none found.
[ "Attempts", "to", "find", "a", "usable", "region", "of", "this", "{", "@link", "TextureAtlas", "}" ]
train
https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/TextureAtlas.java#L108-L120
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Cipher.java
Cipher.update
public final int update(ByteBuffer input, ByteBuffer output) throws ShortBufferException { """ Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part. <p>All <code>input.remaining()</code> bytes starting at <code>input.position()</code> are processed. The result is stored in the output buffer. Upon return, the input buffer's position will be equal to its limit; its limit will not have changed. The output buffer's position will have advanced by n, where n is the value returned by this method; the output buffer's limit will not have changed. <p>If <code>output.remaining()</code> bytes are insufficient to hold the result, a <code>ShortBufferException</code> is thrown. In this case, repeat this call with a larger output buffer. Use {@link #getOutputSize(int) getOutputSize} to determine how big the output buffer should be. <p>Note: this method should be copy-safe, which means the <code>input</code> and <code>output</code> buffers can reference the same block of memory and no unprocessed input data is overwritten when the result is copied into the output buffer. @param input the input ByteBuffer @param output the output ByteByffer @return the number of bytes stored in <code>output</code> @exception IllegalStateException if this cipher is in a wrong state (e.g., has not been initialized) @exception IllegalArgumentException if input and output are the same object @exception ReadOnlyBufferException if the output buffer is read-only @exception ShortBufferException if there is insufficient space in the output buffer @since 1.5 """ checkCipherState(); if ((input == null) || (output == null)) { throw new IllegalArgumentException("Buffers must not be null"); } if (input == output) { throw new IllegalArgumentException("Input and output buffers must " + "not be the same object, consider using buffer.duplicate()"); } if (output.isReadOnly()) { throw new ReadOnlyBufferException(); } updateProviderIfNeeded(); return spi.engineUpdate(input, output); }
java
public final int update(ByteBuffer input, ByteBuffer output) throws ShortBufferException { checkCipherState(); if ((input == null) || (output == null)) { throw new IllegalArgumentException("Buffers must not be null"); } if (input == output) { throw new IllegalArgumentException("Input and output buffers must " + "not be the same object, consider using buffer.duplicate()"); } if (output.isReadOnly()) { throw new ReadOnlyBufferException(); } updateProviderIfNeeded(); return spi.engineUpdate(input, output); }
[ "public", "final", "int", "update", "(", "ByteBuffer", "input", ",", "ByteBuffer", "output", ")", "throws", "ShortBufferException", "{", "checkCipherState", "(", ")", ";", "if", "(", "(", "input", "==", "null", ")", "||", "(", "output", "==", "null", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Buffers must not be null\"", ")", ";", "}", "if", "(", "input", "==", "output", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Input and output buffers must \"", "+", "\"not be the same object, consider using buffer.duplicate()\"", ")", ";", "}", "if", "(", "output", ".", "isReadOnly", "(", ")", ")", "{", "throw", "new", "ReadOnlyBufferException", "(", ")", ";", "}", "updateProviderIfNeeded", "(", ")", ";", "return", "spi", ".", "engineUpdate", "(", "input", ",", "output", ")", ";", "}" ]
Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part. <p>All <code>input.remaining()</code> bytes starting at <code>input.position()</code> are processed. The result is stored in the output buffer. Upon return, the input buffer's position will be equal to its limit; its limit will not have changed. The output buffer's position will have advanced by n, where n is the value returned by this method; the output buffer's limit will not have changed. <p>If <code>output.remaining()</code> bytes are insufficient to hold the result, a <code>ShortBufferException</code> is thrown. In this case, repeat this call with a larger output buffer. Use {@link #getOutputSize(int) getOutputSize} to determine how big the output buffer should be. <p>Note: this method should be copy-safe, which means the <code>input</code> and <code>output</code> buffers can reference the same block of memory and no unprocessed input data is overwritten when the result is copied into the output buffer. @param input the input ByteBuffer @param output the output ByteByffer @return the number of bytes stored in <code>output</code> @exception IllegalStateException if this cipher is in a wrong state (e.g., has not been initialized) @exception IllegalArgumentException if input and output are the same object @exception ReadOnlyBufferException if the output buffer is read-only @exception ShortBufferException if there is insufficient space in the output buffer @since 1.5
[ "Continues", "a", "multiple", "-", "part", "encryption", "or", "decryption", "operation", "(", "depending", "on", "how", "this", "cipher", "was", "initialized", ")", "processing", "another", "data", "part", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Cipher.java#L1885-L1902
czyzby/gdx-lml
kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/GdxUtilities.java
GdxUtilities.clearScreen
public static void clearScreen(final float r, final float g, final float b) { """ Clears the screen with the selected color. @param r red color value. @param g green color value. @param b blue color value. """ Gdx.gl.glClearColor(r, g, b, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); }
java
public static void clearScreen(final float r, final float g, final float b) { Gdx.gl.glClearColor(r, g, b, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); }
[ "public", "static", "void", "clearScreen", "(", "final", "float", "r", ",", "final", "float", "g", ",", "final", "float", "b", ")", "{", "Gdx", ".", "gl", ".", "glClearColor", "(", "r", ",", "g", ",", "b", ",", "1f", ")", ";", "Gdx", ".", "gl", ".", "glClear", "(", "GL20", ".", "GL_COLOR_BUFFER_BIT", ")", ";", "}" ]
Clears the screen with the selected color. @param r red color value. @param g green color value. @param b blue color value.
[ "Clears", "the", "screen", "with", "the", "selected", "color", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/GdxUtilities.java#L32-L35
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/accumulators/AccumulatorHelper.java
AccumulatorHelper.mergeInto
public static void mergeInto(Map<String, OptionalFailure<Accumulator<?, ?>>> target, Map<String, Accumulator<?, ?>> toMerge) { """ Merge two collections of accumulators. The second will be merged into the first. @param target The collection of accumulators that will be updated @param toMerge The collection of accumulators that will be merged into the other """ for (Map.Entry<String, Accumulator<?, ?>> otherEntry : toMerge.entrySet()) { OptionalFailure<Accumulator<?, ?>> ownAccumulator = target.get(otherEntry.getKey()); if (ownAccumulator == null) { // Create initial counter (copy!) target.put( otherEntry.getKey(), wrapUnchecked(otherEntry.getKey(), () -> otherEntry.getValue().clone())); } else if (ownAccumulator.isFailure()) { continue; } else { Accumulator<?, ?> accumulator = ownAccumulator.getUnchecked(); // Both should have the same type compareAccumulatorTypes(otherEntry.getKey(), accumulator.getClass(), otherEntry.getValue().getClass()); // Merge target counter with other counter target.put( otherEntry.getKey(), wrapUnchecked(otherEntry.getKey(), () -> mergeSingle(accumulator, otherEntry.getValue().clone()))); } } }
java
public static void mergeInto(Map<String, OptionalFailure<Accumulator<?, ?>>> target, Map<String, Accumulator<?, ?>> toMerge) { for (Map.Entry<String, Accumulator<?, ?>> otherEntry : toMerge.entrySet()) { OptionalFailure<Accumulator<?, ?>> ownAccumulator = target.get(otherEntry.getKey()); if (ownAccumulator == null) { // Create initial counter (copy!) target.put( otherEntry.getKey(), wrapUnchecked(otherEntry.getKey(), () -> otherEntry.getValue().clone())); } else if (ownAccumulator.isFailure()) { continue; } else { Accumulator<?, ?> accumulator = ownAccumulator.getUnchecked(); // Both should have the same type compareAccumulatorTypes(otherEntry.getKey(), accumulator.getClass(), otherEntry.getValue().getClass()); // Merge target counter with other counter target.put( otherEntry.getKey(), wrapUnchecked(otherEntry.getKey(), () -> mergeSingle(accumulator, otherEntry.getValue().clone()))); } } }
[ "public", "static", "void", "mergeInto", "(", "Map", "<", "String", ",", "OptionalFailure", "<", "Accumulator", "<", "?", ",", "?", ">", ">", ">", "target", ",", "Map", "<", "String", ",", "Accumulator", "<", "?", ",", "?", ">", ">", "toMerge", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Accumulator", "<", "?", ",", "?", ">", ">", "otherEntry", ":", "toMerge", ".", "entrySet", "(", ")", ")", "{", "OptionalFailure", "<", "Accumulator", "<", "?", ",", "?", ">", ">", "ownAccumulator", "=", "target", ".", "get", "(", "otherEntry", ".", "getKey", "(", ")", ")", ";", "if", "(", "ownAccumulator", "==", "null", ")", "{", "// Create initial counter (copy!)", "target", ".", "put", "(", "otherEntry", ".", "getKey", "(", ")", ",", "wrapUnchecked", "(", "otherEntry", ".", "getKey", "(", ")", ",", "(", ")", "->", "otherEntry", ".", "getValue", "(", ")", ".", "clone", "(", ")", ")", ")", ";", "}", "else", "if", "(", "ownAccumulator", ".", "isFailure", "(", ")", ")", "{", "continue", ";", "}", "else", "{", "Accumulator", "<", "?", ",", "?", ">", "accumulator", "=", "ownAccumulator", ".", "getUnchecked", "(", ")", ";", "// Both should have the same type", "compareAccumulatorTypes", "(", "otherEntry", ".", "getKey", "(", ")", ",", "accumulator", ".", "getClass", "(", ")", ",", "otherEntry", ".", "getValue", "(", ")", ".", "getClass", "(", ")", ")", ";", "// Merge target counter with other counter", "target", ".", "put", "(", "otherEntry", ".", "getKey", "(", ")", ",", "wrapUnchecked", "(", "otherEntry", ".", "getKey", "(", ")", ",", "(", ")", "->", "mergeSingle", "(", "accumulator", ",", "otherEntry", ".", "getValue", "(", ")", ".", "clone", "(", ")", ")", ")", ")", ";", "}", "}", "}" ]
Merge two collections of accumulators. The second will be merged into the first. @param target The collection of accumulators that will be updated @param toMerge The collection of accumulators that will be merged into the other
[ "Merge", "two", "collections", "of", "accumulators", ".", "The", "second", "will", "be", "merged", "into", "the", "first", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/accumulators/AccumulatorHelper.java#L54-L78
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.convertClassName
public static String convertClassName(String className, String stringToInsert) { """ Convert this class name by inserting this package after the domain. ie., com.xyz.abc.ClassName -> com.xyz.newpackage.abc.ClassName. @param className @param stringToInsert @return Converted string """ return Util.convertClassName(className, stringToInsert, 2); }
java
public static String convertClassName(String className, String stringToInsert) { return Util.convertClassName(className, stringToInsert, 2); }
[ "public", "static", "String", "convertClassName", "(", "String", "className", ",", "String", "stringToInsert", ")", "{", "return", "Util", ".", "convertClassName", "(", "className", ",", "stringToInsert", ",", "2", ")", ";", "}" ]
Convert this class name by inserting this package after the domain. ie., com.xyz.abc.ClassName -> com.xyz.newpackage.abc.ClassName. @param className @param stringToInsert @return Converted string
[ "Convert", "this", "class", "name", "by", "inserting", "this", "package", "after", "the", "domain", ".", "ie", ".", "com", ".", "xyz", ".", "abc", ".", "ClassName", "-", ">", "com", ".", "xyz", ".", "newpackage", ".", "abc", ".", "ClassName", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L457-L460
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.toSpreadMap
public static SpreadMap toSpreadMap(List self) { """ Creates a spreadable map from this list. <p> @param self a list @return a newly created SpreadMap @see groovy.lang.SpreadMap#SpreadMap(java.util.List) @see #toSpreadMap(java.util.Map) @since 1.8.0 """ if (self == null) throw new GroovyRuntimeException("Fail to convert List to SpreadMap, because it is null."); else if (self.size() % 2 != 0) throw new GroovyRuntimeException("Fail to convert List to SpreadMap, because it's size is not even."); else return new SpreadMap(self); }
java
public static SpreadMap toSpreadMap(List self) { if (self == null) throw new GroovyRuntimeException("Fail to convert List to SpreadMap, because it is null."); else if (self.size() % 2 != 0) throw new GroovyRuntimeException("Fail to convert List to SpreadMap, because it's size is not even."); else return new SpreadMap(self); }
[ "public", "static", "SpreadMap", "toSpreadMap", "(", "List", "self", ")", "{", "if", "(", "self", "==", "null", ")", "throw", "new", "GroovyRuntimeException", "(", "\"Fail to convert List to SpreadMap, because it is null.\"", ")", ";", "else", "if", "(", "self", ".", "size", "(", ")", "%", "2", "!=", "0", ")", "throw", "new", "GroovyRuntimeException", "(", "\"Fail to convert List to SpreadMap, because it's size is not even.\"", ")", ";", "else", "return", "new", "SpreadMap", "(", "self", ")", ";", "}" ]
Creates a spreadable map from this list. <p> @param self a list @return a newly created SpreadMap @see groovy.lang.SpreadMap#SpreadMap(java.util.List) @see #toSpreadMap(java.util.Map) @since 1.8.0
[ "Creates", "a", "spreadable", "map", "from", "this", "list", ".", "<p", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8559-L8566
apache/flink
flink-optimizer/src/main/java/org/apache/flink/optimizer/plan/SingleInputPlanNode.java
SingleInputPlanNode.setDriverKeyInfo
public void setDriverKeyInfo(FieldList keys, boolean[] sortOrder, int id) { """ Sets the key field information for the specified driver comparator. @param keys The key field indexes for the specified driver comparator. @param sortOrder The key sort order for the specified driver comparator. @param id The ID of the driver comparator. """ if(id < 0 || id >= driverKeys.length) { throw new CompilerException("Invalid id for driver key information. DriverStrategy requires only " +super.getDriverStrategy().getNumRequiredComparators()+" comparators."); } this.driverKeys[id] = keys; this.driverSortOrders[id] = sortOrder; }
java
public void setDriverKeyInfo(FieldList keys, boolean[] sortOrder, int id) { if(id < 0 || id >= driverKeys.length) { throw new CompilerException("Invalid id for driver key information. DriverStrategy requires only " +super.getDriverStrategy().getNumRequiredComparators()+" comparators."); } this.driverKeys[id] = keys; this.driverSortOrders[id] = sortOrder; }
[ "public", "void", "setDriverKeyInfo", "(", "FieldList", "keys", ",", "boolean", "[", "]", "sortOrder", ",", "int", "id", ")", "{", "if", "(", "id", "<", "0", "||", "id", ">=", "driverKeys", ".", "length", ")", "{", "throw", "new", "CompilerException", "(", "\"Invalid id for driver key information. DriverStrategy requires only \"", "+", "super", ".", "getDriverStrategy", "(", ")", ".", "getNumRequiredComparators", "(", ")", "+", "\" comparators.\"", ")", ";", "}", "this", ".", "driverKeys", "[", "id", "]", "=", "keys", ";", "this", ".", "driverSortOrders", "[", "id", "]", "=", "sortOrder", ";", "}" ]
Sets the key field information for the specified driver comparator. @param keys The key field indexes for the specified driver comparator. @param sortOrder The key sort order for the specified driver comparator. @param id The ID of the driver comparator.
[ "Sets", "the", "key", "field", "information", "for", "the", "specified", "driver", "comparator", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/plan/SingleInputPlanNode.java#L143-L150
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYAreaChartBuilder.java
DJXYAreaChartBuilder.addSerie
public DJXYAreaChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) { """ Adds the specified serie column to the dataset with custom label. @param column the serie column """ getDataset().addSerie(column, labelExpression); return this; }
java
public DJXYAreaChartBuilder addSerie(AbstractColumn column, StringExpression labelExpression) { getDataset().addSerie(column, labelExpression); return this; }
[ "public", "DJXYAreaChartBuilder", "addSerie", "(", "AbstractColumn", "column", ",", "StringExpression", "labelExpression", ")", "{", "getDataset", "(", ")", ".", "addSerie", "(", "column", ",", "labelExpression", ")", ";", "return", "this", ";", "}" ]
Adds the specified serie column to the dataset with custom label. @param column the serie column
[ "Adds", "the", "specified", "serie", "column", "to", "the", "dataset", "with", "custom", "label", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYAreaChartBuilder.java#L384-L387
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java
DataFrameJoiner.leftOuter
public Table leftOuter(Table table2, String[] col2Names) { """ Joins the joiner to the table2, using the given columns for the second table and returns the resulting table @param table2 The table to join with @param col2Names The columns to join on. If a name refers to a double column, the join is performed after rounding to integers. @return The resulting table """ return leftOuter(table2, false, col2Names); }
java
public Table leftOuter(Table table2, String[] col2Names) { return leftOuter(table2, false, col2Names); }
[ "public", "Table", "leftOuter", "(", "Table", "table2", ",", "String", "[", "]", "col2Names", ")", "{", "return", "leftOuter", "(", "table2", ",", "false", ",", "col2Names", ")", ";", "}" ]
Joins the joiner to the table2, using the given columns for the second table and returns the resulting table @param table2 The table to join with @param col2Names The columns to join on. If a name refers to a double column, the join is performed after rounding to integers. @return The resulting table
[ "Joins", "the", "joiner", "to", "the", "table2", "using", "the", "given", "columns", "for", "the", "second", "table", "and", "returns", "the", "resulting", "table" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L514-L516
apache/groovy
subprojects/groovy-xml/src/main/java/groovy/xml/NamespaceBuilderSupport.java
NamespaceBuilderSupport.invokeMethod
@Override public Object invokeMethod(String methodName, Object args) { """ Allow automatic detection of namespace declared in the attributes """ // detect namespace declared on the added node like xmlns:foo="http:/foo" Map attributes = findAttributes(args); for (Iterator<Map.Entry> iter = attributes.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = iter.next(); String key = String.valueOf(entry.getKey()); if (key.startsWith("xmlns:")) { String prefix = key.substring(6); String uri = String.valueOf(entry.getValue()); namespace(uri, prefix); iter.remove(); } } return super.invokeMethod(methodName, args); }
java
@Override public Object invokeMethod(String methodName, Object args) { // detect namespace declared on the added node like xmlns:foo="http:/foo" Map attributes = findAttributes(args); for (Iterator<Map.Entry> iter = attributes.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = iter.next(); String key = String.valueOf(entry.getKey()); if (key.startsWith("xmlns:")) { String prefix = key.substring(6); String uri = String.valueOf(entry.getValue()); namespace(uri, prefix); iter.remove(); } } return super.invokeMethod(methodName, args); }
[ "@", "Override", "public", "Object", "invokeMethod", "(", "String", "methodName", ",", "Object", "args", ")", "{", "// detect namespace declared on the added node like xmlns:foo=\"http:/foo\"", "Map", "attributes", "=", "findAttributes", "(", "args", ")", ";", "for", "(", "Iterator", "<", "Map", ".", "Entry", ">", "iter", "=", "attributes", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "iter", ".", "hasNext", "(", ")", ";", ")", "{", "Map", ".", "Entry", "entry", "=", "iter", ".", "next", "(", ")", ";", "String", "key", "=", "String", ".", "valueOf", "(", "entry", ".", "getKey", "(", ")", ")", ";", "if", "(", "key", ".", "startsWith", "(", "\"xmlns:\"", ")", ")", "{", "String", "prefix", "=", "key", ".", "substring", "(", "6", ")", ";", "String", "uri", "=", "String", ".", "valueOf", "(", "entry", ".", "getValue", "(", ")", ")", ";", "namespace", "(", "uri", ",", "prefix", ")", ";", "iter", ".", "remove", "(", ")", ";", "}", "}", "return", "super", ".", "invokeMethod", "(", "methodName", ",", "args", ")", ";", "}" ]
Allow automatic detection of namespace declared in the attributes
[ "Allow", "automatic", "detection", "of", "namespace", "declared", "in", "the", "attributes" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/xml/NamespaceBuilderSupport.java#L119-L135
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/util/VelocityParser.java
VelocityParser.isVarEscaped
private boolean isVarEscaped(char[] array, int currentIndex) { """ Look in previous characters of the array to find if the current var is escaped (like \$var). @param array the source to parse @param currentIndex the current index in the <code>array</code> @return the parser context to put some informations """ int i = currentIndex - 1; while (i >= 0 && array[i] == '\\') { --i; } return (currentIndex - i) % 2 == 0; }
java
private boolean isVarEscaped(char[] array, int currentIndex) { int i = currentIndex - 1; while (i >= 0 && array[i] == '\\') { --i; } return (currentIndex - i) % 2 == 0; }
[ "private", "boolean", "isVarEscaped", "(", "char", "[", "]", "array", ",", "int", "currentIndex", ")", "{", "int", "i", "=", "currentIndex", "-", "1", ";", "while", "(", "i", ">=", "0", "&&", "array", "[", "i", "]", "==", "'", "'", ")", "{", "--", "i", ";", "}", "return", "(", "currentIndex", "-", "i", ")", "%", "2", "==", "0", ";", "}" ]
Look in previous characters of the array to find if the current var is escaped (like \$var). @param array the source to parse @param currentIndex the current index in the <code>array</code> @return the parser context to put some informations
[ "Look", "in", "previous", "characters", "of", "the", "array", "to", "find", "if", "the", "current", "var", "is", "escaped", "(", "like", "\\", "$var", ")", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/util/VelocityParser.java#L426-L435
jbundle/jbundle
base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java
TrxMessageHeader.init
public void init(String strQueueName, String strQueueType, Object source, Map<String,Object> properties) { """ Constructor. @param strQueueName Name of the queue. @param strQueueType Type of queue - remote or local. @param source usually the object sending or listening for the message, to reduce echos. """ m_mapMessageHeader = properties; m_mapMessageTransport = null; m_mapMessageInfo = null; super.init(strQueueName, MessageConstants.INTERNET_QUEUE, source, properties); }
java
public void init(String strQueueName, String strQueueType, Object source, Map<String,Object> properties) { m_mapMessageHeader = properties; m_mapMessageTransport = null; m_mapMessageInfo = null; super.init(strQueueName, MessageConstants.INTERNET_QUEUE, source, properties); }
[ "public", "void", "init", "(", "String", "strQueueName", ",", "String", "strQueueType", ",", "Object", "source", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "m_mapMessageHeader", "=", "properties", ";", "m_mapMessageTransport", "=", "null", ";", "m_mapMessageInfo", "=", "null", ";", "super", ".", "init", "(", "strQueueName", ",", "MessageConstants", ".", "INTERNET_QUEUE", ",", "source", ",", "properties", ")", ";", "}" ]
Constructor. @param strQueueName Name of the queue. @param strQueueType Type of queue - remote or local. @param source usually the object sending or listening for the message, to reduce echos.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java#L233-L239
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/document/impl/DotPatternMapHelpers.java
DotPatternMapHelpers.flatten
public static String flatten(String left, String right) { """ Links the two field names into a single left.right field name. If the left field is empty, right is returned @param left one field name @param right the other field name @return left.right or right if left is an empty string """ return left == null || left.isEmpty() ? right : left + "." + right; }
java
public static String flatten(String left, String right) { return left == null || left.isEmpty() ? right : left + "." + right; }
[ "public", "static", "String", "flatten", "(", "String", "left", ",", "String", "right", ")", "{", "return", "left", "==", "null", "||", "left", ".", "isEmpty", "(", ")", "?", "right", ":", "left", "+", "\".\"", "+", "right", ";", "}" ]
Links the two field names into a single left.right field name. If the left field is empty, right is returned @param left one field name @param right the other field name @return left.right or right if left is an empty string
[ "Links", "the", "two", "field", "names", "into", "a", "single", "left", ".", "right", "field", "name", ".", "If", "the", "left", "field", "is", "empty", "right", "is", "returned" ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/document/impl/DotPatternMapHelpers.java#L100-L102
finmath/finmath-lib
src/main/java/net/finmath/functions/LinearAlgebra.java
LinearAlgebra.factorReductionUsingCommonsMath
public static double[][] factorReductionUsingCommonsMath(double[][] correlationMatrix, int numberOfFactors) { """ Returns a correlation matrix which has rank &lt; n and for which the first n factors agree with the factors of correlationMatrix. @param correlationMatrix The given correlation matrix. @param numberOfFactors The requested number of factors (Eigenvectors). @return Factor reduced correlation matrix. """ // Extract factors corresponding to the largest eigenvalues double[][] factorMatrix = getFactorMatrix(correlationMatrix, numberOfFactors); // Renormalize rows for (int row = 0; row < correlationMatrix.length; row++) { double sumSquared = 0; for (int factor = 0; factor < numberOfFactors; factor++) { sumSquared += factorMatrix[row][factor] * factorMatrix[row][factor]; } if(sumSquared != 0) { for (int factor = 0; factor < numberOfFactors; factor++) { factorMatrix[row][factor] = factorMatrix[row][factor] / Math.sqrt(sumSquared); } } else { // This is a rare case: The factor reduction of a completely decorrelated system to 1 factor for (int factor = 0; factor < numberOfFactors; factor++) { factorMatrix[row][factor] = 1.0; } } } // Orthogonalized again double[][] reducedCorrelationMatrix = (new Array2DRowRealMatrix(factorMatrix).multiply(new Array2DRowRealMatrix(factorMatrix).transpose())).getData(); return getFactorMatrix(reducedCorrelationMatrix, numberOfFactors); }
java
public static double[][] factorReductionUsingCommonsMath(double[][] correlationMatrix, int numberOfFactors) { // Extract factors corresponding to the largest eigenvalues double[][] factorMatrix = getFactorMatrix(correlationMatrix, numberOfFactors); // Renormalize rows for (int row = 0; row < correlationMatrix.length; row++) { double sumSquared = 0; for (int factor = 0; factor < numberOfFactors; factor++) { sumSquared += factorMatrix[row][factor] * factorMatrix[row][factor]; } if(sumSquared != 0) { for (int factor = 0; factor < numberOfFactors; factor++) { factorMatrix[row][factor] = factorMatrix[row][factor] / Math.sqrt(sumSquared); } } else { // This is a rare case: The factor reduction of a completely decorrelated system to 1 factor for (int factor = 0; factor < numberOfFactors; factor++) { factorMatrix[row][factor] = 1.0; } } } // Orthogonalized again double[][] reducedCorrelationMatrix = (new Array2DRowRealMatrix(factorMatrix).multiply(new Array2DRowRealMatrix(factorMatrix).transpose())).getData(); return getFactorMatrix(reducedCorrelationMatrix, numberOfFactors); }
[ "public", "static", "double", "[", "]", "[", "]", "factorReductionUsingCommonsMath", "(", "double", "[", "]", "[", "]", "correlationMatrix", ",", "int", "numberOfFactors", ")", "{", "// Extract factors corresponding to the largest eigenvalues", "double", "[", "]", "[", "]", "factorMatrix", "=", "getFactorMatrix", "(", "correlationMatrix", ",", "numberOfFactors", ")", ";", "// Renormalize rows", "for", "(", "int", "row", "=", "0", ";", "row", "<", "correlationMatrix", ".", "length", ";", "row", "++", ")", "{", "double", "sumSquared", "=", "0", ";", "for", "(", "int", "factor", "=", "0", ";", "factor", "<", "numberOfFactors", ";", "factor", "++", ")", "{", "sumSquared", "+=", "factorMatrix", "[", "row", "]", "[", "factor", "]", "*", "factorMatrix", "[", "row", "]", "[", "factor", "]", ";", "}", "if", "(", "sumSquared", "!=", "0", ")", "{", "for", "(", "int", "factor", "=", "0", ";", "factor", "<", "numberOfFactors", ";", "factor", "++", ")", "{", "factorMatrix", "[", "row", "]", "[", "factor", "]", "=", "factorMatrix", "[", "row", "]", "[", "factor", "]", "/", "Math", ".", "sqrt", "(", "sumSquared", ")", ";", "}", "}", "else", "{", "// This is a rare case: The factor reduction of a completely decorrelated system to 1 factor", "for", "(", "int", "factor", "=", "0", ";", "factor", "<", "numberOfFactors", ";", "factor", "++", ")", "{", "factorMatrix", "[", "row", "]", "[", "factor", "]", "=", "1.0", ";", "}", "}", "}", "// Orthogonalized again", "double", "[", "]", "[", "]", "reducedCorrelationMatrix", "=", "(", "new", "Array2DRowRealMatrix", "(", "factorMatrix", ")", ".", "multiply", "(", "new", "Array2DRowRealMatrix", "(", "factorMatrix", ")", ".", "transpose", "(", ")", ")", ")", ".", "getData", "(", ")", ";", "return", "getFactorMatrix", "(", "reducedCorrelationMatrix", ",", "numberOfFactors", ")", ";", "}" ]
Returns a correlation matrix which has rank &lt; n and for which the first n factors agree with the factors of correlationMatrix. @param correlationMatrix The given correlation matrix. @param numberOfFactors The requested number of factors (Eigenvectors). @return Factor reduced correlation matrix.
[ "Returns", "a", "correlation", "matrix", "which", "has", "rank", "&lt", ";", "n", "and", "for", "which", "the", "first", "n", "factors", "agree", "with", "the", "factors", "of", "correlationMatrix", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/functions/LinearAlgebra.java#L438-L466
google/closure-compiler
src/com/google/javascript/jscomp/DestructuringGlobalNameExtractor.java
DestructuringGlobalNameExtractor.makeNewRvalueForDestructuringKey
private static Node makeNewRvalueForDestructuringKey( Node stringKey, Node rvalue, Set<AstChange> newNodes, Ref ref) { """ Makes a default value expression from the rvalue, or otherwise just returns it <p>e.g. for `const {x = defaultValue} = y;`, and the new rvalue `rvalue`, returns `void 0 === rvalue ? defaultValue : rvalue` """ if (stringKey.getOnlyChild().isDefaultValue()) { Node defaultValue = stringKey.getFirstChild().getSecondChild().detach(); // Assume `rvalue` has no side effects since it's a qname, and we can create multiple // references to it. This ignores getters/setters. Node rvalueForSheq = rvalue.cloneTree(); if (newNodes != null) { newNodes.add(new AstChange(ref.module, ref.scope, rvalueForSheq)); } // `void 0 === rvalue ? defaultValue : rvalue` rvalue = IR.hook(IR.sheq(NodeUtil.newUndefinedNode(rvalue), rvalueForSheq), defaultValue, rvalue) .srcrefTree(defaultValue); } return rvalue; }
java
private static Node makeNewRvalueForDestructuringKey( Node stringKey, Node rvalue, Set<AstChange> newNodes, Ref ref) { if (stringKey.getOnlyChild().isDefaultValue()) { Node defaultValue = stringKey.getFirstChild().getSecondChild().detach(); // Assume `rvalue` has no side effects since it's a qname, and we can create multiple // references to it. This ignores getters/setters. Node rvalueForSheq = rvalue.cloneTree(); if (newNodes != null) { newNodes.add(new AstChange(ref.module, ref.scope, rvalueForSheq)); } // `void 0 === rvalue ? defaultValue : rvalue` rvalue = IR.hook(IR.sheq(NodeUtil.newUndefinedNode(rvalue), rvalueForSheq), defaultValue, rvalue) .srcrefTree(defaultValue); } return rvalue; }
[ "private", "static", "Node", "makeNewRvalueForDestructuringKey", "(", "Node", "stringKey", ",", "Node", "rvalue", ",", "Set", "<", "AstChange", ">", "newNodes", ",", "Ref", "ref", ")", "{", "if", "(", "stringKey", ".", "getOnlyChild", "(", ")", ".", "isDefaultValue", "(", ")", ")", "{", "Node", "defaultValue", "=", "stringKey", ".", "getFirstChild", "(", ")", ".", "getSecondChild", "(", ")", ".", "detach", "(", ")", ";", "// Assume `rvalue` has no side effects since it's a qname, and we can create multiple", "// references to it. This ignores getters/setters.", "Node", "rvalueForSheq", "=", "rvalue", ".", "cloneTree", "(", ")", ";", "if", "(", "newNodes", "!=", "null", ")", "{", "newNodes", ".", "add", "(", "new", "AstChange", "(", "ref", ".", "module", ",", "ref", ".", "scope", ",", "rvalueForSheq", ")", ")", ";", "}", "// `void 0 === rvalue ? defaultValue : rvalue`", "rvalue", "=", "IR", ".", "hook", "(", "IR", ".", "sheq", "(", "NodeUtil", ".", "newUndefinedNode", "(", "rvalue", ")", ",", "rvalueForSheq", ")", ",", "defaultValue", ",", "rvalue", ")", ".", "srcrefTree", "(", "defaultValue", ")", ";", "}", "return", "rvalue", ";", "}" ]
Makes a default value expression from the rvalue, or otherwise just returns it <p>e.g. for `const {x = defaultValue} = y;`, and the new rvalue `rvalue`, returns `void 0 === rvalue ? defaultValue : rvalue`
[ "Makes", "a", "default", "value", "expression", "from", "the", "rvalue", "or", "otherwise", "just", "returns", "it" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DestructuringGlobalNameExtractor.java#L176-L192
Alluxio/alluxio
underfs/oss/src/main/java/alluxio/underfs/oss/OSSUnderFileSystem.java
OSSUnderFileSystem.createInstance
public static OSSUnderFileSystem createInstance(AlluxioURI uri, UnderFileSystemConfiguration conf, AlluxioConfiguration alluxioConf) throws Exception { """ Constructs a new instance of {@link OSSUnderFileSystem}. @param uri the {@link AlluxioURI} for this UFS @param conf the configuration for this UFS @param alluxioConf Alluxio configuration @return the created {@link OSSUnderFileSystem} instance """ String bucketName = UnderFileSystemUtils.getBucketName(uri); Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_ACCESS_KEY), "Property %s is required to connect to OSS", PropertyKey.OSS_ACCESS_KEY); Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_SECRET_KEY), "Property %s is required to connect to OSS", PropertyKey.OSS_SECRET_KEY); Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_ENDPOINT_KEY), "Property %s is required to connect to OSS", PropertyKey.OSS_ENDPOINT_KEY); String accessId = conf.get(PropertyKey.OSS_ACCESS_KEY); String accessKey = conf.get(PropertyKey.OSS_SECRET_KEY); String endPoint = conf.get(PropertyKey.OSS_ENDPOINT_KEY); ClientConfiguration ossClientConf = initializeOSSClientConfig(alluxioConf); OSSClient ossClient = new OSSClient(endPoint, accessId, accessKey, ossClientConf); return new OSSUnderFileSystem(uri, ossClient, bucketName, conf, alluxioConf); }
java
public static OSSUnderFileSystem createInstance(AlluxioURI uri, UnderFileSystemConfiguration conf, AlluxioConfiguration alluxioConf) throws Exception { String bucketName = UnderFileSystemUtils.getBucketName(uri); Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_ACCESS_KEY), "Property %s is required to connect to OSS", PropertyKey.OSS_ACCESS_KEY); Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_SECRET_KEY), "Property %s is required to connect to OSS", PropertyKey.OSS_SECRET_KEY); Preconditions.checkArgument(conf.isSet(PropertyKey.OSS_ENDPOINT_KEY), "Property %s is required to connect to OSS", PropertyKey.OSS_ENDPOINT_KEY); String accessId = conf.get(PropertyKey.OSS_ACCESS_KEY); String accessKey = conf.get(PropertyKey.OSS_SECRET_KEY); String endPoint = conf.get(PropertyKey.OSS_ENDPOINT_KEY); ClientConfiguration ossClientConf = initializeOSSClientConfig(alluxioConf); OSSClient ossClient = new OSSClient(endPoint, accessId, accessKey, ossClientConf); return new OSSUnderFileSystem(uri, ossClient, bucketName, conf, alluxioConf); }
[ "public", "static", "OSSUnderFileSystem", "createInstance", "(", "AlluxioURI", "uri", ",", "UnderFileSystemConfiguration", "conf", ",", "AlluxioConfiguration", "alluxioConf", ")", "throws", "Exception", "{", "String", "bucketName", "=", "UnderFileSystemUtils", ".", "getBucketName", "(", "uri", ")", ";", "Preconditions", ".", "checkArgument", "(", "conf", ".", "isSet", "(", "PropertyKey", ".", "OSS_ACCESS_KEY", ")", ",", "\"Property %s is required to connect to OSS\"", ",", "PropertyKey", ".", "OSS_ACCESS_KEY", ")", ";", "Preconditions", ".", "checkArgument", "(", "conf", ".", "isSet", "(", "PropertyKey", ".", "OSS_SECRET_KEY", ")", ",", "\"Property %s is required to connect to OSS\"", ",", "PropertyKey", ".", "OSS_SECRET_KEY", ")", ";", "Preconditions", ".", "checkArgument", "(", "conf", ".", "isSet", "(", "PropertyKey", ".", "OSS_ENDPOINT_KEY", ")", ",", "\"Property %s is required to connect to OSS\"", ",", "PropertyKey", ".", "OSS_ENDPOINT_KEY", ")", ";", "String", "accessId", "=", "conf", ".", "get", "(", "PropertyKey", ".", "OSS_ACCESS_KEY", ")", ";", "String", "accessKey", "=", "conf", ".", "get", "(", "PropertyKey", ".", "OSS_SECRET_KEY", ")", ";", "String", "endPoint", "=", "conf", ".", "get", "(", "PropertyKey", ".", "OSS_ENDPOINT_KEY", ")", ";", "ClientConfiguration", "ossClientConf", "=", "initializeOSSClientConfig", "(", "alluxioConf", ")", ";", "OSSClient", "ossClient", "=", "new", "OSSClient", "(", "endPoint", ",", "accessId", ",", "accessKey", ",", "ossClientConf", ")", ";", "return", "new", "OSSUnderFileSystem", "(", "uri", ",", "ossClient", ",", "bucketName", ",", "conf", ",", "alluxioConf", ")", ";", "}" ]
Constructs a new instance of {@link OSSUnderFileSystem}. @param uri the {@link AlluxioURI} for this UFS @param conf the configuration for this UFS @param alluxioConf Alluxio configuration @return the created {@link OSSUnderFileSystem} instance
[ "Constructs", "a", "new", "instance", "of", "{", "@link", "OSSUnderFileSystem", "}", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/oss/src/main/java/alluxio/underfs/oss/OSSUnderFileSystem.java#L69-L86
javagl/ND
nd-tuples/src/main/java/de/javagl/nd/tuples/i/IntTuples.java
IntTuples.createSubTuple
static MutableIntTuple createSubTuple( MutableIntTuple parent, int fromIndex, int toIndex) { """ Creates a new tuple that is a <i>view</i> on the specified portion of the given parent. Changes in the parent will be visible in the returned tuple, and vice versa. @param parent The parent tuple @param fromIndex The start index in the parent, inclusive @param toIndex The end index in the parent, exclusive @throws NullPointerException If the given parent is <code>null</code> @throws IllegalArgumentException If the given indices are invalid. This is the case when <code>fromIndex &lt; 0</code>, <code>fromIndex &gt; toIndex</code>, or <code>toIndex &gt; {@link Tuple#getSize() parent.getSize()}</code>, @return The new tuple """ return new MutableSubIntTuple(parent, fromIndex, toIndex); }
java
static MutableIntTuple createSubTuple( MutableIntTuple parent, int fromIndex, int toIndex) { return new MutableSubIntTuple(parent, fromIndex, toIndex); }
[ "static", "MutableIntTuple", "createSubTuple", "(", "MutableIntTuple", "parent", ",", "int", "fromIndex", ",", "int", "toIndex", ")", "{", "return", "new", "MutableSubIntTuple", "(", "parent", ",", "fromIndex", ",", "toIndex", ")", ";", "}" ]
Creates a new tuple that is a <i>view</i> on the specified portion of the given parent. Changes in the parent will be visible in the returned tuple, and vice versa. @param parent The parent tuple @param fromIndex The start index in the parent, inclusive @param toIndex The end index in the parent, exclusive @throws NullPointerException If the given parent is <code>null</code> @throws IllegalArgumentException If the given indices are invalid. This is the case when <code>fromIndex &lt; 0</code>, <code>fromIndex &gt; toIndex</code>, or <code>toIndex &gt; {@link Tuple#getSize() parent.getSize()}</code>, @return The new tuple
[ "Creates", "a", "new", "tuple", "that", "is", "a", "<i", ">", "view<", "/", "i", ">", "on", "the", "specified", "portion", "of", "the", "given", "parent", ".", "Changes", "in", "the", "parent", "will", "be", "visible", "in", "the", "returned", "tuple", "and", "vice", "versa", "." ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/i/IntTuples.java#L250-L254
Netflix/eureka
eureka-client/src/main/java/com/netflix/appinfo/ApplicationInfoManager.java
ApplicationInfoManager.setInstanceStatus
public synchronized void setInstanceStatus(InstanceStatus status) { """ Set the status of this instance. Application can use this to indicate whether it is ready to receive traffic. Setting the status here also notifies all registered listeners of a status change event. @param status Status of the instance """ InstanceStatus next = instanceStatusMapper.map(status); if (next == null) { return; } InstanceStatus prev = instanceInfo.setStatus(next); if (prev != null) { for (StatusChangeListener listener : listeners.values()) { try { listener.notify(new StatusChangeEvent(prev, next)); } catch (Exception e) { logger.warn("failed to notify listener: {}", listener.getId(), e); } } } }
java
public synchronized void setInstanceStatus(InstanceStatus status) { InstanceStatus next = instanceStatusMapper.map(status); if (next == null) { return; } InstanceStatus prev = instanceInfo.setStatus(next); if (prev != null) { for (StatusChangeListener listener : listeners.values()) { try { listener.notify(new StatusChangeEvent(prev, next)); } catch (Exception e) { logger.warn("failed to notify listener: {}", listener.getId(), e); } } } }
[ "public", "synchronized", "void", "setInstanceStatus", "(", "InstanceStatus", "status", ")", "{", "InstanceStatus", "next", "=", "instanceStatusMapper", ".", "map", "(", "status", ")", ";", "if", "(", "next", "==", "null", ")", "{", "return", ";", "}", "InstanceStatus", "prev", "=", "instanceInfo", ".", "setStatus", "(", "next", ")", ";", "if", "(", "prev", "!=", "null", ")", "{", "for", "(", "StatusChangeListener", "listener", ":", "listeners", ".", "values", "(", ")", ")", "{", "try", "{", "listener", ".", "notify", "(", "new", "StatusChangeEvent", "(", "prev", ",", "next", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "warn", "(", "\"failed to notify listener: {}\"", ",", "listener", ".", "getId", "(", ")", ",", "e", ")", ";", "}", "}", "}", "}" ]
Set the status of this instance. Application can use this to indicate whether it is ready to receive traffic. Setting the status here also notifies all registered listeners of a status change event. @param status Status of the instance
[ "Set", "the", "status", "of", "this", "instance", ".", "Application", "can", "use", "this", "to", "indicate", "whether", "it", "is", "ready", "to", "receive", "traffic", ".", "Setting", "the", "status", "here", "also", "notifies", "all", "registered", "listeners", "of", "a", "status", "change", "event", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-client/src/main/java/com/netflix/appinfo/ApplicationInfoManager.java#L167-L183
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java
SubWriterHolderWriter.addSummaryType
public void addSummaryType(AbstractMemberWriter mw, Element member, Content tdSummaryType) { """ Add the summary type for the member. @param mw the writer for the member being documented @param member the member to be documented @param tdSummaryType the content tree to which the type will be added """ mw.addSummaryType(member, tdSummaryType); }
java
public void addSummaryType(AbstractMemberWriter mw, Element member, Content tdSummaryType) { mw.addSummaryType(member, tdSummaryType); }
[ "public", "void", "addSummaryType", "(", "AbstractMemberWriter", "mw", ",", "Element", "member", ",", "Content", "tdSummaryType", ")", "{", "mw", ".", "addSummaryType", "(", "member", ",", "tdSummaryType", ")", ";", "}" ]
Add the summary type for the member. @param mw the writer for the member being documented @param member the member to be documented @param tdSummaryType the content tree to which the type will be added
[ "Add", "the", "summary", "type", "for", "the", "member", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java#L217-L219
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.resetAsync
public Observable<VirtualNetworkGatewayInner> resetAsync(String resourceGroupName, String virtualNetworkGatewayName) { """ Resets the primary of the virtual network gateway in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return resetWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<VirtualNetworkGatewayInner>, VirtualNetworkGatewayInner>() { @Override public VirtualNetworkGatewayInner call(ServiceResponse<VirtualNetworkGatewayInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkGatewayInner> resetAsync(String resourceGroupName, String virtualNetworkGatewayName) { return resetWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<VirtualNetworkGatewayInner>, VirtualNetworkGatewayInner>() { @Override public VirtualNetworkGatewayInner call(ServiceResponse<VirtualNetworkGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkGatewayInner", ">", "resetAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ")", "{", "return", "resetWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualNetworkGatewayInner", ">", ",", "VirtualNetworkGatewayInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualNetworkGatewayInner", "call", "(", "ServiceResponse", "<", "VirtualNetworkGatewayInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Resets the primary of the virtual network gateway in the specified resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Resets", "the", "primary", "of", "the", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1184-L1191
jinahya/hex-codec
src/main/java/com/github/jinahya/codec/HexDecoder.java
HexDecoder.decodeSingle
public static int decodeSingle(final byte[] input, final int inoff) { """ Decodes two nibbles in given input array and returns the decoded octet. @param input the input array of nibbles. @param inoff the offset in the array. @return the decoded octet. """ if (input == null) { throw new NullPointerException("input"); } if (input.length < 2) { // not required by (inoff >= input.length -1) checked below throw new IllegalArgumentException( "input.length(" + input.length + ") < 2"); } if (inoff < 0) { throw new IllegalArgumentException("inoff(" + inoff + ") < 0"); } if (inoff >= input.length - 1) { throw new IllegalArgumentException( "inoff(" + inoff + ") >= input.length(" + input.length + ") - 1"); } return (decodeHalf(input[inoff] & 0xFF) << 4) | decodeHalf(input[inoff + 1] & 0xFF); }
java
public static int decodeSingle(final byte[] input, final int inoff) { if (input == null) { throw new NullPointerException("input"); } if (input.length < 2) { // not required by (inoff >= input.length -1) checked below throw new IllegalArgumentException( "input.length(" + input.length + ") < 2"); } if (inoff < 0) { throw new IllegalArgumentException("inoff(" + inoff + ") < 0"); } if (inoff >= input.length - 1) { throw new IllegalArgumentException( "inoff(" + inoff + ") >= input.length(" + input.length + ") - 1"); } return (decodeHalf(input[inoff] & 0xFF) << 4) | decodeHalf(input[inoff + 1] & 0xFF); }
[ "public", "static", "int", "decodeSingle", "(", "final", "byte", "[", "]", "input", ",", "final", "int", "inoff", ")", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"input\"", ")", ";", "}", "if", "(", "input", ".", "length", "<", "2", ")", "{", "// not required by (inoff >= input.length -1) checked below", "throw", "new", "IllegalArgumentException", "(", "\"input.length(\"", "+", "input", ".", "length", "+", "\") < 2\"", ")", ";", "}", "if", "(", "inoff", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"inoff(\"", "+", "inoff", "+", "\") < 0\"", ")", ";", "}", "if", "(", "inoff", ">=", "input", ".", "length", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"inoff(\"", "+", "inoff", "+", "\") >= input.length(\"", "+", "input", ".", "length", "+", "\") - 1\"", ")", ";", "}", "return", "(", "decodeHalf", "(", "input", "[", "inoff", "]", "&", "0xFF", ")", "<<", "4", ")", "|", "decodeHalf", "(", "input", "[", "inoff", "+", "1", "]", "&", "0xFF", ")", ";", "}" ]
Decodes two nibbles in given input array and returns the decoded octet. @param input the input array of nibbles. @param inoff the offset in the array. @return the decoded octet.
[ "Decodes", "two", "nibbles", "in", "given", "input", "array", "and", "returns", "the", "decoded", "octet", "." ]
train
https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexDecoder.java#L91-L115
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterReader.java
GrassRasterReader.readUncompressedFPRowByNumber
private void readUncompressedFPRowByNumber( ByteBuffer rowdata, int rn, RandomAccessFile thefile, int typeBytes ) throws IOException, DataFormatException { """ read a row of data from an uncompressed floating point map @param rn @param outFile @param typeBytes @return the ByteBuffer containing the data @throws IOException @throws DataFormatException """ int datanumber = fileWindow.getCols() * typeBytes; thefile.seek((rn * datanumber)); thefile.read(rowdata.array()); }
java
private void readUncompressedFPRowByNumber( ByteBuffer rowdata, int rn, RandomAccessFile thefile, int typeBytes ) throws IOException, DataFormatException { int datanumber = fileWindow.getCols() * typeBytes; thefile.seek((rn * datanumber)); thefile.read(rowdata.array()); }
[ "private", "void", "readUncompressedFPRowByNumber", "(", "ByteBuffer", "rowdata", ",", "int", "rn", ",", "RandomAccessFile", "thefile", ",", "int", "typeBytes", ")", "throws", "IOException", ",", "DataFormatException", "{", "int", "datanumber", "=", "fileWindow", ".", "getCols", "(", ")", "*", "typeBytes", ";", "thefile", ".", "seek", "(", "(", "rn", "*", "datanumber", ")", ")", ";", "thefile", ".", "read", "(", "rowdata", ".", "array", "(", ")", ")", ";", "}" ]
read a row of data from an uncompressed floating point map @param rn @param outFile @param typeBytes @return the ByteBuffer containing the data @throws IOException @throws DataFormatException
[ "read", "a", "row", "of", "data", "from", "an", "uncompressed", "floating", "point", "map" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterReader.java#L1104-L1110
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryBySecondaryCustomIndex
public Iterable<DContact> queryBySecondaryCustomIndex(Object parent, java.lang.String secondaryCustomIndex) { """ query-by method for field secondaryCustomIndex @param secondaryCustomIndex the specified attribute @return an Iterable of DContacts for the specified secondaryCustomIndex """ return queryByField(parent, DContactMapper.Field.SECONDARYCUSTOMINDEX.getFieldName(), secondaryCustomIndex); }
java
public Iterable<DContact> queryBySecondaryCustomIndex(Object parent, java.lang.String secondaryCustomIndex) { return queryByField(parent, DContactMapper.Field.SECONDARYCUSTOMINDEX.getFieldName(), secondaryCustomIndex); }
[ "public", "Iterable", "<", "DContact", ">", "queryBySecondaryCustomIndex", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "secondaryCustomIndex", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "SECONDARYCUSTOMINDEX", ".", "getFieldName", "(", ")", ",", "secondaryCustomIndex", ")", ";", "}" ]
query-by method for field secondaryCustomIndex @param secondaryCustomIndex the specified attribute @return an Iterable of DContacts for the specified secondaryCustomIndex
[ "query", "-", "by", "method", "for", "field", "secondaryCustomIndex" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L259-L261
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.findTargetClass
private static Class findTargetClass( String key, Map classMap ) { """ Locates a Class associated to a specifi key.<br> The key may be a regexp. """ // try get first Class targetClass = (Class) classMap.get( key ); if( targetClass == null ){ // try with regexp // this will hit performance as it must iterate over all the keys // and create a RegexpMatcher for each key for( Iterator i = classMap.entrySet() .iterator(); i.hasNext(); ){ Map.Entry entry = (Map.Entry) i.next(); if( RegexpUtils.getMatcher( (String) entry.getKey() ) .matches( key ) ){ targetClass = (Class) entry.getValue(); break; } } } return targetClass; }
java
private static Class findTargetClass( String key, Map classMap ) { // try get first Class targetClass = (Class) classMap.get( key ); if( targetClass == null ){ // try with regexp // this will hit performance as it must iterate over all the keys // and create a RegexpMatcher for each key for( Iterator i = classMap.entrySet() .iterator(); i.hasNext(); ){ Map.Entry entry = (Map.Entry) i.next(); if( RegexpUtils.getMatcher( (String) entry.getKey() ) .matches( key ) ){ targetClass = (Class) entry.getValue(); break; } } } return targetClass; }
[ "private", "static", "Class", "findTargetClass", "(", "String", "key", ",", "Map", "classMap", ")", "{", "// try get first", "Class", "targetClass", "=", "(", "Class", ")", "classMap", ".", "get", "(", "key", ")", ";", "if", "(", "targetClass", "==", "null", ")", "{", "// try with regexp", "// this will hit performance as it must iterate over all the keys", "// and create a RegexpMatcher for each key", "for", "(", "Iterator", "i", "=", "classMap", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "Map", ".", "Entry", "entry", "=", "(", "Map", ".", "Entry", ")", "i", ".", "next", "(", ")", ";", "if", "(", "RegexpUtils", ".", "getMatcher", "(", "(", "String", ")", "entry", ".", "getKey", "(", ")", ")", ".", "matches", "(", "key", ")", ")", "{", "targetClass", "=", "(", "Class", ")", "entry", ".", "getValue", "(", ")", ";", "break", ";", "}", "}", "}", "return", "targetClass", ";", "}" ]
Locates a Class associated to a specifi key.<br> The key may be a regexp.
[ "Locates", "a", "Class", "associated", "to", "a", "specifi", "key", ".", "<br", ">", "The", "key", "may", "be", "a", "regexp", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1262-L1281
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/tools/ApiBuilder.java
ApiBuilder.validateProperty
public static boolean validateProperty(String key, String value) { """ Validate the key and value of a property @param key @param value @return """ return !StringUtils.isBlank(key) && !StringUtils.isBlank(value); }
java
public static boolean validateProperty(String key, String value) { return !StringUtils.isBlank(key) && !StringUtils.isBlank(value); }
[ "public", "static", "boolean", "validateProperty", "(", "String", "key", ",", "String", "value", ")", "{", "return", "!", "StringUtils", ".", "isBlank", "(", "key", ")", "&&", "!", "StringUtils", ".", "isBlank", "(", "value", ")", ";", "}" ]
Validate the key and value of a property @param key @param value @return
[ "Validate", "the", "key", "and", "value", "of", "a", "property" ]
train
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/tools/ApiBuilder.java#L124-L126
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java
MsgDestEncodingUtilsImpl.convertPropertyToType
final static Object convertPropertyToType(String longPropertyName, String stringValue) { """ convertPropertyToType Convert a property from its stringified form into an Object of the appropriate type. Called by URIDestinationCreator. @param longPropertyName The long name of the property @param stringValue The stringified property value @return Object Description of returned value """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "convertPropertyToType", new Object[]{longPropertyName, stringValue}); // If the value is null or already a String we won't have anything to do Object decodedObject = stringValue; // The only non-String types we have are Integer & Long, so deal with them Class requiredType = getPropertyType(longPropertyName); if (requiredType == Integer.class) { decodedObject = Integer.valueOf(stringValue); } else if (requiredType == Long.class) { decodedObject = Long.valueOf(stringValue); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "convertPropertyToType"); return decodedObject; }
java
final static Object convertPropertyToType(String longPropertyName, String stringValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "convertPropertyToType", new Object[]{longPropertyName, stringValue}); // If the value is null or already a String we won't have anything to do Object decodedObject = stringValue; // The only non-String types we have are Integer & Long, so deal with them Class requiredType = getPropertyType(longPropertyName); if (requiredType == Integer.class) { decodedObject = Integer.valueOf(stringValue); } else if (requiredType == Long.class) { decodedObject = Long.valueOf(stringValue); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "convertPropertyToType"); return decodedObject; }
[ "final", "static", "Object", "convertPropertyToType", "(", "String", "longPropertyName", ",", "String", "stringValue", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"convertPropertyToType\"", ",", "new", "Object", "[", "]", "{", "longPropertyName", ",", "stringValue", "}", ")", ";", "// If the value is null or already a String we won't have anything to do", "Object", "decodedObject", "=", "stringValue", ";", "// The only non-String types we have are Integer & Long, so deal with them", "Class", "requiredType", "=", "getPropertyType", "(", "longPropertyName", ")", ";", "if", "(", "requiredType", "==", "Integer", ".", "class", ")", "{", "decodedObject", "=", "Integer", ".", "valueOf", "(", "stringValue", ")", ";", "}", "else", "if", "(", "requiredType", "==", "Long", ".", "class", ")", "{", "decodedObject", "=", "Long", ".", "valueOf", "(", "stringValue", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"convertPropertyToType\"", ")", ";", "return", "decodedObject", ";", "}" ]
convertPropertyToType Convert a property from its stringified form into an Object of the appropriate type. Called by URIDestinationCreator. @param longPropertyName The long name of the property @param stringValue The stringified property value @return Object Description of returned value
[ "convertPropertyToType", "Convert", "a", "property", "from", "its", "stringified", "form", "into", "an", "Object", "of", "the", "appropriate", "type", ".", "Called", "by", "URIDestinationCreator", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java#L332-L349
zaproxy/zaproxy
src/org/parosproxy/paros/view/AbstractFrame.java
AbstractFrame.restoreWindowLocation
private Point restoreWindowLocation() { """ Loads and set the saved position preferences for this frame. @return the size of the frame OR null, if there wasn't any preference. """ Point result = null; final String sizestr = preferences.get(prefnzPrefix+PREF_WINDOW_POSITION, null); if (sizestr != null) { int x = 0; int y = 0; final String[] sizes = sizestr.split("[,]"); try { x = Integer.parseInt(sizes[0].trim()); y = Integer.parseInt(sizes[1].trim()); } catch (final Exception e) { // ignoring, cause is prevented by default values; } if (x > 0 && y > 0) { result = new Point(x, y); if (logger.isDebugEnabled()) logger.debug("Restoring preference " + PREF_WINDOW_POSITION + "=" + result.x + "," + result.y); this.setLocation(result); } } return result; }
java
private Point restoreWindowLocation() { Point result = null; final String sizestr = preferences.get(prefnzPrefix+PREF_WINDOW_POSITION, null); if (sizestr != null) { int x = 0; int y = 0; final String[] sizes = sizestr.split("[,]"); try { x = Integer.parseInt(sizes[0].trim()); y = Integer.parseInt(sizes[1].trim()); } catch (final Exception e) { // ignoring, cause is prevented by default values; } if (x > 0 && y > 0) { result = new Point(x, y); if (logger.isDebugEnabled()) logger.debug("Restoring preference " + PREF_WINDOW_POSITION + "=" + result.x + "," + result.y); this.setLocation(result); } } return result; }
[ "private", "Point", "restoreWindowLocation", "(", ")", "{", "Point", "result", "=", "null", ";", "final", "String", "sizestr", "=", "preferences", ".", "get", "(", "prefnzPrefix", "+", "PREF_WINDOW_POSITION", ",", "null", ")", ";", "if", "(", "sizestr", "!=", "null", ")", "{", "int", "x", "=", "0", ";", "int", "y", "=", "0", ";", "final", "String", "[", "]", "sizes", "=", "sizestr", ".", "split", "(", "\"[,]\"", ")", ";", "try", "{", "x", "=", "Integer", ".", "parseInt", "(", "sizes", "[", "0", "]", ".", "trim", "(", ")", ")", ";", "y", "=", "Integer", ".", "parseInt", "(", "sizes", "[", "1", "]", ".", "trim", "(", ")", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "// ignoring, cause is prevented by default values;\r", "}", "if", "(", "x", ">", "0", "&&", "y", ">", "0", ")", "{", "result", "=", "new", "Point", "(", "x", ",", "y", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"Restoring preference \"", "+", "PREF_WINDOW_POSITION", "+", "\"=\"", "+", "result", ".", "x", "+", "\",\"", "+", "result", ".", "y", ")", ";", "this", ".", "setLocation", "(", "result", ")", ";", "}", "}", "return", "result", ";", "}" ]
Loads and set the saved position preferences for this frame. @return the size of the frame OR null, if there wasn't any preference.
[ "Loads", "and", "set", "the", "saved", "position", "preferences", "for", "this", "frame", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/AbstractFrame.java#L243-L263
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java
SynchronousQueue.offer
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { """ Inserts the specified element into this queue, waiting if necessary up to the specified wait time for another thread to receive it. @return {@code true} if successful, or {@code false} if the specified waiting time elapses before a consumer appears @throws InterruptedException {@inheritDoc} @throws NullPointerException {@inheritDoc} """ if (e == null) throw new NullPointerException(); if (transferer.transfer(e, true, unit.toNanos(timeout)) != null) return true; if (!Thread.interrupted()) return false; throw new InterruptedException(); }
java
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { if (e == null) throw new NullPointerException(); if (transferer.transfer(e, true, unit.toNanos(timeout)) != null) return true; if (!Thread.interrupted()) return false; throw new InterruptedException(); }
[ "public", "boolean", "offer", "(", "E", "e", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "if", "(", "e", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "if", "(", "transferer", ".", "transfer", "(", "e", ",", "true", ",", "unit", ".", "toNanos", "(", "timeout", ")", ")", "!=", "null", ")", "return", "true", ";", "if", "(", "!", "Thread", ".", "interrupted", "(", ")", ")", "return", "false", ";", "throw", "new", "InterruptedException", "(", ")", ";", "}" ]
Inserts the specified element into this queue, waiting if necessary up to the specified wait time for another thread to receive it. @return {@code true} if successful, or {@code false} if the specified waiting time elapses before a consumer appears @throws InterruptedException {@inheritDoc} @throws NullPointerException {@inheritDoc}
[ "Inserts", "the", "specified", "element", "into", "this", "queue", "waiting", "if", "necessary", "up", "to", "the", "specified", "wait", "time", "for", "another", "thread", "to", "receive", "it", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java#L895-L903
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_ips_GET
public ArrayList<OvhDatetimeAndIpvalue> billingAccount_line_serviceName_ips_GET(String billingAccount, String serviceName) throws IOException { """ Listing of last ips registry REST: GET /telephony/{billingAccount}/line/{serviceName}/ips @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/line/{serviceName}/ips"; StringBuilder sb = path(qPath, billingAccount, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t9); }
java
public ArrayList<OvhDatetimeAndIpvalue> billingAccount_line_serviceName_ips_GET(String billingAccount, String serviceName) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/ips"; StringBuilder sb = path(qPath, billingAccount, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t9); }
[ "public", "ArrayList", "<", "OvhDatetimeAndIpvalue", ">", "billingAccount_line_serviceName_ips_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/line/{serviceName}/ips\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t9", ")", ";", "}" ]
Listing of last ips registry REST: GET /telephony/{billingAccount}/line/{serviceName}/ips @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Listing", "of", "last", "ips", "registry" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1723-L1728