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
box/box-java-sdk
src/main/java/com/box/sdk/BoxUser.java
BoxUser.getMemberships
public Collection<BoxGroupMembership.Info> getMemberships() { """ Gets information about all of the group memberships for this user. Does not support paging. <p>Note: This method is only available to enterprise admins.</p> @return a collection of information about the group memberships for this user. """ BoxAPIConnection api = this.getAPI(); URL url = USER_MEMBERSHIPS_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); int entriesCount = responseJSON.get("total_count").asInt(); Collection<BoxGroupMembership.Info> memberships = new ArrayList<BoxGroupMembership.Info>(entriesCount); JsonArray entries = responseJSON.get("entries").asArray(); for (JsonValue entry : entries) { JsonObject entryObject = entry.asObject(); BoxGroupMembership membership = new BoxGroupMembership(api, entryObject.get("id").asString()); BoxGroupMembership.Info info = membership.new Info(entryObject); memberships.add(info); } return memberships; }
java
public Collection<BoxGroupMembership.Info> getMemberships() { BoxAPIConnection api = this.getAPI(); URL url = USER_MEMBERSHIPS_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxAPIRequest request = new BoxAPIRequest(api, url, "GET"); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); int entriesCount = responseJSON.get("total_count").asInt(); Collection<BoxGroupMembership.Info> memberships = new ArrayList<BoxGroupMembership.Info>(entriesCount); JsonArray entries = responseJSON.get("entries").asArray(); for (JsonValue entry : entries) { JsonObject entryObject = entry.asObject(); BoxGroupMembership membership = new BoxGroupMembership(api, entryObject.get("id").asString()); BoxGroupMembership.Info info = membership.new Info(entryObject); memberships.add(info); } return memberships; }
[ "public", "Collection", "<", "BoxGroupMembership", ".", "Info", ">", "getMemberships", "(", ")", "{", "BoxAPIConnection", "api", "=", "this", ".", "getAPI", "(", ")", ";", "URL", "url", "=", "USER_MEMBERSHIPS_URL_TEMPLATE", ".", "build", "(", "this", ".", "g...
Gets information about all of the group memberships for this user. Does not support paging. <p>Note: This method is only available to enterprise admins.</p> @return a collection of information about the group memberships for this user.
[ "Gets", "information", "about", "all", "of", "the", "group", "memberships", "for", "this", "user", ".", "Does", "not", "support", "paging", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxUser.java#L301-L320
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java
EsMarshalling.unmarshallApiDefinition
public static ApiDefinitionBean unmarshallApiDefinition(Map<String, Object> source) { """ Unmarshals the given map source into a bean. @param source the source @return the API definition """ if (source == null) { return null; } ApiDefinitionBean bean = new ApiDefinitionBean(); bean.setData(asString(source.get("data"))); postMarshall(bean); return bean; }
java
public static ApiDefinitionBean unmarshallApiDefinition(Map<String, Object> source) { if (source == null) { return null; } ApiDefinitionBean bean = new ApiDefinitionBean(); bean.setData(asString(source.get("data"))); postMarshall(bean); return bean; }
[ "public", "static", "ApiDefinitionBean", "unmarshallApiDefinition", "(", "Map", "<", "String", ",", "Object", ">", "source", ")", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "ApiDefinitionBean", "bean", "=", "new", "ApiDefin...
Unmarshals the given map source into a bean. @param source the source @return the API definition
[ "Unmarshals", "the", "given", "map", "source", "into", "a", "bean", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L742-L750
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java
MsgDestEncodingUtilsImpl.addToMaps
private final static void addToMaps(PropertyCoder propCoder, int intValue, Class type, Object defaultVal, Class<? extends JmsDestinationImpl> suppressIfDefaultInJNDI) { """ addToMaps Add an entry to the PropertyMap, mapping the longName of the property to a PropertyEntry which holds everything else we need to know. Also add an entry to the reverseMap to allow us to map back from the shortName (if the is one) to the longName. @param propCoder The coder to be used for encoding & decoding this property, or null @param intValue The int for this property, to be used in case statements @param type The class of the values for this property @param defaultVal The default value for the property, or null @param suppressIfDefaultInJNDI If non-null, the class of JMS Objects for which this property should be suppressed in JNDI """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addToMaps", new Object[]{propCoder, intValue, type, defaultVal, suppressIfDefaultInJNDI}); // Extract the long & short names from the PropertyCoder. (We do this, rather than // passing them in separately, so that the names only have to be coded once). String longName = propCoder.getLongName(); String shortName = propCoder.getShortName(); // Create the PropertyEntry which holds all the information we could possibly want, & put it in the Master Poperty Map PropertyEntry propEntry = new PropertyEntry(intValue, type, defaultVal, propCoder); propertyMap.put(longName, propEntry); // Add the appropriate reverse mapping to the Reverse Map which is used for decoding if (shortName != null) { reverseMap.put(shortName, longName); } else { reverseMap.put(longName, longName); } // If this property is to suppressed in JNDI, add it to defaultJNDIProperties map if (suppressIfDefaultInJNDI != null) { Map<String,Object> map = defaultJNDIProperties.get(suppressIfDefaultInJNDI); if (map == null) { map = new HashMap<String,Object>(); defaultJNDIProperties.put(suppressIfDefaultInJNDI,map); } map.put(longName,defaultVal); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addToMaps"); }
java
private final static void addToMaps(PropertyCoder propCoder, int intValue, Class type, Object defaultVal, Class<? extends JmsDestinationImpl> suppressIfDefaultInJNDI) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addToMaps", new Object[]{propCoder, intValue, type, defaultVal, suppressIfDefaultInJNDI}); // Extract the long & short names from the PropertyCoder. (We do this, rather than // passing them in separately, so that the names only have to be coded once). String longName = propCoder.getLongName(); String shortName = propCoder.getShortName(); // Create the PropertyEntry which holds all the information we could possibly want, & put it in the Master Poperty Map PropertyEntry propEntry = new PropertyEntry(intValue, type, defaultVal, propCoder); propertyMap.put(longName, propEntry); // Add the appropriate reverse mapping to the Reverse Map which is used for decoding if (shortName != null) { reverseMap.put(shortName, longName); } else { reverseMap.put(longName, longName); } // If this property is to suppressed in JNDI, add it to defaultJNDIProperties map if (suppressIfDefaultInJNDI != null) { Map<String,Object> map = defaultJNDIProperties.get(suppressIfDefaultInJNDI); if (map == null) { map = new HashMap<String,Object>(); defaultJNDIProperties.put(suppressIfDefaultInJNDI,map); } map.put(longName,defaultVal); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addToMaps"); }
[ "private", "final", "static", "void", "addToMaps", "(", "PropertyCoder", "propCoder", ",", "int", "intValue", ",", "Class", "type", ",", "Object", "defaultVal", ",", "Class", "<", "?", "extends", "JmsDestinationImpl", ">", "suppressIfDefaultInJNDI", ")", "{", "i...
addToMaps Add an entry to the PropertyMap, mapping the longName of the property to a PropertyEntry which holds everything else we need to know. Also add an entry to the reverseMap to allow us to map back from the shortName (if the is one) to the longName. @param propCoder The coder to be used for encoding & decoding this property, or null @param intValue The int for this property, to be used in case statements @param type The class of the values for this property @param defaultVal The default value for the property, or null @param suppressIfDefaultInJNDI If non-null, the class of JMS Objects for which this property should be suppressed in JNDI
[ "addToMaps", "Add", "an", "entry", "to", "the", "PropertyMap", "mapping", "the", "longName", "of", "the", "property", "to", "a", "PropertyEntry", "which", "holds", "everything", "else", "we", "need", "to", "know", ".", "Also", "add", "an", "entry", "to", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java#L475-L507
elki-project/elki
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java
DBIDUtil.randomSample
public static DBIDs randomSample(DBIDs ids, double rate, Random random) { """ Produce a random sample of the given DBIDs. <ul> <li>values less or equal 0 mean no sampling. <li>values larger than 0, but at most 1, are relative rates. <li>values larger than 1 are supposed to be integer counts. </ul> @param ids Original ids, no duplicates allowed @param rate Sampling rate @param random Random generator @return Sample """ return rate <= 0 ? ids : // Magic for "no sampling" randomSample(ids, Math.min(ids.size(), // (int) (rate <= 1 ? rate * ids.size() : rate)), random); }
java
public static DBIDs randomSample(DBIDs ids, double rate, Random random) { return rate <= 0 ? ids : // Magic for "no sampling" randomSample(ids, Math.min(ids.size(), // (int) (rate <= 1 ? rate * ids.size() : rate)), random); }
[ "public", "static", "DBIDs", "randomSample", "(", "DBIDs", "ids", ",", "double", "rate", ",", "Random", "random", ")", "{", "return", "rate", "<=", "0", "?", "ids", ":", "// Magic for \"no sampling\"", "randomSample", "(", "ids", ",", "Math", ".", "min", "...
Produce a random sample of the given DBIDs. <ul> <li>values less or equal 0 mean no sampling. <li>values larger than 0, but at most 1, are relative rates. <li>values larger than 1 are supposed to be integer counts. </ul> @param ids Original ids, no duplicates allowed @param rate Sampling rate @param random Random generator @return Sample
[ "Produce", "a", "random", "sample", "of", "the", "given", "DBIDs", ".", "<ul", ">", "<li", ">", "values", "less", "or", "equal", "0", "mean", "no", "sampling", ".", "<li", ">", "values", "larger", "than", "0", "but", "at", "most", "1", "are", "relati...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L701-L705
voldemort/voldemort
src/java/voldemort/utils/ExceptionUtils.java
ExceptionUtils.recursiveClassEquals
public static boolean recursiveClassEquals(Throwable throwableToInspect, Class... throwableClassesToLookFor) { """ Inspects a given {@link Throwable} as well as its nested causes, in order to look for a specific set of exception classes. The function also detects if the throwable to inspect is a subclass of one of the classes you look for, but not the other way around (i.e.: if you're looking for the subclass but the throwableToInspect is the parent class, then this function returns false). @return true if a the throwableToInspect corresponds to or is caused by any of the throwableClassesToLookFor """ for (Class clazz: throwableClassesToLookFor) { Class classToInspect = throwableToInspect.getClass(); while (classToInspect != null) { if (classToInspect.equals(clazz)) { return true; } classToInspect = classToInspect.getSuperclass(); } } Throwable cause = throwableToInspect.getCause(); return cause != null && recursiveClassEquals(cause, throwableClassesToLookFor); }
java
public static boolean recursiveClassEquals(Throwable throwableToInspect, Class... throwableClassesToLookFor) { for (Class clazz: throwableClassesToLookFor) { Class classToInspect = throwableToInspect.getClass(); while (classToInspect != null) { if (classToInspect.equals(clazz)) { return true; } classToInspect = classToInspect.getSuperclass(); } } Throwable cause = throwableToInspect.getCause(); return cause != null && recursiveClassEquals(cause, throwableClassesToLookFor); }
[ "public", "static", "boolean", "recursiveClassEquals", "(", "Throwable", "throwableToInspect", ",", "Class", "...", "throwableClassesToLookFor", ")", "{", "for", "(", "Class", "clazz", ":", "throwableClassesToLookFor", ")", "{", "Class", "classToInspect", "=", "throwa...
Inspects a given {@link Throwable} as well as its nested causes, in order to look for a specific set of exception classes. The function also detects if the throwable to inspect is a subclass of one of the classes you look for, but not the other way around (i.e.: if you're looking for the subclass but the throwableToInspect is the parent class, then this function returns false). @return true if a the throwableToInspect corresponds to or is caused by any of the throwableClassesToLookFor
[ "Inspects", "a", "given", "{", "@link", "Throwable", "}", "as", "well", "as", "its", "nested", "causes", "in", "order", "to", "look", "for", "a", "specific", "set", "of", "exception", "classes", ".", "The", "function", "also", "detects", "if", "the", "th...
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/ExceptionUtils.java#L23-L35
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/OptionsApi.java
OptionsApi.optionsGet
public OptionsGetResponseSuccess optionsGet(String personDbid, String agentGroupDbid) throws ApiException { """ Receive exist options. The GET operation will fetch CloudCluster/Options and merges it with person and sgent groups annexes. @param personDbid DBID of a person. Options will be merged with the Person&#39;s annex and annexes of it&#39;s agent groups. Mutual with agent_group_dbid. (optional) @param agentGroupDbid DBID of a person. Options will be merged with the Agent Groups&#39;s annex. Mutual with person_dbid. (optional) @return OptionsGetResponseSuccess @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<OptionsGetResponseSuccess> resp = optionsGetWithHttpInfo(personDbid, agentGroupDbid); return resp.getData(); }
java
public OptionsGetResponseSuccess optionsGet(String personDbid, String agentGroupDbid) throws ApiException { ApiResponse<OptionsGetResponseSuccess> resp = optionsGetWithHttpInfo(personDbid, agentGroupDbid); return resp.getData(); }
[ "public", "OptionsGetResponseSuccess", "optionsGet", "(", "String", "personDbid", ",", "String", "agentGroupDbid", ")", "throws", "ApiException", "{", "ApiResponse", "<", "OptionsGetResponseSuccess", ">", "resp", "=", "optionsGetWithHttpInfo", "(", "personDbid", ",", "a...
Receive exist options. The GET operation will fetch CloudCluster/Options and merges it with person and sgent groups annexes. @param personDbid DBID of a person. Options will be merged with the Person&#39;s annex and annexes of it&#39;s agent groups. Mutual with agent_group_dbid. (optional) @param agentGroupDbid DBID of a person. Options will be merged with the Agent Groups&#39;s annex. Mutual with person_dbid. (optional) @return OptionsGetResponseSuccess @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Receive", "exist", "options", ".", "The", "GET", "operation", "will", "fetch", "CloudCluster", "/", "Options", "and", "merges", "it", "with", "person", "and", "sgent", "groups", "annexes", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/OptionsApi.java#L135-L138
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.downloadUpdates
public void downloadUpdates(String deviceName, String resourceGroupName) { """ Downloads the updates on a data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ downloadUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().last().body(); }
java
public void downloadUpdates(String deviceName, String resourceGroupName) { downloadUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().last().body(); }
[ "public", "void", "downloadUpdates", "(", "String", "deviceName", ",", "String", "resourceGroupName", ")", "{", "downloadUpdatesWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "b...
Downloads the updates on a data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Downloads", "the", "updates", "on", "a", "data", "box", "edge", "/", "gateway", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1202-L1204
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/Stream.java
Stream.distinctBy
public <K> Stream<T> distinctBy(final Function<? super T, K> keyMapper, final Predicate<? super Long> occurrencesFilter) { """ Distinct and filter by occurrences. @param keyMapper @param occurrencesFilter @return """ final Supplier<? extends Map<Keyed<K, T>, Long>> supplier = isParallel() ? Suppliers.<Keyed<K, T>, Long> ofConcurrentHashMap() : Suppliers.<Keyed<K, T>, Long> ofLinkedHashMap(); return groupBy(Fn.<K, T> keyed(keyMapper), Collectors.counting(), supplier).filter(Fn.<Keyed<K, T>, Long> testByValue(occurrencesFilter)) .map(Fn.<T, K, Long> kk()); }
java
public <K> Stream<T> distinctBy(final Function<? super T, K> keyMapper, final Predicate<? super Long> occurrencesFilter) { final Supplier<? extends Map<Keyed<K, T>, Long>> supplier = isParallel() ? Suppliers.<Keyed<K, T>, Long> ofConcurrentHashMap() : Suppliers.<Keyed<K, T>, Long> ofLinkedHashMap(); return groupBy(Fn.<K, T> keyed(keyMapper), Collectors.counting(), supplier).filter(Fn.<Keyed<K, T>, Long> testByValue(occurrencesFilter)) .map(Fn.<T, K, Long> kk()); }
[ "public", "<", "K", ">", "Stream", "<", "T", ">", "distinctBy", "(", "final", "Function", "<", "?", "super", "T", ",", "K", ">", "keyMapper", ",", "final", "Predicate", "<", "?", "super", "Long", ">", "occurrencesFilter", ")", "{", "final", "Supplier",...
Distinct and filter by occurrences. @param keyMapper @param occurrencesFilter @return
[ "Distinct", "and", "filter", "by", "occurrences", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Stream.java#L1134-L1140
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/lang/AtomicBiInteger.java
AtomicBiInteger.compareAndSet
public boolean compareAndSet(long encoded, int hi, int lo) { """ Atomically sets the values to the given updated values only if the current encoded value {@code ==} the expected encoded value. @param encoded the expected encoded value @param hi the new hi value @param lo the new lo value @return {@code true} if successful. False return indicates that the actual encoded value was not equal to the expected encoded value. """ long update = encode(hi, lo); return compareAndSet(encoded, update); }
java
public boolean compareAndSet(long encoded, int hi, int lo) { long update = encode(hi, lo); return compareAndSet(encoded, update); }
[ "public", "boolean", "compareAndSet", "(", "long", "encoded", ",", "int", "hi", ",", "int", "lo", ")", "{", "long", "update", "=", "encode", "(", "hi", ",", "lo", ")", ";", "return", "compareAndSet", "(", "encoded", ",", "update", ")", ";", "}" ]
Atomically sets the values to the given updated values only if the current encoded value {@code ==} the expected encoded value. @param encoded the expected encoded value @param hi the new hi value @param lo the new lo value @return {@code true} if successful. False return indicates that the actual encoded value was not equal to the expected encoded value.
[ "Atomically", "sets", "the", "values", "to", "the", "given", "updated", "values", "only", "if", "the", "current", "encoded", "value", "{", "@code", "==", "}", "the", "expected", "encoded", "value", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/AtomicBiInteger.java#L115-L118
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/io/DynamicOutputBuffer.java
DynamicOutputBuffer.putString
public void putString(int pos, CharSequence s) { """ Puts a character sequence into the buffer at the given position. Does not increase the write position. @param pos the position where to put the character sequence @param s the character sequence to put """ for (int i = 0; i < s.length(); ++i) { char c = s.charAt(i); byte b0 = (byte)c; byte b1 = (byte)(c >> 8); if (_order == ByteOrder.BIG_ENDIAN) { putBytes(pos, b1, b0); } else { putBytes(pos, b0, b1); } pos += 2; } }
java
public void putString(int pos, CharSequence s) { for (int i = 0; i < s.length(); ++i) { char c = s.charAt(i); byte b0 = (byte)c; byte b1 = (byte)(c >> 8); if (_order == ByteOrder.BIG_ENDIAN) { putBytes(pos, b1, b0); } else { putBytes(pos, b0, b1); } pos += 2; } }
[ "public", "void", "putString", "(", "int", "pos", ",", "CharSequence", "s", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "++", "i", ")", "{", "char", "c", "=", "s", ".", "charAt", "(", "i", "...
Puts a character sequence into the buffer at the given position. Does not increase the write position. @param pos the position where to put the character sequence @param s the character sequence to put
[ "Puts", "a", "character", "sequence", "into", "the", "buffer", "at", "the", "given", "position", ".", "Does", "not", "increase", "the", "write", "position", "." ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/io/DynamicOutputBuffer.java#L509-L521
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java
PathUtils.addExtension
public static Path addExtension(Path path, String... extensions) { """ Suffix all <code>extensions</code> to <code>path</code>. <pre> PathUtils.addExtension("/tmp/data/file", ".txt") = file.txt PathUtils.addExtension("/tmp/data/file.txt.gpg", ".zip") = file.txt.gpg.zip PathUtils.addExtension("/tmp/data/file.txt", ".tar", ".gz") = file.txt.tar.gz PathUtils.addExtension("/tmp/data/file.txt.gpg", ".tar.txt") = file.txt.gpg.tar.txt </pre> @param path to which the <code>extensions</code> need to be added @param extensions to be added @return a new {@link Path} with <code>extensions</code> """ StringBuilder pathStringBuilder = new StringBuilder(path.toString()); for (String extension : extensions) { if (!Strings.isNullOrEmpty(extension)) { pathStringBuilder.append(extension); } } return new Path(pathStringBuilder.toString()); }
java
public static Path addExtension(Path path, String... extensions) { StringBuilder pathStringBuilder = new StringBuilder(path.toString()); for (String extension : extensions) { if (!Strings.isNullOrEmpty(extension)) { pathStringBuilder.append(extension); } } return new Path(pathStringBuilder.toString()); }
[ "public", "static", "Path", "addExtension", "(", "Path", "path", ",", "String", "...", "extensions", ")", "{", "StringBuilder", "pathStringBuilder", "=", "new", "StringBuilder", "(", "path", ".", "toString", "(", ")", ")", ";", "for", "(", "String", "extensi...
Suffix all <code>extensions</code> to <code>path</code>. <pre> PathUtils.addExtension("/tmp/data/file", ".txt") = file.txt PathUtils.addExtension("/tmp/data/file.txt.gpg", ".zip") = file.txt.gpg.zip PathUtils.addExtension("/tmp/data/file.txt", ".tar", ".gz") = file.txt.tar.gz PathUtils.addExtension("/tmp/data/file.txt.gpg", ".tar.txt") = file.txt.gpg.tar.txt </pre> @param path to which the <code>extensions</code> need to be added @param extensions to be added @return a new {@link Path} with <code>extensions</code>
[ "Suffix", "all", "<code", ">", "extensions<", "/", "code", ">", "to", "<code", ">", "path<", "/", "code", ">", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java#L151-L159
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java
SerializationUtils.fromJsonString
public static Object fromJsonString(String jsonString, ClassLoader classLoader) { """ Deserialize a JSON string, with custom class loader. @param jsonString @param classLoader @return """ return fromJsonString(jsonString, Object.class, classLoader); }
java
public static Object fromJsonString(String jsonString, ClassLoader classLoader) { return fromJsonString(jsonString, Object.class, classLoader); }
[ "public", "static", "Object", "fromJsonString", "(", "String", "jsonString", ",", "ClassLoader", "classLoader", ")", "{", "return", "fromJsonString", "(", "jsonString", ",", "Object", ".", "class", ",", "classLoader", ")", ";", "}" ]
Deserialize a JSON string, with custom class loader. @param jsonString @param classLoader @return
[ "Deserialize", "a", "JSON", "string", "with", "custom", "class", "loader", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java#L635-L637
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java
HystrixPropertiesFactory.getCollapserProperties
public static HystrixCollapserProperties getCollapserProperties(HystrixCollapserKey key, HystrixCollapserProperties.Setter builder) { """ Get an instance of {@link HystrixCollapserProperties} with the given factory {@link HystrixPropertiesStrategy} implementation for each {@link HystrixCollapserKey} instance. @param key Pass-thru to {@link HystrixPropertiesStrategy#getCollapserProperties} implementation. @param builder Pass-thru to {@link HystrixPropertiesStrategy#getCollapserProperties} implementation. @return {@link HystrixCollapserProperties} instance """ HystrixPropertiesStrategy hystrixPropertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); String cacheKey = hystrixPropertiesStrategy.getCollapserPropertiesCacheKey(key, builder); if (cacheKey != null) { HystrixCollapserProperties properties = collapserProperties.get(cacheKey); if (properties != null) { return properties; } else { if (builder == null) { builder = HystrixCollapserProperties.Setter(); } // create new instance properties = hystrixPropertiesStrategy.getCollapserProperties(key, builder); // cache and return HystrixCollapserProperties existing = collapserProperties.putIfAbsent(cacheKey, properties); if (existing == null) { return properties; } else { return existing; } } } else { // no cacheKey so we generate it with caching return hystrixPropertiesStrategy.getCollapserProperties(key, builder); } }
java
public static HystrixCollapserProperties getCollapserProperties(HystrixCollapserKey key, HystrixCollapserProperties.Setter builder) { HystrixPropertiesStrategy hystrixPropertiesStrategy = HystrixPlugins.getInstance().getPropertiesStrategy(); String cacheKey = hystrixPropertiesStrategy.getCollapserPropertiesCacheKey(key, builder); if (cacheKey != null) { HystrixCollapserProperties properties = collapserProperties.get(cacheKey); if (properties != null) { return properties; } else { if (builder == null) { builder = HystrixCollapserProperties.Setter(); } // create new instance properties = hystrixPropertiesStrategy.getCollapserProperties(key, builder); // cache and return HystrixCollapserProperties existing = collapserProperties.putIfAbsent(cacheKey, properties); if (existing == null) { return properties; } else { return existing; } } } else { // no cacheKey so we generate it with caching return hystrixPropertiesStrategy.getCollapserProperties(key, builder); } }
[ "public", "static", "HystrixCollapserProperties", "getCollapserProperties", "(", "HystrixCollapserKey", "key", ",", "HystrixCollapserProperties", ".", "Setter", "builder", ")", "{", "HystrixPropertiesStrategy", "hystrixPropertiesStrategy", "=", "HystrixPlugins", ".", "getInstan...
Get an instance of {@link HystrixCollapserProperties} with the given factory {@link HystrixPropertiesStrategy} implementation for each {@link HystrixCollapserKey} instance. @param key Pass-thru to {@link HystrixPropertiesStrategy#getCollapserProperties} implementation. @param builder Pass-thru to {@link HystrixPropertiesStrategy#getCollapserProperties} implementation. @return {@link HystrixCollapserProperties} instance
[ "Get", "an", "instance", "of", "{", "@link", "HystrixCollapserProperties", "}", "with", "the", "given", "factory", "{", "@link", "HystrixPropertiesStrategy", "}", "implementation", "for", "each", "{", "@link", "HystrixCollapserKey", "}", "instance", "." ]
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesFactory.java#L139-L164
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AssertSoapFaultBuilder.java
AssertSoapFaultBuilder.faultDetailResource
public AssertSoapFaultBuilder faultDetailResource(Resource resource, Charset charset) { """ Expect fault detail from file resource. @param resource @param charset @return """ try { action.getFaultDetails().add(FileUtils.readToString(resource, charset)); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read fault detail resource", e); } return this; }
java
public AssertSoapFaultBuilder faultDetailResource(Resource resource, Charset charset) { try { action.getFaultDetails().add(FileUtils.readToString(resource, charset)); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read fault detail resource", e); } return this; }
[ "public", "AssertSoapFaultBuilder", "faultDetailResource", "(", "Resource", "resource", ",", "Charset", "charset", ")", "{", "try", "{", "action", ".", "getFaultDetails", "(", ")", ".", "add", "(", "FileUtils", ".", "readToString", "(", "resource", ",", "charset...
Expect fault detail from file resource. @param resource @param charset @return
[ "Expect", "fault", "detail", "from", "file", "resource", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AssertSoapFaultBuilder.java#L140-L147
classgraph/classgraph
src/main/java/io/github/classgraph/PackageInfo.java
PackageInfo.getClassInfoRecursive
public ClassInfoList getClassInfoRecursive() { """ Get the {@link ClassInfo} objects for all classes that are members of this package or a sub-package. @return the the {@link ClassInfo} objects for all classes that are members of this package or a sub-package. """ final Set<ClassInfo> reachableClassInfo = new HashSet<>(); obtainClassInfoRecursive(reachableClassInfo); return new ClassInfoList(reachableClassInfo, /* sortByName = */ true); }
java
public ClassInfoList getClassInfoRecursive() { final Set<ClassInfo> reachableClassInfo = new HashSet<>(); obtainClassInfoRecursive(reachableClassInfo); return new ClassInfoList(reachableClassInfo, /* sortByName = */ true); }
[ "public", "ClassInfoList", "getClassInfoRecursive", "(", ")", "{", "final", "Set", "<", "ClassInfo", ">", "reachableClassInfo", "=", "new", "HashSet", "<>", "(", ")", ";", "obtainClassInfoRecursive", "(", "reachableClassInfo", ")", ";", "return", "new", "ClassInfo...
Get the {@link ClassInfo} objects for all classes that are members of this package or a sub-package. @return the the {@link ClassInfo} objects for all classes that are members of this package or a sub-package.
[ "Get", "the", "{", "@link", "ClassInfo", "}", "objects", "for", "all", "classes", "that", "are", "members", "of", "this", "package", "or", "a", "sub", "-", "package", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/PackageInfo.java#L223-L227
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.publishUpdated
public void publishUpdated(Cache<K, V> cache, K key, V oldValue, V newValue) { """ Publishes a update event for the entry to all of the interested listeners. @param cache the cache where the entry was updated @param key the entry's key @param oldValue the entry's old value @param newValue the entry's new value """ publish(cache, EventType.UPDATED, key, oldValue, newValue, /* quiet */ false); }
java
public void publishUpdated(Cache<K, V> cache, K key, V oldValue, V newValue) { publish(cache, EventType.UPDATED, key, oldValue, newValue, /* quiet */ false); }
[ "public", "void", "publishUpdated", "(", "Cache", "<", "K", ",", "V", ">", "cache", ",", "K", "key", ",", "V", "oldValue", ",", "V", "newValue", ")", "{", "publish", "(", "cache", ",", "EventType", ".", "UPDATED", ",", "key", ",", "oldValue", ",", ...
Publishes a update event for the entry to all of the interested listeners. @param cache the cache where the entry was updated @param key the entry's key @param oldValue the entry's old value @param newValue the entry's new value
[ "Publishes", "a", "update", "event", "for", "the", "entry", "to", "all", "of", "the", "interested", "listeners", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L125-L127
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java
VCard.setField
public void setField(String field, String value, boolean isUnescapable) { """ Set generic, unescapable VCard field. If unescapable is set to true, XML maybe a part of the value. @param value value of field @param field field to set. See {@link #getField(String)} @param isUnescapable True if the value should not be escaped, and false if it should. """ if (!isUnescapable) { otherSimpleFields.put(field, value); } else { otherUnescapableFields.put(field, value); } }
java
public void setField(String field, String value, boolean isUnescapable) { if (!isUnescapable) { otherSimpleFields.put(field, value); } else { otherUnescapableFields.put(field, value); } }
[ "public", "void", "setField", "(", "String", "field", ",", "String", "value", ",", "boolean", "isUnescapable", ")", "{", "if", "(", "!", "isUnescapable", ")", "{", "otherSimpleFields", ".", "put", "(", "field", ",", "value", ")", ";", "}", "else", "{", ...
Set generic, unescapable VCard field. If unescapable is set to true, XML maybe a part of the value. @param value value of field @param field field to set. See {@link #getField(String)} @param isUnescapable True if the value should not be escaped, and false if it should.
[ "Set", "generic", "unescapable", "VCard", "field", ".", "If", "unescapable", "is", "set", "to", "true", "XML", "maybe", "a", "part", "of", "the", "value", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/vcardtemp/packet/VCard.java#L167-L174
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/core/BridgeMethodResolver.java
BridgeMethodResolver.searchCandidates
private static Method searchCandidates(List<Method> candidateMethods, Method bridgeMethod) { """ Searches for the bridged method in the given candidates. @param candidateMethods the List of candidate Methods @param bridgeMethod the bridge method @return the bridged method, or {@code null} if none found """ if (candidateMethods.isEmpty()) { return null; } Map<TypeVariable, Type> typeParameterMap = GenericTypeResolver.getTypeVariableMap(bridgeMethod.getDeclaringClass()); Method previousMethod = null; boolean sameSig = true; for (Method candidateMethod : candidateMethods) { if (isBridgeMethodFor(bridgeMethod, candidateMethod, typeParameterMap)) { return candidateMethod; } else if (previousMethod != null) { sameSig = sameSig && Arrays.equals(candidateMethod.getGenericParameterTypes(), previousMethod.getGenericParameterTypes()); } previousMethod = candidateMethod; } return (sameSig ? candidateMethods.get(0) : null); }
java
private static Method searchCandidates(List<Method> candidateMethods, Method bridgeMethod) { if (candidateMethods.isEmpty()) { return null; } Map<TypeVariable, Type> typeParameterMap = GenericTypeResolver.getTypeVariableMap(bridgeMethod.getDeclaringClass()); Method previousMethod = null; boolean sameSig = true; for (Method candidateMethod : candidateMethods) { if (isBridgeMethodFor(bridgeMethod, candidateMethod, typeParameterMap)) { return candidateMethod; } else if (previousMethod != null) { sameSig = sameSig && Arrays.equals(candidateMethod.getGenericParameterTypes(), previousMethod.getGenericParameterTypes()); } previousMethod = candidateMethod; } return (sameSig ? candidateMethods.get(0) : null); }
[ "private", "static", "Method", "searchCandidates", "(", "List", "<", "Method", ">", "candidateMethods", ",", "Method", "bridgeMethod", ")", "{", "if", "(", "candidateMethods", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "Map", "<", "Typ...
Searches for the bridged method in the given candidates. @param candidateMethods the List of candidate Methods @param bridgeMethod the bridge method @return the bridged method, or {@code null} if none found
[ "Searches", "for", "the", "bridged", "method", "in", "the", "given", "candidates", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/core/BridgeMethodResolver.java#L95-L113
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.deleteSasDefinitionAsync
public ServiceFuture<DeletedSasDefinitionBundle> deleteSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, final ServiceCallback<DeletedSasDefinitionBundle> serviceCallback) { """ Deletes a SAS definition from a specified storage account. This operation requires the storage/deletesas permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param sasDefinitionName The name of the SAS definition. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(deleteSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName), serviceCallback); }
java
public ServiceFuture<DeletedSasDefinitionBundle> deleteSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, final ServiceCallback<DeletedSasDefinitionBundle> serviceCallback) { return ServiceFuture.fromResponse(deleteSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName), serviceCallback); }
[ "public", "ServiceFuture", "<", "DeletedSasDefinitionBundle", ">", "deleteSasDefinitionAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "String", "sasDefinitionName", ",", "final", "ServiceCallback", "<", "DeletedSasDefinitionBundle", ">", "s...
Deletes a SAS definition from a specified storage account. This operation requires the storage/deletesas permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param sasDefinitionName The name of the SAS definition. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Deletes", "a", "SAS", "definition", "from", "a", "specified", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "deletesas", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L11083-L11085
actorapp/actor-platform
actor-keygen/src/main/java/im/actor/keygen/Curve25519.java
Curve25519.keyGen
public static Curve25519KeyPair keyGen(byte[] randomBytes) throws NoSuchAlgorithmException, DigestException { """ Generating KeyPair @param randomBytes 32 random bytes @return generated key pair """ byte[] privateKey = keyGenPrivate(randomBytes); byte[] publicKey = keyGenPublic(privateKey); return new Curve25519KeyPair(publicKey, privateKey); }
java
public static Curve25519KeyPair keyGen(byte[] randomBytes) throws NoSuchAlgorithmException, DigestException { byte[] privateKey = keyGenPrivate(randomBytes); byte[] publicKey = keyGenPublic(privateKey); return new Curve25519KeyPair(publicKey, privateKey); }
[ "public", "static", "Curve25519KeyPair", "keyGen", "(", "byte", "[", "]", "randomBytes", ")", "throws", "NoSuchAlgorithmException", ",", "DigestException", "{", "byte", "[", "]", "privateKey", "=", "keyGenPrivate", "(", "randomBytes", ")", ";", "byte", "[", "]",...
Generating KeyPair @param randomBytes 32 random bytes @return generated key pair
[ "Generating", "KeyPair" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-keygen/src/main/java/im/actor/keygen/Curve25519.java#L17-L21
google/Accessibility-Test-Framework-for-Android
src/main/java/com/googlecode/eyesfree/utils/WebInterfaceUtils.java
WebInterfaceUtils.setSpecialContentModeEnabled
public static boolean setSpecialContentModeEnabled( AccessibilityNodeInfoCompat node, boolean enabled) { """ Sends a message to ChromeVox indicating that it should enter or exit special content navigation. This is applicable for things like tables and math expressions. <p> NOTE: further navigation should occur at the default movement granularity. @param node The node representing the web content @param enabled Whether this mode should be entered or exited @return {@code true} if the action was performed, {@code false} otherwise. """ final int direction = (enabled) ? DIRECTION_FORWARD : DIRECTION_BACKWARD; return performSpecialAction(node, ACTION_TOGGLE_SPECIAL_CONTENT, direction); }
java
public static boolean setSpecialContentModeEnabled( AccessibilityNodeInfoCompat node, boolean enabled) { final int direction = (enabled) ? DIRECTION_FORWARD : DIRECTION_BACKWARD; return performSpecialAction(node, ACTION_TOGGLE_SPECIAL_CONTENT, direction); }
[ "public", "static", "boolean", "setSpecialContentModeEnabled", "(", "AccessibilityNodeInfoCompat", "node", ",", "boolean", "enabled", ")", "{", "final", "int", "direction", "=", "(", "enabled", ")", "?", "DIRECTION_FORWARD", ":", "DIRECTION_BACKWARD", ";", "return", ...
Sends a message to ChromeVox indicating that it should enter or exit special content navigation. This is applicable for things like tables and math expressions. <p> NOTE: further navigation should occur at the default movement granularity. @param node The node representing the web content @param enabled Whether this mode should be entered or exited @return {@code true} if the action was performed, {@code false} otherwise.
[ "Sends", "a", "message", "to", "ChromeVox", "indicating", "that", "it", "should", "enter", "or", "exit", "special", "content", "navigation", ".", "This", "is", "applicable", "for", "things", "like", "tables", "and", "math", "expressions", ".", "<p", ">", "NO...
train
https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/WebInterfaceUtils.java#L251-L255
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.parseExecutionListenersOnScope
public void parseExecutionListenersOnScope(Element scopeElement, ScopeImpl scope) { """ Parses all execution-listeners on a scope. @param scopeElement the XML element containing the scope definition. @param scope the scope to add the executionListeners to. """ Element extentionsElement = scopeElement.element("extensionElements"); if (extentionsElement != null) { List<Element> listenerElements = extentionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, "executionListener"); for (Element listenerElement : listenerElements) { String eventName = listenerElement.attribute("event"); if (isValidEventNameForScope(eventName, listenerElement)) { ExecutionListener listener = parseExecutionListener(listenerElement); if (listener != null) { scope.addExecutionListener(eventName, listener); } } } } }
java
public void parseExecutionListenersOnScope(Element scopeElement, ScopeImpl scope) { Element extentionsElement = scopeElement.element("extensionElements"); if (extentionsElement != null) { List<Element> listenerElements = extentionsElement.elementsNS(CAMUNDA_BPMN_EXTENSIONS_NS, "executionListener"); for (Element listenerElement : listenerElements) { String eventName = listenerElement.attribute("event"); if (isValidEventNameForScope(eventName, listenerElement)) { ExecutionListener listener = parseExecutionListener(listenerElement); if (listener != null) { scope.addExecutionListener(eventName, listener); } } } } }
[ "public", "void", "parseExecutionListenersOnScope", "(", "Element", "scopeElement", ",", "ScopeImpl", "scope", ")", "{", "Element", "extentionsElement", "=", "scopeElement", ".", "element", "(", "\"extensionElements\"", ")", ";", "if", "(", "extentionsElement", "!=", ...
Parses all execution-listeners on a scope. @param scopeElement the XML element containing the scope definition. @param scope the scope to add the executionListeners to.
[ "Parses", "all", "execution", "-", "listeners", "on", "a", "scope", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L4112-L4126
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java
OmemoService.getMuc
private static MultiUserChat getMuc(XMPPConnection connection, Jid jid) { """ Return the joined MUC with EntityBareJid jid, or null if its not a room and/or not joined. @param connection xmpp connection @param jid jid (presumably) of the MUC @return MultiUserChat or null if not a MUC. """ EntityBareJid ebj = jid.asEntityBareJidIfPossible(); if (ebj == null) { return null; } MultiUserChatManager mucm = MultiUserChatManager.getInstanceFor(connection); Set<EntityBareJid> joinedRooms = mucm.getJoinedRooms(); if (joinedRooms.contains(ebj)) { return mucm.getMultiUserChat(ebj); } return null; }
java
private static MultiUserChat getMuc(XMPPConnection connection, Jid jid) { EntityBareJid ebj = jid.asEntityBareJidIfPossible(); if (ebj == null) { return null; } MultiUserChatManager mucm = MultiUserChatManager.getInstanceFor(connection); Set<EntityBareJid> joinedRooms = mucm.getJoinedRooms(); if (joinedRooms.contains(ebj)) { return mucm.getMultiUserChat(ebj); } return null; }
[ "private", "static", "MultiUserChat", "getMuc", "(", "XMPPConnection", "connection", ",", "Jid", "jid", ")", "{", "EntityBareJid", "ebj", "=", "jid", ".", "asEntityBareJidIfPossible", "(", ")", ";", "if", "(", "ebj", "==", "null", ")", "{", "return", "null",...
Return the joined MUC with EntityBareJid jid, or null if its not a room and/or not joined. @param connection xmpp connection @param jid jid (presumably) of the MUC @return MultiUserChat or null if not a MUC.
[ "Return", "the", "joined", "MUC", "with", "EntityBareJid", "jid", "or", "null", "if", "its", "not", "a", "room", "and", "/", "or", "not", "joined", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java#L1336-L1349
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressGridFragment.java
ProgressGridFragment.onViewCreated
@Override public void onViewCreated(View view, Bundle savedInstanceState) { """ Attach to grid view once the view hierarchy has been created. """ super.onViewCreated(view, savedInstanceState); ensureList(); }
java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ensureList(); }
[ "@", "Override", "public", "void", "onViewCreated", "(", "View", "view", ",", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onViewCreated", "(", "view", ",", "savedInstanceState", ")", ";", "ensureList", "(", ")", ";", "}" ]
Attach to grid view once the view hierarchy has been created.
[ "Attach", "to", "grid", "view", "once", "the", "view", "hierarchy", "has", "been", "created", "." ]
train
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressGridFragment.java#L85-L89
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java
CommonOps_DDF4.fill
public static void fill( DMatrix4x4 a , double v ) { """ <p> Sets every element in the matrix to the specified value.<br> <br> a<sub>ij</sub> = value <p> @param a A matrix whose elements are about to be set. Modified. @param v The value each element will have. """ a.a11 = v; a.a12 = v; a.a13 = v; a.a14 = v; a.a21 = v; a.a22 = v; a.a23 = v; a.a24 = v; a.a31 = v; a.a32 = v; a.a33 = v; a.a34 = v; a.a41 = v; a.a42 = v; a.a43 = v; a.a44 = v; }
java
public static void fill( DMatrix4x4 a , double v ) { a.a11 = v; a.a12 = v; a.a13 = v; a.a14 = v; a.a21 = v; a.a22 = v; a.a23 = v; a.a24 = v; a.a31 = v; a.a32 = v; a.a33 = v; a.a34 = v; a.a41 = v; a.a42 = v; a.a43 = v; a.a44 = v; }
[ "public", "static", "void", "fill", "(", "DMatrix4x4", "a", ",", "double", "v", ")", "{", "a", ".", "a11", "=", "v", ";", "a", ".", "a12", "=", "v", ";", "a", ".", "a13", "=", "v", ";", "a", ".", "a14", "=", "v", ";", "a", ".", "a21", "="...
<p> Sets every element in the matrix to the specified value.<br> <br> a<sub>ij</sub> = value <p> @param a A matrix whose elements are about to be set. Modified. @param v The value each element will have.
[ "<p", ">", "Sets", "every", "element", "in", "the", "matrix", "to", "the", "specified", "value", ".", "<br", ">", "<br", ">", "a<sub", ">", "ij<", "/", "sub", ">", "=", "value", "<p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF4.java#L1592-L1597
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java
StringUtils.ifNotEmptyAppend
public static String ifNotEmptyAppend(String chekString, String value) { """ <p> If <code>checkString</code> has text, returns value+checkString. Otherwise empty string was returned </p> @param chekString the chek string @param value the value @return the string """ if (hasText(chekString)) { return value+chekString; } else { return ""; } }
java
public static String ifNotEmptyAppend(String chekString, String value) { if (hasText(chekString)) { return value+chekString; } else { return ""; } }
[ "public", "static", "String", "ifNotEmptyAppend", "(", "String", "chekString", ",", "String", "value", ")", "{", "if", "(", "hasText", "(", "chekString", ")", ")", "{", "return", "value", "+", "chekString", ";", "}", "else", "{", "return", "\"\"", ";", "...
<p> If <code>checkString</code> has text, returns value+checkString. Otherwise empty string was returned </p> @param chekString the chek string @param value the value @return the string
[ "<p", ">", "If", "<code", ">", "checkString<", "/", "code", ">", "has", "text", "returns", "value", "+", "checkString", ".", "Otherwise", "empty", "string", "was", "returned", "<", "/", "p", ">" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java#L249-L255
ebean-orm/ebean-querybean
src/main/java/io/ebean/typequery/TQRootBean.java
TQRootBean.textCommonTerms
public R textCommonTerms(String query, TextCommonTerms options) { """ Add a Text common terms expression (document store only). <p> This automatically makes the query a document store query. </p> """ peekExprList().textCommonTerms(query, options); return root; }
java
public R textCommonTerms(String query, TextCommonTerms options) { peekExprList().textCommonTerms(query, options); return root; }
[ "public", "R", "textCommonTerms", "(", "String", "query", ",", "TextCommonTerms", "options", ")", "{", "peekExprList", "(", ")", ".", "textCommonTerms", "(", "query", ",", "options", ")", ";", "return", "root", ";", "}" ]
Add a Text common terms expression (document store only). <p> This automatically makes the query a document store query. </p>
[ "Add", "a", "Text", "common", "terms", "expression", "(", "document", "store", "only", ")", ".", "<p", ">", "This", "automatically", "makes", "the", "query", "a", "document", "store", "query", ".", "<", "/", "p", ">" ]
train
https://github.com/ebean-orm/ebean-querybean/blob/821650cb817c9c0fdcc97f93408dc79170b12423/src/main/java/io/ebean/typequery/TQRootBean.java#L1399-L1402
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java
RequestUtils.wrapBasicAuthentication
public static HttpHandler wrapBasicAuthentication(HttpHandler httpHandler, String username, String password) { """ Adds a Wrapper to the handler when the request requires authentication @param httpHandler The Handler to wrap @param username The username to use @param password The password to use @return An HttpHandler wrapped through BasicAuthentication """ Objects.requireNonNull(httpHandler, Required.HTTP_HANDLER.toString()); Objects.requireNonNull(username, Required.USERNAME.toString()); Objects.requireNonNull(password, Required.PASSWORD.toString()); HttpHandler wrap = new AuthenticationCallHandler(httpHandler); wrap = new AuthenticationConstraintHandler(wrap); wrap = new AuthenticationMechanismsHandler(wrap, Collections.<AuthenticationMechanism>singletonList(new BasicAuthenticationMechanism("Authentication required"))); return new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, new Identity(username, password), wrap); }
java
public static HttpHandler wrapBasicAuthentication(HttpHandler httpHandler, String username, String password) { Objects.requireNonNull(httpHandler, Required.HTTP_HANDLER.toString()); Objects.requireNonNull(username, Required.USERNAME.toString()); Objects.requireNonNull(password, Required.PASSWORD.toString()); HttpHandler wrap = new AuthenticationCallHandler(httpHandler); wrap = new AuthenticationConstraintHandler(wrap); wrap = new AuthenticationMechanismsHandler(wrap, Collections.<AuthenticationMechanism>singletonList(new BasicAuthenticationMechanism("Authentication required"))); return new SecurityInitialHandler(AuthenticationMode.PRO_ACTIVE, new Identity(username, password), wrap); }
[ "public", "static", "HttpHandler", "wrapBasicAuthentication", "(", "HttpHandler", "httpHandler", ",", "String", "username", ",", "String", "password", ")", "{", "Objects", ".", "requireNonNull", "(", "httpHandler", ",", "Required", ".", "HTTP_HANDLER", ".", "toStrin...
Adds a Wrapper to the handler when the request requires authentication @param httpHandler The Handler to wrap @param username The username to use @param password The password to use @return An HttpHandler wrapped through BasicAuthentication
[ "Adds", "a", "Wrapper", "to", "the", "handler", "when", "the", "request", "requires", "authentication" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/RequestUtils.java#L211-L221
RKumsher/utils
src/main/java/com/github/rkumsher/date/RandomDateUtils.java
RandomDateUtils.randomMonthDayBefore
public static MonthDay randomMonthDayBefore(MonthDay before, boolean includeLeapDay) { """ Returns a random {@link MonthDay} that is before the given {@link MonthDay}. @param before the value that returned {@link MonthDay} must be before @param includeLeapDay whether or not to include leap day @return the random {@link MonthDay} @throws IllegalArgumentException if before is null or if before is first day of year (January 1st) """ checkArgument(before != null, "Before must be non-null"); checkArgument(before.isAfter(MonthDay.of(JANUARY, 1)), "Before must be after January 1st"); int year = includeLeapDay ? LEAP_YEAR : LEAP_YEAR - 1; LocalDate startOfYear = Year.of(year).atDay(1); LocalDate end = before.atYear(year); LocalDate localDate = randomLocalDate(startOfYear, end); return MonthDay.of(localDate.getMonth(), localDate.getDayOfMonth()); }
java
public static MonthDay randomMonthDayBefore(MonthDay before, boolean includeLeapDay) { checkArgument(before != null, "Before must be non-null"); checkArgument(before.isAfter(MonthDay.of(JANUARY, 1)), "Before must be after January 1st"); int year = includeLeapDay ? LEAP_YEAR : LEAP_YEAR - 1; LocalDate startOfYear = Year.of(year).atDay(1); LocalDate end = before.atYear(year); LocalDate localDate = randomLocalDate(startOfYear, end); return MonthDay.of(localDate.getMonth(), localDate.getDayOfMonth()); }
[ "public", "static", "MonthDay", "randomMonthDayBefore", "(", "MonthDay", "before", ",", "boolean", "includeLeapDay", ")", "{", "checkArgument", "(", "before", "!=", "null", ",", "\"Before must be non-null\"", ")", ";", "checkArgument", "(", "before", ".", "isAfter",...
Returns a random {@link MonthDay} that is before the given {@link MonthDay}. @param before the value that returned {@link MonthDay} must be before @param includeLeapDay whether or not to include leap day @return the random {@link MonthDay} @throws IllegalArgumentException if before is null or if before is first day of year (January 1st)
[ "Returns", "a", "random", "{", "@link", "MonthDay", "}", "that", "is", "before", "the", "given", "{", "@link", "MonthDay", "}", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/date/RandomDateUtils.java#L773-L781
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsResourceTypeConfig.java
CmsResourceTypeConfig.createNewElement
public CmsResource createNewElement(CmsObject userCms, String pageFolderRootPath) throws CmsException { """ Creates a new element.<p> @param userCms the CMS context to use @param pageFolderRootPath root path of the folder containing the current container page @return the created resource @throws CmsException if something goes wrong """ return createNewElement(userCms, null, pageFolderRootPath); }
java
public CmsResource createNewElement(CmsObject userCms, String pageFolderRootPath) throws CmsException { return createNewElement(userCms, null, pageFolderRootPath); }
[ "public", "CmsResource", "createNewElement", "(", "CmsObject", "userCms", ",", "String", "pageFolderRootPath", ")", "throws", "CmsException", "{", "return", "createNewElement", "(", "userCms", ",", "null", ",", "pageFolderRootPath", ")", ";", "}" ]
Creates a new element.<p> @param userCms the CMS context to use @param pageFolderRootPath root path of the folder containing the current container page @return the created resource @throws CmsException if something goes wrong
[ "Creates", "a", "new", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsResourceTypeConfig.java#L404-L407
timewalker74/ffmq
core/src/main/java/net/timewalker/ffmq4/local/connection/LocalQueueConnection.java
LocalQueueConnection.createDurableConnectionConsumer
@Override public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException { """ /* (non-Javadoc) @see net.timewalker.ffmq4.common.connection.AbstractConnection#createDurableConnectionConsumer(javax.jms.Topic, java.lang.String, java.lang.String, javax.jms.ServerSessionPool, int) """ throw new IllegalStateException("Method not available on this domain."); }
java
@Override public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException { throw new IllegalStateException("Method not available on this domain."); }
[ "@", "Override", "public", "ConnectionConsumer", "createDurableConnectionConsumer", "(", "Topic", "topic", ",", "String", "subscriptionName", ",", "String", "messageSelector", ",", "ServerSessionPool", "sessionPool", ",", "int", "maxMessages", ")", "throws", "JMSException...
/* (non-Javadoc) @see net.timewalker.ffmq4.common.connection.AbstractConnection#createDurableConnectionConsumer(javax.jms.Topic, java.lang.String, java.lang.String, javax.jms.ServerSessionPool, int)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/connection/LocalQueueConnection.java#L74-L78
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WPasswordFieldRenderer.java
WPasswordFieldRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WPasswordField. @param component the WPasswordField to paint. @param renderContext the RenderContext to paint to. """ WPasswordField field = (WPasswordField) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = field.isReadOnly(); xml.appendTagOpen(TAG_NAME); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); xml.appendEnd(); return; } int cols = field.getColumns(); int minLength = field.getMinLength(); int maxLength = field.getMaxLength(); WComponent submitControl = field.getDefaultSubmitButton(); String submitControlId = submitControl == null ? null : submitControl.getId(); xml.appendOptionalAttribute("disabled", field.isDisabled(), "true"); xml.appendOptionalAttribute("required", field.isMandatory(), "true"); xml.appendOptionalAttribute("minLength", minLength > 0, minLength); xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength); xml.appendOptionalAttribute("toolTip", field.getToolTip()); xml.appendOptionalAttribute("accessibleText", field.getAccessibleText()); xml.appendOptionalAttribute("size", cols > 0, cols); xml.appendOptionalAttribute("buttonId", submitControlId); String placeholder = field.getPlaceholder(); xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder); String autocomplete = field.getAutocomplete(); xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete); List<Diagnostic> diags = field.getDiagnostics(Diagnostic.ERROR); if (diags == null || diags.isEmpty()) { xml.appendEnd(); return; } xml.appendClose(); DiagnosticRenderUtil.renderDiagnostics(field, renderContext); xml.appendEndTag(TAG_NAME); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WPasswordField field = (WPasswordField) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = field.isReadOnly(); xml.appendTagOpen(TAG_NAME); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", component.isHidden(), "true"); if (readOnly) { xml.appendAttribute("readOnly", "true"); xml.appendEnd(); return; } int cols = field.getColumns(); int minLength = field.getMinLength(); int maxLength = field.getMaxLength(); WComponent submitControl = field.getDefaultSubmitButton(); String submitControlId = submitControl == null ? null : submitControl.getId(); xml.appendOptionalAttribute("disabled", field.isDisabled(), "true"); xml.appendOptionalAttribute("required", field.isMandatory(), "true"); xml.appendOptionalAttribute("minLength", minLength > 0, minLength); xml.appendOptionalAttribute("maxLength", maxLength > 0, maxLength); xml.appendOptionalAttribute("toolTip", field.getToolTip()); xml.appendOptionalAttribute("accessibleText", field.getAccessibleText()); xml.appendOptionalAttribute("size", cols > 0, cols); xml.appendOptionalAttribute("buttonId", submitControlId); String placeholder = field.getPlaceholder(); xml.appendOptionalAttribute("placeholder", !Util.empty(placeholder), placeholder); String autocomplete = field.getAutocomplete(); xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete); List<Diagnostic> diags = field.getDiagnostics(Diagnostic.ERROR); if (diags == null || diags.isEmpty()) { xml.appendEnd(); return; } xml.appendClose(); DiagnosticRenderUtil.renderDiagnostics(field, renderContext); xml.appendEndTag(TAG_NAME); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WPasswordField", "field", "=", "(", "WPasswordField", ")", "component", ";", "XmlStringBuilder", "xml", "=", "r...
Paints the given WPasswordField. @param component the WPasswordField to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WPasswordField", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WPasswordFieldRenderer.java#L30-L75
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/JobClient.java
JobClient.submitJob
public RunningJob submitJob(JobConf job) throws FileNotFoundException, IOException { """ Submit a job to the MR system. This returns a handle to the {@link RunningJob} which can be used to track the running-job. @param job the job configuration. @return a handle to the {@link RunningJob} which can be used to track the running-job. @throws FileNotFoundException @throws IOException """ try { return submitJobInternal(job); } catch (InterruptedException ie) { throw new IOException("interrupted", ie); } catch (ClassNotFoundException cnfe) { throw new IOException("class not found", cnfe); } }
java
public RunningJob submitJob(JobConf job) throws FileNotFoundException, IOException { try { return submitJobInternal(job); } catch (InterruptedException ie) { throw new IOException("interrupted", ie); } catch (ClassNotFoundException cnfe) { throw new IOException("class not found", cnfe); } }
[ "public", "RunningJob", "submitJob", "(", "JobConf", "job", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "try", "{", "return", "submitJobInternal", "(", "job", ")", ";", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "throw", "n...
Submit a job to the MR system. This returns a handle to the {@link RunningJob} which can be used to track the running-job. @param job the job configuration. @return a handle to the {@link RunningJob} which can be used to track the running-job. @throws FileNotFoundException @throws IOException
[ "Submit", "a", "job", "to", "the", "MR", "system", ".", "This", "returns", "a", "handle", "to", "the", "{", "@link", "RunningJob", "}", "which", "can", "be", "used", "to", "track", "the", "running", "-", "job", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobClient.java#L1155-L1164
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java
MailUtil.send
public static void send(MailAccount mailAccount, Collection<String> tos, String subject, String content, boolean isHtml, File... files) { """ 发送邮件给多人 @param mailAccount 邮件认证对象 @param tos 收件人列表 @param subject 标题 @param content 正文 @param isHtml 是否为HTML格式 @param files 附件列表 """ Mail.create(mailAccount)// .setTos(tos.toArray(new String[tos.size()]))// .setTitle(subject)// .setContent(content)// .setHtml(isHtml)// .setFiles(files)// .send(); }
java
public static void send(MailAccount mailAccount, Collection<String> tos, String subject, String content, boolean isHtml, File... files) { Mail.create(mailAccount)// .setTos(tos.toArray(new String[tos.size()]))// .setTitle(subject)// .setContent(content)// .setHtml(isHtml)// .setFiles(files)// .send(); }
[ "public", "static", "void", "send", "(", "MailAccount", "mailAccount", ",", "Collection", "<", "String", ">", "tos", ",", "String", "subject", ",", "String", "content", ",", "boolean", "isHtml", ",", "File", "...", "files", ")", "{", "Mail", ".", "create",...
发送邮件给多人 @param mailAccount 邮件认证对象 @param tos 收件人列表 @param subject 标题 @param content 正文 @param isHtml 是否为HTML格式 @param files 附件列表
[ "发送邮件给多人" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L157-L165
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java
VirtualNetworkRulesInner.createOrUpdateAsync
public Observable<VirtualNetworkRuleInner> createOrUpdateAsync(String resourceGroupName, String accountName, String virtualNetworkRuleName, CreateOrUpdateVirtualNetworkRuleParameters parameters) { """ Creates or updates the specified virtual network rule. During update, the virtual network rule with the specified name will be replaced with this new virtual network rule. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Store account. @param virtualNetworkRuleName The name of the virtual network rule to create or update. @param parameters Parameters supplied to create or update the virtual network rule. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkRuleInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() { @Override public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkRuleInner> createOrUpdateAsync(String resourceGroupName, String accountName, String virtualNetworkRuleName, CreateOrUpdateVirtualNetworkRuleParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() { @Override public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkRuleInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "virtualNetworkRuleName", ",", "CreateOrUpdateVirtualNetworkRuleParameters", "parameters", ")", "{", "return", ...
Creates or updates the specified virtual network rule. During update, the virtual network rule with the specified name will be replaced with this new virtual network rule. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Store account. @param virtualNetworkRuleName The name of the virtual network rule to create or update. @param parameters Parameters supplied to create or update the virtual network rule. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkRuleInner object
[ "Creates", "or", "updates", "the", "specified", "virtual", "network", "rule", ".", "During", "update", "the", "virtual", "network", "rule", "with", "the", "specified", "name", "will", "be", "replaced", "with", "this", "new", "virtual", "network", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java#L257-L264
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
JShellTool.fluff
@Override public void fluff(String format, Object... args) { """ Optional output @param format printf format @param args printf args """ if (showFluff()) { hard(format, args); } }
java
@Override public void fluff(String format, Object... args) { if (showFluff()) { hard(format, args); } }
[ "@", "Override", "public", "void", "fluff", "(", "String", "format", ",", "Object", "...", "args", ")", "{", "if", "(", "showFluff", "(", ")", ")", "{", "hard", "(", "format", ",", "args", ")", ";", "}", "}" ]
Optional output @param format printf format @param args printf args
[ "Optional", "output" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L697-L702
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory.java
HoneycombBitmapFactory.createBitmapInternal
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) @Override public CloseableReference<Bitmap> createBitmapInternal( int width, int height, Bitmap.Config bitmapConfig) { """ Creates a bitmap of the specified width and height. @param width the width of the bitmap @param height the height of the bitmap @param bitmapConfig the {@link android.graphics.Bitmap.Config} used to create the decoded Bitmap @return a reference to the bitmap @throws TooManyBitmapsException if the pool is full @throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated """ if (mImmutableBitmapFallback) { return createFallbackBitmap(width, height, bitmapConfig); } CloseableReference<PooledByteBuffer> jpgRef = mJpegGenerator.generate( (short) width, (short) height); try { EncodedImage encodedImage = new EncodedImage(jpgRef); encodedImage.setImageFormat(DefaultImageFormats.JPEG); try { CloseableReference<Bitmap> bitmapRef = mPurgeableDecoder.decodeJPEGFromEncodedImage( encodedImage, bitmapConfig, null, jpgRef.get().size()); if (!bitmapRef.get().isMutable()) { CloseableReference.closeSafely(bitmapRef); mImmutableBitmapFallback = true; FLog.wtf(TAG, "Immutable bitmap returned by decoder"); // On some devices (Samsung GT-S7580) the returned bitmap can be immutable, in that case // let's jut use Bitmap.createBitmap() to hopefully create a mutable one. return createFallbackBitmap(width, height, bitmapConfig); } bitmapRef.get().setHasAlpha(true); bitmapRef.get().eraseColor(Color.TRANSPARENT); return bitmapRef; } finally { EncodedImage.closeSafely(encodedImage); } } finally { jpgRef.close(); } }
java
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1) @Override public CloseableReference<Bitmap> createBitmapInternal( int width, int height, Bitmap.Config bitmapConfig) { if (mImmutableBitmapFallback) { return createFallbackBitmap(width, height, bitmapConfig); } CloseableReference<PooledByteBuffer> jpgRef = mJpegGenerator.generate( (short) width, (short) height); try { EncodedImage encodedImage = new EncodedImage(jpgRef); encodedImage.setImageFormat(DefaultImageFormats.JPEG); try { CloseableReference<Bitmap> bitmapRef = mPurgeableDecoder.decodeJPEGFromEncodedImage( encodedImage, bitmapConfig, null, jpgRef.get().size()); if (!bitmapRef.get().isMutable()) { CloseableReference.closeSafely(bitmapRef); mImmutableBitmapFallback = true; FLog.wtf(TAG, "Immutable bitmap returned by decoder"); // On some devices (Samsung GT-S7580) the returned bitmap can be immutable, in that case // let's jut use Bitmap.createBitmap() to hopefully create a mutable one. return createFallbackBitmap(width, height, bitmapConfig); } bitmapRef.get().setHasAlpha(true); bitmapRef.get().eraseColor(Color.TRANSPARENT); return bitmapRef; } finally { EncodedImage.closeSafely(encodedImage); } } finally { jpgRef.close(); } }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB_MR1", ")", "@", "Override", "public", "CloseableReference", "<", "Bitmap", ">", "createBitmapInternal", "(", "int", "width", ",", "int", "height", ",", "Bitmap", ".", "Config", "bitmapConfig",...
Creates a bitmap of the specified width and height. @param width the width of the bitmap @param height the height of the bitmap @param bitmapConfig the {@link android.graphics.Bitmap.Config} used to create the decoded Bitmap @return a reference to the bitmap @throws TooManyBitmapsException if the pool is full @throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated
[ "Creates", "a", "bitmap", "of", "the", "specified", "width", "and", "height", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/bitmaps/HoneycombBitmapFactory.java#L51-L87
tencentyun/cos-java-sdk
src/main/java/com/qcloud/cos/common_utils/CommonFileUtils.java
CommonFileUtils.closeFileStream
public static void closeFileStream(InputStream inputStream, String filePath) { """ 关闭对应的文件流 @param inputStream 待关闭的文件流 @param filePath 对应的文件名 @throws IOException 关闭时发生IO异常,则抛出 """ try { if (inputStream != null) { inputStream.close(); } } catch (IOException e) { LOG.error("close file {} occur an IOExcpetion {}", filePath, e); } }
java
public static void closeFileStream(InputStream inputStream, String filePath){ try { if (inputStream != null) { inputStream.close(); } } catch (IOException e) { LOG.error("close file {} occur an IOExcpetion {}", filePath, e); } }
[ "public", "static", "void", "closeFileStream", "(", "InputStream", "inputStream", ",", "String", "filePath", ")", "{", "try", "{", "if", "(", "inputStream", "!=", "null", ")", "{", "inputStream", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "IOEx...
关闭对应的文件流 @param inputStream 待关闭的文件流 @param filePath 对应的文件名 @throws IOException 关闭时发生IO异常,则抛出
[ "关闭对应的文件流" ]
train
https://github.com/tencentyun/cos-java-sdk/blob/6709a48f67c1ea7b82a7215f5037d6ccf218b630/src/main/java/com/qcloud/cos/common_utils/CommonFileUtils.java#L65-L73
apptik/JustJson
json-core/src/main/java/io/apptik/json/JsonObject.java
JsonObject.optString
public String optString(String name, String fallback) { """ Returns the value mapped by {@code name} if it exists, coercing it if necessary, or {@code fallback} if no such mapping exists. """ return optString(name, fallback, true); }
java
public String optString(String name, String fallback) { return optString(name, fallback, true); }
[ "public", "String", "optString", "(", "String", "name", ",", "String", "fallback", ")", "{", "return", "optString", "(", "name", ",", "fallback", ",", "true", ")", ";", "}" ]
Returns the value mapped by {@code name} if it exists, coercing it if necessary, or {@code fallback} if no such mapping exists.
[ "Returns", "the", "value", "mapped", "by", "{" ]
train
https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonObject.java#L602-L604
Azure/azure-sdk-for-java
postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/ServerSecurityAlertPoliciesInner.java
ServerSecurityAlertPoliciesInner.getAsync
public Observable<ServerSecurityAlertPolicyInner> getAsync(String resourceGroupName, String serverName) { """ Get a server's security alert policy. @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. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerSecurityAlertPolicyInner object """ return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerSecurityAlertPolicyInner>, ServerSecurityAlertPolicyInner>() { @Override public ServerSecurityAlertPolicyInner call(ServiceResponse<ServerSecurityAlertPolicyInner> response) { return response.body(); } }); }
java
public Observable<ServerSecurityAlertPolicyInner> getAsync(String resourceGroupName, String serverName) { return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerSecurityAlertPolicyInner>, ServerSecurityAlertPolicyInner>() { @Override public ServerSecurityAlertPolicyInner call(ServiceResponse<ServerSecurityAlertPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerSecurityAlertPolicyInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "new"...
Get a server's security alert policy. @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. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerSecurityAlertPolicyInner object
[ "Get", "a", "server", "s", "security", "alert", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/ServerSecurityAlertPoliciesInner.java#L106-L113
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/beans/BeanUtils.java
BeanUtils.getReadMethod
public static Method getReadMethod(Class<?> clazz, String propertyName) { """ Helper method for getting a read method for a property. @param clazz the type to get the method for. @param propertyName the name of the property. @return the method for reading the property. """ Method readMethod = null; try { PropertyDescriptor[] thisProps = Introspector.getBeanInfo(clazz).getPropertyDescriptors(); for (PropertyDescriptor pd : thisProps) { if (pd.getName().equals(propertyName) && pd.getReadMethod() != null) { readMethod = pd.getReadMethod(); break; } } } catch (IntrospectionException ex) { Logger.getLogger(BeanUtils.class.getName()).log(Level.SEVERE, null, ex); } return readMethod; }
java
public static Method getReadMethod(Class<?> clazz, String propertyName) { Method readMethod = null; try { PropertyDescriptor[] thisProps = Introspector.getBeanInfo(clazz).getPropertyDescriptors(); for (PropertyDescriptor pd : thisProps) { if (pd.getName().equals(propertyName) && pd.getReadMethod() != null) { readMethod = pd.getReadMethod(); break; } } } catch (IntrospectionException ex) { Logger.getLogger(BeanUtils.class.getName()).log(Level.SEVERE, null, ex); } return readMethod; }
[ "public", "static", "Method", "getReadMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ")", "{", "Method", "readMethod", "=", "null", ";", "try", "{", "PropertyDescriptor", "[", "]", "thisProps", "=", "Introspector", ".", "getBea...
Helper method for getting a read method for a property. @param clazz the type to get the method for. @param propertyName the name of the property. @return the method for reading the property.
[ "Helper", "method", "for", "getting", "a", "read", "method", "for", "a", "property", "." ]
train
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/beans/BeanUtils.java#L45-L59
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
PageFlowPageFilter.continueChainNoWrapper
private static void continueChainNoWrapper( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException { """ Internal method used to handle cases where the filter should continue without processing the request by rendering a page associated with a page flow. @param request the request @param response the response @param chain the filter chain @throws IOException @throws ServletException """ // // Remove our request wrapper -- the page doesn't need to see this. // if ( request instanceof PageFlowRequestWrapper ) request = ((PageFlowRequestWrapper)request).getHttpRequest(); chain.doFilter( request, response ); }
java
private static void continueChainNoWrapper( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException { // // Remove our request wrapper -- the page doesn't need to see this. // if ( request instanceof PageFlowRequestWrapper ) request = ((PageFlowRequestWrapper)request).getHttpRequest(); chain.doFilter( request, response ); }
[ "private", "static", "void", "continueChainNoWrapper", "(", "ServletRequest", "request", ",", "ServletResponse", "response", ",", "FilterChain", "chain", ")", "throws", "IOException", ",", "ServletException", "{", "//", "// Remove our request wrapper -- the page doesn't need ...
Internal method used to handle cases where the filter should continue without processing the request by rendering a page associated with a page flow. @param request the request @param response the response @param chain the filter chain @throws IOException @throws ServletException
[ "Internal", "method", "used", "to", "handle", "cases", "where", "the", "filter", "should", "continue", "without", "processing", "the", "request", "by", "rendering", "a", "page", "associated", "with", "a", "page", "flow", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java#L459-L469
Ekryd/sortpom
sorter/src/main/java/sortpom/util/FileUtil.java
FileUtil.getPomFileContent
public String getPomFileContent() { """ Loads the pom file that will be sorted. @return Content of the file """ try (InputStream inputStream = new FileInputStream(pomFile)) { return IOUtils.toString(inputStream, encoding); } catch (UnsupportedCharsetException ex) { throw new FailureException("Could not handle encoding: " + encoding, ex); } catch (IOException ex) { throw new FailureException("Could not read pom file: " + pomFile.getAbsolutePath(), ex); } }
java
public String getPomFileContent() { try (InputStream inputStream = new FileInputStream(pomFile)) { return IOUtils.toString(inputStream, encoding); } catch (UnsupportedCharsetException ex) { throw new FailureException("Could not handle encoding: " + encoding, ex); } catch (IOException ex) { throw new FailureException("Could not read pom file: " + pomFile.getAbsolutePath(), ex); } }
[ "public", "String", "getPomFileContent", "(", ")", "{", "try", "(", "InputStream", "inputStream", "=", "new", "FileInputStream", "(", "pomFile", ")", ")", "{", "return", "IOUtils", ".", "toString", "(", "inputStream", ",", "encoding", ")", ";", "}", "catch",...
Loads the pom file that will be sorted. @return Content of the file
[ "Loads", "the", "pom", "file", "that", "will", "be", "sorted", "." ]
train
https://github.com/Ekryd/sortpom/blob/27056420803ed04001e4149b04a719fbac774c5d/sorter/src/main/java/sortpom/util/FileUtil.java#L72-L80
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/OmsEpanetParametersTime.java
OmsEpanetParametersTime.createFromMap
public static OmsEpanetParametersTime createFromMap( HashMap<TimeParameterCodes, String> options ) throws Exception { """ Create a {@link OmsEpanetParametersTime} from a {@link HashMap} of values. @param options the {@link HashMap} of values. The keys have to be from {@link TimeParameterCodes}. @return the created {@link OmsEpanetParametersTime}. @throws Exception """ OmsEpanetParametersTime epTime = new OmsEpanetParametersTime(); String duration = options.get(TimeParameterCodes.DURATION); epTime.duration = NumericsUtilities.isNumber(duration, Double.class); String hydrTiStep = options.get(TimeParameterCodes.HYDSTEP); epTime.hydraulicTimestep = NumericsUtilities.isNumber(hydrTiStep, Double.class); String pattTimeStep = options.get(TimeParameterCodes.PATTERNSTEP); epTime.patternTimestep = NumericsUtilities.isNumber(pattTimeStep, Double.class); String patternStart = options.get(TimeParameterCodes.PATTERNSTART); epTime.patternStart = NumericsUtilities.isNumber(patternStart, Double.class); String reportTimeStep = options.get(TimeParameterCodes.REPORTSTEP); epTime.reportTimestep = NumericsUtilities.isNumber(reportTimeStep, Double.class); String reportStart = options.get(TimeParameterCodes.REPORTSTART); epTime.reportStart = NumericsUtilities.isNumber(reportStart, Double.class); String startClockTime = options.get(TimeParameterCodes.STARTCLOCKTIME); epTime.startClockTime = startClockTime; String statistic = options.get(TimeParameterCodes.STATISTIC); epTime.statistic = statistic; epTime.process(); return epTime; }
java
public static OmsEpanetParametersTime createFromMap( HashMap<TimeParameterCodes, String> options ) throws Exception { OmsEpanetParametersTime epTime = new OmsEpanetParametersTime(); String duration = options.get(TimeParameterCodes.DURATION); epTime.duration = NumericsUtilities.isNumber(duration, Double.class); String hydrTiStep = options.get(TimeParameterCodes.HYDSTEP); epTime.hydraulicTimestep = NumericsUtilities.isNumber(hydrTiStep, Double.class); String pattTimeStep = options.get(TimeParameterCodes.PATTERNSTEP); epTime.patternTimestep = NumericsUtilities.isNumber(pattTimeStep, Double.class); String patternStart = options.get(TimeParameterCodes.PATTERNSTART); epTime.patternStart = NumericsUtilities.isNumber(patternStart, Double.class); String reportTimeStep = options.get(TimeParameterCodes.REPORTSTEP); epTime.reportTimestep = NumericsUtilities.isNumber(reportTimeStep, Double.class); String reportStart = options.get(TimeParameterCodes.REPORTSTART); epTime.reportStart = NumericsUtilities.isNumber(reportStart, Double.class); String startClockTime = options.get(TimeParameterCodes.STARTCLOCKTIME); epTime.startClockTime = startClockTime; String statistic = options.get(TimeParameterCodes.STATISTIC); epTime.statistic = statistic; epTime.process(); return epTime; }
[ "public", "static", "OmsEpanetParametersTime", "createFromMap", "(", "HashMap", "<", "TimeParameterCodes", ",", "String", ">", "options", ")", "throws", "Exception", "{", "OmsEpanetParametersTime", "epTime", "=", "new", "OmsEpanetParametersTime", "(", ")", ";", "Strin...
Create a {@link OmsEpanetParametersTime} from a {@link HashMap} of values. @param options the {@link HashMap} of values. The keys have to be from {@link TimeParameterCodes}. @return the created {@link OmsEpanetParametersTime}. @throws Exception
[ "Create", "a", "{", "@link", "OmsEpanetParametersTime", "}", "from", "a", "{", "@link", "HashMap", "}", "of", "values", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/OmsEpanetParametersTime.java#L158-L178
joniles/mpxj
src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java
AstaDatabaseReader.getRows
private List<Row> getRows(String sql) throws SQLException { """ Retrieve a number of rows matching the supplied query. @param sql query statement @return result set @throws SQLException """ allocateConnection(); try { List<Row> result = new LinkedList<Row>(); m_ps = m_connection.prepareStatement(sql); m_rs = m_ps.executeQuery(); populateMetaData(); while (m_rs.next()) { result.add(new MpdResultSetRow(m_rs, m_meta)); } return (result); } finally { releaseConnection(); } }
java
private List<Row> getRows(String sql) throws SQLException { allocateConnection(); try { List<Row> result = new LinkedList<Row>(); m_ps = m_connection.prepareStatement(sql); m_rs = m_ps.executeQuery(); populateMetaData(); while (m_rs.next()) { result.add(new MpdResultSetRow(m_rs, m_meta)); } return (result); } finally { releaseConnection(); } }
[ "private", "List", "<", "Row", ">", "getRows", "(", "String", "sql", ")", "throws", "SQLException", "{", "allocateConnection", "(", ")", ";", "try", "{", "List", "<", "Row", ">", "result", "=", "new", "LinkedList", "<", "Row", ">", "(", ")", ";", "m_...
Retrieve a number of rows matching the supplied query. @param sql query statement @return result set @throws SQLException
[ "Retrieve", "a", "number", "of", "rows", "matching", "the", "supplied", "query", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaDatabaseReader.java#L362-L385
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/RolloutGroupConditionBuilder.java
RolloutGroupConditionBuilder.errorAction
public RolloutGroupConditionBuilder errorAction(final RolloutGroupErrorAction action, final String expression) { """ Sets the error action and expression on the builder. @param action the error action @param expression the error expression @return the builder itself """ conditions.setErrorAction(action); conditions.setErrorActionExp(expression); return this; }
java
public RolloutGroupConditionBuilder errorAction(final RolloutGroupErrorAction action, final String expression) { conditions.setErrorAction(action); conditions.setErrorActionExp(expression); return this; }
[ "public", "RolloutGroupConditionBuilder", "errorAction", "(", "final", "RolloutGroupErrorAction", "action", ",", "final", "String", "expression", ")", "{", "conditions", ".", "setErrorAction", "(", "action", ")", ";", "conditions", ".", "setErrorActionExp", "(", "expr...
Sets the error action and expression on the builder. @param action the error action @param expression the error expression @return the builder itself
[ "Sets", "the", "error", "action", "and", "expression", "on", "the", "builder", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/RolloutGroupConditionBuilder.java#L86-L90
b3dgs/lionengine
lionengine-audio-wav/src/main/java/com/b3dgs/lionengine/audio/wav/WavImpl.java
WavImpl.updateAlignment
private static void updateAlignment(DataLine dataLine, Align alignment) { """ Update the sound alignment. @param dataLine Audio source data. @param alignment Alignment value. """ if (dataLine.isControlSupported(Type.PAN)) { final FloatControl pan = (FloatControl) dataLine.getControl(Type.PAN); switch (alignment) { case CENTER: pan.setValue(0.0F); break; case RIGHT: pan.setValue(1.0F); break; case LEFT: pan.setValue(-1.0F); break; default: throw new LionEngineException(alignment); } } }
java
private static void updateAlignment(DataLine dataLine, Align alignment) { if (dataLine.isControlSupported(Type.PAN)) { final FloatControl pan = (FloatControl) dataLine.getControl(Type.PAN); switch (alignment) { case CENTER: pan.setValue(0.0F); break; case RIGHT: pan.setValue(1.0F); break; case LEFT: pan.setValue(-1.0F); break; default: throw new LionEngineException(alignment); } } }
[ "private", "static", "void", "updateAlignment", "(", "DataLine", "dataLine", ",", "Align", "alignment", ")", "{", "if", "(", "dataLine", ".", "isControlSupported", "(", "Type", ".", "PAN", ")", ")", "{", "final", "FloatControl", "pan", "=", "(", "FloatContro...
Update the sound alignment. @param dataLine Audio source data. @param alignment Alignment value.
[ "Update", "the", "sound", "alignment", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-audio-wav/src/main/java/com/b3dgs/lionengine/audio/wav/WavImpl.java#L131-L151
ehcache/ehcache3
clustered/client/src/main/java/org/ehcache/clustered/client/internal/ClusterTierManagerClientEntityFactory.java
ClusterTierManagerClientEntityFactory.abandonLeadership
public boolean abandonLeadership(String entityIdentifier, boolean healthyConnection) { """ Proactively abandon leadership before closing connection. @param entityIdentifier the master entity identifier @return true of abandoned false otherwise """ Hold hold = maintenanceHolds.remove(entityIdentifier); return (hold != null) && healthyConnection && silentlyUnlock(hold, entityIdentifier); }
java
public boolean abandonLeadership(String entityIdentifier, boolean healthyConnection) { Hold hold = maintenanceHolds.remove(entityIdentifier); return (hold != null) && healthyConnection && silentlyUnlock(hold, entityIdentifier); }
[ "public", "boolean", "abandonLeadership", "(", "String", "entityIdentifier", ",", "boolean", "healthyConnection", ")", "{", "Hold", "hold", "=", "maintenanceHolds", ".", "remove", "(", "entityIdentifier", ")", ";", "return", "(", "hold", "!=", "null", ")", "&&",...
Proactively abandon leadership before closing connection. @param entityIdentifier the master entity identifier @return true of abandoned false otherwise
[ "Proactively", "abandon", "leadership", "before", "closing", "connection", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/clustered/client/src/main/java/org/ehcache/clustered/client/internal/ClusterTierManagerClientEntityFactory.java#L94-L97
qos-ch/slf4j
slf4j-ext/src/main/java/org/slf4j/agent/AgentPremain.java
AgentPremain.parseArguments
private static Properties parseArguments(String agentArgument, String separator) { """ Consider the argument string to be a property file (by converting the splitter character to line feeds), and then reading it like any other property file. @param agentArgument string given by instrumentation framework @param separator String to convert to line feeds @return argument converted to properties """ Properties p = new Properties(); try { String argumentAsLines = agentArgument.replaceAll(separator, "\n"); p.load(new ByteArrayInputStream(argumentAsLines.getBytes())); } catch (IOException e) { String s = "Could not load arguments as properties"; throw new RuntimeException(s, e); } return p; }
java
private static Properties parseArguments(String agentArgument, String separator) { Properties p = new Properties(); try { String argumentAsLines = agentArgument.replaceAll(separator, "\n"); p.load(new ByteArrayInputStream(argumentAsLines.getBytes())); } catch (IOException e) { String s = "Could not load arguments as properties"; throw new RuntimeException(s, e); } return p; }
[ "private", "static", "Properties", "parseArguments", "(", "String", "agentArgument", ",", "String", "separator", ")", "{", "Properties", "p", "=", "new", "Properties", "(", ")", ";", "try", "{", "String", "argumentAsLines", "=", "agentArgument", ".", "replaceAll...
Consider the argument string to be a property file (by converting the splitter character to line feeds), and then reading it like any other property file. @param agentArgument string given by instrumentation framework @param separator String to convert to line feeds @return argument converted to properties
[ "Consider", "the", "argument", "string", "to", "be", "a", "property", "file", "(", "by", "converting", "the", "splitter", "character", "to", "line", "feeds", ")", "and", "then", "reading", "it", "like", "any", "other", "property", "file", "." ]
train
https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/slf4j-ext/src/main/java/org/slf4j/agent/AgentPremain.java#L94-L104
CloudSlang/score
score-api/src/main/java/io/cloudslang/score/lang/ExecutionRuntimeServices.java
ExecutionRuntimeServices.addBranch
public void addBranch(Long startPosition, String flowUuid, Map<String, Serializable> context) { """ add brunch - means you want to split your execution @param startPosition - the position in the execution plan the new brunch will point to @param flowUuid - the flow uuid @param context - the context of the created brunch """ Map<String, Long> runningPlansIds = getFromMap(RUNNING_PLANS_MAP); Long runningPlanId = runningPlansIds.get(flowUuid); addBranch(startPosition, runningPlanId, context, new ExecutionRuntimeServices(this)); }
java
public void addBranch(Long startPosition, String flowUuid, Map<String, Serializable> context) { Map<String, Long> runningPlansIds = getFromMap(RUNNING_PLANS_MAP); Long runningPlanId = runningPlansIds.get(flowUuid); addBranch(startPosition, runningPlanId, context, new ExecutionRuntimeServices(this)); }
[ "public", "void", "addBranch", "(", "Long", "startPosition", ",", "String", "flowUuid", ",", "Map", "<", "String", ",", "Serializable", ">", "context", ")", "{", "Map", "<", "String", ",", "Long", ">", "runningPlansIds", "=", "getFromMap", "(", "RUNNING_PLAN...
add brunch - means you want to split your execution @param startPosition - the position in the execution plan the new brunch will point to @param flowUuid - the flow uuid @param context - the context of the created brunch
[ "add", "brunch", "-", "means", "you", "want", "to", "split", "your", "execution" ]
train
https://github.com/CloudSlang/score/blob/796134e917843f4d95a90f7740d69dc5257a1a0e/score-api/src/main/java/io/cloudslang/score/lang/ExecutionRuntimeServices.java#L372-L376
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java
ExcelUtil.read07BySax
public static Excel07SaxReader read07BySax(String path, int sheetIndex, RowHandler rowHandler) { """ Sax方式读取Excel07 @param path 路径 @param sheetIndex Sheet索引,-1表示全部Sheet, 0表示第一个Sheet @param rowHandler 行处理器 @return {@link Excel07SaxReader} @since 3.2.0 """ try { return new Excel07SaxReader(rowHandler).read(path, sheetIndex); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
java
public static Excel07SaxReader read07BySax(String path, int sheetIndex, RowHandler rowHandler) { try { return new Excel07SaxReader(rowHandler).read(path, sheetIndex); } catch (NoClassDefFoundError e) { throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG); } }
[ "public", "static", "Excel07SaxReader", "read07BySax", "(", "String", "path", ",", "int", "sheetIndex", ",", "RowHandler", "rowHandler", ")", "{", "try", "{", "return", "new", "Excel07SaxReader", "(", "rowHandler", ")", ".", "read", "(", "path", ",", "sheetInd...
Sax方式读取Excel07 @param path 路径 @param sheetIndex Sheet索引,-1表示全部Sheet, 0表示第一个Sheet @param rowHandler 行处理器 @return {@link Excel07SaxReader} @since 3.2.0
[ "Sax方式读取Excel07" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L123-L129
sebastiangraf/treetank
interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java
PipelineBuilder.addQuantifierExpr
public void addQuantifierExpr(final INodeReadTrx mTransaction, final boolean mIsSome, final int mVarNum) { """ Adds a SomeExpression or an EveryExpression to the pipeline, depending on the parameter isSome. @param mTransaction Transaction to operate with. @param mIsSome defines whether a some- or an EveryExpression is used. @param mVarNum number of binding variables """ assert getPipeStack().size() >= (mVarNum + 1); final AbsAxis satisfy = getPipeStack().pop().getExpr(); final List<AbsAxis> vars = new ArrayList<AbsAxis>(); int num = mVarNum; while (num-- > 0) { // invert current order of variables to get original variable order vars.add(num, getPipeStack().pop().getExpr()); } final AbsAxis mAxis = mIsSome ? new SomeExpr(mTransaction, vars, satisfy) : new EveryExpr(mTransaction, vars, satisfy); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add(mAxis); }
java
public void addQuantifierExpr(final INodeReadTrx mTransaction, final boolean mIsSome, final int mVarNum) { assert getPipeStack().size() >= (mVarNum + 1); final AbsAxis satisfy = getPipeStack().pop().getExpr(); final List<AbsAxis> vars = new ArrayList<AbsAxis>(); int num = mVarNum; while (num-- > 0) { // invert current order of variables to get original variable order vars.add(num, getPipeStack().pop().getExpr()); } final AbsAxis mAxis = mIsSome ? new SomeExpr(mTransaction, vars, satisfy) : new EveryExpr(mTransaction, vars, satisfy); if (getPipeStack().empty() || getExpression().getSize() != 0) { addExpressionSingle(); } getExpression().add(mAxis); }
[ "public", "void", "addQuantifierExpr", "(", "final", "INodeReadTrx", "mTransaction", ",", "final", "boolean", "mIsSome", ",", "final", "int", "mVarNum", ")", "{", "assert", "getPipeStack", "(", ")", ".", "size", "(", ")", ">=", "(", "mVarNum", "+", "1", ")...
Adds a SomeExpression or an EveryExpression to the pipeline, depending on the parameter isSome. @param mTransaction Transaction to operate with. @param mIsSome defines whether a some- or an EveryExpression is used. @param mVarNum number of binding variables
[ "Adds", "a", "SomeExpression", "or", "an", "EveryExpression", "to", "the", "pipeline", "depending", "on", "the", "parameter", "isSome", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/PipelineBuilder.java#L595-L615
grpc/grpc-java
core/src/main/java/io/grpc/internal/StatsTraceContext.java
StatsTraceContext.serverCallStarted
public void serverCallStarted(ServerCallInfo<?, ?> callInfo) { """ See {@link ServerStreamTracer#serverCallStarted}. For server-side only. <p>Called from {@link io.grpc.internal.ServerImpl}. """ for (StreamTracer tracer : tracers) { ((ServerStreamTracer) tracer).serverCallStarted(callInfo); } }
java
public void serverCallStarted(ServerCallInfo<?, ?> callInfo) { for (StreamTracer tracer : tracers) { ((ServerStreamTracer) tracer).serverCallStarted(callInfo); } }
[ "public", "void", "serverCallStarted", "(", "ServerCallInfo", "<", "?", ",", "?", ">", "callInfo", ")", "{", "for", "(", "StreamTracer", "tracer", ":", "tracers", ")", "{", "(", "(", "ServerStreamTracer", ")", "tracer", ")", ".", "serverCallStarted", "(", ...
See {@link ServerStreamTracer#serverCallStarted}. For server-side only. <p>Called from {@link io.grpc.internal.ServerImpl}.
[ "See", "{", "@link", "ServerStreamTracer#serverCallStarted", "}", ".", "For", "server", "-", "side", "only", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/StatsTraceContext.java#L150-L154
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/BoardsApi.java
BoardsApi.deleteBoard
public void deleteBoard(Object projectIdOrPath, Integer boardId) throws GitLabApiException { """ Soft deletes an existing Issue Board. <p>NOTE: This is only available in GitLab EE</p> <pre><code>GitLab Endpoint: DELETE /projects/:id/boards/:board_id</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param boardId the ID of the board @throws GitLabApiException if any exception occurs """ delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId); }
java
public void deleteBoard(Object projectIdOrPath, Integer boardId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId); }
[ "public", "void", "deleteBoard", "(", "Object", "projectIdOrPath", ",", "Integer", "boardId", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", ...
Soft deletes an existing Issue Board. <p>NOTE: This is only available in GitLab EE</p> <pre><code>GitLab Endpoint: DELETE /projects/:id/boards/:board_id</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param boardId the ID of the board @throws GitLabApiException if any exception occurs
[ "Soft", "deletes", "an", "existing", "Issue", "Board", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/BoardsApi.java#L177-L179
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/AsciiArtUtils.java
AsciiArtUtils.printAsciiArtInfo
@SneakyThrows public static void printAsciiArtInfo(final Logger out, final String asciiArt, final String additional) { """ Print ascii art info. @param out the out @param asciiArt the ascii art @param additional the additional """ out.info(ANSI_CYAN); out.info("\n\n".concat(FigletFont.convertOneLine(asciiArt)).concat(additional)); out.info(ANSI_RESET); }
java
@SneakyThrows public static void printAsciiArtInfo(final Logger out, final String asciiArt, final String additional) { out.info(ANSI_CYAN); out.info("\n\n".concat(FigletFont.convertOneLine(asciiArt)).concat(additional)); out.info(ANSI_RESET); }
[ "@", "SneakyThrows", "public", "static", "void", "printAsciiArtInfo", "(", "final", "Logger", "out", ",", "final", "String", "asciiArt", ",", "final", "String", "additional", ")", "{", "out", ".", "info", "(", "ANSI_CYAN", ")", ";", "out", ".", "info", "("...
Print ascii art info. @param out the out @param asciiArt the ascii art @param additional the additional
[ "Print", "ascii", "art", "info", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/AsciiArtUtils.java#L72-L77
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/ui/CmsInlineEditOverlay.java
CmsInlineEditOverlay.setSelectPosition
private void setSelectPosition(int posX, int posY, int height, int width) { """ Sets position and size of the overlay area.<p> @param posX the new X position @param posY the new Y position @param height the new height @param width the new width """ int useWidth = Window.getClientWidth(); int bodyWidth = RootPanel.getBodyElement().getClientWidth() + RootPanel.getBodyElement().getOffsetLeft(); if (bodyWidth > useWidth) { useWidth = bodyWidth; } int useHeight = Window.getClientHeight(); int bodyHeight = RootPanel.getBodyElement().getClientHeight() + RootPanel.getBodyElement().getOffsetTop(); if (bodyHeight > useHeight) { useHeight = bodyHeight; } m_overlayLeftStyle.setWidth(posX - m_offset, Unit.PX); m_overlayLeftStyle.setHeight(useHeight, Unit.PX); m_borderLeftStyle.setHeight(height + (4 * m_offset), Unit.PX); m_borderLeftStyle.setTop(posY - (2 * m_offset), Unit.PX); m_borderLeftStyle.setLeft(posX - (2 * m_offset), Unit.PX); m_overlayTopStyle.setLeft(posX - m_offset, Unit.PX); m_overlayTopStyle.setWidth(width + (2 * m_offset), Unit.PX); m_overlayTopStyle.setHeight(posY - m_offset, Unit.PX); m_borderTopStyle.setLeft(posX - m_offset, Unit.PX); m_borderTopStyle.setTop(posY - (2 * m_offset), Unit.PX); if (m_hasButtonBar) { m_borderTopStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX); } else { m_borderTopStyle.setWidth(width + (2 * m_offset), Unit.PX); } m_overlayBottomStyle.setLeft(posX - m_offset, Unit.PX); m_overlayBottomStyle.setWidth(width + m_offset + m_offset, Unit.PX); m_overlayBottomStyle.setHeight(useHeight - posY - height - m_offset, Unit.PX); m_overlayBottomStyle.setTop(posY + height + m_offset, Unit.PX); m_borderBottomStyle.setLeft(posX - m_offset, Unit.PX); m_borderBottomStyle.setTop((posY + height) + m_offset, Unit.PX); if (m_hasButtonBar) { m_borderBottomStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX); } else { m_borderBottomStyle.setWidth(width + (2 * m_offset), Unit.PX); } m_overlayRightStyle.setLeft(posX + width + m_offset, Unit.PX); m_overlayRightStyle.setWidth(useWidth - posX - width - m_offset, Unit.PX); m_overlayRightStyle.setHeight(useHeight, Unit.PX); m_borderRightStyle.setHeight(height + (4 * m_offset), Unit.PX); m_borderRightStyle.setTop(posY - (2 * m_offset), Unit.PX); if (m_hasButtonBar) { m_borderRightStyle.setLeft(posX + width + m_offset + BUTTON_BAR_WIDTH, Unit.PX); } else { m_borderRightStyle.setLeft(posX + width + m_offset, Unit.PX); } m_buttonBar.getStyle().setTop(posY - m_offset, Unit.PX); m_buttonBar.getStyle().setHeight(height + (2 * m_offset), Unit.PX); m_buttonBar.getStyle().setLeft(posX + width + m_offset + 1, Unit.PX); }
java
private void setSelectPosition(int posX, int posY, int height, int width) { int useWidth = Window.getClientWidth(); int bodyWidth = RootPanel.getBodyElement().getClientWidth() + RootPanel.getBodyElement().getOffsetLeft(); if (bodyWidth > useWidth) { useWidth = bodyWidth; } int useHeight = Window.getClientHeight(); int bodyHeight = RootPanel.getBodyElement().getClientHeight() + RootPanel.getBodyElement().getOffsetTop(); if (bodyHeight > useHeight) { useHeight = bodyHeight; } m_overlayLeftStyle.setWidth(posX - m_offset, Unit.PX); m_overlayLeftStyle.setHeight(useHeight, Unit.PX); m_borderLeftStyle.setHeight(height + (4 * m_offset), Unit.PX); m_borderLeftStyle.setTop(posY - (2 * m_offset), Unit.PX); m_borderLeftStyle.setLeft(posX - (2 * m_offset), Unit.PX); m_overlayTopStyle.setLeft(posX - m_offset, Unit.PX); m_overlayTopStyle.setWidth(width + (2 * m_offset), Unit.PX); m_overlayTopStyle.setHeight(posY - m_offset, Unit.PX); m_borderTopStyle.setLeft(posX - m_offset, Unit.PX); m_borderTopStyle.setTop(posY - (2 * m_offset), Unit.PX); if (m_hasButtonBar) { m_borderTopStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX); } else { m_borderTopStyle.setWidth(width + (2 * m_offset), Unit.PX); } m_overlayBottomStyle.setLeft(posX - m_offset, Unit.PX); m_overlayBottomStyle.setWidth(width + m_offset + m_offset, Unit.PX); m_overlayBottomStyle.setHeight(useHeight - posY - height - m_offset, Unit.PX); m_overlayBottomStyle.setTop(posY + height + m_offset, Unit.PX); m_borderBottomStyle.setLeft(posX - m_offset, Unit.PX); m_borderBottomStyle.setTop((posY + height) + m_offset, Unit.PX); if (m_hasButtonBar) { m_borderBottomStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX); } else { m_borderBottomStyle.setWidth(width + (2 * m_offset), Unit.PX); } m_overlayRightStyle.setLeft(posX + width + m_offset, Unit.PX); m_overlayRightStyle.setWidth(useWidth - posX - width - m_offset, Unit.PX); m_overlayRightStyle.setHeight(useHeight, Unit.PX); m_borderRightStyle.setHeight(height + (4 * m_offset), Unit.PX); m_borderRightStyle.setTop(posY - (2 * m_offset), Unit.PX); if (m_hasButtonBar) { m_borderRightStyle.setLeft(posX + width + m_offset + BUTTON_BAR_WIDTH, Unit.PX); } else { m_borderRightStyle.setLeft(posX + width + m_offset, Unit.PX); } m_buttonBar.getStyle().setTop(posY - m_offset, Unit.PX); m_buttonBar.getStyle().setHeight(height + (2 * m_offset), Unit.PX); m_buttonBar.getStyle().setLeft(posX + width + m_offset + 1, Unit.PX); }
[ "private", "void", "setSelectPosition", "(", "int", "posX", ",", "int", "posY", ",", "int", "height", ",", "int", "width", ")", "{", "int", "useWidth", "=", "Window", ".", "getClientWidth", "(", ")", ";", "int", "bodyWidth", "=", "RootPanel", ".", "getBo...
Sets position and size of the overlay area.<p> @param posX the new X position @param posY the new Y position @param height the new height @param width the new width
[ "Sets", "position", "and", "size", "of", "the", "overlay", "area", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/ui/CmsInlineEditOverlay.java#L451-L511
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.optPointF
public static <P extends Enum<P>> PointF optPointF(final JSONObject json, P e, boolean emptyForNull) { """ Return the value mapped by enum if it exists and is a {@link JSONObject} by mapping "x" and "y" members into a {@link Point}. If the value does not exist by that enum, and {@code emptyForNull} is {@code true}, returns a default constructed {@code Point}. Otherwise, returns {@code null}. @param json {@code JSONObject} to get data from @param e {@link Enum} labeling the data to get @param emptyForNull {@code True} to return a default constructed {@code Point} if there is no mapped data, {@code false} to return {@code null} in that case @return A {@code Point} if the mapping exists or {@code emptyForNull} is {@code true}; {@code null} otherwise """ PointF p = optPointF(json, e); if (p == null && emptyForNull) { p = new PointF(); } return p; }
java
public static <P extends Enum<P>> PointF optPointF(final JSONObject json, P e, boolean emptyForNull) { PointF p = optPointF(json, e); if (p == null && emptyForNull) { p = new PointF(); } return p; }
[ "public", "static", "<", "P", "extends", "Enum", "<", "P", ">", ">", "PointF", "optPointF", "(", "final", "JSONObject", "json", ",", "P", "e", ",", "boolean", "emptyForNull", ")", "{", "PointF", "p", "=", "optPointF", "(", "json", ",", "e", ")", ";",...
Return the value mapped by enum if it exists and is a {@link JSONObject} by mapping "x" and "y" members into a {@link Point}. If the value does not exist by that enum, and {@code emptyForNull} is {@code true}, returns a default constructed {@code Point}. Otherwise, returns {@code null}. @param json {@code JSONObject} to get data from @param e {@link Enum} labeling the data to get @param emptyForNull {@code True} to return a default constructed {@code Point} if there is no mapped data, {@code false} to return {@code null} in that case @return A {@code Point} if the mapping exists or {@code emptyForNull} is {@code true}; {@code null} otherwise
[ "Return", "the", "value", "mapped", "by", "enum", "if", "it", "exists", "and", "is", "a", "{", "@link", "JSONObject", "}", "by", "mapping", "x", "and", "y", "members", "into", "a", "{", "@link", "Point", "}", ".", "If", "the", "value", "does", "not",...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L613-L619
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java
SequenceGibbsSampler.sampleSequenceBackward
public void sampleSequenceBackward(SequenceModel model, int[] sequence, double temperature) { """ Samples the complete sequence once in the backward direction Destructively modifies the sequence in place. @param sequence the sequence to start with. """ for (int pos=sequence.length-1; pos>=0; pos--) { samplePosition(model, sequence, pos, temperature); } }
java
public void sampleSequenceBackward(SequenceModel model, int[] sequence, double temperature) { for (int pos=sequence.length-1; pos>=0; pos--) { samplePosition(model, sequence, pos, temperature); } }
[ "public", "void", "sampleSequenceBackward", "(", "SequenceModel", "model", ",", "int", "[", "]", "sequence", ",", "double", "temperature", ")", "{", "for", "(", "int", "pos", "=", "sequence", ".", "length", "-", "1", ";", "pos", ">=", "0", ";", "pos", ...
Samples the complete sequence once in the backward direction Destructively modifies the sequence in place. @param sequence the sequence to start with.
[ "Samples", "the", "complete", "sequence", "once", "in", "the", "backward", "direction", "Destructively", "modifies", "the", "sequence", "in", "place", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java#L217-L221
200Puls/darksky-forecast-api
darksky-forecast-api/src/main/java/tk/plogitech/darksky/forecast/DarkSkyClient.java
DarkSkyClient.forecastJsonBytes
public byte[] forecastJsonBytes(ForecastRequest request) throws ForecastException { """ Returns the forecast response as bytes. @param request The Forecast Request which is executed. Use {@link ForecastRequestBuilder} to build the request. @return The forecast unparsed as byte encoded Json. @throws ForecastException if the forecast cannot be fetched. """ notNull("The ForecastRequest cannot be null.", request); logger.log(Level.FINE, "Executing Forecat request: {0}", request); try (InputStream is = executeForecastRequest(request)) { return IOUtil.readFully(is); } catch (IOException e) { throw new ForecastException("Forecast cannot be fetched.", e); } }
java
public byte[] forecastJsonBytes(ForecastRequest request) throws ForecastException { notNull("The ForecastRequest cannot be null.", request); logger.log(Level.FINE, "Executing Forecat request: {0}", request); try (InputStream is = executeForecastRequest(request)) { return IOUtil.readFully(is); } catch (IOException e) { throw new ForecastException("Forecast cannot be fetched.", e); } }
[ "public", "byte", "[", "]", "forecastJsonBytes", "(", "ForecastRequest", "request", ")", "throws", "ForecastException", "{", "notNull", "(", "\"The ForecastRequest cannot be null.\"", ",", "request", ")", ";", "logger", ".", "log", "(", "Level", ".", "FINE", ",", ...
Returns the forecast response as bytes. @param request The Forecast Request which is executed. Use {@link ForecastRequestBuilder} to build the request. @return The forecast unparsed as byte encoded Json. @throws ForecastException if the forecast cannot be fetched.
[ "Returns", "the", "forecast", "response", "as", "bytes", "." ]
train
https://github.com/200Puls/darksky-forecast-api/blob/512eeb90cce5df8aadac12d7986a054127191482/darksky-forecast-api/src/main/java/tk/plogitech/darksky/forecast/DarkSkyClient.java#L82-L92
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
JaxbUtils.createXmlStreamReader
public static XMLStreamReader createXmlStreamReader(Path path, boolean namespaceAware) throws JAXBException { """ Creates an XMLStreamReader based on a file path. @param path the path to the file to be parsed @param namespaceAware if {@code false} the XMLStreamReader will remove all namespaces from all XML elements @return platform-specific XMLStreamReader implementation @throws JAXBException if the XMLStreamReader could not be created """ XMLInputFactory xif = getXmlInputFactory(namespaceAware); XMLStreamReader xsr = null; try { xsr = xif.createXMLStreamReader(new StreamSource(path.toFile())); } catch (XMLStreamException e) { throw new JAXBException(e); } return xsr; }
java
public static XMLStreamReader createXmlStreamReader(Path path, boolean namespaceAware) throws JAXBException { XMLInputFactory xif = getXmlInputFactory(namespaceAware); XMLStreamReader xsr = null; try { xsr = xif.createXMLStreamReader(new StreamSource(path.toFile())); } catch (XMLStreamException e) { throw new JAXBException(e); } return xsr; }
[ "public", "static", "XMLStreamReader", "createXmlStreamReader", "(", "Path", "path", ",", "boolean", "namespaceAware", ")", "throws", "JAXBException", "{", "XMLInputFactory", "xif", "=", "getXmlInputFactory", "(", "namespaceAware", ")", ";", "XMLStreamReader", "xsr", ...
Creates an XMLStreamReader based on a file path. @param path the path to the file to be parsed @param namespaceAware if {@code false} the XMLStreamReader will remove all namespaces from all XML elements @return platform-specific XMLStreamReader implementation @throws JAXBException if the XMLStreamReader could not be created
[ "Creates", "an", "XMLStreamReader", "based", "on", "a", "file", "path", "." ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L95-L105
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/paint/PainterExtensions.java
PainterExtensions.getCompoundPainter
@SuppressWarnings("rawtypes") public static CompoundPainter getCompoundPainter(final Color color, final GlossPainter.GlossPosition position, final double angle) { """ Gets the compound painter. @param color the color @param position the position @param angle the angle @return the compound painter """ final MattePainter mp = new MattePainter(color); final GlossPainter gp = new GlossPainter(color, position); final PinstripePainter pp = new PinstripePainter(color, angle); final CompoundPainter compoundPainter = new CompoundPainter(mp, pp, gp); return compoundPainter; }
java
@SuppressWarnings("rawtypes") public static CompoundPainter getCompoundPainter(final Color color, final GlossPainter.GlossPosition position, final double angle) { final MattePainter mp = new MattePainter(color); final GlossPainter gp = new GlossPainter(color, position); final PinstripePainter pp = new PinstripePainter(color, angle); final CompoundPainter compoundPainter = new CompoundPainter(mp, pp, gp); return compoundPainter; }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "CompoundPainter", "getCompoundPainter", "(", "final", "Color", "color", ",", "final", "GlossPainter", ".", "GlossPosition", "position", ",", "final", "double", "angle", ")", "{", "final", "Mat...
Gets the compound painter. @param color the color @param position the position @param angle the angle @return the compound painter
[ "Gets", "the", "compound", "painter", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/paint/PainterExtensions.java#L79-L89
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.methodInvocation
public static Matcher<ExpressionTree> methodInvocation( Matcher<ExpressionTree> methodSelectMatcher, MatchType matchType, Matcher<ExpressionTree> methodArgumentMatcher) { """ Matches an AST node if it is a method invocation and the given matchers match. @param methodSelectMatcher matcher identifying the method being called @param matchType how to match method arguments with {@code methodArgumentMatcher} @param methodArgumentMatcher matcher applied to each method argument """ return new MethodInvocation(methodSelectMatcher, matchType, methodArgumentMatcher); }
java
public static Matcher<ExpressionTree> methodInvocation( Matcher<ExpressionTree> methodSelectMatcher, MatchType matchType, Matcher<ExpressionTree> methodArgumentMatcher) { return new MethodInvocation(methodSelectMatcher, matchType, methodArgumentMatcher); }
[ "public", "static", "Matcher", "<", "ExpressionTree", ">", "methodInvocation", "(", "Matcher", "<", "ExpressionTree", ">", "methodSelectMatcher", ",", "MatchType", "matchType", ",", "Matcher", "<", "ExpressionTree", ">", "methodArgumentMatcher", ")", "{", "return", ...
Matches an AST node if it is a method invocation and the given matchers match. @param methodSelectMatcher matcher identifying the method being called @param matchType how to match method arguments with {@code methodArgumentMatcher} @param methodArgumentMatcher matcher applied to each method argument
[ "Matches", "an", "AST", "node", "if", "it", "is", "a", "method", "invocation", "and", "the", "given", "matchers", "match", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L363-L368
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.prependIfMissing
private static String prependIfMissing(final String str, final CharSequence prefix, final boolean ignoreCase, final CharSequence... prefixes) { """ Prepends the prefix to the start of the string if the string does not already start with any of the prefixes. @param str The string. @param prefix The prefix to prepend to the start of the string. @param ignoreCase Indicates whether the compare should ignore case. @param prefixes Additional prefixes that are valid (optional). @return A new String if prefix was prepended, the same string otherwise. """ if (str == null || isEmpty(prefix) || startsWith(str, prefix, ignoreCase)) { return str; } if (prefixes != null && prefixes.length > 0) { for (final CharSequence p : prefixes) { if (startsWith(str, p, ignoreCase)) { return str; } } } return prefix.toString() + str; }
java
private static String prependIfMissing(final String str, final CharSequence prefix, final boolean ignoreCase, final CharSequence... prefixes) { if (str == null || isEmpty(prefix) || startsWith(str, prefix, ignoreCase)) { return str; } if (prefixes != null && prefixes.length > 0) { for (final CharSequence p : prefixes) { if (startsWith(str, p, ignoreCase)) { return str; } } } return prefix.toString() + str; }
[ "private", "static", "String", "prependIfMissing", "(", "final", "String", "str", ",", "final", "CharSequence", "prefix", ",", "final", "boolean", "ignoreCase", ",", "final", "CharSequence", "...", "prefixes", ")", "{", "if", "(", "str", "==", "null", "||", ...
Prepends the prefix to the start of the string if the string does not already start with any of the prefixes. @param str The string. @param prefix The prefix to prepend to the start of the string. @param ignoreCase Indicates whether the compare should ignore case. @param prefixes Additional prefixes that are valid (optional). @return A new String if prefix was prepended, the same string otherwise.
[ "Prepends", "the", "prefix", "to", "the", "start", "of", "the", "string", "if", "the", "string", "does", "not", "already", "start", "with", "any", "of", "the", "prefixes", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8867-L8879
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java
Grid.getGridCellsOn
protected Iterable<GridCell<P>> getGridCellsOn(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds, boolean createCells) { """ Replies the grid cells that are intersecting the specified bounds. @param bounds the bounds @param createCells indicates if the not already created cells should be created. @return the grid cells. """ if (bounds.intersects(this.bounds)) { final int c1 = getColumnFor(bounds.getMinX()); final int r1 = getRowFor(bounds.getMinY()); final int c2 = getColumnFor(bounds.getMaxX()); final int r2 = getRowFor(bounds.getMaxY()); return new CellIterable(r1, c1, r2, c2, createCells); } return Collections.emptyList(); }
java
protected Iterable<GridCell<P>> getGridCellsOn(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds, boolean createCells) { if (bounds.intersects(this.bounds)) { final int c1 = getColumnFor(bounds.getMinX()); final int r1 = getRowFor(bounds.getMinY()); final int c2 = getColumnFor(bounds.getMaxX()); final int r2 = getRowFor(bounds.getMaxY()); return new CellIterable(r1, c1, r2, c2, createCells); } return Collections.emptyList(); }
[ "protected", "Iterable", "<", "GridCell", "<", "P", ">", ">", "getGridCellsOn", "(", "Rectangle2afp", "<", "?", ",", "?", ",", "?", ",", "?", ",", "?", ",", "?", ">", "bounds", ",", "boolean", "createCells", ")", "{", "if", "(", "bounds", ".", "int...
Replies the grid cells that are intersecting the specified bounds. @param bounds the bounds @param createCells indicates if the not already created cells should be created. @return the grid cells.
[ "Replies", "the", "grid", "cells", "that", "are", "intersecting", "the", "specified", "bounds", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java#L289-L298
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Waiter.java
Waiter.waitForView
public View waitForView(View view, int timeout) { """ Waits for a given view. @param view the view to wait for @param timeout the amount of time in milliseconds to wait @return {@code true} if view is shown and {@code false} if it is not shown before the timeout """ return waitForView(view, timeout, true, true); }
java
public View waitForView(View view, int timeout){ return waitForView(view, timeout, true, true); }
[ "public", "View", "waitForView", "(", "View", "view", ",", "int", "timeout", ")", "{", "return", "waitForView", "(", "view", ",", "timeout", ",", "true", ",", "true", ")", ";", "}" ]
Waits for a given view. @param view the view to wait for @param timeout the amount of time in milliseconds to wait @return {@code true} if view is shown and {@code false} if it is not shown before the timeout
[ "Waits", "for", "a", "given", "view", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L320-L322
temyers/cucumber-jvm-parallel-plugin
src/main/java/com/github/timm/cucumber/generate/GenerateRunnersMojo.java
GenerateRunnersMojo.overrideParametersWithCucumberOptions
private OverriddenCucumberOptionsParameters overrideParametersWithCucumberOptions() throws MojoExecutionException { """ Overrides the parameters with cucumber.options if they have been specified. Plugins have somewhat limited support. """ try { final OverriddenCucumberOptionsParameters overriddenParameters = new OverriddenCucumberOptionsParameters() .setTags(tags) .setGlue(glue) .setStrict(strict) .setPlugins(parseFormatAndPlugins(format, plugins == null ? new ArrayList<Plugin>() : plugins)) .setMonochrome(monochrome); if (cucumberOptions != null && cucumberOptions.length() > 0) { final RuntimeOptions options = new RuntimeOptions(cucumberOptions); overriddenParameters .overrideTags(options.getFilters()) .overrideGlue(options.getGlue()) .overridePlugins(parsePlugins(options.getPluginNames())) .overrideStrict(options.isStrict()) .overrideMonochrome(options.isMonochrome()); } return overriddenParameters; } catch (IllegalArgumentException e) { throw new MojoExecutionException(this, "Invalid parameter. ", e.getMessage()); } }
java
private OverriddenCucumberOptionsParameters overrideParametersWithCucumberOptions() throws MojoExecutionException { try { final OverriddenCucumberOptionsParameters overriddenParameters = new OverriddenCucumberOptionsParameters() .setTags(tags) .setGlue(glue) .setStrict(strict) .setPlugins(parseFormatAndPlugins(format, plugins == null ? new ArrayList<Plugin>() : plugins)) .setMonochrome(monochrome); if (cucumberOptions != null && cucumberOptions.length() > 0) { final RuntimeOptions options = new RuntimeOptions(cucumberOptions); overriddenParameters .overrideTags(options.getFilters()) .overrideGlue(options.getGlue()) .overridePlugins(parsePlugins(options.getPluginNames())) .overrideStrict(options.isStrict()) .overrideMonochrome(options.isMonochrome()); } return overriddenParameters; } catch (IllegalArgumentException e) { throw new MojoExecutionException(this, "Invalid parameter. ", e.getMessage()); } }
[ "private", "OverriddenCucumberOptionsParameters", "overrideParametersWithCucumberOptions", "(", ")", "throws", "MojoExecutionException", "{", "try", "{", "final", "OverriddenCucumberOptionsParameters", "overriddenParameters", "=", "new", "OverriddenCucumberOptionsParameters", "(", ...
Overrides the parameters with cucumber.options if they have been specified. Plugins have somewhat limited support.
[ "Overrides", "the", "parameters", "with", "cucumber", ".", "options", "if", "they", "have", "been", "specified", ".", "Plugins", "have", "somewhat", "limited", "support", "." ]
train
https://github.com/temyers/cucumber-jvm-parallel-plugin/blob/931628fc1e2822be667ec216e10e706993974aa4/src/main/java/com/github/timm/cucumber/generate/GenerateRunnersMojo.java#L238-L264
olivergondza/dumpling
core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java
ProcessThread.acquiredLock
public static @Nonnull Predicate acquiredLock(final @Nonnull String className) { """ Match thread that has acquired lock identified by <tt>className</tt>. """ return new Predicate() { @Override public boolean isValid(@Nonnull ProcessThread<?, ?, ?> thread) { for (ThreadLock lock: thread.getAcquiredLocks()) { if (lock.getClassName().equals(className)) return true; } return false; } }; }
java
public static @Nonnull Predicate acquiredLock(final @Nonnull String className) { return new Predicate() { @Override public boolean isValid(@Nonnull ProcessThread<?, ?, ?> thread) { for (ThreadLock lock: thread.getAcquiredLocks()) { if (lock.getClassName().equals(className)) return true; } return false; } }; }
[ "public", "static", "@", "Nonnull", "Predicate", "acquiredLock", "(", "final", "@", "Nonnull", "String", "className", ")", "{", "return", "new", "Predicate", "(", ")", "{", "@", "Override", "public", "boolean", "isValid", "(", "@", "Nonnull", "ProcessThread", ...
Match thread that has acquired lock identified by <tt>className</tt>.
[ "Match", "thread", "that", "has", "acquired", "lock", "identified", "by", "<tt", ">", "className<", "/", "tt", ">", "." ]
train
https://github.com/olivergondza/dumpling/blob/ac698735fcc7c023db0c1637cc1f522cb3576c7f/core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java#L566-L576
jbundle/osgi
core/src/main/java/org/jbundle/util/osgi/finder/BaseClassFinderService.java
BaseClassFinderService.checkService
private ServiceReference checkService(ServiceReference serviceReference, String interfaceClassName) { """ Make sure this service reference is the correct interface/class @param serviceReference @param interfaceClassName @param serviceClassName @return """ if (serviceReference != null) { Object service = bundleContext.getService(serviceReference); if (service != null) { try { if (interfaceClassName != null) if (!service.getClass().isAssignableFrom(Class.forName(interfaceClassName))) serviceReference = null; } catch (ClassNotFoundException e) { // Ignore this error } } } return serviceReference; }
java
private ServiceReference checkService(ServiceReference serviceReference, String interfaceClassName) { if (serviceReference != null) { Object service = bundleContext.getService(serviceReference); if (service != null) { try { if (interfaceClassName != null) if (!service.getClass().isAssignableFrom(Class.forName(interfaceClassName))) serviceReference = null; } catch (ClassNotFoundException e) { // Ignore this error } } } return serviceReference; }
[ "private", "ServiceReference", "checkService", "(", "ServiceReference", "serviceReference", ",", "String", "interfaceClassName", ")", "{", "if", "(", "serviceReference", "!=", "null", ")", "{", "Object", "service", "=", "bundleContext", ".", "getService", "(", "serv...
Make sure this service reference is the correct interface/class @param serviceReference @param interfaceClassName @param serviceClassName @return
[ "Make", "sure", "this", "service", "reference", "is", "the", "correct", "interface", "/", "class" ]
train
https://github.com/jbundle/osgi/blob/beb02aef78736a4f799aaac001c8f0327bf0536c/core/src/main/java/org/jbundle/util/osgi/finder/BaseClassFinderService.java#L345-L362
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java
ParticleIO.loadConfiguredSystem
public static ParticleSystem loadConfiguredSystem(InputStream ref, ConfigurableEmitterFactory factory) throws IOException { """ Load a set of configured emitters into a single system @param ref The stream to read the XML from @return A configured particle system @param factory The factory used to create the emitter than will be poulated with loaded data. @throws IOException Indicates a failure to find, read or parse the XML file """ return loadConfiguredSystem(ref, factory, null, null); }
java
public static ParticleSystem loadConfiguredSystem(InputStream ref, ConfigurableEmitterFactory factory) throws IOException { return loadConfiguredSystem(ref, factory, null, null); }
[ "public", "static", "ParticleSystem", "loadConfiguredSystem", "(", "InputStream", "ref", ",", "ConfigurableEmitterFactory", "factory", ")", "throws", "IOException", "{", "return", "loadConfiguredSystem", "(", "ref", ",", "factory", ",", "null", ",", "null", ")", ";"...
Load a set of configured emitters into a single system @param ref The stream to read the XML from @return A configured particle system @param factory The factory used to create the emitter than will be poulated with loaded data. @throws IOException Indicates a failure to find, read or parse the XML file
[ "Load", "a", "set", "of", "configured", "emitters", "into", "a", "single", "system" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleIO.java#L161-L164
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraSessionImpl.java
FedoraSessionImpl.addSessionData
@Override public void addSessionData(final String key, final String value) { """ Add session data @param key the data key @param value the data value Note: while the FedoraSession interface permits multi-valued session data, this implementation constrains that to be single-valued. That is, calling obj.addSessionData("key", "value1") followed by obj.addSessionData("key", "value2") will result in only "value2" being associated with the given key. """ sessionData.put(key, value); }
java
@Override public void addSessionData(final String key, final String value) { sessionData.put(key, value); }
[ "@", "Override", "public", "void", "addSessionData", "(", "final", "String", "key", ",", "final", "String", "value", ")", "{", "sessionData", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Add session data @param key the data key @param value the data value Note: while the FedoraSession interface permits multi-valued session data, this implementation constrains that to be single-valued. That is, calling obj.addSessionData("key", "value1") followed by obj.addSessionData("key", "value2") will result in only "value2" being associated with the given key.
[ "Add", "session", "data", "@param", "key", "the", "data", "key", "@param", "value", "the", "data", "value" ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraSessionImpl.java#L148-L151
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/VisualizerContext.java
VisualizerContext.makeStyleResult
protected void makeStyleResult(StyleLibrary stylelib) { """ Generate a new style result for the given style library. @param stylelib Style library """ final Database db = ResultUtil.findDatabase(hier); stylelibrary = stylelib; List<Clustering<? extends Model>> clusterings = Clustering.getClusteringResults(db); if(!clusterings.isEmpty()) { stylepolicy = new ClusterStylingPolicy(clusterings.get(0), stylelib); } else { Clustering<Model> c = generateDefaultClustering(); stylepolicy = new ClusterStylingPolicy(c, stylelib); } }
java
protected void makeStyleResult(StyleLibrary stylelib) { final Database db = ResultUtil.findDatabase(hier); stylelibrary = stylelib; List<Clustering<? extends Model>> clusterings = Clustering.getClusteringResults(db); if(!clusterings.isEmpty()) { stylepolicy = new ClusterStylingPolicy(clusterings.get(0), stylelib); } else { Clustering<Model> c = generateDefaultClustering(); stylepolicy = new ClusterStylingPolicy(c, stylelib); } }
[ "protected", "void", "makeStyleResult", "(", "StyleLibrary", "stylelib", ")", "{", "final", "Database", "db", "=", "ResultUtil", ".", "findDatabase", "(", "hier", ")", ";", "stylelibrary", "=", "stylelib", ";", "List", "<", "Clustering", "<", "?", "extends", ...
Generate a new style result for the given style library. @param stylelib Style library
[ "Generate", "a", "new", "style", "result", "for", "the", "given", "style", "library", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/VisualizerContext.java#L171-L182
ironjacamar/ironjacamar
deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java
AbstractResourceAdapterDeployer.createAdminObject
protected void createAdminObject(DeploymentBuilder builder, Connector connector, AdminObject ao) throws DeployException { """ Create admin object instance @param builder The deployment builder @param connector The metadata @param ao The admin object @throws DeployException Thrown if the admin object cant be created """ try { String aoClass = findAdminObject(ao.getClassName(), connector); Class<?> clz = Class.forName(aoClass, true, builder.getClassLoader()); Object adminObject = clz.newInstance(); Collection<org.ironjacamar.common.api.metadata.spec.ConfigProperty> configProperties = findConfigProperties( aoClass, connector); Collection<org.ironjacamar.core.api.deploymentrepository.ConfigProperty> dcps = injectConfigProperties( adminObject, configProperties, ao.getConfigProperties(), builder.getClassLoader()); validationObj.add(new ValidateClass(Key.ADMIN_OBJECT, clz, configProperties)); org.ironjacamar.core.spi.statistics.StatisticsPlugin statisticsPlugin = null; if (adminObject instanceof org.ironjacamar.core.spi.statistics.Statistics) statisticsPlugin = ((org.ironjacamar.core.spi.statistics.Statistics)adminObject).getStatistics(); if (builder.getResourceAdapter() != null) associateResourceAdapter(builder.getResourceAdapter().getResourceAdapter(), adminObject); builder.adminObject(new AdminObjectImpl(ao.getJndiName(), adminObject, dcps, ao, statisticsPlugin, jndiStrategy)); } catch (Throwable t) { throw new DeployException(bundle.unableToCreateAdminObject(ao.getId(), ao.getJndiName()), t); } }
java
protected void createAdminObject(DeploymentBuilder builder, Connector connector, AdminObject ao) throws DeployException { try { String aoClass = findAdminObject(ao.getClassName(), connector); Class<?> clz = Class.forName(aoClass, true, builder.getClassLoader()); Object adminObject = clz.newInstance(); Collection<org.ironjacamar.common.api.metadata.spec.ConfigProperty> configProperties = findConfigProperties( aoClass, connector); Collection<org.ironjacamar.core.api.deploymentrepository.ConfigProperty> dcps = injectConfigProperties( adminObject, configProperties, ao.getConfigProperties(), builder.getClassLoader()); validationObj.add(new ValidateClass(Key.ADMIN_OBJECT, clz, configProperties)); org.ironjacamar.core.spi.statistics.StatisticsPlugin statisticsPlugin = null; if (adminObject instanceof org.ironjacamar.core.spi.statistics.Statistics) statisticsPlugin = ((org.ironjacamar.core.spi.statistics.Statistics)adminObject).getStatistics(); if (builder.getResourceAdapter() != null) associateResourceAdapter(builder.getResourceAdapter().getResourceAdapter(), adminObject); builder.adminObject(new AdminObjectImpl(ao.getJndiName(), adminObject, dcps, ao, statisticsPlugin, jndiStrategy)); } catch (Throwable t) { throw new DeployException(bundle.unableToCreateAdminObject(ao.getId(), ao.getJndiName()), t); } }
[ "protected", "void", "createAdminObject", "(", "DeploymentBuilder", "builder", ",", "Connector", "connector", ",", "AdminObject", "ao", ")", "throws", "DeployException", "{", "try", "{", "String", "aoClass", "=", "findAdminObject", "(", "ao", ".", "getClassName", ...
Create admin object instance @param builder The deployment builder @param connector The metadata @param ao The admin object @throws DeployException Thrown if the admin object cant be created
[ "Create", "admin", "object", "instance" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java#L615-L646
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.deleteUserDataPair
public void deleteUserDataPair(String connId, String key) throws WorkspaceApiException { """ Delete data with the specified key from the call's user data. @param connId The connection ID of the call. @param key The key of the data to remove. """ try { VoicecallsiddeleteuserdatapairData deletePairData = new VoicecallsiddeleteuserdatapairData(); deletePairData.setKey(key); KeyData data = new KeyData(); data.data(deletePairData); ApiSuccessResponse response = this.voiceApi.deleteUserDataPair(connId, data); throwIfNotOk("deleteUserDataPair", response); } catch (ApiException e) { throw new WorkspaceApiException("deleteUserDataPair failed.", e); } }
java
public void deleteUserDataPair(String connId, String key) throws WorkspaceApiException { try { VoicecallsiddeleteuserdatapairData deletePairData = new VoicecallsiddeleteuserdatapairData(); deletePairData.setKey(key); KeyData data = new KeyData(); data.data(deletePairData); ApiSuccessResponse response = this.voiceApi.deleteUserDataPair(connId, data); throwIfNotOk("deleteUserDataPair", response); } catch (ApiException e) { throw new WorkspaceApiException("deleteUserDataPair failed.", e); } }
[ "public", "void", "deleteUserDataPair", "(", "String", "connId", ",", "String", "key", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsiddeleteuserdatapairData", "deletePairData", "=", "new", "VoicecallsiddeleteuserdatapairData", "(", ")", ";", "dele...
Delete data with the specified key from the call's user data. @param connId The connection ID of the call. @param key The key of the data to remove.
[ "Delete", "data", "with", "the", "specified", "key", "from", "the", "call", "s", "user", "data", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1104-L1117
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.backupStorageAccountAsync
public Observable<BackupStorageResult> backupStorageAccountAsync(String vaultBaseUrl, String storageAccountName) { """ Backs up the specified storage account. Requests that a backup of the specified storage account be downloaded to the client. This operation requires the storage/backup permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackupStorageResult object """ return backupStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<BackupStorageResult>, BackupStorageResult>() { @Override public BackupStorageResult call(ServiceResponse<BackupStorageResult> response) { return response.body(); } }); }
java
public Observable<BackupStorageResult> backupStorageAccountAsync(String vaultBaseUrl, String storageAccountName) { return backupStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<BackupStorageResult>, BackupStorageResult>() { @Override public BackupStorageResult call(ServiceResponse<BackupStorageResult> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BackupStorageResult", ">", "backupStorageAccountAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ")", "{", "return", "backupStorageAccountWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "storageAccountName", ")", ...
Backs up the specified storage account. Requests that a backup of the specified storage account be downloaded to the client. This operation requires the storage/backup permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackupStorageResult object
[ "Backs", "up", "the", "specified", "storage", "account", ".", "Requests", "that", "a", "backup", "of", "the", "specified", "storage", "account", "be", "downloaded", "to", "the", "client", ".", "This", "operation", "requires", "the", "storage", "/", "backup", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9547-L9554
beders/Resty
src/main/java/us/monoid/web/auth/RestyAuthenticator.java
RestyAuthenticator.addSite
public void addSite(URI aRootUrl, String login, char[] pwd) { """ Add or replace an authentication for a root URL aka site. @param aRootUrl @param login @param pwd """ String rootUri = aRootUrl.normalize().toString(); boolean replaced = false; // check if we already have a login/password for the root uri for (Site site : sites) { if (site.root.equals(rootUri)) { // TODO synchronisation site.login = login; site.pwd = pwd; replaced = true; break; } } if (!replaced) { Site s = new Site(); s.root = rootUri; s.login = login; s.pwd = pwd; sites.add(s); } }
java
public void addSite(URI aRootUrl, String login, char[] pwd) { String rootUri = aRootUrl.normalize().toString(); boolean replaced = false; // check if we already have a login/password for the root uri for (Site site : sites) { if (site.root.equals(rootUri)) { // TODO synchronisation site.login = login; site.pwd = pwd; replaced = true; break; } } if (!replaced) { Site s = new Site(); s.root = rootUri; s.login = login; s.pwd = pwd; sites.add(s); } }
[ "public", "void", "addSite", "(", "URI", "aRootUrl", ",", "String", "login", ",", "char", "[", "]", "pwd", ")", "{", "String", "rootUri", "=", "aRootUrl", ".", "normalize", "(", ")", ".", "toString", "(", ")", ";", "boolean", "replaced", "=", "false", ...
Add or replace an authentication for a root URL aka site. @param aRootUrl @param login @param pwd
[ "Add", "or", "replace", "an", "authentication", "for", "a", "root", "URL", "aka", "site", "." ]
train
https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/auth/RestyAuthenticator.java#L60-L79
javers/javers
javers-core/src/main/java/org/javers/core/JaversBuilder.java
JaversBuilder.registerValue
public <T> JaversBuilder registerValue(Class<T> valueClass, CustomValueComparator<T> customValueComparator) { """ Registers a {@link ValueType} with a custom comparator to be used instead of default {@link Object#equals(Object)}. <br/><br/> Given comparator is used when given Value type is: <ul> <li/>simple property <li/>List item <li/>Array item <li/>Map value </ul> Since this comparator is not aligned with {@link Object#hashCode()}, it <b>is not used </b> when given Value type is: <ul> <li/>Map key <li/>Set item </ul> For example, BigDecimals are (by default) ValueTypes compared using {@link java.math.BigDecimal#equals(Object)}. If you want to compare them in the smarter way, ignoring trailing zeros: <pre> javersBuilder.registerValue(BigDecimal.class, (a,b) -> a.compareTo(b) == 0); </pre> @see <a href="http://javers.org/documentation/domain-configuration/#ValueType">http://javers.org/documentation/domain-configuration/#ValueType</a> @since 3.3 """ argumentsAreNotNull(valueClass, customValueComparator); if (!clientsClassDefinitions.containsKey(valueClass)){ registerType(new ValueDefinition(valueClass)); } ValueDefinition def = getClassDefinition(valueClass); def.setCustomValueComparator(customValueComparator); return this; }
java
public <T> JaversBuilder registerValue(Class<T> valueClass, CustomValueComparator<T> customValueComparator) { argumentsAreNotNull(valueClass, customValueComparator); if (!clientsClassDefinitions.containsKey(valueClass)){ registerType(new ValueDefinition(valueClass)); } ValueDefinition def = getClassDefinition(valueClass); def.setCustomValueComparator(customValueComparator); return this; }
[ "public", "<", "T", ">", "JaversBuilder", "registerValue", "(", "Class", "<", "T", ">", "valueClass", ",", "CustomValueComparator", "<", "T", ">", "customValueComparator", ")", "{", "argumentsAreNotNull", "(", "valueClass", ",", "customValueComparator", ")", ";", ...
Registers a {@link ValueType} with a custom comparator to be used instead of default {@link Object#equals(Object)}. <br/><br/> Given comparator is used when given Value type is: <ul> <li/>simple property <li/>List item <li/>Array item <li/>Map value </ul> Since this comparator is not aligned with {@link Object#hashCode()}, it <b>is not used </b> when given Value type is: <ul> <li/>Map key <li/>Set item </ul> For example, BigDecimals are (by default) ValueTypes compared using {@link java.math.BigDecimal#equals(Object)}. If you want to compare them in the smarter way, ignoring trailing zeros: <pre> javersBuilder.registerValue(BigDecimal.class, (a,b) -> a.compareTo(b) == 0); </pre> @see <a href="http://javers.org/documentation/domain-configuration/#ValueType">http://javers.org/documentation/domain-configuration/#ValueType</a> @since 3.3
[ "Registers", "a", "{", "@link", "ValueType", "}", "with", "a", "custom", "comparator", "to", "be", "used", "instead", "of", "default", "{", "@link", "Object#equals", "(", "Object", ")", "}", ".", "<br", "/", ">", "<br", "/", ">" ]
train
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/JaversBuilder.java#L376-L386
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.isSameLocalTime
public static boolean isSameLocalTime(final Calendar cal1, final Calendar cal2) { """ <p>Checks if two calendar objects represent the same local time.</p> <p>This method compares the values of the fields of the two objects. In addition, both calendars must be the same of the same type.</p> @param cal1 the first calendar, not altered, not null @param cal2 the second calendar, not altered, not null @return true if they represent the same millisecond instant @throws IllegalArgumentException if either date is <code>null</code> @since 2.1 """ if (cal1 == null || cal2 == null) { throw new IllegalArgumentException("The date must not be null"); } return cal1.get(Calendar.MILLISECOND) == cal2.get(Calendar.MILLISECOND) && cal1.get(Calendar.SECOND) == cal2.get(Calendar.SECOND) && cal1.get(Calendar.MINUTE) == cal2.get(Calendar.MINUTE) && cal1.get(Calendar.HOUR_OF_DAY) == cal2.get(Calendar.HOUR_OF_DAY) && cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.getClass() == cal2.getClass(); }
java
public static boolean isSameLocalTime(final Calendar cal1, final Calendar cal2) { if (cal1 == null || cal2 == null) { throw new IllegalArgumentException("The date must not be null"); } return cal1.get(Calendar.MILLISECOND) == cal2.get(Calendar.MILLISECOND) && cal1.get(Calendar.SECOND) == cal2.get(Calendar.SECOND) && cal1.get(Calendar.MINUTE) == cal2.get(Calendar.MINUTE) && cal1.get(Calendar.HOUR_OF_DAY) == cal2.get(Calendar.HOUR_OF_DAY) && cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.getClass() == cal2.getClass(); }
[ "public", "static", "boolean", "isSameLocalTime", "(", "final", "Calendar", "cal1", ",", "final", "Calendar", "cal2", ")", "{", "if", "(", "cal1", "==", "null", "||", "cal2", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The dat...
<p>Checks if two calendar objects represent the same local time.</p> <p>This method compares the values of the fields of the two objects. In addition, both calendars must be the same of the same type.</p> @param cal1 the first calendar, not altered, not null @param cal2 the second calendar, not altered, not null @return true if they represent the same millisecond instant @throws IllegalArgumentException if either date is <code>null</code> @since 2.1
[ "<p", ">", "Checks", "if", "two", "calendar", "objects", "represent", "the", "same", "local", "time", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L251-L263
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Path2dfx.java
Path2dfx.isPolylineProperty
public BooleanProperty isPolylineProperty() { """ Replies the isPolyline property. @return the isPolyline property. """ if (this.isPolyline == null) { this.isPolyline = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_POLYLINE, false); this.isPolyline.bind(Bindings.createBooleanBinding(() -> { boolean first = true; boolean hasOneLine = false; for (final PathElementType type : innerTypesProperty()) { if (first) { if (type != PathElementType.MOVE_TO) { return false; } first = false; } else if (type != PathElementType.LINE_TO) { return false; } else { hasOneLine = true; } } return hasOneLine; }, innerTypesProperty())); } return this.isPolyline; }
java
public BooleanProperty isPolylineProperty() { if (this.isPolyline == null) { this.isPolyline = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_POLYLINE, false); this.isPolyline.bind(Bindings.createBooleanBinding(() -> { boolean first = true; boolean hasOneLine = false; for (final PathElementType type : innerTypesProperty()) { if (first) { if (type != PathElementType.MOVE_TO) { return false; } first = false; } else if (type != PathElementType.LINE_TO) { return false; } else { hasOneLine = true; } } return hasOneLine; }, innerTypesProperty())); } return this.isPolyline; }
[ "public", "BooleanProperty", "isPolylineProperty", "(", ")", "{", "if", "(", "this", ".", "isPolyline", "==", "null", ")", "{", "this", ".", "isPolyline", "=", "new", "ReadOnlyBooleanWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "IS_POLYLINE", ",", ...
Replies the isPolyline property. @return the isPolyline property.
[ "Replies", "the", "isPolyline", "property", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Path2dfx.java#L299-L322
networknt/light-4j
utility/src/main/java/com/networknt/utility/CodeVerifierUtil.java
CodeVerifierUtil.deriveCodeVerifierChallenge
public static String deriveCodeVerifierChallenge(String codeVerifier) { """ Produces a challenge from a code verifier, using SHA-256 as the challenge method if the system supports it (all Android devices _should_ support SHA-256), and falls back to the "plain" challenge type if unavailable. @param codeVerifier code verifier @return String derived challenge """ try { MessageDigest sha256Digester = MessageDigest.getInstance("SHA-256"); sha256Digester.update(codeVerifier.getBytes("ISO_8859_1")); byte[] digestBytes = sha256Digester.digest(); return Base64.getUrlEncoder().withoutPadding().encodeToString(digestBytes); } catch (NoSuchAlgorithmException e) { logger.warn("SHA-256 is not supported on this device! Using plain challenge", e); return codeVerifier; } catch (UnsupportedEncodingException e) { logger.error("ISO-8859-1 encoding not supported on this device!", e); throw new IllegalStateException("ISO-8859-1 encoding not supported", e); } }
java
public static String deriveCodeVerifierChallenge(String codeVerifier) { try { MessageDigest sha256Digester = MessageDigest.getInstance("SHA-256"); sha256Digester.update(codeVerifier.getBytes("ISO_8859_1")); byte[] digestBytes = sha256Digester.digest(); return Base64.getUrlEncoder().withoutPadding().encodeToString(digestBytes); } catch (NoSuchAlgorithmException e) { logger.warn("SHA-256 is not supported on this device! Using plain challenge", e); return codeVerifier; } catch (UnsupportedEncodingException e) { logger.error("ISO-8859-1 encoding not supported on this device!", e); throw new IllegalStateException("ISO-8859-1 encoding not supported", e); } }
[ "public", "static", "String", "deriveCodeVerifierChallenge", "(", "String", "codeVerifier", ")", "{", "try", "{", "MessageDigest", "sha256Digester", "=", "MessageDigest", ".", "getInstance", "(", "\"SHA-256\"", ")", ";", "sha256Digester", ".", "update", "(", "codeVe...
Produces a challenge from a code verifier, using SHA-256 as the challenge method if the system supports it (all Android devices _should_ support SHA-256), and falls back to the "plain" challenge type if unavailable. @param codeVerifier code verifier @return String derived challenge
[ "Produces", "a", "challenge", "from", "a", "code", "verifier", "using", "SHA", "-", "256", "as", "the", "challenge", "method", "if", "the", "system", "supports", "it", "(", "all", "Android", "devices", "_should_", "support", "SHA", "-", "256", ")", "and", ...
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/CodeVerifierUtil.java#L130-L143
OpenNMS/newts
cassandra/search/src/main/java/org/opennms/newts/cassandra/search/CassandraResourceTreeWalker.java
CassandraResourceTreeWalker.depthFirstSearch
public void depthFirstSearch(Context context, SearchResultVisitor visitor, Resource root) { """ Visits all nodes in the resource tree bellow the given resource using depth-first search. """ ArrayDeque<SearchResults.Result> stack = Queues.newArrayDeque(); // Build an instance of a SearchResult for the root resource // but don't invoke the visitor with it boolean skipFirstVisit = true; SearchResults initialResults = new SearchResults(); initialResults.addResult(root, new ArrayList<String>(0)); stack.add(initialResults.iterator().next()); while (!stack.isEmpty()) { SearchResults.Result r = stack.pop(); if (skipFirstVisit) { skipFirstVisit = false; } else { if (!visitor.visit(r)) { return; } } // Reverse the order of the results so we walk the left-most // branches first ImmutableList<SearchResults.Result> results = ImmutableList.copyOf(m_searcher.search( context, matchKeyAndValue(Constants.PARENT_TERM_FIELD, r.getResource().getId()))); for (SearchResults.Result result : results.reverse()) { stack.push(result); } } }
java
public void depthFirstSearch(Context context, SearchResultVisitor visitor, Resource root) { ArrayDeque<SearchResults.Result> stack = Queues.newArrayDeque(); // Build an instance of a SearchResult for the root resource // but don't invoke the visitor with it boolean skipFirstVisit = true; SearchResults initialResults = new SearchResults(); initialResults.addResult(root, new ArrayList<String>(0)); stack.add(initialResults.iterator().next()); while (!stack.isEmpty()) { SearchResults.Result r = stack.pop(); if (skipFirstVisit) { skipFirstVisit = false; } else { if (!visitor.visit(r)) { return; } } // Reverse the order of the results so we walk the left-most // branches first ImmutableList<SearchResults.Result> results = ImmutableList.copyOf(m_searcher.search( context, matchKeyAndValue(Constants.PARENT_TERM_FIELD, r.getResource().getId()))); for (SearchResults.Result result : results.reverse()) { stack.push(result); } } }
[ "public", "void", "depthFirstSearch", "(", "Context", "context", ",", "SearchResultVisitor", "visitor", ",", "Resource", "root", ")", "{", "ArrayDeque", "<", "SearchResults", ".", "Result", ">", "stack", "=", "Queues", ".", "newArrayDeque", "(", ")", ";", "// ...
Visits all nodes in the resource tree bellow the given resource using depth-first search.
[ "Visits", "all", "nodes", "in", "the", "resource", "tree", "bellow", "the", "given", "resource", "using", "depth", "-", "first", "search", "." ]
train
https://github.com/OpenNMS/newts/blob/e1b53169d8a7fbc5e9fb826da08d602f628063ea/cassandra/search/src/main/java/org/opennms/newts/cassandra/search/CassandraResourceTreeWalker.java#L100-L128
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java
ByteBuffer.appendBytes
public void appendBytes(byte[] bs, int start, int len) { """ Append `len' bytes from byte array, starting at given `start' offset. """ elems = ArrayUtils.ensureCapacity(elems, length + len); System.arraycopy(bs, start, elems, length, len); length += len; }
java
public void appendBytes(byte[] bs, int start, int len) { elems = ArrayUtils.ensureCapacity(elems, length + len); System.arraycopy(bs, start, elems, length, len); length += len; }
[ "public", "void", "appendBytes", "(", "byte", "[", "]", "bs", ",", "int", "start", ",", "int", "len", ")", "{", "elems", "=", "ArrayUtils", ".", "ensureCapacity", "(", "elems", ",", "length", "+", "len", ")", ";", "System", ".", "arraycopy", "(", "bs...
Append `len' bytes from byte array, starting at given `start' offset.
[ "Append", "len", "bytes", "from", "byte", "array", "starting", "at", "given", "start", "offset", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java#L73-L77
opoo/opoopress
wagon-providers/wagon-github/src/main/java/org/opoo/press/maven/wagon/github/GitHub.java
GitHub.getRepository
private RepositoryId getRepository(final String owner, final String name) throws GitHubException { """ Get repository and throw a {@link MojoExecutionException} on failures @param project @param owner @param name @return non-null repository id @throws MojoExecutionException """ RepositoryId repository = null; if(StringUtils.isNotBlank(name) && StringUtils.isNotBlank(owner)){ repository = RepositoryId.create(owner, name); }else{ throw new GitHubException("No GitHub repository (owner and name) configured"); } if (log.isDebugEnabled()){ log.debug(MessageFormat.format("Using GitHub repository {0}", repository.generateId())); } return repository; }
java
private RepositoryId getRepository(final String owner, final String name) throws GitHubException { RepositoryId repository = null; if(StringUtils.isNotBlank(name) && StringUtils.isNotBlank(owner)){ repository = RepositoryId.create(owner, name); }else{ throw new GitHubException("No GitHub repository (owner and name) configured"); } if (log.isDebugEnabled()){ log.debug(MessageFormat.format("Using GitHub repository {0}", repository.generateId())); } return repository; }
[ "private", "RepositoryId", "getRepository", "(", "final", "String", "owner", ",", "final", "String", "name", ")", "throws", "GitHubException", "{", "RepositoryId", "repository", "=", "null", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "name", ")", "...
Get repository and throw a {@link MojoExecutionException} on failures @param project @param owner @param name @return non-null repository id @throws MojoExecutionException
[ "Get", "repository", "and", "throw", "a", "{", "@link", "MojoExecutionException", "}", "on", "failures" ]
train
https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/wagon-providers/wagon-github/src/main/java/org/opoo/press/maven/wagon/github/GitHub.java#L515-L526
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java
CPDisplayLayoutPersistenceImpl.findAll
@Override public List<CPDisplayLayout> findAll() { """ Returns all the cp display layouts. @return the cp display layouts """ return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CPDisplayLayout> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CPDisplayLayout", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the cp display layouts. @return the cp display layouts
[ "Returns", "all", "the", "cp", "display", "layouts", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java#L2332-L2335
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataPng.java
CoverageDataPng.getUnsignedPixelValue
public int getUnsignedPixelValue(BufferedImage image, int x, int y) { """ Get the pixel value as a 16 bit unsigned integer value @param image tile image @param x x coordinate @param y y coordinate @return unsigned integer pixel value """ short pixelValue = getPixelValue(image, x, y); int unsignedPixelValue = getUnsignedPixelValue(pixelValue); return unsignedPixelValue; }
java
public int getUnsignedPixelValue(BufferedImage image, int x, int y) { short pixelValue = getPixelValue(image, x, y); int unsignedPixelValue = getUnsignedPixelValue(pixelValue); return unsignedPixelValue; }
[ "public", "int", "getUnsignedPixelValue", "(", "BufferedImage", "image", ",", "int", "x", ",", "int", "y", ")", "{", "short", "pixelValue", "=", "getPixelValue", "(", "image", ",", "x", ",", "y", ")", ";", "int", "unsignedPixelValue", "=", "getUnsignedPixelV...
Get the pixel value as a 16 bit unsigned integer value @param image tile image @param x x coordinate @param y y coordinate @return unsigned integer pixel value
[ "Get", "the", "pixel", "value", "as", "a", "16", "bit", "unsigned", "integer", "value" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataPng.java#L136-L140
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java
WalkerFactory.getAxisFromStep
public static int getAxisFromStep( Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException { """ Special purpose function to see if we can optimize the pattern for a DescendantIterator. @param compiler non-null reference to compiler object that has processed the XPath operations into an opcode map. @param stepOpCodePos The opcode position for the step. @return 32 bits as an integer that give information about the location path as a whole. @throws javax.xml.transform.TransformerException """ int stepType = compiler.getOp(stepOpCodePos); switch (stepType) { case OpCodes.FROM_FOLLOWING : return Axis.FOLLOWING; case OpCodes.FROM_FOLLOWING_SIBLINGS : return Axis.FOLLOWINGSIBLING; case OpCodes.FROM_PRECEDING : return Axis.PRECEDING; case OpCodes.FROM_PRECEDING_SIBLINGS : return Axis.PRECEDINGSIBLING; case OpCodes.FROM_PARENT : return Axis.PARENT; case OpCodes.FROM_NAMESPACE : return Axis.NAMESPACE; case OpCodes.FROM_ANCESTORS : return Axis.ANCESTOR; case OpCodes.FROM_ANCESTORS_OR_SELF : return Axis.ANCESTORORSELF; case OpCodes.FROM_ATTRIBUTES : return Axis.ATTRIBUTE; case OpCodes.FROM_ROOT : return Axis.ROOT; case OpCodes.FROM_CHILDREN : return Axis.CHILD; case OpCodes.FROM_DESCENDANTS_OR_SELF : return Axis.DESCENDANTORSELF; case OpCodes.FROM_DESCENDANTS : return Axis.DESCENDANT; case OpCodes.FROM_SELF : return Axis.SELF; case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : return Axis.FILTEREDLIST; } throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); }
java
public static int getAxisFromStep( Compiler compiler, int stepOpCodePos) throws javax.xml.transform.TransformerException { int stepType = compiler.getOp(stepOpCodePos); switch (stepType) { case OpCodes.FROM_FOLLOWING : return Axis.FOLLOWING; case OpCodes.FROM_FOLLOWING_SIBLINGS : return Axis.FOLLOWINGSIBLING; case OpCodes.FROM_PRECEDING : return Axis.PRECEDING; case OpCodes.FROM_PRECEDING_SIBLINGS : return Axis.PRECEDINGSIBLING; case OpCodes.FROM_PARENT : return Axis.PARENT; case OpCodes.FROM_NAMESPACE : return Axis.NAMESPACE; case OpCodes.FROM_ANCESTORS : return Axis.ANCESTOR; case OpCodes.FROM_ANCESTORS_OR_SELF : return Axis.ANCESTORORSELF; case OpCodes.FROM_ATTRIBUTES : return Axis.ATTRIBUTE; case OpCodes.FROM_ROOT : return Axis.ROOT; case OpCodes.FROM_CHILDREN : return Axis.CHILD; case OpCodes.FROM_DESCENDANTS_OR_SELF : return Axis.DESCENDANTORSELF; case OpCodes.FROM_DESCENDANTS : return Axis.DESCENDANT; case OpCodes.FROM_SELF : return Axis.SELF; case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : case OpCodes.OP_VARIABLE : return Axis.FILTEREDLIST; } throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); }
[ "public", "static", "int", "getAxisFromStep", "(", "Compiler", "compiler", ",", "int", "stepOpCodePos", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "int", "stepType", "=", "compiler", ".", "getOp", "(", "stepOpCodePos"...
Special purpose function to see if we can optimize the pattern for a DescendantIterator. @param compiler non-null reference to compiler object that has processed the XPath operations into an opcode map. @param stepOpCodePos The opcode position for the step. @return 32 bits as an integer that give information about the location path as a whole. @throws javax.xml.transform.TransformerException
[ "Special", "purpose", "function", "to", "see", "if", "we", "can", "optimize", "the", "pattern", "for", "a", "DescendantIterator", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkerFactory.java#L300-L346
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java
MapIterate.forEachKey
public static <K, V> void forEachKey(Map<K, V> map, Procedure<? super K> procedure) { """ For each key of the map, {@code procedure} is evaluated with the key as the parameter. """ if (map == null) { throw new IllegalArgumentException("Cannot perform a forEachKey on null"); } if (MapIterate.notEmpty(map)) { if (map instanceof UnsortedMapIterable) { ((MapIterable<K, V>) map).forEachKey(procedure); } else { IterableIterate.forEach(map.keySet(), procedure); } } }
java
public static <K, V> void forEachKey(Map<K, V> map, Procedure<? super K> procedure) { if (map == null) { throw new IllegalArgumentException("Cannot perform a forEachKey on null"); } if (MapIterate.notEmpty(map)) { if (map instanceof UnsortedMapIterable) { ((MapIterable<K, V>) map).forEachKey(procedure); } else { IterableIterate.forEach(map.keySet(), procedure); } } }
[ "public", "static", "<", "K", ",", "V", ">", "void", "forEachKey", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Procedure", "<", "?", "super", "K", ">", "procedure", ")", "{", "if", "(", "map", "==", "null", ")", "{", "throw", "new", "Ille...
For each key of the map, {@code procedure} is evaluated with the key as the parameter.
[ "For", "each", "key", "of", "the", "map", "{" ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L793-L811
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/f/FundamentalToProjective.java
FundamentalToProjective.twoView
public void twoView(DMatrixRMaj F , DMatrixRMaj cameraMatrix) { """ <p> Given a fundamental matrix a pair of camera matrices P0 and P1 can be extracted. Same {@link #twoView(DMatrixRMaj, DMatrixRMaj)} but with the suggested values for all variables filled in for you. </p> @param F (Input) Fundamental Matrix @param cameraMatrix (Output) resulting projective camera matrix P'. (3 by 4) Known up to a projective transform. """ alg.process(F,e1,e2); twoView(F, e2, zero, 1,cameraMatrix); }
java
public void twoView(DMatrixRMaj F , DMatrixRMaj cameraMatrix) { alg.process(F,e1,e2); twoView(F, e2, zero, 1,cameraMatrix); }
[ "public", "void", "twoView", "(", "DMatrixRMaj", "F", ",", "DMatrixRMaj", "cameraMatrix", ")", "{", "alg", ".", "process", "(", "F", ",", "e1", ",", "e2", ")", ";", "twoView", "(", "F", ",", "e2", ",", "zero", ",", "1", ",", "cameraMatrix", ")", ";...
<p> Given a fundamental matrix a pair of camera matrices P0 and P1 can be extracted. Same {@link #twoView(DMatrixRMaj, DMatrixRMaj)} but with the suggested values for all variables filled in for you. </p> @param F (Input) Fundamental Matrix @param cameraMatrix (Output) resulting projective camera matrix P'. (3 by 4) Known up to a projective transform.
[ "<p", ">", "Given", "a", "fundamental", "matrix", "a", "pair", "of", "camera", "matrices", "P0", "and", "P1", "can", "be", "extracted", ".", "Same", "{" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/f/FundamentalToProjective.java#L69-L73
h2oai/h2o-3
h2o-core/src/main/java/water/parser/ParseSetup.java
ParseSetup.guessSetup
public static ParseSetup guessSetup( Key[] fkeys, ParseSetup userSetup ) { """ Discover the parse setup needed to correctly parse all files. This takes a ParseSetup as guidance. Each file is examined individually and then results merged. If a conflict exists between any results all files are re-examined using the best guess from the first examination. @param fkeys Keys to input vectors to be parsed @param userSetup Setup guidance from user @return ParseSetup settings from looking at all files """ //Guess setup of each file and collect results GuessSetupTsk t = new GuessSetupTsk(userSetup); t.doAll(fkeys).getResult(); //Calc chunk-size // FIXME: should be a parser specific - or at least parser should be able to override defaults Iced ice = DKV.getGet(fkeys[0]); if (ice instanceof Frame && ((Frame) ice).vec(0) instanceof UploadFileVec) { t._gblSetup._chunk_size = FileVec.DFLT_CHUNK_SIZE; } else { t._gblSetup._chunk_size = FileVec.calcOptimalChunkSize(t._totalParseSize, t._gblSetup._number_columns, t._maxLineLength, Runtime.getRuntime().availableProcessors(), H2O.getCloudSize(), false /*use new heuristic*/, true); } return t._gblSetup; }
java
public static ParseSetup guessSetup( Key[] fkeys, ParseSetup userSetup ) { //Guess setup of each file and collect results GuessSetupTsk t = new GuessSetupTsk(userSetup); t.doAll(fkeys).getResult(); //Calc chunk-size // FIXME: should be a parser specific - or at least parser should be able to override defaults Iced ice = DKV.getGet(fkeys[0]); if (ice instanceof Frame && ((Frame) ice).vec(0) instanceof UploadFileVec) { t._gblSetup._chunk_size = FileVec.DFLT_CHUNK_SIZE; } else { t._gblSetup._chunk_size = FileVec.calcOptimalChunkSize(t._totalParseSize, t._gblSetup._number_columns, t._maxLineLength, Runtime.getRuntime().availableProcessors(), H2O.getCloudSize(), false /*use new heuristic*/, true); } return t._gblSetup; }
[ "public", "static", "ParseSetup", "guessSetup", "(", "Key", "[", "]", "fkeys", ",", "ParseSetup", "userSetup", ")", "{", "//Guess setup of each file and collect results", "GuessSetupTsk", "t", "=", "new", "GuessSetupTsk", "(", "userSetup", ")", ";", "t", ".", "doA...
Discover the parse setup needed to correctly parse all files. This takes a ParseSetup as guidance. Each file is examined individually and then results merged. If a conflict exists between any results all files are re-examined using the best guess from the first examination. @param fkeys Keys to input vectors to be parsed @param userSetup Setup guidance from user @return ParseSetup settings from looking at all files
[ "Discover", "the", "parse", "setup", "needed", "to", "correctly", "parse", "all", "files", ".", "This", "takes", "a", "ParseSetup", "as", "guidance", ".", "Each", "file", "is", "examined", "individually", "and", "then", "results", "merged", ".", "If", "a", ...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/ParseSetup.java#L351-L368
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/checksum/ChecksumExtensions.java
ChecksumExtensions.getChecksum
public static String getChecksum(final byte[] bytes, final String algorithm) throws NoSuchAlgorithmException { """ Gets the checksum from the given byte array with an instance of. @param bytes the byte array. @param algorithm the algorithm to get the checksum. This could be for instance "MD4", "MD5", "SHA-1", "SHA-256", "SHA-384" or "SHA-512". @return The checksum from the file as a String object. @throws NoSuchAlgorithmException Is thrown if the algorithm is not supported or does not exists. {@link java.security.MessageDigest} object. """ final MessageDigest messageDigest = MessageDigest.getInstance(algorithm); messageDigest.reset(); messageDigest.update(bytes); final byte digest[] = messageDigest.digest(); final StringBuilder hexView = new StringBuilder(); for (final byte element : digest) { final String intAsHex = Integer.toHexString(0xFF & element); if (intAsHex.length() == 1) { hexView.append('0'); } hexView.append(intAsHex); } return hexView.toString(); }
java
public static String getChecksum(final byte[] bytes, final String algorithm) throws NoSuchAlgorithmException { final MessageDigest messageDigest = MessageDigest.getInstance(algorithm); messageDigest.reset(); messageDigest.update(bytes); final byte digest[] = messageDigest.digest(); final StringBuilder hexView = new StringBuilder(); for (final byte element : digest) { final String intAsHex = Integer.toHexString(0xFF & element); if (intAsHex.length() == 1) { hexView.append('0'); } hexView.append(intAsHex); } return hexView.toString(); }
[ "public", "static", "String", "getChecksum", "(", "final", "byte", "[", "]", "bytes", ",", "final", "String", "algorithm", ")", "throws", "NoSuchAlgorithmException", "{", "final", "MessageDigest", "messageDigest", "=", "MessageDigest", ".", "getInstance", "(", "al...
Gets the checksum from the given byte array with an instance of. @param bytes the byte array. @param algorithm the algorithm to get the checksum. This could be for instance "MD4", "MD5", "SHA-1", "SHA-256", "SHA-384" or "SHA-512". @return The checksum from the file as a String object. @throws NoSuchAlgorithmException Is thrown if the algorithm is not supported or does not exists. {@link java.security.MessageDigest} object.
[ "Gets", "the", "checksum", "from", "the", "given", "byte", "array", "with", "an", "instance", "of", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/checksum/ChecksumExtensions.java#L123-L141
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.updateByIdAsync
public Observable<GenericResourceInner> updateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { """ Updates a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @param parameters Update resource parameters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return updateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1<ServiceResponse<GenericResourceInner>, GenericResourceInner>() { @Override public GenericResourceInner call(ServiceResponse<GenericResourceInner> response) { return response.body(); } }); }
java
public Observable<GenericResourceInner> updateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { return updateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1<ServiceResponse<GenericResourceInner>, GenericResourceInner>() { @Override public GenericResourceInner call(ServiceResponse<GenericResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "GenericResourceInner", ">", "updateByIdAsync", "(", "String", "resourceId", ",", "String", "apiVersion", ",", "GenericResourceInner", "parameters", ")", "{", "return", "updateByIdWithServiceResponseAsync", "(", "resourceId", ",", "apiVersion"...
Updates a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @param parameters Update resource parameters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "resource", "by", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L2258-L2265
banq/jdonframework
JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/io/LazyUtil.java
LazyUtil.isPropertyInitialized
public static boolean isPropertyInitialized(Object object) { """ Check is current object was initialized @param object - object, which need check @return boolean value """ Class < ? > cl = getHibernateClass(); if (cl == null) { return true; } Method method = getInitializeMethod(cl); return checkInitialize(method, object); }
java
public static boolean isPropertyInitialized(Object object) { Class < ? > cl = getHibernateClass(); if (cl == null) { return true; } Method method = getInitializeMethod(cl); return checkInitialize(method, object); }
[ "public", "static", "boolean", "isPropertyInitialized", "(", "Object", "object", ")", "{", "Class", "<", "?", ">", "cl", "=", "getHibernateClass", "(", ")", ";", "if", "(", "cl", "==", "null", ")", "{", "return", "true", ";", "}", "Method", "method", "...
Check is current object was initialized @param object - object, which need check @return boolean value
[ "Check", "is", "current", "object", "was", "initialized" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/io/LazyUtil.java#L98-L107
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java
PrivateDataManager.getPrivateDataProvider
public static PrivateDataProvider getPrivateDataProvider(String elementName, String namespace) { """ Returns the private data provider registered to the specified XML element name and namespace. For example, if a provider was registered to the element name "prefs" and the namespace "http://www.xmppclient.com/prefs", then the following stanza would trigger the provider: <pre> &lt;iq type='result' to='joe@example.com' from='mary@example.com' id='time_1'&gt; &lt;query xmlns='jabber:iq:private'&gt; &lt;prefs xmlns='http://www.xmppclient.com/prefs'&gt; &lt;value1&gt;ABC&lt;/value1&gt; &lt;value2&gt;XYZ&lt;/value2&gt; &lt;/prefs&gt; &lt;/query&gt; &lt;/iq&gt;</pre> <p>Note: this method is generally only called by the internal Smack classes. @param elementName the XML element name. @param namespace the XML namespace. @return the PrivateData provider. """ String key = XmppStringUtils.generateKey(elementName, namespace); return privateDataProviders.get(key); }
java
public static PrivateDataProvider getPrivateDataProvider(String elementName, String namespace) { String key = XmppStringUtils.generateKey(elementName, namespace); return privateDataProviders.get(key); }
[ "public", "static", "PrivateDataProvider", "getPrivateDataProvider", "(", "String", "elementName", ",", "String", "namespace", ")", "{", "String", "key", "=", "XmppStringUtils", ".", "generateKey", "(", "elementName", ",", "namespace", ")", ";", "return", "privateDa...
Returns the private data provider registered to the specified XML element name and namespace. For example, if a provider was registered to the element name "prefs" and the namespace "http://www.xmppclient.com/prefs", then the following stanza would trigger the provider: <pre> &lt;iq type='result' to='joe@example.com' from='mary@example.com' id='time_1'&gt; &lt;query xmlns='jabber:iq:private'&gt; &lt;prefs xmlns='http://www.xmppclient.com/prefs'&gt; &lt;value1&gt;ABC&lt;/value1&gt; &lt;value2&gt;XYZ&lt;/value2&gt; &lt;/prefs&gt; &lt;/query&gt; &lt;/iq&gt;</pre> <p>Note: this method is generally only called by the internal Smack classes. @param elementName the XML element name. @param namespace the XML namespace. @return the PrivateData provider.
[ "Returns", "the", "private", "data", "provider", "registered", "to", "the", "specified", "XML", "element", "name", "and", "namespace", ".", "For", "example", "if", "a", "provider", "was", "registered", "to", "the", "element", "name", "prefs", "and", "the", "...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java#L104-L107
michel-kraemer/citeproc-java
citeproc-java/src/main/java/de/undercouch/citeproc/helper/json/JsonLexer.java
JsonLexer.readNumber
public Number readNumber() throws IOException { """ Reads a number from the stream @return the number @throws IOException if the stream could not be read """ //there should be a character left from readNextToken! if (currentCharacter < 0) { throw new IllegalStateException("Missed first digit"); } //read sign boolean negative = false; if (currentCharacter == '-') { negative = true; currentCharacter = r.read(); } //try to real an integer first long result = 0; while (currentCharacter >= 0) { if (currentCharacter >= '0' && currentCharacter <= '9') { result = result * 10 + currentCharacter - '0'; } else if (currentCharacter == '.') { //there is a dot. read real number return readReal(result, negative); } else { break; } currentCharacter = r.read(); } return negative ? -result : result; }
java
public Number readNumber() throws IOException { //there should be a character left from readNextToken! if (currentCharacter < 0) { throw new IllegalStateException("Missed first digit"); } //read sign boolean negative = false; if (currentCharacter == '-') { negative = true; currentCharacter = r.read(); } //try to real an integer first long result = 0; while (currentCharacter >= 0) { if (currentCharacter >= '0' && currentCharacter <= '9') { result = result * 10 + currentCharacter - '0'; } else if (currentCharacter == '.') { //there is a dot. read real number return readReal(result, negative); } else { break; } currentCharacter = r.read(); } return negative ? -result : result; }
[ "public", "Number", "readNumber", "(", ")", "throws", "IOException", "{", "//there should be a character left from readNextToken!", "if", "(", "currentCharacter", "<", "0", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Missed first digit\"", ")", ";", "}", ...
Reads a number from the stream @return the number @throws IOException if the stream could not be read
[ "Reads", "a", "number", "from", "the", "stream" ]
train
https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/helper/json/JsonLexer.java#L264-L292
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java
DateTimeFormatter.withDecimalStyle
public DateTimeFormatter withDecimalStyle(DecimalStyle decimalStyle) { """ Returns a copy of this formatter with a new DecimalStyle. <p> This instance is immutable and unaffected by this method call. @param decimalStyle the new DecimalStyle, not null @return a formatter based on this formatter with the requested DecimalStyle, not null """ if (this.decimalStyle.equals(decimalStyle)) { return this; } return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone); }
java
public DateTimeFormatter withDecimalStyle(DecimalStyle decimalStyle) { if (this.decimalStyle.equals(decimalStyle)) { return this; } return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone); }
[ "public", "DateTimeFormatter", "withDecimalStyle", "(", "DecimalStyle", "decimalStyle", ")", "{", "if", "(", "this", ".", "decimalStyle", ".", "equals", "(", "decimalStyle", ")", ")", "{", "return", "this", ";", "}", "return", "new", "DateTimeFormatter", "(", ...
Returns a copy of this formatter with a new DecimalStyle. <p> This instance is immutable and unaffected by this method call. @param decimalStyle the new DecimalStyle, not null @return a formatter based on this formatter with the requested DecimalStyle, not null
[ "Returns", "a", "copy", "of", "this", "formatter", "with", "a", "new", "DecimalStyle", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java#L1434-L1439
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWMultiSelectList.java
AbstractWMultiSelectList.selectionsEqual
private boolean selectionsEqual(final List<?> list1, final List<?> list2) { """ Selection lists are considered equal if they have the same items (order is not important). An empty list is considered equal to a null list. @param list1 the first list to check. @param list2 the second list to check. @return true if the lists are equal, false otherwise. """ if (isSelectionOrderable()) { return Util.equals(list1, list2); } // Empty or null lists if ((list1 == null || list1.isEmpty()) && (list2 == null || list2.isEmpty())) { return true; } // Same size and contain same entries return list1 != null && list2 != null && list1.size() == list2.size() && list1. containsAll(list2); }
java
private boolean selectionsEqual(final List<?> list1, final List<?> list2) { if (isSelectionOrderable()) { return Util.equals(list1, list2); } // Empty or null lists if ((list1 == null || list1.isEmpty()) && (list2 == null || list2.isEmpty())) { return true; } // Same size and contain same entries return list1 != null && list2 != null && list1.size() == list2.size() && list1. containsAll(list2); }
[ "private", "boolean", "selectionsEqual", "(", "final", "List", "<", "?", ">", "list1", ",", "final", "List", "<", "?", ">", "list2", ")", "{", "if", "(", "isSelectionOrderable", "(", ")", ")", "{", "return", "Util", ".", "equals", "(", "list1", ",", ...
Selection lists are considered equal if they have the same items (order is not important). An empty list is considered equal to a null list. @param list1 the first list to check. @param list2 the second list to check. @return true if the lists are equal, false otherwise.
[ "Selection", "lists", "are", "considered", "equal", "if", "they", "have", "the", "same", "items", "(", "order", "is", "not", "important", ")", ".", "An", "empty", "list", "is", "considered", "equal", "to", "a", "null", "list", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWMultiSelectList.java#L514-L527
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.readProjectFile
private ProjectFile readProjectFile(ProjectReader reader, InputStream stream) throws MPXJException { """ Adds listeners and reads from a stream. @param reader reader for file type @param stream schedule data @return ProjectFile instance """ addListeners(reader); return reader.read(stream); }
java
private ProjectFile readProjectFile(ProjectReader reader, InputStream stream) throws MPXJException { addListeners(reader); return reader.read(stream); }
[ "private", "ProjectFile", "readProjectFile", "(", "ProjectReader", "reader", ",", "InputStream", "stream", ")", "throws", "MPXJException", "{", "addListeners", "(", "reader", ")", ";", "return", "reader", ".", "read", "(", "stream", ")", ";", "}" ]
Adds listeners and reads from a stream. @param reader reader for file type @param stream schedule data @return ProjectFile instance
[ "Adds", "listeners", "and", "reads", "from", "a", "stream", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L353-L357
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructor.java
MapperConstructor.setOperation
private <T extends AGeneralOperation>T setOperation(T operation,MappingType mtd,MappingType mts) { """ Setting common to all operations. @param operation operation to configure @param mtd mapping type of destination @param mts mapping type of source @return operation configured """ operation.setMtd(mtd).setMts(mts) .initialDSetPath(stringOfSetDestination) .initialDGetPath(stringOfGetDestination) .initialSGetPath(stringOfGetSource); return operation; }
java
private <T extends AGeneralOperation>T setOperation(T operation,MappingType mtd,MappingType mts){ operation.setMtd(mtd).setMts(mts) .initialDSetPath(stringOfSetDestination) .initialDGetPath(stringOfGetDestination) .initialSGetPath(stringOfGetSource); return operation; }
[ "private", "<", "T", "extends", "AGeneralOperation", ">", "T", "setOperation", "(", "T", "operation", ",", "MappingType", "mtd", ",", "MappingType", "mts", ")", "{", "operation", ".", "setMtd", "(", "mtd", ")", ".", "setMts", "(", "mts", ")", ".", "initi...
Setting common to all operations. @param operation operation to configure @param mtd mapping type of destination @param mts mapping type of source @return operation configured
[ "Setting", "common", "to", "all", "operations", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructor.java#L189-L196
alipay/sofa-rpc
extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/server/http/HttpServerHandler.java
HttpServerHandler.handleHttp2Request
public void handleHttp2Request(int streamId, SofaRequest request, ChannelHandlerContext ctx, Http2ConnectionEncoder encoder) { """ Handle request from HTTP/2 @param streamId stream Id @param request SofaRequest @param ctx ChannelHandlerContext @param encoder Http2ConnectionEncoder """ Http2ServerTask task = new Http2ServerTask(this, request, ctx, streamId, encoder); processingCount.incrementAndGet(); try { task.run(); } catch (RejectedExecutionException e) { processingCount.decrementAndGet(); throw e; } }
java
public void handleHttp2Request(int streamId, SofaRequest request, ChannelHandlerContext ctx, Http2ConnectionEncoder encoder) { Http2ServerTask task = new Http2ServerTask(this, request, ctx, streamId, encoder); processingCount.incrementAndGet(); try { task.run(); } catch (RejectedExecutionException e) { processingCount.decrementAndGet(); throw e; } }
[ "public", "void", "handleHttp2Request", "(", "int", "streamId", ",", "SofaRequest", "request", ",", "ChannelHandlerContext", "ctx", ",", "Http2ConnectionEncoder", "encoder", ")", "{", "Http2ServerTask", "task", "=", "new", "Http2ServerTask", "(", "this", ",", "reque...
Handle request from HTTP/2 @param streamId stream Id @param request SofaRequest @param ctx ChannelHandlerContext @param encoder Http2ConnectionEncoder
[ "Handle", "request", "from", "HTTP", "/", "2" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/server/http/HttpServerHandler.java#L102-L113
jhalterman/typetools
src/main/java/net/jodah/typetools/TypeResolver.java
TypeResolver.resolveRawArgument
public static <T, S extends T> Class<?> resolveRawArgument(Class<T> type, Class<S> subType) { """ Returns the raw class representing the argument for the {@code type} using type variable information from the {@code subType}. If no arguments can be resolved then {@code Unknown.class} is returned. @param type to resolve argument for @param subType to extract type variable information from @return argument for {@code type} else {@link Unknown}.class if no type arguments are declared @throws IllegalArgumentException if more or less than one argument is resolved for the {@code type} """ return resolveRawArgument(resolveGenericType(type, subType), subType); }
java
public static <T, S extends T> Class<?> resolveRawArgument(Class<T> type, Class<S> subType) { return resolveRawArgument(resolveGenericType(type, subType), subType); }
[ "public", "static", "<", "T", ",", "S", "extends", "T", ">", "Class", "<", "?", ">", "resolveRawArgument", "(", "Class", "<", "T", ">", "type", ",", "Class", "<", "S", ">", "subType", ")", "{", "return", "resolveRawArgument", "(", "resolveGenericType", ...
Returns the raw class representing the argument for the {@code type} using type variable information from the {@code subType}. If no arguments can be resolved then {@code Unknown.class} is returned. @param type to resolve argument for @param subType to extract type variable information from @return argument for {@code type} else {@link Unknown}.class if no type arguments are declared @throws IllegalArgumentException if more or less than one argument is resolved for the {@code type}
[ "Returns", "the", "raw", "class", "representing", "the", "argument", "for", "the", "{", "@code", "type", "}", "using", "type", "variable", "information", "from", "the", "{", "@code", "subType", "}", ".", "If", "no", "arguments", "can", "be", "resolved", "t...
train
https://github.com/jhalterman/typetools/blob/0bd6f1f6d146a69e1e497b688a8522fa09adae87/src/main/java/net/jodah/typetools/TypeResolver.java#L146-L148
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LOF.java
LOF.computeLRD
protected double computeLRD(KNNQuery<O> knnq, DBIDIter curr) { """ Compute a single local reachability distance. @param knnq kNN Query @param curr Current object @return Local Reachability Density """ final KNNList neighbors = knnq.getKNNForDBID(curr, k); double sum = 0.0; int count = 0; for(DoubleDBIDListIter neighbor = neighbors.iter(); neighbor.valid(); neighbor.advance()) { if(DBIDUtil.equal(curr, neighbor)) { continue; } KNNList neighborsNeighbors = knnq.getKNNForDBID(neighbor, k); sum += MathUtil.max(neighbor.doubleValue(), neighborsNeighbors.getKNNDistance()); count++; } // Avoid division by 0 return (sum > 0) ? (count / sum) : Double.POSITIVE_INFINITY; }
java
protected double computeLRD(KNNQuery<O> knnq, DBIDIter curr) { final KNNList neighbors = knnq.getKNNForDBID(curr, k); double sum = 0.0; int count = 0; for(DoubleDBIDListIter neighbor = neighbors.iter(); neighbor.valid(); neighbor.advance()) { if(DBIDUtil.equal(curr, neighbor)) { continue; } KNNList neighborsNeighbors = knnq.getKNNForDBID(neighbor, k); sum += MathUtil.max(neighbor.doubleValue(), neighborsNeighbors.getKNNDistance()); count++; } // Avoid division by 0 return (sum > 0) ? (count / sum) : Double.POSITIVE_INFINITY; }
[ "protected", "double", "computeLRD", "(", "KNNQuery", "<", "O", ">", "knnq", ",", "DBIDIter", "curr", ")", "{", "final", "KNNList", "neighbors", "=", "knnq", ".", "getKNNForDBID", "(", "curr", ",", "k", ")", ";", "double", "sum", "=", "0.0", ";", "int"...
Compute a single local reachability distance. @param knnq kNN Query @param curr Current object @return Local Reachability Density
[ "Compute", "a", "single", "local", "reachability", "distance", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LOF.java#L177-L191