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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/sources/DefaultSources.java
DefaultSources.getDiscoveredSources
public static ArrayList<ConfigSource> getDiscoveredSources(ClassLoader classloader) { """ Get ConfigSources found using the ServiceLoader pattern - both directly as found ConfigSources and those found via found ConfigSourceProviders' getConfigSources method. @param classloader @return """ ArrayList<ConfigSource> sources = new ArrayList<>(); //load config sources using the service loader try { ServiceLoader<ConfigSource> sl = ServiceLoader.load(ConfigSource.class, classloader); for (ConfigSource source : sl) { sources.add(source); } } catch (ServiceConfigurationError e) { throw new ConfigException(Tr.formatMessage(tc, "unable.to.discover.config.sources.CWMCG0010E", e), e); } try { //load config source providers using the service loader ServiceLoader<ConfigSourceProvider> providerSL = ServiceLoader.load(ConfigSourceProvider.class, classloader); for (ConfigSourceProvider provider : providerSL) { for (ConfigSource source : provider.getConfigSources(classloader)) { sources.add(source); } } } catch (ServiceConfigurationError e) { throw new ConfigException(Tr.formatMessage(tc, "unable.to.discover.config.source.providers.CWMCG0011E", e), e); } return sources; }
java
public static ArrayList<ConfigSource> getDiscoveredSources(ClassLoader classloader) { ArrayList<ConfigSource> sources = new ArrayList<>(); //load config sources using the service loader try { ServiceLoader<ConfigSource> sl = ServiceLoader.load(ConfigSource.class, classloader); for (ConfigSource source : sl) { sources.add(source); } } catch (ServiceConfigurationError e) { throw new ConfigException(Tr.formatMessage(tc, "unable.to.discover.config.sources.CWMCG0010E", e), e); } try { //load config source providers using the service loader ServiceLoader<ConfigSourceProvider> providerSL = ServiceLoader.load(ConfigSourceProvider.class, classloader); for (ConfigSourceProvider provider : providerSL) { for (ConfigSource source : provider.getConfigSources(classloader)) { sources.add(source); } } } catch (ServiceConfigurationError e) { throw new ConfigException(Tr.formatMessage(tc, "unable.to.discover.config.source.providers.CWMCG0011E", e), e); } return sources; }
[ "public", "static", "ArrayList", "<", "ConfigSource", ">", "getDiscoveredSources", "(", "ClassLoader", "classloader", ")", "{", "ArrayList", "<", "ConfigSource", ">", "sources", "=", "new", "ArrayList", "<>", "(", ")", ";", "//load config sources using the service loader", "try", "{", "ServiceLoader", "<", "ConfigSource", ">", "sl", "=", "ServiceLoader", ".", "load", "(", "ConfigSource", ".", "class", ",", "classloader", ")", ";", "for", "(", "ConfigSource", "source", ":", "sl", ")", "{", "sources", ".", "add", "(", "source", ")", ";", "}", "}", "catch", "(", "ServiceConfigurationError", "e", ")", "{", "throw", "new", "ConfigException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"unable.to.discover.config.sources.CWMCG0010E\"", ",", "e", ")", ",", "e", ")", ";", "}", "try", "{", "//load config source providers using the service loader", "ServiceLoader", "<", "ConfigSourceProvider", ">", "providerSL", "=", "ServiceLoader", ".", "load", "(", "ConfigSourceProvider", ".", "class", ",", "classloader", ")", ";", "for", "(", "ConfigSourceProvider", "provider", ":", "providerSL", ")", "{", "for", "(", "ConfigSource", "source", ":", "provider", ".", "getConfigSources", "(", "classloader", ")", ")", "{", "sources", ".", "add", "(", "source", ")", ";", "}", "}", "}", "catch", "(", "ServiceConfigurationError", "e", ")", "{", "throw", "new", "ConfigException", "(", "Tr", ".", "formatMessage", "(", "tc", ",", "\"unable.to.discover.config.source.providers.CWMCG0011E\"", ",", "e", ")", ",", "e", ")", ";", "}", "return", "sources", ";", "}" ]
Get ConfigSources found using the ServiceLoader pattern - both directly as found ConfigSources and those found via found ConfigSourceProviders' getConfigSources method. @param classloader @return
[ "Get", "ConfigSources", "found", "using", "the", "ServiceLoader", "pattern", "-", "both", "directly", "as", "found", "ConfigSources", "and", "those", "found", "via", "found", "ConfigSourceProviders", "getConfigSources", "method", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/sources/DefaultSources.java#L86-L112
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.exportDevices
public JobResponseInner exportDevices(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) { """ Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param exportDevicesParameters The parameters that specify the export devices operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JobResponseInner object if successful. """ return exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters).toBlocking().single().body(); }
java
public JobResponseInner exportDevices(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) { return exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters).toBlocking().single().body(); }
[ "public", "JobResponseInner", "exportDevices", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "ExportDevicesRequest", "exportDevicesParameters", ")", "{", "return", "exportDevicesWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "exportDevicesParameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param exportDevicesParameters The parameters that specify the export devices operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JobResponseInner object if successful.
[ "Exports", "all", "the", "device", "identities", "in", "the", "IoT", "hub", "identity", "registry", "to", "an", "Azure", "Storage", "blob", "container", ".", "For", "more", "information", "see", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "azure", "/", "iot", "-", "hub", "/", "iot", "-", "hub", "-", "devguide", "-", "identity", "-", "registry#import", "-", "and", "-", "export", "-", "device", "-", "identities", ".", "Exports", "all", "the", "device", "identities", "in", "the", "IoT", "hub", "identity", "registry", "to", "an", "Azure", "Storage", "blob", "container", ".", "For", "more", "information", "see", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "azure", "/", "iot", "-", "hub", "/", "iot", "-", "hub", "-", "devguide", "-", "identity", "-", "registry#import", "-", "and", "-", "export", "-", "device", "-", "identities", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L3067-L3069
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/math/RangeBigInteger.java
RangeBigInteger.removeIntersect
public Pair<RangeBigInteger,RangeBigInteger> removeIntersect(RangeBigInteger o) { """ Remove the intersection between this range and the given range, and return the range before and the range after the intersection. """ if (o.max.compareTo(min) < 0 || o.min.compareTo(max) > 0) // o is outside: no intersection return new Pair<>(copy(), null); if (o.min.compareTo(min) <= 0) { // nothing before if (o.max.compareTo(max) >= 0) return new Pair<>(null, null); // o is fully overlapping this return new Pair<>(null, new RangeBigInteger(o.max.add(BigInteger.ONE), max)); } if (o.max.compareTo(max) >= 0) { // nothing after return new Pair<>(new RangeBigInteger(min, o.min.subtract(BigInteger.ONE)), null); } // in the middle return new Pair<>(new RangeBigInteger(min, o.min.subtract(BigInteger.ONE)), new RangeBigInteger(o.max.add(BigInteger.ONE), max)); }
java
public Pair<RangeBigInteger,RangeBigInteger> removeIntersect(RangeBigInteger o) { if (o.max.compareTo(min) < 0 || o.min.compareTo(max) > 0) // o is outside: no intersection return new Pair<>(copy(), null); if (o.min.compareTo(min) <= 0) { // nothing before if (o.max.compareTo(max) >= 0) return new Pair<>(null, null); // o is fully overlapping this return new Pair<>(null, new RangeBigInteger(o.max.add(BigInteger.ONE), max)); } if (o.max.compareTo(max) >= 0) { // nothing after return new Pair<>(new RangeBigInteger(min, o.min.subtract(BigInteger.ONE)), null); } // in the middle return new Pair<>(new RangeBigInteger(min, o.min.subtract(BigInteger.ONE)), new RangeBigInteger(o.max.add(BigInteger.ONE), max)); }
[ "public", "Pair", "<", "RangeBigInteger", ",", "RangeBigInteger", ">", "removeIntersect", "(", "RangeBigInteger", "o", ")", "{", "if", "(", "o", ".", "max", ".", "compareTo", "(", "min", ")", "<", "0", "||", "o", ".", "min", ".", "compareTo", "(", "max", ")", ">", "0", ")", "// o is outside: no intersection\r", "return", "new", "Pair", "<>", "(", "copy", "(", ")", ",", "null", ")", ";", "if", "(", "o", ".", "min", ".", "compareTo", "(", "min", ")", "<=", "0", ")", "{", "// nothing before\r", "if", "(", "o", ".", "max", ".", "compareTo", "(", "max", ")", ">=", "0", ")", "return", "new", "Pair", "<>", "(", "null", ",", "null", ")", ";", "// o is fully overlapping this\r", "return", "new", "Pair", "<>", "(", "null", ",", "new", "RangeBigInteger", "(", "o", ".", "max", ".", "add", "(", "BigInteger", ".", "ONE", ")", ",", "max", ")", ")", ";", "}", "if", "(", "o", ".", "max", ".", "compareTo", "(", "max", ")", ">=", "0", ")", "{", "// nothing after\r", "return", "new", "Pair", "<>", "(", "new", "RangeBigInteger", "(", "min", ",", "o", ".", "min", ".", "subtract", "(", "BigInteger", ".", "ONE", ")", ")", ",", "null", ")", ";", "}", "// in the middle\r", "return", "new", "Pair", "<>", "(", "new", "RangeBigInteger", "(", "min", ",", "o", ".", "min", ".", "subtract", "(", "BigInteger", ".", "ONE", ")", ")", ",", "new", "RangeBigInteger", "(", "o", ".", "max", ".", "add", "(", "BigInteger", ".", "ONE", ")", ",", "max", ")", ")", ";", "}" ]
Remove the intersection between this range and the given range, and return the range before and the range after the intersection.
[ "Remove", "the", "intersection", "between", "this", "range", "and", "the", "given", "range", "and", "return", "the", "range", "before", "and", "the", "range", "after", "the", "intersection", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/math/RangeBigInteger.java#L84-L99
box/box-java-sdk
src/main/java/com/box/sdk/BoxRetentionPolicyAssignment.java
BoxRetentionPolicyAssignment.createAssignment
private static BoxRetentionPolicyAssignment.Info createAssignment(BoxAPIConnection api, String policyID, JsonObject assignTo, JsonArray filter) { """ Assigns retention policy with givenID to folder or enterprise. @param api the API connection to be used by the created assignment. @param policyID id of the assigned retention policy. @param assignTo object representing folder or enterprise to assign policy to. @return info about created assignment. """ URL url = ASSIGNMENTS_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, "POST"); JsonObject requestJSON = new JsonObject() .add("policy_id", policyID) .add("assign_to", assignTo); if (filter != null) { requestJSON.add("filter_fields", filter); } request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxRetentionPolicyAssignment createdAssignment = new BoxRetentionPolicyAssignment(api, responseJSON.get("id").asString()); return createdAssignment.new Info(responseJSON); }
java
private static BoxRetentionPolicyAssignment.Info createAssignment(BoxAPIConnection api, String policyID, JsonObject assignTo, JsonArray filter) { URL url = ASSIGNMENTS_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, "POST"); JsonObject requestJSON = new JsonObject() .add("policy_id", policyID) .add("assign_to", assignTo); if (filter != null) { requestJSON.add("filter_fields", filter); } request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxRetentionPolicyAssignment createdAssignment = new BoxRetentionPolicyAssignment(api, responseJSON.get("id").asString()); return createdAssignment.new Info(responseJSON); }
[ "private", "static", "BoxRetentionPolicyAssignment", ".", "Info", "createAssignment", "(", "BoxAPIConnection", "api", ",", "String", "policyID", ",", "JsonObject", "assignTo", ",", "JsonArray", "filter", ")", "{", "URL", "url", "=", "ASSIGNMENTS_URL_TEMPLATE", ".", "build", "(", "api", ".", "getBaseURL", "(", ")", ")", ";", "BoxJSONRequest", "request", "=", "new", "BoxJSONRequest", "(", "api", ",", "url", ",", "\"POST\"", ")", ";", "JsonObject", "requestJSON", "=", "new", "JsonObject", "(", ")", ".", "add", "(", "\"policy_id\"", ",", "policyID", ")", ".", "add", "(", "\"assign_to\"", ",", "assignTo", ")", ";", "if", "(", "filter", "!=", "null", ")", "{", "requestJSON", ".", "add", "(", "\"filter_fields\"", ",", "filter", ")", ";", "}", "request", ".", "setBody", "(", "requestJSON", ".", "toString", "(", ")", ")", ";", "BoxJSONResponse", "response", "=", "(", "BoxJSONResponse", ")", "request", ".", "send", "(", ")", ";", "JsonObject", "responseJSON", "=", "JsonObject", ".", "readFrom", "(", "response", ".", "getJSON", "(", ")", ")", ";", "BoxRetentionPolicyAssignment", "createdAssignment", "=", "new", "BoxRetentionPolicyAssignment", "(", "api", ",", "responseJSON", ".", "get", "(", "\"id\"", ")", ".", "asString", "(", ")", ")", ";", "return", "createdAssignment", ".", "new", "Info", "(", "responseJSON", ")", ";", "}" ]
Assigns retention policy with givenID to folder or enterprise. @param api the API connection to be used by the created assignment. @param policyID id of the assigned retention policy. @param assignTo object representing folder or enterprise to assign policy to. @return info about created assignment.
[ "Assigns", "retention", "policy", "with", "givenID", "to", "folder", "or", "enterprise", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxRetentionPolicyAssignment.java#L112-L131
G2G3Digital/substeps-framework
core/src/main/java/com/technophobia/substeps/model/PatternMap.java
PatternMap.put
public void put(final String pattern, final V value) throws IllegalStateException { """ Adds a new pattern to the map. <p> Users of this class <em>must</em> check if the pattern has already been added by using {@link containsPattern} to avoid IllegalStateException in the event that the pattern has already been added to the map. @param pattern the pattern @param value the value @throws IllegalStateException - if the map already contains the specified patter. """ if (pattern != null) { if (keys.containsKey(pattern)) { throw new IllegalStateException(""); } keys.put(pattern, value); final Pattern p = Pattern.compile(pattern); patternMap.put(p, value); } else { nullValue = value; } }
java
public void put(final String pattern, final V value) throws IllegalStateException { if (pattern != null) { if (keys.containsKey(pattern)) { throw new IllegalStateException(""); } keys.put(pattern, value); final Pattern p = Pattern.compile(pattern); patternMap.put(p, value); } else { nullValue = value; } }
[ "public", "void", "put", "(", "final", "String", "pattern", ",", "final", "V", "value", ")", "throws", "IllegalStateException", "{", "if", "(", "pattern", "!=", "null", ")", "{", "if", "(", "keys", ".", "containsKey", "(", "pattern", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"\"", ")", ";", "}", "keys", ".", "put", "(", "pattern", ",", "value", ")", ";", "final", "Pattern", "p", "=", "Pattern", ".", "compile", "(", "pattern", ")", ";", "patternMap", ".", "put", "(", "p", ",", "value", ")", ";", "}", "else", "{", "nullValue", "=", "value", ";", "}", "}" ]
Adds a new pattern to the map. <p> Users of this class <em>must</em> check if the pattern has already been added by using {@link containsPattern} to avoid IllegalStateException in the event that the pattern has already been added to the map. @param pattern the pattern @param value the value @throws IllegalStateException - if the map already contains the specified patter.
[ "Adds", "a", "new", "pattern", "to", "the", "map", ".", "<p", ">", "Users", "of", "this", "class", "<em", ">", "must<", "/", "em", ">", "check", "if", "the", "pattern", "has", "already", "been", "added", "by", "using", "{", "@link", "containsPattern", "}", "to", "avoid", "IllegalStateException", "in", "the", "event", "that", "the", "pattern", "has", "already", "been", "added", "to", "the", "map", "." ]
train
https://github.com/G2G3Digital/substeps-framework/blob/c1ec6487e1673a7dae54b5e7b62a96f602cd280a/core/src/main/java/com/technophobia/substeps/model/PatternMap.java#L56-L70
samskivert/samskivert
src/main/java/com/samskivert/servlet/user/UserRepository.java
UserRepository.lookupUsersByEmail
public ArrayList<User> lookupUsersByEmail (String email) throws PersistenceException { """ Lookup a user by email address, something that is not efficient and should really only be done by site admins attempting to look up a user record. @return the user with the specified user id or null if no user with that id exists. """ return loadAll(_utable, "where email = " + JDBCUtil.escape(email)); }
java
public ArrayList<User> lookupUsersByEmail (String email) throws PersistenceException { return loadAll(_utable, "where email = " + JDBCUtil.escape(email)); }
[ "public", "ArrayList", "<", "User", ">", "lookupUsersByEmail", "(", "String", "email", ")", "throws", "PersistenceException", "{", "return", "loadAll", "(", "_utable", ",", "\"where email = \"", "+", "JDBCUtil", ".", "escape", "(", "email", ")", ")", ";", "}" ]
Lookup a user by email address, something that is not efficient and should really only be done by site admins attempting to look up a user record. @return the user with the specified user id or null if no user with that id exists.
[ "Lookup", "a", "user", "by", "email", "address", "something", "that", "is", "not", "efficient", "and", "should", "really", "only", "be", "done", "by", "site", "admins", "attempting", "to", "look", "up", "a", "user", "record", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/user/UserRepository.java#L145-L149
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.setPropertyEL
public static void setPropertyEL(Object obj, String prop, Object value) { """ assign a value to a visible Property (Field or Setter) of a object @param obj Object to assign value to his property @param prop name of property @param value Value to assign """ // first check for field Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop, null); if (!ArrayUtil.isEmpty(fields)) { try { fields[0].set(obj, value); return; } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } // then check for setter try { getSetter(obj, prop, value).invoke(obj); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } }
java
public static void setPropertyEL(Object obj, String prop, Object value) { // first check for field Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop, null); if (!ArrayUtil.isEmpty(fields)) { try { fields[0].set(obj, value); return; } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } // then check for setter try { getSetter(obj, prop, value).invoke(obj); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } }
[ "public", "static", "void", "setPropertyEL", "(", "Object", "obj", ",", "String", "prop", ",", "Object", "value", ")", "{", "// first check for field", "Field", "[", "]", "fields", "=", "getFieldsIgnoreCase", "(", "obj", ".", "getClass", "(", ")", ",", "prop", ",", "null", ")", ";", "if", "(", "!", "ArrayUtil", ".", "isEmpty", "(", "fields", ")", ")", "{", "try", "{", "fields", "[", "0", "]", ".", "set", "(", "obj", ",", "value", ")", ";", "return", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "ExceptionUtil", ".", "rethrowIfNecessary", "(", "t", ")", ";", "}", "}", "// then check for setter", "try", "{", "getSetter", "(", "obj", ",", "prop", ",", "value", ")", ".", "invoke", "(", "obj", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "ExceptionUtil", ".", "rethrowIfNecessary", "(", "t", ")", ";", "}", "}" ]
assign a value to a visible Property (Field or Setter) of a object @param obj Object to assign value to his property @param prop name of property @param value Value to assign
[ "assign", "a", "value", "to", "a", "visible", "Property", "(", "Field", "or", "Setter", ")", "of", "a", "object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1265-L1287
super-csv/super-csv
super-csv/src/main/java/org/supercsv/util/TwoDHashMap.java
TwoDHashMap.get
public V get(final K1 firstKey, final K2 secondKey) { """ Fetch a value from the Hashmap . @param firstKey first key @param secondKey second key @return the element or null. """ // existence check on inner map final HashMap<K2, V> innerMap = map.get(firstKey); if( innerMap == null ) { return null; } return innerMap.get(secondKey); }
java
public V get(final K1 firstKey, final K2 secondKey) { // existence check on inner map final HashMap<K2, V> innerMap = map.get(firstKey); if( innerMap == null ) { return null; } return innerMap.get(secondKey); }
[ "public", "V", "get", "(", "final", "K1", "firstKey", ",", "final", "K2", "secondKey", ")", "{", "// existence check on inner map", "final", "HashMap", "<", "K2", ",", "V", ">", "innerMap", "=", "map", ".", "get", "(", "firstKey", ")", ";", "if", "(", "innerMap", "==", "null", ")", "{", "return", "null", ";", "}", "return", "innerMap", ".", "get", "(", "secondKey", ")", ";", "}" ]
Fetch a value from the Hashmap . @param firstKey first key @param secondKey second key @return the element or null.
[ "Fetch", "a", "value", "from", "the", "Hashmap", "." ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/TwoDHashMap.java#L88-L95
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java
RelativeDateTimeFormatter.combineDateAndTime
public String combineDateAndTime(String relativeDateString, String timeString) { """ Combines a relative date string and a time string in this object's locale. This is done with the same date-time separator used for the default calendar in this locale. @param relativeDateString the relative date e.g 'yesterday' @param timeString the time e.g '3:45' @return the date and time concatenated according to the default calendar in this locale e.g 'yesterday, 3:45' """ return SimpleFormatterImpl.formatCompiledPattern( combinedDateAndTime, timeString, relativeDateString); }
java
public String combineDateAndTime(String relativeDateString, String timeString) { return SimpleFormatterImpl.formatCompiledPattern( combinedDateAndTime, timeString, relativeDateString); }
[ "public", "String", "combineDateAndTime", "(", "String", "relativeDateString", ",", "String", "timeString", ")", "{", "return", "SimpleFormatterImpl", ".", "formatCompiledPattern", "(", "combinedDateAndTime", ",", "timeString", ",", "relativeDateString", ")", ";", "}" ]
Combines a relative date string and a time string in this object's locale. This is done with the same date-time separator used for the default calendar in this locale. @param relativeDateString the relative date e.g 'yesterday' @param timeString the time e.g '3:45' @return the date and time concatenated according to the default calendar in this locale e.g 'yesterday, 3:45'
[ "Combines", "a", "relative", "date", "string", "and", "a", "time", "string", "in", "this", "object", "s", "locale", ".", "This", "is", "done", "with", "the", "same", "date", "-", "time", "separator", "used", "for", "the", "default", "calendar", "in", "this", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L668-L671
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/face/AipFace.java
AipFace.getUser
public JSONObject getUser(String userId, String groupId, HashMap<String, String> options) { """ 用户信息查询接口 @param userId - 用户id(由数字、字母、下划线组成),长度限制128B @param groupId - 用户组id(由数字、字母、下划线组成),长度限制128B @param options - 可选参数对象,key: value都为string类型 options - options列表: @return JSONObject """ AipRequest request = new AipRequest(); preOperation(request); request.addBody("user_id", userId); request.addBody("group_id", groupId); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.USER_GET); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
java
public JSONObject getUser(String userId, String groupId, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("user_id", userId); request.addBody("group_id", groupId); if (options != null) { request.addBody(options); } request.setUri(FaceConsts.USER_GET); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "getUser", "(", "String", "userId", ",", "String", "groupId", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "request", ".", "addBody", "(", "\"user_id\"", ",", "userId", ")", ";", "request", ".", "addBody", "(", "\"group_id\"", ",", "groupId", ")", ";", "if", "(", "options", "!=", "null", ")", "{", "request", ".", "addBody", "(", "options", ")", ";", "}", "request", ".", "setUri", "(", "FaceConsts", ".", "USER_GET", ")", ";", "request", ".", "setBodyFormat", "(", "EBodyFormat", ".", "RAW_JSON", ")", ";", "postOperation", "(", "request", ")", ";", "return", "requestServer", "(", "request", ")", ";", "}" ]
用户信息查询接口 @param userId - 用户id(由数字、字母、下划线组成),长度限制128B @param groupId - 用户组id(由数字、字母、下划线组成),长度限制128B @param options - 可选参数对象,key: value都为string类型 options - options列表: @return JSONObject
[ "用户信息查询接口" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/face/AipFace.java#L200-L214
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java
ManagedInstanceEncryptionProtectorsInner.getAsync
public Observable<ManagedInstanceEncryptionProtectorInner> getAsync(String resourceGroupName, String managedInstanceName) { """ Gets a managed instance encryption protector. @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 managedInstanceName The name of the managed instance. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedInstanceEncryptionProtectorInner object """ return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1<ServiceResponse<ManagedInstanceEncryptionProtectorInner>, ManagedInstanceEncryptionProtectorInner>() { @Override public ManagedInstanceEncryptionProtectorInner call(ServiceResponse<ManagedInstanceEncryptionProtectorInner> response) { return response.body(); } }); }
java
public Observable<ManagedInstanceEncryptionProtectorInner> getAsync(String resourceGroupName, String managedInstanceName) { return getWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1<ServiceResponse<ManagedInstanceEncryptionProtectorInner>, ManagedInstanceEncryptionProtectorInner>() { @Override public ManagedInstanceEncryptionProtectorInner call(ServiceResponse<ManagedInstanceEncryptionProtectorInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagedInstanceEncryptionProtectorInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "managedInstanceName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ManagedInstanceEncryptionProtectorInner", ">", ",", "ManagedInstanceEncryptionProtectorInner", ">", "(", ")", "{", "@", "Override", "public", "ManagedInstanceEncryptionProtectorInner", "call", "(", "ServiceResponse", "<", "ManagedInstanceEncryptionProtectorInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a managed instance encryption protector. @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 managedInstanceName The name of the managed instance. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedInstanceEncryptionProtectorInner object
[ "Gets", "a", "managed", "instance", "encryption", "protector", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java#L243-L250
craftercms/commons
utilities/src/main/java/org/craftercms/commons/crypto/CryptoUtils.java
CryptoUtils.matchPassword
public static boolean matchPassword(String hashedPswdAndSalt, String clearPswd) { """ Returns true if it's a password match, that is, if the hashed clear password equals the given hash. @param hashedPswdAndSalt the hashed password + {@link #PASSWORD_SEP} + salt, as returned by {@link #hashPassword(String)} @param clearPswd the password that we're trying to match, in clear @return if the password matches """ if (StringUtils.isNotEmpty(hashedPswdAndSalt) && StringUtils.isNotEmpty(clearPswd)) { int idxOfSep = hashedPswdAndSalt.indexOf(PASSWORD_SEP); String storedHash = hashedPswdAndSalt.substring(0, idxOfSep); String salt = hashedPswdAndSalt.substring(idxOfSep + 1); SimpleDigest digest = new SimpleDigest(); digest.setBase64Salt(salt); return storedHash.equals(digest.digestBase64(clearPswd)); } else if (hashedPswdAndSalt == null && clearPswd == null) { return true; } else if (hashedPswdAndSalt.isEmpty() && clearPswd.isEmpty()) { return true; } else { return false; } }
java
public static boolean matchPassword(String hashedPswdAndSalt, String clearPswd) { if (StringUtils.isNotEmpty(hashedPswdAndSalt) && StringUtils.isNotEmpty(clearPswd)) { int idxOfSep = hashedPswdAndSalt.indexOf(PASSWORD_SEP); String storedHash = hashedPswdAndSalt.substring(0, idxOfSep); String salt = hashedPswdAndSalt.substring(idxOfSep + 1); SimpleDigest digest = new SimpleDigest(); digest.setBase64Salt(salt); return storedHash.equals(digest.digestBase64(clearPswd)); } else if (hashedPswdAndSalt == null && clearPswd == null) { return true; } else if (hashedPswdAndSalt.isEmpty() && clearPswd.isEmpty()) { return true; } else { return false; } }
[ "public", "static", "boolean", "matchPassword", "(", "String", "hashedPswdAndSalt", ",", "String", "clearPswd", ")", "{", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "hashedPswdAndSalt", ")", "&&", "StringUtils", ".", "isNotEmpty", "(", "clearPswd", ")", ")", "{", "int", "idxOfSep", "=", "hashedPswdAndSalt", ".", "indexOf", "(", "PASSWORD_SEP", ")", ";", "String", "storedHash", "=", "hashedPswdAndSalt", ".", "substring", "(", "0", ",", "idxOfSep", ")", ";", "String", "salt", "=", "hashedPswdAndSalt", ".", "substring", "(", "idxOfSep", "+", "1", ")", ";", "SimpleDigest", "digest", "=", "new", "SimpleDigest", "(", ")", ";", "digest", ".", "setBase64Salt", "(", "salt", ")", ";", "return", "storedHash", ".", "equals", "(", "digest", ".", "digestBase64", "(", "clearPswd", ")", ")", ";", "}", "else", "if", "(", "hashedPswdAndSalt", "==", "null", "&&", "clearPswd", "==", "null", ")", "{", "return", "true", ";", "}", "else", "if", "(", "hashedPswdAndSalt", ".", "isEmpty", "(", ")", "&&", "clearPswd", ".", "isEmpty", "(", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Returns true if it's a password match, that is, if the hashed clear password equals the given hash. @param hashedPswdAndSalt the hashed password + {@link #PASSWORD_SEP} + salt, as returned by {@link #hashPassword(String)} @param clearPswd the password that we're trying to match, in clear @return if the password matches
[ "Returns", "true", "if", "it", "s", "a", "password", "match", "that", "is", "if", "the", "hashed", "clear", "password", "equals", "the", "given", "hash", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/crypto/CryptoUtils.java#L120-L137
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java
ProcfsBasedProcessTree.checkPidPgrpidForMatch
static boolean checkPidPgrpidForMatch(String pidStr, String procfsDir) { """ Verify that the given process id is same as its process group id. @param pidStr Process id of the to-be-verified-process @param procfsDir Procfs root dir """ Integer pId = Integer.parseInt(pidStr); // Get information for this process ProcessInfo pInfo = new ProcessInfo(pId); pInfo = constructProcessInfo(pInfo, procfsDir); if (pInfo == null) { // process group leader may have finished execution, but we still need to // kill the subProcesses in the process group. return true; } //make sure that pId and its pgrpId match if (!pInfo.getPgrpId().equals(pId)) { LOG.warn("Unexpected: Process with PID " + pId + " is not a process group leader."); return false; } if (LOG.isDebugEnabled()) { LOG.debug(pId + " is a process group leader, as expected."); } return true; }
java
static boolean checkPidPgrpidForMatch(String pidStr, String procfsDir) { Integer pId = Integer.parseInt(pidStr); // Get information for this process ProcessInfo pInfo = new ProcessInfo(pId); pInfo = constructProcessInfo(pInfo, procfsDir); if (pInfo == null) { // process group leader may have finished execution, but we still need to // kill the subProcesses in the process group. return true; } //make sure that pId and its pgrpId match if (!pInfo.getPgrpId().equals(pId)) { LOG.warn("Unexpected: Process with PID " + pId + " is not a process group leader."); return false; } if (LOG.isDebugEnabled()) { LOG.debug(pId + " is a process group leader, as expected."); } return true; }
[ "static", "boolean", "checkPidPgrpidForMatch", "(", "String", "pidStr", ",", "String", "procfsDir", ")", "{", "Integer", "pId", "=", "Integer", ".", "parseInt", "(", "pidStr", ")", ";", "// Get information for this process", "ProcessInfo", "pInfo", "=", "new", "ProcessInfo", "(", "pId", ")", ";", "pInfo", "=", "constructProcessInfo", "(", "pInfo", ",", "procfsDir", ")", ";", "if", "(", "pInfo", "==", "null", ")", "{", "// process group leader may have finished execution, but we still need to", "// kill the subProcesses in the process group.", "return", "true", ";", "}", "//make sure that pId and its pgrpId match", "if", "(", "!", "pInfo", ".", "getPgrpId", "(", ")", ".", "equals", "(", "pId", ")", ")", "{", "LOG", ".", "warn", "(", "\"Unexpected: Process with PID \"", "+", "pId", "+", "\" is not a process group leader.\"", ")", ";", "return", "false", ";", "}", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "pId", "+", "\" is a process group leader, as expected.\"", ")", ";", "}", "return", "true", ";", "}" ]
Verify that the given process id is same as its process group id. @param pidStr Process id of the to-be-verified-process @param procfsDir Procfs root dir
[ "Verify", "that", "the", "given", "process", "id", "is", "same", "as", "its", "process", "group", "id", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/ProcfsBasedProcessTree.java#L268-L289
alkacon/opencms-core
src/org/opencms/gwt/shared/CmsListInfoBean.java
CmsListInfoBean.addAdditionalInfo
public void addAdditionalInfo(String name, String value, String style) { """ Sets a new additional info.<p> @param name the additional info name @param value the additional info value @param style the CSS style to apply to the info """ getAdditionalInfo().add(new CmsAdditionalInfoBean(name, value, style)); }
java
public void addAdditionalInfo(String name, String value, String style) { getAdditionalInfo().add(new CmsAdditionalInfoBean(name, value, style)); }
[ "public", "void", "addAdditionalInfo", "(", "String", "name", ",", "String", "value", ",", "String", "style", ")", "{", "getAdditionalInfo", "(", ")", ".", "add", "(", "new", "CmsAdditionalInfoBean", "(", "name", ",", "value", ",", "style", ")", ")", ";", "}" ]
Sets a new additional info.<p> @param name the additional info name @param value the additional info value @param style the CSS style to apply to the info
[ "Sets", "a", "new", "additional", "info", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/shared/CmsListInfoBean.java#L147-L150
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java
SyntheticStorableReferenceBuilder.isConsistent
@Deprecated public boolean isConsistent(Storable indexEntry, S master) throws FetchException { """ Returns true if the properties of the given index entry match those contained in the master, excluding any version property. This will always return true after a call to copyFromMaster. @param indexEntry index entry whose properties will be tested @param master source of property values @deprecated call getReferenceAccess """ return getReferenceAccess().isConsistent(indexEntry, master); }
java
@Deprecated public boolean isConsistent(Storable indexEntry, S master) throws FetchException { return getReferenceAccess().isConsistent(indexEntry, master); }
[ "@", "Deprecated", "public", "boolean", "isConsistent", "(", "Storable", "indexEntry", ",", "S", "master", ")", "throws", "FetchException", "{", "return", "getReferenceAccess", "(", ")", ".", "isConsistent", "(", "indexEntry", ",", "master", ")", ";", "}" ]
Returns true if the properties of the given index entry match those contained in the master, excluding any version property. This will always return true after a call to copyFromMaster. @param indexEntry index entry whose properties will be tested @param master source of property values @deprecated call getReferenceAccess
[ "Returns", "true", "if", "the", "properties", "of", "the", "given", "index", "entry", "match", "those", "contained", "in", "the", "master", "excluding", "any", "version", "property", ".", "This", "will", "always", "return", "true", "after", "a", "call", "to", "copyFromMaster", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java#L382-L385
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java
SDVariable.lt
public SDVariable lt(String name, SDVariable other) { """ Less than operation: elementwise {@code this < y}<br> If x and y arrays have equal shape, the output shape is the same as the inputs.<br> Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast.<br> Returns an array with values 1 where condition is satisfied, or value 0 otherwise. @param name Name of the output variable @param other Variable to compare values against @return Output SDVariable with values 0 (not satisfied) and 1 (where the condition is satisfied) """ return sameDiff.lt(name, this, other); }
java
public SDVariable lt(String name, SDVariable other){ return sameDiff.lt(name, this, other); }
[ "public", "SDVariable", "lt", "(", "String", "name", ",", "SDVariable", "other", ")", "{", "return", "sameDiff", ".", "lt", "(", "name", ",", "this", ",", "other", ")", ";", "}" ]
Less than operation: elementwise {@code this < y}<br> If x and y arrays have equal shape, the output shape is the same as the inputs.<br> Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast.<br> Returns an array with values 1 where condition is satisfied, or value 0 otherwise. @param name Name of the output variable @param other Variable to compare values against @return Output SDVariable with values 0 (not satisfied) and 1 (where the condition is satisfied)
[ "Less", "than", "operation", ":", "elementwise", "{", "@code", "this", "<", "y", "}", "<br", ">", "If", "x", "and", "y", "arrays", "have", "equal", "shape", "the", "output", "shape", "is", "the", "same", "as", "the", "inputs", ".", "<br", ">", "Supports", "broadcasting", ":", "if", "x", "and", "y", "have", "different", "shapes", "and", "are", "broadcastable", "the", "output", "shape", "is", "broadcast", ".", "<br", ">", "Returns", "an", "array", "with", "values", "1", "where", "condition", "is", "satisfied", "or", "value", "0", "otherwise", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L504-L506
josueeduardo/snappy
plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/MainClassFinder.java
MainClassFinder.findMainClass
public static String findMainClass(File rootFolder) throws IOException { """ Find the main class from a given folder. @param rootFolder the root folder to search @return the main class or {@code null} @throws IOException if the folder cannot be read """ return doWithMainClasses(rootFolder, new ClassNameCallback<String>() { @Override public String doWith(String className) { return className; } }); }
java
public static String findMainClass(File rootFolder) throws IOException { return doWithMainClasses(rootFolder, new ClassNameCallback<String>() { @Override public String doWith(String className) { return className; } }); }
[ "public", "static", "String", "findMainClass", "(", "File", "rootFolder", ")", "throws", "IOException", "{", "return", "doWithMainClasses", "(", "rootFolder", ",", "new", "ClassNameCallback", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "doWith", "(", "String", "className", ")", "{", "return", "className", ";", "}", "}", ")", ";", "}" ]
Find the main class from a given folder. @param rootFolder the root folder to search @return the main class or {@code null} @throws IOException if the folder cannot be read
[ "Find", "the", "main", "class", "from", "a", "given", "folder", "." ]
train
https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-maven-plugin/src/main/java/io/joshworks/snappy/maven/tools/MainClassFinder.java#L82-L89
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/util/CredentialsUtils.java
CredentialsUtils.saveProxyCredentials
public static void saveProxyCredentials(String proxyFileName, X509Credential uc, PrivateKeyEncoding encoding) throws IOException { """ Saves proxy credentials to a file. This method ensures that the stored proxy is saved with the appropriate file permissions. @param proxyFileName the file where the proxy will be saved @param uc the credential to be saved @param encoding the private key encoding @throws IOException in case of errors writing to the proxy file """ File f = new File(proxyFileName); RandomAccessFile raf = new RandomAccessFile(f, "rws"); FileChannel channel = raf.getChannel(); FilePermissionHelper.setProxyPermissions(proxyFileName); channel.truncate(0); ByteArrayOutputStream baos = new ByteArrayOutputStream(); saveProxyCredentials(baos, uc, encoding); baos.close(); channel.write(ByteBuffer.wrap(baos.toByteArray())); channel.close(); raf.close(); }
java
public static void saveProxyCredentials(String proxyFileName, X509Credential uc, PrivateKeyEncoding encoding) throws IOException { File f = new File(proxyFileName); RandomAccessFile raf = new RandomAccessFile(f, "rws"); FileChannel channel = raf.getChannel(); FilePermissionHelper.setProxyPermissions(proxyFileName); channel.truncate(0); ByteArrayOutputStream baos = new ByteArrayOutputStream(); saveProxyCredentials(baos, uc, encoding); baos.close(); channel.write(ByteBuffer.wrap(baos.toByteArray())); channel.close(); raf.close(); }
[ "public", "static", "void", "saveProxyCredentials", "(", "String", "proxyFileName", ",", "X509Credential", "uc", ",", "PrivateKeyEncoding", "encoding", ")", "throws", "IOException", "{", "File", "f", "=", "new", "File", "(", "proxyFileName", ")", ";", "RandomAccessFile", "raf", "=", "new", "RandomAccessFile", "(", "f", ",", "\"rws\"", ")", ";", "FileChannel", "channel", "=", "raf", ".", "getChannel", "(", ")", ";", "FilePermissionHelper", ".", "setProxyPermissions", "(", "proxyFileName", ")", ";", "channel", ".", "truncate", "(", "0", ")", ";", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "saveProxyCredentials", "(", "baos", ",", "uc", ",", "encoding", ")", ";", "baos", ".", "close", "(", ")", ";", "channel", ".", "write", "(", "ByteBuffer", ".", "wrap", "(", "baos", ".", "toByteArray", "(", ")", ")", ")", ";", "channel", ".", "close", "(", ")", ";", "raf", ".", "close", "(", ")", ";", "}" ]
Saves proxy credentials to a file. This method ensures that the stored proxy is saved with the appropriate file permissions. @param proxyFileName the file where the proxy will be saved @param uc the credential to be saved @param encoding the private key encoding @throws IOException in case of errors writing to the proxy file
[ "Saves", "proxy", "credentials", "to", "a", "file", ".", "This", "method", "ensures", "that", "the", "stored", "proxy", "is", "saved", "with", "the", "appropriate", "file", "permissions", "." ]
train
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/util/CredentialsUtils.java#L206-L224
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/util/AbstractDataInput.java
AbstractDataInput.readFully
public void readFully(byte[] buffer, int offset, int count) throws IOException { """ Read bytes from this file into {@code buffer} starting at offset {@code offset}. This method blocks until {@code count} number of bytes have been read. @param buffer the buffer to read bytes into. @param offset the initial position in {@code buffer} to store the bytes read from this file. @param count the maximum number of bytes to store in {@code buffer}. @throws EOFException if the end of this file is detected. @throws IndexOutOfBoundsException if {@code offset < 0} or {@code count < 0}, or if {@code offset + count} is greater than the length of {@code buffer}. @throws IOException if this file is closed or another I/O error occurs. @throws NullPointerException if {@code buffer} is {@code null}. """ if (buffer == null) { throw new NullPointerException(); } // avoid int overflow if (offset < 0 || offset > buffer.length || count < 0 || count > buffer.length - offset) { throw new IndexOutOfBoundsException(); } while (count > 0) { int result = read(buffer, offset, count); if (result < 0) { throw new EOFException(); } offset += result; count -= result; } }
java
public void readFully(byte[] buffer, int offset, int count) throws IOException { if (buffer == null) { throw new NullPointerException(); } // avoid int overflow if (offset < 0 || offset > buffer.length || count < 0 || count > buffer.length - offset) { throw new IndexOutOfBoundsException(); } while (count > 0) { int result = read(buffer, offset, count); if (result < 0) { throw new EOFException(); } offset += result; count -= result; } }
[ "public", "void", "readFully", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "int", "count", ")", "throws", "IOException", "{", "if", "(", "buffer", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "// avoid int overflow", "if", "(", "offset", "<", "0", "||", "offset", ">", "buffer", ".", "length", "||", "count", "<", "0", "||", "count", ">", "buffer", ".", "length", "-", "offset", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "while", "(", "count", ">", "0", ")", "{", "int", "result", "=", "read", "(", "buffer", ",", "offset", ",", "count", ")", ";", "if", "(", "result", "<", "0", ")", "{", "throw", "new", "EOFException", "(", ")", ";", "}", "offset", "+=", "result", ";", "count", "-=", "result", ";", "}", "}" ]
Read bytes from this file into {@code buffer} starting at offset {@code offset}. This method blocks until {@code count} number of bytes have been read. @param buffer the buffer to read bytes into. @param offset the initial position in {@code buffer} to store the bytes read from this file. @param count the maximum number of bytes to store in {@code buffer}. @throws EOFException if the end of this file is detected. @throws IndexOutOfBoundsException if {@code offset < 0} or {@code count < 0}, or if {@code offset + count} is greater than the length of {@code buffer}. @throws IOException if this file is closed or another I/O error occurs. @throws NullPointerException if {@code buffer} is {@code null}.
[ "Read", "bytes", "from", "this", "file", "into", "{", "@code", "buffer", "}", "starting", "at", "offset", "{", "@code", "offset", "}", ".", "This", "method", "blocks", "until", "{", "@code", "count", "}", "number", "of", "bytes", "have", "been", "read", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/util/AbstractDataInput.java#L159-L177
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/parser/ParseTree.java
ParseTree.getStatementAtLine
public ParseTree getStatementAtLine( int iLineNum, Class clsSkip ) { """ @param iLineNum The one based line number to check. @param clsSkip A statement sublcass to ignore. Optional. @return The first statement beginning at the specified line number, or null if no statements start at the line number. """ if( _pe instanceof NewExpression ) { NewExpression newExpression = (NewExpression)_pe; IType type = newExpression.getType(); if( type instanceof IGosuClassInternal && newExpression.isAnonymousClass() ) { return (ParseTree)((IGosuClassInternal)type).getClassStatement().getLocation().getStatementAtLine( iLineNum, clsSkip ); } } if( (_pe instanceof Statement) && // Note we must analyze expressions e.g., block expressions can have statements !(_pe instanceof FunctionStatement && ((FunctionStatement)_pe).getDynamicFunctionSymbol() instanceof ProgramClassFunctionSymbol) && (getLineNum() == iLineNum) && (clsSkip == null || !clsSkip.isAssignableFrom( _pe.getClass() )) ) { return this; } ParseTree deepest = null; for(int i = 0; i < _children.size; i++) { ParseTree child = (ParseTree) _children.data[i]; ParseTree l = child.getStatementAtLine( iLineNum, clsSkip ); if( Search.isDeeper( deepest, l ) ) { deepest = l; } } return deepest; }
java
public ParseTree getStatementAtLine( int iLineNum, Class clsSkip ) { if( _pe instanceof NewExpression ) { NewExpression newExpression = (NewExpression)_pe; IType type = newExpression.getType(); if( type instanceof IGosuClassInternal && newExpression.isAnonymousClass() ) { return (ParseTree)((IGosuClassInternal)type).getClassStatement().getLocation().getStatementAtLine( iLineNum, clsSkip ); } } if( (_pe instanceof Statement) && // Note we must analyze expressions e.g., block expressions can have statements !(_pe instanceof FunctionStatement && ((FunctionStatement)_pe).getDynamicFunctionSymbol() instanceof ProgramClassFunctionSymbol) && (getLineNum() == iLineNum) && (clsSkip == null || !clsSkip.isAssignableFrom( _pe.getClass() )) ) { return this; } ParseTree deepest = null; for(int i = 0; i < _children.size; i++) { ParseTree child = (ParseTree) _children.data[i]; ParseTree l = child.getStatementAtLine( iLineNum, clsSkip ); if( Search.isDeeper( deepest, l ) ) { deepest = l; } } return deepest; }
[ "public", "ParseTree", "getStatementAtLine", "(", "int", "iLineNum", ",", "Class", "clsSkip", ")", "{", "if", "(", "_pe", "instanceof", "NewExpression", ")", "{", "NewExpression", "newExpression", "=", "(", "NewExpression", ")", "_pe", ";", "IType", "type", "=", "newExpression", ".", "getType", "(", ")", ";", "if", "(", "type", "instanceof", "IGosuClassInternal", "&&", "newExpression", ".", "isAnonymousClass", "(", ")", ")", "{", "return", "(", "ParseTree", ")", "(", "(", "IGosuClassInternal", ")", "type", ")", ".", "getClassStatement", "(", ")", ".", "getLocation", "(", ")", ".", "getStatementAtLine", "(", "iLineNum", ",", "clsSkip", ")", ";", "}", "}", "if", "(", "(", "_pe", "instanceof", "Statement", ")", "&&", "// Note we must analyze expressions e.g., block expressions can have statements", "!", "(", "_pe", "instanceof", "FunctionStatement", "&&", "(", "(", "FunctionStatement", ")", "_pe", ")", ".", "getDynamicFunctionSymbol", "(", ")", "instanceof", "ProgramClassFunctionSymbol", ")", "&&", "(", "getLineNum", "(", ")", "==", "iLineNum", ")", "&&", "(", "clsSkip", "==", "null", "||", "!", "clsSkip", ".", "isAssignableFrom", "(", "_pe", ".", "getClass", "(", ")", ")", ")", ")", "{", "return", "this", ";", "}", "ParseTree", "deepest", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_children", ".", "size", ";", "i", "++", ")", "{", "ParseTree", "child", "=", "(", "ParseTree", ")", "_children", ".", "data", "[", "i", "]", ";", "ParseTree", "l", "=", "child", ".", "getStatementAtLine", "(", "iLineNum", ",", "clsSkip", ")", ";", "if", "(", "Search", ".", "isDeeper", "(", "deepest", ",", "l", ")", ")", "{", "deepest", "=", "l", ";", "}", "}", "return", "deepest", ";", "}" ]
@param iLineNum The one based line number to check. @param clsSkip A statement sublcass to ignore. Optional. @return The first statement beginning at the specified line number, or null if no statements start at the line number.
[ "@param", "iLineNum", "The", "one", "based", "line", "number", "to", "check", ".", "@param", "clsSkip", "A", "statement", "sublcass", "to", "ignore", ".", "Optional", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ParseTree.java#L273-L305
xvik/dropwizard-guicey
src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java
ConfigurationContext.getOrCreateInfo
@SuppressWarnings("unchecked") private <T extends ItemInfoImpl> T getOrCreateInfo(final ConfigItem type, final Object item) { """ Disabled items may not be actually registered. In order to register disable info in uniform way dummy container is created. @param type item type @param item item object @param <T> expected container type @return info container instance """ final Class<?> itemType = getType(item); final T info; // details holder allows to implicitly filter by type and avoid duplicate registration if (detailsHolder.containsKey(itemType)) { // no duplicate registration info = (T) detailsHolder.get(itemType); } else { itemsHolder.put(type, item); info = type.newContainer(itemType); detailsHolder.put(itemType, info); } return info; }
java
@SuppressWarnings("unchecked") private <T extends ItemInfoImpl> T getOrCreateInfo(final ConfigItem type, final Object item) { final Class<?> itemType = getType(item); final T info; // details holder allows to implicitly filter by type and avoid duplicate registration if (detailsHolder.containsKey(itemType)) { // no duplicate registration info = (T) detailsHolder.get(itemType); } else { itemsHolder.put(type, item); info = type.newContainer(itemType); detailsHolder.put(itemType, info); } return info; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "<", "T", "extends", "ItemInfoImpl", ">", "T", "getOrCreateInfo", "(", "final", "ConfigItem", "type", ",", "final", "Object", "item", ")", "{", "final", "Class", "<", "?", ">", "itemType", "=", "getType", "(", "item", ")", ";", "final", "T", "info", ";", "// details holder allows to implicitly filter by type and avoid duplicate registration", "if", "(", "detailsHolder", ".", "containsKey", "(", "itemType", ")", ")", "{", "// no duplicate registration", "info", "=", "(", "T", ")", "detailsHolder", ".", "get", "(", "itemType", ")", ";", "}", "else", "{", "itemsHolder", ".", "put", "(", "type", ",", "item", ")", ";", "info", "=", "type", ".", "newContainer", "(", "itemType", ")", ";", "detailsHolder", ".", "put", "(", "itemType", ",", "info", ")", ";", "}", "return", "info", ";", "}" ]
Disabled items may not be actually registered. In order to register disable info in uniform way dummy container is created. @param type item type @param item item object @param <T> expected container type @return info container instance
[ "Disabled", "items", "may", "not", "be", "actually", "registered", ".", "In", "order", "to", "register", "disable", "info", "in", "uniform", "way", "dummy", "container", "is", "created", "." ]
train
https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationContext.java#L675-L689
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/config/internal/MultivalueProperty.java
MultivalueProperty.retroTrim
private static int retroTrim(char[] res, int resI) { """ Reads from index {@code resI} to the beginning into {@code res} looking up the location of the trimmable char with the lowest index before encountering a non-trimmable char. <p> This basically trims {@code res} from any trimmable char at its end. @return index of next location to put new char in res """ int i = resI; while (i >= 1) { if (!istrimmable(res[i - 1])) { return i; } i--; } return i; }
java
private static int retroTrim(char[] res, int resI) { int i = resI; while (i >= 1) { if (!istrimmable(res[i - 1])) { return i; } i--; } return i; }
[ "private", "static", "int", "retroTrim", "(", "char", "[", "]", "res", ",", "int", "resI", ")", "{", "int", "i", "=", "resI", ";", "while", "(", "i", ">=", "1", ")", "{", "if", "(", "!", "istrimmable", "(", "res", "[", "i", "-", "1", "]", ")", ")", "{", "return", "i", ";", "}", "i", "--", ";", "}", "return", "i", ";", "}" ]
Reads from index {@code resI} to the beginning into {@code res} looking up the location of the trimmable char with the lowest index before encountering a non-trimmable char. <p> This basically trims {@code res} from any trimmable char at its end. @return index of next location to put new char in res
[ "Reads", "from", "index", "{", "@code", "resI", "}", "to", "the", "beginning", "into", "{", "@code", "res", "}", "looking", "up", "the", "location", "of", "the", "trimmable", "char", "with", "the", "lowest", "index", "before", "encountering", "a", "non", "-", "trimmable", "char", ".", "<p", ">", "This", "basically", "trims", "{", "@code", "res", "}", "from", "any", "trimmable", "char", "at", "its", "end", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/config/internal/MultivalueProperty.java#L199-L208
alkacon/opencms-core
src/org/opencms/ui/CmsVaadinUtils.java
CmsVaadinUtils.getMessageText
public static String getMessageText(I_CmsMessageBundle messages, String key, Object... args) { """ Gets the message for the current locale and the given key and arguments.<p> @param messages the messages instance @param key the message key @param args the message arguments @return the message text for the current locale """ return messages.getBundle(A_CmsUI.get().getLocale()).key(key, args); }
java
public static String getMessageText(I_CmsMessageBundle messages, String key, Object... args) { return messages.getBundle(A_CmsUI.get().getLocale()).key(key, args); }
[ "public", "static", "String", "getMessageText", "(", "I_CmsMessageBundle", "messages", ",", "String", "key", ",", "Object", "...", "args", ")", "{", "return", "messages", ".", "getBundle", "(", "A_CmsUI", ".", "get", "(", ")", ".", "getLocale", "(", ")", ")", ".", "key", "(", "key", ",", "args", ")", ";", "}" ]
Gets the message for the current locale and the given key and arguments.<p> @param messages the messages instance @param key the message key @param args the message arguments @return the message text for the current locale
[ "Gets", "the", "message", "for", "the", "current", "locale", "and", "the", "given", "key", "and", "arguments", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L631-L634
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcCallableStatement.java
WSJdbcCallableStatement.getCursor
private Object getCursor(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { """ Invokes getCursor and wraps the result set. @param implObject the instance on which the operation is invoked. @param method the method that is invoked. @param args the parameters to the method. @throws IllegalAccessException if the method is inaccessible. @throws IllegalArgumentException if the instance does not have the method or if the method arguments are not appropriate. @throws InvocationTargetException if the method raises a checked exception. @throws SQLException if unable to invoke the method for other reasons. @return the result of invoking the method. """ final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(tc, "getCursor", this, args[0]); ResultSet rsetImpl = (ResultSet) method.invoke(implObject, args); WSJdbcResultSet rsetWrapper = rsetImpl == null ? null : createWrapper(rsetImpl); if (trace && tc.isEntryEnabled()) Tr.exit(tc, "getCursor", rsetWrapper); return rsetWrapper; }
java
private Object getCursor(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { final boolean trace = TraceComponent.isAnyTracingEnabled(); if (trace && tc.isEntryEnabled()) Tr.entry(tc, "getCursor", this, args[0]); ResultSet rsetImpl = (ResultSet) method.invoke(implObject, args); WSJdbcResultSet rsetWrapper = rsetImpl == null ? null : createWrapper(rsetImpl); if (trace && tc.isEntryEnabled()) Tr.exit(tc, "getCursor", rsetWrapper); return rsetWrapper; }
[ "private", "Object", "getCursor", "(", "Object", "implObject", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", ",", "SQLException", "{", "final", "boolean", "trace", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "(", "trace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"getCursor\"", ",", "this", ",", "args", "[", "0", "]", ")", ";", "ResultSet", "rsetImpl", "=", "(", "ResultSet", ")", "method", ".", "invoke", "(", "implObject", ",", "args", ")", ";", "WSJdbcResultSet", "rsetWrapper", "=", "rsetImpl", "==", "null", "?", "null", ":", "createWrapper", "(", "rsetImpl", ")", ";", "if", "(", "trace", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"getCursor\"", ",", "rsetWrapper", ")", ";", "return", "rsetWrapper", ";", "}" ]
Invokes getCursor and wraps the result set. @param implObject the instance on which the operation is invoked. @param method the method that is invoked. @param args the parameters to the method. @throws IllegalAccessException if the method is inaccessible. @throws IllegalArgumentException if the instance does not have the method or if the method arguments are not appropriate. @throws InvocationTargetException if the method raises a checked exception. @throws SQLException if unable to invoke the method for other reasons. @return the result of invoking the method.
[ "Invokes", "getCursor", "and", "wraps", "the", "result", "set", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcCallableStatement.java#L290-L303
Sefford/fraggle
fraggle/src/main/java/com/sefford/fraggle/FraggleManager.java
FraggleManager.processAnimations
protected void processAnimations(FragmentAnimation animation, FragmentTransaction ft) { """ Processes the custom animations element, adding them as required @param animation Animation object to process @param ft Fragment transaction to add to the transition """ if (animation != null) { if (animation.isCompletedAnimation()) { ft.setCustomAnimations(animation.getEnterAnim(), animation.getExitAnim(), animation.getPushInAnim(), animation.getPopOutAnim()); } else { ft.setCustomAnimations(animation.getEnterAnim(), animation.getExitAnim()); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) for (LollipopAnim sharedElement : animation.getSharedViews()) { ft.addSharedElement(sharedElement.view, sharedElement.name); } } }
java
protected void processAnimations(FragmentAnimation animation, FragmentTransaction ft) { if (animation != null) { if (animation.isCompletedAnimation()) { ft.setCustomAnimations(animation.getEnterAnim(), animation.getExitAnim(), animation.getPushInAnim(), animation.getPopOutAnim()); } else { ft.setCustomAnimations(animation.getEnterAnim(), animation.getExitAnim()); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) for (LollipopAnim sharedElement : animation.getSharedViews()) { ft.addSharedElement(sharedElement.view, sharedElement.name); } } }
[ "protected", "void", "processAnimations", "(", "FragmentAnimation", "animation", ",", "FragmentTransaction", "ft", ")", "{", "if", "(", "animation", "!=", "null", ")", "{", "if", "(", "animation", ".", "isCompletedAnimation", "(", ")", ")", "{", "ft", ".", "setCustomAnimations", "(", "animation", ".", "getEnterAnim", "(", ")", ",", "animation", ".", "getExitAnim", "(", ")", ",", "animation", ".", "getPushInAnim", "(", ")", ",", "animation", ".", "getPopOutAnim", "(", ")", ")", ";", "}", "else", "{", "ft", ".", "setCustomAnimations", "(", "animation", ".", "getEnterAnim", "(", ")", ",", "animation", ".", "getExitAnim", "(", ")", ")", ";", "}", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "LOLLIPOP", ")", "for", "(", "LollipopAnim", "sharedElement", ":", "animation", ".", "getSharedViews", "(", ")", ")", "{", "ft", ".", "addSharedElement", "(", "sharedElement", ".", "view", ",", "sharedElement", ".", "name", ")", ";", "}", "}", "}" ]
Processes the custom animations element, adding them as required @param animation Animation object to process @param ft Fragment transaction to add to the transition
[ "Processes", "the", "custom", "animations", "element", "adding", "them", "as", "required" ]
train
https://github.com/Sefford/fraggle/blob/d1b65a99ecc3c3faeef8f288ca6225bbf475c3a3/fraggle/src/main/java/com/sefford/fraggle/FraggleManager.java#L229-L242
michael-rapp/AndroidBottomSheet
library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java
DividableGridAdapter.visualizeItem
@SuppressWarnings("PrimitiveArrayArgumentToVariableArgMethod") private void visualizeItem(@NonNull final Item item, @NonNull final ItemViewHolder viewHolder) { """ Visualizes a specific item. @param item The item, which should be visualized, as an instance of the class {@link Item}. The item may not be null @param viewHolder The view holder, which contains the views, which should be used to visualize the item, as an instance of the class {@link ItemViewHolder}. The view holder may not be null """ viewHolder.iconImageView.setVisibility(iconCount > 0 ? View.VISIBLE : View.GONE); viewHolder.iconImageView.setEnabled(item.isEnabled()); if (item.getIcon() != null && item.getIcon() instanceof StateListDrawable) { StateListDrawable stateListDrawable = (StateListDrawable) item.getIcon(); try { int[] currentState = viewHolder.iconImageView.getDrawableState(); Method getStateDrawableIndex = StateListDrawable.class.getMethod("getStateDrawableIndex", int[].class); Method getStateDrawable = StateListDrawable.class.getMethod("getStateDrawable", int.class); int index = (int) getStateDrawableIndex.invoke(stateListDrawable, currentState); Drawable drawable = (Drawable) getStateDrawable.invoke(stateListDrawable, index); viewHolder.iconImageView.setImageDrawable(drawable); } catch (Exception e) { viewHolder.iconImageView.setImageDrawable(item.getIcon()); } } else { viewHolder.iconImageView.setImageDrawable(item.getIcon()); } viewHolder.titleTextView.setText(item.getTitle()); viewHolder.titleTextView.setEnabled(item.isEnabled()); if (getItemColor() != -1) { viewHolder.titleTextView.setTextColor(getItemColor()); } }
java
@SuppressWarnings("PrimitiveArrayArgumentToVariableArgMethod") private void visualizeItem(@NonNull final Item item, @NonNull final ItemViewHolder viewHolder) { viewHolder.iconImageView.setVisibility(iconCount > 0 ? View.VISIBLE : View.GONE); viewHolder.iconImageView.setEnabled(item.isEnabled()); if (item.getIcon() != null && item.getIcon() instanceof StateListDrawable) { StateListDrawable stateListDrawable = (StateListDrawable) item.getIcon(); try { int[] currentState = viewHolder.iconImageView.getDrawableState(); Method getStateDrawableIndex = StateListDrawable.class.getMethod("getStateDrawableIndex", int[].class); Method getStateDrawable = StateListDrawable.class.getMethod("getStateDrawable", int.class); int index = (int) getStateDrawableIndex.invoke(stateListDrawable, currentState); Drawable drawable = (Drawable) getStateDrawable.invoke(stateListDrawable, index); viewHolder.iconImageView.setImageDrawable(drawable); } catch (Exception e) { viewHolder.iconImageView.setImageDrawable(item.getIcon()); } } else { viewHolder.iconImageView.setImageDrawable(item.getIcon()); } viewHolder.titleTextView.setText(item.getTitle()); viewHolder.titleTextView.setEnabled(item.isEnabled()); if (getItemColor() != -1) { viewHolder.titleTextView.setTextColor(getItemColor()); } }
[ "@", "SuppressWarnings", "(", "\"PrimitiveArrayArgumentToVariableArgMethod\"", ")", "private", "void", "visualizeItem", "(", "@", "NonNull", "final", "Item", "item", ",", "@", "NonNull", "final", "ItemViewHolder", "viewHolder", ")", "{", "viewHolder", ".", "iconImageView", ".", "setVisibility", "(", "iconCount", ">", "0", "?", "View", ".", "VISIBLE", ":", "View", ".", "GONE", ")", ";", "viewHolder", ".", "iconImageView", ".", "setEnabled", "(", "item", ".", "isEnabled", "(", ")", ")", ";", "if", "(", "item", ".", "getIcon", "(", ")", "!=", "null", "&&", "item", ".", "getIcon", "(", ")", "instanceof", "StateListDrawable", ")", "{", "StateListDrawable", "stateListDrawable", "=", "(", "StateListDrawable", ")", "item", ".", "getIcon", "(", ")", ";", "try", "{", "int", "[", "]", "currentState", "=", "viewHolder", ".", "iconImageView", ".", "getDrawableState", "(", ")", ";", "Method", "getStateDrawableIndex", "=", "StateListDrawable", ".", "class", ".", "getMethod", "(", "\"getStateDrawableIndex\"", ",", "int", "[", "]", ".", "class", ")", ";", "Method", "getStateDrawable", "=", "StateListDrawable", ".", "class", ".", "getMethod", "(", "\"getStateDrawable\"", ",", "int", ".", "class", ")", ";", "int", "index", "=", "(", "int", ")", "getStateDrawableIndex", ".", "invoke", "(", "stateListDrawable", ",", "currentState", ")", ";", "Drawable", "drawable", "=", "(", "Drawable", ")", "getStateDrawable", ".", "invoke", "(", "stateListDrawable", ",", "index", ")", ";", "viewHolder", ".", "iconImageView", ".", "setImageDrawable", "(", "drawable", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "viewHolder", ".", "iconImageView", ".", "setImageDrawable", "(", "item", ".", "getIcon", "(", ")", ")", ";", "}", "}", "else", "{", "viewHolder", ".", "iconImageView", ".", "setImageDrawable", "(", "item", ".", "getIcon", "(", ")", ")", ";", "}", "viewHolder", ".", "titleTextView", ".", "setText", "(", "item", ".", "getTitle", "(", ")", ")", ";", "viewHolder", ".", "titleTextView", ".", "setEnabled", "(", "item", ".", "isEnabled", "(", ")", ")", ";", "if", "(", "getItemColor", "(", ")", "!=", "-", "1", ")", "{", "viewHolder", ".", "titleTextView", ".", "setTextColor", "(", "getItemColor", "(", ")", ")", ";", "}", "}" ]
Visualizes a specific item. @param item The item, which should be visualized, as an instance of the class {@link Item}. The item may not be null @param viewHolder The view holder, which contains the views, which should be used to visualize the item, as an instance of the class {@link ItemViewHolder}. The view holder may not be null
[ "Visualizes", "a", "specific", "item", "." ]
train
https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/adapter/DividableGridAdapter.java#L251-L281
cogroo/cogroo4
cogroo-nlp/src/main/java/org/cogroo/tools/featurizer/FeaturizerCrossValidator.java
FeaturizerCrossValidator.evaluate
public void evaluate(ObjectStream<FeatureSample> samples, int nFolds) throws IOException, InvalidFormatException, IOException { """ Starts the evaluation. @param samples the data to train and test @param nFolds number of folds @throws IOException """ CrossValidationPartitioner<FeatureSample> partitioner = new CrossValidationPartitioner<FeatureSample>( samples, nFolds); while (partitioner.hasNext()) { CrossValidationPartitioner.TrainingSampleStream<FeatureSample> trainingSampleStream = partitioner .next(); if (this.factory == null) { this.factory = FeaturizerFactory.create(this.factoryClassName, posDict, cgFlags); } FeaturizerModel model = FeaturizerME.train(languageCode, trainingSampleStream, this.params, factory); // do testing FeaturizerEvaluator evaluator = new FeaturizerEvaluator(new FeaturizerME( model), listeners); evaluator.evaluate(trainingSampleStream.getTestSampleStream()); wordAccuracy.add(evaluator.getWordAccuracy(), evaluator.getWordCount()); } }
java
public void evaluate(ObjectStream<FeatureSample> samples, int nFolds) throws IOException, InvalidFormatException, IOException { CrossValidationPartitioner<FeatureSample> partitioner = new CrossValidationPartitioner<FeatureSample>( samples, nFolds); while (partitioner.hasNext()) { CrossValidationPartitioner.TrainingSampleStream<FeatureSample> trainingSampleStream = partitioner .next(); if (this.factory == null) { this.factory = FeaturizerFactory.create(this.factoryClassName, posDict, cgFlags); } FeaturizerModel model = FeaturizerME.train(languageCode, trainingSampleStream, this.params, factory); // do testing FeaturizerEvaluator evaluator = new FeaturizerEvaluator(new FeaturizerME( model), listeners); evaluator.evaluate(trainingSampleStream.getTestSampleStream()); wordAccuracy.add(evaluator.getWordAccuracy(), evaluator.getWordCount()); } }
[ "public", "void", "evaluate", "(", "ObjectStream", "<", "FeatureSample", ">", "samples", ",", "int", "nFolds", ")", "throws", "IOException", ",", "InvalidFormatException", ",", "IOException", "{", "CrossValidationPartitioner", "<", "FeatureSample", ">", "partitioner", "=", "new", "CrossValidationPartitioner", "<", "FeatureSample", ">", "(", "samples", ",", "nFolds", ")", ";", "while", "(", "partitioner", ".", "hasNext", "(", ")", ")", "{", "CrossValidationPartitioner", ".", "TrainingSampleStream", "<", "FeatureSample", ">", "trainingSampleStream", "=", "partitioner", ".", "next", "(", ")", ";", "if", "(", "this", ".", "factory", "==", "null", ")", "{", "this", ".", "factory", "=", "FeaturizerFactory", ".", "create", "(", "this", ".", "factoryClassName", ",", "posDict", ",", "cgFlags", ")", ";", "}", "FeaturizerModel", "model", "=", "FeaturizerME", ".", "train", "(", "languageCode", ",", "trainingSampleStream", ",", "this", ".", "params", ",", "factory", ")", ";", "// do testing", "FeaturizerEvaluator", "evaluator", "=", "new", "FeaturizerEvaluator", "(", "new", "FeaturizerME", "(", "model", ")", ",", "listeners", ")", ";", "evaluator", ".", "evaluate", "(", "trainingSampleStream", ".", "getTestSampleStream", "(", ")", ")", ";", "wordAccuracy", ".", "add", "(", "evaluator", ".", "getWordAccuracy", "(", ")", ",", "evaluator", ".", "getWordCount", "(", ")", ")", ";", "}", "}" ]
Starts the evaluation. @param samples the data to train and test @param nFolds number of folds @throws IOException
[ "Starts", "the", "evaluation", "." ]
train
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-nlp/src/main/java/org/cogroo/tools/featurizer/FeaturizerCrossValidator.java#L62-L87
Waikato/moa
moa/src/main/java/moa/clusterers/outliers/utils/mtree/MTree.java
MTree.getNearest
public Query getNearest(DATA queryData) { """ Performs a nearest-neighbor query on the M-Tree, without constraints. @param queryData The query data object. @return A {@link Query} object used to iterate on the results. """ return new Query(queryData, Double.POSITIVE_INFINITY, Integer.MAX_VALUE); }
java
public Query getNearest(DATA queryData) { return new Query(queryData, Double.POSITIVE_INFINITY, Integer.MAX_VALUE); }
[ "public", "Query", "getNearest", "(", "DATA", "queryData", ")", "{", "return", "new", "Query", "(", "queryData", ",", "Double", ".", "POSITIVE_INFINITY", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Performs a nearest-neighbor query on the M-Tree, without constraints. @param queryData The query data object. @return A {@link Query} object used to iterate on the results.
[ "Performs", "a", "nearest", "-", "neighbor", "query", "on", "the", "M", "-", "Tree", "without", "constraints", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/outliers/utils/mtree/MTree.java#L444-L446
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java
AmqpClient.registerSynchronousRequest
void registerSynchronousRequest(Object context, String input, Object frame, String stateName) { """ registerSynchronousRequest puts the client into a waiting state that will be able to call the continuation for a method that expects a particular synchronous response This also lets us call the error cb when there is a close frame (which AMQP uses to raise exceptions) with a reason why the last command failed. """ Action action = (Action)frame; AmqpMethod amqpMethod = (AmqpMethod)action.args[1]; if (amqpMethod.synchronous) { asyncClient.setWaitingAction(action); } else { // method is not synchronous } }
java
void registerSynchronousRequest(Object context, String input, Object frame, String stateName) { Action action = (Action)frame; AmqpMethod amqpMethod = (AmqpMethod)action.args[1]; if (amqpMethod.synchronous) { asyncClient.setWaitingAction(action); } else { // method is not synchronous } }
[ "void", "registerSynchronousRequest", "(", "Object", "context", ",", "String", "input", ",", "Object", "frame", ",", "String", "stateName", ")", "{", "Action", "action", "=", "(", "Action", ")", "frame", ";", "AmqpMethod", "amqpMethod", "=", "(", "AmqpMethod", ")", "action", ".", "args", "[", "1", "]", ";", "if", "(", "amqpMethod", ".", "synchronous", ")", "{", "asyncClient", ".", "setWaitingAction", "(", "action", ")", ";", "}", "else", "{", "// method is not synchronous", "}", "}" ]
registerSynchronousRequest puts the client into a waiting state that will be able to call the continuation for a method that expects a particular synchronous response This also lets us call the error cb when there is a close frame (which AMQP uses to raise exceptions) with a reason why the last command failed.
[ "registerSynchronousRequest", "puts", "the", "client", "into", "a", "waiting", "state", "that", "will", "be", "able", "to", "call", "the", "continuation", "for", "a", "method", "that", "expects", "a", "particular", "synchronous", "response", "This", "also", "lets", "us", "call", "the", "error", "cb", "when", "there", "is", "a", "close", "frame", "(", "which", "AMQP", "uses", "to", "raise", "exceptions", ")", "with", "a", "reason", "why", "the", "last", "command", "failed", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java#L949-L958
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/manager/HBCIUtils.java
HBCIUtils.strings2DateTimeLocal
public static Date strings2DateTimeLocal(String date, String time) { """ Erzeugt ein Datums-Objekt aus Datum und Uhrzeit in der String-Darstellung. Die String-Darstellung von Datum und Uhrzeit müssen dabei der aktuellen <em>HBCI4Java</em>-Locale entsprechen (siehe Kernel-Parameter <code>kernel.locale.*</code>)). @param date ein Datum in der lokalen Stringdarstellung @param time eine Uhrzeit in der lokalen Stringdarstellung (darf <code>null</code> sein) @return ein entsprechendes Datumsobjekt """ Date ret; try { if (time != null) ret = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault()).parse(date + " " + time); else ret = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).parse(date); } catch (Exception e) { throw new InvalidArgumentException(date + " / " + time); } return ret; }
java
public static Date strings2DateTimeLocal(String date, String time) { Date ret; try { if (time != null) ret = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault()).parse(date + " " + time); else ret = DateFormat.getDateInstance(DateFormat.SHORT, Locale.getDefault()).parse(date); } catch (Exception e) { throw new InvalidArgumentException(date + " / " + time); } return ret; }
[ "public", "static", "Date", "strings2DateTimeLocal", "(", "String", "date", ",", "String", "time", ")", "{", "Date", "ret", ";", "try", "{", "if", "(", "time", "!=", "null", ")", "ret", "=", "DateFormat", ".", "getDateTimeInstance", "(", "DateFormat", ".", "SHORT", ",", "DateFormat", ".", "SHORT", ",", "Locale", ".", "getDefault", "(", ")", ")", ".", "parse", "(", "date", "+", "\" \"", "+", "time", ")", ";", "else", "ret", "=", "DateFormat", ".", "getDateInstance", "(", "DateFormat", ".", "SHORT", ",", "Locale", ".", "getDefault", "(", ")", ")", ".", "parse", "(", "date", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "InvalidArgumentException", "(", "date", "+", "\" / \"", "+", "time", ")", ";", "}", "return", "ret", ";", "}" ]
Erzeugt ein Datums-Objekt aus Datum und Uhrzeit in der String-Darstellung. Die String-Darstellung von Datum und Uhrzeit müssen dabei der aktuellen <em>HBCI4Java</em>-Locale entsprechen (siehe Kernel-Parameter <code>kernel.locale.*</code>)). @param date ein Datum in der lokalen Stringdarstellung @param time eine Uhrzeit in der lokalen Stringdarstellung (darf <code>null</code> sein) @return ein entsprechendes Datumsobjekt
[ "Erzeugt", "ein", "Datums", "-", "Objekt", "aus", "Datum", "und", "Uhrzeit", "in", "der", "String", "-", "Darstellung", ".", "Die", "String", "-", "Darstellung", "von", "Datum", "und", "Uhrzeit", "müssen", "dabei", "der", "aktuellen", "<em", ">", "HBCI4Java<", "/", "em", ">", "-", "Locale", "entsprechen", "(", "siehe", "Kernel", "-", "Parameter", "<code", ">", "kernel", ".", "locale", ".", "*", "<", "/", "code", ">", "))", "." ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIUtils.java#L431-L445
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java
FileWriter.write
public File write(String content, boolean isAppend) throws IORuntimeException { """ 将String写入文件 @param content 写入的内容 @param isAppend 是否追加 @return 目标文件 @throws IORuntimeException IO异常 """ BufferedWriter writer = null; try { writer = getWriter(isAppend); writer.write(content); writer.flush(); }catch(IOException e){ throw new IORuntimeException(e); }finally { IoUtil.close(writer); } return file; }
java
public File write(String content, boolean isAppend) throws IORuntimeException { BufferedWriter writer = null; try { writer = getWriter(isAppend); writer.write(content); writer.flush(); }catch(IOException e){ throw new IORuntimeException(e); }finally { IoUtil.close(writer); } return file; }
[ "public", "File", "write", "(", "String", "content", ",", "boolean", "isAppend", ")", "throws", "IORuntimeException", "{", "BufferedWriter", "writer", "=", "null", ";", "try", "{", "writer", "=", "getWriter", "(", "isAppend", ")", ";", "writer", ".", "write", "(", "content", ")", ";", "writer", ".", "flush", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IORuntimeException", "(", "e", ")", ";", "}", "finally", "{", "IoUtil", ".", "close", "(", "writer", ")", ";", "}", "return", "file", ";", "}" ]
将String写入文件 @param content 写入的内容 @param isAppend 是否追加 @return 目标文件 @throws IORuntimeException IO异常
[ "将String写入文件" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java#L113-L125
haraldk/TwelveMonkeys
imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGLosslessDecoderWrapper.java
JPEGLosslessDecoderWrapper.to16Bit1ComponentGrayScale
private BufferedImage to16Bit1ComponentGrayScale(int[][] decoded, int precision, int width, int height) { """ Converts the decoded buffer into a BufferedImage. precision: 16 bit, componentCount = 1 @param decoded data buffer @param precision @param width of the image @param height of the image @return a BufferedImage.TYPE_USHORT_GRAY """ BufferedImage image; if (precision == 16) { image = new BufferedImage(width, height, BufferedImage.TYPE_USHORT_GRAY); } else { ColorModel colorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY), new int[] {precision}, false, false, Transparency.OPAQUE, DataBuffer.TYPE_USHORT); image = new BufferedImage(colorModel, colorModel.createCompatibleWritableRaster(width, height), colorModel.isAlphaPremultiplied(), null); } short[] imageBuffer = ((DataBufferUShort) image.getRaster().getDataBuffer()).getData(); for (int i = 0; i < imageBuffer.length; i++) { imageBuffer[i] = (short) decoded[0][i]; } return image; }
java
private BufferedImage to16Bit1ComponentGrayScale(int[][] decoded, int precision, int width, int height) { BufferedImage image; if (precision == 16) { image = new BufferedImage(width, height, BufferedImage.TYPE_USHORT_GRAY); } else { ColorModel colorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY), new int[] {precision}, false, false, Transparency.OPAQUE, DataBuffer.TYPE_USHORT); image = new BufferedImage(colorModel, colorModel.createCompatibleWritableRaster(width, height), colorModel.isAlphaPremultiplied(), null); } short[] imageBuffer = ((DataBufferUShort) image.getRaster().getDataBuffer()).getData(); for (int i = 0; i < imageBuffer.length; i++) { imageBuffer[i] = (short) decoded[0][i]; } return image; }
[ "private", "BufferedImage", "to16Bit1ComponentGrayScale", "(", "int", "[", "]", "[", "]", "decoded", ",", "int", "precision", ",", "int", "width", ",", "int", "height", ")", "{", "BufferedImage", "image", ";", "if", "(", "precision", "==", "16", ")", "{", "image", "=", "new", "BufferedImage", "(", "width", ",", "height", ",", "BufferedImage", ".", "TYPE_USHORT_GRAY", ")", ";", "}", "else", "{", "ColorModel", "colorModel", "=", "new", "ComponentColorModel", "(", "ColorSpace", ".", "getInstance", "(", "ColorSpace", ".", "CS_GRAY", ")", ",", "new", "int", "[", "]", "{", "precision", "}", ",", "false", ",", "false", ",", "Transparency", ".", "OPAQUE", ",", "DataBuffer", ".", "TYPE_USHORT", ")", ";", "image", "=", "new", "BufferedImage", "(", "colorModel", ",", "colorModel", ".", "createCompatibleWritableRaster", "(", "width", ",", "height", ")", ",", "colorModel", ".", "isAlphaPremultiplied", "(", ")", ",", "null", ")", ";", "}", "short", "[", "]", "imageBuffer", "=", "(", "(", "DataBufferUShort", ")", "image", ".", "getRaster", "(", ")", ".", "getDataBuffer", "(", ")", ")", ".", "getData", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "imageBuffer", ".", "length", ";", "i", "++", ")", "{", "imageBuffer", "[", "i", "]", "=", "(", "short", ")", "decoded", "[", "0", "]", "[", "i", "]", ";", "}", "return", "image", ";", "}" ]
Converts the decoded buffer into a BufferedImage. precision: 16 bit, componentCount = 1 @param decoded data buffer @param precision @param width of the image @param height of the image @return a BufferedImage.TYPE_USHORT_GRAY
[ "Converts", "the", "decoded", "buffer", "into", "a", "BufferedImage", ".", "precision", ":", "16", "bit", "componentCount", "=", "1" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGLosslessDecoderWrapper.java#L132-L149
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.convertTo
public <S, T> T convertTo(Class<S> input, Class<T> output, Object object, Class<? extends Annotation> qualifier) { """ Convert an object which is an instance of source class to the given target class @param input The class of the object to be converted @param output The target class to convert the object to @param object The object to be converted @param qualifier Match the converter with the given qualifier """ return convertTo(new ConverterKey<S,T>(input, output, qualifier), object); }
java
public <S, T> T convertTo(Class<S> input, Class<T> output, Object object, Class<? extends Annotation> qualifier) { return convertTo(new ConverterKey<S,T>(input, output, qualifier), object); }
[ "public", "<", "S", ",", "T", ">", "T", "convertTo", "(", "Class", "<", "S", ">", "input", ",", "Class", "<", "T", ">", "output", ",", "Object", "object", ",", "Class", "<", "?", "extends", "Annotation", ">", "qualifier", ")", "{", "return", "convertTo", "(", "new", "ConverterKey", "<", "S", ",", "T", ">", "(", "input", ",", "output", ",", "qualifier", ")", ",", "object", ")", ";", "}" ]
Convert an object which is an instance of source class to the given target class @param input The class of the object to be converted @param output The target class to convert the object to @param object The object to be converted @param qualifier Match the converter with the given qualifier
[ "Convert", "an", "object", "which", "is", "an", "instance", "of", "source", "class", "to", "the", "given", "target", "class" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L805-L808
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLBuilder.java
JQLBuilder.forEachFields
private static void forEachFields(SQLiteModelMethod method, OnPropertyListener listener) { """ For each fields. @param dao the dao @param listener the listener """ for (SQLProperty item : method.getEntity().getCollection()) { listener.onProperty(item); } }
java
private static void forEachFields(SQLiteModelMethod method, OnPropertyListener listener) { for (SQLProperty item : method.getEntity().getCollection()) { listener.onProperty(item); } }
[ "private", "static", "void", "forEachFields", "(", "SQLiteModelMethod", "method", ",", "OnPropertyListener", "listener", ")", "{", "for", "(", "SQLProperty", "item", ":", "method", ".", "getEntity", "(", ")", ".", "getCollection", "(", ")", ")", "{", "listener", ".", "onProperty", "(", "item", ")", ";", "}", "}" ]
For each fields. @param dao the dao @param listener the listener
[ "For", "each", "fields", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLBuilder.java#L1092-L1096
alkacon/opencms-core
src/org/opencms/loader/CmsResourceManager.java
CmsResourceManager.readTemplateWithName
private NamedTemplate readTemplateWithName(CmsObject cms, String path) { """ Reads a template resource together with its name.<p> @param cms the current CMS context @param path the template path @return the template together with its name, or null if the template couldn't be read """ try { CmsResource resource = cms.readResource(path, CmsResourceFilter.IGNORE_EXPIRATION); String name = getTemplateName(cms, resource); return new NamedTemplate(resource, name); } catch (Exception e) { return null; } }
java
private NamedTemplate readTemplateWithName(CmsObject cms, String path) { try { CmsResource resource = cms.readResource(path, CmsResourceFilter.IGNORE_EXPIRATION); String name = getTemplateName(cms, resource); return new NamedTemplate(resource, name); } catch (Exception e) { return null; } }
[ "private", "NamedTemplate", "readTemplateWithName", "(", "CmsObject", "cms", ",", "String", "path", ")", "{", "try", "{", "CmsResource", "resource", "=", "cms", ".", "readResource", "(", "path", ",", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ")", ";", "String", "name", "=", "getTemplateName", "(", "cms", ",", "resource", ")", ";", "return", "new", "NamedTemplate", "(", "resource", ",", "name", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "null", ";", "}", "}" ]
Reads a template resource together with its name.<p> @param cms the current CMS context @param path the template path @return the template together with its name, or null if the template couldn't be read
[ "Reads", "a", "template", "resource", "together", "with", "its", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsResourceManager.java#L1550-L1559
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsADEManager.java
CmsADEManager.saveFavoriteList
public void saveFavoriteList(CmsObject cms, List<CmsContainerElementBean> favoriteList) throws CmsException { """ Saves the favorite list, user based.<p> @param cms the cms context @param favoriteList the element list @throws CmsException if something goes wrong """ saveElementList(cms, favoriteList, ADDINFO_ADE_FAVORITE_LIST); }
java
public void saveFavoriteList(CmsObject cms, List<CmsContainerElementBean> favoriteList) throws CmsException { saveElementList(cms, favoriteList, ADDINFO_ADE_FAVORITE_LIST); }
[ "public", "void", "saveFavoriteList", "(", "CmsObject", "cms", ",", "List", "<", "CmsContainerElementBean", ">", "favoriteList", ")", "throws", "CmsException", "{", "saveElementList", "(", "cms", ",", "favoriteList", ",", "ADDINFO_ADE_FAVORITE_LIST", ")", ";", "}" ]
Saves the favorite list, user based.<p> @param cms the cms context @param favoriteList the element list @throws CmsException if something goes wrong
[ "Saves", "the", "favorite", "list", "user", "based", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L1196-L1199
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java
INodeDirectory.addNode
<T extends INode> T addNode(String path, T newNode) throws FileNotFoundException { """ Equivalent to addNode(path, newNode, false). @see #addNode(String, INode, boolean) """ return addNode(path, newNode, false); }
java
<T extends INode> T addNode(String path, T newNode) throws FileNotFoundException { return addNode(path, newNode, false); }
[ "<", "T", "extends", "INode", ">", "T", "addNode", "(", "String", "path", ",", "T", "newNode", ")", "throws", "FileNotFoundException", "{", "return", "addNode", "(", "path", ",", "newNode", ",", "false", ")", ";", "}" ]
Equivalent to addNode(path, newNode, false). @see #addNode(String, INode, boolean)
[ "Equivalent", "to", "addNode", "(", "path", "newNode", "false", ")", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INodeDirectory.java#L328-L330
nispok/snackbar
lib/src/main/java/com/nispok/snackbar/Snackbar.java
Snackbar.setBackgroundDrawable
public static void setBackgroundDrawable(View view, Drawable drawable) { """ Set a Background Drawable using the appropriate Android version api call @param view @param drawable """ if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { view.setBackgroundDrawable(drawable); } else { view.setBackground(drawable); } }
java
public static void setBackgroundDrawable(View view, Drawable drawable) { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) { view.setBackgroundDrawable(drawable); } else { view.setBackground(drawable); } }
[ "public", "static", "void", "setBackgroundDrawable", "(", "View", "view", ",", "Drawable", "drawable", ")", "{", "if", "(", "android", ".", "os", ".", "Build", ".", "VERSION", ".", "SDK_INT", "<", "android", ".", "os", ".", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN", ")", "{", "view", ".", "setBackgroundDrawable", "(", "drawable", ")", ";", "}", "else", "{", "view", ".", "setBackground", "(", "drawable", ")", ";", "}", "}" ]
Set a Background Drawable using the appropriate Android version api call @param view @param drawable
[ "Set", "a", "Background", "Drawable", "using", "the", "appropriate", "Android", "version", "api", "call" ]
train
https://github.com/nispok/snackbar/blob/a4e0449874423031107f6aaa7e97d0f1714a1d3b/lib/src/main/java/com/nispok/snackbar/Snackbar.java#L1222-L1228
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java
JsiiClient.callStaticMethod
public JsonNode callStaticMethod(final String fqn, final String method, final ArrayNode args) { """ Invokes a static method. @param fqn The FQN of the class. @param method The method name. @param args The method arguments. @return The return value. """ ObjectNode req = makeRequest("sinvoke"); req.put("fqn", fqn); req.put("method", method); req.set("args", args); JsonNode resp = this.runtime.requestResponse(req); return resp.get("result"); }
java
public JsonNode callStaticMethod(final String fqn, final String method, final ArrayNode args) { ObjectNode req = makeRequest("sinvoke"); req.put("fqn", fqn); req.put("method", method); req.set("args", args); JsonNode resp = this.runtime.requestResponse(req); return resp.get("result"); }
[ "public", "JsonNode", "callStaticMethod", "(", "final", "String", "fqn", ",", "final", "String", "method", ",", "final", "ArrayNode", "args", ")", "{", "ObjectNode", "req", "=", "makeRequest", "(", "\"sinvoke\"", ")", ";", "req", ".", "put", "(", "\"fqn\"", ",", "fqn", ")", ";", "req", ".", "put", "(", "\"method\"", ",", "method", ")", ";", "req", ".", "set", "(", "\"args\"", ",", "args", ")", ";", "JsonNode", "resp", "=", "this", ".", "runtime", ".", "requestResponse", "(", "req", ")", ";", "return", "resp", ".", "get", "(", "\"result\"", ")", ";", "}" ]
Invokes a static method. @param fqn The FQN of the class. @param method The method name. @param args The method arguments. @return The return value.
[ "Invokes", "a", "static", "method", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L164-L171
ixa-ehu/kaflib
src/main/java/ixa/kaflib/KAFDocument.java
KAFDocument.newTimex3
public Timex3 newTimex3(String id, String type) { """ Creates a timeExpressions object to load an existing Timex3. It receives it's ID as an argument. The Timex3 is added to the document. @param id the ID of the coreference. @param references different mentions (list of targets) to the same entity. @return a new timex3. """ idManager.updateCounter(AnnotationType.TIMEX3, id); Timex3 newTimex3 = new Timex3(id, type); annotationContainer.add(newTimex3, Layer.TIME_EXPRESSIONS, AnnotationType.TIMEX3); return newTimex3; }
java
public Timex3 newTimex3(String id, String type) { idManager.updateCounter(AnnotationType.TIMEX3, id); Timex3 newTimex3 = new Timex3(id, type); annotationContainer.add(newTimex3, Layer.TIME_EXPRESSIONS, AnnotationType.TIMEX3); return newTimex3; }
[ "public", "Timex3", "newTimex3", "(", "String", "id", ",", "String", "type", ")", "{", "idManager", ".", "updateCounter", "(", "AnnotationType", ".", "TIMEX3", ",", "id", ")", ";", "Timex3", "newTimex3", "=", "new", "Timex3", "(", "id", ",", "type", ")", ";", "annotationContainer", ".", "add", "(", "newTimex3", ",", "Layer", ".", "TIME_EXPRESSIONS", ",", "AnnotationType", ".", "TIMEX3", ")", ";", "return", "newTimex3", ";", "}" ]
Creates a timeExpressions object to load an existing Timex3. It receives it's ID as an argument. The Timex3 is added to the document. @param id the ID of the coreference. @param references different mentions (list of targets) to the same entity. @return a new timex3.
[ "Creates", "a", "timeExpressions", "object", "to", "load", "an", "existing", "Timex3", ".", "It", "receives", "it", "s", "ID", "as", "an", "argument", ".", "The", "Timex3", "is", "added", "to", "the", "document", "." ]
train
https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L779-L784
requery/requery
requery/src/main/java/io/requery/proxy/EntityProxy.java
EntityProxy.setState
public void setState(Attribute<E, ?> attribute, PropertyState state) { """ Sets the current {@link PropertyState} of a given {@link Attribute}. @param attribute to set @param state state to set """ if (!stateless) { attribute.getPropertyState().set(entity, state); } }
java
public void setState(Attribute<E, ?> attribute, PropertyState state) { if (!stateless) { attribute.getPropertyState().set(entity, state); } }
[ "public", "void", "setState", "(", "Attribute", "<", "E", ",", "?", ">", "attribute", ",", "PropertyState", "state", ")", "{", "if", "(", "!", "stateless", ")", "{", "attribute", ".", "getPropertyState", "(", ")", ".", "set", "(", "entity", ",", "state", ")", ";", "}", "}" ]
Sets the current {@link PropertyState} of a given {@link Attribute}. @param attribute to set @param state state to set
[ "Sets", "the", "current", "{", "@link", "PropertyState", "}", "of", "a", "given", "{", "@link", "Attribute", "}", "." ]
train
https://github.com/requery/requery/blob/3070590c2ef76bb7062570bf9df03cd482db024a/requery/src/main/java/io/requery/proxy/EntityProxy.java#L219-L223
aws/aws-sdk-java
aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/RespondToAuthChallengeRequest.java
RespondToAuthChallengeRequest.withChallengeResponses
public RespondToAuthChallengeRequest withChallengeResponses(java.util.Map<String, String> challengeResponses) { """ <p> The challenge responses. These are inputs corresponding to the value of <code>ChallengeName</code>, for example: </p> <ul> <li> <p> <code>SMS_MFA</code>: <code>SMS_MFA_CODE</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>PASSWORD_VERIFIER</code>: <code>PASSWORD_CLAIM_SIGNATURE</code>, <code>PASSWORD_CLAIM_SECRET_BLOCK</code>, <code>TIMESTAMP</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>NEW_PASSWORD_REQUIRED</code>: <code>NEW_PASSWORD</code>, any other required attributes, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> </ul> @param challengeResponses The challenge responses. These are inputs corresponding to the value of <code>ChallengeName</code>, for example:</p> <ul> <li> <p> <code>SMS_MFA</code>: <code>SMS_MFA_CODE</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>PASSWORD_VERIFIER</code>: <code>PASSWORD_CLAIM_SIGNATURE</code>, <code>PASSWORD_CLAIM_SECRET_BLOCK</code>, <code>TIMESTAMP</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>NEW_PASSWORD_REQUIRED</code>: <code>NEW_PASSWORD</code>, any other required attributes, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> @return Returns a reference to this object so that method calls can be chained together. """ setChallengeResponses(challengeResponses); return this; }
java
public RespondToAuthChallengeRequest withChallengeResponses(java.util.Map<String, String> challengeResponses) { setChallengeResponses(challengeResponses); return this; }
[ "public", "RespondToAuthChallengeRequest", "withChallengeResponses", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "challengeResponses", ")", "{", "setChallengeResponses", "(", "challengeResponses", ")", ";", "return", "this", ";", "}" ]
<p> The challenge responses. These are inputs corresponding to the value of <code>ChallengeName</code>, for example: </p> <ul> <li> <p> <code>SMS_MFA</code>: <code>SMS_MFA_CODE</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>PASSWORD_VERIFIER</code>: <code>PASSWORD_CLAIM_SIGNATURE</code>, <code>PASSWORD_CLAIM_SECRET_BLOCK</code>, <code>TIMESTAMP</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>NEW_PASSWORD_REQUIRED</code>: <code>NEW_PASSWORD</code>, any other required attributes, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> </ul> @param challengeResponses The challenge responses. These are inputs corresponding to the value of <code>ChallengeName</code>, for example:</p> <ul> <li> <p> <code>SMS_MFA</code>: <code>SMS_MFA_CODE</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>PASSWORD_VERIFIER</code>: <code>PASSWORD_CLAIM_SIGNATURE</code>, <code>PASSWORD_CLAIM_SECRET_BLOCK</code>, <code>TIMESTAMP</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>NEW_PASSWORD_REQUIRED</code>: <code>NEW_PASSWORD</code>, any other required attributes, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "challenge", "responses", ".", "These", "are", "inputs", "corresponding", "to", "the", "value", "of", "<code", ">", "ChallengeName<", "/", "code", ">", "for", "example", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<p", ">", "<code", ">", "SMS_MFA<", "/", "code", ">", ":", "<code", ">", "SMS_MFA_CODE<", "/", "code", ">", "<code", ">", "USERNAME<", "/", "code", ">", "<code", ">", "SECRET_HASH<", "/", "code", ">", "(", "if", "app", "client", "is", "configured", "with", "client", "secret", ")", ".", "<", "/", "p", ">", "<", "/", "li", ">", "<li", ">", "<p", ">", "<code", ">", "PASSWORD_VERIFIER<", "/", "code", ">", ":", "<code", ">", "PASSWORD_CLAIM_SIGNATURE<", "/", "code", ">", "<code", ">", "PASSWORD_CLAIM_SECRET_BLOCK<", "/", "code", ">", "<code", ">", "TIMESTAMP<", "/", "code", ">", "<code", ">", "USERNAME<", "/", "code", ">", "<code", ">", "SECRET_HASH<", "/", "code", ">", "(", "if", "app", "client", "is", "configured", "with", "client", "secret", ")", ".", "<", "/", "p", ">", "<", "/", "li", ">", "<li", ">", "<p", ">", "<code", ">", "NEW_PASSWORD_REQUIRED<", "/", "code", ">", ":", "<code", ">", "NEW_PASSWORD<", "/", "code", ">", "any", "other", "required", "attributes", "<code", ">", "USERNAME<", "/", "code", ">", "<code", ">", "SECRET_HASH<", "/", "code", ">", "(", "if", "app", "client", "is", "configured", "with", "client", "secret", ")", ".", "<", "/", "p", ">", "<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/RespondToAuthChallengeRequest.java#L453-L456
JRebirth/JRebirth
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java
AbstractTemplateView.addSlideItem
protected void addSlideItem(final VBox vbox, final SlideItem item) { """ Add a slide item by managing level. @param vbox the layout node @param item the slide item to add """ Node node = null; if (item.isLink()) { final Hyperlink link = HyperlinkBuilder.create() .opacity(1.0) .text(item.getValue()) .build(); link.getStyleClass().add("link" + item.getLevel()); link.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent e) { final ClipboardContent content = new ClipboardContent(); content.putString("http://" + ((Hyperlink) e.getSource()).getText()); Clipboard.getSystemClipboard().setContent(content); } }); node = link; } else if (item.isHtml()) { final WebView web = WebViewBuilder.create() .fontScale(1.4) // .effect(ReflectionBuilder.create().fraction(0.4).build()) .build(); web.getEngine().loadContent(item.getValue()); VBox.setVgrow(web, Priority.NEVER); node = web; // StackPaneBuilder.create().children(web).style("-fx-border-width:2;-fx-border-color:#000000").build(); } else if (item.getImage() != null) { final Image image = Resources.create(new RelImage(item.getImage())).get(); final ImageView imageViewer = ImageViewBuilder.create() .styleClass(ITEM_CLASS_PREFIX + item.getLevel()) .image(image) // .effect(ReflectionBuilder.create().fraction(0.9).build()) .build(); node = imageViewer; } else { final Text text = TextBuilder.create() .styleClass(ITEM_CLASS_PREFIX + item.getLevel()) .text(item.getValue() == null ? "" : item.getValue()) .build(); node = text; } if (item.getStyle() != null) { node.getStyleClass().add(item.getStyle()); } if (item.getScale() != 1.0) { node.setScaleX(item.getScale()); node.setScaleY(item.getScale()); } vbox.getChildren().add(node); }
java
protected void addSlideItem(final VBox vbox, final SlideItem item) { Node node = null; if (item.isLink()) { final Hyperlink link = HyperlinkBuilder.create() .opacity(1.0) .text(item.getValue()) .build(); link.getStyleClass().add("link" + item.getLevel()); link.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(final ActionEvent e) { final ClipboardContent content = new ClipboardContent(); content.putString("http://" + ((Hyperlink) e.getSource()).getText()); Clipboard.getSystemClipboard().setContent(content); } }); node = link; } else if (item.isHtml()) { final WebView web = WebViewBuilder.create() .fontScale(1.4) // .effect(ReflectionBuilder.create().fraction(0.4).build()) .build(); web.getEngine().loadContent(item.getValue()); VBox.setVgrow(web, Priority.NEVER); node = web; // StackPaneBuilder.create().children(web).style("-fx-border-width:2;-fx-border-color:#000000").build(); } else if (item.getImage() != null) { final Image image = Resources.create(new RelImage(item.getImage())).get(); final ImageView imageViewer = ImageViewBuilder.create() .styleClass(ITEM_CLASS_PREFIX + item.getLevel()) .image(image) // .effect(ReflectionBuilder.create().fraction(0.9).build()) .build(); node = imageViewer; } else { final Text text = TextBuilder.create() .styleClass(ITEM_CLASS_PREFIX + item.getLevel()) .text(item.getValue() == null ? "" : item.getValue()) .build(); node = text; } if (item.getStyle() != null) { node.getStyleClass().add(item.getStyle()); } if (item.getScale() != 1.0) { node.setScaleX(item.getScale()); node.setScaleY(item.getScale()); } vbox.getChildren().add(node); }
[ "protected", "void", "addSlideItem", "(", "final", "VBox", "vbox", ",", "final", "SlideItem", "item", ")", "{", "Node", "node", "=", "null", ";", "if", "(", "item", ".", "isLink", "(", ")", ")", "{", "final", "Hyperlink", "link", "=", "HyperlinkBuilder", ".", "create", "(", ")", ".", "opacity", "(", "1.0", ")", ".", "text", "(", "item", ".", "getValue", "(", ")", ")", ".", "build", "(", ")", ";", "link", ".", "getStyleClass", "(", ")", ".", "add", "(", "\"link\"", "+", "item", ".", "getLevel", "(", ")", ")", ";", "link", ".", "setOnAction", "(", "new", "EventHandler", "<", "ActionEvent", ">", "(", ")", "{", "@", "Override", "public", "void", "handle", "(", "final", "ActionEvent", "e", ")", "{", "final", "ClipboardContent", "content", "=", "new", "ClipboardContent", "(", ")", ";", "content", ".", "putString", "(", "\"http://\"", "+", "(", "(", "Hyperlink", ")", "e", ".", "getSource", "(", ")", ")", ".", "getText", "(", ")", ")", ";", "Clipboard", ".", "getSystemClipboard", "(", ")", ".", "setContent", "(", "content", ")", ";", "}", "}", ")", ";", "node", "=", "link", ";", "}", "else", "if", "(", "item", ".", "isHtml", "(", ")", ")", "{", "final", "WebView", "web", "=", "WebViewBuilder", ".", "create", "(", ")", ".", "fontScale", "(", "1.4", ")", "// .effect(ReflectionBuilder.create().fraction(0.4).build())", ".", "build", "(", ")", ";", "web", ".", "getEngine", "(", ")", ".", "loadContent", "(", "item", ".", "getValue", "(", ")", ")", ";", "VBox", ".", "setVgrow", "(", "web", ",", "Priority", ".", "NEVER", ")", ";", "node", "=", "web", ";", "// StackPaneBuilder.create().children(web).style(\"-fx-border-width:2;-fx-border-color:#000000\").build();", "}", "else", "if", "(", "item", ".", "getImage", "(", ")", "!=", "null", ")", "{", "final", "Image", "image", "=", "Resources", ".", "create", "(", "new", "RelImage", "(", "item", ".", "getImage", "(", ")", ")", ")", ".", "get", "(", ")", ";", "final", "ImageView", "imageViewer", "=", "ImageViewBuilder", ".", "create", "(", ")", ".", "styleClass", "(", "ITEM_CLASS_PREFIX", "+", "item", ".", "getLevel", "(", ")", ")", ".", "image", "(", "image", ")", "// .effect(ReflectionBuilder.create().fraction(0.9).build())", ".", "build", "(", ")", ";", "node", "=", "imageViewer", ";", "}", "else", "{", "final", "Text", "text", "=", "TextBuilder", ".", "create", "(", ")", ".", "styleClass", "(", "ITEM_CLASS_PREFIX", "+", "item", ".", "getLevel", "(", ")", ")", ".", "text", "(", "item", ".", "getValue", "(", ")", "==", "null", "?", "\"\"", ":", "item", ".", "getValue", "(", ")", ")", ".", "build", "(", ")", ";", "node", "=", "text", ";", "}", "if", "(", "item", ".", "getStyle", "(", ")", "!=", "null", ")", "{", "node", ".", "getStyleClass", "(", ")", ".", "add", "(", "item", ".", "getStyle", "(", ")", ")", ";", "}", "if", "(", "item", ".", "getScale", "(", ")", "!=", "1.0", ")", "{", "node", ".", "setScaleX", "(", "item", ".", "getScale", "(", ")", ")", ";", "node", ".", "setScaleY", "(", "item", ".", "getScale", "(", ")", ")", ";", "}", "vbox", ".", "getChildren", "(", ")", ".", "add", "(", "node", ")", ";", "}" ]
Add a slide item by managing level. @param vbox the layout node @param item the slide item to add
[ "Add", "a", "slide", "item", "by", "managing", "level", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/template/AbstractTemplateView.java#L488-L552
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/simple/SimpleMatrix.java
SimpleMatrix.random_DDRM
public static SimpleMatrix random_DDRM(int numRows, int numCols, double minValue, double maxValue, Random rand) { """ <p> Creates a new SimpleMatrix with random elements drawn from a uniform distribution from minValue to maxValue. </p> @see RandomMatrices_DDRM#fillUniform(DMatrixRMaj,java.util.Random) @param numRows The number of rows in the new matrix @param numCols The number of columns in the new matrix @param minValue Lower bound @param maxValue Upper bound @param rand The random number generator that's used to fill the matrix. @return The new random matrix. """ SimpleMatrix ret = new SimpleMatrix(numRows,numCols); RandomMatrices_DDRM.fillUniform((DMatrixRMaj)ret.mat,minValue,maxValue,rand); return ret; }
java
public static SimpleMatrix random_DDRM(int numRows, int numCols, double minValue, double maxValue, Random rand) { SimpleMatrix ret = new SimpleMatrix(numRows,numCols); RandomMatrices_DDRM.fillUniform((DMatrixRMaj)ret.mat,minValue,maxValue,rand); return ret; }
[ "public", "static", "SimpleMatrix", "random_DDRM", "(", "int", "numRows", ",", "int", "numCols", ",", "double", "minValue", ",", "double", "maxValue", ",", "Random", "rand", ")", "{", "SimpleMatrix", "ret", "=", "new", "SimpleMatrix", "(", "numRows", ",", "numCols", ")", ";", "RandomMatrices_DDRM", ".", "fillUniform", "(", "(", "DMatrixRMaj", ")", "ret", ".", "mat", ",", "minValue", ",", "maxValue", ",", "rand", ")", ";", "return", "ret", ";", "}" ]
<p> Creates a new SimpleMatrix with random elements drawn from a uniform distribution from minValue to maxValue. </p> @see RandomMatrices_DDRM#fillUniform(DMatrixRMaj,java.util.Random) @param numRows The number of rows in the new matrix @param numCols The number of columns in the new matrix @param minValue Lower bound @param maxValue Upper bound @param rand The random number generator that's used to fill the matrix. @return The new random matrix.
[ "<p", ">", "Creates", "a", "new", "SimpleMatrix", "with", "random", "elements", "drawn", "from", "a", "uniform", "distribution", "from", "minValue", "to", "maxValue", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleMatrix.java#L290-L294
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.removeEntry
public static void removeEntry(File zip, String path, File destZip) { """ Copies an existing ZIP file and removes entry with a given path. @param zip an existing ZIP file (only read) @param path path of the entry to remove @param destZip new ZIP file created. @since 1.7 """ removeEntries(zip, new String[] { path }, destZip); }
java
public static void removeEntry(File zip, String path, File destZip) { removeEntries(zip, new String[] { path }, destZip); }
[ "public", "static", "void", "removeEntry", "(", "File", "zip", ",", "String", "path", ",", "File", "destZip", ")", "{", "removeEntries", "(", "zip", ",", "new", "String", "[", "]", "{", "path", "}", ",", "destZip", ")", ";", "}" ]
Copies an existing ZIP file and removes entry with a given path. @param zip an existing ZIP file (only read) @param path path of the entry to remove @param destZip new ZIP file created. @since 1.7
[ "Copies", "an", "existing", "ZIP", "file", "and", "removes", "entry", "with", "a", "given", "path", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2270-L2272
casbin/jcasbin
src/main/java/org/casbin/jcasbin/main/Enforcer.java
Enforcer.hasPermissionForUser
public boolean hasPermissionForUser(String user, List<String> permission) { """ hasPermissionForUser determines whether a user has a permission. @param user the user. @param permission the permission, usually be (obj, act). It is actually the rule without the subject. @return whether the user has the permission. """ return hasPermissionForUser(user, permission.toArray(new String[0])); }
java
public boolean hasPermissionForUser(String user, List<String> permission) { return hasPermissionForUser(user, permission.toArray(new String[0])); }
[ "public", "boolean", "hasPermissionForUser", "(", "String", "user", ",", "List", "<", "String", ">", "permission", ")", "{", "return", "hasPermissionForUser", "(", "user", ",", "permission", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ")", ";", "}" ]
hasPermissionForUser determines whether a user has a permission. @param user the user. @param permission the permission, usually be (obj, act). It is actually the rule without the subject. @return whether the user has the permission.
[ "hasPermissionForUser", "determines", "whether", "a", "user", "has", "a", "permission", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L345-L347
Impetus/Kundera
src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/LuceneIndexer.java
LuceneIndexer.indexDocument
public void indexDocument(EntityMetadata metadata, Document document) { """ Indexes document in file system using lucene. @param metadata the metadata @param document the document """ if (log.isDebugEnabled()) { log.debug("Indexing document: {} for in file system using Lucene", document); } IndexWriter w = getIndexWriter(); try { w.addDocument(document); } catch (Exception e) { log.error("Error while indexing document {} into Lucene, Caused by:{} ", document, e); throw new LuceneIndexingException("Error while indexing document " + document + " into Lucene.", e); } }
java
public void indexDocument(EntityMetadata metadata, Document document) { if (log.isDebugEnabled()) { log.debug("Indexing document: {} for in file system using Lucene", document); } IndexWriter w = getIndexWriter(); try { w.addDocument(document); } catch (Exception e) { log.error("Error while indexing document {} into Lucene, Caused by:{} ", document, e); throw new LuceneIndexingException("Error while indexing document " + document + " into Lucene.", e); } }
[ "public", "void", "indexDocument", "(", "EntityMetadata", "metadata", ",", "Document", "document", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Indexing document: {} for in file system using Lucene\"", ",", "document", ")", ";", "}", "IndexWriter", "w", "=", "getIndexWriter", "(", ")", ";", "try", "{", "w", ".", "addDocument", "(", "document", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Error while indexing document {} into Lucene, Caused by:{} \"", ",", "document", ",", "e", ")", ";", "throw", "new", "LuceneIndexingException", "(", "\"Error while indexing document \"", "+", "document", "+", "\" into Lucene.\"", ",", "e", ")", ";", "}", "}" ]
Indexes document in file system using lucene. @param metadata the metadata @param document the document
[ "Indexes", "document", "in", "file", "system", "using", "lucene", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/fallback-impl/src/main/java/com/impetus/kundera/index/LuceneIndexer.java#L471-L488
Stratio/deep-spark
deep-core/src/main/java/com/stratio/deep/core/context/DeepSparkContext.java
DeepSparkContext.textFile
public RDD textFile(ExtractorConfig<Cells> config) throws IllegalArgumentException { """ Returns a Cells RDD from a HDFS or S3 ExtractorConfig. @param config ExtractorConfig for HDFS or S3. @return RDD of Cells. @throws IllegalArgumentException """ if(ExtractorConstants.HDFS.equals(config.getExtractorImplClassName())) { return createHDFSRDD(config); } else if(ExtractorConstants.S3.equals(config.getExtractorImplClassName())) { return createS3RDD(config); } throw new IllegalArgumentException("Valid configurations are HDFS paths, S3 paths or local file paths."); }
java
public RDD textFile(ExtractorConfig<Cells> config) throws IllegalArgumentException { if(ExtractorConstants.HDFS.equals(config.getExtractorImplClassName())) { return createHDFSRDD(config); } else if(ExtractorConstants.S3.equals(config.getExtractorImplClassName())) { return createS3RDD(config); } throw new IllegalArgumentException("Valid configurations are HDFS paths, S3 paths or local file paths."); }
[ "public", "RDD", "textFile", "(", "ExtractorConfig", "<", "Cells", ">", "config", ")", "throws", "IllegalArgumentException", "{", "if", "(", "ExtractorConstants", ".", "HDFS", ".", "equals", "(", "config", ".", "getExtractorImplClassName", "(", ")", ")", ")", "{", "return", "createHDFSRDD", "(", "config", ")", ";", "}", "else", "if", "(", "ExtractorConstants", ".", "S3", ".", "equals", "(", "config", ".", "getExtractorImplClassName", "(", ")", ")", ")", "{", "return", "createS3RDD", "(", "config", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Valid configurations are HDFS paths, S3 paths or local file paths.\"", ")", ";", "}" ]
Returns a Cells RDD from a HDFS or S3 ExtractorConfig. @param config ExtractorConfig for HDFS or S3. @return RDD of Cells. @throws IllegalArgumentException
[ "Returns", "a", "Cells", "RDD", "from", "a", "HDFS", "or", "S3", "ExtractorConfig", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-core/src/main/java/com/stratio/deep/core/context/DeepSparkContext.java#L263-L270
google/closure-compiler
src/com/google/javascript/jscomp/JsMessageVisitor.java
JsMessageVisitor.maybeInitMetaDataFromJsDoc
private static boolean maybeInitMetaDataFromJsDoc(Builder builder, Node node) { """ Initializes the meta data in a message builder given a node that may contain JsDoc properties. @param builder the message builder whose meta data will be initialized @param node the node with the message's JSDoc properties @return true if message has JsDoc with valid description in @desc annotation """ boolean messageHasDesc = false; JSDocInfo info = node.getJSDocInfo(); if (info != null) { String desc = info.getDescription(); if (desc != null) { builder.setDesc(desc); messageHasDesc = true; } if (info.isHidden()) { builder.setIsHidden(true); } if (info.getMeaning() != null) { builder.setMeaning(info.getMeaning()); } } return messageHasDesc; }
java
private static boolean maybeInitMetaDataFromJsDoc(Builder builder, Node node) { boolean messageHasDesc = false; JSDocInfo info = node.getJSDocInfo(); if (info != null) { String desc = info.getDescription(); if (desc != null) { builder.setDesc(desc); messageHasDesc = true; } if (info.isHidden()) { builder.setIsHidden(true); } if (info.getMeaning() != null) { builder.setMeaning(info.getMeaning()); } } return messageHasDesc; }
[ "private", "static", "boolean", "maybeInitMetaDataFromJsDoc", "(", "Builder", "builder", ",", "Node", "node", ")", "{", "boolean", "messageHasDesc", "=", "false", ";", "JSDocInfo", "info", "=", "node", ".", "getJSDocInfo", "(", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "String", "desc", "=", "info", ".", "getDescription", "(", ")", ";", "if", "(", "desc", "!=", "null", ")", "{", "builder", ".", "setDesc", "(", "desc", ")", ";", "messageHasDesc", "=", "true", ";", "}", "if", "(", "info", ".", "isHidden", "(", ")", ")", "{", "builder", ".", "setIsHidden", "(", "true", ")", ";", "}", "if", "(", "info", ".", "getMeaning", "(", ")", "!=", "null", ")", "{", "builder", ".", "setMeaning", "(", "info", ".", "getMeaning", "(", ")", ")", ";", "}", "}", "return", "messageHasDesc", ";", "}" ]
Initializes the meta data in a message builder given a node that may contain JsDoc properties. @param builder the message builder whose meta data will be initialized @param node the node with the message's JSDoc properties @return true if message has JsDoc with valid description in @desc annotation
[ "Initializes", "the", "meta", "data", "in", "a", "message", "builder", "given", "a", "node", "that", "may", "contain", "JsDoc", "properties", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JsMessageVisitor.java#L550-L568
jglobus/JGlobus
gridftp/src/main/java/org/globus/ftp/FTPClient.java
FTPClient.setType
public void setType(int type) throws IOException, ServerException { """ Sets transfer type. @param type should be {@link Session#TYPE_IMAGE TYPE_IMAGE}, {@link Session#TYPE_ASCII TYPE_ASCII}, {@link Session#TYPE_LOCAL TYPE_LOCAL}, {@link Session#TYPE_EBCDIC TYPE_EBCDIC} """ localServer.setTransferType(type); String typeStr = null; switch (type) { case Session.TYPE_IMAGE : typeStr = "I"; break; case Session.TYPE_ASCII : typeStr = "A"; break; case Session.TYPE_LOCAL : typeStr = "E"; break; case Session.TYPE_EBCDIC : typeStr = "L"; break; default : throw new IllegalArgumentException("Bad type: " + type); } Command cmd = new Command("TYPE", typeStr); try { controlChannel.execute(cmd); } catch (FTPReplyParseException rpe) { throw ServerException.embedFTPReplyParseException(rpe); } catch (UnexpectedReplyCodeException urce) { throw ServerException.embedUnexpectedReplyCodeException( urce, "Server refused changing transfer mode"); } this.session.transferType = type; }
java
public void setType(int type) throws IOException, ServerException { localServer.setTransferType(type); String typeStr = null; switch (type) { case Session.TYPE_IMAGE : typeStr = "I"; break; case Session.TYPE_ASCII : typeStr = "A"; break; case Session.TYPE_LOCAL : typeStr = "E"; break; case Session.TYPE_EBCDIC : typeStr = "L"; break; default : throw new IllegalArgumentException("Bad type: " + type); } Command cmd = new Command("TYPE", typeStr); try { controlChannel.execute(cmd); } catch (FTPReplyParseException rpe) { throw ServerException.embedFTPReplyParseException(rpe); } catch (UnexpectedReplyCodeException urce) { throw ServerException.embedUnexpectedReplyCodeException( urce, "Server refused changing transfer mode"); } this.session.transferType = type; }
[ "public", "void", "setType", "(", "int", "type", ")", "throws", "IOException", ",", "ServerException", "{", "localServer", ".", "setTransferType", "(", "type", ")", ";", "String", "typeStr", "=", "null", ";", "switch", "(", "type", ")", "{", "case", "Session", ".", "TYPE_IMAGE", ":", "typeStr", "=", "\"I\"", ";", "break", ";", "case", "Session", ".", "TYPE_ASCII", ":", "typeStr", "=", "\"A\"", ";", "break", ";", "case", "Session", ".", "TYPE_LOCAL", ":", "typeStr", "=", "\"E\"", ";", "break", ";", "case", "Session", ".", "TYPE_EBCDIC", ":", "typeStr", "=", "\"L\"", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Bad type: \"", "+", "type", ")", ";", "}", "Command", "cmd", "=", "new", "Command", "(", "\"TYPE\"", ",", "typeStr", ")", ";", "try", "{", "controlChannel", ".", "execute", "(", "cmd", ")", ";", "}", "catch", "(", "FTPReplyParseException", "rpe", ")", "{", "throw", "ServerException", ".", "embedFTPReplyParseException", "(", "rpe", ")", ";", "}", "catch", "(", "UnexpectedReplyCodeException", "urce", ")", "{", "throw", "ServerException", ".", "embedUnexpectedReplyCodeException", "(", "urce", ",", "\"Server refused changing transfer mode\"", ")", ";", "}", "this", ".", "session", ".", "transferType", "=", "type", ";", "}" ]
Sets transfer type. @param type should be {@link Session#TYPE_IMAGE TYPE_IMAGE}, {@link Session#TYPE_ASCII TYPE_ASCII}, {@link Session#TYPE_LOCAL TYPE_LOCAL}, {@link Session#TYPE_EBCDIC TYPE_EBCDIC}
[ "Sets", "transfer", "type", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L800-L834
WASdev/standards.jsr352.jbatch
com.ibm.jbatch.spi/src/main/java/com/ibm/jbatch/spi/ServiceRegistry.java
ServiceRegistry.getSystemPropertyOverrides
public static Properties getSystemPropertyOverrides() { """ If a system property is found with key equal to: A.B where A is the current classname and B is some constant String defined in ServicePropertyNames, then the value V of this system property will be included in a new property added to the return value Properties object. The return value will include a property with key B and value V. E.g. a system property (key=value) of: (com.ibm.jbatch.spi.ServiceRegistry.TRANSACTION_SERVICE=XXXX) will result in the return value including a property of: (TRANSACTION_SERVICE=XXXX) @return Properties object as defined above. """ final String PROP_PREFIX = sourceClass; Properties props = new Properties(); for (String propName : getAllServicePropertyNames()) { final String key = PROP_PREFIX + "." + propName; final String val = System.getProperty(key); if (val != null) { logger.fine("Found override property from system properties (key,value) = (" + propName + "," + val + ")"); props.setProperty(propName, val); } } return props; }
java
public static Properties getSystemPropertyOverrides() { final String PROP_PREFIX = sourceClass; Properties props = new Properties(); for (String propName : getAllServicePropertyNames()) { final String key = PROP_PREFIX + "." + propName; final String val = System.getProperty(key); if (val != null) { logger.fine("Found override property from system properties (key,value) = (" + propName + "," + val + ")"); props.setProperty(propName, val); } } return props; }
[ "public", "static", "Properties", "getSystemPropertyOverrides", "(", ")", "{", "final", "String", "PROP_PREFIX", "=", "sourceClass", ";", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "for", "(", "String", "propName", ":", "getAllServicePropertyNames", "(", ")", ")", "{", "final", "String", "key", "=", "PROP_PREFIX", "+", "\".\"", "+", "propName", ";", "final", "String", "val", "=", "System", ".", "getProperty", "(", "key", ")", ";", "if", "(", "val", "!=", "null", ")", "{", "logger", ".", "fine", "(", "\"Found override property from system properties (key,value) = (\"", "+", "propName", "+", "\",\"", "+", "val", "+", "\")\"", ")", ";", "props", ".", "setProperty", "(", "propName", ",", "val", ")", ";", "}", "}", "return", "props", ";", "}" ]
If a system property is found with key equal to: A.B where A is the current classname and B is some constant String defined in ServicePropertyNames, then the value V of this system property will be included in a new property added to the return value Properties object. The return value will include a property with key B and value V. E.g. a system property (key=value) of: (com.ibm.jbatch.spi.ServiceRegistry.TRANSACTION_SERVICE=XXXX) will result in the return value including a property of: (TRANSACTION_SERVICE=XXXX) @return Properties object as defined above.
[ "If", "a", "system", "property", "is", "found", "with", "key", "equal", "to", ":", "A", ".", "B", "where", "A", "is", "the", "current", "classname", "and", "B", "is", "some", "constant", "String", "defined", "in", "ServicePropertyNames", "then", "the", "value", "V", "of", "this", "system", "property", "will", "be", "included", "in", "a", "new", "property", "added", "to", "the", "return", "value", "Properties", "object", ".", "The", "return", "value", "will", "include", "a", "property", "with", "key", "B", "and", "value", "V", "." ]
train
https://github.com/WASdev/standards.jsr352.jbatch/blob/e267e79dccd4f0bd4bf9c2abc41a8a47b65be28f/com.ibm.jbatch.spi/src/main/java/com/ibm/jbatch/spi/ServiceRegistry.java#L168-L181
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/util/LogQueryTool.java
LogQueryTool.exceptionWithQuery
public SQLException exceptionWithQuery(ParameterHolder[] parameters, SQLException sqlEx, PrepareResult serverPrepareResult) { """ Return exception with query information's. @param parameters query parameters @param sqlEx current exception @param serverPrepareResult prepare results @return exception with query information """ if (sqlEx.getCause() instanceof SocketTimeoutException) { return new SQLException("Connection timed out", CONNECTION_EXCEPTION.getSqlState(), sqlEx); } if (options.dumpQueriesOnException) { return new SQLException(exWithQuery(sqlEx.getMessage(), serverPrepareResult, parameters), sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getCause()); } return sqlEx; }
java
public SQLException exceptionWithQuery(ParameterHolder[] parameters, SQLException sqlEx, PrepareResult serverPrepareResult) { if (sqlEx.getCause() instanceof SocketTimeoutException) { return new SQLException("Connection timed out", CONNECTION_EXCEPTION.getSqlState(), sqlEx); } if (options.dumpQueriesOnException) { return new SQLException(exWithQuery(sqlEx.getMessage(), serverPrepareResult, parameters), sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getCause()); } return sqlEx; }
[ "public", "SQLException", "exceptionWithQuery", "(", "ParameterHolder", "[", "]", "parameters", ",", "SQLException", "sqlEx", ",", "PrepareResult", "serverPrepareResult", ")", "{", "if", "(", "sqlEx", ".", "getCause", "(", ")", "instanceof", "SocketTimeoutException", ")", "{", "return", "new", "SQLException", "(", "\"Connection timed out\"", ",", "CONNECTION_EXCEPTION", ".", "getSqlState", "(", ")", ",", "sqlEx", ")", ";", "}", "if", "(", "options", ".", "dumpQueriesOnException", ")", "{", "return", "new", "SQLException", "(", "exWithQuery", "(", "sqlEx", ".", "getMessage", "(", ")", ",", "serverPrepareResult", ",", "parameters", ")", ",", "sqlEx", ".", "getSQLState", "(", ")", ",", "sqlEx", ".", "getErrorCode", "(", ")", ",", "sqlEx", ".", "getCause", "(", ")", ")", ";", "}", "return", "sqlEx", ";", "}" ]
Return exception with query information's. @param parameters query parameters @param sqlEx current exception @param serverPrepareResult prepare results @return exception with query information
[ "Return", "exception", "with", "query", "information", "s", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/LogQueryTool.java#L155-L166
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.getCustomFieldOutlineCodeValue
private String getCustomFieldOutlineCodeValue(Var2Data varData, Var2Data outlineCodeVarData, Integer id) { """ Retrieve custom field value. @param varData var data block @param outlineCodeVarData var data block @param id parent item ID @return item value """ String result = null; int uniqueId = id.intValue(); if (uniqueId == 0) { return ""; } CustomFieldValueItem item = m_file.getCustomFields().getCustomFieldValueItemByUniqueID(uniqueId); if (item != null) { Object value = item.getValue(); if (value instanceof String) { result = (String) value; } if (result != null && !NumberHelper.equals(id, item.getParent())) { String result2 = getCustomFieldOutlineCodeValue(varData, outlineCodeVarData, item.getParent()); if (result2 != null && !result2.isEmpty()) { result = result2 + "." + result; } } } return result; }
java
private String getCustomFieldOutlineCodeValue(Var2Data varData, Var2Data outlineCodeVarData, Integer id) { String result = null; int uniqueId = id.intValue(); if (uniqueId == 0) { return ""; } CustomFieldValueItem item = m_file.getCustomFields().getCustomFieldValueItemByUniqueID(uniqueId); if (item != null) { Object value = item.getValue(); if (value instanceof String) { result = (String) value; } if (result != null && !NumberHelper.equals(id, item.getParent())) { String result2 = getCustomFieldOutlineCodeValue(varData, outlineCodeVarData, item.getParent()); if (result2 != null && !result2.isEmpty()) { result = result2 + "." + result; } } } return result; }
[ "private", "String", "getCustomFieldOutlineCodeValue", "(", "Var2Data", "varData", ",", "Var2Data", "outlineCodeVarData", ",", "Integer", "id", ")", "{", "String", "result", "=", "null", ";", "int", "uniqueId", "=", "id", ".", "intValue", "(", ")", ";", "if", "(", "uniqueId", "==", "0", ")", "{", "return", "\"\"", ";", "}", "CustomFieldValueItem", "item", "=", "m_file", ".", "getCustomFields", "(", ")", ".", "getCustomFieldValueItemByUniqueID", "(", "uniqueId", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "Object", "value", "=", "item", ".", "getValue", "(", ")", ";", "if", "(", "value", "instanceof", "String", ")", "{", "result", "=", "(", "String", ")", "value", ";", "}", "if", "(", "result", "!=", "null", "&&", "!", "NumberHelper", ".", "equals", "(", "id", ",", "item", ".", "getParent", "(", ")", ")", ")", "{", "String", "result2", "=", "getCustomFieldOutlineCodeValue", "(", "varData", ",", "outlineCodeVarData", ",", "item", ".", "getParent", "(", ")", ")", ";", "if", "(", "result2", "!=", "null", "&&", "!", "result2", ".", "isEmpty", "(", ")", ")", "{", "result", "=", "result2", "+", "\".\"", "+", "result", ";", "}", "}", "}", "return", "result", ";", "}" ]
Retrieve custom field value. @param varData var data block @param outlineCodeVarData var data block @param id parent item ID @return item value
[ "Retrieve", "custom", "field", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L1999-L2029
springfox/springfox
springfox-core/src/main/java/springfox/documentation/builders/BuilderDefaults.java
BuilderDefaults.defaultIfAbsent
public static <T> T defaultIfAbsent(T newValue, T defaultValue) { """ Returns this default value if the new value is null @param newValue - new value @param defaultValue - default value @param <T> - Represents any type that is nullable @return Coalesces the newValue and defaultValue to return a non-null value """ return ofNullable(newValue) .orElse(ofNullable(defaultValue) .orElse(null)); }
java
public static <T> T defaultIfAbsent(T newValue, T defaultValue) { return ofNullable(newValue) .orElse(ofNullable(defaultValue) .orElse(null)); }
[ "public", "static", "<", "T", ">", "T", "defaultIfAbsent", "(", "T", "newValue", ",", "T", "defaultValue", ")", "{", "return", "ofNullable", "(", "newValue", ")", ".", "orElse", "(", "ofNullable", "(", "defaultValue", ")", ".", "orElse", "(", "null", ")", ")", ";", "}" ]
Returns this default value if the new value is null @param newValue - new value @param defaultValue - default value @param <T> - Represents any type that is nullable @return Coalesces the newValue and defaultValue to return a non-null value
[ "Returns", "this", "default", "value", "if", "the", "new", "value", "is", "null" ]
train
https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-core/src/main/java/springfox/documentation/builders/BuilderDefaults.java#L53-L57
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.deleteStream
public void deleteStream(String domain, String app, String stream) { """ Delete stream in live stream service @param domain The requested domain which the specific stream belongs to @param app The requested app which the specific stream belongs to @param stream The requested stream to delete """ DeleteStreamRequest request = new DeleteStreamRequest() .withDomain(domain) .withApp(app) .withStream(stream); deleteStream(request); }
java
public void deleteStream(String domain, String app, String stream) { DeleteStreamRequest request = new DeleteStreamRequest() .withDomain(domain) .withApp(app) .withStream(stream); deleteStream(request); }
[ "public", "void", "deleteStream", "(", "String", "domain", ",", "String", "app", ",", "String", "stream", ")", "{", "DeleteStreamRequest", "request", "=", "new", "DeleteStreamRequest", "(", ")", ".", "withDomain", "(", "domain", ")", ".", "withApp", "(", "app", ")", ".", "withStream", "(", "stream", ")", ";", "deleteStream", "(", "request", ")", ";", "}" ]
Delete stream in live stream service @param domain The requested domain which the specific stream belongs to @param app The requested app which the specific stream belongs to @param stream The requested stream to delete
[ "Delete", "stream", "in", "live", "stream", "service" ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1588-L1594
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.waitForView
public <T extends View> boolean waitForView(final Class<T> viewClass, final int minimumNumberOfMatches, final int timeout) { """ Waits for a View matching the specified class. @param viewClass the {@link View} class to wait for @param minimumNumberOfMatches the minimum number of matches that are expected to be found. {@code 0} means any number of matches @param timeout the amount of time in milliseconds to wait @return {@code true} if the {@link View} is displayed and {@code false} if it is not displayed before the timeout """ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForView("+viewClass+", "+minimumNumberOfMatches+", "+timeout+")"); } int index = minimumNumberOfMatches-1; if(index < 1) index = 0; return waiter.waitForView(viewClass, index, timeout, true); }
java
public <T extends View> boolean waitForView(final Class<T> viewClass, final int minimumNumberOfMatches, final int timeout){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForView("+viewClass+", "+minimumNumberOfMatches+", "+timeout+")"); } int index = minimumNumberOfMatches-1; if(index < 1) index = 0; return waiter.waitForView(viewClass, index, timeout, true); }
[ "public", "<", "T", "extends", "View", ">", "boolean", "waitForView", "(", "final", "Class", "<", "T", ">", "viewClass", ",", "final", "int", "minimumNumberOfMatches", ",", "final", "int", "timeout", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"waitForView(\"", "+", "viewClass", "+", "\", \"", "+", "minimumNumberOfMatches", "+", "\", \"", "+", "timeout", "+", "\")\"", ")", ";", "}", "int", "index", "=", "minimumNumberOfMatches", "-", "1", ";", "if", "(", "index", "<", "1", ")", "index", "=", "0", ";", "return", "waiter", ".", "waitForView", "(", "viewClass", ",", "index", ",", "timeout", ",", "true", ")", ";", "}" ]
Waits for a View matching the specified class. @param viewClass the {@link View} class to wait for @param minimumNumberOfMatches the minimum number of matches that are expected to be found. {@code 0} means any number of matches @param timeout the amount of time in milliseconds to wait @return {@code true} if the {@link View} is displayed and {@code false} if it is not displayed before the timeout
[ "Waits", "for", "a", "View", "matching", "the", "specified", "class", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L622-L633
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.createMessageReceiverFromEntityPathAsync
public static CompletableFuture<IMessageReceiver> createMessageReceiverFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings, ReceiveMode receiveMode) { """ Asynchronously creates a message receiver to the entity using the client settings @param namespaceEndpointURI endpoint uri of entity namespace @param entityPath path of entity @param clientSettings client settings @param receiveMode PeekLock or ReceiveAndDelete @return a CompletableFuture representing the pending creation of message receiver """ Utils.assertNonNull("namespaceEndpointURI", namespaceEndpointURI); Utils.assertNonNull("entityPath", entityPath); MessageReceiver receiver = new MessageReceiver(namespaceEndpointURI, entityPath, null, clientSettings, receiveMode); return receiver.initializeAsync().thenApply((v) -> receiver); }
java
public static CompletableFuture<IMessageReceiver> createMessageReceiverFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings, ReceiveMode receiveMode) { Utils.assertNonNull("namespaceEndpointURI", namespaceEndpointURI); Utils.assertNonNull("entityPath", entityPath); MessageReceiver receiver = new MessageReceiver(namespaceEndpointURI, entityPath, null, clientSettings, receiveMode); return receiver.initializeAsync().thenApply((v) -> receiver); }
[ "public", "static", "CompletableFuture", "<", "IMessageReceiver", ">", "createMessageReceiverFromEntityPathAsync", "(", "URI", "namespaceEndpointURI", ",", "String", "entityPath", ",", "ClientSettings", "clientSettings", ",", "ReceiveMode", "receiveMode", ")", "{", "Utils", ".", "assertNonNull", "(", "\"namespaceEndpointURI\"", ",", "namespaceEndpointURI", ")", ";", "Utils", ".", "assertNonNull", "(", "\"entityPath\"", ",", "entityPath", ")", ";", "MessageReceiver", "receiver", "=", "new", "MessageReceiver", "(", "namespaceEndpointURI", ",", "entityPath", ",", "null", ",", "clientSettings", ",", "receiveMode", ")", ";", "return", "receiver", ".", "initializeAsync", "(", ")", ".", "thenApply", "(", "(", "v", ")", "-", ">", "receiver", ")", ";", "}" ]
Asynchronously creates a message receiver to the entity using the client settings @param namespaceEndpointURI endpoint uri of entity namespace @param entityPath path of entity @param clientSettings client settings @param receiveMode PeekLock or ReceiveAndDelete @return a CompletableFuture representing the pending creation of message receiver
[ "Asynchronously", "creates", "a", "message", "receiver", "to", "the", "entity", "using", "the", "client", "settings" ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L442-L447
unbescape/unbescape
src/main/java/org/unbescape/html/HtmlEscape.java
HtmlEscape.escapeHtml4
public static void escapeHtml4(final Reader reader, final Writer writer) throws IOException { """ <p> Perform an HTML 4 level 2 (result is ASCII) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt></li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by replacing those chars by the corresponding HTML 4 Named Character References (e.g. <tt>'&amp;acute;'</tt>) when such NCR exists for the replaced character, and replacing by a decimal character reference (e.g. <tt>'&amp;#8345;'</tt>) when there there is no NCR for the replaced character. </p> <p> This method calls {@link #escapeHtml(Reader, Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.html.HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li> <li><tt>level</tt>: {@link org.unbescape.html.HtmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2 """ escapeHtml(reader, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT); }
java
public static void escapeHtml4(final Reader reader, final Writer writer) throws IOException { escapeHtml(reader, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeHtml4", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeHtml", "(", "reader", ",", "writer", ",", "HtmlEscapeType", ".", "HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL", ",", "HtmlEscapeLevel", ".", "LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT", ")", ";", "}" ]
<p> Perform an HTML 4 level 2 (result is ASCII) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt></li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by replacing those chars by the corresponding HTML 4 Named Character References (e.g. <tt>'&amp;acute;'</tt>) when such NCR exists for the replaced character, and replacing by a decimal character reference (e.g. <tt>'&amp;#8345;'</tt>) when there there is no NCR for the replaced character. </p> <p> This method calls {@link #escapeHtml(Reader, Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.html.HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li> <li><tt>level</tt>: {@link org.unbescape.html.HtmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "an", "HTML", "4", "level", "2", "(", "result", "is", "ASCII", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "<em", ">", "Level", "2<", "/", "em", ">", "means", "this", "method", "will", "escape", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "The", "five", "markup", "-", "significant", "characters", ":", "<tt", ">", "&lt", ";", "<", "/", "tt", ">", "<tt", ">", "&gt", ";", "<", "/", "tt", ">", "<tt", ">", "&amp", ";", "<", "/", "tt", ">", "<tt", ">", "&quot", ";", "<", "/", "tt", ">", "and", "<tt", ">", "&#39", ";", "<", "/", "tt", ">", "<", "/", "li", ">", "<li", ">", "All", "non", "ASCII", "characters", ".", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "escape", "will", "be", "performed", "by", "replacing", "those", "chars", "by", "the", "corresponding", "HTML", "4", "Named", "Character", "References", "(", "e", ".", "g", ".", "<tt", ">", "&amp", ";", "acute", ";", "<", "/", "tt", ">", ")", "when", "such", "NCR", "exists", "for", "the", "replaced", "character", "and", "replacing", "by", "a", "decimal", "character", "reference", "(", "e", ".", "g", ".", "<tt", ">", "&amp", ";", "#8345", ";", "<", "/", "tt", ">", ")", "when", "there", "there", "is", "no", "NCR", "for", "the", "replaced", "character", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "calls", "{", "@link", "#escapeHtml", "(", "Reader", "Writer", "HtmlEscapeType", "HtmlEscapeLevel", ")", "}", "with", "the", "following", "preconfigured", "values", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<tt", ">", "type<", "/", "tt", ">", ":", "{", "@link", "org", ".", "unbescape", ".", "html", ".", "HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL", "}", "<", "/", "li", ">", "<li", ">", "<tt", ">", "level<", "/", "tt", ">", ":", "{", "@link", "org", ".", "unbescape", ".", "html", ".", "HtmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT", "}", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L727-L731
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/WriteSegmentRequest.java
WriteSegmentRequest.withTags
public WriteSegmentRequest withTags(java.util.Map<String, String> tags) { """ The Tags for the segments. @param tags The Tags for the segments. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public WriteSegmentRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "WriteSegmentRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
The Tags for the segments. @param tags The Tags for the segments. @return Returns a reference to this object so that method calls can be chained together.
[ "The", "Tags", "for", "the", "segments", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/WriteSegmentRequest.java#L185-L188
Appendium/objectlabkit
datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java
AbstractKitCalculatorsFactory.setHolidays
protected void setHolidays(final String name, final DateCalculator<E> dc) { """ Used by extensions to set holidays in a DateCalculator. @param name holiday name @param dc the date calculator to configure. """ if (name != null) { dc.setHolidayCalendar(holidays.get(name)); } }
java
protected void setHolidays(final String name, final DateCalculator<E> dc) { if (name != null) { dc.setHolidayCalendar(holidays.get(name)); } }
[ "protected", "void", "setHolidays", "(", "final", "String", "name", ",", "final", "DateCalculator", "<", "E", ">", "dc", ")", "{", "if", "(", "name", "!=", "null", ")", "{", "dc", ".", "setHolidayCalendar", "(", "holidays", ".", "get", "(", "name", ")", ")", ";", "}", "}" ]
Used by extensions to set holidays in a DateCalculator. @param name holiday name @param dc the date calculator to configure.
[ "Used", "by", "extensions", "to", "set", "holidays", "in", "a", "DateCalculator", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/AbstractKitCalculatorsFactory.java#L137-L141
alkacon/opencms-core
src/org/opencms/main/OpenCmsCore.java
OpenCmsCore.initCmsObject
private CmsObject initCmsObject(CmsContextInfo contextInfo) throws CmsException { """ Initializes a CmsObject with the given context information.<p> @param contextInfo the information for the CmsObject context to create @return the initialized CmsObject @throws CmsException if something goes wrong """ CmsUser user = contextInfo.getUser(); if (user == null) { user = m_securityManager.readUser(null, contextInfo.getUserName()); } CmsProject project = contextInfo.getProject(); if (project == null) { project = m_securityManager.readProject(contextInfo.getProjectName()); } // first create the request context CmsRequestContext context = new CmsRequestContext( user, project, contextInfo.getRequestedUri(), contextInfo.getRequestMatcher(), contextInfo.getSiteRoot(), contextInfo.isSecureRequest(), contextInfo.getLocale(), contextInfo.getEncoding(), contextInfo.getRemoteAddr(), contextInfo.getRequestTime(), m_resourceManager.getFolderTranslator(), m_resourceManager.getFileTranslator(), contextInfo.getOuFqn()); context.setDetailResource(contextInfo.getDetailResource()); // now initialize and return the CmsObject return new CmsObject(m_securityManager, context); }
java
private CmsObject initCmsObject(CmsContextInfo contextInfo) throws CmsException { CmsUser user = contextInfo.getUser(); if (user == null) { user = m_securityManager.readUser(null, contextInfo.getUserName()); } CmsProject project = contextInfo.getProject(); if (project == null) { project = m_securityManager.readProject(contextInfo.getProjectName()); } // first create the request context CmsRequestContext context = new CmsRequestContext( user, project, contextInfo.getRequestedUri(), contextInfo.getRequestMatcher(), contextInfo.getSiteRoot(), contextInfo.isSecureRequest(), contextInfo.getLocale(), contextInfo.getEncoding(), contextInfo.getRemoteAddr(), contextInfo.getRequestTime(), m_resourceManager.getFolderTranslator(), m_resourceManager.getFileTranslator(), contextInfo.getOuFqn()); context.setDetailResource(contextInfo.getDetailResource()); // now initialize and return the CmsObject return new CmsObject(m_securityManager, context); }
[ "private", "CmsObject", "initCmsObject", "(", "CmsContextInfo", "contextInfo", ")", "throws", "CmsException", "{", "CmsUser", "user", "=", "contextInfo", ".", "getUser", "(", ")", ";", "if", "(", "user", "==", "null", ")", "{", "user", "=", "m_securityManager", ".", "readUser", "(", "null", ",", "contextInfo", ".", "getUserName", "(", ")", ")", ";", "}", "CmsProject", "project", "=", "contextInfo", ".", "getProject", "(", ")", ";", "if", "(", "project", "==", "null", ")", "{", "project", "=", "m_securityManager", ".", "readProject", "(", "contextInfo", ".", "getProjectName", "(", ")", ")", ";", "}", "// first create the request context", "CmsRequestContext", "context", "=", "new", "CmsRequestContext", "(", "user", ",", "project", ",", "contextInfo", ".", "getRequestedUri", "(", ")", ",", "contextInfo", ".", "getRequestMatcher", "(", ")", ",", "contextInfo", ".", "getSiteRoot", "(", ")", ",", "contextInfo", ".", "isSecureRequest", "(", ")", ",", "contextInfo", ".", "getLocale", "(", ")", ",", "contextInfo", ".", "getEncoding", "(", ")", ",", "contextInfo", ".", "getRemoteAddr", "(", ")", ",", "contextInfo", ".", "getRequestTime", "(", ")", ",", "m_resourceManager", ".", "getFolderTranslator", "(", ")", ",", "m_resourceManager", ".", "getFileTranslator", "(", ")", ",", "contextInfo", ".", "getOuFqn", "(", ")", ")", ";", "context", ".", "setDetailResource", "(", "contextInfo", ".", "getDetailResource", "(", ")", ")", ";", "// now initialize and return the CmsObject", "return", "new", "CmsObject", "(", "m_securityManager", ",", "context", ")", ";", "}" ]
Initializes a CmsObject with the given context information.<p> @param contextInfo the information for the CmsObject context to create @return the initialized CmsObject @throws CmsException if something goes wrong
[ "Initializes", "a", "CmsObject", "with", "the", "given", "context", "information", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsCore.java#L2778-L2809
b3dgs/lionengine
lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java
ToolsAwt.applyMask
public static BufferedImage applyMask(BufferedImage image, int rgba) { """ Apply a mask to an existing image. @param image The existing image. @param rgba The rgba color value. @return The masked image. """ final BufferedImage mask = copyImage(image); final int height = mask.getHeight(); final int width = mask.getWidth(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { final int col = mask.getRGB(x, y); final int flag = 0x00_FF_FF_FF; if (col == rgba) { mask.setRGB(x, y, col & flag); } } } return mask; }
java
public static BufferedImage applyMask(BufferedImage image, int rgba) { final BufferedImage mask = copyImage(image); final int height = mask.getHeight(); final int width = mask.getWidth(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { final int col = mask.getRGB(x, y); final int flag = 0x00_FF_FF_FF; if (col == rgba) { mask.setRGB(x, y, col & flag); } } } return mask; }
[ "public", "static", "BufferedImage", "applyMask", "(", "BufferedImage", "image", ",", "int", "rgba", ")", "{", "final", "BufferedImage", "mask", "=", "copyImage", "(", "image", ")", ";", "final", "int", "height", "=", "mask", ".", "getHeight", "(", ")", ";", "final", "int", "width", "=", "mask", ".", "getWidth", "(", ")", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "height", ";", "y", "++", ")", "{", "for", "(", "int", "x", "=", "0", ";", "x", "<", "width", ";", "x", "++", ")", "{", "final", "int", "col", "=", "mask", ".", "getRGB", "(", "x", ",", "y", ")", ";", "final", "int", "flag", "=", "0x00_FF_FF_FF", ";", "if", "(", "col", "==", "rgba", ")", "{", "mask", ".", "setRGB", "(", "x", ",", "y", ",", "col", "&", "flag", ")", ";", "}", "}", "}", "return", "mask", ";", "}" ]
Apply a mask to an existing image. @param image The existing image. @param rgba The rgba color value. @return The masked image.
[ "Apply", "a", "mask", "to", "an", "existing", "image", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java#L188-L207
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.setVpnclientIpsecParametersAsync
public Observable<VpnClientIPsecParametersInner> setVpnclientIpsecParametersAsync(String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams) { """ The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param vpnclientIpsecParams Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network Gateway P2S client operation through Network resource provider. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return setVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams).map(new Func1<ServiceResponse<VpnClientIPsecParametersInner>, VpnClientIPsecParametersInner>() { @Override public VpnClientIPsecParametersInner call(ServiceResponse<VpnClientIPsecParametersInner> response) { return response.body(); } }); }
java
public Observable<VpnClientIPsecParametersInner> setVpnclientIpsecParametersAsync(String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams) { return setVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams).map(new Func1<ServiceResponse<VpnClientIPsecParametersInner>, VpnClientIPsecParametersInner>() { @Override public VpnClientIPsecParametersInner call(ServiceResponse<VpnClientIPsecParametersInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VpnClientIPsecParametersInner", ">", "setVpnclientIpsecParametersAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ",", "VpnClientIPsecParametersInner", "vpnclientIpsecParams", ")", "{", "return", "setVpnclientIpsecParametersWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ",", "vpnclientIpsecParams", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VpnClientIPsecParametersInner", ">", ",", "VpnClientIPsecParametersInner", ">", "(", ")", "{", "@", "Override", "public", "VpnClientIPsecParametersInner", "call", "(", "ServiceResponse", "<", "VpnClientIPsecParametersInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param vpnclientIpsecParams Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network Gateway P2S client operation through Network resource provider. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "The", "Set", "VpnclientIpsecParameters", "operation", "sets", "the", "vpnclient", "ipsec", "policy", "for", "P2S", "client", "of", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "through", "Network", "resource", "provider", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2686-L2693
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java
JNStorage.getSyncLogTemporaryFile
File getSyncLogTemporaryFile(long segmentTxId, long endTxId, long stamp) { """ Get name for temporary file used for log syncing, after a journal node crashed. """ String name = NNStorage.getFinalizedEditsFileName(segmentTxId, endTxId) + ".tmp=" + stamp; return new File(sd.getCurrentDir(), name); }
java
File getSyncLogTemporaryFile(long segmentTxId, long endTxId, long stamp) { String name = NNStorage.getFinalizedEditsFileName(segmentTxId, endTxId) + ".tmp=" + stamp; return new File(sd.getCurrentDir(), name); }
[ "File", "getSyncLogTemporaryFile", "(", "long", "segmentTxId", ",", "long", "endTxId", ",", "long", "stamp", ")", "{", "String", "name", "=", "NNStorage", ".", "getFinalizedEditsFileName", "(", "segmentTxId", ",", "endTxId", ")", "+", "\".tmp=\"", "+", "stamp", ";", "return", "new", "File", "(", "sd", ".", "getCurrentDir", "(", ")", ",", "name", ")", ";", "}" ]
Get name for temporary file used for log syncing, after a journal node crashed.
[ "Get", "name", "for", "temporary", "file", "used", "for", "log", "syncing", "after", "a", "journal", "node", "crashed", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java#L145-L149
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java
AccountHeaderBuilder.setImageOrPlaceholder
private void setImageOrPlaceholder(ImageView iv, ImageHolder imageHolder) { """ small helper method to set an profile image or a placeholder @param iv @param imageHolder """ //cancel previous started image loading processes DrawerImageLoader.getInstance().cancelImage(iv); //set the placeholder iv.setImageDrawable(DrawerImageLoader.getInstance().getImageLoader().placeholder(iv.getContext(), DrawerImageLoader.Tags.PROFILE.name())); //set the real image (probably also the uri) ImageHolder.applyTo(imageHolder, iv, DrawerImageLoader.Tags.PROFILE.name()); }
java
private void setImageOrPlaceholder(ImageView iv, ImageHolder imageHolder) { //cancel previous started image loading processes DrawerImageLoader.getInstance().cancelImage(iv); //set the placeholder iv.setImageDrawable(DrawerImageLoader.getInstance().getImageLoader().placeholder(iv.getContext(), DrawerImageLoader.Tags.PROFILE.name())); //set the real image (probably also the uri) ImageHolder.applyTo(imageHolder, iv, DrawerImageLoader.Tags.PROFILE.name()); }
[ "private", "void", "setImageOrPlaceholder", "(", "ImageView", "iv", ",", "ImageHolder", "imageHolder", ")", "{", "//cancel previous started image loading processes", "DrawerImageLoader", ".", "getInstance", "(", ")", ".", "cancelImage", "(", "iv", ")", ";", "//set the placeholder", "iv", ".", "setImageDrawable", "(", "DrawerImageLoader", ".", "getInstance", "(", ")", ".", "getImageLoader", "(", ")", ".", "placeholder", "(", "iv", ".", "getContext", "(", ")", ",", "DrawerImageLoader", ".", "Tags", ".", "PROFILE", ".", "name", "(", ")", ")", ")", ";", "//set the real image (probably also the uri)", "ImageHolder", ".", "applyTo", "(", "imageHolder", ",", "iv", ",", "DrawerImageLoader", ".", "Tags", ".", "PROFILE", ".", "name", "(", ")", ")", ";", "}" ]
small helper method to set an profile image or a placeholder @param iv @param imageHolder
[ "small", "helper", "method", "to", "set", "an", "profile", "image", "or", "a", "placeholder" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/AccountHeaderBuilder.java#L1182-L1189
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/EmbeddedNeo4jDialect.java
EmbeddedNeo4jDialect.applyProperties
private void applyProperties(AssociationKey associationKey, Tuple associationRow, Relationship relationship) { """ The only properties added to a relationship are the columns representing the index of the association. """ String[] indexColumns = associationKey.getMetadata().getRowKeyIndexColumnNames(); for ( int i = 0; i < indexColumns.length; i++ ) { String propertyName = indexColumns[i]; Object propertyValue = associationRow.get( propertyName ); relationship.setProperty( propertyName, propertyValue ); } }
java
private void applyProperties(AssociationKey associationKey, Tuple associationRow, Relationship relationship) { String[] indexColumns = associationKey.getMetadata().getRowKeyIndexColumnNames(); for ( int i = 0; i < indexColumns.length; i++ ) { String propertyName = indexColumns[i]; Object propertyValue = associationRow.get( propertyName ); relationship.setProperty( propertyName, propertyValue ); } }
[ "private", "void", "applyProperties", "(", "AssociationKey", "associationKey", ",", "Tuple", "associationRow", ",", "Relationship", "relationship", ")", "{", "String", "[", "]", "indexColumns", "=", "associationKey", ".", "getMetadata", "(", ")", ".", "getRowKeyIndexColumnNames", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "indexColumns", ".", "length", ";", "i", "++", ")", "{", "String", "propertyName", "=", "indexColumns", "[", "i", "]", ";", "Object", "propertyValue", "=", "associationRow", ".", "get", "(", "propertyName", ")", ";", "relationship", ".", "setProperty", "(", "propertyName", ",", "propertyValue", ")", ";", "}", "}" ]
The only properties added to a relationship are the columns representing the index of the association.
[ "The", "only", "properties", "added", "to", "a", "relationship", "are", "the", "columns", "representing", "the", "index", "of", "the", "association", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/EmbeddedNeo4jDialect.java#L276-L283
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java
AbstractSequenceClassifier.loadClassifier
public void loadClassifier(String loadPath, Properties props) throws ClassCastException, IOException, ClassNotFoundException { """ Loads a classifier from the file specified by loadPath. If loadPath ends in .gz, uses a GZIPInputStream, else uses a regular FileInputStream. """ InputStream is; // ms, 10-04-2010: check first is this path exists in our CLASSPATH. This // takes priority over the file system. if ((is = loadStreamFromClasspath(loadPath)) != null) { Timing.startDoing("Loading classifier from " + loadPath); loadClassifier(is); is.close(); Timing.endDoing(); } else { loadClassifier(new File(loadPath), props); } }
java
public void loadClassifier(String loadPath, Properties props) throws ClassCastException, IOException, ClassNotFoundException { InputStream is; // ms, 10-04-2010: check first is this path exists in our CLASSPATH. This // takes priority over the file system. if ((is = loadStreamFromClasspath(loadPath)) != null) { Timing.startDoing("Loading classifier from " + loadPath); loadClassifier(is); is.close(); Timing.endDoing(); } else { loadClassifier(new File(loadPath), props); } }
[ "public", "void", "loadClassifier", "(", "String", "loadPath", ",", "Properties", "props", ")", "throws", "ClassCastException", ",", "IOException", ",", "ClassNotFoundException", "{", "InputStream", "is", ";", "// ms, 10-04-2010: check first is this path exists in our CLASSPATH. This\r", "// takes priority over the file system.\r", "if", "(", "(", "is", "=", "loadStreamFromClasspath", "(", "loadPath", ")", ")", "!=", "null", ")", "{", "Timing", ".", "startDoing", "(", "\"Loading classifier from \"", "+", "loadPath", ")", ";", "loadClassifier", "(", "is", ")", ";", "is", ".", "close", "(", ")", ";", "Timing", ".", "endDoing", "(", ")", ";", "}", "else", "{", "loadClassifier", "(", "new", "File", "(", "loadPath", ")", ",", "props", ")", ";", "}", "}" ]
Loads a classifier from the file specified by loadPath. If loadPath ends in .gz, uses a GZIPInputStream, else uses a regular FileInputStream.
[ "Loads", "a", "classifier", "from", "the", "file", "specified", "by", "loadPath", ".", "If", "loadPath", "ends", "in", ".", "gz", "uses", "a", "GZIPInputStream", "else", "uses", "a", "regular", "FileInputStream", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java#L1591-L1603
alkacon/opencms-core
src/org/opencms/cache/CmsVfsMemoryObjectCache.java
CmsVfsMemoryObjectCache.getCachedObject
public Object getCachedObject(CmsObject cms, String rootPath) { """ Return an object from the cache.<p> @param cms the current users OpenCms context @param rootPath the rootPath of the VFS resource to get the object for @return object form cache or null """ String key = getCacheKeyForCurrentProject(cms, rootPath); return OpenCms.getMemoryMonitor().getCachedVfsObject(key); }
java
public Object getCachedObject(CmsObject cms, String rootPath) { String key = getCacheKeyForCurrentProject(cms, rootPath); return OpenCms.getMemoryMonitor().getCachedVfsObject(key); }
[ "public", "Object", "getCachedObject", "(", "CmsObject", "cms", ",", "String", "rootPath", ")", "{", "String", "key", "=", "getCacheKeyForCurrentProject", "(", "cms", ",", "rootPath", ")", ";", "return", "OpenCms", ".", "getMemoryMonitor", "(", ")", ".", "getCachedVfsObject", "(", "key", ")", ";", "}" ]
Return an object from the cache.<p> @param cms the current users OpenCms context @param rootPath the rootPath of the VFS resource to get the object for @return object form cache or null
[ "Return", "an", "object", "from", "the", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsVfsMemoryObjectCache.java#L90-L94
openbase/jul
schedule/src/main/java/org/openbase/jul/schedule/AbstractSynchronizationFuture.java
AbstractSynchronizationFuture.get
@Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { """ {@inheritDoc} @param timeout {@inheritDoc} @param unit {@inheritDoc} @return {@inheritDoc} @throws InterruptedException {@inheritDoc} @throws ExecutionException {@inheritDoc} @throws TimeoutException {@inheritDoc} """ // when get returns without an exception the synchronisation is complete // and else the exception will be thrown if (isInitialized()) { synchronisationFuture.get(timeout, unit); } return internalFuture.get(timeout, unit); }
java
@Override public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { // when get returns without an exception the synchronisation is complete // and else the exception will be thrown if (isInitialized()) { synchronisationFuture.get(timeout, unit); } return internalFuture.get(timeout, unit); }
[ "@", "Override", "public", "T", "get", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", ",", "ExecutionException", ",", "TimeoutException", "{", "// when get returns without an exception the synchronisation is complete", "// and else the exception will be thrown", "if", "(", "isInitialized", "(", ")", ")", "{", "synchronisationFuture", ".", "get", "(", "timeout", ",", "unit", ")", ";", "}", "return", "internalFuture", ".", "get", "(", "timeout", ",", "unit", ")", ";", "}" ]
{@inheritDoc} @param timeout {@inheritDoc} @param unit {@inheritDoc} @return {@inheritDoc} @throws InterruptedException {@inheritDoc} @throws ExecutionException {@inheritDoc} @throws TimeoutException {@inheritDoc}
[ "{" ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/schedule/src/main/java/org/openbase/jul/schedule/AbstractSynchronizationFuture.java#L188-L196
derari/cthul
strings/src/main/java/org/cthul/strings/JavaNames.java
JavaNames.camelCase
public static StringBuilder camelCase(final StringBuilder target, boolean firstToLower, final String... tokens) { """ Appends {@code tokens} to {@code target} in CamelCase format. @param tokens parts of the word @param target string builder the word is appended to @param firstToLower if true, the first character will be in lowercase """ for (String t: tokens) { if (firstToLower) { firstToLower = false; target.append(t.toLowerCase()); } else { appendFirstToUpper(target, t); } } return target; }
java
public static StringBuilder camelCase(final StringBuilder target, boolean firstToLower, final String... tokens) { for (String t: tokens) { if (firstToLower) { firstToLower = false; target.append(t.toLowerCase()); } else { appendFirstToUpper(target, t); } } return target; }
[ "public", "static", "StringBuilder", "camelCase", "(", "final", "StringBuilder", "target", ",", "boolean", "firstToLower", ",", "final", "String", "...", "tokens", ")", "{", "for", "(", "String", "t", ":", "tokens", ")", "{", "if", "(", "firstToLower", ")", "{", "firstToLower", "=", "false", ";", "target", ".", "append", "(", "t", ".", "toLowerCase", "(", ")", ")", ";", "}", "else", "{", "appendFirstToUpper", "(", "target", ",", "t", ")", ";", "}", "}", "return", "target", ";", "}" ]
Appends {@code tokens} to {@code target} in CamelCase format. @param tokens parts of the word @param target string builder the word is appended to @param firstToLower if true, the first character will be in lowercase
[ "Appends", "{" ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/strings/src/main/java/org/cthul/strings/JavaNames.java#L140-L150
alkacon/opencms-core
src/org/opencms/configuration/CmsConfigurationManager.java
CmsConfigurationManager.loadXmlConfiguration
public void loadXmlConfiguration() throws SAXException, IOException { """ Loads the OpenCms configuration from the given XML file.<p> @throws SAXException in case of XML parse errors @throws IOException in case of file IO errors """ URL baseUrl = m_baseFolder.toURI().toURL(); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_BASE_URL_1, baseUrl)); } // first load the base configuration loadXmlConfiguration(baseUrl, this); // now iterate all sub-configurations Iterator<I_CmsXmlConfiguration> i = m_configurations.iterator(); while (i.hasNext()) { loadXmlConfiguration(baseUrl, i.next()); } // remove the old backups removeOldBackups(MAX_BACKUP_DAYS); }
java
public void loadXmlConfiguration() throws SAXException, IOException { URL baseUrl = m_baseFolder.toURI().toURL(); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_BASE_URL_1, baseUrl)); } // first load the base configuration loadXmlConfiguration(baseUrl, this); // now iterate all sub-configurations Iterator<I_CmsXmlConfiguration> i = m_configurations.iterator(); while (i.hasNext()) { loadXmlConfiguration(baseUrl, i.next()); } // remove the old backups removeOldBackups(MAX_BACKUP_DAYS); }
[ "public", "void", "loadXmlConfiguration", "(", ")", "throws", "SAXException", ",", "IOException", "{", "URL", "baseUrl", "=", "m_baseFolder", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_BASE_URL_1", ",", "baseUrl", ")", ")", ";", "}", "// first load the base configuration", "loadXmlConfiguration", "(", "baseUrl", ",", "this", ")", ";", "// now iterate all sub-configurations", "Iterator", "<", "I_CmsXmlConfiguration", ">", "i", "=", "m_configurations", ".", "iterator", "(", ")", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "loadXmlConfiguration", "(", "baseUrl", ",", "i", ".", "next", "(", ")", ")", ";", "}", "// remove the old backups", "removeOldBackups", "(", "MAX_BACKUP_DAYS", ")", ";", "}" ]
Loads the OpenCms configuration from the given XML file.<p> @throws SAXException in case of XML parse errors @throws IOException in case of file IO errors
[ "Loads", "the", "OpenCms", "configuration", "from", "the", "given", "XML", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsConfigurationManager.java#L352-L370
threerings/narya
core/src/main/java/com/threerings/crowd/server/PlaceRegistry.java
PlaceRegistry.createPlace
public PlaceManager createPlace (PlaceConfig config, PreStartupHook hook) throws InstantiationException, InvocationException { """ Don't use this method, see {@link #createPlace(PlaceConfig)}. @param hook an optional pre-startup hook that allows a place manager to be configured prior to having {@link PlaceManager#startup} called. This mainly exists because it used to be possible to do such things. Try not to use this in new code. """ return createPlace(config, null, hook); }
java
public PlaceManager createPlace (PlaceConfig config, PreStartupHook hook) throws InstantiationException, InvocationException { return createPlace(config, null, hook); }
[ "public", "PlaceManager", "createPlace", "(", "PlaceConfig", "config", ",", "PreStartupHook", "hook", ")", "throws", "InstantiationException", ",", "InvocationException", "{", "return", "createPlace", "(", "config", ",", "null", ",", "hook", ")", ";", "}" ]
Don't use this method, see {@link #createPlace(PlaceConfig)}. @param hook an optional pre-startup hook that allows a place manager to be configured prior to having {@link PlaceManager#startup} called. This mainly exists because it used to be possible to do such things. Try not to use this in new code.
[ "Don", "t", "use", "this", "method", "see", "{", "@link", "#createPlace", "(", "PlaceConfig", ")", "}", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/server/PlaceRegistry.java#L122-L126
resilience4j/resilience4j
resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/CircuitBreakerExports.java
CircuitBreakerExports.ofSupplier
public static CircuitBreakerExports ofSupplier(String prefix, Supplier<Iterable<CircuitBreaker>> circuitBreakersSupplier) { """ Creates a new instance of {@link CircuitBreakerExports} with specified metrics names prefix and {@link Supplier} of circuit breakers @param prefix the prefix of metrics names @param circuitBreakersSupplier the supplier of circuit breakers """ return new CircuitBreakerExports(prefix, circuitBreakersSupplier); }
java
public static CircuitBreakerExports ofSupplier(String prefix, Supplier<Iterable<CircuitBreaker>> circuitBreakersSupplier) { return new CircuitBreakerExports(prefix, circuitBreakersSupplier); }
[ "public", "static", "CircuitBreakerExports", "ofSupplier", "(", "String", "prefix", ",", "Supplier", "<", "Iterable", "<", "CircuitBreaker", ">", ">", "circuitBreakersSupplier", ")", "{", "return", "new", "CircuitBreakerExports", "(", "prefix", ",", "circuitBreakersSupplier", ")", ";", "}" ]
Creates a new instance of {@link CircuitBreakerExports} with specified metrics names prefix and {@link Supplier} of circuit breakers @param prefix the prefix of metrics names @param circuitBreakersSupplier the supplier of circuit breakers
[ "Creates", "a", "new", "instance", "of", "{", "@link", "CircuitBreakerExports", "}", "with", "specified", "metrics", "names", "prefix", "and", "{", "@link", "Supplier", "}", "of", "circuit", "breakers" ]
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-prometheus/src/main/java/io/github/resilience4j/prometheus/CircuitBreakerExports.java#L61-L63
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/HFClient.java
HFClient.deSerializeChannel
public Channel deSerializeChannel(byte[] channelBytes) throws IOException, ClassNotFoundException, InvalidArgumentException { """ Deserialize a channel serialized by {@link Channel#serializeChannel()} @param channelBytes bytes to be deserialized. @return A Channel that has not been initialized. @throws IOException @throws ClassNotFoundException @throws InvalidArgumentException """ Channel channel; ObjectInputStream in = null; try { in = new ObjectInputStream(new ByteArrayInputStream(channelBytes)); channel = (Channel) in.readObject(); final String name = channel.getName(); synchronized (channels) { if (null != getChannel(name)) { channel.shutdown(true); throw new InvalidArgumentException(format("Channel %s already exists in the client", name)); } channels.put(name, channel); channel.client = this; } } finally { try { if (in != null) { in.close(); } } catch (IOException e) { // Best effort here. logger.error(e); } } return channel; }
java
public Channel deSerializeChannel(byte[] channelBytes) throws IOException, ClassNotFoundException, InvalidArgumentException { Channel channel; ObjectInputStream in = null; try { in = new ObjectInputStream(new ByteArrayInputStream(channelBytes)); channel = (Channel) in.readObject(); final String name = channel.getName(); synchronized (channels) { if (null != getChannel(name)) { channel.shutdown(true); throw new InvalidArgumentException(format("Channel %s already exists in the client", name)); } channels.put(name, channel); channel.client = this; } } finally { try { if (in != null) { in.close(); } } catch (IOException e) { // Best effort here. logger.error(e); } } return channel; }
[ "public", "Channel", "deSerializeChannel", "(", "byte", "[", "]", "channelBytes", ")", "throws", "IOException", ",", "ClassNotFoundException", ",", "InvalidArgumentException", "{", "Channel", "channel", ";", "ObjectInputStream", "in", "=", "null", ";", "try", "{", "in", "=", "new", "ObjectInputStream", "(", "new", "ByteArrayInputStream", "(", "channelBytes", ")", ")", ";", "channel", "=", "(", "Channel", ")", "in", ".", "readObject", "(", ")", ";", "final", "String", "name", "=", "channel", ".", "getName", "(", ")", ";", "synchronized", "(", "channels", ")", "{", "if", "(", "null", "!=", "getChannel", "(", "name", ")", ")", "{", "channel", ".", "shutdown", "(", "true", ")", ";", "throw", "new", "InvalidArgumentException", "(", "format", "(", "\"Channel %s already exists in the client\"", ",", "name", ")", ")", ";", "}", "channels", ".", "put", "(", "name", ",", "channel", ")", ";", "channel", ".", "client", "=", "this", ";", "}", "}", "finally", "{", "try", "{", "if", "(", "in", "!=", "null", ")", "{", "in", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "// Best effort here.", "logger", ".", "error", "(", "e", ")", ";", "}", "}", "return", "channel", ";", "}" ]
Deserialize a channel serialized by {@link Channel#serializeChannel()} @param channelBytes bytes to be deserialized. @return A Channel that has not been initialized. @throws IOException @throws ClassNotFoundException @throws InvalidArgumentException
[ "Deserialize", "a", "channel", "serialized", "by", "{", "@link", "Channel#serializeChannel", "()", "}" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/HFClient.java#L319-L350
mojgh/JKeyLockManager
src/main/java/de/jkeylockmanager/manager/implementation/lockstripe/CountingLock.java
CountingLock.tryLock
void tryLock() { """ Decorates {@link ReentrantLock#tryLock(long, TimeUnit)}. @throws KeyLockManagerInterruptedException if the current thread becomes interrupted while waiting for the lock @throws KeyLockManagerTimeoutException if the instance wide waiting time is exceeded """ try { if (!delegate.tryLock(lockTimeout, lockTimeoutUnit)) { throw new KeyLockManagerTimeoutException(lockTimeout, lockTimeoutUnit); } } catch (final InterruptedException e) { throw new KeyLockManagerInterruptedException(); } }
java
void tryLock() { try { if (!delegate.tryLock(lockTimeout, lockTimeoutUnit)) { throw new KeyLockManagerTimeoutException(lockTimeout, lockTimeoutUnit); } } catch (final InterruptedException e) { throw new KeyLockManagerInterruptedException(); } }
[ "void", "tryLock", "(", ")", "{", "try", "{", "if", "(", "!", "delegate", ".", "tryLock", "(", "lockTimeout", ",", "lockTimeoutUnit", ")", ")", "{", "throw", "new", "KeyLockManagerTimeoutException", "(", "lockTimeout", ",", "lockTimeoutUnit", ")", ";", "}", "}", "catch", "(", "final", "InterruptedException", "e", ")", "{", "throw", "new", "KeyLockManagerInterruptedException", "(", ")", ";", "}", "}" ]
Decorates {@link ReentrantLock#tryLock(long, TimeUnit)}. @throws KeyLockManagerInterruptedException if the current thread becomes interrupted while waiting for the lock @throws KeyLockManagerTimeoutException if the instance wide waiting time is exceeded
[ "Decorates", "{", "@link", "ReentrantLock#tryLock", "(", "long", "TimeUnit", ")", "}", "." ]
train
https://github.com/mojgh/JKeyLockManager/blob/7b69d27f3cde0224a599d6a43ea9d4f1d016d5f1/src/main/java/de/jkeylockmanager/manager/implementation/lockstripe/CountingLock.java#L106-L114
cryptomator/cryptofs
src/main/java/org/cryptomator/cryptofs/CryptoFileSystemProvider.java
CryptoFileSystemProvider.changePassphrase
public static void changePassphrase(Path pathToVault, String masterkeyFilename, CharSequence oldPassphrase, CharSequence newPassphrase) throws InvalidPassphraseException, FileSystemNeedsMigrationException, IOException { """ Changes the passphrase of a vault at the given path. @param pathToVault Vault directory @param masterkeyFilename Name of the masterkey file @param oldPassphrase Current passphrase @param newPassphrase Future passphrase @throws InvalidPassphraseException If <code>oldPassphrase</code> can not be used to unlock the vault. @throws FileSystemNeedsMigrationException if the vault format needs to get updated. @throws IOException If the masterkey could not be read or written. @see #changePassphrase(Path, String, byte[], CharSequence, CharSequence) @since 1.1.0 """ changePassphrase(pathToVault, masterkeyFilename, new byte[0], oldPassphrase, newPassphrase); }
java
public static void changePassphrase(Path pathToVault, String masterkeyFilename, CharSequence oldPassphrase, CharSequence newPassphrase) throws InvalidPassphraseException, FileSystemNeedsMigrationException, IOException { changePassphrase(pathToVault, masterkeyFilename, new byte[0], oldPassphrase, newPassphrase); }
[ "public", "static", "void", "changePassphrase", "(", "Path", "pathToVault", ",", "String", "masterkeyFilename", ",", "CharSequence", "oldPassphrase", ",", "CharSequence", "newPassphrase", ")", "throws", "InvalidPassphraseException", ",", "FileSystemNeedsMigrationException", ",", "IOException", "{", "changePassphrase", "(", "pathToVault", ",", "masterkeyFilename", ",", "new", "byte", "[", "0", "]", ",", "oldPassphrase", ",", "newPassphrase", ")", ";", "}" ]
Changes the passphrase of a vault at the given path. @param pathToVault Vault directory @param masterkeyFilename Name of the masterkey file @param oldPassphrase Current passphrase @param newPassphrase Future passphrase @throws InvalidPassphraseException If <code>oldPassphrase</code> can not be used to unlock the vault. @throws FileSystemNeedsMigrationException if the vault format needs to get updated. @throws IOException If the masterkey could not be read or written. @see #changePassphrase(Path, String, byte[], CharSequence, CharSequence) @since 1.1.0
[ "Changes", "the", "passphrase", "of", "a", "vault", "at", "the", "given", "path", "." ]
train
https://github.com/cryptomator/cryptofs/blob/67fc1a4950dd1c150cd2e2c75bcabbeb7c9ac82e/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemProvider.java#L202-L205
rsocket/rsocket-java
rsocket-transport-netty/src/main/java/io/rsocket/transport/netty/UriUtils.java
UriUtils.getPort
public static int getPort(URI uri, int defaultPort) { """ Returns the port of a URI. If the port is unset (i.e. {@code -1}) then returns the {@code defaultPort}. @param uri the URI to extract the port from @param defaultPort the default to use if the port is unset @return the port of a URI or {@code defaultPort} if unset @throws NullPointerException if {@code uri} is {@code null} """ Objects.requireNonNull(uri, "uri must not be null"); return uri.getPort() == -1 ? defaultPort : uri.getPort(); }
java
public static int getPort(URI uri, int defaultPort) { Objects.requireNonNull(uri, "uri must not be null"); return uri.getPort() == -1 ? defaultPort : uri.getPort(); }
[ "public", "static", "int", "getPort", "(", "URI", "uri", ",", "int", "defaultPort", ")", "{", "Objects", ".", "requireNonNull", "(", "uri", ",", "\"uri must not be null\"", ")", ";", "return", "uri", ".", "getPort", "(", ")", "==", "-", "1", "?", "defaultPort", ":", "uri", ".", "getPort", "(", ")", ";", "}" ]
Returns the port of a URI. If the port is unset (i.e. {@code -1}) then returns the {@code defaultPort}. @param uri the URI to extract the port from @param defaultPort the default to use if the port is unset @return the port of a URI or {@code defaultPort} if unset @throws NullPointerException if {@code uri} is {@code null}
[ "Returns", "the", "port", "of", "a", "URI", ".", "If", "the", "port", "is", "unset", "(", "i", ".", "e", ".", "{", "@code", "-", "1", "}", ")", "then", "returns", "the", "{", "@code", "defaultPort", "}", "." ]
train
https://github.com/rsocket/rsocket-java/blob/5101748fbd224ec86570351cebd24d079b63fbfc/rsocket-transport-netty/src/main/java/io/rsocket/transport/netty/UriUtils.java#L36-L39
lamydev/Android-Notification
core/src/zemin/notification/NotificationBoardCallback.java
NotificationBoardCallback.makeRowView
public View makeRowView(NotificationBoard board, NotificationEntry entry, LayoutInflater inflater) { """ Called to instantiate a view being placed in the row view, which is the user interface for the incoming notification. @param board @param entry @param inflater @return View """ return inflater.inflate(R.layout.notification_board_row, null, false); }
java
public View makeRowView(NotificationBoard board, NotificationEntry entry, LayoutInflater inflater) { return inflater.inflate(R.layout.notification_board_row, null, false); }
[ "public", "View", "makeRowView", "(", "NotificationBoard", "board", ",", "NotificationEntry", "entry", ",", "LayoutInflater", "inflater", ")", "{", "return", "inflater", ".", "inflate", "(", "R", ".", "layout", ".", "notification_board_row", ",", "null", ",", "false", ")", ";", "}" ]
Called to instantiate a view being placed in the row view, which is the user interface for the incoming notification. @param board @param entry @param inflater @return View
[ "Called", "to", "instantiate", "a", "view", "being", "placed", "in", "the", "row", "view", "which", "is", "the", "user", "interface", "for", "the", "incoming", "notification", "." ]
train
https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationBoardCallback.java#L101-L104
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Vector2dfx.java
Vector2dfx.lengthSquaredProperty
public ReadOnlyDoubleProperty lengthSquaredProperty() { """ Replies the property that represents the length of the vector. @return the length property """ if (this.lengthSquareProperty == null) { this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED); this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() -> Vector2dfx.this.x.doubleValue() * Vector2dfx.this.x.doubleValue() + Vector2dfx.this.y.doubleValue() * Vector2dfx.this.y.doubleValue(), this.x, this.y)); } return this.lengthSquareProperty.getReadOnlyProperty(); }
java
public ReadOnlyDoubleProperty lengthSquaredProperty() { if (this.lengthSquareProperty == null) { this.lengthSquareProperty = new ReadOnlyDoubleWrapper(this, MathFXAttributeNames.LENGTH_SQUARED); this.lengthSquareProperty.bind(Bindings.createDoubleBinding(() -> Vector2dfx.this.x.doubleValue() * Vector2dfx.this.x.doubleValue() + Vector2dfx.this.y.doubleValue() * Vector2dfx.this.y.doubleValue(), this.x, this.y)); } return this.lengthSquareProperty.getReadOnlyProperty(); }
[ "public", "ReadOnlyDoubleProperty", "lengthSquaredProperty", "(", ")", "{", "if", "(", "this", ".", "lengthSquareProperty", "==", "null", ")", "{", "this", ".", "lengthSquareProperty", "=", "new", "ReadOnlyDoubleWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "LENGTH_SQUARED", ")", ";", "this", ".", "lengthSquareProperty", ".", "bind", "(", "Bindings", ".", "createDoubleBinding", "(", "(", ")", "->", "Vector2dfx", ".", "this", ".", "x", ".", "doubleValue", "(", ")", "*", "Vector2dfx", ".", "this", ".", "x", ".", "doubleValue", "(", ")", "+", "Vector2dfx", ".", "this", ".", "y", ".", "doubleValue", "(", ")", "*", "Vector2dfx", ".", "this", ".", "y", ".", "doubleValue", "(", ")", ",", "this", ".", "x", ",", "this", ".", "y", ")", ")", ";", "}", "return", "this", ".", "lengthSquareProperty", ".", "getReadOnlyProperty", "(", ")", ";", "}" ]
Replies the property that represents the length of the vector. @return the length property
[ "Replies", "the", "property", "that", "represents", "the", "length", "of", "the", "vector", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Vector2dfx.java#L188-L196
drallgood/jpasskit
jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java
PKSigningInformationUtil.loadSigningInformation
public PKSigningInformation loadSigningInformation(final String keyStoreFilePath, final String keyStorePassword, final String appleWWDRCAFilePath) throws PKSigningException { """ Load all signing information necessary for pass generation from the filesystem or classpath. @param keyStoreFilePath path to keystore (classpath or filesystem) @param keyStorePassword Password used to access the key store @param appleWWDRCAFilePath path to apple's WWDRCA certificate file (classpath or filesystem) @return a {@link PKSigningInformation} object filled with all certificates from the provided files @throws PKSigningException """ try { return loadSigningInformationFromPKCS12AndIntermediateCertificate(keyStoreFilePath, keyStorePassword, appleWWDRCAFilePath); } catch (IOException | CertificateException e) { throw new PKSigningException("Failed to load signing information", e); } }
java
public PKSigningInformation loadSigningInformation(final String keyStoreFilePath, final String keyStorePassword, final String appleWWDRCAFilePath) throws PKSigningException { try { return loadSigningInformationFromPKCS12AndIntermediateCertificate(keyStoreFilePath, keyStorePassword, appleWWDRCAFilePath); } catch (IOException | CertificateException e) { throw new PKSigningException("Failed to load signing information", e); } }
[ "public", "PKSigningInformation", "loadSigningInformation", "(", "final", "String", "keyStoreFilePath", ",", "final", "String", "keyStorePassword", ",", "final", "String", "appleWWDRCAFilePath", ")", "throws", "PKSigningException", "{", "try", "{", "return", "loadSigningInformationFromPKCS12AndIntermediateCertificate", "(", "keyStoreFilePath", ",", "keyStorePassword", ",", "appleWWDRCAFilePath", ")", ";", "}", "catch", "(", "IOException", "|", "CertificateException", "e", ")", "{", "throw", "new", "PKSigningException", "(", "\"Failed to load signing information\"", ",", "e", ")", ";", "}", "}" ]
Load all signing information necessary for pass generation from the filesystem or classpath. @param keyStoreFilePath path to keystore (classpath or filesystem) @param keyStorePassword Password used to access the key store @param appleWWDRCAFilePath path to apple's WWDRCA certificate file (classpath or filesystem) @return a {@link PKSigningInformation} object filled with all certificates from the provided files @throws PKSigningException
[ "Load", "all", "signing", "information", "necessary", "for", "pass", "generation", "from", "the", "filesystem", "or", "classpath", "." ]
train
https://github.com/drallgood/jpasskit/blob/63bfa8abbdb85c2d7596c60eed41ed8e374cbd01/jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java#L43-L51
apereo/cas
core/cas-server-core/src/main/java/org/apereo/cas/AbstractCentralAuthenticationService.java
AbstractCentralAuthenticationService.verifyTicketState
@Synchronized protected void verifyTicketState(final Ticket ticket, final String id, final Class clazz) { """ Validate ticket expiration policy and throws exception if ticket is no longer valid. Expired tickets are also deleted from the registry immediately on demand. @param ticket the ticket @param id the original id @param clazz the clazz """ if (ticket == null) { LOGGER.debug("Ticket [{}] by type [{}] cannot be found in the ticket registry.", id, clazz != null ? clazz.getSimpleName() : "unspecified"); throw new InvalidTicketException(id); } if (ticket.isExpired()) { deleteTicket(id); LOGGER.debug("Ticket [{}] has expired and is now deleted from the ticket registry.", ticket); throw new InvalidTicketException(id); } }
java
@Synchronized protected void verifyTicketState(final Ticket ticket, final String id, final Class clazz) { if (ticket == null) { LOGGER.debug("Ticket [{}] by type [{}] cannot be found in the ticket registry.", id, clazz != null ? clazz.getSimpleName() : "unspecified"); throw new InvalidTicketException(id); } if (ticket.isExpired()) { deleteTicket(id); LOGGER.debug("Ticket [{}] has expired and is now deleted from the ticket registry.", ticket); throw new InvalidTicketException(id); } }
[ "@", "Synchronized", "protected", "void", "verifyTicketState", "(", "final", "Ticket", "ticket", ",", "final", "String", "id", ",", "final", "Class", "clazz", ")", "{", "if", "(", "ticket", "==", "null", ")", "{", "LOGGER", ".", "debug", "(", "\"Ticket [{}] by type [{}] cannot be found in the ticket registry.\"", ",", "id", ",", "clazz", "!=", "null", "?", "clazz", ".", "getSimpleName", "(", ")", ":", "\"unspecified\"", ")", ";", "throw", "new", "InvalidTicketException", "(", "id", ")", ";", "}", "if", "(", "ticket", ".", "isExpired", "(", ")", ")", "{", "deleteTicket", "(", "id", ")", ";", "LOGGER", ".", "debug", "(", "\"Ticket [{}] has expired and is now deleted from the ticket registry.\"", ",", "ticket", ")", ";", "throw", "new", "InvalidTicketException", "(", "id", ")", ";", "}", "}" ]
Validate ticket expiration policy and throws exception if ticket is no longer valid. Expired tickets are also deleted from the registry immediately on demand. @param ticket the ticket @param id the original id @param clazz the clazz
[ "Validate", "ticket", "expiration", "policy", "and", "throws", "exception", "if", "ticket", "is", "no", "longer", "valid", ".", "Expired", "tickets", "are", "also", "deleted", "from", "the", "registry", "immediately", "on", "demand", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core/src/main/java/org/apereo/cas/AbstractCentralAuthenticationService.java#L211-L222
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java
PageInBrowserStats.getAverageWindowLoadTime
public double getAverageWindowLoadTime(final String intervalName, final TimeUnit unit) { """ Returns the average web page load time for given interval and {@link TimeUnit}. @param intervalName name of the interval @param unit {@link TimeUnit} @return average web page load time """ return unit.transformMillis(totalWindowLoadTime.getValueAsLong(intervalName)) / numberOfLoads.getValueAsDouble(intervalName); }
java
public double getAverageWindowLoadTime(final String intervalName, final TimeUnit unit) { return unit.transformMillis(totalWindowLoadTime.getValueAsLong(intervalName)) / numberOfLoads.getValueAsDouble(intervalName); }
[ "public", "double", "getAverageWindowLoadTime", "(", "final", "String", "intervalName", ",", "final", "TimeUnit", "unit", ")", "{", "return", "unit", ".", "transformMillis", "(", "totalWindowLoadTime", ".", "getValueAsLong", "(", "intervalName", ")", ")", "/", "numberOfLoads", ".", "getValueAsDouble", "(", "intervalName", ")", ";", "}" ]
Returns the average web page load time for given interval and {@link TimeUnit}. @param intervalName name of the interval @param unit {@link TimeUnit} @return average web page load time
[ "Returns", "the", "average", "web", "page", "load", "time", "for", "given", "interval", "and", "{", "@link", "TimeUnit", "}", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L221-L223
facebookarchive/hadoop-20
src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java
HadoopLocationWizard.createConfNameEditor
private Text createConfNameEditor(ModifyListener listener, Composite parent, String propName, String labelText) { """ Create an editor entry for the given configuration name @param listener the listener to trigger on property change @param parent the SWT parent container @param propName the name of the property to create an editor for @param labelText a label (null will defaults to the property name) @return a SWT Text field """ { ConfProp prop = ConfProp.getByName(propName); if (prop != null) return createConfLabelText(listener, parent, prop, labelText); } Label label = new Label(parent, SWT.NONE); if (labelText == null) labelText = propName; label.setText(labelText); Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(data); text.setData("hPropName", propName); text.setText(location.getConfProp(propName)); text.addModifyListener(listener); return text; }
java
private Text createConfNameEditor(ModifyListener listener, Composite parent, String propName, String labelText) { { ConfProp prop = ConfProp.getByName(propName); if (prop != null) return createConfLabelText(listener, parent, prop, labelText); } Label label = new Label(parent, SWT.NONE); if (labelText == null) labelText = propName; label.setText(labelText); Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); text.setLayoutData(data); text.setData("hPropName", propName); text.setText(location.getConfProp(propName)); text.addModifyListener(listener); return text; }
[ "private", "Text", "createConfNameEditor", "(", "ModifyListener", "listener", ",", "Composite", "parent", ",", "String", "propName", ",", "String", "labelText", ")", "{", "{", "ConfProp", "prop", "=", "ConfProp", ".", "getByName", "(", "propName", ")", ";", "if", "(", "prop", "!=", "null", ")", "return", "createConfLabelText", "(", "listener", ",", "parent", ",", "prop", ",", "labelText", ")", ";", "}", "Label", "label", "=", "new", "Label", "(", "parent", ",", "SWT", ".", "NONE", ")", ";", "if", "(", "labelText", "==", "null", ")", "labelText", "=", "propName", ";", "label", ".", "setText", "(", "labelText", ")", ";", "Text", "text", "=", "new", "Text", "(", "parent", ",", "SWT", ".", "SINGLE", "|", "SWT", ".", "BORDER", ")", ";", "GridData", "data", "=", "new", "GridData", "(", "GridData", ".", "FILL_HORIZONTAL", ")", ";", "text", ".", "setLayoutData", "(", "data", ")", ";", "text", ".", "setData", "(", "\"hPropName\"", ",", "propName", ")", ";", "text", ".", "setText", "(", "location", ".", "getConfProp", "(", "propName", ")", ")", ";", "text", ".", "addModifyListener", "(", "listener", ")", ";", "return", "text", ";", "}" ]
Create an editor entry for the given configuration name @param listener the listener to trigger on property change @param parent the SWT parent container @param propName the name of the property to create an editor for @param labelText a label (null will defaults to the property name) @return a SWT Text field
[ "Create", "an", "editor", "entry", "for", "the", "given", "configuration", "name" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/servers/HadoopLocationWizard.java#L562-L584
apache/groovy
subprojects/groovy-json/src/main/java/groovy/json/JsonLexer.java
JsonLexer.skipWhitespace
public int skipWhitespace() { """ Skips all the whitespace characters and moves the cursor to the next non-space character. """ try { int readChar = 20; char c = SPACE; while (Character.isWhitespace(c)) { reader.mark(1); readChar = reader.read(); c = (char) readChar; } reader.reset(); return readChar; } catch (IOException ioe) { throw new JsonException("An IO exception occurred while reading the JSON payload", ioe); } }
java
public int skipWhitespace() { try { int readChar = 20; char c = SPACE; while (Character.isWhitespace(c)) { reader.mark(1); readChar = reader.read(); c = (char) readChar; } reader.reset(); return readChar; } catch (IOException ioe) { throw new JsonException("An IO exception occurred while reading the JSON payload", ioe); } }
[ "public", "int", "skipWhitespace", "(", ")", "{", "try", "{", "int", "readChar", "=", "20", ";", "char", "c", "=", "SPACE", ";", "while", "(", "Character", ".", "isWhitespace", "(", "c", ")", ")", "{", "reader", ".", "mark", "(", "1", ")", ";", "readChar", "=", "reader", ".", "read", "(", ")", ";", "c", "=", "(", "char", ")", "readChar", ";", "}", "reader", ".", "reset", "(", ")", ";", "return", "readChar", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "JsonException", "(", "\"An IO exception occurred while reading the JSON payload\"", ",", "ioe", ")", ";", "}", "}" ]
Skips all the whitespace characters and moves the cursor to the next non-space character.
[ "Skips", "all", "the", "whitespace", "characters", "and", "moves", "the", "cursor", "to", "the", "next", "non", "-", "space", "character", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-json/src/main/java/groovy/json/JsonLexer.java#L213-L227
alkacon/opencms-core
src/org/opencms/cmis/CmsCmisResourceHelper.java
CmsCmisResourceHelper.getAllowableActions
public synchronized AllowableActions getAllowableActions(CmsCmisCallContext context, String objectId) { """ Gets the allowable actions for an object.<p> @param context the call context @param objectId the object id @return the allowable actions """ try { CmsObject cms = m_repository.getCmsObject(context); CmsUUID structureId = new CmsUUID(objectId); CmsResource file = cms.readResource(structureId); return collectAllowableActions(cms, file); } catch (CmsException e) { handleCmsException(e); return null; } }
java
public synchronized AllowableActions getAllowableActions(CmsCmisCallContext context, String objectId) { try { CmsObject cms = m_repository.getCmsObject(context); CmsUUID structureId = new CmsUUID(objectId); CmsResource file = cms.readResource(structureId); return collectAllowableActions(cms, file); } catch (CmsException e) { handleCmsException(e); return null; } }
[ "public", "synchronized", "AllowableActions", "getAllowableActions", "(", "CmsCmisCallContext", "context", ",", "String", "objectId", ")", "{", "try", "{", "CmsObject", "cms", "=", "m_repository", ".", "getCmsObject", "(", "context", ")", ";", "CmsUUID", "structureId", "=", "new", "CmsUUID", "(", "objectId", ")", ";", "CmsResource", "file", "=", "cms", ".", "readResource", "(", "structureId", ")", ";", "return", "collectAllowableActions", "(", "cms", ",", "file", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "handleCmsException", "(", "e", ")", ";", "return", "null", ";", "}", "}" ]
Gets the allowable actions for an object.<p> @param context the call context @param objectId the object id @return the allowable actions
[ "Gets", "the", "allowable", "actions", "for", "an", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisResourceHelper.java#L169-L180
threerings/nenya
tools/src/main/java/com/threerings/cast/bundle/tools/ComponentBundler.java
ComponentBundler.composePath
protected String composePath (String[] info, String extension) { """ Composes a triplet of [class, name, action] into the path that should be supplied to the JarEntry that contains the associated image data. """ return (info[0] + "/" + info[1] + "/" + info[2] + extension); }
java
protected String composePath (String[] info, String extension) { return (info[0] + "/" + info[1] + "/" + info[2] + extension); }
[ "protected", "String", "composePath", "(", "String", "[", "]", "info", ",", "String", "extension", ")", "{", "return", "(", "info", "[", "0", "]", "+", "\"/\"", "+", "info", "[", "1", "]", "+", "\"/\"", "+", "info", "[", "2", "]", "+", "extension", ")", ";", "}" ]
Composes a triplet of [class, name, action] into the path that should be supplied to the JarEntry that contains the associated image data.
[ "Composes", "a", "triplet", "of", "[", "class", "name", "action", "]", "into", "the", "path", "that", "should", "be", "supplied", "to", "the", "JarEntry", "that", "contains", "the", "associated", "image", "data", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/cast/bundle/tools/ComponentBundler.java#L320-L323
aws/aws-sdk-java
aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/GetDocumentResult.java
GetDocumentResult.withCustomMetadata
public GetDocumentResult withCustomMetadata(java.util.Map<String, String> customMetadata) { """ <p> The custom metadata on the document. </p> @param customMetadata The custom metadata on the document. @return Returns a reference to this object so that method calls can be chained together. """ setCustomMetadata(customMetadata); return this; }
java
public GetDocumentResult withCustomMetadata(java.util.Map<String, String> customMetadata) { setCustomMetadata(customMetadata); return this; }
[ "public", "GetDocumentResult", "withCustomMetadata", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "customMetadata", ")", "{", "setCustomMetadata", "(", "customMetadata", ")", ";", "return", "this", ";", "}" ]
<p> The custom metadata on the document. </p> @param customMetadata The custom metadata on the document. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "custom", "metadata", "on", "the", "document", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/GetDocumentResult.java#L114-L117
kiegroup/drools
drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSource.java
LeftTupleSource.removeTupleSink
public void removeTupleSink(final LeftTupleSink tupleSink) { """ Removes the <code>TupleSink</code> @param tupleSink The <code>TupleSink</code> to remove """ if ( this.sink instanceof EmptyLeftTupleSinkAdapter ) { throw new IllegalArgumentException( "Cannot remove a sink, when the list of sinks is null" ); } if ( this.sink instanceof SingleLeftTupleSinkAdapter ) { this.sink = EmptyLeftTupleSinkAdapter.getInstance(); } else { final CompositeLeftTupleSinkAdapter sinkAdapter = (CompositeLeftTupleSinkAdapter) this.sink; sinkAdapter.removeTupleSink( tupleSink ); if ( sinkAdapter.size() == 1 ) { this.sink = new SingleLeftTupleSinkAdapter( this.getPartitionId(), sinkAdapter.getSinks()[0] ); } } }
java
public void removeTupleSink(final LeftTupleSink tupleSink) { if ( this.sink instanceof EmptyLeftTupleSinkAdapter ) { throw new IllegalArgumentException( "Cannot remove a sink, when the list of sinks is null" ); } if ( this.sink instanceof SingleLeftTupleSinkAdapter ) { this.sink = EmptyLeftTupleSinkAdapter.getInstance(); } else { final CompositeLeftTupleSinkAdapter sinkAdapter = (CompositeLeftTupleSinkAdapter) this.sink; sinkAdapter.removeTupleSink( tupleSink ); if ( sinkAdapter.size() == 1 ) { this.sink = new SingleLeftTupleSinkAdapter( this.getPartitionId(), sinkAdapter.getSinks()[0] ); } } }
[ "public", "void", "removeTupleSink", "(", "final", "LeftTupleSink", "tupleSink", ")", "{", "if", "(", "this", ".", "sink", "instanceof", "EmptyLeftTupleSinkAdapter", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot remove a sink, when the list of sinks is null\"", ")", ";", "}", "if", "(", "this", ".", "sink", "instanceof", "SingleLeftTupleSinkAdapter", ")", "{", "this", ".", "sink", "=", "EmptyLeftTupleSinkAdapter", ".", "getInstance", "(", ")", ";", "}", "else", "{", "final", "CompositeLeftTupleSinkAdapter", "sinkAdapter", "=", "(", "CompositeLeftTupleSinkAdapter", ")", "this", ".", "sink", ";", "sinkAdapter", ".", "removeTupleSink", "(", "tupleSink", ")", ";", "if", "(", "sinkAdapter", ".", "size", "(", ")", "==", "1", ")", "{", "this", ".", "sink", "=", "new", "SingleLeftTupleSinkAdapter", "(", "this", ".", "getPartitionId", "(", ")", ",", "sinkAdapter", ".", "getSinks", "(", ")", "[", "0", "]", ")", ";", "}", "}", "}" ]
Removes the <code>TupleSink</code> @param tupleSink The <code>TupleSink</code> to remove
[ "Removes", "the", "<code", ">", "TupleSink<", "/", "code", ">" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/reteoo/LeftTupleSource.java#L173-L187
Syncleus/aparapi
src/main/java/com/aparapi/internal/kernel/KernelProfile.java
KernelProfile.onEvent
void onEvent(Device device, ProfilingEvent event) { """ Updates the profiling information for the current thread invoking this method regarding the specified execution device. @param device the device where the kernel is/was executed @param event the event for which the profiling information is being updated """ if (event == null) { logger.log(Level.WARNING, "Discarding profiling event " + event + " for null device, for Kernel class: " + kernelClass.getName()); return; } final KernelDeviceProfile deviceProfile = deviceProfiles.get(device); switch (event) { case CLASS_MODEL_BUILT: // fallthrough case OPENCL_GENERATED: // fallthrough case INIT_JNI: // fallthrough case OPENCL_COMPILED: // fallthrough case PREPARE_EXECUTE: // fallthrough case EXECUTED: // fallthrough { if (deviceProfile == null) { logger.log(Level.SEVERE, "Error in KernelProfile, no currentDevice (synchronization error?"); } deviceProfile.onEvent(event); break; } case START: throw new IllegalArgumentException("must use onStart(Device) to start profiling"); default: throw new IllegalArgumentException("Unhandled event " + event); } }
java
void onEvent(Device device, ProfilingEvent event) { if (event == null) { logger.log(Level.WARNING, "Discarding profiling event " + event + " for null device, for Kernel class: " + kernelClass.getName()); return; } final KernelDeviceProfile deviceProfile = deviceProfiles.get(device); switch (event) { case CLASS_MODEL_BUILT: // fallthrough case OPENCL_GENERATED: // fallthrough case INIT_JNI: // fallthrough case OPENCL_COMPILED: // fallthrough case PREPARE_EXECUTE: // fallthrough case EXECUTED: // fallthrough { if (deviceProfile == null) { logger.log(Level.SEVERE, "Error in KernelProfile, no currentDevice (synchronization error?"); } deviceProfile.onEvent(event); break; } case START: throw new IllegalArgumentException("must use onStart(Device) to start profiling"); default: throw new IllegalArgumentException("Unhandled event " + event); } }
[ "void", "onEvent", "(", "Device", "device", ",", "ProfilingEvent", "event", ")", "{", "if", "(", "event", "==", "null", ")", "{", "logger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Discarding profiling event \"", "+", "event", "+", "\" for null device, for Kernel class: \"", "+", "kernelClass", ".", "getName", "(", ")", ")", ";", "return", ";", "}", "final", "KernelDeviceProfile", "deviceProfile", "=", "deviceProfiles", ".", "get", "(", "device", ")", ";", "switch", "(", "event", ")", "{", "case", "CLASS_MODEL_BUILT", ":", "// fallthrough", "case", "OPENCL_GENERATED", ":", "// fallthrough", "case", "INIT_JNI", ":", "// fallthrough", "case", "OPENCL_COMPILED", ":", "// fallthrough", "case", "PREPARE_EXECUTE", ":", "// fallthrough", "case", "EXECUTED", ":", "// fallthrough", "{", "if", "(", "deviceProfile", "==", "null", ")", "{", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Error in KernelProfile, no currentDevice (synchronization error?\"", ")", ";", "}", "deviceProfile", ".", "onEvent", "(", "event", ")", ";", "break", ";", "}", "case", "START", ":", "throw", "new", "IllegalArgumentException", "(", "\"must use onStart(Device) to start profiling\"", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unhandled event \"", "+", "event", ")", ";", "}", "}" ]
Updates the profiling information for the current thread invoking this method regarding the specified execution device. @param device the device where the kernel is/was executed @param event the event for which the profiling information is being updated
[ "Updates", "the", "profiling", "information", "for", "the", "current", "thread", "invoking", "this", "method", "regarding", "the", "specified", "execution", "device", "." ]
train
https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelProfile.java#L97-L122
windup/windup
decompiler/impl-procyon/src/main/java/org/jboss/windup/decompiler/procyon/ProcyonDecompiler.java
ProcyonDecompiler.decompileClassFile
@Override public DecompilationResult decompileClassFile(Path rootDir, Path classFilePath, Path outputDir) throws DecompilationException { """ Decompiles the given .class file and creates the specified output source file. @param classFilePath the .class file to be decompiled. @param outputDir The directory where decompiled .java files will be placed. """ Checks.checkDirectoryToBeRead(rootDir.toFile(), "Classes root dir"); File classFile = classFilePath.toFile(); Checks.checkFileToBeRead(classFile, "Class file"); Checks.checkDirectoryToBeFilled(outputDir.toFile(), "Output directory"); log.info("Decompiling .class '" + classFilePath + "' to '" + outputDir + "' from: '" + rootDir + "'"); String name = classFilePath.normalize().toAbsolutePath().toString().substring(rootDir.toAbsolutePath().toString().length() + 1); final String typeName = StringUtils.removeEnd(name, ".class");// .replace('/', '.'); DecompilationResult result = new DecompilationResult(); try { DecompilerSettings settings = getDefaultSettings(outputDir.toFile()); this.procyonConf.setDecompilerSettings(settings); // TODO: This is horrible mess. final ITypeLoader typeLoader = new CompositeTypeLoader(new WindupClasspathTypeLoader(rootDir.toString()), new ClasspathTypeLoader()); WindupMetadataSystem metadataSystem = new WindupMetadataSystem(typeLoader); File outputFile = this.decompileType(settings, metadataSystem, typeName); result.addDecompiled(Collections.singletonList(classFilePath.toString()), outputFile.getAbsolutePath()); } catch (Throwable e) { DecompilationFailure failure = new DecompilationFailure("Error during decompilation of " + classFilePath.toString() + ":\n " + e.getMessage(), Collections.singletonList(name), e); log.severe(failure.getMessage()); result.addFailure(failure); } return result; }
java
@Override public DecompilationResult decompileClassFile(Path rootDir, Path classFilePath, Path outputDir) throws DecompilationException { Checks.checkDirectoryToBeRead(rootDir.toFile(), "Classes root dir"); File classFile = classFilePath.toFile(); Checks.checkFileToBeRead(classFile, "Class file"); Checks.checkDirectoryToBeFilled(outputDir.toFile(), "Output directory"); log.info("Decompiling .class '" + classFilePath + "' to '" + outputDir + "' from: '" + rootDir + "'"); String name = classFilePath.normalize().toAbsolutePath().toString().substring(rootDir.toAbsolutePath().toString().length() + 1); final String typeName = StringUtils.removeEnd(name, ".class");// .replace('/', '.'); DecompilationResult result = new DecompilationResult(); try { DecompilerSettings settings = getDefaultSettings(outputDir.toFile()); this.procyonConf.setDecompilerSettings(settings); // TODO: This is horrible mess. final ITypeLoader typeLoader = new CompositeTypeLoader(new WindupClasspathTypeLoader(rootDir.toString()), new ClasspathTypeLoader()); WindupMetadataSystem metadataSystem = new WindupMetadataSystem(typeLoader); File outputFile = this.decompileType(settings, metadataSystem, typeName); result.addDecompiled(Collections.singletonList(classFilePath.toString()), outputFile.getAbsolutePath()); } catch (Throwable e) { DecompilationFailure failure = new DecompilationFailure("Error during decompilation of " + classFilePath.toString() + ":\n " + e.getMessage(), Collections.singletonList(name), e); log.severe(failure.getMessage()); result.addFailure(failure); } return result; }
[ "@", "Override", "public", "DecompilationResult", "decompileClassFile", "(", "Path", "rootDir", ",", "Path", "classFilePath", ",", "Path", "outputDir", ")", "throws", "DecompilationException", "{", "Checks", ".", "checkDirectoryToBeRead", "(", "rootDir", ".", "toFile", "(", ")", ",", "\"Classes root dir\"", ")", ";", "File", "classFile", "=", "classFilePath", ".", "toFile", "(", ")", ";", "Checks", ".", "checkFileToBeRead", "(", "classFile", ",", "\"Class file\"", ")", ";", "Checks", ".", "checkDirectoryToBeFilled", "(", "outputDir", ".", "toFile", "(", ")", ",", "\"Output directory\"", ")", ";", "log", ".", "info", "(", "\"Decompiling .class '\"", "+", "classFilePath", "+", "\"' to '\"", "+", "outputDir", "+", "\"' from: '\"", "+", "rootDir", "+", "\"'\"", ")", ";", "String", "name", "=", "classFilePath", ".", "normalize", "(", ")", ".", "toAbsolutePath", "(", ")", ".", "toString", "(", ")", ".", "substring", "(", "rootDir", ".", "toAbsolutePath", "(", ")", ".", "toString", "(", ")", ".", "length", "(", ")", "+", "1", ")", ";", "final", "String", "typeName", "=", "StringUtils", ".", "removeEnd", "(", "name", ",", "\".class\"", ")", ";", "// .replace('/', '.');", "DecompilationResult", "result", "=", "new", "DecompilationResult", "(", ")", ";", "try", "{", "DecompilerSettings", "settings", "=", "getDefaultSettings", "(", "outputDir", ".", "toFile", "(", ")", ")", ";", "this", ".", "procyonConf", ".", "setDecompilerSettings", "(", "settings", ")", ";", "// TODO: This is horrible mess.", "final", "ITypeLoader", "typeLoader", "=", "new", "CompositeTypeLoader", "(", "new", "WindupClasspathTypeLoader", "(", "rootDir", ".", "toString", "(", ")", ")", ",", "new", "ClasspathTypeLoader", "(", ")", ")", ";", "WindupMetadataSystem", "metadataSystem", "=", "new", "WindupMetadataSystem", "(", "typeLoader", ")", ";", "File", "outputFile", "=", "this", ".", "decompileType", "(", "settings", ",", "metadataSystem", ",", "typeName", ")", ";", "result", ".", "addDecompiled", "(", "Collections", ".", "singletonList", "(", "classFilePath", ".", "toString", "(", ")", ")", ",", "outputFile", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "DecompilationFailure", "failure", "=", "new", "DecompilationFailure", "(", "\"Error during decompilation of \"", "+", "classFilePath", ".", "toString", "(", ")", "+", "\":\\n \"", "+", "e", ".", "getMessage", "(", ")", ",", "Collections", ".", "singletonList", "(", "name", ")", ",", "e", ")", ";", "log", ".", "severe", "(", "failure", ".", "getMessage", "(", ")", ")", ";", "result", ".", "addFailure", "(", "failure", ")", ";", "}", "return", "result", ";", "}" ]
Decompiles the given .class file and creates the specified output source file. @param classFilePath the .class file to be decompiled. @param outputDir The directory where decompiled .java files will be placed.
[ "Decompiles", "the", "given", ".", "class", "file", "and", "creates", "the", "specified", "output", "source", "file", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/decompiler/impl-procyon/src/main/java/org/jboss/windup/decompiler/procyon/ProcyonDecompiler.java#L225-L259
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java
ComponentCollision.addPoint
private void addPoint(Point point, Collidable collidable) { """ Add point. Create empty list of not existing. @param point The point to remove. @param collidable The associated collidable. """ final Integer group = collidable.getGroup(); if (!collidables.containsKey(group)) { collidables.put(group, new HashMap<Point, Set<Collidable>>()); } final Map<Point, Set<Collidable>> elements = collidables.get(group); if (!elements.containsKey(point)) { elements.put(point, new HashSet<Collidable>()); } elements.get(point).add(collidable); }
java
private void addPoint(Point point, Collidable collidable) { final Integer group = collidable.getGroup(); if (!collidables.containsKey(group)) { collidables.put(group, new HashMap<Point, Set<Collidable>>()); } final Map<Point, Set<Collidable>> elements = collidables.get(group); if (!elements.containsKey(point)) { elements.put(point, new HashSet<Collidable>()); } elements.get(point).add(collidable); }
[ "private", "void", "addPoint", "(", "Point", "point", ",", "Collidable", "collidable", ")", "{", "final", "Integer", "group", "=", "collidable", ".", "getGroup", "(", ")", ";", "if", "(", "!", "collidables", ".", "containsKey", "(", "group", ")", ")", "{", "collidables", ".", "put", "(", "group", ",", "new", "HashMap", "<", "Point", ",", "Set", "<", "Collidable", ">", ">", "(", ")", ")", ";", "}", "final", "Map", "<", "Point", ",", "Set", "<", "Collidable", ">", ">", "elements", "=", "collidables", ".", "get", "(", "group", ")", ";", "if", "(", "!", "elements", ".", "containsKey", "(", "point", ")", ")", "{", "elements", ".", "put", "(", "point", ",", "new", "HashSet", "<", "Collidable", ">", "(", ")", ")", ";", "}", "elements", ".", "get", "(", "point", ")", ".", "add", "(", "collidable", ")", ";", "}" ]
Add point. Create empty list of not existing. @param point The point to remove. @param collidable The associated collidable.
[ "Add", "point", ".", "Create", "empty", "list", "of", "not", "existing", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java#L108-L121
apiman/apiman
common/auth/src/main/java/io/apiman/common/auth/AuthTokenUtil.java
AuthTokenUtil.produceToken
public static final String produceToken(String principal, Set<String> roles, int expiresInMillis) { """ Produce a token suitable for transmission. This will generate the auth token, then serialize it to a JSON string, then Base64 encode the JSON. @param principal the auth principal @param roles the auth roles @param expiresInMillis the number of millis to expiry @return the token """ AuthToken authToken = createAuthToken(principal, roles, expiresInMillis); String json = toJSON(authToken); return StringUtils.newStringUtf8(Base64.encodeBase64(StringUtils.getBytesUtf8(json))); }
java
public static final String produceToken(String principal, Set<String> roles, int expiresInMillis) { AuthToken authToken = createAuthToken(principal, roles, expiresInMillis); String json = toJSON(authToken); return StringUtils.newStringUtf8(Base64.encodeBase64(StringUtils.getBytesUtf8(json))); }
[ "public", "static", "final", "String", "produceToken", "(", "String", "principal", ",", "Set", "<", "String", ">", "roles", ",", "int", "expiresInMillis", ")", "{", "AuthToken", "authToken", "=", "createAuthToken", "(", "principal", ",", "roles", ",", "expiresInMillis", ")", ";", "String", "json", "=", "toJSON", "(", "authToken", ")", ";", "return", "StringUtils", ".", "newStringUtf8", "(", "Base64", ".", "encodeBase64", "(", "StringUtils", ".", "getBytesUtf8", "(", "json", ")", ")", ")", ";", "}" ]
Produce a token suitable for transmission. This will generate the auth token, then serialize it to a JSON string, then Base64 encode the JSON. @param principal the auth principal @param roles the auth roles @param expiresInMillis the number of millis to expiry @return the token
[ "Produce", "a", "token", "suitable", "for", "transmission", ".", "This", "will", "generate", "the", "auth", "token", "then", "serialize", "it", "to", "a", "JSON", "string", "then", "Base64", "encode", "the", "JSON", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/auth/src/main/java/io/apiman/common/auth/AuthTokenUtil.java#L74-L78
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java
SqlExecutor.execute
public static boolean execute(PreparedStatement ps, Object... params) throws SQLException { """ 可用于执行任何SQL语句,返回一个boolean值,表明执行该SQL语句是否返回了ResultSet。<br> 如果执行后第一个结果是ResultSet,则返回true,否则返回false。<br> 此方法不会关闭PreparedStatement @param ps PreparedStatement对象 @param params 参数 @return 如果执行后第一个结果是ResultSet,则返回true,否则返回false。 @throws SQLException SQL执行异常 """ StatementUtil.fillParams(ps, params); return ps.execute(); }
java
public static boolean execute(PreparedStatement ps, Object... params) throws SQLException { StatementUtil.fillParams(ps, params); return ps.execute(); }
[ "public", "static", "boolean", "execute", "(", "PreparedStatement", "ps", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "StatementUtil", ".", "fillParams", "(", "ps", ",", "params", ")", ";", "return", "ps", ".", "execute", "(", ")", ";", "}" ]
可用于执行任何SQL语句,返回一个boolean值,表明执行该SQL语句是否返回了ResultSet。<br> 如果执行后第一个结果是ResultSet,则返回true,否则返回false。<br> 此方法不会关闭PreparedStatement @param ps PreparedStatement对象 @param params 参数 @return 如果执行后第一个结果是ResultSet,则返回true,否则返回false。 @throws SQLException SQL执行异常
[ "可用于执行任何SQL语句,返回一个boolean值,表明执行该SQL语句是否返回了ResultSet。<br", ">", "如果执行后第一个结果是ResultSet,则返回true,否则返回false。<br", ">", "此方法不会关闭PreparedStatement" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L296-L299
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/SearchFilter.java
SearchFilter.matchValue
public void matchValue(String ElementName, String value, int oper) { """ Change the search filter to one that specifies an element to not match one single value. The old search filter is deleted. @param ElementName is the name of the element to be matched @param value is the value to not be matched @param oper is the IN or NOT_IN operator to indicate how to matche """ // Delete the old search filter m_filter = null; // If not NOT_IN, assume IN // (Since ints are passed by value, it is OK to change it) if (oper != NOT_IN) { oper = IN; // Create a String array in which to hold the one name, // and put that name in the array } String[] ValueArray = new String[1]; ValueArray[0] = value; // Create a leaf node for this list and store it as the filter m_filter = new SearchBaseLeaf(ElementName, oper, ValueArray); }
java
public void matchValue(String ElementName, String value, int oper) { // Delete the old search filter m_filter = null; // If not NOT_IN, assume IN // (Since ints are passed by value, it is OK to change it) if (oper != NOT_IN) { oper = IN; // Create a String array in which to hold the one name, // and put that name in the array } String[] ValueArray = new String[1]; ValueArray[0] = value; // Create a leaf node for this list and store it as the filter m_filter = new SearchBaseLeaf(ElementName, oper, ValueArray); }
[ "public", "void", "matchValue", "(", "String", "ElementName", ",", "String", "value", ",", "int", "oper", ")", "{", "// Delete the old search filter\r", "m_filter", "=", "null", ";", "// If not NOT_IN, assume IN\r", "// (Since ints are passed by value, it is OK to change it)\r", "if", "(", "oper", "!=", "NOT_IN", ")", "{", "oper", "=", "IN", ";", "// Create a String array in which to hold the one name,\r", "// and put that name in the array\r", "}", "String", "[", "]", "ValueArray", "=", "new", "String", "[", "1", "]", ";", "ValueArray", "[", "0", "]", "=", "value", ";", "// Create a leaf node for this list and store it as the filter\r", "m_filter", "=", "new", "SearchBaseLeaf", "(", "ElementName", ",", "oper", ",", "ValueArray", ")", ";", "}" ]
Change the search filter to one that specifies an element to not match one single value. The old search filter is deleted. @param ElementName is the name of the element to be matched @param value is the value to not be matched @param oper is the IN or NOT_IN operator to indicate how to matche
[ "Change", "the", "search", "filter", "to", "one", "that", "specifies", "an", "element", "to", "not", "match", "one", "single", "value", ".", "The", "old", "search", "filter", "is", "deleted", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/SearchFilter.java#L146-L162
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/curves/ForwardCurveInterpolation.java
ForwardCurveInterpolation.createForwardCurveFromForwards
public static ForwardCurveInterpolation createForwardCurveFromForwards(String name, Date referenceDate, String paymentOffsetCode, BusinessdayCalendar paymentBusinessdayCalendar, BusinessdayCalendar.DateRollConvention paymentDateRollConvention, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity, InterpolationEntityForward interpolationEntityForward, String discountCurveName, AnalyticModel model, double[] times, double[] givenForwards) { """ Create a forward curve from given times and given forwards. @param name The name of this curve. @param referenceDate The reference date for this code, i.e., the date which defines t=0. @param paymentOffsetCode The maturity of the index modeled by this curve. @param paymentBusinessdayCalendar The business day calendar used for adjusting the payment date. @param paymentDateRollConvention The date roll convention used for adjusting the payment date. @param interpolationMethod The interpolation method used for the curve. @param extrapolationMethod The extrapolation method used for the curve. @param interpolationEntity The entity interpolated/extrapolated. @param interpolationEntityForward Interpolation entity used for forward rate interpolation. @param discountCurveName The name of a discount curve associated with this index (associated with it's funding or collateralization), if any. @param model The model to be used to fetch the discount curve, if needed. @param times A vector of given time points. @param givenForwards A vector of given forwards (corresponding to the given time points). @return A new ForwardCurve object. """ return createForwardCurveFromForwards(name, referenceDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), paymentOffsetCode, paymentBusinessdayCalendar, paymentDateRollConvention, interpolationMethod, extrapolationMethod, interpolationEntity, interpolationEntityForward, discountCurveName, model, times, givenForwards); }
java
public static ForwardCurveInterpolation createForwardCurveFromForwards(String name, Date referenceDate, String paymentOffsetCode, BusinessdayCalendar paymentBusinessdayCalendar, BusinessdayCalendar.DateRollConvention paymentDateRollConvention, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity, InterpolationEntityForward interpolationEntityForward, String discountCurveName, AnalyticModel model, double[] times, double[] givenForwards) { return createForwardCurveFromForwards(name, referenceDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), paymentOffsetCode, paymentBusinessdayCalendar, paymentDateRollConvention, interpolationMethod, extrapolationMethod, interpolationEntity, interpolationEntityForward, discountCurveName, model, times, givenForwards); }
[ "public", "static", "ForwardCurveInterpolation", "createForwardCurveFromForwards", "(", "String", "name", ",", "Date", "referenceDate", ",", "String", "paymentOffsetCode", ",", "BusinessdayCalendar", "paymentBusinessdayCalendar", ",", "BusinessdayCalendar", ".", "DateRollConvention", "paymentDateRollConvention", ",", "InterpolationMethod", "interpolationMethod", ",", "ExtrapolationMethod", "extrapolationMethod", ",", "InterpolationEntity", "interpolationEntity", ",", "InterpolationEntityForward", "interpolationEntityForward", ",", "String", "discountCurveName", ",", "AnalyticModel", "model", ",", "double", "[", "]", "times", ",", "double", "[", "]", "givenForwards", ")", "{", "return", "createForwardCurveFromForwards", "(", "name", ",", "referenceDate", ".", "toInstant", "(", ")", ".", "atZone", "(", "ZoneId", ".", "systemDefault", "(", ")", ")", ".", "toLocalDate", "(", ")", ",", "paymentOffsetCode", ",", "paymentBusinessdayCalendar", ",", "paymentDateRollConvention", ",", "interpolationMethod", ",", "extrapolationMethod", ",", "interpolationEntity", ",", "interpolationEntityForward", ",", "discountCurveName", ",", "model", ",", "times", ",", "givenForwards", ")", ";", "}" ]
Create a forward curve from given times and given forwards. @param name The name of this curve. @param referenceDate The reference date for this code, i.e., the date which defines t=0. @param paymentOffsetCode The maturity of the index modeled by this curve. @param paymentBusinessdayCalendar The business day calendar used for adjusting the payment date. @param paymentDateRollConvention The date roll convention used for adjusting the payment date. @param interpolationMethod The interpolation method used for the curve. @param extrapolationMethod The extrapolation method used for the curve. @param interpolationEntity The entity interpolated/extrapolated. @param interpolationEntityForward Interpolation entity used for forward rate interpolation. @param discountCurveName The name of a discount curve associated with this index (associated with it's funding or collateralization), if any. @param model The model to be used to fetch the discount curve, if needed. @param times A vector of given time points. @param givenForwards A vector of given forwards (corresponding to the given time points). @return A new ForwardCurve object.
[ "Create", "a", "forward", "curve", "from", "given", "times", "and", "given", "forwards", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/ForwardCurveInterpolation.java#L167-L173
dhanji/sitebricks
sitebricks/src/main/java/com/google/sitebricks/rendering/control/DecorateWidget.java
DecorateWidget.nextDecoratedClassInHierarchy
private Class<?> nextDecoratedClassInHierarchy(Class<?> previousTemplateClass, Class<?> candidate) { """ recursively find the next superclass with an @Decorated annotation """ if (candidate == previousTemplateClass) { // terminate the recursion return null; } else if (candidate == Object.class) { // this should never happen - we should terminate recursion first throw new IllegalStateException("Did not find previous extension"); } else { boolean isDecorated = candidate.isAnnotationPresent(Decorated.class); if (isDecorated) return candidate; else return nextDecoratedClassInHierarchy(previousTemplateClass, candidate.getSuperclass()); } }
java
private Class<?> nextDecoratedClassInHierarchy(Class<?> previousTemplateClass, Class<?> candidate) { if (candidate == previousTemplateClass) { // terminate the recursion return null; } else if (candidate == Object.class) { // this should never happen - we should terminate recursion first throw new IllegalStateException("Did not find previous extension"); } else { boolean isDecorated = candidate.isAnnotationPresent(Decorated.class); if (isDecorated) return candidate; else return nextDecoratedClassInHierarchy(previousTemplateClass, candidate.getSuperclass()); } }
[ "private", "Class", "<", "?", ">", "nextDecoratedClassInHierarchy", "(", "Class", "<", "?", ">", "previousTemplateClass", ",", "Class", "<", "?", ">", "candidate", ")", "{", "if", "(", "candidate", "==", "previousTemplateClass", ")", "{", "// terminate the recursion\r", "return", "null", ";", "}", "else", "if", "(", "candidate", "==", "Object", ".", "class", ")", "{", "// this should never happen - we should terminate recursion first\r", "throw", "new", "IllegalStateException", "(", "\"Did not find previous extension\"", ")", ";", "}", "else", "{", "boolean", "isDecorated", "=", "candidate", ".", "isAnnotationPresent", "(", "Decorated", ".", "class", ")", ";", "if", "(", "isDecorated", ")", "return", "candidate", ";", "else", "return", "nextDecoratedClassInHierarchy", "(", "previousTemplateClass", ",", "candidate", ".", "getSuperclass", "(", ")", ")", ";", "}", "}" ]
recursively find the next superclass with an @Decorated annotation
[ "recursively", "find", "the", "next", "superclass", "with", "an" ]
train
https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/rendering/control/DecorateWidget.java#L74-L90
lagom/lagom
service/javadsl/broker/src/main/java/com/lightbend/lagom/javadsl/broker/TopicProducer.java
TopicProducer.singleStreamWithOffset
public static <Message> Topic<Message> singleStreamWithOffset( Function<Offset, Source<Pair<Message, Offset>, ?>> eventStream) { """ Publish a single stream. This producer will ensure every element from the stream will be published at least once (usually only once), using the message offsets to track where in the stream the producer is up to publishing. @param eventStream A function to create the event stream given the last offset that was published. @return The topic producer. """ return taggedStreamWithOffset(SINGLETON_TAG, (tag, offset) -> eventStream.apply(offset)); }
java
public static <Message> Topic<Message> singleStreamWithOffset( Function<Offset, Source<Pair<Message, Offset>, ?>> eventStream) { return taggedStreamWithOffset(SINGLETON_TAG, (tag, offset) -> eventStream.apply(offset)); }
[ "public", "static", "<", "Message", ">", "Topic", "<", "Message", ">", "singleStreamWithOffset", "(", "Function", "<", "Offset", ",", "Source", "<", "Pair", "<", "Message", ",", "Offset", ">", ",", "?", ">", ">", "eventStream", ")", "{", "return", "taggedStreamWithOffset", "(", "SINGLETON_TAG", ",", "(", "tag", ",", "offset", ")", "->", "eventStream", ".", "apply", "(", "offset", ")", ")", ";", "}" ]
Publish a single stream. This producer will ensure every element from the stream will be published at least once (usually only once), using the message offsets to track where in the stream the producer is up to publishing. @param eventStream A function to create the event stream given the last offset that was published. @return The topic producer.
[ "Publish", "a", "single", "stream", "." ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/broker/src/main/java/com/lightbend/lagom/javadsl/broker/TopicProducer.java#L38-L41
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/builder/XmlSqlInfoBuilder.java
XmlSqlInfoBuilder.buildBetweenSql
public SqlInfo buildBetweenSql(String fieldText, String startText, String endText) { """ 构建between区间查询的sqlInfo信息. @param fieldText 字段文本值 @param startText 参数开始值 @param endText 参数结束值 @return 返回SqlInfo信息 """ // 获取开始属性值和结束属性值,作区间查询 Object startValue = ParseHelper.parseExpress(startText, context); Object endValue = ParseHelper.parseExpress(endText, context); return super.buildBetweenSql(fieldText, startValue, endValue); }
java
public SqlInfo buildBetweenSql(String fieldText, String startText, String endText) { // 获取开始属性值和结束属性值,作区间查询 Object startValue = ParseHelper.parseExpress(startText, context); Object endValue = ParseHelper.parseExpress(endText, context); return super.buildBetweenSql(fieldText, startValue, endValue); }
[ "public", "SqlInfo", "buildBetweenSql", "(", "String", "fieldText", ",", "String", "startText", ",", "String", "endText", ")", "{", "// 获取开始属性值和结束属性值,作区间查询", "Object", "startValue", "=", "ParseHelper", ".", "parseExpress", "(", "startText", ",", "context", ")", ";", "Object", "endValue", "=", "ParseHelper", ".", "parseExpress", "(", "endText", ",", "context", ")", ";", "return", "super", ".", "buildBetweenSql", "(", "fieldText", ",", "startValue", ",", "endValue", ")", ";", "}" ]
构建between区间查询的sqlInfo信息. @param fieldText 字段文本值 @param startText 参数开始值 @param endText 参数结束值 @return 返回SqlInfo信息
[ "构建between区间查询的sqlInfo信息", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/builder/XmlSqlInfoBuilder.java#L71-L76
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java
JobExecutionsInner.createAsync
public Observable<JobExecutionInner> createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { """ Starts an elastic job execution. @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 jobAgentName The name of the job agent. @param jobName The name of the job to get. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1<ServiceResponse<JobExecutionInner>, JobExecutionInner>() { @Override public JobExecutionInner call(ServiceResponse<JobExecutionInner> response) { return response.body(); } }); }
java
public Observable<JobExecutionInner> createAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName) { return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).map(new Func1<ServiceResponse<JobExecutionInner>, JobExecutionInner>() { @Override public JobExecutionInner call(ServiceResponse<JobExecutionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobExecutionInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "jobAgentName", ",", "String", "jobName", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "jobAgentName", ",", "jobName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "JobExecutionInner", ">", ",", "JobExecutionInner", ">", "(", ")", "{", "@", "Override", "public", "JobExecutionInner", "call", "(", "ServiceResponse", "<", "JobExecutionInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Starts an elastic job execution. @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 jobAgentName The name of the job agent. @param jobName The name of the job to get. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Starts", "an", "elastic", "job", "execution", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java#L550-L557
eclipse/xtext-core
org.eclipse.xtext/src-gen/org/eclipse/xtext/serializer/XtextSemanticSequencer.java
XtextSemanticSequencer.sequence_Keyword
protected void sequence_Keyword(ISerializationContext context, Keyword semanticObject) { """ Contexts: Keyword returns Keyword AssignableTerminal returns Keyword ParenthesizedAssignableElement returns Keyword AssignableAlternatives returns Keyword AssignableAlternatives.Alternatives_1_0 returns Keyword CrossReferenceableTerminal returns Keyword CharacterRange returns Keyword CharacterRange.CharacterRange_1_0 returns Keyword Constraint: value=STRING """ if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.KEYWORD__VALUE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.KEYWORD__VALUE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getKeywordAccess().getValueSTRINGTerminalRuleCall_0(), semanticObject.getValue()); feeder.finish(); }
java
protected void sequence_Keyword(ISerializationContext context, Keyword semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.KEYWORD__VALUE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XtextPackage.Literals.KEYWORD__VALUE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getKeywordAccess().getValueSTRINGTerminalRuleCall_0(), semanticObject.getValue()); feeder.finish(); }
[ "protected", "void", "sequence_Keyword", "(", "ISerializationContext", "context", ",", "Keyword", "semanticObject", ")", "{", "if", "(", "errorAcceptor", "!=", "null", ")", "{", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanticObject", ",", "XtextPackage", ".", "Literals", ".", "KEYWORD__VALUE", ")", "==", "ValueTransient", ".", "YES", ")", "errorAcceptor", ".", "accept", "(", "diagnosticProvider", ".", "createFeatureValueMissing", "(", "semanticObject", ",", "XtextPackage", ".", "Literals", ".", "KEYWORD__VALUE", ")", ")", ";", "}", "SequenceFeeder", "feeder", "=", "createSequencerFeeder", "(", "context", ",", "semanticObject", ")", ";", "feeder", ".", "accept", "(", "grammarAccess", ".", "getKeywordAccess", "(", ")", ".", "getValueSTRINGTerminalRuleCall_0", "(", ")", ",", "semanticObject", ".", "getValue", "(", ")", ")", ";", "feeder", ".", "finish", "(", ")", ";", "}" ]
Contexts: Keyword returns Keyword AssignableTerminal returns Keyword ParenthesizedAssignableElement returns Keyword AssignableAlternatives returns Keyword AssignableAlternatives.Alternatives_1_0 returns Keyword CrossReferenceableTerminal returns Keyword CharacterRange returns Keyword CharacterRange.CharacterRange_1_0 returns Keyword Constraint: value=STRING
[ "Contexts", ":", "Keyword", "returns", "Keyword", "AssignableTerminal", "returns", "Keyword", "ParenthesizedAssignableElement", "returns", "Keyword", "AssignableAlternatives", "returns", "Keyword", "AssignableAlternatives", ".", "Alternatives_1_0", "returns", "Keyword", "CrossReferenceableTerminal", "returns", "Keyword", "CharacterRange", "returns", "Keyword", "CharacterRange", ".", "CharacterRange_1_0", "returns", "Keyword" ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src-gen/org/eclipse/xtext/serializer/XtextSemanticSequencer.java#L844-L852