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
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java
Settings.setArrayIfNotEmpty
public void setArrayIfNotEmpty(@NotNull final String key, @Nullable final List<String> value) { """ Sets a property value only if the array value is not null and not empty. @param key the key for the property @param value the value for the property """ if (null != value && !value.isEmpty()) { setString(key, new Gson().toJson(value)); } }
java
public void setArrayIfNotEmpty(@NotNull final String key, @Nullable final List<String> value) { if (null != value && !value.isEmpty()) { setString(key, new Gson().toJson(value)); } }
[ "public", "void", "setArrayIfNotEmpty", "(", "@", "NotNull", "final", "String", "key", ",", "@", "Nullable", "final", "List", "<", "String", ">", "value", ")", "{", "if", "(", "null", "!=", "value", "&&", "!", "value", ".", "isEmpty", "(", ")", ")", "{", "setString", "(", "key", ",", "new", "Gson", "(", ")", ".", "toJson", "(", "value", ")", ")", ";", "}", "}" ]
Sets a property value only if the array value is not null and not empty. @param key the key for the property @param value the value for the property
[ "Sets", "a", "property", "value", "only", "if", "the", "array", "value", "is", "not", "null", "and", "not", "empty", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L712-L716
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/expressions/Expressions.java
Expressions.isEqual
public static BooleanIsEqual isEqual(ComparableExpression<Boolean> left, Boolean constant) { """ Creates a BooleanIsEqual expression from the given expression and constant. @param left The left expression. @param constant The constant to compare to. @return A new BooleanIsEqual binary expression. """ return new BooleanIsEqual(left, constant(constant)); }
java
public static BooleanIsEqual isEqual(ComparableExpression<Boolean> left, Boolean constant) { return new BooleanIsEqual(left, constant(constant)); }
[ "public", "static", "BooleanIsEqual", "isEqual", "(", "ComparableExpression", "<", "Boolean", ">", "left", ",", "Boolean", "constant", ")", "{", "return", "new", "BooleanIsEqual", "(", "left", ",", "constant", "(", "constant", ")", ")", ";", "}" ]
Creates a BooleanIsEqual expression from the given expression and constant. @param left The left expression. @param constant The constant to compare to. @return A new BooleanIsEqual binary expression.
[ "Creates", "a", "BooleanIsEqual", "expression", "from", "the", "given", "expression", "and", "constant", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L186-L188
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.getIntentSuggestions
public List<IntentsSuggestionExample> getIntentSuggestions(UUID appId, String versionId, UUID intentId, GetIntentSuggestionsOptionalParameter getIntentSuggestionsOptionalParameter) { """ Suggests examples that would improve the accuracy of the intent model. @param appId The application ID. @param versionId The version ID. @param intentId The intent classifier ID. @param getIntentSuggestionsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;IntentsSuggestionExample&gt; object if successful. """ return getIntentSuggestionsWithServiceResponseAsync(appId, versionId, intentId, getIntentSuggestionsOptionalParameter).toBlocking().single().body(); }
java
public List<IntentsSuggestionExample> getIntentSuggestions(UUID appId, String versionId, UUID intentId, GetIntentSuggestionsOptionalParameter getIntentSuggestionsOptionalParameter) { return getIntentSuggestionsWithServiceResponseAsync(appId, versionId, intentId, getIntentSuggestionsOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "IntentsSuggestionExample", ">", "getIntentSuggestions", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "intentId", ",", "GetIntentSuggestionsOptionalParameter", "getIntentSuggestionsOptionalParameter", ")", "{", "return", "getIntentSuggestionsWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "intentId", ",", "getIntentSuggestionsOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Suggests examples that would improve the accuracy of the intent model. @param appId The application ID. @param versionId The version ID. @param intentId The intent classifier ID. @param getIntentSuggestionsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;IntentsSuggestionExample&gt; object if successful.
[ "Suggests", "examples", "that", "would", "improve", "the", "accuracy", "of", "the", "intent", "model", "." ]
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#L5071-L5073
samskivert/samskivert
src/main/java/com/samskivert/util/CollectionUtil.java
CollectionUtil.addAll
@ReplacedBy("com.google.common.collect.Iterators#addAll()") public static <T, C extends Collection<T>> C addAll (C col, Iterator<? extends T> iter) { """ Adds all items returned by the iterator to the supplied collection and returns the supplied collection. """ while (iter.hasNext()) { col.add(iter.next()); } return col; }
java
@ReplacedBy("com.google.common.collect.Iterators#addAll()") public static <T, C extends Collection<T>> C addAll (C col, Iterator<? extends T> iter) { while (iter.hasNext()) { col.add(iter.next()); } return col; }
[ "@", "ReplacedBy", "(", "\"com.google.common.collect.Iterators#addAll()\"", ")", "public", "static", "<", "T", ",", "C", "extends", "Collection", "<", "T", ">", ">", "C", "addAll", "(", "C", "col", ",", "Iterator", "<", "?", "extends", "T", ">", "iter", ")", "{", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "col", ".", "add", "(", "iter", ".", "next", "(", ")", ")", ";", "}", "return", "col", ";", "}" ]
Adds all items returned by the iterator to the supplied collection and returns the supplied collection.
[ "Adds", "all", "items", "returned", "by", "the", "iterator", "to", "the", "supplied", "collection", "and", "returns", "the", "supplied", "collection", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/CollectionUtil.java#L43-L50
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.getTileGrid
public static TileGrid getTileGrid(Point point, int zoom, Projection projection) { """ Get the tile grid for the location specified as the projection @param point point @param zoom zoom level @param projection projection @return tile grid @since 1.1.0 """ ProjectionTransform toWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); Point webMercatorPoint = toWebMercator.transform(point); BoundingBox boundingBox = new BoundingBox(webMercatorPoint.getX(), webMercatorPoint.getY(), webMercatorPoint.getX(), webMercatorPoint.getY()); return getTileGrid(boundingBox, zoom); }
java
public static TileGrid getTileGrid(Point point, int zoom, Projection projection) { ProjectionTransform toWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); Point webMercatorPoint = toWebMercator.transform(point); BoundingBox boundingBox = new BoundingBox(webMercatorPoint.getX(), webMercatorPoint.getY(), webMercatorPoint.getX(), webMercatorPoint.getY()); return getTileGrid(boundingBox, zoom); }
[ "public", "static", "TileGrid", "getTileGrid", "(", "Point", "point", ",", "int", "zoom", ",", "Projection", "projection", ")", "{", "ProjectionTransform", "toWebMercator", "=", "projection", ".", "getTransformation", "(", "ProjectionConstants", ".", "EPSG_WEB_MERCATOR", ")", ";", "Point", "webMercatorPoint", "=", "toWebMercator", ".", "transform", "(", "point", ")", ";", "BoundingBox", "boundingBox", "=", "new", "BoundingBox", "(", "webMercatorPoint", ".", "getX", "(", ")", ",", "webMercatorPoint", ".", "getY", "(", ")", ",", "webMercatorPoint", ".", "getX", "(", ")", ",", "webMercatorPoint", ".", "getY", "(", ")", ")", ";", "return", "getTileGrid", "(", "boundingBox", ",", "zoom", ")", ";", "}" ]
Get the tile grid for the location specified as the projection @param point point @param zoom zoom level @param projection projection @return tile grid @since 1.1.0
[ "Get", "the", "tile", "grid", "for", "the", "location", "specified", "as", "the", "projection" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L574-L583
groovy/groovy-core
src/main/groovy/lang/GroovyClassLoader.java
GroovyClassLoader.parseClass
public Class parseClass(GroovyCodeSource codeSource, boolean shouldCacheSource) throws CompilationFailedException { """ Parses the given code source into a Java class. If there is a class file for the given code source, then no parsing is done, instead the cached class is returned. @param shouldCacheSource if true then the generated class will be stored in the source cache @return the main class defined in the given script """ synchronized (sourceCache) { Class answer = sourceCache.get(codeSource.getName()); if (answer != null) return answer; answer = doParseClass(codeSource); if (shouldCacheSource) sourceCache.put(codeSource.getName(), answer); return answer; } }
java
public Class parseClass(GroovyCodeSource codeSource, boolean shouldCacheSource) throws CompilationFailedException { synchronized (sourceCache) { Class answer = sourceCache.get(codeSource.getName()); if (answer != null) return answer; answer = doParseClass(codeSource); if (shouldCacheSource) sourceCache.put(codeSource.getName(), answer); return answer; } }
[ "public", "Class", "parseClass", "(", "GroovyCodeSource", "codeSource", ",", "boolean", "shouldCacheSource", ")", "throws", "CompilationFailedException", "{", "synchronized", "(", "sourceCache", ")", "{", "Class", "answer", "=", "sourceCache", ".", "get", "(", "codeSource", ".", "getName", "(", ")", ")", ";", "if", "(", "answer", "!=", "null", ")", "return", "answer", ";", "answer", "=", "doParseClass", "(", "codeSource", ")", ";", "if", "(", "shouldCacheSource", ")", "sourceCache", ".", "put", "(", "codeSource", ".", "getName", "(", ")", ",", "answer", ")", ";", "return", "answer", ";", "}", "}" ]
Parses the given code source into a Java class. If there is a class file for the given code source, then no parsing is done, instead the cached class is returned. @param shouldCacheSource if true then the generated class will be stored in the source cache @return the main class defined in the given script
[ "Parses", "the", "given", "code", "source", "into", "a", "Java", "class", ".", "If", "there", "is", "a", "class", "file", "for", "the", "given", "code", "source", "then", "no", "parsing", "is", "done", "instead", "the", "cached", "class", "is", "returned", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/GroovyClassLoader.java#L265-L273
bitcoinj/bitcoinj
tools/src/main/java/org/bitcoinj/tools/WalletTool.java
WalletTool.parseLockTimeStr
private static long parseLockTimeStr(String lockTimeStr) throws ParseException { """ Parses the string either as a whole number of blocks, or if it contains slashes as a YYYY/MM/DD format date and returns the lock time in wire format. """ if (lockTimeStr.indexOf("/") != -1) { SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd", Locale.US); Date date = format.parse(lockTimeStr); return date.getTime() / 1000; } return Long.parseLong(lockTimeStr); }
java
private static long parseLockTimeStr(String lockTimeStr) throws ParseException { if (lockTimeStr.indexOf("/") != -1) { SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd", Locale.US); Date date = format.parse(lockTimeStr); return date.getTime() / 1000; } return Long.parseLong(lockTimeStr); }
[ "private", "static", "long", "parseLockTimeStr", "(", "String", "lockTimeStr", ")", "throws", "ParseException", "{", "if", "(", "lockTimeStr", ".", "indexOf", "(", "\"/\"", ")", "!=", "-", "1", ")", "{", "SimpleDateFormat", "format", "=", "new", "SimpleDateFormat", "(", "\"yyyy/MM/dd\"", ",", "Locale", ".", "US", ")", ";", "Date", "date", "=", "format", ".", "parse", "(", "lockTimeStr", ")", ";", "return", "date", ".", "getTime", "(", ")", "/", "1000", ";", "}", "return", "Long", ".", "parseLong", "(", "lockTimeStr", ")", ";", "}" ]
Parses the string either as a whole number of blocks, or if it contains slashes as a YYYY/MM/DD format date and returns the lock time in wire format.
[ "Parses", "the", "string", "either", "as", "a", "whole", "number", "of", "blocks", "or", "if", "it", "contains", "slashes", "as", "a", "YYYY", "/", "MM", "/", "DD", "format", "date", "and", "returns", "the", "lock", "time", "in", "wire", "format", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/tools/src/main/java/org/bitcoinj/tools/WalletTool.java#L1064-L1071
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/utils/FileLogHolder.java
FileLogHolder.createFileLogHolder
public static FileLogHolder createFileLogHolder(TraceWriter oldLog, FileLogHeader logHeader, File logDirectory, String newFileName, int maxFiles, long maxSizeBytes) { """ This method will check to see if the supplied parameters match the settings on the <code>oldLog</code>, if they do then the <code>oldLog</code> is returned, otherwise a new FileLogHolder will be created. @param oldLog The previous FileLogHolder that may or may not be replaced by a new one, may be <code>null</code> (will cause a new instance to be created) @param logHeader Header to print at the top of new log files @param logDirectory Directory in which to store created log files @param newFileName File name for new log: this will be split into a name and extension @param maxFiles New maximum number of log files. If 0, log files won't be pruned. @param maxSizeBytes New maximum log file size in bytes. If 0, log files won't be rolled. @return a log holder. If all values are the same, the old one is returned, otherwise a new log holder is created. """ return createFileLogHolder(oldLog, logHeader, logDirectory, newFileName, maxFiles, maxSizeBytes, NEW_LOGS_ON_START_DEFAULT); }
java
public static FileLogHolder createFileLogHolder(TraceWriter oldLog, FileLogHeader logHeader, File logDirectory, String newFileName, int maxFiles, long maxSizeBytes) { return createFileLogHolder(oldLog, logHeader, logDirectory, newFileName, maxFiles, maxSizeBytes, NEW_LOGS_ON_START_DEFAULT); }
[ "public", "static", "FileLogHolder", "createFileLogHolder", "(", "TraceWriter", "oldLog", ",", "FileLogHeader", "logHeader", ",", "File", "logDirectory", ",", "String", "newFileName", ",", "int", "maxFiles", ",", "long", "maxSizeBytes", ")", "{", "return", "createFileLogHolder", "(", "oldLog", ",", "logHeader", ",", "logDirectory", ",", "newFileName", ",", "maxFiles", ",", "maxSizeBytes", ",", "NEW_LOGS_ON_START_DEFAULT", ")", ";", "}" ]
This method will check to see if the supplied parameters match the settings on the <code>oldLog</code>, if they do then the <code>oldLog</code> is returned, otherwise a new FileLogHolder will be created. @param oldLog The previous FileLogHolder that may or may not be replaced by a new one, may be <code>null</code> (will cause a new instance to be created) @param logHeader Header to print at the top of new log files @param logDirectory Directory in which to store created log files @param newFileName File name for new log: this will be split into a name and extension @param maxFiles New maximum number of log files. If 0, log files won't be pruned. @param maxSizeBytes New maximum log file size in bytes. If 0, log files won't be rolled. @return a log holder. If all values are the same, the old one is returned, otherwise a new log holder is created.
[ "This", "method", "will", "check", "to", "see", "if", "the", "supplied", "parameters", "match", "the", "settings", "on", "the", "<code", ">", "oldLog<", "/", "code", ">", "if", "they", "do", "then", "the", "<code", ">", "oldLog<", "/", "code", ">", "is", "returned", "otherwise", "a", "new", "FileLogHolder", "will", "be", "created", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/utils/FileLogHolder.java#L132-L136
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageRequest.java
MessageRequest.withContext
public MessageRequest withContext(java.util.Map<String, String> context) { """ A map of custom attributes to attributes to be attached to the message. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @param context A map of custom attributes to attributes to be attached to the message. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @return Returns a reference to this object so that method calls can be chained together. """ setContext(context); return this; }
java
public MessageRequest withContext(java.util.Map<String, String> context) { setContext(context); return this; }
[ "public", "MessageRequest", "withContext", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "context", ")", "{", "setContext", "(", "context", ")", ";", "return", "this", ";", "}" ]
A map of custom attributes to attributes to be attached to the message. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @param context A map of custom attributes to attributes to be attached to the message. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "map", "of", "custom", "attributes", "to", "attributes", "to", "be", "attached", "to", "the", "message", ".", "This", "payload", "is", "added", "to", "the", "push", "notification", "s", "data", ".", "pinpoint", "object", "or", "added", "to", "the", "email", "/", "sms", "delivery", "receipt", "event", "attributes", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageRequest.java#L146-L149
neo4j/neo4j-java-driver
driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java
DriverFactory.createSecurityPlanImpl
@SuppressWarnings( "deprecation" ) private static SecurityPlan createSecurityPlanImpl( BoltServerAddress address, Config config ) throws GeneralSecurityException, IOException { """ /* Establish a complete SecurityPlan based on the details provided for driver construction. """ if ( config.encrypted() ) { Logger logger = config.logging().getLog( "SecurityPlan" ); Config.TrustStrategy trustStrategy = config.trustStrategy(); boolean hostnameVerificationEnabled = trustStrategy.isHostnameVerificationEnabled(); switch ( trustStrategy.strategy() ) { case TRUST_ON_FIRST_USE: logger.warn( "Option `TRUST_ON_FIRST_USE` has been deprecated and will be removed in a future " + "version of the driver. Please switch to use `TRUST_ALL_CERTIFICATES` instead." ); return SecurityPlan.forTrustOnFirstUse( trustStrategy.certFile(), hostnameVerificationEnabled, address, logger ); case TRUST_SIGNED_CERTIFICATES: logger.warn( "Option `TRUST_SIGNED_CERTIFICATE` has been deprecated and will be removed in a future " + "version of the driver. Please switch to use `TRUST_CUSTOM_CA_SIGNED_CERTIFICATES` instead." ); // intentional fallthrough case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES: return SecurityPlan.forCustomCASignedCertificates( trustStrategy.certFile(), hostnameVerificationEnabled ); case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES: return SecurityPlan.forSystemCASignedCertificates( hostnameVerificationEnabled ); case TRUST_ALL_CERTIFICATES: return SecurityPlan.forAllCertificates( hostnameVerificationEnabled ); default: throw new ClientException( "Unknown TLS authentication strategy: " + trustStrategy.strategy().name() ); } } else { return insecure(); } }
java
@SuppressWarnings( "deprecation" ) private static SecurityPlan createSecurityPlanImpl( BoltServerAddress address, Config config ) throws GeneralSecurityException, IOException { if ( config.encrypted() ) { Logger logger = config.logging().getLog( "SecurityPlan" ); Config.TrustStrategy trustStrategy = config.trustStrategy(); boolean hostnameVerificationEnabled = trustStrategy.isHostnameVerificationEnabled(); switch ( trustStrategy.strategy() ) { case TRUST_ON_FIRST_USE: logger.warn( "Option `TRUST_ON_FIRST_USE` has been deprecated and will be removed in a future " + "version of the driver. Please switch to use `TRUST_ALL_CERTIFICATES` instead." ); return SecurityPlan.forTrustOnFirstUse( trustStrategy.certFile(), hostnameVerificationEnabled, address, logger ); case TRUST_SIGNED_CERTIFICATES: logger.warn( "Option `TRUST_SIGNED_CERTIFICATE` has been deprecated and will be removed in a future " + "version of the driver. Please switch to use `TRUST_CUSTOM_CA_SIGNED_CERTIFICATES` instead." ); // intentional fallthrough case TRUST_CUSTOM_CA_SIGNED_CERTIFICATES: return SecurityPlan.forCustomCASignedCertificates( trustStrategy.certFile(), hostnameVerificationEnabled ); case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES: return SecurityPlan.forSystemCASignedCertificates( hostnameVerificationEnabled ); case TRUST_ALL_CERTIFICATES: return SecurityPlan.forAllCertificates( hostnameVerificationEnabled ); default: throw new ClientException( "Unknown TLS authentication strategy: " + trustStrategy.strategy().name() ); } } else { return insecure(); } }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "private", "static", "SecurityPlan", "createSecurityPlanImpl", "(", "BoltServerAddress", "address", ",", "Config", "config", ")", "throws", "GeneralSecurityException", ",", "IOException", "{", "if", "(", "config", ".", "encrypted", "(", ")", ")", "{", "Logger", "logger", "=", "config", ".", "logging", "(", ")", ".", "getLog", "(", "\"SecurityPlan\"", ")", ";", "Config", ".", "TrustStrategy", "trustStrategy", "=", "config", ".", "trustStrategy", "(", ")", ";", "boolean", "hostnameVerificationEnabled", "=", "trustStrategy", ".", "isHostnameVerificationEnabled", "(", ")", ";", "switch", "(", "trustStrategy", ".", "strategy", "(", ")", ")", "{", "case", "TRUST_ON_FIRST_USE", ":", "logger", ".", "warn", "(", "\"Option `TRUST_ON_FIRST_USE` has been deprecated and will be removed in a future \"", "+", "\"version of the driver. Please switch to use `TRUST_ALL_CERTIFICATES` instead.\"", ")", ";", "return", "SecurityPlan", ".", "forTrustOnFirstUse", "(", "trustStrategy", ".", "certFile", "(", ")", ",", "hostnameVerificationEnabled", ",", "address", ",", "logger", ")", ";", "case", "TRUST_SIGNED_CERTIFICATES", ":", "logger", ".", "warn", "(", "\"Option `TRUST_SIGNED_CERTIFICATE` has been deprecated and will be removed in a future \"", "+", "\"version of the driver. Please switch to use `TRUST_CUSTOM_CA_SIGNED_CERTIFICATES` instead.\"", ")", ";", "// intentional fallthrough", "case", "TRUST_CUSTOM_CA_SIGNED_CERTIFICATES", ":", "return", "SecurityPlan", ".", "forCustomCASignedCertificates", "(", "trustStrategy", ".", "certFile", "(", ")", ",", "hostnameVerificationEnabled", ")", ";", "case", "TRUST_SYSTEM_CA_SIGNED_CERTIFICATES", ":", "return", "SecurityPlan", ".", "forSystemCASignedCertificates", "(", "hostnameVerificationEnabled", ")", ";", "case", "TRUST_ALL_CERTIFICATES", ":", "return", "SecurityPlan", ".", "forAllCertificates", "(", "hostnameVerificationEnabled", ")", ";", "default", ":", "throw", "new", "ClientException", "(", "\"Unknown TLS authentication strategy: \"", "+", "trustStrategy", ".", "strategy", "(", ")", ".", "name", "(", ")", ")", ";", "}", "}", "else", "{", "return", "insecure", "(", ")", ";", "}", "}" ]
/* Establish a complete SecurityPlan based on the details provided for driver construction.
[ "/", "*", "Establish", "a", "complete", "SecurityPlan", "based", "on", "the", "details", "provided", "for", "driver", "construction", "." ]
train
https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java#L290-L327
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuModuleGetGlobal
public static int cuModuleGetGlobal(CUdeviceptr dptr, long bytes[], CUmodule hmod, String name) { """ Returns a global pointer from a module. <pre> CUresult cuModuleGetGlobal ( CUdeviceptr* dptr, size_t* bytes, CUmodule hmod, const char* name ) </pre> <div> <p>Returns a global pointer from a module. Returns in <tt>*dptr</tt> and <tt>*bytes</tt> the base pointer and size of the global of name <tt>name</tt> located in module <tt>hmod</tt>. If no variable of that name exists, cuModuleGetGlobal() returns CUDA_ERROR_NOT_FOUND. Both parameters <tt>dptr</tt> and <tt>bytes</tt> are optional. If one of them is NULL, it is ignored. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param dptr Returned global device pointer @param bytes Returned global size in bytes @param hmod Module to retrieve global from @param name Name of global to retrieve @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_NOT_FOUND @see JCudaDriver#cuModuleGetFunction @see JCudaDriver#cuModuleGetTexRef @see JCudaDriver#cuModuleLoad @see JCudaDriver#cuModuleLoadData @see JCudaDriver#cuModuleLoadDataEx @see JCudaDriver#cuModuleLoadFatBinary @see JCudaDriver#cuModuleUnload """ return checkResult(cuModuleGetGlobalNative(dptr, bytes, hmod, name)); }
java
public static int cuModuleGetGlobal(CUdeviceptr dptr, long bytes[], CUmodule hmod, String name) { return checkResult(cuModuleGetGlobalNative(dptr, bytes, hmod, name)); }
[ "public", "static", "int", "cuModuleGetGlobal", "(", "CUdeviceptr", "dptr", ",", "long", "bytes", "[", "]", ",", "CUmodule", "hmod", ",", "String", "name", ")", "{", "return", "checkResult", "(", "cuModuleGetGlobalNative", "(", "dptr", ",", "bytes", ",", "hmod", ",", "name", ")", ")", ";", "}" ]
Returns a global pointer from a module. <pre> CUresult cuModuleGetGlobal ( CUdeviceptr* dptr, size_t* bytes, CUmodule hmod, const char* name ) </pre> <div> <p>Returns a global pointer from a module. Returns in <tt>*dptr</tt> and <tt>*bytes</tt> the base pointer and size of the global of name <tt>name</tt> located in module <tt>hmod</tt>. If no variable of that name exists, cuModuleGetGlobal() returns CUDA_ERROR_NOT_FOUND. Both parameters <tt>dptr</tt> and <tt>bytes</tt> are optional. If one of them is NULL, it is ignored. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param dptr Returned global device pointer @param bytes Returned global size in bytes @param hmod Module to retrieve global from @param name Name of global to retrieve @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_NOT_FOUND @see JCudaDriver#cuModuleGetFunction @see JCudaDriver#cuModuleGetTexRef @see JCudaDriver#cuModuleLoad @see JCudaDriver#cuModuleLoadData @see JCudaDriver#cuModuleLoadDataEx @see JCudaDriver#cuModuleLoadFatBinary @see JCudaDriver#cuModuleUnload
[ "Returns", "a", "global", "pointer", "from", "a", "module", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L2636-L2639
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/JobBuilder.java
JobBuilder.withIdentity
public JobBuilder withIdentity (final String name, final String group) { """ Use a <code>JobKey</code> with the given name and group to identify the JobDetail. <p> If none of the 'withIdentity' methods are set on the JobBuilder, then a random, unique JobKey will be generated. </p> @param name the name element for the Job's JobKey @param group the group element for the Job's JobKey @return the updated JobBuilder @see JobKey @see IJobDetail#getKey() """ m_aKey = new JobKey (name, group); return this; }
java
public JobBuilder withIdentity (final String name, final String group) { m_aKey = new JobKey (name, group); return this; }
[ "public", "JobBuilder", "withIdentity", "(", "final", "String", "name", ",", "final", "String", "group", ")", "{", "m_aKey", "=", "new", "JobKey", "(", "name", ",", "group", ")", ";", "return", "this", ";", "}" ]
Use a <code>JobKey</code> with the given name and group to identify the JobDetail. <p> If none of the 'withIdentity' methods are set on the JobBuilder, then a random, unique JobKey will be generated. </p> @param name the name element for the Job's JobKey @param group the group element for the Job's JobKey @return the updated JobBuilder @see JobKey @see IJobDetail#getKey()
[ "Use", "a", "<code", ">", "JobKey<", "/", "code", ">", "with", "the", "given", "name", "and", "group", "to", "identify", "the", "JobDetail", ".", "<p", ">", "If", "none", "of", "the", "withIdentity", "methods", "are", "set", "on", "the", "JobBuilder", "then", "a", "random", "unique", "JobKey", "will", "be", "generated", ".", "<", "/", "p", ">" ]
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/JobBuilder.java#L153-L157
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/OutputLayerUtil.java
OutputLayerUtil.validateOutputLayer
public static void validateOutputLayer(String layerName, Layer layer) { """ Validate the output layer (or loss layer) configuration, to detect invalid consfiugrations. A DL4JInvalidConfigException will be thrown for invalid configurations (like softmax + nOut=1).<br> If the specified layer is not an output layer, this is a no-op @param layerName Name of the layer @param layer Layer """ IActivation activation; ILossFunction loss; long nOut; boolean isLossLayer = false; if (layer instanceof BaseOutputLayer && !(layer instanceof OCNNOutputLayer)) { activation = ((BaseOutputLayer) layer).getActivationFn(); loss = ((BaseOutputLayer) layer).getLossFn(); nOut = ((BaseOutputLayer) layer).getNOut(); } else if (layer instanceof LossLayer) { activation = ((LossLayer) layer).getActivationFn(); loss = ((LossLayer) layer).getLossFn(); nOut = ((LossLayer) layer).getNOut(); isLossLayer = true; } else if (layer instanceof RnnLossLayer) { activation = ((RnnLossLayer) layer).getActivationFn(); loss = ((RnnLossLayer) layer).getLossFn(); nOut = ((RnnLossLayer) layer).getNOut(); isLossLayer = true; } else if (layer instanceof CnnLossLayer) { activation = ((CnnLossLayer) layer).getActivationFn(); loss = ((CnnLossLayer) layer).getLossFn(); nOut = ((CnnLossLayer) layer).getNOut(); isLossLayer = true; } else { //Not an output layer return; } OutputLayerUtil.validateOutputLayerConfiguration(layerName, nOut, isLossLayer, activation, loss); }
java
public static void validateOutputLayer(String layerName, Layer layer){ IActivation activation; ILossFunction loss; long nOut; boolean isLossLayer = false; if (layer instanceof BaseOutputLayer && !(layer instanceof OCNNOutputLayer)) { activation = ((BaseOutputLayer) layer).getActivationFn(); loss = ((BaseOutputLayer) layer).getLossFn(); nOut = ((BaseOutputLayer) layer).getNOut(); } else if (layer instanceof LossLayer) { activation = ((LossLayer) layer).getActivationFn(); loss = ((LossLayer) layer).getLossFn(); nOut = ((LossLayer) layer).getNOut(); isLossLayer = true; } else if (layer instanceof RnnLossLayer) { activation = ((RnnLossLayer) layer).getActivationFn(); loss = ((RnnLossLayer) layer).getLossFn(); nOut = ((RnnLossLayer) layer).getNOut(); isLossLayer = true; } else if (layer instanceof CnnLossLayer) { activation = ((CnnLossLayer) layer).getActivationFn(); loss = ((CnnLossLayer) layer).getLossFn(); nOut = ((CnnLossLayer) layer).getNOut(); isLossLayer = true; } else { //Not an output layer return; } OutputLayerUtil.validateOutputLayerConfiguration(layerName, nOut, isLossLayer, activation, loss); }
[ "public", "static", "void", "validateOutputLayer", "(", "String", "layerName", ",", "Layer", "layer", ")", "{", "IActivation", "activation", ";", "ILossFunction", "loss", ";", "long", "nOut", ";", "boolean", "isLossLayer", "=", "false", ";", "if", "(", "layer", "instanceof", "BaseOutputLayer", "&&", "!", "(", "layer", "instanceof", "OCNNOutputLayer", ")", ")", "{", "activation", "=", "(", "(", "BaseOutputLayer", ")", "layer", ")", ".", "getActivationFn", "(", ")", ";", "loss", "=", "(", "(", "BaseOutputLayer", ")", "layer", ")", ".", "getLossFn", "(", ")", ";", "nOut", "=", "(", "(", "BaseOutputLayer", ")", "layer", ")", ".", "getNOut", "(", ")", ";", "}", "else", "if", "(", "layer", "instanceof", "LossLayer", ")", "{", "activation", "=", "(", "(", "LossLayer", ")", "layer", ")", ".", "getActivationFn", "(", ")", ";", "loss", "=", "(", "(", "LossLayer", ")", "layer", ")", ".", "getLossFn", "(", ")", ";", "nOut", "=", "(", "(", "LossLayer", ")", "layer", ")", ".", "getNOut", "(", ")", ";", "isLossLayer", "=", "true", ";", "}", "else", "if", "(", "layer", "instanceof", "RnnLossLayer", ")", "{", "activation", "=", "(", "(", "RnnLossLayer", ")", "layer", ")", ".", "getActivationFn", "(", ")", ";", "loss", "=", "(", "(", "RnnLossLayer", ")", "layer", ")", ".", "getLossFn", "(", ")", ";", "nOut", "=", "(", "(", "RnnLossLayer", ")", "layer", ")", ".", "getNOut", "(", ")", ";", "isLossLayer", "=", "true", ";", "}", "else", "if", "(", "layer", "instanceof", "CnnLossLayer", ")", "{", "activation", "=", "(", "(", "CnnLossLayer", ")", "layer", ")", ".", "getActivationFn", "(", ")", ";", "loss", "=", "(", "(", "CnnLossLayer", ")", "layer", ")", ".", "getLossFn", "(", ")", ";", "nOut", "=", "(", "(", "CnnLossLayer", ")", "layer", ")", ".", "getNOut", "(", ")", ";", "isLossLayer", "=", "true", ";", "}", "else", "{", "//Not an output layer", "return", ";", "}", "OutputLayerUtil", ".", "validateOutputLayerConfiguration", "(", "layerName", ",", "nOut", ",", "isLossLayer", ",", "activation", ",", "loss", ")", ";", "}" ]
Validate the output layer (or loss layer) configuration, to detect invalid consfiugrations. A DL4JInvalidConfigException will be thrown for invalid configurations (like softmax + nOut=1).<br> If the specified layer is not an output layer, this is a no-op @param layerName Name of the layer @param layer Layer
[ "Validate", "the", "output", "layer", "(", "or", "loss", "layer", ")", "configuration", "to", "detect", "invalid", "consfiugrations", ".", "A", "DL4JInvalidConfigException", "will", "be", "thrown", "for", "invalid", "configurations", "(", "like", "softmax", "+", "nOut", "=", "1", ")", ".", "<br", ">" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/OutputLayerUtil.java#L74-L103
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java
CommandUtil.associateCommand
public static void associateCommand(String commandName, BaseUIComponent component) { """ Associates a UI component with a command. @param commandName Name of the command. @param component Component to be associated. """ associateCommand(commandName, component, (BaseUIComponent) null); }
java
public static void associateCommand(String commandName, BaseUIComponent component) { associateCommand(commandName, component, (BaseUIComponent) null); }
[ "public", "static", "void", "associateCommand", "(", "String", "commandName", ",", "BaseUIComponent", "component", ")", "{", "associateCommand", "(", "commandName", ",", "component", ",", "(", "BaseUIComponent", ")", "null", ")", ";", "}" ]
Associates a UI component with a command. @param commandName Name of the command. @param component Component to be associated.
[ "Associates", "a", "UI", "component", "with", "a", "command", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java#L176-L178
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClassUtility.java
ClassUtility.getLastClassAnnotation
public static <A extends Annotation> A getLastClassAnnotation(final Class<?> sourceClass, final Class<A> annotationClass) { """ Extract the last annotation requested found into the class hierarchy.<br /> Interfaces are not yet supported. @param sourceClass the class (wit its parent classes) to inspect @param annotationClass the annotation to find @param <A> the type of the requested annotation @return the request annotation or null if none have been found into the class hierarchy """ A annotation = null; Class<?> currentClass = sourceClass; while (annotation == null && currentClass != null) { annotation = currentClass.getAnnotation(annotationClass); currentClass = currentClass.getSuperclass(); } return annotation; }
java
public static <A extends Annotation> A getLastClassAnnotation(final Class<?> sourceClass, final Class<A> annotationClass) { A annotation = null; Class<?> currentClass = sourceClass; while (annotation == null && currentClass != null) { annotation = currentClass.getAnnotation(annotationClass); currentClass = currentClass.getSuperclass(); } return annotation; }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "getLastClassAnnotation", "(", "final", "Class", "<", "?", ">", "sourceClass", ",", "final", "Class", "<", "A", ">", "annotationClass", ")", "{", "A", "annotation", "=", "null", ";", "Class", "<", "?", ">", "currentClass", "=", "sourceClass", ";", "while", "(", "annotation", "==", "null", "&&", "currentClass", "!=", "null", ")", "{", "annotation", "=", "currentClass", ".", "getAnnotation", "(", "annotationClass", ")", ";", "currentClass", "=", "currentClass", ".", "getSuperclass", "(", ")", ";", "}", "return", "annotation", ";", "}" ]
Extract the last annotation requested found into the class hierarchy.<br /> Interfaces are not yet supported. @param sourceClass the class (wit its parent classes) to inspect @param annotationClass the annotation to find @param <A> the type of the requested annotation @return the request annotation or null if none have been found into the class hierarchy
[ "Extract", "the", "last", "annotation", "requested", "found", "into", "the", "class", "hierarchy", ".", "<br", "/", ">", "Interfaces", "are", "not", "yet", "supported", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClassUtility.java#L399-L407
mangstadt/biweekly
src/main/java/biweekly/util/com/google/ical/iter/RecurrenceIteratorFactory.java
RecurrenceIteratorFactory.join
public static RecurrenceIterator join(RecurrenceIterator first, RecurrenceIterator... rest) { """ Generates a recurrence iterator that iterates over the union of the given recurrence iterators. @param first the first recurrence iterator @param rest the other recurrence iterators @return the union iterator """ List<RecurrenceIterator> all = new ArrayList<RecurrenceIterator>(); all.add(first); all.addAll(Arrays.asList(rest)); return new CompoundIteratorImpl(all, Collections.<RecurrenceIterator> emptyList()); }
java
public static RecurrenceIterator join(RecurrenceIterator first, RecurrenceIterator... rest) { List<RecurrenceIterator> all = new ArrayList<RecurrenceIterator>(); all.add(first); all.addAll(Arrays.asList(rest)); return new CompoundIteratorImpl(all, Collections.<RecurrenceIterator> emptyList()); }
[ "public", "static", "RecurrenceIterator", "join", "(", "RecurrenceIterator", "first", ",", "RecurrenceIterator", "...", "rest", ")", "{", "List", "<", "RecurrenceIterator", ">", "all", "=", "new", "ArrayList", "<", "RecurrenceIterator", ">", "(", ")", ";", "all", ".", "add", "(", "first", ")", ";", "all", ".", "addAll", "(", "Arrays", ".", "asList", "(", "rest", ")", ")", ";", "return", "new", "CompoundIteratorImpl", "(", "all", ",", "Collections", ".", "<", "RecurrenceIterator", ">", "emptyList", "(", ")", ")", ";", "}" ]
Generates a recurrence iterator that iterates over the union of the given recurrence iterators. @param first the first recurrence iterator @param rest the other recurrence iterators @return the union iterator
[ "Generates", "a", "recurrence", "iterator", "that", "iterates", "over", "the", "union", "of", "the", "given", "recurrence", "iterators", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/RecurrenceIteratorFactory.java#L461-L466
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java
Whitebox.setInternalState
public static void setInternalState(Object object, String fieldName, Object value, Class<?> where) { """ Set the value of a field using reflection. Use this method when you need to specify in which class the field is declared. This might be useful when you have mocked the instance you are trying to modify. @param object the object to modify @param fieldName the name of the field @param value the new value of the field @param where the class in the hierarchy where the field is defined """ WhiteboxImpl.setInternalState(object, fieldName, value, where); }
java
public static void setInternalState(Object object, String fieldName, Object value, Class<?> where) { WhiteboxImpl.setInternalState(object, fieldName, value, where); }
[ "public", "static", "void", "setInternalState", "(", "Object", "object", ",", "String", "fieldName", ",", "Object", "value", ",", "Class", "<", "?", ">", "where", ")", "{", "WhiteboxImpl", ".", "setInternalState", "(", "object", ",", "fieldName", ",", "value", ",", "where", ")", ";", "}" ]
Set the value of a field using reflection. Use this method when you need to specify in which class the field is declared. This might be useful when you have mocked the instance you are trying to modify. @param object the object to modify @param fieldName the name of the field @param value the new value of the field @param where the class in the hierarchy where the field is defined
[ "Set", "the", "value", "of", "a", "field", "using", "reflection", ".", "Use", "this", "method", "when", "you", "need", "to", "specify", "in", "which", "class", "the", "field", "is", "declared", ".", "This", "might", "be", "useful", "when", "you", "have", "mocked", "the", "instance", "you", "are", "trying", "to", "modify", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L240-L242
infinispan/infinispan
server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheContainerRemoveHandler.java
CacheContainerRemoveHandler.recoverServices
@Override protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { """ Method to re-install any services associated with existing local caches. @param context @param operation @param model @throws OperationFailedException """ PathAddress address = context.getCurrentAddress(); // re-install the cache container services CacheContainerAddHandler.installRuntimeServices(context, operation, model); // re-install any existing cache services for (CacheType type: CacheType.values()) { CacheAdd addHandler = type.getAddHandler(); if (model.hasDefined(type.pathElement().getKey())) { for (Property property: model.get(type.pathElement().getKey()).asPropertyList()) { ModelNode addOperation = Util.createAddOperation(address.append(type.pathElement(property.getName()))); addHandler.installRuntimeServices(context, addOperation, model, property.getValue()); } } } }
java
@Override protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { PathAddress address = context.getCurrentAddress(); // re-install the cache container services CacheContainerAddHandler.installRuntimeServices(context, operation, model); // re-install any existing cache services for (CacheType type: CacheType.values()) { CacheAdd addHandler = type.getAddHandler(); if (model.hasDefined(type.pathElement().getKey())) { for (Property property: model.get(type.pathElement().getKey()).asPropertyList()) { ModelNode addOperation = Util.createAddOperation(address.append(type.pathElement(property.getName()))); addHandler.installRuntimeServices(context, addOperation, model, property.getValue()); } } } }
[ "@", "Override", "protected", "void", "recoverServices", "(", "OperationContext", "context", ",", "ModelNode", "operation", ",", "ModelNode", "model", ")", "throws", "OperationFailedException", "{", "PathAddress", "address", "=", "context", ".", "getCurrentAddress", "(", ")", ";", "// re-install the cache container services", "CacheContainerAddHandler", ".", "installRuntimeServices", "(", "context", ",", "operation", ",", "model", ")", ";", "// re-install any existing cache services", "for", "(", "CacheType", "type", ":", "CacheType", ".", "values", "(", ")", ")", "{", "CacheAdd", "addHandler", "=", "type", ".", "getAddHandler", "(", ")", ";", "if", "(", "model", ".", "hasDefined", "(", "type", ".", "pathElement", "(", ")", ".", "getKey", "(", ")", ")", ")", "{", "for", "(", "Property", "property", ":", "model", ".", "get", "(", "type", ".", "pathElement", "(", ")", ".", "getKey", "(", ")", ")", ".", "asPropertyList", "(", ")", ")", "{", "ModelNode", "addOperation", "=", "Util", ".", "createAddOperation", "(", "address", ".", "append", "(", "type", ".", "pathElement", "(", "property", ".", "getName", "(", ")", ")", ")", ")", ";", "addHandler", ".", "installRuntimeServices", "(", "context", ",", "addOperation", ",", "model", ",", "property", ".", "getValue", "(", ")", ")", ";", "}", "}", "}", "}" ]
Method to re-install any services associated with existing local caches. @param context @param operation @param model @throws OperationFailedException
[ "Method", "to", "re", "-", "install", "any", "services", "associated", "with", "existing", "local", "caches", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/CacheContainerRemoveHandler.java#L67-L85
knowm/Yank
src/main/java/org/knowm/yank/Yank.java
Yank.queryScalarSQLKey
public static <T> T queryScalarSQLKey( String poolName, String sqlKey, Class<T> scalarType, Object[] params) throws SQLStatementNotFoundException, YankSQLException { """ Return just one scalar given a SQL Key using an SQL statement matching the sqlKey String in a properties file loaded via Yank.addSQLStatements(...). If more than one row match the query, only the first row is returned. @param poolName The name of the connection pool to query against @param sqlKey The SQL Key found in a properties file corresponding to the desired SQL statement value @param scalarType The Class of the desired return scalar matching the table @param params The replacement parameters @return The Object @throws SQLStatementNotFoundException if an SQL statement could not be found for the given sqlKey String """ String sql = YANK_POOL_MANAGER.getMergedSqlProperties().getProperty(sqlKey); if (sql == null || sql.equalsIgnoreCase("")) { throw new SQLStatementNotFoundException(); } else { return queryScalar(poolName, sql, scalarType, params); } }
java
public static <T> T queryScalarSQLKey( String poolName, String sqlKey, Class<T> scalarType, Object[] params) throws SQLStatementNotFoundException, YankSQLException { String sql = YANK_POOL_MANAGER.getMergedSqlProperties().getProperty(sqlKey); if (sql == null || sql.equalsIgnoreCase("")) { throw new SQLStatementNotFoundException(); } else { return queryScalar(poolName, sql, scalarType, params); } }
[ "public", "static", "<", "T", ">", "T", "queryScalarSQLKey", "(", "String", "poolName", ",", "String", "sqlKey", ",", "Class", "<", "T", ">", "scalarType", ",", "Object", "[", "]", "params", ")", "throws", "SQLStatementNotFoundException", ",", "YankSQLException", "{", "String", "sql", "=", "YANK_POOL_MANAGER", ".", "getMergedSqlProperties", "(", ")", ".", "getProperty", "(", "sqlKey", ")", ";", "if", "(", "sql", "==", "null", "||", "sql", ".", "equalsIgnoreCase", "(", "\"\"", ")", ")", "{", "throw", "new", "SQLStatementNotFoundException", "(", ")", ";", "}", "else", "{", "return", "queryScalar", "(", "poolName", ",", "sql", ",", "scalarType", ",", "params", ")", ";", "}", "}" ]
Return just one scalar given a SQL Key using an SQL statement matching the sqlKey String in a properties file loaded via Yank.addSQLStatements(...). If more than one row match the query, only the first row is returned. @param poolName The name of the connection pool to query against @param sqlKey The SQL Key found in a properties file corresponding to the desired SQL statement value @param scalarType The Class of the desired return scalar matching the table @param params The replacement parameters @return The Object @throws SQLStatementNotFoundException if an SQL statement could not be found for the given sqlKey String
[ "Return", "just", "one", "scalar", "given", "a", "SQL", "Key", "using", "an", "SQL", "statement", "matching", "the", "sqlKey", "String", "in", "a", "properties", "file", "loaded", "via", "Yank", ".", "addSQLStatements", "(", "...", ")", ".", "If", "more", "than", "one", "row", "match", "the", "query", "only", "the", "first", "row", "is", "returned", "." ]
train
https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L253-L263
junit-team/junit4
src/main/java/org/junit/runners/ParentRunner.java
ParentRunner.withClassRules
private Statement withClassRules(Statement statement) { """ Returns a {@link Statement}: apply all static fields assignable to {@link TestRule} annotated with {@link ClassRule}. @param statement the base statement @return a RunRules statement if any class-level {@link Rule}s are found, or the base statement """ List<TestRule> classRules = classRules(); return classRules.isEmpty() ? statement : new RunRules(statement, classRules, getDescription()); }
java
private Statement withClassRules(Statement statement) { List<TestRule> classRules = classRules(); return classRules.isEmpty() ? statement : new RunRules(statement, classRules, getDescription()); }
[ "private", "Statement", "withClassRules", "(", "Statement", "statement", ")", "{", "List", "<", "TestRule", ">", "classRules", "=", "classRules", "(", ")", ";", "return", "classRules", ".", "isEmpty", "(", ")", "?", "statement", ":", "new", "RunRules", "(", "statement", ",", "classRules", ",", "getDescription", "(", ")", ")", ";", "}" ]
Returns a {@link Statement}: apply all static fields assignable to {@link TestRule} annotated with {@link ClassRule}. @param statement the base statement @return a RunRules statement if any class-level {@link Rule}s are found, or the base statement
[ "Returns", "a", "{", "@link", "Statement", "}", ":", "apply", "all", "static", "fields", "assignable", "to", "{", "@link", "TestRule", "}", "annotated", "with", "{", "@link", "ClassRule", "}", "." ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runners/ParentRunner.java#L266-L270
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroup.java
CommandGroup.createButtonBar
public JComponent createButtonBar(final ColumnSpec columnSpec, final RowSpec rowSpec, final Border border) { """ Create a button bar with buttons for all the commands in this. @param columnSpec Custom columnSpec for each column containing a button, can be <code>null</code>. @param rowSpec Custom rowspec for the buttonbar, can be <code>null</code>. @param border if null, then don't use a border @return never null """ final ButtonBarGroupContainerPopulator container = new ButtonBarGroupContainerPopulator(); container.setColumnSpec(columnSpec); container.setRowSpec(rowSpec); addCommandsToGroupContainer(container); return GuiStandardUtils.attachBorder(container.getButtonBar(), border); }
java
public JComponent createButtonBar(final ColumnSpec columnSpec, final RowSpec rowSpec, final Border border) { final ButtonBarGroupContainerPopulator container = new ButtonBarGroupContainerPopulator(); container.setColumnSpec(columnSpec); container.setRowSpec(rowSpec); addCommandsToGroupContainer(container); return GuiStandardUtils.attachBorder(container.getButtonBar(), border); }
[ "public", "JComponent", "createButtonBar", "(", "final", "ColumnSpec", "columnSpec", ",", "final", "RowSpec", "rowSpec", ",", "final", "Border", "border", ")", "{", "final", "ButtonBarGroupContainerPopulator", "container", "=", "new", "ButtonBarGroupContainerPopulator", "(", ")", ";", "container", ".", "setColumnSpec", "(", "columnSpec", ")", ";", "container", ".", "setRowSpec", "(", "rowSpec", ")", ";", "addCommandsToGroupContainer", "(", "container", ")", ";", "return", "GuiStandardUtils", ".", "attachBorder", "(", "container", ".", "getButtonBar", "(", ")", ",", "border", ")", ";", "}" ]
Create a button bar with buttons for all the commands in this. @param columnSpec Custom columnSpec for each column containing a button, can be <code>null</code>. @param rowSpec Custom rowspec for the buttonbar, can be <code>null</code>. @param border if null, then don't use a border @return never null
[ "Create", "a", "button", "bar", "with", "buttons", "for", "all", "the", "commands", "in", "this", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroup.java#L472-L478
ManfredTremmel/gwt-bean-validators
gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/impl/GroupChainGenerator.java
GroupChainGenerator.insertInheritedGroups
private void insertInheritedGroups(final Class<?> clazz, final GroupChain chain) { """ Recursively add inherited groups into the group chain. @param clazz The group interface @param chain The group chain we are currently building. """ validationGroupsMetadata.getParentsOfGroup(clazz).forEach(inheritedGroup -> { final Group group = new Group(inheritedGroup); chain.insertGroup(group); insertInheritedGroups(inheritedGroup, chain); }); }
java
private void insertInheritedGroups(final Class<?> clazz, final GroupChain chain) { validationGroupsMetadata.getParentsOfGroup(clazz).forEach(inheritedGroup -> { final Group group = new Group(inheritedGroup); chain.insertGroup(group); insertInheritedGroups(inheritedGroup, chain); }); }
[ "private", "void", "insertInheritedGroups", "(", "final", "Class", "<", "?", ">", "clazz", ",", "final", "GroupChain", "chain", ")", "{", "validationGroupsMetadata", ".", "getParentsOfGroup", "(", "clazz", ")", ".", "forEach", "(", "inheritedGroup", "->", "{", "final", "Group", "group", "=", "new", "Group", "(", "inheritedGroup", ")", ";", "chain", ".", "insertGroup", "(", "group", ")", ";", "insertInheritedGroups", "(", "inheritedGroup", ",", "chain", ")", ";", "}", ")", ";", "}" ]
Recursively add inherited groups into the group chain. @param clazz The group interface @param chain The group chain we are currently building.
[ "Recursively", "add", "inherited", "groups", "into", "the", "group", "chain", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/impl/GroupChainGenerator.java#L128-L134
Netflix/ribbon
ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java
ClientFactory.registerNamedLoadBalancerFromclientConfig
public static ILoadBalancer registerNamedLoadBalancerFromclientConfig(String name, IClientConfig clientConfig) throws ClientException { """ Create and register a load balancer with the name and given the class of configClass. @throws ClientException if load balancer with the same name already exists or any error occurs @see #instantiateInstanceWithClientConfig(String, IClientConfig) """ if (namedLBMap.get(name) != null) { throw new ClientException("LoadBalancer for name " + name + " already exists"); } ILoadBalancer lb = null; try { String loadBalancerClassName = clientConfig.getOrDefault(CommonClientConfigKey.NFLoadBalancerClassName); lb = (ILoadBalancer) ClientFactory.instantiateInstanceWithClientConfig(loadBalancerClassName, clientConfig); namedLBMap.put(name, lb); logger.info("Client: {} instantiated a LoadBalancer: {}", name, lb); return lb; } catch (Throwable e) { throw new ClientException("Unable to instantiate/associate LoadBalancer with Client:" + name, e); } }
java
public static ILoadBalancer registerNamedLoadBalancerFromclientConfig(String name, IClientConfig clientConfig) throws ClientException { if (namedLBMap.get(name) != null) { throw new ClientException("LoadBalancer for name " + name + " already exists"); } ILoadBalancer lb = null; try { String loadBalancerClassName = clientConfig.getOrDefault(CommonClientConfigKey.NFLoadBalancerClassName); lb = (ILoadBalancer) ClientFactory.instantiateInstanceWithClientConfig(loadBalancerClassName, clientConfig); namedLBMap.put(name, lb); logger.info("Client: {} instantiated a LoadBalancer: {}", name, lb); return lb; } catch (Throwable e) { throw new ClientException("Unable to instantiate/associate LoadBalancer with Client:" + name, e); } }
[ "public", "static", "ILoadBalancer", "registerNamedLoadBalancerFromclientConfig", "(", "String", "name", ",", "IClientConfig", "clientConfig", ")", "throws", "ClientException", "{", "if", "(", "namedLBMap", ".", "get", "(", "name", ")", "!=", "null", ")", "{", "throw", "new", "ClientException", "(", "\"LoadBalancer for name \"", "+", "name", "+", "\" already exists\"", ")", ";", "}", "ILoadBalancer", "lb", "=", "null", ";", "try", "{", "String", "loadBalancerClassName", "=", "clientConfig", ".", "getOrDefault", "(", "CommonClientConfigKey", ".", "NFLoadBalancerClassName", ")", ";", "lb", "=", "(", "ILoadBalancer", ")", "ClientFactory", ".", "instantiateInstanceWithClientConfig", "(", "loadBalancerClassName", ",", "clientConfig", ")", ";", "namedLBMap", ".", "put", "(", "name", ",", "lb", ")", ";", "logger", ".", "info", "(", "\"Client: {} instantiated a LoadBalancer: {}\"", ",", "name", ",", "lb", ")", ";", "return", "lb", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "throw", "new", "ClientException", "(", "\"Unable to instantiate/associate LoadBalancer with Client:\"", "+", "name", ",", "e", ")", ";", "}", "}" ]
Create and register a load balancer with the name and given the class of configClass. @throws ClientException if load balancer with the same name already exists or any error occurs @see #instantiateInstanceWithClientConfig(String, IClientConfig)
[ "Create", "and", "register", "a", "load", "balancer", "with", "the", "name", "and", "given", "the", "class", "of", "configClass", "." ]
train
https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java#L178-L192
wcm-io/wcm-io-handler
url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java
SuffixParser.getResource
public @Nullable Resource getResource(@NotNull Predicate<Resource> filter) { """ Parse the suffix as resource paths, return the first resource from the suffix (relativ to the current page's content) that matches the given filter. @param filter a filter that selects only the resource you're interested in. @return the resource or null if no such resource was selected by suffix """ return getResource(filter, (Resource)null); }
java
public @Nullable Resource getResource(@NotNull Predicate<Resource> filter) { return getResource(filter, (Resource)null); }
[ "public", "@", "Nullable", "Resource", "getResource", "(", "@", "NotNull", "Predicate", "<", "Resource", ">", "filter", ")", "{", "return", "getResource", "(", "filter", ",", "(", "Resource", ")", "null", ")", ";", "}" ]
Parse the suffix as resource paths, return the first resource from the suffix (relativ to the current page's content) that matches the given filter. @param filter a filter that selects only the resource you're interested in. @return the resource or null if no such resource was selected by suffix
[ "Parse", "the", "suffix", "as", "resource", "paths", "return", "the", "first", "resource", "from", "the", "suffix", "(", "relativ", "to", "the", "current", "page", "s", "content", ")", "that", "matches", "the", "given", "filter", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java#L208-L210
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java
AbstractAsymmetricCrypto.encrypt
public byte[] encrypt(String data, KeyType keyType) { """ 加密,使用UTF-8编码 @param data 被加密的字符串 @param keyType 私钥或公钥 {@link KeyType} @return 加密后的bytes """ return encrypt(StrUtil.bytes(data, CharsetUtil.CHARSET_UTF_8), keyType); }
java
public byte[] encrypt(String data, KeyType keyType) { return encrypt(StrUtil.bytes(data, CharsetUtil.CHARSET_UTF_8), keyType); }
[ "public", "byte", "[", "]", "encrypt", "(", "String", "data", ",", "KeyType", "keyType", ")", "{", "return", "encrypt", "(", "StrUtil", ".", "bytes", "(", "data", ",", "CharsetUtil", ".", "CHARSET_UTF_8", ")", ",", "keyType", ")", ";", "}" ]
加密,使用UTF-8编码 @param data 被加密的字符串 @param keyType 私钥或公钥 {@link KeyType} @return 加密后的bytes
[ "加密,使用UTF", "-", "8编码" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L100-L102
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java
CmsFocalPointController.updateImage
public void updateImage(FlowPanel container, Image previewImage) { """ Updates the image.<p> @param container the parent widget for the image @param previewImage the image """ if (!ENABLED) { return; } String path = m_imageInfoProvider.get().getResourcePath(); if (CmsClientStringUtil.checkIsPathOrLinkToSvg(path)) { return; } m_image = previewImage; clearImagePoint(); m_savedFocalPoint = m_imageInfoProvider.get().getFocalPoint(); m_focalPoint = m_savedFocalPoint; m_container = container; previewImage.addLoadHandler(new LoadHandler() { @SuppressWarnings("synthetic-access") public void onLoad(LoadEvent event) { updateScaling(); updatePoint(); } }); }
java
public void updateImage(FlowPanel container, Image previewImage) { if (!ENABLED) { return; } String path = m_imageInfoProvider.get().getResourcePath(); if (CmsClientStringUtil.checkIsPathOrLinkToSvg(path)) { return; } m_image = previewImage; clearImagePoint(); m_savedFocalPoint = m_imageInfoProvider.get().getFocalPoint(); m_focalPoint = m_savedFocalPoint; m_container = container; previewImage.addLoadHandler(new LoadHandler() { @SuppressWarnings("synthetic-access") public void onLoad(LoadEvent event) { updateScaling(); updatePoint(); } }); }
[ "public", "void", "updateImage", "(", "FlowPanel", "container", ",", "Image", "previewImage", ")", "{", "if", "(", "!", "ENABLED", ")", "{", "return", ";", "}", "String", "path", "=", "m_imageInfoProvider", ".", "get", "(", ")", ".", "getResourcePath", "(", ")", ";", "if", "(", "CmsClientStringUtil", ".", "checkIsPathOrLinkToSvg", "(", "path", ")", ")", "{", "return", ";", "}", "m_image", "=", "previewImage", ";", "clearImagePoint", "(", ")", ";", "m_savedFocalPoint", "=", "m_imageInfoProvider", ".", "get", "(", ")", ".", "getFocalPoint", "(", ")", ";", "m_focalPoint", "=", "m_savedFocalPoint", ";", "m_container", "=", "container", ";", "previewImage", ".", "addLoadHandler", "(", "new", "LoadHandler", "(", ")", "{", "@", "SuppressWarnings", "(", "\"synthetic-access\"", ")", "public", "void", "onLoad", "(", "LoadEvent", "event", ")", "{", "updateScaling", "(", ")", ";", "updatePoint", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates the image.<p> @param container the parent widget for the image @param previewImage the image
[ "Updates", "the", "image", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java#L224-L249
sebastiangraf/jSCSI
bundles/target/src/main/java/org/jscsi/target/settings/SettingsNegotiator.java
SettingsNegotiator.getEntry
static final Entry getEntry (final String key, final Collection<Entry> entries) { """ Returns the first {@link Entry} in the specified {@link Collection} for which {@link Entry#matchKey(String)} returns <code>true</code>. @param key the key String identifying the {@link Entry} @param entries a {@link Collection} of {@link Entry} objects. @return a matching {@link Entry} or null, if no such {@link Entry} exists """ for (Entry e : entries) if (e.matchKey(key)) return e; return null; }
java
static final Entry getEntry (final String key, final Collection<Entry> entries) { for (Entry e : entries) if (e.matchKey(key)) return e; return null; }
[ "static", "final", "Entry", "getEntry", "(", "final", "String", "key", ",", "final", "Collection", "<", "Entry", ">", "entries", ")", "{", "for", "(", "Entry", "e", ":", "entries", ")", "if", "(", "e", ".", "matchKey", "(", "key", ")", ")", "return", "e", ";", "return", "null", ";", "}" ]
Returns the first {@link Entry} in the specified {@link Collection} for which {@link Entry#matchKey(String)} returns <code>true</code>. @param key the key String identifying the {@link Entry} @param entries a {@link Collection} of {@link Entry} objects. @return a matching {@link Entry} or null, if no such {@link Entry} exists
[ "Returns", "the", "first", "{", "@link", "Entry", "}", "in", "the", "specified", "{", "@link", "Collection", "}", "for", "which", "{", "@link", "Entry#matchKey", "(", "String", ")", "}", "returns", "<code", ">", "true<", "/", "code", ">", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/target/src/main/java/org/jscsi/target/settings/SettingsNegotiator.java#L43-L47
zaproxy/zaproxy
src/org/zaproxy/zap/extension/script/ExtensionScript.java
ExtensionScript.getScriptCount
public int getScriptCount(File dir) { """ Gets the numbers of scripts for the given directory for the currently registered script engines and types. @param dir the directory to check. @return the number of scripts. @since 2.4.1 """ int scripts = 0; for (ScriptType type : this.getScriptTypes()) { File locDir = new File(dir, type.getName()); if (locDir.exists()) { for (File f : locDir.listFiles()) { String ext = f.getName().substring(f.getName().lastIndexOf(".") + 1); String engineName = this.getEngineNameForExtension(ext); if (engineName != null) { scripts++; } } } } return scripts; }
java
public int getScriptCount(File dir) { int scripts = 0; for (ScriptType type : this.getScriptTypes()) { File locDir = new File(dir, type.getName()); if (locDir.exists()) { for (File f : locDir.listFiles()) { String ext = f.getName().substring(f.getName().lastIndexOf(".") + 1); String engineName = this.getEngineNameForExtension(ext); if (engineName != null) { scripts++; } } } } return scripts; }
[ "public", "int", "getScriptCount", "(", "File", "dir", ")", "{", "int", "scripts", "=", "0", ";", "for", "(", "ScriptType", "type", ":", "this", ".", "getScriptTypes", "(", ")", ")", "{", "File", "locDir", "=", "new", "File", "(", "dir", ",", "type", ".", "getName", "(", ")", ")", ";", "if", "(", "locDir", ".", "exists", "(", ")", ")", "{", "for", "(", "File", "f", ":", "locDir", ".", "listFiles", "(", ")", ")", "{", "String", "ext", "=", "f", ".", "getName", "(", ")", ".", "substring", "(", "f", ".", "getName", "(", ")", ".", "lastIndexOf", "(", "\".\"", ")", "+", "1", ")", ";", "String", "engineName", "=", "this", ".", "getEngineNameForExtension", "(", "ext", ")", ";", "if", "(", "engineName", "!=", "null", ")", "{", "scripts", "++", ";", "}", "}", "}", "}", "return", "scripts", ";", "}" ]
Gets the numbers of scripts for the given directory for the currently registered script engines and types. @param dir the directory to check. @return the number of scripts. @since 2.4.1
[ "Gets", "the", "numbers", "of", "scripts", "for", "the", "given", "directory", "for", "the", "currently", "registered", "script", "engines", "and", "types", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ExtensionScript.java#L983-L999
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/SubClass.java
SubClass.resolveFieldIndex
private int resolveFieldIndex(TypeElement declaringClass, String name, String descriptor) { """ Returns the constant map index to field If entry doesn't exist it is created. @param declaringClass @param name @param descriptor @return """ int size = 0; int index = 0; constantReadLock.lock(); try { size = getConstantPoolSize(); index = getRefIndex(Fieldref.class, declaringClass.getQualifiedName().toString(), name, descriptor); } finally { constantReadLock.unlock(); } if (index == -1) { // add entry to constant pool int ci = resolveClassIndex(declaringClass); int nati = resolveNameAndTypeIndex(name, descriptor); return addConstantInfo(new Fieldref(ci, nati), size); } return index; }
java
private int resolveFieldIndex(TypeElement declaringClass, String name, String descriptor) { int size = 0; int index = 0; constantReadLock.lock(); try { size = getConstantPoolSize(); index = getRefIndex(Fieldref.class, declaringClass.getQualifiedName().toString(), name, descriptor); } finally { constantReadLock.unlock(); } if (index == -1) { // add entry to constant pool int ci = resolveClassIndex(declaringClass); int nati = resolveNameAndTypeIndex(name, descriptor); return addConstantInfo(new Fieldref(ci, nati), size); } return index; }
[ "private", "int", "resolveFieldIndex", "(", "TypeElement", "declaringClass", ",", "String", "name", ",", "String", "descriptor", ")", "{", "int", "size", "=", "0", ";", "int", "index", "=", "0", ";", "constantReadLock", ".", "lock", "(", ")", ";", "try", "{", "size", "=", "getConstantPoolSize", "(", ")", ";", "index", "=", "getRefIndex", "(", "Fieldref", ".", "class", ",", "declaringClass", ".", "getQualifiedName", "(", ")", ".", "toString", "(", ")", ",", "name", ",", "descriptor", ")", ";", "}", "finally", "{", "constantReadLock", ".", "unlock", "(", ")", ";", "}", "if", "(", "index", "==", "-", "1", ")", "{", "// add entry to constant pool\r", "int", "ci", "=", "resolveClassIndex", "(", "declaringClass", ")", ";", "int", "nati", "=", "resolveNameAndTypeIndex", "(", "name", ",", "descriptor", ")", ";", "return", "addConstantInfo", "(", "new", "Fieldref", "(", "ci", ",", "nati", ")", ",", "size", ")", ";", "}", "return", "index", ";", "}" ]
Returns the constant map index to field If entry doesn't exist it is created. @param declaringClass @param name @param descriptor @return
[ "Returns", "the", "constant", "map", "index", "to", "field", "If", "entry", "doesn", "t", "exist", "it", "is", "created", "." ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L195-L217
maddingo/sojo
src/main/java/net/sf/sojo/core/reflect/Property.java
Property.executeSetValue
public void executeSetValue(Object pvObject, Object pvArgs) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { """ Call the setter Method or set value from Field. @param pvObject Object, on which the value is set @param pvArgs the set value """ AccessController.doPrivileged(new AccessiblePrivilegedAction(accessibleObject)); if (propertyType == PROPERTY_TYPE_METHOD) { ((Method) accessibleObject).invoke(pvObject, new Object[] { pvArgs }); } else { ((Field) accessibleObject).set(pvObject, pvArgs); } }
java
public void executeSetValue(Object pvObject, Object pvArgs) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { AccessController.doPrivileged(new AccessiblePrivilegedAction(accessibleObject)); if (propertyType == PROPERTY_TYPE_METHOD) { ((Method) accessibleObject).invoke(pvObject, new Object[] { pvArgs }); } else { ((Field) accessibleObject).set(pvObject, pvArgs); } }
[ "public", "void", "executeSetValue", "(", "Object", "pvObject", ",", "Object", "pvArgs", ")", "throws", "IllegalArgumentException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "AccessController", ".", "doPrivileged", "(", "new", "AccessiblePrivilegedAction", "(", "accessibleObject", ")", ")", ";", "if", "(", "propertyType", "==", "PROPERTY_TYPE_METHOD", ")", "{", "(", "(", "Method", ")", "accessibleObject", ")", ".", "invoke", "(", "pvObject", ",", "new", "Object", "[", "]", "{", "pvArgs", "}", ")", ";", "}", "else", "{", "(", "(", "Field", ")", "accessibleObject", ")", ".", "set", "(", "pvObject", ",", "pvArgs", ")", ";", "}", "}" ]
Call the setter Method or set value from Field. @param pvObject Object, on which the value is set @param pvArgs the set value
[ "Call", "the", "setter", "Method", "or", "set", "value", "from", "Field", "." ]
train
https://github.com/maddingo/sojo/blob/99e9e0a146b502deb7f507fe0623227402ed675b/src/main/java/net/sf/sojo/core/reflect/Property.java#L58-L65
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/TextMessageBuilder.java
TextMessageBuilder.build
public FbBotMillResponse build(MessageEnvelope envelope) { """ {@inheritDoc} Returns a response containing a plain text message. """ User recipient = getRecipient(envelope); Message message = new TextMessage(messageText); message.setQuickReplies(quickReplies); return new FbBotMillMessageResponse(recipient, message); }
java
public FbBotMillResponse build(MessageEnvelope envelope) { User recipient = getRecipient(envelope); Message message = new TextMessage(messageText); message.setQuickReplies(quickReplies); return new FbBotMillMessageResponse(recipient, message); }
[ "public", "FbBotMillResponse", "build", "(", "MessageEnvelope", "envelope", ")", "{", "User", "recipient", "=", "getRecipient", "(", "envelope", ")", ";", "Message", "message", "=", "new", "TextMessage", "(", "messageText", ")", ";", "message", ".", "setQuickReplies", "(", "quickReplies", ")", ";", "return", "new", "FbBotMillMessageResponse", "(", "recipient", ",", "message", ")", ";", "}" ]
{@inheritDoc} Returns a response containing a plain text message.
[ "{" ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/TextMessageBuilder.java#L142-L147
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/ToolScreen.java
ToolScreen.getNextLocation
public ScreenLocation getNextLocation(short position, short setNewAnchor) { """ Code this position and Anchor to add it to the LayoutManager. @param position The location constant (see ScreenConstants). @param setNewAnchor The anchor constant. @return The new screen location object. """ if (position == ScreenConstants.FIRST_LOCATION) position = ScreenConstants.FIRST_FIELD_BUTTON_LOCATION; if (position == ScreenConstants.NEXT_LOGICAL) position = ScreenConstants.RIGHT_OF_LAST_BUTTON; return super.getNextLocation(position, setNewAnchor); }
java
public ScreenLocation getNextLocation(short position, short setNewAnchor) { if (position == ScreenConstants.FIRST_LOCATION) position = ScreenConstants.FIRST_FIELD_BUTTON_LOCATION; if (position == ScreenConstants.NEXT_LOGICAL) position = ScreenConstants.RIGHT_OF_LAST_BUTTON; return super.getNextLocation(position, setNewAnchor); }
[ "public", "ScreenLocation", "getNextLocation", "(", "short", "position", ",", "short", "setNewAnchor", ")", "{", "if", "(", "position", "==", "ScreenConstants", ".", "FIRST_LOCATION", ")", "position", "=", "ScreenConstants", ".", "FIRST_FIELD_BUTTON_LOCATION", ";", "if", "(", "position", "==", "ScreenConstants", ".", "NEXT_LOGICAL", ")", "position", "=", "ScreenConstants", ".", "RIGHT_OF_LAST_BUTTON", ";", "return", "super", ".", "getNextLocation", "(", "position", ",", "setNewAnchor", ")", ";", "}" ]
Code this position and Anchor to add it to the LayoutManager. @param position The location constant (see ScreenConstants). @param setNewAnchor The anchor constant. @return The new screen location object.
[ "Code", "this", "position", "and", "Anchor", "to", "add", "it", "to", "the", "LayoutManager", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ToolScreen.java#L99-L106
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.selectField
private TaskField selectField(TaskField[] fields, int index) { """ Maps a field index to a TaskField instance. @param fields array of fields used as the basis for the mapping. @param index required field index @return TaskField instance """ if (index < 1 || index > fields.length) { throw new IllegalArgumentException(index + " is not a valid field index"); } return (fields[index - 1]); }
java
private TaskField selectField(TaskField[] fields, int index) { if (index < 1 || index > fields.length) { throw new IllegalArgumentException(index + " is not a valid field index"); } return (fields[index - 1]); }
[ "private", "TaskField", "selectField", "(", "TaskField", "[", "]", "fields", ",", "int", "index", ")", "{", "if", "(", "index", "<", "1", "||", "index", ">", "fields", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "index", "+", "\" is not a valid field index\"", ")", ";", "}", "return", "(", "fields", "[", "index", "-", "1", "]", ")", ";", "}" ]
Maps a field index to a TaskField instance. @param fields array of fields used as the basis for the mapping. @param index required field index @return TaskField instance
[ "Maps", "a", "field", "index", "to", "a", "TaskField", "instance", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4670-L4677
knowm/XChange
xchange-bitcoinium/src/main/java/org/knowm/xchange/bitcoinium/BitcoiniumAdapters.java
BitcoiniumAdapters.adaptOrderbook
public static OrderBook adaptOrderbook( BitcoiniumOrderbook bitcoiniumOrderbook, CurrencyPair currencyPair) { """ Adapts a BitcoiniumOrderbook to a OrderBook Object @param bitcoiniumOrderbook @return the XChange OrderBook """ List<LimitOrder> asks = createOrders(currencyPair, Order.OrderType.ASK, bitcoiniumOrderbook.getAsks()); List<LimitOrder> bids = createOrders(currencyPair, Order.OrderType.BID, bitcoiniumOrderbook.getBids()); Date date = new Date( bitcoiniumOrderbook .getBitcoiniumTicker() .getTimestamp()); // Note, this is the timestamp of the piggy-backed Ticker. return new OrderBook(date, asks, bids); }
java
public static OrderBook adaptOrderbook( BitcoiniumOrderbook bitcoiniumOrderbook, CurrencyPair currencyPair) { List<LimitOrder> asks = createOrders(currencyPair, Order.OrderType.ASK, bitcoiniumOrderbook.getAsks()); List<LimitOrder> bids = createOrders(currencyPair, Order.OrderType.BID, bitcoiniumOrderbook.getBids()); Date date = new Date( bitcoiniumOrderbook .getBitcoiniumTicker() .getTimestamp()); // Note, this is the timestamp of the piggy-backed Ticker. return new OrderBook(date, asks, bids); }
[ "public", "static", "OrderBook", "adaptOrderbook", "(", "BitcoiniumOrderbook", "bitcoiniumOrderbook", ",", "CurrencyPair", "currencyPair", ")", "{", "List", "<", "LimitOrder", ">", "asks", "=", "createOrders", "(", "currencyPair", ",", "Order", ".", "OrderType", ".", "ASK", ",", "bitcoiniumOrderbook", ".", "getAsks", "(", ")", ")", ";", "List", "<", "LimitOrder", ">", "bids", "=", "createOrders", "(", "currencyPair", ",", "Order", ".", "OrderType", ".", "BID", ",", "bitcoiniumOrderbook", ".", "getBids", "(", ")", ")", ";", "Date", "date", "=", "new", "Date", "(", "bitcoiniumOrderbook", ".", "getBitcoiniumTicker", "(", ")", ".", "getTimestamp", "(", ")", ")", ";", "// Note, this is the timestamp of the piggy-backed Ticker.", "return", "new", "OrderBook", "(", "date", ",", "asks", ",", "bids", ")", ";", "}" ]
Adapts a BitcoiniumOrderbook to a OrderBook Object @param bitcoiniumOrderbook @return the XChange OrderBook
[ "Adapts", "a", "BitcoiniumOrderbook", "to", "a", "OrderBook", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitcoinium/src/main/java/org/knowm/xchange/bitcoinium/BitcoiniumAdapters.java#L54-L67
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/text/inflector/RuleBasedPluralizer.java
RuleBasedPluralizer.postProcess
protected String postProcess(String trimmedWord, String pluralizedWord) { """ <p> Apply processing to <code>pluralizedWord</code>. This implementation ensures the case of the plural is consistent with the case of the input word. </p> <p> If <code>trimmedWord</code> is all uppercase, then <code>pluralizedWord</code> is uppercased. If <code>trimmedWord</code> is titlecase, then <code>pluralizedWord</code> is titlecased. </p> @param trimmedWord the input word, with leading and trailing whitespace removed @param pluralizedWord the pluralized word @return the <code>pluralizedWord</code> after processing """ if (pluPattern1.matcher(trimmedWord).matches()) { return pluralizedWord.toUpperCase(locale); } else if (pluPattern2.matcher(trimmedWord).matches()) { return pluralizedWord.substring(0, 1) .toUpperCase(locale) + pluralizedWord.substring(1); } return pluralizedWord; }
java
protected String postProcess(String trimmedWord, String pluralizedWord) { if (pluPattern1.matcher(trimmedWord).matches()) { return pluralizedWord.toUpperCase(locale); } else if (pluPattern2.matcher(trimmedWord).matches()) { return pluralizedWord.substring(0, 1) .toUpperCase(locale) + pluralizedWord.substring(1); } return pluralizedWord; }
[ "protected", "String", "postProcess", "(", "String", "trimmedWord", ",", "String", "pluralizedWord", ")", "{", "if", "(", "pluPattern1", ".", "matcher", "(", "trimmedWord", ")", ".", "matches", "(", ")", ")", "{", "return", "pluralizedWord", ".", "toUpperCase", "(", "locale", ")", ";", "}", "else", "if", "(", "pluPattern2", ".", "matcher", "(", "trimmedWord", ")", ".", "matches", "(", ")", ")", "{", "return", "pluralizedWord", ".", "substring", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", "locale", ")", "+", "pluralizedWord", ".", "substring", "(", "1", ")", ";", "}", "return", "pluralizedWord", ";", "}" ]
<p> Apply processing to <code>pluralizedWord</code>. This implementation ensures the case of the plural is consistent with the case of the input word. </p> <p> If <code>trimmedWord</code> is all uppercase, then <code>pluralizedWord</code> is uppercased. If <code>trimmedWord</code> is titlecase, then <code>pluralizedWord</code> is titlecased. </p> @param trimmedWord the input word, with leading and trailing whitespace removed @param pluralizedWord the pluralized word @return the <code>pluralizedWord</code> after processing
[ "<p", ">", "Apply", "processing", "to", "<code", ">", "pluralizedWord<", "/", "code", ">", ".", "This", "implementation", "ensures", "the", "case", "of", "the", "plural", "is", "consistent", "with", "the", "case", "of", "the", "input", "word", ".", "<", "/", "p", ">", "<p", ">", "If", "<code", ">", "trimmedWord<", "/", "code", ">", "is", "all", "uppercase", "then", "<code", ">", "pluralizedWord<", "/", "code", ">", "is", "uppercased", ".", "If", "<code", ">", "trimmedWord<", "/", "code", ">", "is", "titlecase", "then", "<code", ">", "pluralizedWord<", "/", "code", ">", "is", "titlecased", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/text/inflector/RuleBasedPluralizer.java#L241-L247
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/LongExtensions.java
LongExtensions.operator_modulo
@Pure @Inline(value="($1 % $2)", constantExpression=true) public static double operator_modulo(long a, double b) { """ The binary <code>modulo</code> operator. This is the equivalent to the Java <code>%</code> operator. @param a a long. @param b a double. @return <code>a%b</code> @since 2.3 """ return a % b; }
java
@Pure @Inline(value="($1 % $2)", constantExpression=true) public static double operator_modulo(long a, double b) { return a % b; }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"($1 % $2)\"", ",", "constantExpression", "=", "true", ")", "public", "static", "double", "operator_modulo", "(", "long", "a", ",", "double", "b", ")", "{", "return", "a", "%", "b", ";", "}" ]
The binary <code>modulo</code> operator. This is the equivalent to the Java <code>%</code> operator. @param a a long. @param b a double. @return <code>a%b</code> @since 2.3
[ "The", "binary", "<code", ">", "modulo<", "/", "code", ">", "operator", ".", "This", "is", "the", "equivalent", "to", "the", "Java", "<code", ">", "%<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/LongExtensions.java#L306-L310
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.popBrowserHistory
public void popBrowserHistory(int quanityToPop, boolean bCommandHandledByJava, String browserTitle) { """ Pop commands off the browser stack. @param quanityToPop The number of commands to pop off the stack @param bCommandHandledByJava If I say false, the browser will do a 'back', otherwise, it just pops to top command(s) """ if (this.getBrowserManager() != null) this.getBrowserManager().popBrowserHistory(quanityToPop, bCommandHandledByJava, this.getStatusText(Constants.INFORMATION)); // Let browser know about the new screen }
java
public void popBrowserHistory(int quanityToPop, boolean bCommandHandledByJava, String browserTitle) { if (this.getBrowserManager() != null) this.getBrowserManager().popBrowserHistory(quanityToPop, bCommandHandledByJava, this.getStatusText(Constants.INFORMATION)); // Let browser know about the new screen }
[ "public", "void", "popBrowserHistory", "(", "int", "quanityToPop", ",", "boolean", "bCommandHandledByJava", ",", "String", "browserTitle", ")", "{", "if", "(", "this", ".", "getBrowserManager", "(", ")", "!=", "null", ")", "this", ".", "getBrowserManager", "(", ")", ".", "popBrowserHistory", "(", "quanityToPop", ",", "bCommandHandledByJava", ",", "this", ".", "getStatusText", "(", "Constants", ".", "INFORMATION", ")", ")", ";", "// Let browser know about the new screen", "}" ]
Pop commands off the browser stack. @param quanityToPop The number of commands to pop off the stack @param bCommandHandledByJava If I say false, the browser will do a 'back', otherwise, it just pops to top command(s)
[ "Pop", "commands", "off", "the", "browser", "stack", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1279-L1283
haifengl/smile
math/src/main/java/smile/math/Math.java
Math.KullbackLeiblerDivergence
public static double KullbackLeiblerDivergence(double[] x, double[] y) { """ Kullback-Leibler divergence. The Kullback-Leibler divergence (also information divergence, information gain, relative entropy, or KLIC) is a non-symmetric measure of the difference between two probability distributions P and Q. KL measures the expected number of extra bits required to code samples from P when using a code based on Q, rather than using a code based on P. Typically P represents the "true" distribution of data, observations, or a precise calculated theoretical distribution. The measure Q typically represents a theory, model, description, or approximation of P. <p> Although it is often intuited as a distance metric, the KL divergence is not a true metric - for example, the KL from P to Q is not necessarily the same as the KL from Q to P. """ boolean intersection = false; double kl = 0.0; for (int i = 0; i < x.length; i++) { if (x[i] != 0.0 && y[i] != 0.0) { intersection = true; kl += x[i] * Math.log(x[i] / y[i]); } } if (intersection) { return kl; } else { return Double.POSITIVE_INFINITY; } }
java
public static double KullbackLeiblerDivergence(double[] x, double[] y) { boolean intersection = false; double kl = 0.0; for (int i = 0; i < x.length; i++) { if (x[i] != 0.0 && y[i] != 0.0) { intersection = true; kl += x[i] * Math.log(x[i] / y[i]); } } if (intersection) { return kl; } else { return Double.POSITIVE_INFINITY; } }
[ "public", "static", "double", "KullbackLeiblerDivergence", "(", "double", "[", "]", "x", ",", "double", "[", "]", "y", ")", "{", "boolean", "intersection", "=", "false", ";", "double", "kl", "=", "0.0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "x", ".", "length", ";", "i", "++", ")", "{", "if", "(", "x", "[", "i", "]", "!=", "0.0", "&&", "y", "[", "i", "]", "!=", "0.0", ")", "{", "intersection", "=", "true", ";", "kl", "+=", "x", "[", "i", "]", "*", "Math", ".", "log", "(", "x", "[", "i", "]", "/", "y", "[", "i", "]", ")", ";", "}", "}", "if", "(", "intersection", ")", "{", "return", "kl", ";", "}", "else", "{", "return", "Double", ".", "POSITIVE_INFINITY", ";", "}", "}" ]
Kullback-Leibler divergence. The Kullback-Leibler divergence (also information divergence, information gain, relative entropy, or KLIC) is a non-symmetric measure of the difference between two probability distributions P and Q. KL measures the expected number of extra bits required to code samples from P when using a code based on Q, rather than using a code based on P. Typically P represents the "true" distribution of data, observations, or a precise calculated theoretical distribution. The measure Q typically represents a theory, model, description, or approximation of P. <p> Although it is often intuited as a distance metric, the KL divergence is not a true metric - for example, the KL from P to Q is not necessarily the same as the KL from Q to P.
[ "Kullback", "-", "Leibler", "divergence", ".", "The", "Kullback", "-", "Leibler", "divergence", "(", "also", "information", "divergence", "information", "gain", "relative", "entropy", "or", "KLIC", ")", "is", "a", "non", "-", "symmetric", "measure", "of", "the", "difference", "between", "two", "probability", "distributions", "P", "and", "Q", ".", "KL", "measures", "the", "expected", "number", "of", "extra", "bits", "required", "to", "code", "samples", "from", "P", "when", "using", "a", "code", "based", "on", "Q", "rather", "than", "using", "a", "code", "based", "on", "P", ".", "Typically", "P", "represents", "the", "true", "distribution", "of", "data", "observations", "or", "a", "precise", "calculated", "theoretical", "distribution", ".", "The", "measure", "Q", "typically", "represents", "a", "theory", "model", "description", "or", "approximation", "of", "P", ".", "<p", ">", "Although", "it", "is", "often", "intuited", "as", "a", "distance", "metric", "the", "KL", "divergence", "is", "not", "a", "true", "metric", "-", "for", "example", "the", "KL", "from", "P", "to", "Q", "is", "not", "necessarily", "the", "same", "as", "the", "KL", "from", "Q", "to", "P", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Math.java#L2255-L2271
aws/aws-sdk-java
aws-java-sdk-lightsail/src/main/java/com/amazonaws/services/lightsail/model/DomainEntry.java
DomainEntry.setOptions
@Deprecated public void setOptions(java.util.Map<String, String> options) { """ <p> (Deprecated) The options for the domain entry. </p> <note> <p> In releases prior to November 29, 2017, this parameter was not included in the API response. It is now deprecated. </p> </note> @param options (Deprecated) The options for the domain entry.</p> <note> <p> In releases prior to November 29, 2017, this parameter was not included in the API response. It is now deprecated. </p> """ this.options = options; }
java
@Deprecated public void setOptions(java.util.Map<String, String> options) { this.options = options; }
[ "@", "Deprecated", "public", "void", "setOptions", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "options", ")", "{", "this", ".", "options", "=", "options", ";", "}" ]
<p> (Deprecated) The options for the domain entry. </p> <note> <p> In releases prior to November 29, 2017, this parameter was not included in the API response. It is now deprecated. </p> </note> @param options (Deprecated) The options for the domain entry.</p> <note> <p> In releases prior to November 29, 2017, this parameter was not included in the API response. It is now deprecated. </p>
[ "<p", ">", "(", "Deprecated", ")", "The", "options", "for", "the", "domain", "entry", ".", "<", "/", "p", ">", "<note", ">", "<p", ">", "In", "releases", "prior", "to", "November", "29", "2017", "this", "parameter", "was", "not", "included", "in", "the", "API", "response", ".", "It", "is", "now", "deprecated", ".", "<", "/", "p", ">", "<", "/", "note", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lightsail/src/main/java/com/amazonaws/services/lightsail/model/DomainEntry.java#L661-L664
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraSchemaMgr.java
CassandraSchemaMgr.getKeyspaces
public Collection<String> getKeyspaces(DBConn dbConn) { """ Get a list of all known keyspaces. This method can be used with any DB connection. @param dbConn Database connection to use. @return List of all known keyspaces, empty if none. """ List<String> result = new ArrayList<>(); try { for (KsDef ksDef : dbConn.getClientSession().describe_keyspaces()) { result.add(ksDef.getName()); } } catch (Exception e) { String errMsg = "Failed to get keyspace description"; m_logger.error(errMsg, e); throw new RuntimeException(errMsg, e); } return result; }
java
public Collection<String> getKeyspaces(DBConn dbConn) { List<String> result = new ArrayList<>(); try { for (KsDef ksDef : dbConn.getClientSession().describe_keyspaces()) { result.add(ksDef.getName()); } } catch (Exception e) { String errMsg = "Failed to get keyspace description"; m_logger.error(errMsg, e); throw new RuntimeException(errMsg, e); } return result; }
[ "public", "Collection", "<", "String", ">", "getKeyspaces", "(", "DBConn", "dbConn", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "{", "for", "(", "KsDef", "ksDef", ":", "dbConn", ".", "getClientSession", "(", ")", ".", "describe_keyspaces", "(", ")", ")", "{", "result", ".", "add", "(", "ksDef", ".", "getName", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "String", "errMsg", "=", "\"Failed to get keyspace description\"", ";", "m_logger", ".", "error", "(", "errMsg", ",", "e", ")", ";", "throw", "new", "RuntimeException", "(", "errMsg", ",", "e", ")", ";", "}", "return", "result", ";", "}" ]
Get a list of all known keyspaces. This method can be used with any DB connection. @param dbConn Database connection to use. @return List of all known keyspaces, empty if none.
[ "Get", "a", "list", "of", "all", "known", "keyspaces", ".", "This", "method", "can", "be", "used", "with", "any", "DB", "connection", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraSchemaMgr.java#L58-L70
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/util/ImageHelper.java
ImageHelper.getScaledInstance
public static BufferedImage getScaledInstance(BufferedImage image, int targetWidth, int targetHeight) { """ Convenience method that returns a scaled instance of the provided {@code BufferedImage}. @param image the original image to be scaled @param targetWidth the desired width of the scaled instance, in pixels @param targetHeight the desired height of the scaled instance, in pixels @return a scaled version of the original {@code BufferedImage} """ int type = (image.getTransparency() == Transparency.OPAQUE) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB; BufferedImage tmp = new BufferedImage(targetWidth, targetHeight, type); Graphics2D g2 = tmp.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g2.drawImage(image, 0, 0, targetWidth, targetHeight, null); g2.dispose(); return tmp; }
java
public static BufferedImage getScaledInstance(BufferedImage image, int targetWidth, int targetHeight) { int type = (image.getTransparency() == Transparency.OPAQUE) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB; BufferedImage tmp = new BufferedImage(targetWidth, targetHeight, type); Graphics2D g2 = tmp.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g2.drawImage(image, 0, 0, targetWidth, targetHeight, null); g2.dispose(); return tmp; }
[ "public", "static", "BufferedImage", "getScaledInstance", "(", "BufferedImage", "image", ",", "int", "targetWidth", ",", "int", "targetHeight", ")", "{", "int", "type", "=", "(", "image", ".", "getTransparency", "(", ")", "==", "Transparency", ".", "OPAQUE", ")", "?", "BufferedImage", ".", "TYPE_INT_RGB", ":", "BufferedImage", ".", "TYPE_INT_ARGB", ";", "BufferedImage", "tmp", "=", "new", "BufferedImage", "(", "targetWidth", ",", "targetHeight", ",", "type", ")", ";", "Graphics2D", "g2", "=", "tmp", ".", "createGraphics", "(", ")", ";", "g2", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_INTERPOLATION", ",", "RenderingHints", ".", "VALUE_INTERPOLATION_BICUBIC", ")", ";", "g2", ".", "drawImage", "(", "image", ",", "0", ",", "0", ",", "targetWidth", ",", "targetHeight", ",", "null", ")", ";", "g2", ".", "dispose", "(", ")", ";", "return", "tmp", ";", "}" ]
Convenience method that returns a scaled instance of the provided {@code BufferedImage}. @param image the original image to be scaled @param targetWidth the desired width of the scaled instance, in pixels @param targetHeight the desired height of the scaled instance, in pixels @return a scaled version of the original {@code BufferedImage}
[ "Convenience", "method", "that", "returns", "a", "scaled", "instance", "of", "the", "provided", "{", "@code", "BufferedImage", "}", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageHelper.java#L39-L48
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/GridRowSet.java
GridRowSet.getCellPolygon
private Polygon getCellPolygon() { """ Compute the polygon corresponding to the cell @return Polygon of the cell """ final Coordinate[] summits = new Coordinate[5]; double x1 = minX + cellI * deltaX; double y1 = minY + cellJ * deltaY; double x2 = minX + (cellI + 1) * deltaX; double y2 = minY + (cellJ + 1) * deltaY; summits[0] = new Coordinate(x1, y1); summits[1] = new Coordinate(x2, y1); summits[2] = new Coordinate(x2, y2); summits[3] = new Coordinate(x1, y2); summits[4] = new Coordinate(x1, y1); final LinearRing g = GF.createLinearRing(summits); final Polygon gg = GF.createPolygon(g, null); cellI++; return gg; }
java
private Polygon getCellPolygon() { final Coordinate[] summits = new Coordinate[5]; double x1 = minX + cellI * deltaX; double y1 = minY + cellJ * deltaY; double x2 = minX + (cellI + 1) * deltaX; double y2 = minY + (cellJ + 1) * deltaY; summits[0] = new Coordinate(x1, y1); summits[1] = new Coordinate(x2, y1); summits[2] = new Coordinate(x2, y2); summits[3] = new Coordinate(x1, y2); summits[4] = new Coordinate(x1, y1); final LinearRing g = GF.createLinearRing(summits); final Polygon gg = GF.createPolygon(g, null); cellI++; return gg; }
[ "private", "Polygon", "getCellPolygon", "(", ")", "{", "final", "Coordinate", "[", "]", "summits", "=", "new", "Coordinate", "[", "5", "]", ";", "double", "x1", "=", "minX", "+", "cellI", "*", "deltaX", ";", "double", "y1", "=", "minY", "+", "cellJ", "*", "deltaY", ";", "double", "x2", "=", "minX", "+", "(", "cellI", "+", "1", ")", "*", "deltaX", ";", "double", "y2", "=", "minY", "+", "(", "cellJ", "+", "1", ")", "*", "deltaY", ";", "summits", "[", "0", "]", "=", "new", "Coordinate", "(", "x1", ",", "y1", ")", ";", "summits", "[", "1", "]", "=", "new", "Coordinate", "(", "x2", ",", "y1", ")", ";", "summits", "[", "2", "]", "=", "new", "Coordinate", "(", "x2", ",", "y2", ")", ";", "summits", "[", "3", "]", "=", "new", "Coordinate", "(", "x1", ",", "y2", ")", ";", "summits", "[", "4", "]", "=", "new", "Coordinate", "(", "x1", ",", "y1", ")", ";", "final", "LinearRing", "g", "=", "GF", ".", "createLinearRing", "(", "summits", ")", ";", "final", "Polygon", "gg", "=", "GF", ".", "createPolygon", "(", "g", ",", "null", ")", ";", "cellI", "++", ";", "return", "gg", ";", "}" ]
Compute the polygon corresponding to the cell @return Polygon of the cell
[ "Compute", "the", "polygon", "corresponding", "to", "the", "cell" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/GridRowSet.java#L143-L158
Bearded-Hen/Android-Bootstrap
AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java
AwesomeTextView.setIcon
public void setIcon(CharSequence iconCode, IconSet iconSet) { """ Sets the text to display a FontIcon, replacing whatever text is already present. Used to set the text to display a FontAwesome Icon. @param iconSet - An implementation of FontIcon """ setBootstrapText(new BootstrapText.Builder(getContext(), isInEditMode()).addIcon(iconCode, iconSet).build()); }
java
public void setIcon(CharSequence iconCode, IconSet iconSet) { setBootstrapText(new BootstrapText.Builder(getContext(), isInEditMode()).addIcon(iconCode, iconSet).build()); }
[ "public", "void", "setIcon", "(", "CharSequence", "iconCode", ",", "IconSet", "iconSet", ")", "{", "setBootstrapText", "(", "new", "BootstrapText", ".", "Builder", "(", "getContext", "(", ")", ",", "isInEditMode", "(", ")", ")", ".", "addIcon", "(", "iconCode", ",", "iconSet", ")", ".", "build", "(", ")", ")", ";", "}" ]
Sets the text to display a FontIcon, replacing whatever text is already present. Used to set the text to display a FontAwesome Icon. @param iconSet - An implementation of FontIcon
[ "Sets", "the", "text", "to", "display", "a", "FontIcon", "replacing", "whatever", "text", "is", "already", "present", ".", "Used", "to", "set", "the", "text", "to", "display", "a", "FontAwesome", "Icon", "." ]
train
https://github.com/Bearded-Hen/Android-Bootstrap/blob/b3d62cc1847e26d420c53c92665a4fe1e6ee7ecf/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/AwesomeTextView.java#L212-L214
mgormley/pacaya
src/main/java/edu/jhu/pacaya/util/Threads.java
Threads.initDefaultPool
public static void initDefaultPool(int numThreads, boolean isDaemon) { """ Initializes the default thread pool and adds a shutdown hook which will attempt to shutdown the thread pool on a call to System.exit(). If numThreads > 1 and isDaemon = true, then System.exit() or Threads.shutdownDefaultPool() must be explicitly called. Otherwise, the JVM may hang. @param numThreads The number of threads. @param isDaemon Whether the thread pool should consist of daemon threads. """ if (numThreads == 1) { Threads.defaultPool = MoreExecutors.newDirectExecutorService(); Threads.numThreads = 1; } else { log.info("Initialized default thread pool to {} threads. (This must be closed by Threads.shutdownDefaultPool)", numThreads); Threads.defaultPool = Executors.newFixedThreadPool(numThreads, new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = Executors.defaultThreadFactory().newThread(r); t.setDaemon(isDaemon); return t; } }); Threads.numThreads = numThreads; // Shutdown the thread pool on System.exit(). Runtime.getRuntime().addShutdownHook(new Thread(){ @Override public void run() { Threads.shutdownDefaultPool(); } }); } }
java
public static void initDefaultPool(int numThreads, boolean isDaemon) { if (numThreads == 1) { Threads.defaultPool = MoreExecutors.newDirectExecutorService(); Threads.numThreads = 1; } else { log.info("Initialized default thread pool to {} threads. (This must be closed by Threads.shutdownDefaultPool)", numThreads); Threads.defaultPool = Executors.newFixedThreadPool(numThreads, new ThreadFactory() { public Thread newThread(Runnable r) { Thread t = Executors.defaultThreadFactory().newThread(r); t.setDaemon(isDaemon); return t; } }); Threads.numThreads = numThreads; // Shutdown the thread pool on System.exit(). Runtime.getRuntime().addShutdownHook(new Thread(){ @Override public void run() { Threads.shutdownDefaultPool(); } }); } }
[ "public", "static", "void", "initDefaultPool", "(", "int", "numThreads", ",", "boolean", "isDaemon", ")", "{", "if", "(", "numThreads", "==", "1", ")", "{", "Threads", ".", "defaultPool", "=", "MoreExecutors", ".", "newDirectExecutorService", "(", ")", ";", "Threads", ".", "numThreads", "=", "1", ";", "}", "else", "{", "log", ".", "info", "(", "\"Initialized default thread pool to {} threads. (This must be closed by Threads.shutdownDefaultPool)\"", ",", "numThreads", ")", ";", "Threads", ".", "defaultPool", "=", "Executors", ".", "newFixedThreadPool", "(", "numThreads", ",", "new", "ThreadFactory", "(", ")", "{", "public", "Thread", "newThread", "(", "Runnable", "r", ")", "{", "Thread", "t", "=", "Executors", ".", "defaultThreadFactory", "(", ")", ".", "newThread", "(", "r", ")", ";", "t", ".", "setDaemon", "(", "isDaemon", ")", ";", "return", "t", ";", "}", "}", ")", ";", "Threads", ".", "numThreads", "=", "numThreads", ";", "// Shutdown the thread pool on System.exit().", "Runtime", ".", "getRuntime", "(", ")", ".", "addShutdownHook", "(", "new", "Thread", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "Threads", ".", "shutdownDefaultPool", "(", ")", ";", "}", "}", ")", ";", "}", "}" ]
Initializes the default thread pool and adds a shutdown hook which will attempt to shutdown the thread pool on a call to System.exit(). If numThreads > 1 and isDaemon = true, then System.exit() or Threads.shutdownDefaultPool() must be explicitly called. Otherwise, the JVM may hang. @param numThreads The number of threads. @param isDaemon Whether the thread pool should consist of daemon threads.
[ "Initializes", "the", "default", "thread", "pool", "and", "adds", "a", "shutdown", "hook", "which", "will", "attempt", "to", "shutdown", "the", "thread", "pool", "on", "a", "call", "to", "System", ".", "exit", "()", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/util/Threads.java#L64-L86
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/MessageFormat.java
MessageFormat.setFormatByArgumentIndex
public void setFormatByArgumentIndex(int argumentIndex, Format newFormat) { """ Sets the format to use for the format elements within the previously set pattern string that use the given argument index. The argument index is part of the format element definition and represents an index into the <code>arguments</code> array passed to the <code>format</code> methods or the result array returned by the <code>parse</code> methods. <p> If the argument index is used for more than one format element in the pattern string, then the new format is used for all such format elements. If the argument index is not used for any format element in the pattern string, then the new format is ignored. @param argumentIndex the argument index for which to use the new format @param newFormat the new format to use @since 1.4 """ for (int j = 0; j <= maxOffset; j++) { if (argumentNumbers[j] == argumentIndex) { formats[j] = newFormat; } } }
java
public void setFormatByArgumentIndex(int argumentIndex, Format newFormat) { for (int j = 0; j <= maxOffset; j++) { if (argumentNumbers[j] == argumentIndex) { formats[j] = newFormat; } } }
[ "public", "void", "setFormatByArgumentIndex", "(", "int", "argumentIndex", ",", "Format", "newFormat", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<=", "maxOffset", ";", "j", "++", ")", "{", "if", "(", "argumentNumbers", "[", "j", "]", "==", "argumentIndex", ")", "{", "formats", "[", "j", "]", "=", "newFormat", ";", "}", "}", "}" ]
Sets the format to use for the format elements within the previously set pattern string that use the given argument index. The argument index is part of the format element definition and represents an index into the <code>arguments</code> array passed to the <code>format</code> methods or the result array returned by the <code>parse</code> methods. <p> If the argument index is used for more than one format element in the pattern string, then the new format is used for all such format elements. If the argument index is not used for any format element in the pattern string, then the new format is ignored. @param argumentIndex the argument index for which to use the new format @param newFormat the new format to use @since 1.4
[ "Sets", "the", "format", "to", "use", "for", "the", "format", "elements", "within", "the", "previously", "set", "pattern", "string", "that", "use", "the", "given", "argument", "index", ".", "The", "argument", "index", "is", "part", "of", "the", "format", "element", "definition", "and", "represents", "an", "index", "into", "the", "<code", ">", "arguments<", "/", "code", ">", "array", "passed", "to", "the", "<code", ">", "format<", "/", "code", ">", "methods", "or", "the", "result", "array", "returned", "by", "the", "<code", ">", "parse<", "/", "code", ">", "methods", ".", "<p", ">", "If", "the", "argument", "index", "is", "used", "for", "more", "than", "one", "format", "element", "in", "the", "pattern", "string", "then", "the", "new", "format", "is", "used", "for", "all", "such", "format", "elements", ".", "If", "the", "argument", "index", "is", "not", "used", "for", "any", "format", "element", "in", "the", "pattern", "string", "then", "the", "new", "format", "is", "ignored", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/MessageFormat.java#L667-L673
ptgoetz/storm-hbase
src/main/java/org/apache/storm/hbase/common/ColumnList.java
ColumnList.addCounter
public ColumnList addCounter(byte[] family, byte[] qualifier, long incr) { """ Add an HBase counter column. @param family @param qualifier @param incr @return """ counters().add(new Counter(family, qualifier, incr)); return this; }
java
public ColumnList addCounter(byte[] family, byte[] qualifier, long incr){ counters().add(new Counter(family, qualifier, incr)); return this; }
[ "public", "ColumnList", "addCounter", "(", "byte", "[", "]", "family", ",", "byte", "[", "]", "qualifier", ",", "long", "incr", ")", "{", "counters", "(", ")", ".", "add", "(", "new", "Counter", "(", "family", ",", "qualifier", ",", "incr", ")", ")", ";", "return", "this", ";", "}" ]
Add an HBase counter column. @param family @param qualifier @param incr @return
[ "Add", "an", "HBase", "counter", "column", "." ]
train
https://github.com/ptgoetz/storm-hbase/blob/509e41514bb92ef65dba1449bbd935557dc8193c/src/main/java/org/apache/storm/hbase/common/ColumnList.java#L151-L154
RogerParkinson/madura-objects-parent
madura-rules/src/main/java/nz/co/senanque/rulesparser/ParsePackage.java
ParsePackage.processRule
private AbstractRule processRule(RulesTextProvider textProvider) { """ Method processRule. Parse the rule. Rules have an if/then structure with conditions and actions @return Rule @throws ParserException """ log.debug("processRule"); int start = textProvider.getPos(); Rule rule = new Rule(); LoadCommonRuleData(rule,textProvider); textProvider.addTOCElement(null, rule.getDescription(), start, textProvider.getPos(), TYPE_RULE); exactOrError("{",textProvider); if (!exact("if",textProvider)) throw new ParserException("expected 'if' in a rule: ",textProvider); // Condition Expression condition = processCondition(textProvider); rule.addCondition(condition); exactOrError("{",textProvider); while (!exact("}",textProvider)) { Expression action = processAction(textProvider); exact(";",textProvider); rule.addAction(action); } exact("}",textProvider); return rule; }
java
private AbstractRule processRule(RulesTextProvider textProvider) { log.debug("processRule"); int start = textProvider.getPos(); Rule rule = new Rule(); LoadCommonRuleData(rule,textProvider); textProvider.addTOCElement(null, rule.getDescription(), start, textProvider.getPos(), TYPE_RULE); exactOrError("{",textProvider); if (!exact("if",textProvider)) throw new ParserException("expected 'if' in a rule: ",textProvider); // Condition Expression condition = processCondition(textProvider); rule.addCondition(condition); exactOrError("{",textProvider); while (!exact("}",textProvider)) { Expression action = processAction(textProvider); exact(";",textProvider); rule.addAction(action); } exact("}",textProvider); return rule; }
[ "private", "AbstractRule", "processRule", "(", "RulesTextProvider", "textProvider", ")", "{", "log", ".", "debug", "(", "\"processRule\"", ")", ";", "int", "start", "=", "textProvider", ".", "getPos", "(", ")", ";", "Rule", "rule", "=", "new", "Rule", "(", ")", ";", "LoadCommonRuleData", "(", "rule", ",", "textProvider", ")", ";", "textProvider", ".", "addTOCElement", "(", "null", ",", "rule", ".", "getDescription", "(", ")", ",", "start", ",", "textProvider", ".", "getPos", "(", ")", ",", "TYPE_RULE", ")", ";", "exactOrError", "(", "\"{\"", ",", "textProvider", ")", ";", "if", "(", "!", "exact", "(", "\"if\"", ",", "textProvider", ")", ")", "throw", "new", "ParserException", "(", "\"expected 'if' in a rule: \"", ",", "textProvider", ")", ";", "// Condition", "Expression", "condition", "=", "processCondition", "(", "textProvider", ")", ";", "rule", ".", "addCondition", "(", "condition", ")", ";", "exactOrError", "(", "\"{\"", ",", "textProvider", ")", ";", "while", "(", "!", "exact", "(", "\"}\"", ",", "textProvider", ")", ")", "{", "Expression", "action", "=", "processAction", "(", "textProvider", ")", ";", "exact", "(", "\";\"", ",", "textProvider", ")", ";", "rule", ".", "addAction", "(", "action", ")", ";", "}", "exact", "(", "\"}\"", ",", "textProvider", ")", ";", "return", "rule", ";", "}" ]
Method processRule. Parse the rule. Rules have an if/then structure with conditions and actions @return Rule @throws ParserException
[ "Method", "processRule", ".", "Parse", "the", "rule", ".", "Rules", "have", "an", "if", "/", "then", "structure", "with", "conditions", "and", "actions" ]
train
https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-rules/src/main/java/nz/co/senanque/rulesparser/ParsePackage.java#L242-L266
lucee/Lucee
core/src/main/java/lucee/runtime/net/ntp/NtpClient.java
NtpClient.getOffset
public long getOffset() throws IOException { """ returns the offest from the ntp server to local system @return @throws IOException """ /// Send request DatagramSocket socket = null; try { socket = new DatagramSocket(); socket.setSoTimeout(20000); InetAddress address = InetAddress.getByName(serverName); byte[] buf = new NtpMessage().toByteArray(); DatagramPacket packet = new DatagramPacket(buf, buf.length, address, 123); // Set the transmit timestamp *just* before sending the packet NtpMessage.encodeTimestamp(packet.getData(), 40, (System.currentTimeMillis() / 1000.0) + 2208988800.0); socket.send(packet); // Get response packet = new DatagramPacket(buf, buf.length); socket.receive(packet); // Immediately record the incoming timestamp double destinationTimestamp = (System.currentTimeMillis() / 1000.0) + 2208988800.0; // Process response NtpMessage msg = new NtpMessage(packet.getData()); // double roundTripDelay = (destinationTimestamp-msg.originateTimestamp) - // (msg.receiveTimestamp-msg.transmitTimestamp); double localClockOffset = ((msg.receiveTimestamp - msg.originateTimestamp) + (msg.transmitTimestamp - destinationTimestamp)) / 2; return (long) (localClockOffset * 1000); } finally { IOUtil.closeEL(socket); } }
java
public long getOffset() throws IOException { /// Send request DatagramSocket socket = null; try { socket = new DatagramSocket(); socket.setSoTimeout(20000); InetAddress address = InetAddress.getByName(serverName); byte[] buf = new NtpMessage().toByteArray(); DatagramPacket packet = new DatagramPacket(buf, buf.length, address, 123); // Set the transmit timestamp *just* before sending the packet NtpMessage.encodeTimestamp(packet.getData(), 40, (System.currentTimeMillis() / 1000.0) + 2208988800.0); socket.send(packet); // Get response packet = new DatagramPacket(buf, buf.length); socket.receive(packet); // Immediately record the incoming timestamp double destinationTimestamp = (System.currentTimeMillis() / 1000.0) + 2208988800.0; // Process response NtpMessage msg = new NtpMessage(packet.getData()); // double roundTripDelay = (destinationTimestamp-msg.originateTimestamp) - // (msg.receiveTimestamp-msg.transmitTimestamp); double localClockOffset = ((msg.receiveTimestamp - msg.originateTimestamp) + (msg.transmitTimestamp - destinationTimestamp)) / 2; return (long) (localClockOffset * 1000); } finally { IOUtil.closeEL(socket); } }
[ "public", "long", "getOffset", "(", ")", "throws", "IOException", "{", "/// Send request", "DatagramSocket", "socket", "=", "null", ";", "try", "{", "socket", "=", "new", "DatagramSocket", "(", ")", ";", "socket", ".", "setSoTimeout", "(", "20000", ")", ";", "InetAddress", "address", "=", "InetAddress", ".", "getByName", "(", "serverName", ")", ";", "byte", "[", "]", "buf", "=", "new", "NtpMessage", "(", ")", ".", "toByteArray", "(", ")", ";", "DatagramPacket", "packet", "=", "new", "DatagramPacket", "(", "buf", ",", "buf", ".", "length", ",", "address", ",", "123", ")", ";", "// Set the transmit timestamp *just* before sending the packet", "NtpMessage", ".", "encodeTimestamp", "(", "packet", ".", "getData", "(", ")", ",", "40", ",", "(", "System", ".", "currentTimeMillis", "(", ")", "/", "1000.0", ")", "+", "2208988800.0", ")", ";", "socket", ".", "send", "(", "packet", ")", ";", "// Get response", "packet", "=", "new", "DatagramPacket", "(", "buf", ",", "buf", ".", "length", ")", ";", "socket", ".", "receive", "(", "packet", ")", ";", "// Immediately record the incoming timestamp", "double", "destinationTimestamp", "=", "(", "System", ".", "currentTimeMillis", "(", ")", "/", "1000.0", ")", "+", "2208988800.0", ";", "// Process response", "NtpMessage", "msg", "=", "new", "NtpMessage", "(", "packet", ".", "getData", "(", ")", ")", ";", "// double roundTripDelay = (destinationTimestamp-msg.originateTimestamp) -", "// (msg.receiveTimestamp-msg.transmitTimestamp);", "double", "localClockOffset", "=", "(", "(", "msg", ".", "receiveTimestamp", "-", "msg", ".", "originateTimestamp", ")", "+", "(", "msg", ".", "transmitTimestamp", "-", "destinationTimestamp", ")", ")", "/", "2", ";", "return", "(", "long", ")", "(", "localClockOffset", "*", "1000", ")", ";", "}", "finally", "{", "IOUtil", ".", "closeEL", "(", "socket", ")", ";", "}", "}" ]
returns the offest from the ntp server to local system @return @throws IOException
[ "returns", "the", "offest", "from", "the", "ntp", "server", "to", "local", "system" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/ntp/NtpClient.java#L51-L84
zaproxy/zaproxy
src/org/zaproxy/zap/model/Context.java
Context.duplicate
public Context duplicate() { """ Creates a copy of the Context. The copy is deep, with the exception of the TechSet. @return the context """ Context newContext = new Context(session, getIndex()); newContext.description = this.description; newContext.name = this.name; newContext.includeInRegexs = new ArrayList<>(this.includeInRegexs); newContext.includeInPatterns = new ArrayList<>(this.includeInPatterns); newContext.excludeFromRegexs = new ArrayList<>(this.excludeFromRegexs); newContext.excludeFromPatterns = new ArrayList<>(this.excludeFromPatterns); newContext.inScope = this.inScope; newContext.techSet = new TechSet(this.techSet); newContext.authenticationMethod = this.authenticationMethod.clone(); newContext.sessionManagementMethod = this.sessionManagementMethod.clone(); newContext.urlParamParser = this.urlParamParser.clone(); newContext.postParamParser = this.postParamParser.clone(); newContext.authorizationDetectionMethod = this.authorizationDetectionMethod.clone(); newContext.dataDrivenNodes = this.getDataDrivenNodes(); return newContext; }
java
public Context duplicate() { Context newContext = new Context(session, getIndex()); newContext.description = this.description; newContext.name = this.name; newContext.includeInRegexs = new ArrayList<>(this.includeInRegexs); newContext.includeInPatterns = new ArrayList<>(this.includeInPatterns); newContext.excludeFromRegexs = new ArrayList<>(this.excludeFromRegexs); newContext.excludeFromPatterns = new ArrayList<>(this.excludeFromPatterns); newContext.inScope = this.inScope; newContext.techSet = new TechSet(this.techSet); newContext.authenticationMethod = this.authenticationMethod.clone(); newContext.sessionManagementMethod = this.sessionManagementMethod.clone(); newContext.urlParamParser = this.urlParamParser.clone(); newContext.postParamParser = this.postParamParser.clone(); newContext.authorizationDetectionMethod = this.authorizationDetectionMethod.clone(); newContext.dataDrivenNodes = this.getDataDrivenNodes(); return newContext; }
[ "public", "Context", "duplicate", "(", ")", "{", "Context", "newContext", "=", "new", "Context", "(", "session", ",", "getIndex", "(", ")", ")", ";", "newContext", ".", "description", "=", "this", ".", "description", ";", "newContext", ".", "name", "=", "this", ".", "name", ";", "newContext", ".", "includeInRegexs", "=", "new", "ArrayList", "<>", "(", "this", ".", "includeInRegexs", ")", ";", "newContext", ".", "includeInPatterns", "=", "new", "ArrayList", "<>", "(", "this", ".", "includeInPatterns", ")", ";", "newContext", ".", "excludeFromRegexs", "=", "new", "ArrayList", "<>", "(", "this", ".", "excludeFromRegexs", ")", ";", "newContext", ".", "excludeFromPatterns", "=", "new", "ArrayList", "<>", "(", "this", ".", "excludeFromPatterns", ")", ";", "newContext", ".", "inScope", "=", "this", ".", "inScope", ";", "newContext", ".", "techSet", "=", "new", "TechSet", "(", "this", ".", "techSet", ")", ";", "newContext", ".", "authenticationMethod", "=", "this", ".", "authenticationMethod", ".", "clone", "(", ")", ";", "newContext", ".", "sessionManagementMethod", "=", "this", ".", "sessionManagementMethod", ".", "clone", "(", ")", ";", "newContext", ".", "urlParamParser", "=", "this", ".", "urlParamParser", ".", "clone", "(", ")", ";", "newContext", ".", "postParamParser", "=", "this", ".", "postParamParser", ".", "clone", "(", ")", ";", "newContext", ".", "authorizationDetectionMethod", "=", "this", ".", "authorizationDetectionMethod", ".", "clone", "(", ")", ";", "newContext", ".", "dataDrivenNodes", "=", "this", ".", "getDataDrivenNodes", "(", ")", ";", "return", "newContext", ";", "}" ]
Creates a copy of the Context. The copy is deep, with the exception of the TechSet. @return the context
[ "Creates", "a", "copy", "of", "the", "Context", ".", "The", "copy", "is", "deep", "with", "the", "exception", "of", "the", "TechSet", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/model/Context.java#L736-L753
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_ripe_PUT
public void ip_ripe_PUT(String ip, OvhRipeInfos body) throws IOException { """ Alter this object properties REST: PUT /ip/{ip}/ripe @param body [required] New object properties @param ip [required] """ String qPath = "/ip/{ip}/ripe"; StringBuilder sb = path(qPath, ip); exec(qPath, "PUT", sb.toString(), body); }
java
public void ip_ripe_PUT(String ip, OvhRipeInfos body) throws IOException { String qPath = "/ip/{ip}/ripe"; StringBuilder sb = path(qPath, ip); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "ip_ripe_PUT", "(", "String", "ip", ",", "OvhRipeInfos", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/ripe\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /ip/{ip}/ripe @param body [required] New object properties @param ip [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L182-L186
netty/netty
common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java
ThreadExecutorMap.apply
public static ThreadFactory apply(final ThreadFactory threadFactory, final EventExecutor eventExecutor) { """ Decorate the given {@link ThreadFactory} and ensure {@link #currentExecutor()} will return {@code eventExecutor} when called from within the {@link Runnable} during execution. """ ObjectUtil.checkNotNull(threadFactory, "command"); ObjectUtil.checkNotNull(eventExecutor, "eventExecutor"); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { return threadFactory.newThread(apply(r, eventExecutor)); } }; }
java
public static ThreadFactory apply(final ThreadFactory threadFactory, final EventExecutor eventExecutor) { ObjectUtil.checkNotNull(threadFactory, "command"); ObjectUtil.checkNotNull(eventExecutor, "eventExecutor"); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { return threadFactory.newThread(apply(r, eventExecutor)); } }; }
[ "public", "static", "ThreadFactory", "apply", "(", "final", "ThreadFactory", "threadFactory", ",", "final", "EventExecutor", "eventExecutor", ")", "{", "ObjectUtil", ".", "checkNotNull", "(", "threadFactory", ",", "\"command\"", ")", ";", "ObjectUtil", ".", "checkNotNull", "(", "eventExecutor", ",", "\"eventExecutor\"", ")", ";", "return", "new", "ThreadFactory", "(", ")", "{", "@", "Override", "public", "Thread", "newThread", "(", "Runnable", "r", ")", "{", "return", "threadFactory", ".", "newThread", "(", "apply", "(", "r", ",", "eventExecutor", ")", ")", ";", "}", "}", ";", "}" ]
Decorate the given {@link ThreadFactory} and ensure {@link #currentExecutor()} will return {@code eventExecutor} when called from within the {@link Runnable} during execution.
[ "Decorate", "the", "given", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java#L86-L95
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/GeneralizedCounter.java
GeneralizedCounter.incrementCount2D
public void incrementCount2D(K first, K second, double count) { """ Equivalent to incrementCount( new Object[] { first, second }, count ). Makes the special case easier, and also more efficient. """ if (depth != 2) { wrongDepth(); //throws exception } this.addToTotal(count); GeneralizedCounter<K> next = this.conditionalizeHelper(first); next.incrementCount1D(second, count); }
java
public void incrementCount2D(K first, K second, double count) { if (depth != 2) { wrongDepth(); //throws exception } this.addToTotal(count); GeneralizedCounter<K> next = this.conditionalizeHelper(first); next.incrementCount1D(second, count); }
[ "public", "void", "incrementCount2D", "(", "K", "first", ",", "K", "second", ",", "double", "count", ")", "{", "if", "(", "depth", "!=", "2", ")", "{", "wrongDepth", "(", ")", ";", "//throws exception\r", "}", "this", ".", "addToTotal", "(", "count", ")", ";", "GeneralizedCounter", "<", "K", ">", "next", "=", "this", ".", "conditionalizeHelper", "(", "first", ")", ";", "next", ".", "incrementCount1D", "(", "second", ",", "count", ")", ";", "}" ]
Equivalent to incrementCount( new Object[] { first, second }, count ). Makes the special case easier, and also more efficient.
[ "Equivalent", "to", "incrementCount", "(", "new", "Object", "[]", "{", "first", "second", "}", "count", ")", ".", "Makes", "the", "special", "case", "easier", "and", "also", "more", "efficient", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/GeneralizedCounter.java#L492-L500
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java
ContextItems.addItems
private void addItems(Map<String, String> values) { """ Adds property values to the context item list. @param values Values to add. """ for (String itemName : values.keySet()) { setItem(itemName, values.get(itemName)); } }
java
private void addItems(Map<String, String> values) { for (String itemName : values.keySet()) { setItem(itemName, values.get(itemName)); } }
[ "private", "void", "addItems", "(", "Map", "<", "String", ",", "String", ">", "values", ")", "{", "for", "(", "String", "itemName", ":", "values", ".", "keySet", "(", ")", ")", "{", "setItem", "(", "itemName", ",", "values", ".", "get", "(", "itemName", ")", ")", ";", "}", "}" ]
Adds property values to the context item list. @param values Values to add.
[ "Adds", "property", "values", "to", "the", "context", "item", "list", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L336-L340
jenkinsci/jenkins
core/src/main/java/hudson/model/User.java
User.getOrCreateById
private static @Nullable User getOrCreateById(@Nonnull String id, @Nonnull String fullName, boolean create) { """ Retrieve a user by its ID, and create a new one if requested. @return An existing or created user. May be {@code null} if a user does not exist and {@code create} is false. """ User u = AllUsers.get(id); if (u == null && (create || UserIdMapper.getInstance().isMapped(id))) { u = new User(id, fullName); AllUsers.put(id, u); if (!id.equals(fullName) && !UserIdMapper.getInstance().isMapped(id)) { try { u.save(); } catch (IOException x) { LOGGER.log(Level.WARNING, "Failed to save user configuration for " + id, x); } } } return u; }
java
private static @Nullable User getOrCreateById(@Nonnull String id, @Nonnull String fullName, boolean create) { User u = AllUsers.get(id); if (u == null && (create || UserIdMapper.getInstance().isMapped(id))) { u = new User(id, fullName); AllUsers.put(id, u); if (!id.equals(fullName) && !UserIdMapper.getInstance().isMapped(id)) { try { u.save(); } catch (IOException x) { LOGGER.log(Level.WARNING, "Failed to save user configuration for " + id, x); } } } return u; }
[ "private", "static", "@", "Nullable", "User", "getOrCreateById", "(", "@", "Nonnull", "String", "id", ",", "@", "Nonnull", "String", "fullName", ",", "boolean", "create", ")", "{", "User", "u", "=", "AllUsers", ".", "get", "(", "id", ")", ";", "if", "(", "u", "==", "null", "&&", "(", "create", "||", "UserIdMapper", ".", "getInstance", "(", ")", ".", "isMapped", "(", "id", ")", ")", ")", "{", "u", "=", "new", "User", "(", "id", ",", "fullName", ")", ";", "AllUsers", ".", "put", "(", "id", ",", "u", ")", ";", "if", "(", "!", "id", ".", "equals", "(", "fullName", ")", "&&", "!", "UserIdMapper", ".", "getInstance", "(", ")", ".", "isMapped", "(", "id", ")", ")", "{", "try", "{", "u", ".", "save", "(", ")", ";", "}", "catch", "(", "IOException", "x", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Failed to save user configuration for \"", "+", "id", ",", "x", ")", ";", "}", "}", "}", "return", "u", ";", "}" ]
Retrieve a user by its ID, and create a new one if requested. @return An existing or created user. May be {@code null} if a user does not exist and {@code create} is false.
[ "Retrieve", "a", "user", "by", "its", "ID", "and", "create", "a", "new", "one", "if", "requested", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L515-L530
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/RangeDistributionBuilder.java
RangeDistributionBuilder.add
public RangeDistributionBuilder add(Number value, int count) { """ Increments an entry @param value the value to use to pick the entry to increment @param count the number by which to increment """ if (greaterOrEqualsThan(value, bottomLimits[0])) { addValue(value, count); isEmpty = false; } return this; }
java
public RangeDistributionBuilder add(Number value, int count) { if (greaterOrEqualsThan(value, bottomLimits[0])) { addValue(value, count); isEmpty = false; } return this; }
[ "public", "RangeDistributionBuilder", "add", "(", "Number", "value", ",", "int", "count", ")", "{", "if", "(", "greaterOrEqualsThan", "(", "value", ",", "bottomLimits", "[", "0", "]", ")", ")", "{", "addValue", "(", "value", ",", "count", ")", ";", "isEmpty", "=", "false", ";", "}", "return", "this", ";", "}" ]
Increments an entry @param value the value to use to pick the entry to increment @param count the number by which to increment
[ "Increments", "an", "entry" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/RangeDistributionBuilder.java#L77-L83
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/Event.java
Event.withAttributes
public Event withAttributes(java.util.Map<String, String> attributes) { """ Custom attributes that are associated with the event you're adding or updating. @param attributes Custom attributes that are associated with the event you're adding or updating. @return Returns a reference to this object so that method calls can be chained together. """ setAttributes(attributes); return this; }
java
public Event withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
[ "public", "Event", "withAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "setAttributes", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
Custom attributes that are associated with the event you're adding or updating. @param attributes Custom attributes that are associated with the event you're adding or updating. @return Returns a reference to this object so that method calls can be chained together.
[ "Custom", "attributes", "that", "are", "associated", "with", "the", "event", "you", "re", "adding", "or", "updating", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/Event.java#L181-L184
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java
ClusterHeartbeatManager.sendHeartbeat
private void sendHeartbeat(Member target) { """ Send a {@link HeartbeatOp} to the {@code target} @param target target Member """ if (target == null) { return; } try { MembersViewMetadata membersViewMetadata = clusterService.getMembershipManager().createLocalMembersViewMetadata(); Operation op = new HeartbeatOp(membersViewMetadata, target.getUuid(), clusterClock.getClusterTime()); op.setCallerUuid(clusterService.getThisUuid()); node.nodeEngine.getOperationService().send(op, target.getAddress()); } catch (Exception e) { if (logger.isFineEnabled()) { logger.fine(format("Error while sending heartbeat -> %s[%s]", e.getClass().getName(), e.getMessage())); } } }
java
private void sendHeartbeat(Member target) { if (target == null) { return; } try { MembersViewMetadata membersViewMetadata = clusterService.getMembershipManager().createLocalMembersViewMetadata(); Operation op = new HeartbeatOp(membersViewMetadata, target.getUuid(), clusterClock.getClusterTime()); op.setCallerUuid(clusterService.getThisUuid()); node.nodeEngine.getOperationService().send(op, target.getAddress()); } catch (Exception e) { if (logger.isFineEnabled()) { logger.fine(format("Error while sending heartbeat -> %s[%s]", e.getClass().getName(), e.getMessage())); } } }
[ "private", "void", "sendHeartbeat", "(", "Member", "target", ")", "{", "if", "(", "target", "==", "null", ")", "{", "return", ";", "}", "try", "{", "MembersViewMetadata", "membersViewMetadata", "=", "clusterService", ".", "getMembershipManager", "(", ")", ".", "createLocalMembersViewMetadata", "(", ")", ";", "Operation", "op", "=", "new", "HeartbeatOp", "(", "membersViewMetadata", ",", "target", ".", "getUuid", "(", ")", ",", "clusterClock", ".", "getClusterTime", "(", ")", ")", ";", "op", ".", "setCallerUuid", "(", "clusterService", ".", "getThisUuid", "(", ")", ")", ";", "node", ".", "nodeEngine", ".", "getOperationService", "(", ")", ".", "send", "(", "op", ",", "target", ".", "getAddress", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "logger", ".", "isFineEnabled", "(", ")", ")", "{", "logger", ".", "fine", "(", "format", "(", "\"Error while sending heartbeat -> %s[%s]\"", ",", "e", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "e", ".", "getMessage", "(", ")", ")", ")", ";", "}", "}", "}" ]
Send a {@link HeartbeatOp} to the {@code target} @param target target Member
[ "Send", "a", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterHeartbeatManager.java#L614-L628
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/derivative/DerivativeLaplacian.java
DerivativeLaplacian.process
public static void process(GrayF32 orig, GrayF32 deriv, @Nullable ImageBorder_F32 border) { """ Computes the Laplacian of 'orig'. @param orig Input image. Not modified. @param deriv Where the Laplacian is written to. Modified. """ deriv.reshape(orig.width,orig.height); if( BoofConcurrency.USE_CONCURRENT ) { DerivativeLaplacian_Inner_MT.process(orig,deriv); } else { DerivativeLaplacian_Inner.process(orig,deriv); } if( border != null ) { border.setImage(orig); ConvolveJustBorder_General_SB.convolve(kernel_F32, border,deriv); } }
java
public static void process(GrayF32 orig, GrayF32 deriv, @Nullable ImageBorder_F32 border) { deriv.reshape(orig.width,orig.height); if( BoofConcurrency.USE_CONCURRENT ) { DerivativeLaplacian_Inner_MT.process(orig,deriv); } else { DerivativeLaplacian_Inner.process(orig,deriv); } if( border != null ) { border.setImage(orig); ConvolveJustBorder_General_SB.convolve(kernel_F32, border,deriv); } }
[ "public", "static", "void", "process", "(", "GrayF32", "orig", ",", "GrayF32", "deriv", ",", "@", "Nullable", "ImageBorder_F32", "border", ")", "{", "deriv", ".", "reshape", "(", "orig", ".", "width", ",", "orig", ".", "height", ")", ";", "if", "(", "BoofConcurrency", ".", "USE_CONCURRENT", ")", "{", "DerivativeLaplacian_Inner_MT", ".", "process", "(", "orig", ",", "deriv", ")", ";", "}", "else", "{", "DerivativeLaplacian_Inner", ".", "process", "(", "orig", ",", "deriv", ")", ";", "}", "if", "(", "border", "!=", "null", ")", "{", "border", ".", "setImage", "(", "orig", ")", ";", "ConvolveJustBorder_General_SB", ".", "convolve", "(", "kernel_F32", ",", "border", ",", "deriv", ")", ";", "}", "}" ]
Computes the Laplacian of 'orig'. @param orig Input image. Not modified. @param deriv Where the Laplacian is written to. Modified.
[ "Computes", "the", "Laplacian", "of", "orig", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/derivative/DerivativeLaplacian.java#L114-L127
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/utils/IterHelper.java
IterHelper.loopOrSingle
@SuppressWarnings( { """ Calls eval for each entry found, or just once if the "x" isn't iterable/collection/list/etc. with "x" @param x the object process @param callback the callback """"unchecked"}) public void loopOrSingle(final Object x, final IterCallback<V> callback) { if (x == null) { return; } //A collection if (x instanceof Collection<?>) { final Collection<?> l = (Collection<?>) x; for (final Object o : l) { callback.eval((V) o); } return; } //An array of Object[] if (x.getClass().isArray()) { for (final Object o : (Object[]) x) { callback.eval((V) o); } return; } callback.eval((V) x); }
java
@SuppressWarnings({"unchecked"}) public void loopOrSingle(final Object x, final IterCallback<V> callback) { if (x == null) { return; } //A collection if (x instanceof Collection<?>) { final Collection<?> l = (Collection<?>) x; for (final Object o : l) { callback.eval((V) o); } return; } //An array of Object[] if (x.getClass().isArray()) { for (final Object o : (Object[]) x) { callback.eval((V) o); } return; } callback.eval((V) x); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "public", "void", "loopOrSingle", "(", "final", "Object", "x", ",", "final", "IterCallback", "<", "V", ">", "callback", ")", "{", "if", "(", "x", "==", "null", ")", "{", "return", ";", "}", "//A collection", "if", "(", "x", "instanceof", "Collection", "<", "?", ">", ")", "{", "final", "Collection", "<", "?", ">", "l", "=", "(", "Collection", "<", "?", ">", ")", "x", ";", "for", "(", "final", "Object", "o", ":", "l", ")", "{", "callback", ".", "eval", "(", "(", "V", ")", "o", ")", ";", "}", "return", ";", "}", "//An array of Object[]", "if", "(", "x", ".", "getClass", "(", ")", ".", "isArray", "(", ")", ")", "{", "for", "(", "final", "Object", "o", ":", "(", "Object", "[", "]", ")", "x", ")", "{", "callback", ".", "eval", "(", "(", "V", ")", "o", ")", ";", "}", "return", ";", "}", "callback", ".", "eval", "(", "(", "V", ")", "x", ")", ";", "}" ]
Calls eval for each entry found, or just once if the "x" isn't iterable/collection/list/etc. with "x" @param x the object process @param callback the callback
[ "Calls", "eval", "for", "each", "entry", "found", "or", "just", "once", "if", "the", "x", "isn", "t", "iterable", "/", "collection", "/", "list", "/", "etc", ".", "with", "x" ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/IterHelper.java#L69-L93
google/closure-templates
java/src/com/google/template/soy/incrementaldomsrc/GenIncrementalDomCodeVisitor.java
GenIncrementalDomCodeVisitor.visitLetParamContentNode
private void visitLetParamContentNode(RenderUnitNode node, String generatedVarName) { """ Generates the content of a {@code let} or {@code param} statement. For HTML and attribute let/param statements, the generated instructions inside the node are wrapped in a function which will be optionally passed to another template and invoked in the correct location. All other kinds of let statements are generated as a simple variable. """ // The html transform step, performed by HtmlContextVisitor, ensures that // we always have a content kind specified. checkState(node.getContentKind() != null); IncrementalDomCodeBuilder jsCodeBuilder = getJsCodeBuilder(); SanitizedContentKind prevContentKind = jsCodeBuilder.getContentKind(); jsCodeBuilder.setContentKind(node.getContentKind()); CodeChunk definition; VariableDeclaration.Builder builder = VariableDeclaration.builder(generatedVarName); SanitizedContentKind kind = node.getContentKind(); if (kind == SanitizedContentKind.HTML || kind == SanitizedContentKind.ATTRIBUTES) { Expression constructor; if (kind == SanitizedContentKind.HTML) { constructor = SOY_IDOM_MAKE_HTML; } else { constructor = SOY_IDOM_MAKE_ATTRIBUTES; } JsDoc jsdoc = JsDoc.builder() .addParam(INCREMENTAL_DOM_PARAM_NAME, "incrementaldomlib.IncrementalDomRenderer") .build(); definition = builder .setRhs( constructor.call( Expression.arrowFunction(jsdoc, visitChildrenReturningCodeChunk(node)))) .build(); } else { // We do our own initialization, so mark it as such. String outputVarName = generatedVarName + "_output"; jsCodeBuilder.pushOutputVar(outputVarName).setOutputVarInited(); definition = Statement.of( VariableDeclaration.builder(outputVarName).setRhs(LITERAL_EMPTY_STRING).build(), visitChildrenReturningCodeChunk(node), builder .setRhs( JsRuntime.sanitizedContentOrdainerFunctionForInternalBlocks( node.getContentKind()) .call(id(outputVarName))) .build()); jsCodeBuilder.popOutputVar(); } jsCodeBuilder.setContentKind(prevContentKind); jsCodeBuilder.append(definition); }
java
private void visitLetParamContentNode(RenderUnitNode node, String generatedVarName) { // The html transform step, performed by HtmlContextVisitor, ensures that // we always have a content kind specified. checkState(node.getContentKind() != null); IncrementalDomCodeBuilder jsCodeBuilder = getJsCodeBuilder(); SanitizedContentKind prevContentKind = jsCodeBuilder.getContentKind(); jsCodeBuilder.setContentKind(node.getContentKind()); CodeChunk definition; VariableDeclaration.Builder builder = VariableDeclaration.builder(generatedVarName); SanitizedContentKind kind = node.getContentKind(); if (kind == SanitizedContentKind.HTML || kind == SanitizedContentKind.ATTRIBUTES) { Expression constructor; if (kind == SanitizedContentKind.HTML) { constructor = SOY_IDOM_MAKE_HTML; } else { constructor = SOY_IDOM_MAKE_ATTRIBUTES; } JsDoc jsdoc = JsDoc.builder() .addParam(INCREMENTAL_DOM_PARAM_NAME, "incrementaldomlib.IncrementalDomRenderer") .build(); definition = builder .setRhs( constructor.call( Expression.arrowFunction(jsdoc, visitChildrenReturningCodeChunk(node)))) .build(); } else { // We do our own initialization, so mark it as such. String outputVarName = generatedVarName + "_output"; jsCodeBuilder.pushOutputVar(outputVarName).setOutputVarInited(); definition = Statement.of( VariableDeclaration.builder(outputVarName).setRhs(LITERAL_EMPTY_STRING).build(), visitChildrenReturningCodeChunk(node), builder .setRhs( JsRuntime.sanitizedContentOrdainerFunctionForInternalBlocks( node.getContentKind()) .call(id(outputVarName))) .build()); jsCodeBuilder.popOutputVar(); } jsCodeBuilder.setContentKind(prevContentKind); jsCodeBuilder.append(definition); }
[ "private", "void", "visitLetParamContentNode", "(", "RenderUnitNode", "node", ",", "String", "generatedVarName", ")", "{", "// The html transform step, performed by HtmlContextVisitor, ensures that", "// we always have a content kind specified.", "checkState", "(", "node", ".", "getContentKind", "(", ")", "!=", "null", ")", ";", "IncrementalDomCodeBuilder", "jsCodeBuilder", "=", "getJsCodeBuilder", "(", ")", ";", "SanitizedContentKind", "prevContentKind", "=", "jsCodeBuilder", ".", "getContentKind", "(", ")", ";", "jsCodeBuilder", ".", "setContentKind", "(", "node", ".", "getContentKind", "(", ")", ")", ";", "CodeChunk", "definition", ";", "VariableDeclaration", ".", "Builder", "builder", "=", "VariableDeclaration", ".", "builder", "(", "generatedVarName", ")", ";", "SanitizedContentKind", "kind", "=", "node", ".", "getContentKind", "(", ")", ";", "if", "(", "kind", "==", "SanitizedContentKind", ".", "HTML", "||", "kind", "==", "SanitizedContentKind", ".", "ATTRIBUTES", ")", "{", "Expression", "constructor", ";", "if", "(", "kind", "==", "SanitizedContentKind", ".", "HTML", ")", "{", "constructor", "=", "SOY_IDOM_MAKE_HTML", ";", "}", "else", "{", "constructor", "=", "SOY_IDOM_MAKE_ATTRIBUTES", ";", "}", "JsDoc", "jsdoc", "=", "JsDoc", ".", "builder", "(", ")", ".", "addParam", "(", "INCREMENTAL_DOM_PARAM_NAME", ",", "\"incrementaldomlib.IncrementalDomRenderer\"", ")", ".", "build", "(", ")", ";", "definition", "=", "builder", ".", "setRhs", "(", "constructor", ".", "call", "(", "Expression", ".", "arrowFunction", "(", "jsdoc", ",", "visitChildrenReturningCodeChunk", "(", "node", ")", ")", ")", ")", ".", "build", "(", ")", ";", "}", "else", "{", "// We do our own initialization, so mark it as such.", "String", "outputVarName", "=", "generatedVarName", "+", "\"_output\"", ";", "jsCodeBuilder", ".", "pushOutputVar", "(", "outputVarName", ")", ".", "setOutputVarInited", "(", ")", ";", "definition", "=", "Statement", ".", "of", "(", "VariableDeclaration", ".", "builder", "(", "outputVarName", ")", ".", "setRhs", "(", "LITERAL_EMPTY_STRING", ")", ".", "build", "(", ")", ",", "visitChildrenReturningCodeChunk", "(", "node", ")", ",", "builder", ".", "setRhs", "(", "JsRuntime", ".", "sanitizedContentOrdainerFunctionForInternalBlocks", "(", "node", ".", "getContentKind", "(", ")", ")", ".", "call", "(", "id", "(", "outputVarName", ")", ")", ")", ".", "build", "(", ")", ")", ";", "jsCodeBuilder", ".", "popOutputVar", "(", ")", ";", "}", "jsCodeBuilder", ".", "setContentKind", "(", "prevContentKind", ")", ";", "jsCodeBuilder", ".", "append", "(", "definition", ")", ";", "}" ]
Generates the content of a {@code let} or {@code param} statement. For HTML and attribute let/param statements, the generated instructions inside the node are wrapped in a function which will be optionally passed to another template and invoked in the correct location. All other kinds of let statements are generated as a simple variable.
[ "Generates", "the", "content", "of", "a", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/incrementaldomsrc/GenIncrementalDomCodeVisitor.java#L647-L697
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java
BigDecimalMath.atanh
public static BigDecimal atanh(BigDecimal x, MathContext mathContext) { """ Calculates the arc hyperbolic tangens (inverse hyperbolic tangens) of {@link BigDecimal} x. <p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p> @param x the {@link BigDecimal} to calculate the arc hyperbolic tangens for @param mathContext the {@link MathContext} used for the result @return the calculated arc hyperbolic tangens {@link BigDecimal} with the precision specified in the <code>mathContext</code> @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision """ if (x.compareTo(BigDecimal.ONE) >= 0) { throw new ArithmeticException("Illegal atanh(x) for x >= 1: x = " + x); } if (x.compareTo(MINUS_ONE) <= 0) { throw new ArithmeticException("Illegal atanh(x) for x <= -1: x = " + x); } checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); BigDecimal result = log(ONE.add(x, mc).divide(ONE.subtract(x, mc), mc), mc).multiply(ONE_HALF, mc); return round(result, mathContext); }
java
public static BigDecimal atanh(BigDecimal x, MathContext mathContext) { if (x.compareTo(BigDecimal.ONE) >= 0) { throw new ArithmeticException("Illegal atanh(x) for x >= 1: x = " + x); } if (x.compareTo(MINUS_ONE) <= 0) { throw new ArithmeticException("Illegal atanh(x) for x <= -1: x = " + x); } checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode()); BigDecimal result = log(ONE.add(x, mc).divide(ONE.subtract(x, mc), mc), mc).multiply(ONE_HALF, mc); return round(result, mathContext); }
[ "public", "static", "BigDecimal", "atanh", "(", "BigDecimal", "x", ",", "MathContext", "mathContext", ")", "{", "if", "(", "x", ".", "compareTo", "(", "BigDecimal", ".", "ONE", ")", ">=", "0", ")", "{", "throw", "new", "ArithmeticException", "(", "\"Illegal atanh(x) for x >= 1: x = \"", "+", "x", ")", ";", "}", "if", "(", "x", ".", "compareTo", "(", "MINUS_ONE", ")", "<=", "0", ")", "{", "throw", "new", "ArithmeticException", "(", "\"Illegal atanh(x) for x <= -1: x = \"", "+", "x", ")", ";", "}", "checkMathContext", "(", "mathContext", ")", ";", "MathContext", "mc", "=", "new", "MathContext", "(", "mathContext", ".", "getPrecision", "(", ")", "+", "6", ",", "mathContext", ".", "getRoundingMode", "(", ")", ")", ";", "BigDecimal", "result", "=", "log", "(", "ONE", ".", "add", "(", "x", ",", "mc", ")", ".", "divide", "(", "ONE", ".", "subtract", "(", "x", ",", "mc", ")", ",", "mc", ")", ",", "mc", ")", ".", "multiply", "(", "ONE_HALF", ",", "mc", ")", ";", "return", "round", "(", "result", ",", "mathContext", ")", ";", "}" ]
Calculates the arc hyperbolic tangens (inverse hyperbolic tangens) of {@link BigDecimal} x. <p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p> @param x the {@link BigDecimal} to calculate the arc hyperbolic tangens for @param mathContext the {@link MathContext} used for the result @return the calculated arc hyperbolic tangens {@link BigDecimal} with the precision specified in the <code>mathContext</code> @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision
[ "Calculates", "the", "arc", "hyperbolic", "tangens", "(", "inverse", "hyperbolic", "tangens", ")", "of", "{", "@link", "BigDecimal", "}", "x", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L1635-L1647
apollographql/apollo-android
apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java
ResponseField.forLong
public static ResponseField forLong(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { """ Factory method for creating a Field instance representing {@link Type#LONG}. @param responseName alias for the result of a field @param fieldName name of the field in the GraphQL operation @param arguments arguments to be passed along with the field @param optional whether the arguments passed along are optional or required @param conditions list of conditions for this field @return Field instance representing {@link Type#LONG} """ return new ResponseField(Type.LONG, responseName, fieldName, arguments, optional, conditions); }
java
public static ResponseField forLong(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.LONG, responseName, fieldName, arguments, optional, conditions); }
[ "public", "static", "ResponseField", "forLong", "(", "String", "responseName", ",", "String", "fieldName", ",", "Map", "<", "String", ",", "Object", ">", "arguments", ",", "boolean", "optional", ",", "List", "<", "Condition", ">", "conditions", ")", "{", "return", "new", "ResponseField", "(", "Type", ".", "LONG", ",", "responseName", ",", "fieldName", ",", "arguments", ",", "optional", ",", "conditions", ")", ";", "}" ]
Factory method for creating a Field instance representing {@link Type#LONG}. @param responseName alias for the result of a field @param fieldName name of the field in the GraphQL operation @param arguments arguments to be passed along with the field @param optional whether the arguments passed along are optional or required @param conditions list of conditions for this field @return Field instance representing {@link Type#LONG}
[ "Factory", "method", "for", "creating", "a", "Field", "instance", "representing", "{", "@link", "Type#LONG", "}", "." ]
train
https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java#L70-L73
google/error-prone
check_api/src/main/java/com/google/errorprone/SuppressionInfo.java
SuppressionInfo.forCompilationUnit
public SuppressionInfo forCompilationUnit(CompilationUnitTree tree, VisitorState state) { """ Generates the {@link SuppressionInfo} for a {@link CompilationUnitTree}. This differs in that {@code isGenerated} is determined by inspecting the annotations of the outermost class so that matchers on {@link CompilationUnitTree} will also be suppressed. """ AtomicBoolean generated = new AtomicBoolean(false); new SimpleTreeVisitor<Void, Void>() { @Override public Void visitClass(ClassTree node, Void unused) { ClassSymbol symbol = ASTHelpers.getSymbol(node); generated.compareAndSet(false, symbol != null && isGenerated(symbol, state)); return null; } }.visit(tree.getTypeDecls(), null); return new SuppressionInfo(suppressWarningsStrings, customSuppressions, generated.get()); }
java
public SuppressionInfo forCompilationUnit(CompilationUnitTree tree, VisitorState state) { AtomicBoolean generated = new AtomicBoolean(false); new SimpleTreeVisitor<Void, Void>() { @Override public Void visitClass(ClassTree node, Void unused) { ClassSymbol symbol = ASTHelpers.getSymbol(node); generated.compareAndSet(false, symbol != null && isGenerated(symbol, state)); return null; } }.visit(tree.getTypeDecls(), null); return new SuppressionInfo(suppressWarningsStrings, customSuppressions, generated.get()); }
[ "public", "SuppressionInfo", "forCompilationUnit", "(", "CompilationUnitTree", "tree", ",", "VisitorState", "state", ")", "{", "AtomicBoolean", "generated", "=", "new", "AtomicBoolean", "(", "false", ")", ";", "new", "SimpleTreeVisitor", "<", "Void", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "visitClass", "(", "ClassTree", "node", ",", "Void", "unused", ")", "{", "ClassSymbol", "symbol", "=", "ASTHelpers", ".", "getSymbol", "(", "node", ")", ";", "generated", ".", "compareAndSet", "(", "false", ",", "symbol", "!=", "null", "&&", "isGenerated", "(", "symbol", ",", "state", ")", ")", ";", "return", "null", ";", "}", "}", ".", "visit", "(", "tree", ".", "getTypeDecls", "(", ")", ",", "null", ")", ";", "return", "new", "SuppressionInfo", "(", "suppressWarningsStrings", ",", "customSuppressions", ",", "generated", ".", "get", "(", ")", ")", ";", "}" ]
Generates the {@link SuppressionInfo} for a {@link CompilationUnitTree}. This differs in that {@code isGenerated} is determined by inspecting the annotations of the outermost class so that matchers on {@link CompilationUnitTree} will also be suppressed.
[ "Generates", "the", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/SuppressionInfo.java#L116-L127
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java
MerkleTreeUtil.getLeafOrderForHash
static int getLeafOrderForHash(int hash, int level) { """ Returns the breadth-first order of the leaf that a given {@code hash} belongs to @param hash The hash for which the leaf order to be calculated @param level The level @return the breadth-first order of the leaf for the given {@code hash} """ long hashStepForLevel = getNodeHashRangeOnLevel(level); long hashDistanceFromMin = ((long) hash) - Integer.MIN_VALUE; int steps = (int) (hashDistanceFromMin / hashStepForLevel); int leftMostNodeOrderOnLevel = getLeftMostNodeOrderOnLevel(level); return leftMostNodeOrderOnLevel + steps; }
java
static int getLeafOrderForHash(int hash, int level) { long hashStepForLevel = getNodeHashRangeOnLevel(level); long hashDistanceFromMin = ((long) hash) - Integer.MIN_VALUE; int steps = (int) (hashDistanceFromMin / hashStepForLevel); int leftMostNodeOrderOnLevel = getLeftMostNodeOrderOnLevel(level); return leftMostNodeOrderOnLevel + steps; }
[ "static", "int", "getLeafOrderForHash", "(", "int", "hash", ",", "int", "level", ")", "{", "long", "hashStepForLevel", "=", "getNodeHashRangeOnLevel", "(", "level", ")", ";", "long", "hashDistanceFromMin", "=", "(", "(", "long", ")", "hash", ")", "-", "Integer", ".", "MIN_VALUE", ";", "int", "steps", "=", "(", "int", ")", "(", "hashDistanceFromMin", "/", "hashStepForLevel", ")", ";", "int", "leftMostNodeOrderOnLevel", "=", "getLeftMostNodeOrderOnLevel", "(", "level", ")", ";", "return", "leftMostNodeOrderOnLevel", "+", "steps", ";", "}" ]
Returns the breadth-first order of the leaf that a given {@code hash} belongs to @param hash The hash for which the leaf order to be calculated @param level The level @return the breadth-first order of the leaf for the given {@code hash}
[ "Returns", "the", "breadth", "-", "first", "order", "of", "the", "leaf", "that", "a", "given", "{", "@code", "hash", "}", "belongs", "to" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/wan/merkletree/MerkleTreeUtil.java#L48-L55
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java
MetricRegistryConfiguration.fromConfiguration
public static MetricRegistryConfiguration fromConfiguration(Configuration configuration) { """ Create a metric registry configuration object from the given {@link Configuration}. @param configuration to generate the metric registry configuration from @return Metric registry configuration generated from the configuration """ ScopeFormats scopeFormats; try { scopeFormats = ScopeFormats.fromConfig(configuration); } catch (Exception e) { LOG.warn("Failed to parse scope format, using default scope formats", e); scopeFormats = ScopeFormats.fromConfig(new Configuration()); } char delim; try { delim = configuration.getString(MetricOptions.SCOPE_DELIMITER).charAt(0); } catch (Exception e) { LOG.warn("Failed to parse delimiter, using default delimiter.", e); delim = '.'; } final long maximumFrameSize = AkkaRpcServiceUtils.extractMaximumFramesize(configuration); // padding to account for serialization overhead final long messageSizeLimitPadding = 256; return new MetricRegistryConfiguration(scopeFormats, delim, maximumFrameSize - messageSizeLimitPadding); }
java
public static MetricRegistryConfiguration fromConfiguration(Configuration configuration) { ScopeFormats scopeFormats; try { scopeFormats = ScopeFormats.fromConfig(configuration); } catch (Exception e) { LOG.warn("Failed to parse scope format, using default scope formats", e); scopeFormats = ScopeFormats.fromConfig(new Configuration()); } char delim; try { delim = configuration.getString(MetricOptions.SCOPE_DELIMITER).charAt(0); } catch (Exception e) { LOG.warn("Failed to parse delimiter, using default delimiter.", e); delim = '.'; } final long maximumFrameSize = AkkaRpcServiceUtils.extractMaximumFramesize(configuration); // padding to account for serialization overhead final long messageSizeLimitPadding = 256; return new MetricRegistryConfiguration(scopeFormats, delim, maximumFrameSize - messageSizeLimitPadding); }
[ "public", "static", "MetricRegistryConfiguration", "fromConfiguration", "(", "Configuration", "configuration", ")", "{", "ScopeFormats", "scopeFormats", ";", "try", "{", "scopeFormats", "=", "ScopeFormats", ".", "fromConfig", "(", "configuration", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "warn", "(", "\"Failed to parse scope format, using default scope formats\"", ",", "e", ")", ";", "scopeFormats", "=", "ScopeFormats", ".", "fromConfig", "(", "new", "Configuration", "(", ")", ")", ";", "}", "char", "delim", ";", "try", "{", "delim", "=", "configuration", ".", "getString", "(", "MetricOptions", ".", "SCOPE_DELIMITER", ")", ".", "charAt", "(", "0", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "warn", "(", "\"Failed to parse delimiter, using default delimiter.\"", ",", "e", ")", ";", "delim", "=", "'", "'", ";", "}", "final", "long", "maximumFrameSize", "=", "AkkaRpcServiceUtils", ".", "extractMaximumFramesize", "(", "configuration", ")", ";", "// padding to account for serialization overhead", "final", "long", "messageSizeLimitPadding", "=", "256", ";", "return", "new", "MetricRegistryConfiguration", "(", "scopeFormats", ",", "delim", ",", "maximumFrameSize", "-", "messageSizeLimitPadding", ")", ";", "}" ]
Create a metric registry configuration object from the given {@link Configuration}. @param configuration to generate the metric registry configuration from @return Metric registry configuration generated from the configuration
[ "Create", "a", "metric", "registry", "configuration", "object", "from", "the", "given", "{", "@link", "Configuration", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java#L83-L106
apereo/cas
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java
OAuth20Utils.checkResponseTypes
public static boolean checkResponseTypes(final String type, final OAuth20ResponseTypes... expectedTypes) { """ Check the response type against expected response types. @param type the current response type @param expectedTypes the expected response types @return whether the response type is supported """ LOGGER.debug("Response type: [{}]", type); val checked = Stream.of(expectedTypes).anyMatch(t -> OAuth20Utils.isResponseType(type, t)); if (!checked) { LOGGER.error("Unsupported response type: [{}]", type); } return checked; }
java
public static boolean checkResponseTypes(final String type, final OAuth20ResponseTypes... expectedTypes) { LOGGER.debug("Response type: [{}]", type); val checked = Stream.of(expectedTypes).anyMatch(t -> OAuth20Utils.isResponseType(type, t)); if (!checked) { LOGGER.error("Unsupported response type: [{}]", type); } return checked; }
[ "public", "static", "boolean", "checkResponseTypes", "(", "final", "String", "type", ",", "final", "OAuth20ResponseTypes", "...", "expectedTypes", ")", "{", "LOGGER", ".", "debug", "(", "\"Response type: [{}]\"", ",", "type", ")", ";", "val", "checked", "=", "Stream", ".", "of", "(", "expectedTypes", ")", ".", "anyMatch", "(", "t", "->", "OAuth20Utils", ".", "isResponseType", "(", "type", ",", "t", ")", ")", ";", "if", "(", "!", "checked", ")", "{", "LOGGER", ".", "error", "(", "\"Unsupported response type: [{}]\"", ",", "type", ")", ";", "}", "return", "checked", ";", "}" ]
Check the response type against expected response types. @param type the current response type @param expectedTypes the expected response types @return whether the response type is supported
[ "Check", "the", "response", "type", "against", "expected", "response", "types", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/util/OAuth20Utils.java#L406-L413
apache/incubator-gobblin
gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java
AzkabanClient.handleResponse
protected static Map<String, String> handleResponse(HttpResponse response) throws IOException { """ Convert a {@link HttpResponse} to a <string, string> map. Put protected modifier here so it is visible to {@link AzkabanAjaxAPIClient}. @param response An http response returned by {@link org.apache.http.client.HttpClient} execution. This should be JSON string. @return A map composed by the first level of KV pair of json object """ int code = response.getStatusLine().getStatusCode(); if (code != HttpStatus.SC_CREATED && code != HttpStatus.SC_OK) { log.error("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); throw new AzkabanClientException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } // Get response in string HttpEntity entity = null; String jsonResponseString; try { entity = response.getEntity(); jsonResponseString = IOUtils.toString(entity.getContent(), "UTF-8"); log.info("Response string: " + jsonResponseString); } catch (Exception e) { throw new AzkabanClientException("Cannot convert response to a string", e); } finally { if (entity != null) { EntityUtils.consume(entity); } } return AzkabanClient.parseResponse(jsonResponseString); }
java
protected static Map<String, String> handleResponse(HttpResponse response) throws IOException { int code = response.getStatusLine().getStatusCode(); if (code != HttpStatus.SC_CREATED && code != HttpStatus.SC_OK) { log.error("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); throw new AzkabanClientException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } // Get response in string HttpEntity entity = null; String jsonResponseString; try { entity = response.getEntity(); jsonResponseString = IOUtils.toString(entity.getContent(), "UTF-8"); log.info("Response string: " + jsonResponseString); } catch (Exception e) { throw new AzkabanClientException("Cannot convert response to a string", e); } finally { if (entity != null) { EntityUtils.consume(entity); } } return AzkabanClient.parseResponse(jsonResponseString); }
[ "protected", "static", "Map", "<", "String", ",", "String", ">", "handleResponse", "(", "HttpResponse", "response", ")", "throws", "IOException", "{", "int", "code", "=", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", ";", "if", "(", "code", "!=", "HttpStatus", ".", "SC_CREATED", "&&", "code", "!=", "HttpStatus", ".", "SC_OK", ")", "{", "log", ".", "error", "(", "\"Failed : HTTP error code : \"", "+", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", ")", ";", "throw", "new", "AzkabanClientException", "(", "\"Failed : HTTP error code : \"", "+", "response", ".", "getStatusLine", "(", ")", ".", "getStatusCode", "(", ")", ")", ";", "}", "// Get response in string", "HttpEntity", "entity", "=", "null", ";", "String", "jsonResponseString", ";", "try", "{", "entity", "=", "response", ".", "getEntity", "(", ")", ";", "jsonResponseString", "=", "IOUtils", ".", "toString", "(", "entity", ".", "getContent", "(", ")", ",", "\"UTF-8\"", ")", ";", "log", ".", "info", "(", "\"Response string: \"", "+", "jsonResponseString", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "AzkabanClientException", "(", "\"Cannot convert response to a string\"", ",", "e", ")", ";", "}", "finally", "{", "if", "(", "entity", "!=", "null", ")", "{", "EntityUtils", ".", "consume", "(", "entity", ")", ";", "}", "}", "return", "AzkabanClient", ".", "parseResponse", "(", "jsonResponseString", ")", ";", "}" ]
Convert a {@link HttpResponse} to a <string, string> map. Put protected modifier here so it is visible to {@link AzkabanAjaxAPIClient}. @param response An http response returned by {@link org.apache.http.client.HttpClient} execution. This should be JSON string. @return A map composed by the first level of KV pair of json object
[ "Convert", "a", "{", "@link", "HttpResponse", "}", "to", "a", "<string", "string", ">", "map", ".", "Put", "protected", "modifier", "here", "so", "it", "is", "visible", "to", "{", "@link", "AzkabanAjaxAPIClient", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java#L206-L230
languagetool-org/languagetool
languagetool-server/src/main/java/org/languagetool/server/ServerTools.java
ServerTools.print
static void print(String s, PrintStream outputStream) { """ /* replace with structured logging: check done cache stats maybe: (could be combined in table) Access denied: request size / rate limit / ... more interesting: error rate too high text checking took longer than ... misc.: language code unknown missing arguments old api blacklisted referrer various other exceptions """ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ZZ"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); String now = dateFormat.format(new Date()); outputStream.println(now + " " + s); }
java
static void print(String s, PrintStream outputStream) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ZZ"); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); String now = dateFormat.format(new Date()); outputStream.println(now + " " + s); }
[ "static", "void", "print", "(", "String", "s", ",", "PrintStream", "outputStream", ")", "{", "SimpleDateFormat", "dateFormat", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd HH:mm:ss ZZ\"", ")", ";", "dateFormat", ".", "setTimeZone", "(", "TimeZone", ".", "getTimeZone", "(", "\"UTC\"", ")", ")", ";", "String", "now", "=", "dateFormat", ".", "format", "(", "new", "Date", "(", ")", ")", ";", "outputStream", ".", "println", "(", "now", "+", "\" \"", "+", "s", ")", ";", "}" ]
/* replace with structured logging: check done cache stats maybe: (could be combined in table) Access denied: request size / rate limit / ... more interesting: error rate too high text checking took longer than ... misc.: language code unknown missing arguments old api blacklisted referrer various other exceptions
[ "/", "*", "replace", "with", "structured", "logging", ":", "check", "done", "cache", "stats" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-server/src/main/java/org/languagetool/server/ServerTools.java#L68-L73
michael-rapp/AndroidPreferenceActivity
example/src/main/java/de/mrapp/android/preference/activity/example/dialog/RemovePreferenceHeaderDialogBuilder.java
RemovePreferenceHeaderDialogBuilder.createRemovePreferenceHeaderClickListener
private OnClickListener createRemovePreferenceHeaderClickListener() { """ Creates and returns a listener, which allows to notify the registered listener, when the user closes the dialog confirmatively. @return The listener, which has been created, as an instance of the type {@link OnClickListener} """ return new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { int position = spinner.getSelectedItemPosition(); listener.onRemovePreferenceHeader(position); } }; }
java
private OnClickListener createRemovePreferenceHeaderClickListener() { return new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int which) { int position = spinner.getSelectedItemPosition(); listener.onRemovePreferenceHeader(position); } }; }
[ "private", "OnClickListener", "createRemovePreferenceHeaderClickListener", "(", ")", "{", "return", "new", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "final", "DialogInterface", "dialog", ",", "final", "int", "which", ")", "{", "int", "position", "=", "spinner", ".", "getSelectedItemPosition", "(", ")", ";", "listener", ".", "onRemovePreferenceHeader", "(", "position", ")", ";", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to notify the registered listener, when the user closes the dialog confirmatively. @return The listener, which has been created, as an instance of the type {@link OnClickListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "notify", "the", "registered", "listener", "when", "the", "user", "closes", "the", "dialog", "confirmatively", "." ]
train
https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/dialog/RemovePreferenceHeaderDialogBuilder.java#L132-L142
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java
SyncGroupsInner.listHubSchemasWithServiceResponseAsync
public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> listHubSchemasWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { """ Gets a collection of hub database schemas. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SyncFullSchemaPropertiesInner&gt; object """ return listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName) .concatMap(new Func1<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>, Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>>>() { @Override public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> call(ServiceResponse<Page<SyncFullSchemaPropertiesInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listHubSchemasNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> listHubSchemasWithServiceResponseAsync(final String resourceGroupName, final String serverName, final String databaseName, final String syncGroupName) { return listHubSchemasSinglePageAsync(resourceGroupName, serverName, databaseName, syncGroupName) .concatMap(new Func1<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>, Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>>>() { @Override public Observable<ServiceResponse<Page<SyncFullSchemaPropertiesInner>>> call(ServiceResponse<Page<SyncFullSchemaPropertiesInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listHubSchemasNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SyncFullSchemaPropertiesInner", ">", ">", ">", "listHubSchemasWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ",", "final", "String", "databaseName", ",", "final", "String", "syncGroupName", ")", "{", "return", "listHubSchemasSinglePageAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", "syncGroupName", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "SyncFullSchemaPropertiesInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SyncFullSchemaPropertiesInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SyncFullSchemaPropertiesInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "SyncFullSchemaPropertiesInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listHubSchemasNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Gets a collection of hub database schemas. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SyncFullSchemaPropertiesInner&gt; object
[ "Gets", "a", "collection", "of", "hub", "database", "schemas", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java#L516-L528
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
NodeIndexer.createFulltextField
protected Fieldable createFulltextField(Reader value) { """ Creates a fulltext field for the reader <code>value</code>. @param value the reader value. @return a lucene field. """ if (supportHighlighting) { return new TextFieldExtractor(FieldNames.FULLTEXT, value, true, true); } else { return new TextFieldExtractor(FieldNames.FULLTEXT, value, false, false); } }
java
protected Fieldable createFulltextField(Reader value) { if (supportHighlighting) { return new TextFieldExtractor(FieldNames.FULLTEXT, value, true, true); } else { return new TextFieldExtractor(FieldNames.FULLTEXT, value, false, false); } }
[ "protected", "Fieldable", "createFulltextField", "(", "Reader", "value", ")", "{", "if", "(", "supportHighlighting", ")", "{", "return", "new", "TextFieldExtractor", "(", "FieldNames", ".", "FULLTEXT", ",", "value", ",", "true", ",", "true", ")", ";", "}", "else", "{", "return", "new", "TextFieldExtractor", "(", "FieldNames", ".", "FULLTEXT", ",", "value", ",", "false", ",", "false", ")", ";", "}", "}" ]
Creates a fulltext field for the reader <code>value</code>. @param value the reader value. @return a lucene field.
[ "Creates", "a", "fulltext", "field", "for", "the", "reader", "<code", ">", "value<", "/", "code", ">", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L919-L929
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/rest/RegisteredCommand.java
RegisteredCommand.compareNodes
private static int compareNodes(String node1, String node2) { """ path nodes are query parameters. Either node can be empty, but not null. """ assert node1 != null; assert node2 != null; if (node1.equals(node2)) { return 0; } if (node1.length() > 0 && node1.charAt(0) == '{') { if (node2.length() > 0 && node2.charAt(0) == '{') { return 0; // Both nodes are parameters; names are irrelevant } return 1; // r1 is a parameter but r2 is not, so r2 should come first } if (node2.length() > 0 && node2.charAt(0) == '{') { return -1; // r2 is a parameter but r1 is not, so r1 should come first } return node1.compareTo(node2); // neither node is a parameter }
java
private static int compareNodes(String node1, String node2) { assert node1 != null; assert node2 != null; if (node1.equals(node2)) { return 0; } if (node1.length() > 0 && node1.charAt(0) == '{') { if (node2.length() > 0 && node2.charAt(0) == '{') { return 0; // Both nodes are parameters; names are irrelevant } return 1; // r1 is a parameter but r2 is not, so r2 should come first } if (node2.length() > 0 && node2.charAt(0) == '{') { return -1; // r2 is a parameter but r1 is not, so r1 should come first } return node1.compareTo(node2); // neither node is a parameter }
[ "private", "static", "int", "compareNodes", "(", "String", "node1", ",", "String", "node2", ")", "{", "assert", "node1", "!=", "null", ";", "assert", "node2", "!=", "null", ";", "if", "(", "node1", ".", "equals", "(", "node2", ")", ")", "{", "return", "0", ";", "}", "if", "(", "node1", ".", "length", "(", ")", ">", "0", "&&", "node1", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "if", "(", "node2", ".", "length", "(", ")", ">", "0", "&&", "node2", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "return", "0", ";", "// Both nodes are parameters; names are irrelevant", "}", "return", "1", ";", "// r1 is a parameter but r2 is not, so r2 should come first", "}", "if", "(", "node2", ".", "length", "(", ")", ">", "0", "&&", "node2", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "return", "-", "1", ";", "// r2 is a parameter but r1 is not, so r1 should come first", "}", "return", "node1", ".", "compareTo", "(", "node2", ")", ";", "// neither node is a parameter", "}" ]
path nodes are query parameters. Either node can be empty, but not null.
[ "path", "nodes", "are", "query", "parameters", ".", "Either", "node", "can", "be", "empty", "but", "not", "null", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/rest/RegisteredCommand.java#L223-L240
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java
CuratorFrameworkFactory.newClient
public static CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy) { """ Create a new client @param connectString list of servers to connect to @param sessionTimeoutMs session timeout @param connectionTimeoutMs connection timeout @param retryPolicy retry policy to use @return client """ return builder(). connectString(connectString). sessionTimeoutMs(sessionTimeoutMs). connectionTimeoutMs(connectionTimeoutMs). retryPolicy(retryPolicy). build(); }
java
public static CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy) { return builder(). connectString(connectString). sessionTimeoutMs(sessionTimeoutMs). connectionTimeoutMs(connectionTimeoutMs). retryPolicy(retryPolicy). build(); }
[ "public", "static", "CuratorFramework", "newClient", "(", "String", "connectString", ",", "int", "sessionTimeoutMs", ",", "int", "connectionTimeoutMs", ",", "RetryPolicy", "retryPolicy", ")", "{", "return", "builder", "(", ")", ".", "connectString", "(", "connectString", ")", ".", "sessionTimeoutMs", "(", "sessionTimeoutMs", ")", ".", "connectionTimeoutMs", "(", "connectionTimeoutMs", ")", ".", "retryPolicy", "(", "retryPolicy", ")", ".", "build", "(", ")", ";", "}" ]
Create a new client @param connectString list of servers to connect to @param sessionTimeoutMs session timeout @param connectionTimeoutMs connection timeout @param retryPolicy retry policy to use @return client
[ "Create", "a", "new", "client" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java#L93-L101
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/style/stylers/Image.java
Image.style
@Override public final <E> E style(E element, Object data) throws VectorPrintException { """ Calls {@link #initURL(String) }, {@link #createImage(com.itextpdf.text.pdf.PdfContentByte, java.lang.Object, float) }, {@link #applySettings(com.itextpdf.text.Image) }. Calls {@link VectorPrintDocument#addHook(com.vectorprint.report.itext.VectorPrintDocument.AddElementHook) } for drawing image shadow and for drawing near this image. @param <E> @param element @param data when null use {@link #getData() } @return @throws VectorPrintException """ initURL(String.valueOf((data != null) ? convert(data) : getData())); try { /* always call createImage when styling, subclasses may do their own document writing etc. in createImage */ com.itextpdf.text.Image img = createImage(getWriter().getDirectContent(), (data != null) ? convert(data) : getData(), getValue(OPACITY, Float.class)); if (data != null) { setData(convert(data)); } applySettings(img); VectorPrintDocument document = (VectorPrintDocument) getDocument(); if (getValue(SHADOW, Boolean.class)) { // draw a shadow, but we do not know our position document.addHook(new VectorPrintDocument.AddElementHook(VectorPrintDocument.AddElementHook.INTENTION.PRINTIMAGESHADOW, img, this, getStyleClass())); } document.addHook(new VectorPrintDocument.AddElementHook(VectorPrintDocument.AddElementHook.INTENTION.DRAWNEARIMAGE, img, this, getStyleClass())); if (element != null) { // if we got here with an element, proceed no further, this element should finaly be added to the document return element; } return (E) img; } catch (BadElementException ex) { throw new VectorPrintException(ex); } }
java
@Override public final <E> E style(E element, Object data) throws VectorPrintException { initURL(String.valueOf((data != null) ? convert(data) : getData())); try { /* always call createImage when styling, subclasses may do their own document writing etc. in createImage */ com.itextpdf.text.Image img = createImage(getWriter().getDirectContent(), (data != null) ? convert(data) : getData(), getValue(OPACITY, Float.class)); if (data != null) { setData(convert(data)); } applySettings(img); VectorPrintDocument document = (VectorPrintDocument) getDocument(); if (getValue(SHADOW, Boolean.class)) { // draw a shadow, but we do not know our position document.addHook(new VectorPrintDocument.AddElementHook(VectorPrintDocument.AddElementHook.INTENTION.PRINTIMAGESHADOW, img, this, getStyleClass())); } document.addHook(new VectorPrintDocument.AddElementHook(VectorPrintDocument.AddElementHook.INTENTION.DRAWNEARIMAGE, img, this, getStyleClass())); if (element != null) { // if we got here with an element, proceed no further, this element should finaly be added to the document return element; } return (E) img; } catch (BadElementException ex) { throw new VectorPrintException(ex); } }
[ "@", "Override", "public", "final", "<", "E", ">", "E", "style", "(", "E", "element", ",", "Object", "data", ")", "throws", "VectorPrintException", "{", "initURL", "(", "String", ".", "valueOf", "(", "(", "data", "!=", "null", ")", "?", "convert", "(", "data", ")", ":", "getData", "(", ")", ")", ")", ";", "try", "{", "/*\n always call createImage when styling, subclasses may do their own document writing etc. in createImage\n */", "com", ".", "itextpdf", ".", "text", ".", "Image", "img", "=", "createImage", "(", "getWriter", "(", ")", ".", "getDirectContent", "(", ")", ",", "(", "data", "!=", "null", ")", "?", "convert", "(", "data", ")", ":", "getData", "(", ")", ",", "getValue", "(", "OPACITY", ",", "Float", ".", "class", ")", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "setData", "(", "convert", "(", "data", ")", ")", ";", "}", "applySettings", "(", "img", ")", ";", "VectorPrintDocument", "document", "=", "(", "VectorPrintDocument", ")", "getDocument", "(", ")", ";", "if", "(", "getValue", "(", "SHADOW", ",", "Boolean", ".", "class", ")", ")", "{", "// draw a shadow, but we do not know our position", "document", ".", "addHook", "(", "new", "VectorPrintDocument", ".", "AddElementHook", "(", "VectorPrintDocument", ".", "AddElementHook", ".", "INTENTION", ".", "PRINTIMAGESHADOW", ",", "img", ",", "this", ",", "getStyleClass", "(", ")", ")", ")", ";", "}", "document", ".", "addHook", "(", "new", "VectorPrintDocument", ".", "AddElementHook", "(", "VectorPrintDocument", ".", "AddElementHook", ".", "INTENTION", ".", "DRAWNEARIMAGE", ",", "img", ",", "this", ",", "getStyleClass", "(", ")", ")", ")", ";", "if", "(", "element", "!=", "null", ")", "{", "// if we got here with an element, proceed no further, this element should finaly be added to the document", "return", "element", ";", "}", "return", "(", "E", ")", "img", ";", "}", "catch", "(", "BadElementException", "ex", ")", "{", "throw", "new", "VectorPrintException", "(", "ex", ")", ";", "}", "}" ]
Calls {@link #initURL(String) }, {@link #createImage(com.itextpdf.text.pdf.PdfContentByte, java.lang.Object, float) }, {@link #applySettings(com.itextpdf.text.Image) }. Calls {@link VectorPrintDocument#addHook(com.vectorprint.report.itext.VectorPrintDocument.AddElementHook) } for drawing image shadow and for drawing near this image. @param <E> @param element @param data when null use {@link #getData() } @return @throws VectorPrintException
[ "Calls", "{", "@link", "#initURL", "(", "String", ")", "}", "{", "@link", "#createImage", "(", "com", ".", "itextpdf", ".", "text", ".", "pdf", ".", "PdfContentByte", "java", ".", "lang", ".", "Object", "float", ")", "}", "{", "@link", "#applySettings", "(", "com", ".", "itextpdf", ".", "text", ".", "Image", ")", "}", ".", "Calls", "{", "@link", "VectorPrintDocument#addHook", "(", "com", ".", "vectorprint", ".", "report", ".", "itext", ".", "VectorPrintDocument", ".", "AddElementHook", ")", "}", "for", "drawing", "image", "shadow", "and", "for", "drawing", "near", "this", "image", "." ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/stylers/Image.java#L173-L200
openbase/jul
extension/type/storage/src/main/java/org/openbase/jul/extension/type/storage/registry/consistency/TransformationFrameConsistencyHandler.java
TransformationFrameConsistencyHandler.verifyAndUpdatePlacement
protected PlacementConfig verifyAndUpdatePlacement(final String alias, final PlacementConfig placementConfig) throws CouldNotPerformException, EntryModification { """ Methods verifies and updates the transformation frame id for the given placement configuration. If the given placement configuration is up to date this the method returns null. @param alias @param placementConfig @return @throws CouldNotPerformException @throws EntryModification """ try { if (alias == null || alias.isEmpty()) { throw new NotAvailableException("label"); } if (placementConfig == null) { throw new NotAvailableException("placementconfig"); } String frameId = generateFrameId(alias, placementConfig); // verify and update frame id if (placementConfig.getTransformationFrameId().equals(frameId)) { return null; } return placementConfig.toBuilder().setTransformationFrameId(frameId).build(); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not verify and update placement!", ex); } }
java
protected PlacementConfig verifyAndUpdatePlacement(final String alias, final PlacementConfig placementConfig) throws CouldNotPerformException, EntryModification { try { if (alias == null || alias.isEmpty()) { throw new NotAvailableException("label"); } if (placementConfig == null) { throw new NotAvailableException("placementconfig"); } String frameId = generateFrameId(alias, placementConfig); // verify and update frame id if (placementConfig.getTransformationFrameId().equals(frameId)) { return null; } return placementConfig.toBuilder().setTransformationFrameId(frameId).build(); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not verify and update placement!", ex); } }
[ "protected", "PlacementConfig", "verifyAndUpdatePlacement", "(", "final", "String", "alias", ",", "final", "PlacementConfig", "placementConfig", ")", "throws", "CouldNotPerformException", ",", "EntryModification", "{", "try", "{", "if", "(", "alias", "==", "null", "||", "alias", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "NotAvailableException", "(", "\"label\"", ")", ";", "}", "if", "(", "placementConfig", "==", "null", ")", "{", "throw", "new", "NotAvailableException", "(", "\"placementconfig\"", ")", ";", "}", "String", "frameId", "=", "generateFrameId", "(", "alias", ",", "placementConfig", ")", ";", "// verify and update frame id", "if", "(", "placementConfig", ".", "getTransformationFrameId", "(", ")", ".", "equals", "(", "frameId", ")", ")", "{", "return", "null", ";", "}", "return", "placementConfig", ".", "toBuilder", "(", ")", ".", "setTransformationFrameId", "(", "frameId", ")", ".", "build", "(", ")", ";", "}", "catch", "(", "CouldNotPerformException", "ex", ")", "{", "throw", "new", "CouldNotPerformException", "(", "\"Could not verify and update placement!\"", ",", "ex", ")", ";", "}", "}" ]
Methods verifies and updates the transformation frame id for the given placement configuration. If the given placement configuration is up to date this the method returns null. @param alias @param placementConfig @return @throws CouldNotPerformException @throws EntryModification
[ "Methods", "verifies", "and", "updates", "the", "transformation", "frame", "id", "for", "the", "given", "placement", "configuration", ".", "If", "the", "given", "placement", "configuration", "is", "up", "to", "date", "this", "the", "method", "returns", "null", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/storage/src/main/java/org/openbase/jul/extension/type/storage/registry/consistency/TransformationFrameConsistencyHandler.java#L64-L85
netkicorp/java-wns-resolver
src/main/java/com/netki/tlsa/CertChainValidator.java
CertChainValidator.validateKeyChain
public boolean validateKeyChain(X509Certificate client, KeyStore keyStore) throws KeyStoreException, CertificateException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { """ Validate keychain @param client is the client X509Certificate @param keyStore containing all trusted certificate @return true if validation until root certificate success, false otherwise @throws KeyStoreException KeyStore is invalid @throws CertificateException Certificate is Invalid @throws InvalidAlgorithmParameterException Algorithm Parameter is Invalid @throws NoSuchAlgorithmException Algorithm Does Not Exist @throws NoSuchProviderException No Such Security Provider Exists """ X509Certificate[] certs = new X509Certificate[keyStore.size()]; int i = 0; Enumeration<String> alias = keyStore.aliases(); while (alias.hasMoreElements()) { certs[i++] = (X509Certificate) keyStore.getCertificate(alias.nextElement()); } return validateKeyChain(client, certs); }
java
public boolean validateKeyChain(X509Certificate client, KeyStore keyStore) throws KeyStoreException, CertificateException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException { X509Certificate[] certs = new X509Certificate[keyStore.size()]; int i = 0; Enumeration<String> alias = keyStore.aliases(); while (alias.hasMoreElements()) { certs[i++] = (X509Certificate) keyStore.getCertificate(alias.nextElement()); } return validateKeyChain(client, certs); }
[ "public", "boolean", "validateKeyChain", "(", "X509Certificate", "client", ",", "KeyStore", "keyStore", ")", "throws", "KeyStoreException", ",", "CertificateException", ",", "InvalidAlgorithmParameterException", ",", "NoSuchAlgorithmException", ",", "NoSuchProviderException", "{", "X509Certificate", "[", "]", "certs", "=", "new", "X509Certificate", "[", "keyStore", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "Enumeration", "<", "String", ">", "alias", "=", "keyStore", ".", "aliases", "(", ")", ";", "while", "(", "alias", ".", "hasMoreElements", "(", ")", ")", "{", "certs", "[", "i", "++", "]", "=", "(", "X509Certificate", ")", "keyStore", ".", "getCertificate", "(", "alias", ".", "nextElement", "(", ")", ")", ";", "}", "return", "validateKeyChain", "(", "client", ",", "certs", ")", ";", "}" ]
Validate keychain @param client is the client X509Certificate @param keyStore containing all trusted certificate @return true if validation until root certificate success, false otherwise @throws KeyStoreException KeyStore is invalid @throws CertificateException Certificate is Invalid @throws InvalidAlgorithmParameterException Algorithm Parameter is Invalid @throws NoSuchAlgorithmException Algorithm Does Not Exist @throws NoSuchProviderException No Such Security Provider Exists
[ "Validate", "keychain" ]
train
https://github.com/netkicorp/java-wns-resolver/blob/a7aad04d96c03feb05536aef189617beb4f011bc/src/main/java/com/netki/tlsa/CertChainValidator.java#L27-L39
centic9/commons-dost
src/main/java/org/dstadler/commons/svn/SVNCommands.java
SVNCommands.getBranchLogStream
public static InputStream getBranchLogStream(String[] branches, long startRevision, long endRevision, String baseUrl, String user, String pwd) throws IOException { """ Retrieve the XML-log of changes on the given branch, starting with the given revision up to HEAD. This method returns an {@link InputStream} that can be used to read and process the XML data without storing the complete result. This is useful when you are potentially reading many revisions and thus need to avoid being limited in memory or disk. @param branches The list of branches to fetch logs for, currently only the first entry is used! @param startRevision The SVN revision to use as starting point for the log-entries. @param endRevision The SVN revision to use as end point for the log-entries. In case <code>endRevision</code> is <code>-1</code>, HEAD revision is being used @param baseUrl The SVN url to connect to @param user The SVN user or null if the default user from the machine should be used @param pwd The SVN password or null if the default user from the machine should be used @return A stream that can be used to read the XML data, should be closed by the caller @return An InputStream which provides the XML-log response @throws IOException Execution of the SVN sub-process failed or the sub-process returned a exit value indicating a failure """ CommandLine cmdLine = getCommandLineForXMLLog(user, pwd); cmdLine.addArgument(startRevision + ":" + (endRevision != -1 ? endRevision : "HEAD")); // use HEAD if no valid endRevision given (= -1) cmdLine.addArgument(baseUrl + branches[0]); return ExecutionHelper.getCommandResult(cmdLine, new File("."), 0, 120000); }
java
public static InputStream getBranchLogStream(String[] branches, long startRevision, long endRevision, String baseUrl, String user, String pwd) throws IOException { CommandLine cmdLine = getCommandLineForXMLLog(user, pwd); cmdLine.addArgument(startRevision + ":" + (endRevision != -1 ? endRevision : "HEAD")); // use HEAD if no valid endRevision given (= -1) cmdLine.addArgument(baseUrl + branches[0]); return ExecutionHelper.getCommandResult(cmdLine, new File("."), 0, 120000); }
[ "public", "static", "InputStream", "getBranchLogStream", "(", "String", "[", "]", "branches", ",", "long", "startRevision", ",", "long", "endRevision", ",", "String", "baseUrl", ",", "String", "user", ",", "String", "pwd", ")", "throws", "IOException", "{", "CommandLine", "cmdLine", "=", "getCommandLineForXMLLog", "(", "user", ",", "pwd", ")", ";", "cmdLine", ".", "addArgument", "(", "startRevision", "+", "\":\"", "+", "(", "endRevision", "!=", "-", "1", "?", "endRevision", ":", "\"HEAD\"", ")", ")", ";", "// use HEAD if no valid endRevision given (= -1)", "cmdLine", ".", "addArgument", "(", "baseUrl", "+", "branches", "[", "0", "]", ")", ";", "return", "ExecutionHelper", ".", "getCommandResult", "(", "cmdLine", ",", "new", "File", "(", "\".\"", ")", ",", "0", ",", "120000", ")", ";", "}" ]
Retrieve the XML-log of changes on the given branch, starting with the given revision up to HEAD. This method returns an {@link InputStream} that can be used to read and process the XML data without storing the complete result. This is useful when you are potentially reading many revisions and thus need to avoid being limited in memory or disk. @param branches The list of branches to fetch logs for, currently only the first entry is used! @param startRevision The SVN revision to use as starting point for the log-entries. @param endRevision The SVN revision to use as end point for the log-entries. In case <code>endRevision</code> is <code>-1</code>, HEAD revision is being used @param baseUrl The SVN url to connect to @param user The SVN user or null if the default user from the machine should be used @param pwd The SVN password or null if the default user from the machine should be used @return A stream that can be used to read the XML data, should be closed by the caller @return An InputStream which provides the XML-log response @throws IOException Execution of the SVN sub-process failed or the sub-process returned a exit value indicating a failure
[ "Retrieve", "the", "XML", "-", "log", "of", "changes", "on", "the", "given", "branch", "starting", "with", "the", "given", "revision", "up", "to", "HEAD", ".", "This", "method", "returns", "an", "{", "@link", "InputStream", "}", "that", "can", "be", "used", "to", "read", "and", "process", "the", "XML", "data", "without", "storing", "the", "complete", "result", ".", "This", "is", "useful", "when", "you", "are", "potentially", "reading", "many", "revisions", "and", "thus", "need", "to", "avoid", "being", "limited", "in", "memory", "or", "disk", "." ]
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/svn/SVNCommands.java#L167-L173
jayantk/jklol
src/com/jayantkrish/jklol/cfg/CfgParser.java
CfgParser.parseInsideMarginal
public CfgParseChart parseInsideMarginal(List<?> terminals, boolean useSumProduct) { """ Calculate the inside probabilities (i.e., run the upward pass of variable elimination). """ CfgParseChart chart = createParseChart(terminals, useSumProduct); initializeChart(chart, terminals); upwardChartPass(chart); return chart; }
java
public CfgParseChart parseInsideMarginal(List<?> terminals, boolean useSumProduct) { CfgParseChart chart = createParseChart(terminals, useSumProduct); initializeChart(chart, terminals); upwardChartPass(chart); return chart; }
[ "public", "CfgParseChart", "parseInsideMarginal", "(", "List", "<", "?", ">", "terminals", ",", "boolean", "useSumProduct", ")", "{", "CfgParseChart", "chart", "=", "createParseChart", "(", "terminals", ",", "useSumProduct", ")", ";", "initializeChart", "(", "chart", ",", "terminals", ")", ";", "upwardChartPass", "(", "chart", ")", ";", "return", "chart", ";", "}" ]
Calculate the inside probabilities (i.e., run the upward pass of variable elimination).
[ "Calculate", "the", "inside", "probabilities", "(", "i", ".", "e", ".", "run", "the", "upward", "pass", "of", "variable", "elimination", ")", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cfg/CfgParser.java#L360-L365
SeaCloudsEU/SeaCloudsPlatform
sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/TemplateRest.java
TemplateRest.getTemplateByUuid
@GET @Path(" { """ Gets the information of an specific template. <pre> GET /templates/{template_id} Request: GET /templates/{template_id} HTTP/1.1 Response: HTTP/1.1 200 Ok {@code <?xml version="1.0" encoding="UTF-8"?> <wsag:Template>...</wsag:Template> } </pre> Example: <li>curl http://localhost:8080/sla-service/templates/contract-template-2007-12-04</li> @return XML information with the different details of the templates @throws JAXBException """id}") @Produces(MediaType.APPLICATION_XML) public Response getTemplateByUuid(@PathParam("id") String templateId){ logger.debug("StartOf getTemplateByUuid - REQUEST for /templates/{uuid}" + templateId); try{ TemplateHelper templateRestService = getTemplateHelper(); String serializedTemplate = templateRestService.getTemplateByUUID(templateId); if (serializedTemplate!=null){ logger.debug("EndOf getTemplateByUuid"); return buildResponse(200, serializedTemplate); }else{ logger.debug("EndOf getTemplateByUuid"); return buildResponse(404, printError(404, "There is no template with uuid " + templateId + " in the SLA Repository Database")); } } catch (HelperException e) { logger.info("getTemplateByUuid exception:"+e.getMessage()); return buildResponse(e); } }
java
@GET @Path("{id}") @Produces(MediaType.APPLICATION_XML) public Response getTemplateByUuid(@PathParam("id") String templateId){ logger.debug("StartOf getTemplateByUuid - REQUEST for /templates/{uuid}" + templateId); try{ TemplateHelper templateRestService = getTemplateHelper(); String serializedTemplate = templateRestService.getTemplateByUUID(templateId); if (serializedTemplate!=null){ logger.debug("EndOf getTemplateByUuid"); return buildResponse(200, serializedTemplate); }else{ logger.debug("EndOf getTemplateByUuid"); return buildResponse(404, printError(404, "There is no template with uuid " + templateId + " in the SLA Repository Database")); } } catch (HelperException e) { logger.info("getTemplateByUuid exception:"+e.getMessage()); return buildResponse(e); } }
[ "@", "GET", "@", "Path", "(", "\"{id}\"", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_XML", ")", "public", "Response", "getTemplateByUuid", "(", "@", "PathParam", "(", "\"id\"", ")", "String", "templateId", ")", "{", "logger", ".", "debug", "(", "\"StartOf getTemplateByUuid - REQUEST for /templates/{uuid}\"", "+", "templateId", ")", ";", "try", "{", "TemplateHelper", "templateRestService", "=", "getTemplateHelper", "(", ")", ";", "String", "serializedTemplate", "=", "templateRestService", ".", "getTemplateByUUID", "(", "templateId", ")", ";", "if", "(", "serializedTemplate", "!=", "null", ")", "{", "logger", ".", "debug", "(", "\"EndOf getTemplateByUuid\"", ")", ";", "return", "buildResponse", "(", "200", ",", "serializedTemplate", ")", ";", "}", "else", "{", "logger", ".", "debug", "(", "\"EndOf getTemplateByUuid\"", ")", ";", "return", "buildResponse", "(", "404", ",", "printError", "(", "404", ",", "\"There is no template with uuid \"", "+", "templateId", "+", "\" in the SLA Repository Database\"", ")", ")", ";", "}", "}", "catch", "(", "HelperException", "e", ")", "{", "logger", ".", "info", "(", "\"getTemplateByUuid exception:\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "return", "buildResponse", "(", "e", ")", ";", "}", "}" ]
Gets the information of an specific template. <pre> GET /templates/{template_id} Request: GET /templates/{template_id} HTTP/1.1 Response: HTTP/1.1 200 Ok {@code <?xml version="1.0" encoding="UTF-8"?> <wsag:Template>...</wsag:Template> } </pre> Example: <li>curl http://localhost:8080/sla-service/templates/contract-template-2007-12-04</li> @return XML information with the different details of the templates @throws JAXBException
[ "Gets", "the", "information", "of", "an", "specific", "template", "." ]
train
https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/TemplateRest.java#L195-L217
census-instrumentation/opencensus-java
exporters/trace/zipkin/src/main/java/io/opencensus/exporter/trace/zipkin/ZipkinTraceExporter.java
ZipkinTraceExporter.createAndRegister
public static void createAndRegister( SpanBytesEncoder encoder, Sender sender, String serviceName) { """ Creates and registers the Zipkin Trace exporter to the OpenCensus library. Only one Zipkin exporter can be registered at any point. @param encoder Usually {@link SpanBytesEncoder#JSON_V2} @param sender Often, but not necessarily an http sender. This could be Kafka or SQS. @param serviceName the {@link Span#localServiceName() local service name} of the process. @throws IllegalStateException if a Zipkin exporter is already registered. @since 0.12 """ synchronized (monitor) { checkState(handler == null, "Zipkin exporter is already registered."); Handler newHandler = new ZipkinExporterHandler(encoder, sender, serviceName); handler = newHandler; register(Tracing.getExportComponent().getSpanExporter(), newHandler); } }
java
public static void createAndRegister( SpanBytesEncoder encoder, Sender sender, String serviceName) { synchronized (monitor) { checkState(handler == null, "Zipkin exporter is already registered."); Handler newHandler = new ZipkinExporterHandler(encoder, sender, serviceName); handler = newHandler; register(Tracing.getExportComponent().getSpanExporter(), newHandler); } }
[ "public", "static", "void", "createAndRegister", "(", "SpanBytesEncoder", "encoder", ",", "Sender", "sender", ",", "String", "serviceName", ")", "{", "synchronized", "(", "monitor", ")", "{", "checkState", "(", "handler", "==", "null", ",", "\"Zipkin exporter is already registered.\"", ")", ";", "Handler", "newHandler", "=", "new", "ZipkinExporterHandler", "(", "encoder", ",", "sender", ",", "serviceName", ")", ";", "handler", "=", "newHandler", ";", "register", "(", "Tracing", ".", "getExportComponent", "(", ")", ".", "getSpanExporter", "(", ")", ",", "newHandler", ")", ";", "}", "}" ]
Creates and registers the Zipkin Trace exporter to the OpenCensus library. Only one Zipkin exporter can be registered at any point. @param encoder Usually {@link SpanBytesEncoder#JSON_V2} @param sender Often, but not necessarily an http sender. This could be Kafka or SQS. @param serviceName the {@link Span#localServiceName() local service name} of the process. @throws IllegalStateException if a Zipkin exporter is already registered. @since 0.12
[ "Creates", "and", "registers", "the", "Zipkin", "Trace", "exporter", "to", "the", "OpenCensus", "library", ".", "Only", "one", "Zipkin", "exporter", "can", "be", "registered", "at", "any", "point", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/exporters/trace/zipkin/src/main/java/io/opencensus/exporter/trace/zipkin/ZipkinTraceExporter.java#L80-L88
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java
B2BAccountUrl.getB2BAccountAttributeUrl
public static MozuUrl getB2BAccountAttributeUrl(Integer accountId, String attributeFQN, String responseFields) { """ Get Resource Url for GetB2BAccountAttribute @param accountId Unique identifier of the customer account. @param attributeFQN Fully qualified name for an attribute. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/attributes/{attributeFQN}?responseFields={responseFields}"); formatter.formatUrl("accountId", accountId); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getB2BAccountAttributeUrl(Integer accountId, String attributeFQN, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/attributes/{attributeFQN}?responseFields={responseFields}"); formatter.formatUrl("accountId", accountId); formatter.formatUrl("attributeFQN", attributeFQN); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getB2BAccountAttributeUrl", "(", "Integer", "accountId", ",", "String", "attributeFQN", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/customer/b2baccounts/{accountId}/attributes/{attributeFQN}?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"accountId\"", ",", "accountId", ")", ";", "formatter", ".", "formatUrl", "(", "\"attributeFQN\"", ",", "attributeFQN", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for GetB2BAccountAttribute @param accountId Unique identifier of the customer account. @param attributeFQN Fully qualified name for an attribute. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetB2BAccountAttribute" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java#L49-L56
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilder.java
SearchBuilder.toJson
public String toJson() { """ Returns the JSON representation of this object. @return a JSON representation of this object """ build(); try { return JsonSerializer.toString(this); } catch (IOException e) { throw new IndexException(e, "Unformateable JSON search: {}", e.getMessage()); } }
java
public String toJson() { build(); try { return JsonSerializer.toString(this); } catch (IOException e) { throw new IndexException(e, "Unformateable JSON search: {}", e.getMessage()); } }
[ "public", "String", "toJson", "(", ")", "{", "build", "(", ")", ";", "try", "{", "return", "JsonSerializer", ".", "toString", "(", "this", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IndexException", "(", "e", ",", "\"Unformateable JSON search: {}\"", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Returns the JSON representation of this object. @return a JSON representation of this object
[ "Returns", "the", "JSON", "representation", "of", "this", "object", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilder.java#L140-L147
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/internal/resilience/AbstractResilienceStrategy.java
AbstractResilienceStrategy.inconsistent
protected void inconsistent(Iterable<? extends K> keys, StoreAccessException because, StoreAccessException... cleanup) { """ Called when the cache failed to recover from a failing store operation on a list of keys. @param keys @param because exception thrown by the failing operation @param cleanup all the exceptions that occurred during cleanup """ pacedErrorLog("Ehcache keys {} in possible inconsistent state", keys, because); }
java
protected void inconsistent(Iterable<? extends K> keys, StoreAccessException because, StoreAccessException... cleanup) { pacedErrorLog("Ehcache keys {} in possible inconsistent state", keys, because); }
[ "protected", "void", "inconsistent", "(", "Iterable", "<", "?", "extends", "K", ">", "keys", ",", "StoreAccessException", "because", ",", "StoreAccessException", "...", "cleanup", ")", "{", "pacedErrorLog", "(", "\"Ehcache keys {} in possible inconsistent state\"", ",", "keys", ",", "because", ")", ";", "}" ]
Called when the cache failed to recover from a failing store operation on a list of keys. @param keys @param because exception thrown by the failing operation @param cleanup all the exceptions that occurred during cleanup
[ "Called", "when", "the", "cache", "failed", "to", "recover", "from", "a", "failing", "store", "operation", "on", "a", "list", "of", "keys", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/AbstractResilienceStrategy.java#L157-L159
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java
JDBC4PreparedStatement.setArray
@Override public void setArray(int parameterIndex, Array x) throws SQLException { """ Sets the designated parameter to the given java.sql.Array object. """ checkParameterBounds(parameterIndex); throw SQLError.noSupport(); }
java
@Override public void setArray(int parameterIndex, Array x) throws SQLException { checkParameterBounds(parameterIndex); throw SQLError.noSupport(); }
[ "@", "Override", "public", "void", "setArray", "(", "int", "parameterIndex", ",", "Array", "x", ")", "throws", "SQLException", "{", "checkParameterBounds", "(", "parameterIndex", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Sets the designated parameter to the given java.sql.Array object.
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "java", ".", "sql", ".", "Array", "object", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L158-L163
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java
GlobalizationPreferences.guessDateFormat
protected DateFormat guessDateFormat(int dateStyle, int timeStyle) { """ This function can be overridden by subclasses to use different heuristics. <b>It MUST return a 'safe' value, one whose modification will not affect this object.</b> @param dateStyle @param timeStyle @hide draft / provisional / internal are hidden on Android """ DateFormat result; ULocale dfLocale = getAvailableLocale(TYPE_DATEFORMAT); if (dfLocale == null) { dfLocale = ULocale.ROOT; } if (timeStyle == DF_NONE) { result = DateFormat.getDateInstance(getCalendar(), dateStyle, dfLocale); } else if (dateStyle == DF_NONE) { result = DateFormat.getTimeInstance(getCalendar(), timeStyle, dfLocale); } else { result = DateFormat.getDateTimeInstance(getCalendar(), dateStyle, timeStyle, dfLocale); } return result; }
java
protected DateFormat guessDateFormat(int dateStyle, int timeStyle) { DateFormat result; ULocale dfLocale = getAvailableLocale(TYPE_DATEFORMAT); if (dfLocale == null) { dfLocale = ULocale.ROOT; } if (timeStyle == DF_NONE) { result = DateFormat.getDateInstance(getCalendar(), dateStyle, dfLocale); } else if (dateStyle == DF_NONE) { result = DateFormat.getTimeInstance(getCalendar(), timeStyle, dfLocale); } else { result = DateFormat.getDateTimeInstance(getCalendar(), dateStyle, timeStyle, dfLocale); } return result; }
[ "protected", "DateFormat", "guessDateFormat", "(", "int", "dateStyle", ",", "int", "timeStyle", ")", "{", "DateFormat", "result", ";", "ULocale", "dfLocale", "=", "getAvailableLocale", "(", "TYPE_DATEFORMAT", ")", ";", "if", "(", "dfLocale", "==", "null", ")", "{", "dfLocale", "=", "ULocale", ".", "ROOT", ";", "}", "if", "(", "timeStyle", "==", "DF_NONE", ")", "{", "result", "=", "DateFormat", ".", "getDateInstance", "(", "getCalendar", "(", ")", ",", "dateStyle", ",", "dfLocale", ")", ";", "}", "else", "if", "(", "dateStyle", "==", "DF_NONE", ")", "{", "result", "=", "DateFormat", ".", "getTimeInstance", "(", "getCalendar", "(", ")", ",", "timeStyle", ",", "dfLocale", ")", ";", "}", "else", "{", "result", "=", "DateFormat", ".", "getDateTimeInstance", "(", "getCalendar", "(", ")", ",", "dateStyle", ",", "timeStyle", ",", "dfLocale", ")", ";", "}", "return", "result", ";", "}" ]
This function can be overridden by subclasses to use different heuristics. <b>It MUST return a 'safe' value, one whose modification will not affect this object.</b> @param dateStyle @param timeStyle @hide draft / provisional / internal are hidden on Android
[ "This", "function", "can", "be", "overridden", "by", "subclasses", "to", "use", "different", "heuristics", ".", "<b", ">", "It", "MUST", "return", "a", "safe", "value", "one", "whose", "modification", "will", "not", "affect", "this", "object", ".", "<", "/", "b", ">" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L915-L929
awslabs/dynamodb-janusgraph-storage-backend
src/main/java/com/amazon/janusgraph/diskstorage/dynamodb/DynamoDbStoreTransaction.java
DynamoDbStoreTransaction.contains
public boolean contains(final AbstractDynamoDbStore store, final StaticBuffer key, final StaticBuffer column) { """ Determins whether a particular key and column are part of this transaction @param key key to check for existence @param column column to check for existence @return true if both the key and column combination are in this transaction and false otherwise. """ return expectedValues.containsKey(store) && expectedValues.get(store).containsKey(key) && expectedValues.get(store).get(key).containsKey(column); }
java
public boolean contains(final AbstractDynamoDbStore store, final StaticBuffer key, final StaticBuffer column) { return expectedValues.containsKey(store) && expectedValues.get(store).containsKey(key) && expectedValues.get(store).get(key).containsKey(column); }
[ "public", "boolean", "contains", "(", "final", "AbstractDynamoDbStore", "store", ",", "final", "StaticBuffer", "key", ",", "final", "StaticBuffer", "column", ")", "{", "return", "expectedValues", ".", "containsKey", "(", "store", ")", "&&", "expectedValues", ".", "get", "(", "store", ")", ".", "containsKey", "(", "key", ")", "&&", "expectedValues", ".", "get", "(", "store", ")", ".", "get", "(", "key", ")", ".", "containsKey", "(", "column", ")", ";", "}" ]
Determins whether a particular key and column are part of this transaction @param key key to check for existence @param column column to check for existence @return true if both the key and column combination are in this transaction and false otherwise.
[ "Determins", "whether", "a", "particular", "key", "and", "column", "are", "part", "of", "this", "transaction" ]
train
https://github.com/awslabs/dynamodb-janusgraph-storage-backend/blob/e7ba180d2c40d8ea777e320d9a542725a5229fc0/src/main/java/com/amazon/janusgraph/diskstorage/dynamodb/DynamoDbStoreTransaction.java#L87-L91
jfinal/jfinal
src/main/java/com/jfinal/plugin/redis/Cache.java
Cache.zrank
public Long zrank(Object key, Object member) { """ 返回有序集 key 中成员 member 的排名。其中有序集成员按 score 值递增(从小到大)顺序排列。 排名以 0 为底,也就是说, score 值最小的成员排名为 0 。 使用 ZREVRANK 命令可以获得成员按 score 值递减(从大到小)排列的排名。 """ Jedis jedis = getJedis(); try { return jedis.zrank(keyToBytes(key), valueToBytes(member)); } finally {close(jedis);} }
java
public Long zrank(Object key, Object member) { Jedis jedis = getJedis(); try { return jedis.zrank(keyToBytes(key), valueToBytes(member)); } finally {close(jedis);} }
[ "public", "Long", "zrank", "(", "Object", "key", ",", "Object", "member", ")", "{", "Jedis", "jedis", "=", "getJedis", "(", ")", ";", "try", "{", "return", "jedis", ".", "zrank", "(", "keyToBytes", "(", "key", ")", ",", "valueToBytes", "(", "member", ")", ")", ";", "}", "finally", "{", "close", "(", "jedis", ")", ";", "}", "}" ]
返回有序集 key 中成员 member 的排名。其中有序集成员按 score 值递增(从小到大)顺序排列。 排名以 0 为底,也就是说, score 值最小的成员排名为 0 。 使用 ZREVRANK 命令可以获得成员按 score 值递减(从大到小)排列的排名。
[ "返回有序集", "key", "中成员", "member", "的排名。其中有序集成员按", "score", "值递增", "(", "从小到大", ")", "顺序排列。", "排名以", "0", "为底,也就是说,", "score", "值最小的成员排名为", "0", "。", "使用", "ZREVRANK", "命令可以获得成员按", "score", "值递减", "(", "从大到小", ")", "排列的排名。" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L1106-L1112
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsVfsTabHandler.java
CmsVfsTabHandler.onSelectFolder
public void onSelectFolder(String folder, boolean selected) { """ This method is called when a folder is selected or deselected in the VFS tab.<p> @param folder the folder which is selected or deselected @param selected true if the folder has been selected, false if it has been deselected """ if (selected) { m_controller.addFolder(folder); } else { m_controller.removeFolder(folder); } }
java
public void onSelectFolder(String folder, boolean selected) { if (selected) { m_controller.addFolder(folder); } else { m_controller.removeFolder(folder); } }
[ "public", "void", "onSelectFolder", "(", "String", "folder", ",", "boolean", "selected", ")", "{", "if", "(", "selected", ")", "{", "m_controller", ".", "addFolder", "(", "folder", ")", ";", "}", "else", "{", "m_controller", ".", "removeFolder", "(", "folder", ")", ";", "}", "}" ]
This method is called when a folder is selected or deselected in the VFS tab.<p> @param folder the folder which is selected or deselected @param selected true if the folder has been selected, false if it has been deselected
[ "This", "method", "is", "called", "when", "a", "folder", "is", "selected", "or", "deselected", "in", "the", "VFS", "tab", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsVfsTabHandler.java#L156-L163
cdk/cdk
tool/formula/src/main/java/org/openscience/cdk/formula/RoundRobinFormulaGenerator.java
RangeMassDecomposer.maybeDecomposable
boolean maybeDecomposable(double from, double to) { """ Check if a mass is decomposable. This is done in constant time (especially: it is very very very fast!). But it doesn't check if there is a valid decomposition. Therefore, even if the method returns true, all decompositions may be invalid for the given validator or given bounds. #decompose(mass) uses this function before starting the decomposition, therefore this method should only be used if you don't want to start the decomposition algorithm. @return true if the mass is decomposable, ignoring bounds or any additional filtering rule """ init(); final int[][][] ERTs = this.ERTs; final int[] minmax = new int[2]; //normal version seems to be faster, because it returns after first hit integerBound(from, to, minmax); final int a = weights.get(0).getIntegerMass(); for (int i = minmax[0]; i <= minmax[1]; ++i) { final int r = i % a; if (i >= ERTs[0][r][weights.size() - 1]) return true; } return false; }
java
boolean maybeDecomposable(double from, double to) { init(); final int[][][] ERTs = this.ERTs; final int[] minmax = new int[2]; //normal version seems to be faster, because it returns after first hit integerBound(from, to, minmax); final int a = weights.get(0).getIntegerMass(); for (int i = minmax[0]; i <= minmax[1]; ++i) { final int r = i % a; if (i >= ERTs[0][r][weights.size() - 1]) return true; } return false; }
[ "boolean", "maybeDecomposable", "(", "double", "from", ",", "double", "to", ")", "{", "init", "(", ")", ";", "final", "int", "[", "]", "[", "]", "[", "]", "ERTs", "=", "this", ".", "ERTs", ";", "final", "int", "[", "]", "minmax", "=", "new", "int", "[", "2", "]", ";", "//normal version seems to be faster, because it returns after first hit", "integerBound", "(", "from", ",", "to", ",", "minmax", ")", ";", "final", "int", "a", "=", "weights", ".", "get", "(", "0", ")", ".", "getIntegerMass", "(", ")", ";", "for", "(", "int", "i", "=", "minmax", "[", "0", "]", ";", "i", "<=", "minmax", "[", "1", "]", ";", "++", "i", ")", "{", "final", "int", "r", "=", "i", "%", "a", ";", "if", "(", "i", ">=", "ERTs", "[", "0", "]", "[", "r", "]", "[", "weights", ".", "size", "(", ")", "-", "1", "]", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Check if a mass is decomposable. This is done in constant time (especially: it is very very very fast!). But it doesn't check if there is a valid decomposition. Therefore, even if the method returns true, all decompositions may be invalid for the given validator or given bounds. #decompose(mass) uses this function before starting the decomposition, therefore this method should only be used if you don't want to start the decomposition algorithm. @return true if the mass is decomposable, ignoring bounds or any additional filtering rule
[ "Check", "if", "a", "mass", "is", "decomposable", ".", "This", "is", "done", "in", "constant", "time", "(", "especially", ":", "it", "is", "very", "very", "very", "fast!", ")", ".", "But", "it", "doesn", "t", "check", "if", "there", "is", "a", "valid", "decomposition", ".", "Therefore", "even", "if", "the", "method", "returns", "true", "all", "decompositions", "may", "be", "invalid", "for", "the", "given", "validator", "or", "given", "bounds", ".", "#decompose", "(", "mass", ")", "uses", "this", "function", "before", "starting", "the", "decomposition", "therefore", "this", "method", "should", "only", "be", "used", "if", "you", "don", "t", "want", "to", "start", "the", "decomposition", "algorithm", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/formula/RoundRobinFormulaGenerator.java#L280-L292
mikepenz/Android-Iconics
library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java
IconicsDrawable.colorRes
@NonNull public IconicsDrawable colorRes(@ColorRes int colorResId) { """ Set the color of the drawable. @param colorResId The color resource, from your R file. @return The current IconicsDrawable for chaining. """ return color(ContextCompat.getColor(mContext, colorResId)); }
java
@NonNull public IconicsDrawable colorRes(@ColorRes int colorResId) { return color(ContextCompat.getColor(mContext, colorResId)); }
[ "@", "NonNull", "public", "IconicsDrawable", "colorRes", "(", "@", "ColorRes", "int", "colorResId", ")", "{", "return", "color", "(", "ContextCompat", ".", "getColor", "(", "mContext", ",", "colorResId", ")", ")", ";", "}" ]
Set the color of the drawable. @param colorResId The color resource, from your R file. @return The current IconicsDrawable for chaining.
[ "Set", "the", "color", "of", "the", "drawable", "." ]
train
https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L477-L480
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java
CouchClient.revsDiff
public Map<String, MissingRevisions> revsDiff(Map<String, Set<String>> revisions) { """ Returns the subset of given the documentId/revisions that are not stored in the database. The input revisions is a map, whose key is document ID, and value is a list of revisions. An example input could be (in JSON format): { "03ee06461a12f3c288bb865b22000170": [ "1-b2e54331db828310f3c772d6e042ac9c", "2-3a24009a9525bde9e4bfa8a99046b00d" ], "82e04f650661c9bdb88c57e044000a4b": [ "3-bb39f8c740c6ffb8614c7031b46ac162" ] } The output is in same format. If the ID has no missing revision, it should not appear in the Map's key set. If all IDs do not have missing revisions, the returned Map should be empty map, but never null. @see <a target="_blank" href="http://wiki.apache.org/couchdb/HttpPostRevsDiff">HttpPostRevsDiff documentation</a> """ Misc.checkNotNull(revisions, "Input revisions"); URI uri = this.uriHelper.revsDiffUri(); String payload = JSONUtils.toJson(revisions); HttpConnection connection = Http.POST(uri, "application/json"); connection.setRequestBody(payload); return executeToJsonObjectWithRetry(connection, JSONUtils.STRING_MISSING_REVS_MAP_TYPE_DEF); }
java
public Map<String, MissingRevisions> revsDiff(Map<String, Set<String>> revisions) { Misc.checkNotNull(revisions, "Input revisions"); URI uri = this.uriHelper.revsDiffUri(); String payload = JSONUtils.toJson(revisions); HttpConnection connection = Http.POST(uri, "application/json"); connection.setRequestBody(payload); return executeToJsonObjectWithRetry(connection, JSONUtils.STRING_MISSING_REVS_MAP_TYPE_DEF); }
[ "public", "Map", "<", "String", ",", "MissingRevisions", ">", "revsDiff", "(", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "revisions", ")", "{", "Misc", ".", "checkNotNull", "(", "revisions", ",", "\"Input revisions\"", ")", ";", "URI", "uri", "=", "this", ".", "uriHelper", ".", "revsDiffUri", "(", ")", ";", "String", "payload", "=", "JSONUtils", ".", "toJson", "(", "revisions", ")", ";", "HttpConnection", "connection", "=", "Http", ".", "POST", "(", "uri", ",", "\"application/json\"", ")", ";", "connection", ".", "setRequestBody", "(", "payload", ")", ";", "return", "executeToJsonObjectWithRetry", "(", "connection", ",", "JSONUtils", ".", "STRING_MISSING_REVS_MAP_TYPE_DEF", ")", ";", "}" ]
Returns the subset of given the documentId/revisions that are not stored in the database. The input revisions is a map, whose key is document ID, and value is a list of revisions. An example input could be (in JSON format): { "03ee06461a12f3c288bb865b22000170": [ "1-b2e54331db828310f3c772d6e042ac9c", "2-3a24009a9525bde9e4bfa8a99046b00d" ], "82e04f650661c9bdb88c57e044000a4b": [ "3-bb39f8c740c6ffb8614c7031b46ac162" ] } The output is in same format. If the ID has no missing revision, it should not appear in the Map's key set. If all IDs do not have missing revisions, the returned Map should be empty map, but never null. @see <a target="_blank" href="http://wiki.apache.org/couchdb/HttpPostRevsDiff">HttpPostRevsDiff documentation</a>
[ "Returns", "the", "subset", "of", "given", "the", "documentId", "/", "revisions", "that", "are", "not", "stored", "in", "the", "database", "." ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java#L865-L873
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java
DeprecatedAPIListBuilder.composeDeprecatedList
private void composeDeprecatedList(List<Doc> list, MemberDoc[] members) { """ Add the members into a single list of deprecated members. @param list List of all the particular deprecated members, e.g. methods. @param members members to be added in the list. """ for (int i = 0; i < members.length; i++) { if (Util.isDeprecated(members[i])) { list.add(members[i]); } } }
java
private void composeDeprecatedList(List<Doc> list, MemberDoc[] members) { for (int i = 0; i < members.length; i++) { if (Util.isDeprecated(members[i])) { list.add(members[i]); } } }
[ "private", "void", "composeDeprecatedList", "(", "List", "<", "Doc", ">", "list", ",", "MemberDoc", "[", "]", "members", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "members", ".", "length", ";", "i", "++", ")", "{", "if", "(", "Util", ".", "isDeprecated", "(", "members", "[", "i", "]", ")", ")", "{", "list", ".", "add", "(", "members", "[", "i", "]", ")", ";", "}", "}", "}" ]
Add the members into a single list of deprecated members. @param list List of all the particular deprecated members, e.g. methods. @param members members to be added in the list.
[ "Add", "the", "members", "into", "a", "single", "list", "of", "deprecated", "members", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java#L133-L139
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java
DomainsInner.getOwnershipIdentifierAsync
public Observable<DomainOwnershipIdentifierInner> getOwnershipIdentifierAsync(String resourceGroupName, String domainName, String name) { """ Get ownership identifier for domain. Get ownership identifier for domain. @param resourceGroupName Name of the resource group to which the resource belongs. @param domainName Name of domain. @param name Name of identifier. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DomainOwnershipIdentifierInner object """ return getOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name).map(new Func1<ServiceResponse<DomainOwnershipIdentifierInner>, DomainOwnershipIdentifierInner>() { @Override public DomainOwnershipIdentifierInner call(ServiceResponse<DomainOwnershipIdentifierInner> response) { return response.body(); } }); }
java
public Observable<DomainOwnershipIdentifierInner> getOwnershipIdentifierAsync(String resourceGroupName, String domainName, String name) { return getOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name).map(new Func1<ServiceResponse<DomainOwnershipIdentifierInner>, DomainOwnershipIdentifierInner>() { @Override public DomainOwnershipIdentifierInner call(ServiceResponse<DomainOwnershipIdentifierInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DomainOwnershipIdentifierInner", ">", "getOwnershipIdentifierAsync", "(", "String", "resourceGroupName", ",", "String", "domainName", ",", "String", "name", ")", "{", "return", "getOwnershipIdentifierWithServiceResponseAsync", "(", "resourceGroupName", ",", "domainName", ",", "name", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DomainOwnershipIdentifierInner", ">", ",", "DomainOwnershipIdentifierInner", ">", "(", ")", "{", "@", "Override", "public", "DomainOwnershipIdentifierInner", "call", "(", "ServiceResponse", "<", "DomainOwnershipIdentifierInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get ownership identifier for domain. Get ownership identifier for domain. @param resourceGroupName Name of the resource group to which the resource belongs. @param domainName Name of domain. @param name Name of identifier. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DomainOwnershipIdentifierInner object
[ "Get", "ownership", "identifier", "for", "domain", ".", "Get", "ownership", "identifier", "for", "domain", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java#L1452-L1459
JodaOrg/joda-time
src/main/java/org/joda/time/DateTimeZone.java
DateTimeZone.forOffsetMillis
public static DateTimeZone forOffsetMillis(int millisOffset) { """ Gets a time zone instance for the specified offset to UTC in milliseconds. @param millisOffset the offset in millis from UTC, from -23:59:59.999 to +23:59:59.999 @return the DateTimeZone object for the offset """ if (millisOffset < -MAX_MILLIS || millisOffset > MAX_MILLIS) { throw new IllegalArgumentException("Millis out of range: " + millisOffset); } String id = printOffset(millisOffset); return fixedOffsetZone(id, millisOffset); }
java
public static DateTimeZone forOffsetMillis(int millisOffset) { if (millisOffset < -MAX_MILLIS || millisOffset > MAX_MILLIS) { throw new IllegalArgumentException("Millis out of range: " + millisOffset); } String id = printOffset(millisOffset); return fixedOffsetZone(id, millisOffset); }
[ "public", "static", "DateTimeZone", "forOffsetMillis", "(", "int", "millisOffset", ")", "{", "if", "(", "millisOffset", "<", "-", "MAX_MILLIS", "||", "millisOffset", ">", "MAX_MILLIS", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Millis out of range: \"", "+", "millisOffset", ")", ";", "}", "String", "id", "=", "printOffset", "(", "millisOffset", ")", ";", "return", "fixedOffsetZone", "(", "id", ",", "millisOffset", ")", ";", "}" ]
Gets a time zone instance for the specified offset to UTC in milliseconds. @param millisOffset the offset in millis from UTC, from -23:59:59.999 to +23:59:59.999 @return the DateTimeZone object for the offset
[ "Gets", "a", "time", "zone", "instance", "for", "the", "specified", "offset", "to", "UTC", "in", "milliseconds", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTimeZone.java#L316-L322
google/j2objc
jre_emul/android/frameworks/base/core/java/android/util/Log.java
Log.println
public static int println(int priority, String tag, String msg) { """ Low-level logging call. @param priority The priority/type of this log message @param tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. @param msg The message you would like logged. @return The number of bytes written. """ return println_native(LOG_ID_MAIN, priority, tag, msg); }
java
public static int println(int priority, String tag, String msg) { return println_native(LOG_ID_MAIN, priority, tag, msg); }
[ "public", "static", "int", "println", "(", "int", "priority", ",", "String", "tag", ",", "String", "msg", ")", "{", "return", "println_native", "(", "LOG_ID_MAIN", ",", "priority", ",", "tag", ",", "msg", ")", ";", "}" ]
Low-level logging call. @param priority The priority/type of this log message @param tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. @param msg The message you would like logged. @return The number of bytes written.
[ "Low", "-", "level", "logging", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/Log.java#L395-L397
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/FieldUpdater.java
FieldUpdater.createFieldUpdater
public static FieldUpdater createFieldUpdater(ObjectUpdater objUpdater, DBObject dbObj, String fieldName) { """ Create a FieldUpdater that will handle updates for the given object and field. @param tableDef {@link TableDefinition} of table in which object resides. @param dbObj {@link DBObject} of object being added, updated, or deleted. @param fieldName Name of field the new FieldUpdater will handle. Can be the _ID field, a declared or undeclared scalar field, or a link field. @return A FieldUpdater that can perform updates for the given object and field. """ if (fieldName.charAt(0) == '_') { if (fieldName.equals(CommonDefs.ID_FIELD)) { return new IDFieldUpdater(objUpdater, dbObj); } else { // Allow but skip all other system fields (e.g., "_table") return new NullFieldUpdater(objUpdater, dbObj, fieldName); } } TableDefinition tableDef = objUpdater.getTableDef(); if (tableDef.isLinkField(fieldName)) { return new LinkFieldUpdater(objUpdater, dbObj, fieldName); } else { Utils.require(FieldDefinition.isValidFieldName(fieldName), "Invalid field name: %s", fieldName); return new ScalarFieldUpdater(objUpdater, dbObj, fieldName); } }
java
public static FieldUpdater createFieldUpdater(ObjectUpdater objUpdater, DBObject dbObj, String fieldName) { if (fieldName.charAt(0) == '_') { if (fieldName.equals(CommonDefs.ID_FIELD)) { return new IDFieldUpdater(objUpdater, dbObj); } else { // Allow but skip all other system fields (e.g., "_table") return new NullFieldUpdater(objUpdater, dbObj, fieldName); } } TableDefinition tableDef = objUpdater.getTableDef(); if (tableDef.isLinkField(fieldName)) { return new LinkFieldUpdater(objUpdater, dbObj, fieldName); } else { Utils.require(FieldDefinition.isValidFieldName(fieldName), "Invalid field name: %s", fieldName); return new ScalarFieldUpdater(objUpdater, dbObj, fieldName); } }
[ "public", "static", "FieldUpdater", "createFieldUpdater", "(", "ObjectUpdater", "objUpdater", ",", "DBObject", "dbObj", ",", "String", "fieldName", ")", "{", "if", "(", "fieldName", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "if", "(", "fieldName", ".", "equals", "(", "CommonDefs", ".", "ID_FIELD", ")", ")", "{", "return", "new", "IDFieldUpdater", "(", "objUpdater", ",", "dbObj", ")", ";", "}", "else", "{", "// Allow but skip all other system fields (e.g., \"_table\")\r", "return", "new", "NullFieldUpdater", "(", "objUpdater", ",", "dbObj", ",", "fieldName", ")", ";", "}", "}", "TableDefinition", "tableDef", "=", "objUpdater", ".", "getTableDef", "(", ")", ";", "if", "(", "tableDef", ".", "isLinkField", "(", "fieldName", ")", ")", "{", "return", "new", "LinkFieldUpdater", "(", "objUpdater", ",", "dbObj", ",", "fieldName", ")", ";", "}", "else", "{", "Utils", ".", "require", "(", "FieldDefinition", ".", "isValidFieldName", "(", "fieldName", ")", ",", "\"Invalid field name: %s\"", ",", "fieldName", ")", ";", "return", "new", "ScalarFieldUpdater", "(", "objUpdater", ",", "dbObj", ",", "fieldName", ")", ";", "}", "}" ]
Create a FieldUpdater that will handle updates for the given object and field. @param tableDef {@link TableDefinition} of table in which object resides. @param dbObj {@link DBObject} of object being added, updated, or deleted. @param fieldName Name of field the new FieldUpdater will handle. Can be the _ID field, a declared or undeclared scalar field, or a link field. @return A FieldUpdater that can perform updates for the given object and field.
[ "Create", "a", "FieldUpdater", "that", "will", "handle", "updates", "for", "the", "given", "object", "and", "field", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/FieldUpdater.java#L54-L70
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsClientStringUtil.java
CmsClientStringUtil.getStackTrace
public static String getStackTrace(Throwable t, String separator) { """ Returns the stack trace of the Throwable as a string.<p> @param t the Throwable for which the stack trace should be returned @param separator the separator between the lines of the stack trace @return a string representing a stack trace """ Throwable cause = t; String result = ""; while (cause != null) { result += getStackTraceAsString(cause.getStackTrace(), separator); cause = cause.getCause(); } return result; }
java
public static String getStackTrace(Throwable t, String separator) { Throwable cause = t; String result = ""; while (cause != null) { result += getStackTraceAsString(cause.getStackTrace(), separator); cause = cause.getCause(); } return result; }
[ "public", "static", "String", "getStackTrace", "(", "Throwable", "t", ",", "String", "separator", ")", "{", "Throwable", "cause", "=", "t", ";", "String", "result", "=", "\"\"", ";", "while", "(", "cause", "!=", "null", ")", "{", "result", "+=", "getStackTraceAsString", "(", "cause", ".", "getStackTrace", "(", ")", ",", "separator", ")", ";", "cause", "=", "cause", ".", "getCause", "(", ")", ";", "}", "return", "result", ";", "}" ]
Returns the stack trace of the Throwable as a string.<p> @param t the Throwable for which the stack trace should be returned @param separator the separator between the lines of the stack trace @return a string representing a stack trace
[ "Returns", "the", "stack", "trace", "of", "the", "Throwable", "as", "a", "string", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsClientStringUtil.java#L100-L109
google/truth
extensions/java8/src/main/java/com/google/common/truth/IntStreamSubject.java
IntStreamSubject.containsAllOf
@SuppressWarnings("GoodTime") // false positive; b/122617528 @CanIgnoreReturnValue public Ordered containsAllOf(int first, int second, int... rest) { """ Fails if the subject does not contain all of the given elements. If an element appears more than once in the given elements, then it must appear at least that number of times in the actual elements. <p>To also test that the contents appear in the given order, make a call to {@code inOrder()} on the object returned by this method. The expected elements must appear in the given order within the actual elements, but they are not required to be consecutive. """ return check().that(actualList).containsAtLeast(first, second, box(rest)); }
java
@SuppressWarnings("GoodTime") // false positive; b/122617528 @CanIgnoreReturnValue public Ordered containsAllOf(int first, int second, int... rest) { return check().that(actualList).containsAtLeast(first, second, box(rest)); }
[ "@", "SuppressWarnings", "(", "\"GoodTime\"", ")", "// false positive; b/122617528", "@", "CanIgnoreReturnValue", "public", "Ordered", "containsAllOf", "(", "int", "first", ",", "int", "second", ",", "int", "...", "rest", ")", "{", "return", "check", "(", ")", ".", "that", "(", "actualList", ")", ".", "containsAtLeast", "(", "first", ",", "second", ",", "box", "(", "rest", ")", ")", ";", "}" ]
Fails if the subject does not contain all of the given elements. If an element appears more than once in the given elements, then it must appear at least that number of times in the actual elements. <p>To also test that the contents appear in the given order, make a call to {@code inOrder()} on the object returned by this method. The expected elements must appear in the given order within the actual elements, but they are not required to be consecutive.
[ "Fails", "if", "the", "subject", "does", "not", "contain", "all", "of", "the", "given", "elements", ".", "If", "an", "element", "appears", "more", "than", "once", "in", "the", "given", "elements", "then", "it", "must", "appear", "at", "least", "that", "number", "of", "times", "in", "the", "actual", "elements", "." ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/java8/src/main/java/com/google/common/truth/IntStreamSubject.java#L117-L121
alkacon/opencms-core
src/org/opencms/ade/containerpage/CmsDetailOnlyContainerPageBuilder.java
CmsDetailOnlyContainerPageBuilder.addContainerElement
public void addContainerElement(String name, CmsResource resource) { """ Adds a resource to a container as an element.<p> @param name the container name @param resource the resource to add as a container elementv """ getContainerInfo(name).getResources().add(resource); }
java
public void addContainerElement(String name, CmsResource resource) { getContainerInfo(name).getResources().add(resource); }
[ "public", "void", "addContainerElement", "(", "String", "name", ",", "CmsResource", "resource", ")", "{", "getContainerInfo", "(", "name", ")", ".", "getResources", "(", ")", ".", "add", "(", "resource", ")", ";", "}" ]
Adds a resource to a container as an element.<p> @param name the container name @param resource the resource to add as a container elementv
[ "Adds", "a", "resource", "to", "a", "container", "as", "an", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsDetailOnlyContainerPageBuilder.java#L215-L218
Coveros/selenified
src/main/java/com/coveros/selenified/application/WaitFor.java
WaitFor.promptMatches
public void promptMatches(double seconds, String expectedPromptPattern) { """ Waits up to the provided wait time for a prompt present on the page has content matching the expected text. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param expectedPromptPattern the expected text of the prompt @param seconds the number of seconds to wait """ try { double timeTook = popup(seconds); timeTook = popupMatches(seconds - timeTook, expectedPromptPattern); checkPromptMatches(expectedPromptPattern, seconds, timeTook); } catch (TimeoutException e) { checkPromptMatches(expectedPromptPattern, seconds, seconds); } }
java
public void promptMatches(double seconds, String expectedPromptPattern) { try { double timeTook = popup(seconds); timeTook = popupMatches(seconds - timeTook, expectedPromptPattern); checkPromptMatches(expectedPromptPattern, seconds, timeTook); } catch (TimeoutException e) { checkPromptMatches(expectedPromptPattern, seconds, seconds); } }
[ "public", "void", "promptMatches", "(", "double", "seconds", ",", "String", "expectedPromptPattern", ")", "{", "try", "{", "double", "timeTook", "=", "popup", "(", "seconds", ")", ";", "timeTook", "=", "popupMatches", "(", "seconds", "-", "timeTook", ",", "expectedPromptPattern", ")", ";", "checkPromptMatches", "(", "expectedPromptPattern", ",", "seconds", ",", "timeTook", ")", ";", "}", "catch", "(", "TimeoutException", "e", ")", "{", "checkPromptMatches", "(", "expectedPromptPattern", ",", "seconds", ",", "seconds", ")", ";", "}", "}" ]
Waits up to the provided wait time for a prompt present on the page has content matching the expected text. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param expectedPromptPattern the expected text of the prompt @param seconds the number of seconds to wait
[ "Waits", "up", "to", "the", "provided", "wait", "time", "for", "a", "prompt", "present", "on", "the", "page", "has", "content", "matching", "the", "expected", "text", ".", "This", "information", "will", "be", "logged", "and", "recorded", "with", "a", "screenshot", "for", "traceability", "and", "added", "debugging", "support", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L646-L654