repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bos/model/CompleteMultipartUploadRequest.java
CompleteMultipartUploadRequest.setPartETags
public void setPartETags(List<PartETag> partETags) { checkNotNull(partETags, "partETags should not be null."); for (int i = 0; i < partETags.size(); ++i) { PartETag partETag = partETags.get(i); checkNotNull(partETag, "partETags[%s] should not be null.", i); int partNumber = partETag.getPartNumber(); checkArgument(partNumber > 0, "partNumber should be positive. partETags[%s].partNumber:%s", i, partNumber); checkNotNull(partETag.getETag(), "partETags[%s].eTag should not be null.", i); } Collections.sort(partETags, new Comparator<PartETag>() { @Override public int compare(PartETag tag1, PartETag tag2) { return tag1.getPartNumber() - tag2.getPartNumber(); } }); int lastPartNumber = 0; for (int i = 0; i < partETags.size(); ++i) { int partNumber = partETags.get(i).getPartNumber(); checkArgument(partNumber != lastPartNumber, "Duplicated partNumber %s.", partNumber); lastPartNumber = partNumber; } this.partETags = partETags; }
java
public void setPartETags(List<PartETag> partETags) { checkNotNull(partETags, "partETags should not be null."); for (int i = 0; i < partETags.size(); ++i) { PartETag partETag = partETags.get(i); checkNotNull(partETag, "partETags[%s] should not be null.", i); int partNumber = partETag.getPartNumber(); checkArgument(partNumber > 0, "partNumber should be positive. partETags[%s].partNumber:%s", i, partNumber); checkNotNull(partETag.getETag(), "partETags[%s].eTag should not be null.", i); } Collections.sort(partETags, new Comparator<PartETag>() { @Override public int compare(PartETag tag1, PartETag tag2) { return tag1.getPartNumber() - tag2.getPartNumber(); } }); int lastPartNumber = 0; for (int i = 0; i < partETags.size(); ++i) { int partNumber = partETags.get(i).getPartNumber(); checkArgument(partNumber != lastPartNumber, "Duplicated partNumber %s.", partNumber); lastPartNumber = partNumber; } this.partETags = partETags; }
[ "public", "void", "setPartETags", "(", "List", "<", "PartETag", ">", "partETags", ")", "{", "checkNotNull", "(", "partETags", ",", "\"partETags should not be null.\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "partETags", ".", "size", "(", ")", ";", "++", "i", ")", "{", "PartETag", "partETag", "=", "partETags", ".", "get", "(", "i", ")", ";", "checkNotNull", "(", "partETag", ",", "\"partETags[%s] should not be null.\"", ",", "i", ")", ";", "int", "partNumber", "=", "partETag", ".", "getPartNumber", "(", ")", ";", "checkArgument", "(", "partNumber", ">", "0", ",", "\"partNumber should be positive. partETags[%s].partNumber:%s\"", ",", "i", ",", "partNumber", ")", ";", "checkNotNull", "(", "partETag", ".", "getETag", "(", ")", ",", "\"partETags[%s].eTag should not be null.\"", ",", "i", ")", ";", "}", "Collections", ".", "sort", "(", "partETags", ",", "new", "Comparator", "<", "PartETag", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "PartETag", "tag1", ",", "PartETag", "tag2", ")", "{", "return", "tag1", ".", "getPartNumber", "(", ")", "-", "tag2", ".", "getPartNumber", "(", ")", ";", "}", "}", ")", ";", "int", "lastPartNumber", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "partETags", ".", "size", "(", ")", ";", "++", "i", ")", "{", "int", "partNumber", "=", "partETags", ".", "get", "(", "i", ")", ".", "getPartNumber", "(", ")", ";", "checkArgument", "(", "partNumber", "!=", "lastPartNumber", ",", "\"Duplicated partNumber %s.\"", ",", "partNumber", ")", ";", "lastPartNumber", "=", "partNumber", ";", "}", "this", ".", "partETags", "=", "partETags", ";", "}" ]
Sets the list of part numbers and ETags that identify the individual parts of the multipart upload to complete. @param partETags The list of part numbers and ETags that identify the individual parts of the multipart upload to complete.
[ "Sets", "the", "list", "of", "part", "numbers", "and", "ETags", "that", "identify", "the", "individual", "parts", "of", "the", "multipart", "upload", "to", "complete", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/model/CompleteMultipartUploadRequest.java#L170-L192
GerdHolz/TOVAL
src/de/invation/code/toval/os/OSUtils.java
OSUtils.runCommand
public void runCommand(String[] command, GenericHandler<BufferedReader> inputHandler, GenericHandler<BufferedReader> errorHandler) throws OSException { Validate.notNull(command); try { Process p = Runtime.getRuntime().exec(command); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())); if (inputHandler != null) { inputHandler.handle(in); } if (errorHandler != null) { errorHandler.handle(err); } in.close(); p.waitFor(); p.exitValue(); } catch (Exception ex) { throw new OSException(ex.getMessage(), ex); } }
java
public void runCommand(String[] command, GenericHandler<BufferedReader> inputHandler, GenericHandler<BufferedReader> errorHandler) throws OSException { Validate.notNull(command); try { Process p = Runtime.getRuntime().exec(command); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader err = new BufferedReader(new InputStreamReader(p.getErrorStream())); if (inputHandler != null) { inputHandler.handle(in); } if (errorHandler != null) { errorHandler.handle(err); } in.close(); p.waitFor(); p.exitValue(); } catch (Exception ex) { throw new OSException(ex.getMessage(), ex); } }
[ "public", "void", "runCommand", "(", "String", "[", "]", "command", ",", "GenericHandler", "<", "BufferedReader", ">", "inputHandler", ",", "GenericHandler", "<", "BufferedReader", ">", "errorHandler", ")", "throws", "OSException", "{", "Validate", ".", "notNull", "(", "command", ")", ";", "try", "{", "Process", "p", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "command", ")", ";", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "p", ".", "getInputStream", "(", ")", ")", ")", ";", "BufferedReader", "err", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "p", ".", "getErrorStream", "(", ")", ")", ")", ";", "if", "(", "inputHandler", "!=", "null", ")", "{", "inputHandler", ".", "handle", "(", "in", ")", ";", "}", "if", "(", "errorHandler", "!=", "null", ")", "{", "errorHandler", ".", "handle", "(", "err", ")", ";", "}", "in", ".", "close", "(", ")", ";", "p", ".", "waitFor", "(", ")", ";", "p", ".", "exitValue", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "OSException", "(", "ex", ".", "getMessage", "(", ")", ",", "ex", ")", ";", "}", "}" ]
Runs a command on the operating system. @param command String array of command parts. The parts are concatenated with spaces between the parts. The single command parts should not contain whitespaces. @param inputHandler {@link GenericHandler} to handle the process input stream {@link BufferedReader}. @param errorHandler {@link GenericHandler} to handle the process error output {@link BufferedReader}. @throws OSException
[ "Runs", "a", "command", "on", "the", "operating", "system", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/OSUtils.java#L170-L191
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.reimageAllAsync
public Observable<OperationStatusResponseInner> reimageAllAsync(String resourceGroupName, String vmScaleSetName) { return reimageAllWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> reimageAllAsync(String resourceGroupName, String vmScaleSetName) { return reimageAllWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "reimageAllAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "reimageAllWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatusResponseInner", ">", ",", "OperationStatusResponseInner", ">", "(", ")", "{", "@", "Override", "public", "OperationStatusResponseInner", "call", "(", "ServiceResponse", "<", "OperationStatusResponseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed disks. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Reimages", "all", "the", "disks", "(", "including", "data", "disks", ")", "in", "the", "virtual", "machines", "in", "a", "VM", "scale", "set", ".", "This", "operation", "is", "only", "supported", "for", "managed", "disks", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L3243-L3250
alkacon/opencms-core
src/org/opencms/search/solr/CmsSolrIndex.java
CmsSolrIndex.getLocaleForResource
@Override public Locale getLocaleForResource(CmsObject cms, CmsResource resource, List<Locale> availableLocales) { Locale result = null; List<Locale> defaultLocales = OpenCms.getLocaleManager().getDefaultLocales(cms, resource); if ((availableLocales != null) && (availableLocales.size() > 0)) { result = OpenCms.getLocaleManager().getBestMatchingLocale( defaultLocales.get(0), defaultLocales, availableLocales); } if (result == null) { result = ((availableLocales != null) && availableLocales.isEmpty()) ? availableLocales.get(0) : defaultLocales.get(0); } return result; }
java
@Override public Locale getLocaleForResource(CmsObject cms, CmsResource resource, List<Locale> availableLocales) { Locale result = null; List<Locale> defaultLocales = OpenCms.getLocaleManager().getDefaultLocales(cms, resource); if ((availableLocales != null) && (availableLocales.size() > 0)) { result = OpenCms.getLocaleManager().getBestMatchingLocale( defaultLocales.get(0), defaultLocales, availableLocales); } if (result == null) { result = ((availableLocales != null) && availableLocales.isEmpty()) ? availableLocales.get(0) : defaultLocales.get(0); } return result; }
[ "@", "Override", "public", "Locale", "getLocaleForResource", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "List", "<", "Locale", ">", "availableLocales", ")", "{", "Locale", "result", "=", "null", ";", "List", "<", "Locale", ">", "defaultLocales", "=", "OpenCms", ".", "getLocaleManager", "(", ")", ".", "getDefaultLocales", "(", "cms", ",", "resource", ")", ";", "if", "(", "(", "availableLocales", "!=", "null", ")", "&&", "(", "availableLocales", ".", "size", "(", ")", ">", "0", ")", ")", "{", "result", "=", "OpenCms", ".", "getLocaleManager", "(", ")", ".", "getBestMatchingLocale", "(", "defaultLocales", ".", "get", "(", "0", ")", ",", "defaultLocales", ",", "availableLocales", ")", ";", "}", "if", "(", "result", "==", "null", ")", "{", "result", "=", "(", "(", "availableLocales", "!=", "null", ")", "&&", "availableLocales", ".", "isEmpty", "(", ")", ")", "?", "availableLocales", ".", "get", "(", "0", ")", ":", "defaultLocales", ".", "get", "(", "0", ")", ";", "}", "return", "result", ";", "}" ]
Returns the language locale for the given resource in this index.<p> @param cms the current OpenCms user context @param resource the resource to check @param availableLocales a list of locales supported by the resource @return the language locale for the given resource in this index
[ "Returns", "the", "language", "locale", "for", "the", "given", "resource", "in", "this", "index", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrIndex.java#L598-L615
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/resource/ResourceModelFactory.java
ResourceModelFactory.newResourceModel
public static IModel<String> newResourceModel(final String resourceKey, final Component component) { return newResourceModel(resourceKey, component, null, ""); }
java
public static IModel<String> newResourceModel(final String resourceKey, final Component component) { return newResourceModel(resourceKey, component, null, ""); }
[ "public", "static", "IModel", "<", "String", ">", "newResourceModel", "(", "final", "String", "resourceKey", ",", "final", "Component", "component", ")", "{", "return", "newResourceModel", "(", "resourceKey", ",", "component", ",", "null", ",", "\"\"", ")", ";", "}" ]
Factory method to create a new {@link StringResourceModel} from the given resource key and given component. @param resourceKey the resource key @param component the component @return a new {@link StringResourceModel} as an {@link IModel}
[ "Factory", "method", "to", "create", "a", "new", "{", "@link", "StringResourceModel", "}", "from", "the", "given", "resource", "key", "and", "given", "component", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/resource/ResourceModelFactory.java#L127-L131
jmchilton/galaxy-bootstrap
src/main/java/com/github/jmchilton/galaxybootstrap/DownloadProperties.java
DownloadProperties.forGalaxyDist
@Deprecated public static DownloadProperties forGalaxyDist(final File destination, String revision) { return new DownloadProperties(GALAXY_DIST_REPOSITORY_URL, BRANCH_STABLE, revision, destination); }
java
@Deprecated public static DownloadProperties forGalaxyDist(final File destination, String revision) { return new DownloadProperties(GALAXY_DIST_REPOSITORY_URL, BRANCH_STABLE, revision, destination); }
[ "@", "Deprecated", "public", "static", "DownloadProperties", "forGalaxyDist", "(", "final", "File", "destination", ",", "String", "revision", ")", "{", "return", "new", "DownloadProperties", "(", "GALAXY_DIST_REPOSITORY_URL", ",", "BRANCH_STABLE", ",", "revision", ",", "destination", ")", ";", "}" ]
Builds a new DownloadProperties for downloading Galaxy from galaxy-dist. @param destination The destination directory to store Galaxy, null if a directory should be chosen by default. @param revision The revision to use for Galaxy. @return A new DownloadProperties for downloading Galaxy from galaxy-dist.
[ "Builds", "a", "new", "DownloadProperties", "for", "downloading", "Galaxy", "from", "galaxy", "-", "dist", "." ]
train
https://github.com/jmchilton/galaxy-bootstrap/blob/4a899f5e6ec0c9f6f4b9b21d5a0320e5925ec649/src/main/java/com/github/jmchilton/galaxybootstrap/DownloadProperties.java#L326-L329
VoltDB/voltdb
src/frontend/org/voltcore/messaging/HostMessenger.java
HostMessenger.cutLink
public void cutLink(int hostIdA, int hostIdB) { if (m_localHostId == hostIdA) { Iterator<ForeignHost> it = m_foreignHosts.get(hostIdB).iterator(); while (it.hasNext()) { ForeignHost fh = it.next(); fh.cutLink(); } } if (m_localHostId == hostIdB) { Iterator<ForeignHost> it = m_foreignHosts.get(hostIdA).iterator(); while (it.hasNext()) { ForeignHost fh = it.next(); fh.cutLink(); } } }
java
public void cutLink(int hostIdA, int hostIdB) { if (m_localHostId == hostIdA) { Iterator<ForeignHost> it = m_foreignHosts.get(hostIdB).iterator(); while (it.hasNext()) { ForeignHost fh = it.next(); fh.cutLink(); } } if (m_localHostId == hostIdB) { Iterator<ForeignHost> it = m_foreignHosts.get(hostIdA).iterator(); while (it.hasNext()) { ForeignHost fh = it.next(); fh.cutLink(); } } }
[ "public", "void", "cutLink", "(", "int", "hostIdA", ",", "int", "hostIdB", ")", "{", "if", "(", "m_localHostId", "==", "hostIdA", ")", "{", "Iterator", "<", "ForeignHost", ">", "it", "=", "m_foreignHosts", ".", "get", "(", "hostIdB", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "ForeignHost", "fh", "=", "it", ".", "next", "(", ")", ";", "fh", ".", "cutLink", "(", ")", ";", "}", "}", "if", "(", "m_localHostId", "==", "hostIdB", ")", "{", "Iterator", "<", "ForeignHost", ">", "it", "=", "m_foreignHosts", ".", "get", "(", "hostIdA", ")", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "ForeignHost", "fh", "=", "it", ".", "next", "(", ")", ";", "fh", ".", "cutLink", "(", ")", ";", "}", "}", "}" ]
Cut the network connection between two hostids immediately Useful for simulating network partitions
[ "Cut", "the", "network", "connection", "between", "two", "hostids", "immediately", "Useful", "for", "simulating", "network", "partitions" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/messaging/HostMessenger.java#L1869-L1884
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/convert/TypeConverter.java
TypeConverter.toTypeWithDefault
public static <T> T toTypeWithDefault(Class<T> type, Object value, T defaultValue) { T result = toNullableType(type, value); return result != null ? result : defaultValue; }
java
public static <T> T toTypeWithDefault(Class<T> type, Object value, T defaultValue) { T result = toNullableType(type, value); return result != null ? result : defaultValue; }
[ "public", "static", "<", "T", ">", "T", "toTypeWithDefault", "(", "Class", "<", "T", ">", "type", ",", "Object", "value", ",", "T", "defaultValue", ")", "{", "T", "result", "=", "toNullableType", "(", "type", ",", "value", ")", ";", "return", "result", "!=", "null", "?", "result", ":", "defaultValue", ";", "}" ]
Converts value into an object type specified by Type Code or returns default value when conversion is not possible. @param type the Class type for the data type into which 'value' is to be converted. @param value the value to convert. @param defaultValue the default value to return if conversion is not possible (returns null). @return object value of type corresponding to TypeCode, or default value when conversion is not supported. @see TypeConverter#toNullableType(Class, Object) @see TypeConverter#toTypeCode(Class)
[ "Converts", "value", "into", "an", "object", "type", "specified", "by", "Type", "Code", "or", "returns", "default", "value", "when", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/convert/TypeConverter.java#L193-L196
wcm-io/wcm-io-handler
link/src/main/java/io/wcm/handler/link/type/MediaLinkType.java
MediaLinkType.getSyntheticLinkResource
public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String mediaRef) { Map<String, Object> map = new HashMap<>(); map.put(LinkNameConstants.PN_LINK_TYPE, ID); map.put(LinkNameConstants.PN_LINK_MEDIA_REF, mediaRef); return new SyntheticLinkResource(resourceResolver, map); }
java
public static @NotNull Resource getSyntheticLinkResource(@NotNull ResourceResolver resourceResolver, @NotNull String mediaRef) { Map<String, Object> map = new HashMap<>(); map.put(LinkNameConstants.PN_LINK_TYPE, ID); map.put(LinkNameConstants.PN_LINK_MEDIA_REF, mediaRef); return new SyntheticLinkResource(resourceResolver, map); }
[ "public", "static", "@", "NotNull", "Resource", "getSyntheticLinkResource", "(", "@", "NotNull", "ResourceResolver", "resourceResolver", ",", "@", "NotNull", "String", "mediaRef", ")", "{", "Map", "<", "String", ",", "Object", ">", "map", "=", "new", "HashMap", "<>", "(", ")", ";", "map", ".", "put", "(", "LinkNameConstants", ".", "PN_LINK_TYPE", ",", "ID", ")", ";", "map", ".", "put", "(", "LinkNameConstants", ".", "PN_LINK_MEDIA_REF", ",", "mediaRef", ")", ";", "return", "new", "SyntheticLinkResource", "(", "resourceResolver", ",", "map", ")", ";", "}" ]
Get synthetic link resource for this link type. @param resourceResolver Resource resolver @param mediaRef Media asset reference @return Synthetic link resource
[ "Get", "synthetic", "link", "resource", "for", "this", "link", "type", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/link/src/main/java/io/wcm/handler/link/type/MediaLinkType.java#L140-L145
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java
CachedTSDBService.constructMetricQueryKey
private String constructMetricQueryKey(Long startTimeStampBoundary, Metric metric, MetricQuery query) { StringBuilder sb = new StringBuilder(); sb.append(startTimeStampBoundary).append(":"); sb.append(query.getNamespace()).append(":"); sb.append(query.getScope()).append(":"); sb.append(query.getMetric()).append(":"); Map<String, String> treeMap = new TreeMap<>(); treeMap.putAll(metric.getTags()); sb.append(treeMap).append(":"); sb.append(query.getAggregator()).append(":"); sb.append(query.getDownsampler()).append(":"); sb.append(query.getDownsamplingPeriod()); return sb.toString(); }
java
private String constructMetricQueryKey(Long startTimeStampBoundary, Metric metric, MetricQuery query) { StringBuilder sb = new StringBuilder(); sb.append(startTimeStampBoundary).append(":"); sb.append(query.getNamespace()).append(":"); sb.append(query.getScope()).append(":"); sb.append(query.getMetric()).append(":"); Map<String, String> treeMap = new TreeMap<>(); treeMap.putAll(metric.getTags()); sb.append(treeMap).append(":"); sb.append(query.getAggregator()).append(":"); sb.append(query.getDownsampler()).append(":"); sb.append(query.getDownsamplingPeriod()); return sb.toString(); }
[ "private", "String", "constructMetricQueryKey", "(", "Long", "startTimeStampBoundary", ",", "Metric", "metric", ",", "MetricQuery", "query", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "startTimeStampBoundary", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getNamespace", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getScope", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getMetric", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "Map", "<", "String", ",", "String", ">", "treeMap", "=", "new", "TreeMap", "<>", "(", ")", ";", "treeMap", ".", "putAll", "(", "metric", ".", "getTags", "(", ")", ")", ";", "sb", ".", "append", "(", "treeMap", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getAggregator", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getDownsampler", "(", ")", ")", ".", "append", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "query", ".", "getDownsamplingPeriod", "(", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Constructs a cache key from start time stamp boundary, returned metric tags and metric query. @param startTimeStampBoundary The start time stamp boundary. @param metric The metric to construct the cache key for. @param query The query to use to construct the cache key. @return The cache key.
[ "Constructs", "a", "cache", "key", "from", "start", "time", "stamp", "boundary", "returned", "metric", "tags", "and", "metric", "query", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java#L280-L296
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/ContentSpec.java
ContentSpec.setAdditionalPublicanCfg
public void setAdditionalPublicanCfg(final String name, final String publicanCfg) { if (publicanCfg == null && !publicanCfgs.containsKey(name)) { return; } else if (publicanCfg == null) { removeChild(publicanCfgs.get(name)); publicanCfgs.remove(name); } else if (!publicanCfgs.containsKey(name)) { final String fixedName = name + "-" + CommonConstants.CS_PUBLICAN_CFG_TITLE; final KeyValueNode<String> publicanCfgMetaData = new KeyValueNode<String>(fixedName, publicanCfg); publicanCfgs.put(name, publicanCfgMetaData); appendChild(publicanCfgMetaData, false); } else { publicanCfgs.get(name).setValue(publicanCfg); } }
java
public void setAdditionalPublicanCfg(final String name, final String publicanCfg) { if (publicanCfg == null && !publicanCfgs.containsKey(name)) { return; } else if (publicanCfg == null) { removeChild(publicanCfgs.get(name)); publicanCfgs.remove(name); } else if (!publicanCfgs.containsKey(name)) { final String fixedName = name + "-" + CommonConstants.CS_PUBLICAN_CFG_TITLE; final KeyValueNode<String> publicanCfgMetaData = new KeyValueNode<String>(fixedName, publicanCfg); publicanCfgs.put(name, publicanCfgMetaData); appendChild(publicanCfgMetaData, false); } else { publicanCfgs.get(name).setValue(publicanCfg); } }
[ "public", "void", "setAdditionalPublicanCfg", "(", "final", "String", "name", ",", "final", "String", "publicanCfg", ")", "{", "if", "(", "publicanCfg", "==", "null", "&&", "!", "publicanCfgs", ".", "containsKey", "(", "name", ")", ")", "{", "return", ";", "}", "else", "if", "(", "publicanCfg", "==", "null", ")", "{", "removeChild", "(", "publicanCfgs", ".", "get", "(", "name", ")", ")", ";", "publicanCfgs", ".", "remove", "(", "name", ")", ";", "}", "else", "if", "(", "!", "publicanCfgs", ".", "containsKey", "(", "name", ")", ")", "{", "final", "String", "fixedName", "=", "name", "+", "\"-\"", "+", "CommonConstants", ".", "CS_PUBLICAN_CFG_TITLE", ";", "final", "KeyValueNode", "<", "String", ">", "publicanCfgMetaData", "=", "new", "KeyValueNode", "<", "String", ">", "(", "fixedName", ",", "publicanCfg", ")", ";", "publicanCfgs", ".", "put", "(", "name", ",", "publicanCfgMetaData", ")", ";", "appendChild", "(", "publicanCfgMetaData", ",", "false", ")", ";", "}", "else", "{", "publicanCfgs", ".", "get", "(", "name", ")", ".", "setValue", "(", "publicanCfg", ")", ";", "}", "}" ]
Set the data that will be appended to the publican.cfg file when built. @param name The custom configuration name. @param publicanCfg The data to be appended.
[ "Set", "the", "data", "that", "will", "be", "appended", "to", "the", "publican", ".", "cfg", "file", "when", "built", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/ContentSpec.java#L595-L609
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/BaseJsonBo.java
BaseJsonBo.getSubAttr
public JsonNode getSubAttr(String attrName, String dPath) { Lock lock = lockForRead(); try { return JacksonUtils.getValue(getAttribute(attrName), dPath); } finally { lock.unlock(); } }
java
public JsonNode getSubAttr(String attrName, String dPath) { Lock lock = lockForRead(); try { return JacksonUtils.getValue(getAttribute(attrName), dPath); } finally { lock.unlock(); } }
[ "public", "JsonNode", "getSubAttr", "(", "String", "attrName", ",", "String", "dPath", ")", "{", "Lock", "lock", "=", "lockForRead", "(", ")", ";", "try", "{", "return", "JacksonUtils", ".", "getValue", "(", "getAttribute", "(", "attrName", ")", ",", "dPath", ")", ";", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
Get a sub-attribute using d-path. @param attrName @param dPath @return @see DPathUtils
[ "Get", "a", "sub", "-", "attribute", "using", "d", "-", "path", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseJsonBo.java#L136-L143
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java
RpcProtocolVersionsUtil.checkRpcProtocolVersions
static RpcVersionsCheckResult checkRpcProtocolVersions( RpcProtocolVersions localVersions, RpcProtocolVersions peerVersions) { Version maxCommonVersion; Version minCommonVersion; // maxCommonVersion is MIN(local.max, peer.max) if (isGreaterThanOrEqualTo(localVersions.getMaxRpcVersion(), peerVersions.getMaxRpcVersion())) { maxCommonVersion = peerVersions.getMaxRpcVersion(); } else { maxCommonVersion = localVersions.getMaxRpcVersion(); } // minCommonVersion is MAX(local.min, peer.min) if (isGreaterThanOrEqualTo(localVersions.getMinRpcVersion(), peerVersions.getMinRpcVersion())) { minCommonVersion = localVersions.getMinRpcVersion(); } else { minCommonVersion = peerVersions.getMinRpcVersion(); } if (isGreaterThanOrEqualTo(maxCommonVersion, minCommonVersion)) { return new RpcVersionsCheckResult.Builder() .setResult(true) .setHighestCommonVersion(maxCommonVersion) .build(); } return new RpcVersionsCheckResult.Builder().setResult(false).build(); }
java
static RpcVersionsCheckResult checkRpcProtocolVersions( RpcProtocolVersions localVersions, RpcProtocolVersions peerVersions) { Version maxCommonVersion; Version minCommonVersion; // maxCommonVersion is MIN(local.max, peer.max) if (isGreaterThanOrEqualTo(localVersions.getMaxRpcVersion(), peerVersions.getMaxRpcVersion())) { maxCommonVersion = peerVersions.getMaxRpcVersion(); } else { maxCommonVersion = localVersions.getMaxRpcVersion(); } // minCommonVersion is MAX(local.min, peer.min) if (isGreaterThanOrEqualTo(localVersions.getMinRpcVersion(), peerVersions.getMinRpcVersion())) { minCommonVersion = localVersions.getMinRpcVersion(); } else { minCommonVersion = peerVersions.getMinRpcVersion(); } if (isGreaterThanOrEqualTo(maxCommonVersion, minCommonVersion)) { return new RpcVersionsCheckResult.Builder() .setResult(true) .setHighestCommonVersion(maxCommonVersion) .build(); } return new RpcVersionsCheckResult.Builder().setResult(false).build(); }
[ "static", "RpcVersionsCheckResult", "checkRpcProtocolVersions", "(", "RpcProtocolVersions", "localVersions", ",", "RpcProtocolVersions", "peerVersions", ")", "{", "Version", "maxCommonVersion", ";", "Version", "minCommonVersion", ";", "// maxCommonVersion is MIN(local.max, peer.max)", "if", "(", "isGreaterThanOrEqualTo", "(", "localVersions", ".", "getMaxRpcVersion", "(", ")", ",", "peerVersions", ".", "getMaxRpcVersion", "(", ")", ")", ")", "{", "maxCommonVersion", "=", "peerVersions", ".", "getMaxRpcVersion", "(", ")", ";", "}", "else", "{", "maxCommonVersion", "=", "localVersions", ".", "getMaxRpcVersion", "(", ")", ";", "}", "// minCommonVersion is MAX(local.min, peer.min)", "if", "(", "isGreaterThanOrEqualTo", "(", "localVersions", ".", "getMinRpcVersion", "(", ")", ",", "peerVersions", ".", "getMinRpcVersion", "(", ")", ")", ")", "{", "minCommonVersion", "=", "localVersions", ".", "getMinRpcVersion", "(", ")", ";", "}", "else", "{", "minCommonVersion", "=", "peerVersions", ".", "getMinRpcVersion", "(", ")", ";", "}", "if", "(", "isGreaterThanOrEqualTo", "(", "maxCommonVersion", ",", "minCommonVersion", ")", ")", "{", "return", "new", "RpcVersionsCheckResult", ".", "Builder", "(", ")", ".", "setResult", "(", "true", ")", ".", "setHighestCommonVersion", "(", "maxCommonVersion", ")", ".", "build", "(", ")", ";", "}", "return", "new", "RpcVersionsCheckResult", ".", "Builder", "(", ")", ".", "setResult", "(", "false", ")", ".", "build", "(", ")", ";", "}" ]
Performs check between local and peer Rpc Protocol Versions. This function returns true and the highest common version if there exists a common Rpc Protocol Version to use, and returns false and null otherwise.
[ "Performs", "check", "between", "local", "and", "peer", "Rpc", "Protocol", "Versions", ".", "This", "function", "returns", "true", "and", "the", "highest", "common", "version", "if", "there", "exists", "a", "common", "Rpc", "Protocol", "Version", "to", "use", "and", "returns", "false", "and", "null", "otherwise", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java#L67-L90
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationFileUtil.java
ValidationFileUtil.initFileSendHeader
public static void initFileSendHeader(HttpServletResponse res, String filename, String contentType) { filename = getEncodingFileName(filename); if (contentType != null) { res.setContentType(contentType); } else { res.setContentType("applicaiton/download;charset=utf-8"); } res.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\";"); res.setHeader("Content-Transfer-Encoding", "binary"); res.setHeader("file-name", filename); }
java
public static void initFileSendHeader(HttpServletResponse res, String filename, String contentType) { filename = getEncodingFileName(filename); if (contentType != null) { res.setContentType(contentType); } else { res.setContentType("applicaiton/download;charset=utf-8"); } res.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\";"); res.setHeader("Content-Transfer-Encoding", "binary"); res.setHeader("file-name", filename); }
[ "public", "static", "void", "initFileSendHeader", "(", "HttpServletResponse", "res", ",", "String", "filename", ",", "String", "contentType", ")", "{", "filename", "=", "getEncodingFileName", "(", "filename", ")", ";", "if", "(", "contentType", "!=", "null", ")", "{", "res", ".", "setContentType", "(", "contentType", ")", ";", "}", "else", "{", "res", ".", "setContentType", "(", "\"applicaiton/download;charset=utf-8\"", ")", ";", "}", "res", ".", "setHeader", "(", "\"Content-Disposition\"", ",", "\"attachment; filename=\\\"\"", "+", "filename", "+", "\"\\\";\"", ")", ";", "res", ".", "setHeader", "(", "\"Content-Transfer-Encoding\"", ",", "\"binary\"", ")", ";", "res", ".", "setHeader", "(", "\"file-name\"", ",", "filename", ")", ";", "}" ]
Init file send header. @param res the res @param filename the filename @param contentType the content type
[ "Init", "file", "send", "header", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationFileUtil.java#L89-L101
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.setController
public void setController(Object object, GraphicsController controller, int eventMask) { doSetController(getGroup(object), controller, eventMask); }
java
public void setController(Object object, GraphicsController controller, int eventMask) { doSetController(getGroup(object), controller, eventMask); }
[ "public", "void", "setController", "(", "Object", "object", ",", "GraphicsController", "controller", ",", "int", "eventMask", ")", "{", "doSetController", "(", "getGroup", "(", "object", ")", ",", "controller", ",", "eventMask", ")", ";", "}" ]
Set the controller on an element of this <code>GraphicsContext</code> so it can react to events. @param object the element on which the controller should be set. @param controller The new <code>GraphicsController</code> @param eventMask a bitmask to specify which events to listen for {@link com.google.gwt.user.client.Event}
[ "Set", "the", "controller", "on", "an", "element", "of", "this", "<code", ">", "GraphicsContext<", "/", "code", ">", "so", "it", "can", "react", "to", "events", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L583-L585
StripesFramework/stripes-stuff
src/main/java/org/stripesstuff/plugin/session/SessionStoreInterceptor.java
SessionStoreInterceptor.saveFields
protected void saveFields(Collection<Field> fields, ActionBean actionBean, HttpSession session) throws IllegalAccessException { for (Field field : fields) { if (!field.isAccessible()) { field.setAccessible(true); } setAttribute(session, getFieldKey(field, actionBean.getClass()), field.get(actionBean), ((Session)field.getAnnotation(Session.class)).serializable(), ((Session)field.getAnnotation(Session.class)).maxTime()); } }
java
protected void saveFields(Collection<Field> fields, ActionBean actionBean, HttpSession session) throws IllegalAccessException { for (Field field : fields) { if (!field.isAccessible()) { field.setAccessible(true); } setAttribute(session, getFieldKey(field, actionBean.getClass()), field.get(actionBean), ((Session)field.getAnnotation(Session.class)).serializable(), ((Session)field.getAnnotation(Session.class)).maxTime()); } }
[ "protected", "void", "saveFields", "(", "Collection", "<", "Field", ">", "fields", ",", "ActionBean", "actionBean", ",", "HttpSession", "session", ")", "throws", "IllegalAccessException", "{", "for", "(", "Field", "field", ":", "fields", ")", "{", "if", "(", "!", "field", ".", "isAccessible", "(", ")", ")", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "}", "setAttribute", "(", "session", ",", "getFieldKey", "(", "field", ",", "actionBean", ".", "getClass", "(", ")", ")", ",", "field", ".", "get", "(", "actionBean", ")", ",", "(", "(", "Session", ")", "field", ".", "getAnnotation", "(", "Session", ".", "class", ")", ")", ".", "serializable", "(", ")", ",", "(", "(", "Session", ")", "field", ".", "getAnnotation", "(", "Session", ".", "class", ")", ")", ".", "maxTime", "(", ")", ")", ";", "}", "}" ]
Saves all fields in session. @param fields Fields to save in session. @param actionBean ActionBean. @param session HttpSession. @throws IllegalAccessException Cannot get access to some fields.
[ "Saves", "all", "fields", "in", "session", "." ]
train
https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/session/SessionStoreInterceptor.java#L76-L83
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java
TeaToolsUtils.createPatternString
public String createPatternString(String pattern, int length) { if (pattern == null) { return null; } int totalLength = pattern.length() * length; StringBuffer sb = new StringBuffer(totalLength); for (int i = 0; i < length; i++) { sb.append(pattern); } return sb.toString(); }
java
public String createPatternString(String pattern, int length) { if (pattern == null) { return null; } int totalLength = pattern.length() * length; StringBuffer sb = new StringBuffer(totalLength); for (int i = 0; i < length; i++) { sb.append(pattern); } return sb.toString(); }
[ "public", "String", "createPatternString", "(", "String", "pattern", ",", "int", "length", ")", "{", "if", "(", "pattern", "==", "null", ")", "{", "return", "null", ";", "}", "int", "totalLength", "=", "pattern", ".", "length", "(", ")", "*", "length", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "totalLength", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "pattern", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Creates a String with the specified pattern repeated length times.
[ "Creates", "a", "String", "with", "the", "specified", "pattern", "repeated", "length", "times", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/TeaToolsUtils.java#L693-L704
javalite/activeweb
javalite-async/src/main/java/org/javalite/async/Async.java
Async.receiveCommand
public Command receiveCommand(String queueName, long timeout) { try { Message message = receiveMessage(queueName, timeout); if(message == null){ return null; }else{ Command command; if(binaryMode){ command = Command.fromBytes(getBytes((BytesMessage) message)); }else { command = Command.fromXml(((TextMessage)message).getText()); } command.setJMSMessageID(message.getJMSMessageID()); return command; } } catch (Exception e) { throw new AsyncException("Could not get command", e); } }
java
public Command receiveCommand(String queueName, long timeout) { try { Message message = receiveMessage(queueName, timeout); if(message == null){ return null; }else{ Command command; if(binaryMode){ command = Command.fromBytes(getBytes((BytesMessage) message)); }else { command = Command.fromXml(((TextMessage)message).getText()); } command.setJMSMessageID(message.getJMSMessageID()); return command; } } catch (Exception e) { throw new AsyncException("Could not get command", e); } }
[ "public", "Command", "receiveCommand", "(", "String", "queueName", ",", "long", "timeout", ")", "{", "try", "{", "Message", "message", "=", "receiveMessage", "(", "queueName", ",", "timeout", ")", ";", "if", "(", "message", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "Command", "command", ";", "if", "(", "binaryMode", ")", "{", "command", "=", "Command", ".", "fromBytes", "(", "getBytes", "(", "(", "BytesMessage", ")", "message", ")", ")", ";", "}", "else", "{", "command", "=", "Command", ".", "fromXml", "(", "(", "(", "TextMessage", ")", "message", ")", ".", "getText", "(", ")", ")", ";", "}", "command", ".", "setJMSMessageID", "(", "message", ".", "getJMSMessageID", "(", ")", ")", ";", "return", "command", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "AsyncException", "(", "\"Could not get command\"", ",", "e", ")", ";", "}", "}" ]
Receives a command from a queue synchronously. If this queue also has listeners, then commands will be distributed across all consumers. @param queueName name of queue @param timeout timeout in milliseconds. If a command is not received during a timeout, this methods returns null. @return command if found. If command not found, this method will block till a command is present in queue or a timeout expires.
[ "Receives", "a", "command", "from", "a", "queue", "synchronously", ".", "If", "this", "queue", "also", "has", "listeners", "then", "commands", "will", "be", "distributed", "across", "all", "consumers", "." ]
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L433-L452
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
MethodUtils.invokeMethod
public static Object invokeMethod(final Object object, final String methodName, Object... args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { args = ArrayUtils.nullToEmpty(args); final Class<?>[] parameterTypes = ClassUtils.toClass(args); return invokeMethod(object, methodName, args, parameterTypes); }
java
public static Object invokeMethod(final Object object, final String methodName, Object... args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { args = ArrayUtils.nullToEmpty(args); final Class<?>[] parameterTypes = ClassUtils.toClass(args); return invokeMethod(object, methodName, args, parameterTypes); }
[ "public", "static", "Object", "invokeMethod", "(", "final", "Object", "object", ",", "final", "String", "methodName", ",", "Object", "...", "args", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "args", "=", "ArrayUtils", ".", "nullToEmpty", "(", "args", ")", ";", "final", "Class", "<", "?", ">", "[", "]", "parameterTypes", "=", "ClassUtils", ".", "toClass", "(", "args", ")", ";", "return", "invokeMethod", "(", "object", ",", "methodName", ",", "args", ",", "parameterTypes", ")", ";", "}" ]
<p>Invokes a named method whose parameter type matches the object type.</p> <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class, String, Class[])}.</p> <p>This method supports calls to methods taking primitive parameters via passing in wrapping classes. So, for example, a {@code Boolean} object would match a {@code boolean} primitive.</p> <p>This is a convenient wrapper for {@link #invokeMethod(Object object,String methodName, Object[] args, Class[] parameterTypes)}. </p> @param object invoke method on this object @param methodName get method with this name @param args use these arguments - treat null as empty array @return The value returned by the invoked method @throws NoSuchMethodException if there is no such accessible method @throws InvocationTargetException wraps an exception thrown by the method invoked @throws IllegalAccessException if the requested method is not accessible via reflection
[ "<p", ">", "Invokes", "a", "named", "method", "whose", "parameter", "type", "matches", "the", "object", "type", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java#L146-L152
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java
Function.getArgument
public <T> T getArgument(int idx, Class<? extends T> type) { return getArgument(-1, idx, type); }
java
public <T> T getArgument(int idx, Class<? extends T> type) { return getArgument(-1, idx, type); }
[ "public", "<", "T", ">", "T", "getArgument", "(", "int", "idx", ",", "Class", "<", "?", "extends", "T", ">", "type", ")", "{", "return", "getArgument", "(", "-", "1", ",", "idx", ",", "type", ")", ";", "}" ]
Safety return the argument in the position idx. If the element class is not of the requested type it returns null and you don't get casting exeption.
[ "Safety", "return", "the", "argument", "in", "the", "position", "idx", "." ]
train
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java#L221-L223
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSField.java
JSField.estimateSizeOfUnassembledValue
public int estimateSizeOfUnassembledValue(byte[] frame, int offset, int indirect) { if (indirect == 0) return estimateUnassembledSize(frame, offset); else return coder.estimateUnassembledSize(frame, offset); }
java
public int estimateSizeOfUnassembledValue(byte[] frame, int offset, int indirect) { if (indirect == 0) return estimateUnassembledSize(frame, offset); else return coder.estimateUnassembledSize(frame, offset); }
[ "public", "int", "estimateSizeOfUnassembledValue", "(", "byte", "[", "]", "frame", ",", "int", "offset", ",", "int", "indirect", ")", "{", "if", "(", "indirect", "==", "0", ")", "return", "estimateUnassembledSize", "(", "frame", ",", "offset", ")", ";", "else", "return", "coder", ".", "estimateUnassembledSize", "(", "frame", ",", "offset", ")", ";", "}" ]
estimateSizeOfUnassembledValue Return the estimated size of the value if unassembled. This size includes a guess at the heap overhead of the object(s) which would be created. @param frame the byte array from which the object would be deserialized. @param offset the byte at which to start in frame @param indirect the list indirection that applies to the object or -1 if the JSField's maximum list indirection (based on the number of JSRepeated nodes that dominate it in the schema) is to be used: this, of course, includes the possibility that it isn't a list at all. @return int the estimated size of the unassembled object in the heap.
[ "estimateSizeOfUnassembledValue", "Return", "the", "estimated", "size", "of", "the", "value", "if", "unassembled", ".", "This", "size", "includes", "a", "guess", "at", "the", "heap", "overhead", "of", "the", "object", "(", "s", ")", "which", "would", "be", "created", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSField.java#L222-L227
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ConcurrentBoundedWorkUnitList.java
ConcurrentBoundedWorkUnitList.addFileSet
public boolean addFileSet(FileSet<CopyEntity> fileSet, List<WorkUnit> workUnits) { boolean addedWorkunits = addFileSetImpl(fileSet, workUnits); if (!addedWorkunits) { this.rejectedFileSet = true; } return addedWorkunits; }
java
public boolean addFileSet(FileSet<CopyEntity> fileSet, List<WorkUnit> workUnits) { boolean addedWorkunits = addFileSetImpl(fileSet, workUnits); if (!addedWorkunits) { this.rejectedFileSet = true; } return addedWorkunits; }
[ "public", "boolean", "addFileSet", "(", "FileSet", "<", "CopyEntity", ">", "fileSet", ",", "List", "<", "WorkUnit", ">", "workUnits", ")", "{", "boolean", "addedWorkunits", "=", "addFileSetImpl", "(", "fileSet", ",", "workUnits", ")", ";", "if", "(", "!", "addedWorkunits", ")", "{", "this", ".", "rejectedFileSet", "=", "true", ";", "}", "return", "addedWorkunits", ";", "}" ]
Add a file set to the container. @param fileSet File set, expressed as a {@link org.apache.gobblin.data.management.partition.FileSet} of {@link CopyEntity}s. @param workUnits List of {@link WorkUnit}s corresponding to this file set. @return true if the file set was added to the container, false otherwise (i.e. has reached max size).
[ "Add", "a", "file", "set", "to", "the", "container", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ConcurrentBoundedWorkUnitList.java#L108-L114
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java
DomainsInner.beginCreateOrUpdateAsync
public Observable<DomainInner> beginCreateOrUpdateAsync(String resourceGroupName, String domainName, DomainInner domainInfo) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, domainName, domainInfo).map(new Func1<ServiceResponse<DomainInner>, DomainInner>() { @Override public DomainInner call(ServiceResponse<DomainInner> response) { return response.body(); } }); }
java
public Observable<DomainInner> beginCreateOrUpdateAsync(String resourceGroupName, String domainName, DomainInner domainInfo) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, domainName, domainInfo).map(new Func1<ServiceResponse<DomainInner>, DomainInner>() { @Override public DomainInner call(ServiceResponse<DomainInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DomainInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "domainName", ",", "DomainInner", "domainInfo", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "domainName", ",", "domainInfo", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DomainInner", ">", ",", "DomainInner", ">", "(", ")", "{", "@", "Override", "public", "DomainInner", "call", "(", "ServiceResponse", "<", "DomainInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create a domain. Asynchronously creates a new domain with the specified parameters. @param resourceGroupName The name of the resource group within the user's subscription. @param domainName Name of the domain @param domainInfo Domain information @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DomainInner object
[ "Create", "a", "domain", ".", "Asynchronously", "creates", "a", "new", "domain", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java#L327-L334
alkacon/opencms-core
src/org/opencms/xml/CmsXmlUtils.java
CmsXmlUtils.createXpath
public static String createXpath(String path, int index) { if (path.indexOf('/') > -1) { // this is a complex path over more then 1 node StringBuffer result = new StringBuffer(path.length() + 32); // split the path into sub elements List<String> elements = CmsStringUtil.splitAsList(path, '/'); int end = elements.size() - 1; for (int i = 0; i <= end; i++) { // append [i] to path element if required result.append(createXpathElementCheck(elements.get(i), (i == end) ? index : 1)); if (i < end) { // append path delimiter if not final path element result.append('/'); } } return result.toString(); } // this path has only 1 node, append [index] if required return createXpathElementCheck(path, index); }
java
public static String createXpath(String path, int index) { if (path.indexOf('/') > -1) { // this is a complex path over more then 1 node StringBuffer result = new StringBuffer(path.length() + 32); // split the path into sub elements List<String> elements = CmsStringUtil.splitAsList(path, '/'); int end = elements.size() - 1; for (int i = 0; i <= end; i++) { // append [i] to path element if required result.append(createXpathElementCheck(elements.get(i), (i == end) ? index : 1)); if (i < end) { // append path delimiter if not final path element result.append('/'); } } return result.toString(); } // this path has only 1 node, append [index] if required return createXpathElementCheck(path, index); }
[ "public", "static", "String", "createXpath", "(", "String", "path", ",", "int", "index", ")", "{", "if", "(", "path", ".", "indexOf", "(", "'", "'", ")", ">", "-", "1", ")", "{", "// this is a complex path over more then 1 node", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "path", ".", "length", "(", ")", "+", "32", ")", ";", "// split the path into sub elements", "List", "<", "String", ">", "elements", "=", "CmsStringUtil", ".", "splitAsList", "(", "path", ",", "'", "'", ")", ";", "int", "end", "=", "elements", ".", "size", "(", ")", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "end", ";", "i", "++", ")", "{", "// append [i] to path element if required", "result", ".", "append", "(", "createXpathElementCheck", "(", "elements", ".", "get", "(", "i", ")", ",", "(", "i", "==", "end", ")", "?", "index", ":", "1", ")", ")", ";", "if", "(", "i", "<", "end", ")", "{", "// append path delimiter if not final path element", "result", ".", "append", "(", "'", "'", ")", ";", "}", "}", "return", "result", ".", "toString", "(", ")", ";", "}", "// this path has only 1 node, append [index] if required", "return", "createXpathElementCheck", "(", "path", ",", "index", ")", ";", "}" ]
Translates a simple lookup path to the simplified Xpath format used for the internal bookmarks.<p> Examples:<br> <code>title</code> becomes <code>title[1]</code><br> <code>title[1]</code> is left untouched<br> <code>title/subtitle</code> becomes <code>title[1]/subtitle[1]</code><br> <code>title/subtitle[1]</code> becomes <code>title[1]/subtitle[1]</code><p> Note: If the name already has the format <code>title[1]</code> then provided index parameter is ignored.<p> @param path the path to get the simplified Xpath for @param index the index to append (if required) @return the simplified Xpath for the given name
[ "Translates", "a", "simple", "lookup", "path", "to", "the", "simplified", "Xpath", "format", "used", "for", "the", "internal", "bookmarks", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlUtils.java#L177-L199
JodaOrg/joda-time
src/main/java/org/joda/time/chrono/BuddhistChronology.java
BuddhistChronology.getInstance
public static BuddhistChronology getInstance(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } BuddhistChronology chrono = cCache.get(zone); if (chrono == null) { // First create without a lower limit. chrono = new BuddhistChronology(GJChronology.getInstance(zone, null), null); // Impose lower limit and make another BuddhistChronology. DateTime lowerLimit = new DateTime(1, 1, 1, 0, 0, 0, 0, chrono); chrono = new BuddhistChronology(LimitChronology.getInstance(chrono, lowerLimit, null), ""); BuddhistChronology oldChrono = cCache.putIfAbsent(zone, chrono); if (oldChrono != null) { chrono = oldChrono; } } return chrono; }
java
public static BuddhistChronology getInstance(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } BuddhistChronology chrono = cCache.get(zone); if (chrono == null) { // First create without a lower limit. chrono = new BuddhistChronology(GJChronology.getInstance(zone, null), null); // Impose lower limit and make another BuddhistChronology. DateTime lowerLimit = new DateTime(1, 1, 1, 0, 0, 0, 0, chrono); chrono = new BuddhistChronology(LimitChronology.getInstance(chrono, lowerLimit, null), ""); BuddhistChronology oldChrono = cCache.putIfAbsent(zone, chrono); if (oldChrono != null) { chrono = oldChrono; } } return chrono; }
[ "public", "static", "BuddhistChronology", "getInstance", "(", "DateTimeZone", "zone", ")", "{", "if", "(", "zone", "==", "null", ")", "{", "zone", "=", "DateTimeZone", ".", "getDefault", "(", ")", ";", "}", "BuddhistChronology", "chrono", "=", "cCache", ".", "get", "(", "zone", ")", ";", "if", "(", "chrono", "==", "null", ")", "{", "// First create without a lower limit.", "chrono", "=", "new", "BuddhistChronology", "(", "GJChronology", ".", "getInstance", "(", "zone", ",", "null", ")", ",", "null", ")", ";", "// Impose lower limit and make another BuddhistChronology.", "DateTime", "lowerLimit", "=", "new", "DateTime", "(", "1", ",", "1", ",", "1", ",", "0", ",", "0", ",", "0", ",", "0", ",", "chrono", ")", ";", "chrono", "=", "new", "BuddhistChronology", "(", "LimitChronology", ".", "getInstance", "(", "chrono", ",", "lowerLimit", ",", "null", ")", ",", "\"\"", ")", ";", "BuddhistChronology", "oldChrono", "=", "cCache", ".", "putIfAbsent", "(", "zone", ",", "chrono", ")", ";", "if", "(", "oldChrono", "!=", "null", ")", "{", "chrono", "=", "oldChrono", ";", "}", "}", "return", "chrono", ";", "}" ]
Standard instance of a Buddhist Chronology, that matches Sun's BuddhistCalendar class. This means that it follows the GregorianJulian calendar rules with a cutover date. @param zone the time zone to use, null is default
[ "Standard", "instance", "of", "a", "Buddhist", "Chronology", "that", "matches", "Sun", "s", "BuddhistCalendar", "class", ".", "This", "means", "that", "it", "follows", "the", "GregorianJulian", "calendar", "rules", "with", "a", "cutover", "date", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/BuddhistChronology.java#L104-L121
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java
TypeHandlerUtils.convertClob
public static Object convertClob(Connection conn, String value) throws SQLException { return convertClob(conn, value.getBytes()); }
java
public static Object convertClob(Connection conn, String value) throws SQLException { return convertClob(conn, value.getBytes()); }
[ "public", "static", "Object", "convertClob", "(", "Connection", "conn", ",", "String", "value", ")", "throws", "SQLException", "{", "return", "convertClob", "(", "conn", ",", "value", ".", "getBytes", "(", ")", ")", ";", "}" ]
Transfers data from String into sql.Blob @param conn connection for which sql.Blob object would be created @param value String @return sql.Clob from String @throws SQLException
[ "Transfers", "data", "from", "String", "into", "sql", ".", "Blob" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L189-L191
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/GeomFactory1dfx.java
GeomFactory1dfx.newVector
@SuppressWarnings("static-method") public Vector1dfx newVector(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) { return new Vector1dfx(segment, x, y); }
java
@SuppressWarnings("static-method") public Vector1dfx newVector(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) { return new Vector1dfx(segment, x, y); }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "public", "Vector1dfx", "newVector", "(", "ObjectProperty", "<", "WeakReference", "<", "Segment1D", "<", "?", ",", "?", ">", ">", ">", "segment", ",", "DoubleProperty", "x", ",", "DoubleProperty", "y", ")", "{", "return", "new", "Vector1dfx", "(", "segment", ",", "x", ",", "y", ")", ";", "}" ]
Create a vector with properties. @param segment the segment property. @param x the x property. @param y the y property. @return the vector.
[ "Create", "a", "vector", "with", "properties", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/GeomFactory1dfx.java#L131-L134
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_publicFolder_path_PUT
public void organizationName_service_exchangeService_publicFolder_path_PUT(String organizationName, String exchangeService, String path, OvhPublicFolder body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}"; StringBuilder sb = path(qPath, organizationName, exchangeService, path); exec(qPath, "PUT", sb.toString(), body); }
java
public void organizationName_service_exchangeService_publicFolder_path_PUT(String organizationName, String exchangeService, String path, OvhPublicFolder body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}"; StringBuilder sb = path(qPath, organizationName, exchangeService, path); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "organizationName_service_exchangeService_publicFolder_path_PUT", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "path", ",", "OvhPublicFolder", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "organizationName", ",", "exchangeService", ",", "path", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/publicFolder/{path} @param body [required] New object properties @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param path [required] Path for public folder
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L182-L186
mapsforge/mapsforge
mapsforge-poi/src/main/java/org/mapsforge/poi/storage/PoiCategoryRangeQueryGenerator.java
PoiCategoryRangeQueryGenerator.getSQLSelectString
public static String getSQLSelectString(PoiCategoryFilter filter, int count, int version) { StringBuilder sb = new StringBuilder(); sb.append(DbConstants.FIND_IN_BOX_CLAUSE_SELECT); if (version < 2) { sb.append(DbConstants.JOIN_DATA_CLAUSE); } else { sb.append(DbConstants.JOIN_CATEGORY_CLAUSE); if (count > 0) { sb.append(DbConstants.JOIN_DATA_CLAUSE); } } sb.append(DbConstants.FIND_IN_BOX_CLAUSE_WHERE); sb.append(getSQLWhereClauseString(filter, version)); for (int i = 0; i < count; i++) { sb.append(DbConstants.FIND_BY_DATA_CLAUSE); } return (sb.append(" LIMIT ?;").toString()); }
java
public static String getSQLSelectString(PoiCategoryFilter filter, int count, int version) { StringBuilder sb = new StringBuilder(); sb.append(DbConstants.FIND_IN_BOX_CLAUSE_SELECT); if (version < 2) { sb.append(DbConstants.JOIN_DATA_CLAUSE); } else { sb.append(DbConstants.JOIN_CATEGORY_CLAUSE); if (count > 0) { sb.append(DbConstants.JOIN_DATA_CLAUSE); } } sb.append(DbConstants.FIND_IN_BOX_CLAUSE_WHERE); sb.append(getSQLWhereClauseString(filter, version)); for (int i = 0; i < count; i++) { sb.append(DbConstants.FIND_BY_DATA_CLAUSE); } return (sb.append(" LIMIT ?;").toString()); }
[ "public", "static", "String", "getSQLSelectString", "(", "PoiCategoryFilter", "filter", ",", "int", "count", ",", "int", "version", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "DbConstants", ".", "FIND_IN_BOX_CLAUSE_SELECT", ")", ";", "if", "(", "version", "<", "2", ")", "{", "sb", ".", "append", "(", "DbConstants", ".", "JOIN_DATA_CLAUSE", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "DbConstants", ".", "JOIN_CATEGORY_CLAUSE", ")", ";", "if", "(", "count", ">", "0", ")", "{", "sb", ".", "append", "(", "DbConstants", ".", "JOIN_DATA_CLAUSE", ")", ";", "}", "}", "sb", ".", "append", "(", "DbConstants", ".", "FIND_IN_BOX_CLAUSE_WHERE", ")", ";", "sb", ".", "append", "(", "getSQLWhereClauseString", "(", "filter", ",", "version", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "DbConstants", ".", "FIND_BY_DATA_CLAUSE", ")", ";", "}", "return", "(", "sb", ".", "append", "(", "\" LIMIT ?;\"", ")", ".", "toString", "(", ")", ")", ";", "}" ]
Gets the SQL query that looks up POI entries. @param filter The filter object for determining all wanted categories. @param count Count of patterns to search in points of interest names (may be 0). @param version POI specification version. @return The SQL query.
[ "Gets", "the", "SQL", "query", "that", "looks", "up", "POI", "entries", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-poi/src/main/java/org/mapsforge/poi/storage/PoiCategoryRangeQueryGenerator.java#L40-L57
dvdme/forecastio-lib-java
src/com/github/dvdme/ForecastIOLib/ForecastIO.java
ForecastIO.setHTTPProxy
public void setHTTPProxy(String PROXYNAME, int PROXYPORT) { if (PROXYNAME == null) { this.proxy_to_use = null; } else { this.proxy_to_use = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXYNAME, PROXYPORT)); } }
java
public void setHTTPProxy(String PROXYNAME, int PROXYPORT) { if (PROXYNAME == null) { this.proxy_to_use = null; } else { this.proxy_to_use = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXYNAME, PROXYPORT)); } }
[ "public", "void", "setHTTPProxy", "(", "String", "PROXYNAME", ",", "int", "PROXYPORT", ")", "{", "if", "(", "PROXYNAME", "==", "null", ")", "{", "this", ".", "proxy_to_use", "=", "null", ";", "}", "else", "{", "this", ".", "proxy_to_use", "=", "new", "Proxy", "(", "Proxy", ".", "Type", ".", "HTTP", ",", "new", "InetSocketAddress", "(", "PROXYNAME", ",", "PROXYPORT", ")", ")", ";", "}", "}" ]
Sets the http-proxy to use. @param PROXYNAME hostname or ip of the proxy to use (e.g. "127.0.0.1"). If proxyname equals null, no proxy will be used. @param PROXYPORT port of the proxy to use (e.g. 8080)
[ "Sets", "the", "http", "-", "proxy", "to", "use", "." ]
train
https://github.com/dvdme/forecastio-lib-java/blob/63c0ff17446eb7eb4e9f8bef4e19272f14c74e85/src/com/github/dvdme/ForecastIOLib/ForecastIO.java#L285-L292
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java
ConstantsSummaryBuilder.buildClassConstantSummary
public void buildClassConstantSummary(XMLNode node, Content summariesTree) throws DocletException { SortedSet<TypeElement> classes = !currentPackage.isUnnamed() ? utils.getAllClasses(currentPackage) : configuration.typeElementCatalog.allUnnamedClasses(); Content classConstantTree = writer.getClassConstantHeader(); for (TypeElement te : classes) { if (!typeElementsWithConstFields.contains(te) || !utils.isIncluded(te)) { continue; } currentClass = te; //Build the documentation for the current class. buildChildren(node, classConstantTree); } writer.addClassConstant(summariesTree, classConstantTree); }
java
public void buildClassConstantSummary(XMLNode node, Content summariesTree) throws DocletException { SortedSet<TypeElement> classes = !currentPackage.isUnnamed() ? utils.getAllClasses(currentPackage) : configuration.typeElementCatalog.allUnnamedClasses(); Content classConstantTree = writer.getClassConstantHeader(); for (TypeElement te : classes) { if (!typeElementsWithConstFields.contains(te) || !utils.isIncluded(te)) { continue; } currentClass = te; //Build the documentation for the current class. buildChildren(node, classConstantTree); } writer.addClassConstant(summariesTree, classConstantTree); }
[ "public", "void", "buildClassConstantSummary", "(", "XMLNode", "node", ",", "Content", "summariesTree", ")", "throws", "DocletException", "{", "SortedSet", "<", "TypeElement", ">", "classes", "=", "!", "currentPackage", ".", "isUnnamed", "(", ")", "?", "utils", ".", "getAllClasses", "(", "currentPackage", ")", ":", "configuration", ".", "typeElementCatalog", ".", "allUnnamedClasses", "(", ")", ";", "Content", "classConstantTree", "=", "writer", ".", "getClassConstantHeader", "(", ")", ";", "for", "(", "TypeElement", "te", ":", "classes", ")", "{", "if", "(", "!", "typeElementsWithConstFields", ".", "contains", "(", "te", ")", "||", "!", "utils", ".", "isIncluded", "(", "te", ")", ")", "{", "continue", ";", "}", "currentClass", "=", "te", ";", "//Build the documentation for the current class.", "buildChildren", "(", "node", ",", "classConstantTree", ")", ";", "}", "writer", ".", "addClassConstant", "(", "summariesTree", ",", "classConstantTree", ")", ";", "}" ]
Build the summary for the current class. @param node the XML element that specifies which components to document @param summariesTree the tree to which the class constant summary will be added @throws DocletException if there is a problem while building the documentation
[ "Build", "the", "summary", "for", "the", "current", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java#L221-L237
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
HttpHeaders.setDateHeader
@Deprecated public static void setDateHeader(HttpMessage message, String name, Iterable<Date> values) { message.headers().set(name, values); }
java
@Deprecated public static void setDateHeader(HttpMessage message, String name, Iterable<Date> values) { message.headers().set(name, values); }
[ "@", "Deprecated", "public", "static", "void", "setDateHeader", "(", "HttpMessage", "message", ",", "String", "name", ",", "Iterable", "<", "Date", ">", "values", ")", "{", "message", ".", "headers", "(", ")", ".", "set", "(", "name", ",", "values", ")", ";", "}" ]
@deprecated Use {@link #set(CharSequence, Iterable)} instead. @see #setDateHeader(HttpMessage, CharSequence, Iterable)
[ "@deprecated", "Use", "{", "@link", "#set", "(", "CharSequence", "Iterable", ")", "}", "instead", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L914-L917
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/v1/DbxClientV1.java
DbxClientV1.getDeltaC
public <C> DbxDeltaC<C> getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>, C> collector, /*@Nullable*/String cursor) throws DbxException { return getDeltaC(collector, cursor, false); }
java
public <C> DbxDeltaC<C> getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>, C> collector, /*@Nullable*/String cursor) throws DbxException { return getDeltaC(collector, cursor, false); }
[ "public", "<", "C", ">", "DbxDeltaC", "<", "C", ">", "getDeltaC", "(", "Collector", "<", "DbxDeltaC", ".", "Entry", "<", "DbxEntry", ">", ",", "C", ">", "collector", ",", "/*@Nullable*/", "String", "cursor", ")", "throws", "DbxException", "{", "return", "getDeltaC", "(", "collector", ",", "cursor", ",", "false", ")", ";", "}" ]
Same as {@link #getDeltaC(Collector, String, boolean)} with {@code includeMediaInfo} set to {@code false}.
[ "Same", "as", "{" ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1508-L1512
astrapi69/mystic-crypt
crypt-data/src/main/java/de/alpharogroup/crypto/key/PublicKeyExtensions.java
PublicKeyExtensions.toPemFile
public static void toPemFile(final @NonNull PublicKey publicKey, final @NonNull File file) throws IOException { PublicKeyWriter.writeInPemFormat(publicKey, file); }
java
public static void toPemFile(final @NonNull PublicKey publicKey, final @NonNull File file) throws IOException { PublicKeyWriter.writeInPemFormat(publicKey, file); }
[ "public", "static", "void", "toPemFile", "(", "final", "@", "NonNull", "PublicKey", "publicKey", ",", "final", "@", "NonNull", "File", "file", ")", "throws", "IOException", "{", "PublicKeyWriter", ".", "writeInPemFormat", "(", "publicKey", ",", "file", ")", ";", "}" ]
Write the given {@link PublicKey} into the given {@link File}. @param publicKey the public key @param file the file to write in @throws IOException Signals that an I/O exception has occurred.
[ "Write", "the", "given", "{", "@link", "PublicKey", "}", "into", "the", "given", "{", "@link", "File", "}", "." ]
train
https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/PublicKeyExtensions.java#L153-L156
apache/groovy
subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java
DateTimeExtensions.rightShift
public static Period rightShift(YearMonth self, YearMonth other) { return Period.between(self.atDay(1), other.atDay(1)); }
java
public static Period rightShift(YearMonth self, YearMonth other) { return Period.between(self.atDay(1), other.atDay(1)); }
[ "public", "static", "Period", "rightShift", "(", "YearMonth", "self", ",", "YearMonth", "other", ")", "{", "return", "Period", ".", "between", "(", "self", ".", "atDay", "(", "1", ")", ",", "other", ".", "atDay", "(", "1", ")", ")", ";", "}" ]
Returns a {@link java.time.Period} of time between the first day of this year/month (inclusive) and the given {@link java.time.YearMonth} (exclusive). @param self a YearMonth @param other another YearMonth @return a Period @since 2.5.0
[ "Returns", "a", "{", "@link", "java", ".", "time", ".", "Period", "}", "of", "time", "between", "the", "first", "day", "of", "this", "year", "/", "month", "(", "inclusive", ")", "and", "the", "given", "{", "@link", "java", ".", "time", ".", "YearMonth", "}", "(", "exclusive", ")", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L1603-L1605
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LocalNameRangeQuery.java
LocalNameRangeQuery.getUpperTerm
private static Term getUpperTerm(String upperName) { String text; if (upperName == null) { text = "\uFFFF"; } else { text = upperName; } return new Term(FieldNames.LOCAL_NAME, text); }
java
private static Term getUpperTerm(String upperName) { String text; if (upperName == null) { text = "\uFFFF"; } else { text = upperName; } return new Term(FieldNames.LOCAL_NAME, text); }
[ "private", "static", "Term", "getUpperTerm", "(", "String", "upperName", ")", "{", "String", "text", ";", "if", "(", "upperName", "==", "null", ")", "{", "text", "=", "\"\\uFFFF\"", ";", "}", "else", "{", "text", "=", "upperName", ";", "}", "return", "new", "Term", "(", "FieldNames", ".", "LOCAL_NAME", ",", "text", ")", ";", "}" ]
Creates a {@link Term} for the upper bound local name. @param upperName the upper bound local name. @return a {@link Term} for the upper bound local name.
[ "Creates", "a", "{", "@link", "Term", "}", "for", "the", "upper", "bound", "local", "name", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LocalNameRangeQuery.java#L68-L76
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.removeUntilLast
public boolean removeUntilLast(ST obj, PT pt) { return removeUntil(lastIndexOf(obj, pt), true); }
java
public boolean removeUntilLast(ST obj, PT pt) { return removeUntil(lastIndexOf(obj, pt), true); }
[ "public", "boolean", "removeUntilLast", "(", "ST", "obj", ",", "PT", "pt", ")", "{", "return", "removeUntil", "(", "lastIndexOf", "(", "obj", ",", "pt", ")", ",", "true", ")", ";", "}" ]
Remove the path's elements before the specified one which is starting at the specified point. The specified element will be removed. <p>This function removes until the <i>last occurence</i> of the given object. @param obj is the segment to remove @param pt is the point on which the segment was connected as its first point. @return <code>true</code> on success, otherwise <code>false</code>
[ "Remove", "the", "path", "s", "elements", "before", "the", "specified", "one", "which", "is", "starting", "at", "the", "specified", "point", ".", "The", "specified", "element", "will", "be", "removed", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L709-L711
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java
SparkComputationGraph.scoreExamplesMultiDataSet
public <K> JavaPairRDD<K, Double> scoreExamplesMultiDataSet(JavaPairRDD<K, MultiDataSet> data, boolean includeRegularizationTerms) { return scoreExamplesMultiDataSet(data, includeRegularizationTerms, DEFAULT_EVAL_SCORE_BATCH_SIZE); }
java
public <K> JavaPairRDD<K, Double> scoreExamplesMultiDataSet(JavaPairRDD<K, MultiDataSet> data, boolean includeRegularizationTerms) { return scoreExamplesMultiDataSet(data, includeRegularizationTerms, DEFAULT_EVAL_SCORE_BATCH_SIZE); }
[ "public", "<", "K", ">", "JavaPairRDD", "<", "K", ",", "Double", ">", "scoreExamplesMultiDataSet", "(", "JavaPairRDD", "<", "K", ",", "MultiDataSet", ">", "data", ",", "boolean", "includeRegularizationTerms", ")", "{", "return", "scoreExamplesMultiDataSet", "(", "data", ",", "includeRegularizationTerms", ",", "DEFAULT_EVAL_SCORE_BATCH_SIZE", ")", ";", "}" ]
Score the examples individually, using the default batch size {@link #DEFAULT_EVAL_SCORE_BATCH_SIZE}. Unlike {@link #calculateScore(JavaRDD, boolean)}, this method returns a score for each example separately<br> Note: The provided JavaPairRDD has a key that is associated with each example and returned score.<br> <b>Note:</b> The DataSet objects passed in must have exactly one example in them (otherwise: can't have a 1:1 association between keys and data sets to score) @param data Data to score @param includeRegularizationTerms If true: include the l1/l2 regularization terms with the score (if any) @param <K> Key type @return A {@code JavaPairRDD<K,Double>} containing the scores of each example @see MultiLayerNetwork#scoreExamples(DataSet, boolean)
[ "Score", "the", "examples", "individually", "using", "the", "default", "batch", "size", "{", "@link", "#DEFAULT_EVAL_SCORE_BATCH_SIZE", "}", ".", "Unlike", "{", "@link", "#calculateScore", "(", "JavaRDD", "boolean", ")", "}", "this", "method", "returns", "a", "score", "for", "each", "example", "separately<br", ">", "Note", ":", "The", "provided", "JavaPairRDD", "has", "a", "key", "that", "is", "associated", "with", "each", "example", "and", "returned", "score", ".", "<br", ">", "<b", ">", "Note", ":", "<", "/", "b", ">", "The", "DataSet", "objects", "passed", "in", "must", "have", "exactly", "one", "example", "in", "them", "(", "otherwise", ":", "can", "t", "have", "a", "1", ":", "1", "association", "between", "keys", "and", "data", "sets", "to", "score", ")" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L501-L504
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsDynamicFunctionBean.java
CmsDynamicFunctionBean.getFormatForContainer
public Format getFormatForContainer(CmsObject cms, String type, int width) { IdentityHashMap<CmsFormatterBean, Format> formatsByFormatter = new IdentityHashMap<CmsFormatterBean, Format>(); // relate formatters to formats so we can pick the corresponding format after a formatter has been selected CmsFormatterBean mainFormatter = createFormatterBean(m_mainFormat, true); formatsByFormatter.put(mainFormatter, m_mainFormat); List<I_CmsFormatterBean> formatters = new ArrayList<I_CmsFormatterBean>(); for (Format format : m_otherFormats) { CmsFormatterBean formatter = createFormatterBean(format, false); formatsByFormatter.put(formatter, format); formatters.add(formatter); } formatters.add(0, mainFormatter); CmsFormatterConfiguration formatterConfiguration = CmsFormatterConfiguration.create(cms, formatters); I_CmsFormatterBean matchingFormatter = formatterConfiguration.getDefaultFormatter(type, width); if (matchingFormatter == null) { return null; } return formatsByFormatter.get(matchingFormatter); }
java
public Format getFormatForContainer(CmsObject cms, String type, int width) { IdentityHashMap<CmsFormatterBean, Format> formatsByFormatter = new IdentityHashMap<CmsFormatterBean, Format>(); // relate formatters to formats so we can pick the corresponding format after a formatter has been selected CmsFormatterBean mainFormatter = createFormatterBean(m_mainFormat, true); formatsByFormatter.put(mainFormatter, m_mainFormat); List<I_CmsFormatterBean> formatters = new ArrayList<I_CmsFormatterBean>(); for (Format format : m_otherFormats) { CmsFormatterBean formatter = createFormatterBean(format, false); formatsByFormatter.put(formatter, format); formatters.add(formatter); } formatters.add(0, mainFormatter); CmsFormatterConfiguration formatterConfiguration = CmsFormatterConfiguration.create(cms, formatters); I_CmsFormatterBean matchingFormatter = formatterConfiguration.getDefaultFormatter(type, width); if (matchingFormatter == null) { return null; } return formatsByFormatter.get(matchingFormatter); }
[ "public", "Format", "getFormatForContainer", "(", "CmsObject", "cms", ",", "String", "type", ",", "int", "width", ")", "{", "IdentityHashMap", "<", "CmsFormatterBean", ",", "Format", ">", "formatsByFormatter", "=", "new", "IdentityHashMap", "<", "CmsFormatterBean", ",", "Format", ">", "(", ")", ";", "// relate formatters to formats so we can pick the corresponding format after a formatter has been selected\r", "CmsFormatterBean", "mainFormatter", "=", "createFormatterBean", "(", "m_mainFormat", ",", "true", ")", ";", "formatsByFormatter", ".", "put", "(", "mainFormatter", ",", "m_mainFormat", ")", ";", "List", "<", "I_CmsFormatterBean", ">", "formatters", "=", "new", "ArrayList", "<", "I_CmsFormatterBean", ">", "(", ")", ";", "for", "(", "Format", "format", ":", "m_otherFormats", ")", "{", "CmsFormatterBean", "formatter", "=", "createFormatterBean", "(", "format", ",", "false", ")", ";", "formatsByFormatter", ".", "put", "(", "formatter", ",", "format", ")", ";", "formatters", ".", "add", "(", "formatter", ")", ";", "}", "formatters", ".", "add", "(", "0", ",", "mainFormatter", ")", ";", "CmsFormatterConfiguration", "formatterConfiguration", "=", "CmsFormatterConfiguration", ".", "create", "(", "cms", ",", "formatters", ")", ";", "I_CmsFormatterBean", "matchingFormatter", "=", "formatterConfiguration", ".", "getDefaultFormatter", "(", "type", ",", "width", ")", ";", "if", "(", "matchingFormatter", "==", "null", ")", "{", "return", "null", ";", "}", "return", "formatsByFormatter", ".", "get", "(", "matchingFormatter", ")", ";", "}" ]
Finds the correct format for a given container type and width.<p> @param cms the current CMS context @param type the container type @param width the container width @return the format for the given container type and width
[ "Finds", "the", "correct", "format", "for", "a", "given", "container", "type", "and", "width", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsDynamicFunctionBean.java#L228-L247
ulisesbocchio/spring-boot-security-saml
spring-boot-security-saml/src/main/java/com/github/ulisesbocchio/spring/boot/security/saml/resource/KeystoreFactory.java
KeystoreFactory.addKeyToKeystore
@SneakyThrows public void addKeyToKeystore(KeyStore keyStore, X509Certificate cert, RSAPrivateKey privateKey, String alias, String password) { KeyStore.PasswordProtection pass = new KeyStore.PasswordProtection(password.toCharArray()); Certificate[] certificateChain = {cert}; keyStore.setEntry(alias, new KeyStore.PrivateKeyEntry(privateKey, certificateChain), pass); }
java
@SneakyThrows public void addKeyToKeystore(KeyStore keyStore, X509Certificate cert, RSAPrivateKey privateKey, String alias, String password) { KeyStore.PasswordProtection pass = new KeyStore.PasswordProtection(password.toCharArray()); Certificate[] certificateChain = {cert}; keyStore.setEntry(alias, new KeyStore.PrivateKeyEntry(privateKey, certificateChain), pass); }
[ "@", "SneakyThrows", "public", "void", "addKeyToKeystore", "(", "KeyStore", "keyStore", ",", "X509Certificate", "cert", ",", "RSAPrivateKey", "privateKey", ",", "String", "alias", ",", "String", "password", ")", "{", "KeyStore", ".", "PasswordProtection", "pass", "=", "new", "KeyStore", ".", "PasswordProtection", "(", "password", ".", "toCharArray", "(", ")", ")", ";", "Certificate", "[", "]", "certificateChain", "=", "{", "cert", "}", ";", "keyStore", ".", "setEntry", "(", "alias", ",", "new", "KeyStore", ".", "PrivateKeyEntry", "(", "privateKey", ",", "certificateChain", ")", ",", "pass", ")", ";", "}" ]
Based on a public certificate, private key, alias and password, this method will load the certificate and private key as an entry into the keystore, and it will set the provided alias and password to the keystore entry. @param keyStore @param cert @param privateKey @param alias @param password
[ "Based", "on", "a", "public", "certificate", "private", "key", "alias", "and", "password", "this", "method", "will", "load", "the", "certificate", "and", "private", "key", "as", "an", "entry", "into", "the", "keystore", "and", "it", "will", "set", "the", "provided", "alias", "and", "password", "to", "the", "keystore", "entry", "." ]
train
https://github.com/ulisesbocchio/spring-boot-security-saml/blob/63596fe9b4b5504053392b9ee9a925b9a77644d4/spring-boot-security-saml/src/main/java/com/github/ulisesbocchio/spring/boot/security/saml/resource/KeystoreFactory.java#L65-L70
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/XMLGregorianCalendar.java
XMLGregorianCalendar.setTime
public void setTime(int hour, int minute, int second, int millisecond) { setHour(hour); setMinute(minute); setSecond(second); setMillisecond(millisecond); }
java
public void setTime(int hour, int minute, int second, int millisecond) { setHour(hour); setMinute(minute); setSecond(second); setMillisecond(millisecond); }
[ "public", "void", "setTime", "(", "int", "hour", ",", "int", "minute", ",", "int", "second", ",", "int", "millisecond", ")", "{", "setHour", "(", "hour", ")", ";", "setMinute", "(", "minute", ")", ";", "setSecond", "(", "second", ")", ";", "setMillisecond", "(", "millisecond", ")", ";", "}" ]
<p>Set time as one unit, including optional milliseconds.</p> @param hour value constraints are summarized in <a href="#datetimefield-hour">hour field of date/time field mapping table</a>. @param minute value constraints are summarized in <a href="#datetimefield-minute">minute field of date/time field mapping table</a>. @param second value constraints are summarized in <a href="#datetimefield-second">second field of date/time field mapping table</a>. @param millisecond value of {@link DatatypeConstants#FIELD_UNDEFINED} indicates this optional field is not set. @throws IllegalArgumentException if any parameter is outside value constraints for the field as specified in <a href="#datetimefieldmapping">date/time field mapping table</a>.
[ "<p", ">", "Set", "time", "as", "one", "unit", "including", "optional", "milliseconds", ".", "<", "/", "p", ">" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/XMLGregorianCalendar.java#L444-L450
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/FileUtils.java
FileUtils.toFile
public static File toFile(final URL aURL) throws MalformedURLException { if (aURL.getProtocol().equals(FILE_TYPE)) { return new File(aURL.toString().replace("file:", "")); } throw new MalformedURLException(LOGGER.getI18n(MessageCodes.UTIL_036, aURL)); }
java
public static File toFile(final URL aURL) throws MalformedURLException { if (aURL.getProtocol().equals(FILE_TYPE)) { return new File(aURL.toString().replace("file:", "")); } throw new MalformedURLException(LOGGER.getI18n(MessageCodes.UTIL_036, aURL)); }
[ "public", "static", "File", "toFile", "(", "final", "URL", "aURL", ")", "throws", "MalformedURLException", "{", "if", "(", "aURL", ".", "getProtocol", "(", ")", ".", "equals", "(", "FILE_TYPE", ")", ")", "{", "return", "new", "File", "(", "aURL", ".", "toString", "(", ")", ".", "replace", "(", "\"file:\"", ",", "\"\"", ")", ")", ";", "}", "throw", "new", "MalformedURLException", "(", "LOGGER", ".", "getI18n", "(", "MessageCodes", ".", "UTIL_036", ",", "aURL", ")", ")", ";", "}" ]
Returns a Java <code>File</code> for the supplied file-based URL. @param aURL A URL that has a file protocol @return A Java <code>File</code> for the supplied URL @throws MalformedURLException If the supplied URL doesn't have a file protocol
[ "Returns", "a", "Java", "<code", ">", "File<", "/", "code", ">", "for", "the", "supplied", "file", "-", "based", "URL", "." ]
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L326-L332
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java
AbstractParser.attributeAsInt
protected Integer attributeAsInt(XMLStreamReader reader, String attributeName, Map<String, String> expressions) throws XMLStreamException { String attributeString = rawAttributeText(reader, attributeName); if (attributeName != null && expressions != null && attributeString != null && attributeString.indexOf("${") != -1) expressions.put(attributeName, attributeString); return attributeString != null ? Integer.valueOf(getSubstitutionValue(attributeString)) : null; }
java
protected Integer attributeAsInt(XMLStreamReader reader, String attributeName, Map<String, String> expressions) throws XMLStreamException { String attributeString = rawAttributeText(reader, attributeName); if (attributeName != null && expressions != null && attributeString != null && attributeString.indexOf("${") != -1) expressions.put(attributeName, attributeString); return attributeString != null ? Integer.valueOf(getSubstitutionValue(attributeString)) : null; }
[ "protected", "Integer", "attributeAsInt", "(", "XMLStreamReader", "reader", ",", "String", "attributeName", ",", "Map", "<", "String", ",", "String", ">", "expressions", ")", "throws", "XMLStreamException", "{", "String", "attributeString", "=", "rawAttributeText", "(", "reader", ",", "attributeName", ")", ";", "if", "(", "attributeName", "!=", "null", "&&", "expressions", "!=", "null", "&&", "attributeString", "!=", "null", "&&", "attributeString", ".", "indexOf", "(", "\"${\"", ")", "!=", "-", "1", ")", "expressions", ".", "put", "(", "attributeName", ",", "attributeString", ")", ";", "return", "attributeString", "!=", "null", "?", "Integer", ".", "valueOf", "(", "getSubstitutionValue", "(", "attributeString", ")", ")", ":", "null", ";", "}" ]
convert an xml element in String value @param reader the StAX reader @param attributeName the name of the attribute @param expressions The expressions @return the string representing element @throws XMLStreamException StAX exception
[ "convert", "an", "xml", "element", "in", "String", "value" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java#L217-L227
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/IdentityHashMap.java
IdentityHashMap.put
public V put(K key, V value) { final Object k = maskNull(key); retryAfterResize: for (;;) { final Object[] tab = table; final int len = tab.length; int i = hash(k, len); for (Object item; (item = tab[i]) != null; i = nextKeyIndex(i, len)) { if (item == k) { @SuppressWarnings("unchecked") V oldValue = (V) tab[i + 1]; tab[i + 1] = value; return oldValue; } } final int s = size + 1; // Use optimized form of 3 * s. // Next capacity is len, 2 * current capacity. if (s + (s << 1) > len && resize(len)) continue retryAfterResize; modCount++; tab[i] = k; tab[i + 1] = value; size = s; return null; } }
java
public V put(K key, V value) { final Object k = maskNull(key); retryAfterResize: for (;;) { final Object[] tab = table; final int len = tab.length; int i = hash(k, len); for (Object item; (item = tab[i]) != null; i = nextKeyIndex(i, len)) { if (item == k) { @SuppressWarnings("unchecked") V oldValue = (V) tab[i + 1]; tab[i + 1] = value; return oldValue; } } final int s = size + 1; // Use optimized form of 3 * s. // Next capacity is len, 2 * current capacity. if (s + (s << 1) > len && resize(len)) continue retryAfterResize; modCount++; tab[i] = k; tab[i + 1] = value; size = s; return null; } }
[ "public", "V", "put", "(", "K", "key", ",", "V", "value", ")", "{", "final", "Object", "k", "=", "maskNull", "(", "key", ")", ";", "retryAfterResize", ":", "for", "(", ";", ";", ")", "{", "final", "Object", "[", "]", "tab", "=", "table", ";", "final", "int", "len", "=", "tab", ".", "length", ";", "int", "i", "=", "hash", "(", "k", ",", "len", ")", ";", "for", "(", "Object", "item", ";", "(", "item", "=", "tab", "[", "i", "]", ")", "!=", "null", ";", "i", "=", "nextKeyIndex", "(", "i", ",", "len", ")", ")", "{", "if", "(", "item", "==", "k", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "V", "oldValue", "=", "(", "V", ")", "tab", "[", "i", "+", "1", "]", ";", "tab", "[", "i", "+", "1", "]", "=", "value", ";", "return", "oldValue", ";", "}", "}", "final", "int", "s", "=", "size", "+", "1", ";", "// Use optimized form of 3 * s.", "// Next capacity is len, 2 * current capacity.", "if", "(", "s", "+", "(", "s", "<<", "1", ")", ">", "len", "&&", "resize", "(", "len", ")", ")", "continue", "retryAfterResize", ";", "modCount", "++", ";", "tab", "[", "i", "]", "=", "k", ";", "tab", "[", "i", "+", "1", "]", "=", "value", ";", "size", "=", "s", ";", "return", "null", ";", "}", "}" ]
Associates the specified value with the specified key in this identity hash map. If the map previously contained a mapping for the key, the old value is replaced. @param key the key with which the specified value is to be associated @param value the value to be associated with the specified key @return the previous value associated with <tt>key</tt>, or <tt>null</tt> if there was no mapping for <tt>key</tt>. (A <tt>null</tt> return can also indicate that the map previously associated <tt>null</tt> with <tt>key</tt>.) @see Object#equals(Object) @see #get(Object) @see #containsKey(Object)
[ "Associates", "the", "specified", "value", "with", "the", "specified", "key", "in", "this", "identity", "hash", "map", ".", "If", "the", "map", "previously", "contained", "a", "mapping", "for", "the", "key", "the", "old", "value", "is", "replaced", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/IdentityHashMap.java#L425-L455
js-lib-com/commons
src/main/java/js/lang/Config.java
Config.getProperty
public <T> T getProperty(String name, Class<T> type) { return getProperty(name, type, null); }
java
public <T> T getProperty(String name, Class<T> type) { return getProperty(name, type, null); }
[ "public", "<", "T", ">", "T", "getProperty", "(", "String", "name", ",", "Class", "<", "T", ">", "type", ")", "{", "return", "getProperty", "(", "name", ",", "type", ",", "null", ")", ";", "}" ]
Get configuration object property converter to requested type or null if there is no property with given name. @param name property name. @param type type to convert property value to. @param <T> value type. @return newly created value object or null. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws IllegalArgumentException if <code>type</code> argument is null. @throws ConverterException if there is no converter registered for value type or value parse fails.
[ "Get", "configuration", "object", "property", "converter", "to", "requested", "type", "or", "null", "if", "there", "is", "no", "property", "with", "given", "name", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/Config.java#L409-L412
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/OrientedBox3d.java
OrientedBox3d.setFirstAxisProperties
public void setFirstAxisProperties(Vector3d vector, DoubleProperty extent, CoordinateSystem3D system) { this.axis1.setProperties(vector.xProperty,vector.yProperty,vector.zProperty); assert(this.axis1.isUnitVector()); if (system.isLeftHanded()) { this.axis3.set(this.axis1.crossLeftHand(this.axis2)); } else { this.axis3.set(this.axis3.crossRightHand(this.axis2)); } this.extent1Property = extent; }
java
public void setFirstAxisProperties(Vector3d vector, DoubleProperty extent, CoordinateSystem3D system) { this.axis1.setProperties(vector.xProperty,vector.yProperty,vector.zProperty); assert(this.axis1.isUnitVector()); if (system.isLeftHanded()) { this.axis3.set(this.axis1.crossLeftHand(this.axis2)); } else { this.axis3.set(this.axis3.crossRightHand(this.axis2)); } this.extent1Property = extent; }
[ "public", "void", "setFirstAxisProperties", "(", "Vector3d", "vector", ",", "DoubleProperty", "extent", ",", "CoordinateSystem3D", "system", ")", "{", "this", ".", "axis1", ".", "setProperties", "(", "vector", ".", "xProperty", ",", "vector", ".", "yProperty", ",", "vector", ".", "zProperty", ")", ";", "assert", "(", "this", ".", "axis1", ".", "isUnitVector", "(", ")", ")", ";", "if", "(", "system", ".", "isLeftHanded", "(", ")", ")", "{", "this", ".", "axis3", ".", "set", "(", "this", ".", "axis1", ".", "crossLeftHand", "(", "this", ".", "axis2", ")", ")", ";", "}", "else", "{", "this", ".", "axis3", ".", "set", "(", "this", ".", "axis3", ".", "crossRightHand", "(", "this", ".", "axis2", ")", ")", ";", "}", "this", ".", "extent1Property", "=", "extent", ";", "}" ]
Set the second axis of the box. The third axis is updated to be perpendicular to the two other axis. @param vector @param extent @param system
[ "Set", "the", "second", "axis", "of", "the", "box", ".", "The", "third", "axis", "is", "updated", "to", "be", "perpendicular", "to", "the", "two", "other", "axis", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/OrientedBox3d.java#L537-L546
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java
ImageLoader.displayImage
public void displayImage(String uri, ImageView imageView, ImageLoadingListener listener) { displayImage(uri, new ImageViewAware(imageView), null, listener, null); }
java
public void displayImage(String uri, ImageView imageView, ImageLoadingListener listener) { displayImage(uri, new ImageViewAware(imageView), null, listener, null); }
[ "public", "void", "displayImage", "(", "String", "uri", ",", "ImageView", "imageView", ",", "ImageLoadingListener", "listener", ")", "{", "displayImage", "(", "uri", ",", "new", "ImageViewAware", "(", "imageView", ")", ",", "null", ",", "listener", ",", "null", ")", ";", "}" ]
Adds display image task to execution pool. Image will be set to ImageView when it's turn.<br /> Default {@linkplain DisplayImageOptions display image options} from {@linkplain ImageLoaderConfiguration configuration} will be used.<br /> <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") @param imageView {@link ImageView} which should display image @param listener {@linkplain ImageLoadingListener Listener} for image loading process. Listener fires events on UI thread if this method is called on UI thread. @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before @throws IllegalArgumentException if passed <b>imageView</b> is null
[ "Adds", "display", "image", "task", "to", "execution", "pool", ".", "Image", "will", "be", "set", "to", "ImageView", "when", "it", "s", "turn", ".", "<br", "/", ">", "Default", "{", "@linkplain", "DisplayImageOptions", "display", "image", "options", "}", "from", "{", "@linkplain", "ImageLoaderConfiguration", "configuration", "}", "will", "be", "used", ".", "<br", "/", ">", "<b", ">", "NOTE", ":", "<", "/", "b", ">", "{", "@link", "#init", "(", "ImageLoaderConfiguration", ")", "}", "method", "must", "be", "called", "before", "this", "method", "call" ]
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java#L364-L366
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/Collectors.java
Collectors.toCollection
@NotNull public static <T, R extends Collection<T>> Collector<T, ?, R> toCollection( @NotNull Supplier<R> collectionSupplier) { return new CollectorsImpl<T, R, R>( collectionSupplier, new BiConsumer<R, T>() { @Override public void accept(@NotNull R t, T u) { t.add(u); } } ); }
java
@NotNull public static <T, R extends Collection<T>> Collector<T, ?, R> toCollection( @NotNull Supplier<R> collectionSupplier) { return new CollectorsImpl<T, R, R>( collectionSupplier, new BiConsumer<R, T>() { @Override public void accept(@NotNull R t, T u) { t.add(u); } } ); }
[ "@", "NotNull", "public", "static", "<", "T", ",", "R", "extends", "Collection", "<", "T", ">", ">", "Collector", "<", "T", ",", "?", ",", "R", ">", "toCollection", "(", "@", "NotNull", "Supplier", "<", "R", ">", "collectionSupplier", ")", "{", "return", "new", "CollectorsImpl", "<", "T", ",", "R", ",", "R", ">", "(", "collectionSupplier", ",", "new", "BiConsumer", "<", "R", ",", "T", ">", "(", ")", "{", "@", "Override", "public", "void", "accept", "(", "@", "NotNull", "R", "t", ",", "T", "u", ")", "{", "t", ".", "add", "(", "u", ")", ";", "}", "}", ")", ";", "}" ]
Returns a {@code Collector} that fills new {@code Collection}, provided by {@code collectionSupplier}, with input elements. @param <T> the type of the input elements @param <R> the type of the resulting collection @param collectionSupplier a supplier function that provides new collection @return a {@code Collector}
[ "Returns", "a", "{", "@code", "Collector", "}", "that", "fills", "new", "{", "@code", "Collection", "}", "provided", "by", "{", "@code", "collectionSupplier", "}", "with", "input", "elements", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L50-L64
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/Controller.java
Controller.mapOut
void mapOut(String out, Object comp, String comp_out) { if (comp == ca.getComponent()) { throw new ComponentException("cannot connect 'Out' with itself for " + out); } ComponentAccess ac_dest = lookup(comp); FieldAccess destAccess = (FieldAccess) ac_dest.output(comp_out); FieldAccess srcAccess = (FieldAccess) ca.output(out); checkFA(destAccess, comp, comp_out); checkFA(srcAccess, ca.getComponent(), out); FieldContent data = srcAccess.getData(); data.tagLeaf(); data.tagOut(); destAccess.setData(data); dataSet.add(data); if (log.isLoggable(Level.CONFIG)) { log.log(Level.CONFIG, String.format("@Out(%s) -> @Out(%s)", srcAccess, destAccess)); } // ens.fireMapOut(srcAccess, destAccess); }
java
void mapOut(String out, Object comp, String comp_out) { if (comp == ca.getComponent()) { throw new ComponentException("cannot connect 'Out' with itself for " + out); } ComponentAccess ac_dest = lookup(comp); FieldAccess destAccess = (FieldAccess) ac_dest.output(comp_out); FieldAccess srcAccess = (FieldAccess) ca.output(out); checkFA(destAccess, comp, comp_out); checkFA(srcAccess, ca.getComponent(), out); FieldContent data = srcAccess.getData(); data.tagLeaf(); data.tagOut(); destAccess.setData(data); dataSet.add(data); if (log.isLoggable(Level.CONFIG)) { log.log(Level.CONFIG, String.format("@Out(%s) -> @Out(%s)", srcAccess, destAccess)); } // ens.fireMapOut(srcAccess, destAccess); }
[ "void", "mapOut", "(", "String", "out", ",", "Object", "comp", ",", "String", "comp_out", ")", "{", "if", "(", "comp", "==", "ca", ".", "getComponent", "(", ")", ")", "{", "throw", "new", "ComponentException", "(", "\"cannot connect 'Out' with itself for \"", "+", "out", ")", ";", "}", "ComponentAccess", "ac_dest", "=", "lookup", "(", "comp", ")", ";", "FieldAccess", "destAccess", "=", "(", "FieldAccess", ")", "ac_dest", ".", "output", "(", "comp_out", ")", ";", "FieldAccess", "srcAccess", "=", "(", "FieldAccess", ")", "ca", ".", "output", "(", "out", ")", ";", "checkFA", "(", "destAccess", ",", "comp", ",", "comp_out", ")", ";", "checkFA", "(", "srcAccess", ",", "ca", ".", "getComponent", "(", ")", ",", "out", ")", ";", "FieldContent", "data", "=", "srcAccess", ".", "getData", "(", ")", ";", "data", ".", "tagLeaf", "(", ")", ";", "data", ".", "tagOut", "(", ")", ";", "destAccess", ".", "setData", "(", "data", ")", ";", "dataSet", ".", "add", "(", "data", ")", ";", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "CONFIG", ")", ")", "{", "log", ".", "log", "(", "Level", ".", "CONFIG", ",", "String", ".", "format", "(", "\"@Out(%s) -> @Out(%s)\"", ",", "srcAccess", ",", "destAccess", ")", ")", ";", "}", "// ens.fireMapOut(srcAccess, destAccess);", "}" ]
Map two output fields. @param out the output field name of this component @param comp the component @param comp_out the component output name;
[ "Map", "two", "output", "fields", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Controller.java#L85-L106
StanKocken/EfficientAdapter
efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java
ViewHelper.setImageUri
public static void setImageUri(EfficientCacheView cacheView, int viewId, @Nullable Uri uri) { View view = cacheView.findViewByIdEfficient(viewId); if (view instanceof ImageView) { ((ImageView) view).setImageURI(uri); } }
java
public static void setImageUri(EfficientCacheView cacheView, int viewId, @Nullable Uri uri) { View view = cacheView.findViewByIdEfficient(viewId); if (view instanceof ImageView) { ((ImageView) view).setImageURI(uri); } }
[ "public", "static", "void", "setImageUri", "(", "EfficientCacheView", "cacheView", ",", "int", "viewId", ",", "@", "Nullable", "Uri", "uri", ")", "{", "View", "view", "=", "cacheView", ".", "findViewByIdEfficient", "(", "viewId", ")", ";", "if", "(", "view", "instanceof", "ImageView", ")", "{", "(", "(", "ImageView", ")", "view", ")", ".", "setImageURI", "(", "uri", ")", ";", "}", "}" ]
Equivalent to calling ImageView.setImageUri @param cacheView The cache of views to get the view from @param viewId The id of the view whose image should change @param uri the Uri of an image, or {@code null} to clear the content
[ "Equivalent", "to", "calling", "ImageView", ".", "setImageUri" ]
train
https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java#L217-L222
Cornutum/tcases
tcases-openapi/src/main/java/org/cornutum/tcases/openapi/io/TcasesOpenApiIO.java
TcasesOpenApiIO.getRequestInputModel
public static SystemInputDef getRequestInputModel( InputStream api, ModelOptions options) { try( OpenApiReader reader = new OpenApiReader( api)) { return TcasesOpenApi.getRequestInputModel( reader.read(), options); } }
java
public static SystemInputDef getRequestInputModel( InputStream api, ModelOptions options) { try( OpenApiReader reader = new OpenApiReader( api)) { return TcasesOpenApi.getRequestInputModel( reader.read(), options); } }
[ "public", "static", "SystemInputDef", "getRequestInputModel", "(", "InputStream", "api", ",", "ModelOptions", "options", ")", "{", "try", "(", "OpenApiReader", "reader", "=", "new", "OpenApiReader", "(", "api", ")", ")", "{", "return", "TcasesOpenApi", ".", "getRequestInputModel", "(", "reader", ".", "read", "(", ")", ",", "options", ")", ";", "}", "}" ]
Returns a {@link SystemInputDef system input definition} for the API requests defined by the given OpenAPI specification. Returns null if the given spec defines no API requests to model.
[ "Returns", "a", "{" ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-openapi/src/main/java/org/cornutum/tcases/openapi/io/TcasesOpenApiIO.java#L49-L55
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java
AbstractService.updateProgress
public void updateProgress(final Wave wave, final double workDone, final double totalWork, final double progressIncrement) { if (wave.get(JRebirthWaves.SERVICE_TASK).checkProgressRatio(workDone, totalWork, progressIncrement)) { // Increase the task progression JRebirth.runIntoJAT("ServiceTask Workdone (dbl) " + workDone + RATIO_SEPARATOR + totalWork, () -> wave.get(JRebirthWaves.SERVICE_TASK).updateProgress(workDone, totalWork)); } }
java
public void updateProgress(final Wave wave, final double workDone, final double totalWork, final double progressIncrement) { if (wave.get(JRebirthWaves.SERVICE_TASK).checkProgressRatio(workDone, totalWork, progressIncrement)) { // Increase the task progression JRebirth.runIntoJAT("ServiceTask Workdone (dbl) " + workDone + RATIO_SEPARATOR + totalWork, () -> wave.get(JRebirthWaves.SERVICE_TASK).updateProgress(workDone, totalWork)); } }
[ "public", "void", "updateProgress", "(", "final", "Wave", "wave", ",", "final", "double", "workDone", ",", "final", "double", "totalWork", ",", "final", "double", "progressIncrement", ")", "{", "if", "(", "wave", ".", "get", "(", "JRebirthWaves", ".", "SERVICE_TASK", ")", ".", "checkProgressRatio", "(", "workDone", ",", "totalWork", ",", "progressIncrement", ")", ")", "{", "// Increase the task progression", "JRebirth", ".", "runIntoJAT", "(", "\"ServiceTask Workdone (dbl) \"", "+", "workDone", "+", "RATIO_SEPARATOR", "+", "totalWork", ",", "(", ")", "->", "wave", ".", "get", "(", "JRebirthWaves", ".", "SERVICE_TASK", ")", ".", "updateProgress", "(", "workDone", ",", "totalWork", ")", ")", ";", "}", "}" ]
Update the progress of the service task related to the given wave. @param wave the wave that trigger the service task call @param workDone the amount of overall work done @param totalWork the amount of total work to do @param progressIncrement the value increment used to filter useless progress event
[ "Update", "the", "progress", "of", "the", "service", "task", "related", "to", "the", "given", "wave", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L330-L338
haraldk/TwelveMonkeys
imageio/imageio-icns/src/main/java/com/twelvemonkeys/imageio/plugins/icns/ICNSUtil.java
ICNSUtil.decompress
static void decompress(final DataInputStream input, final byte[] result, int offset, int length) throws IOException { int resultPos = offset; int remaining = length; while (remaining > 0) { byte run = input.readByte(); int runLength; if ((run & 0x80) != 0) { // Compressed run runLength = run + 131; // PackBits: -run + 1 and run == 0x80 is no-op... This allows 1 byte longer runs... byte runData = input.readByte(); for (int i = 0; i < runLength; i++) { result[resultPos++] = runData; } } else { // Uncompressed run runLength = run + 1; input.readFully(result, resultPos, runLength); resultPos += runLength; } remaining -= runLength; } }
java
static void decompress(final DataInputStream input, final byte[] result, int offset, int length) throws IOException { int resultPos = offset; int remaining = length; while (remaining > 0) { byte run = input.readByte(); int runLength; if ((run & 0x80) != 0) { // Compressed run runLength = run + 131; // PackBits: -run + 1 and run == 0x80 is no-op... This allows 1 byte longer runs... byte runData = input.readByte(); for (int i = 0; i < runLength; i++) { result[resultPos++] = runData; } } else { // Uncompressed run runLength = run + 1; input.readFully(result, resultPos, runLength); resultPos += runLength; } remaining -= runLength; } }
[ "static", "void", "decompress", "(", "final", "DataInputStream", "input", ",", "final", "byte", "[", "]", "result", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "int", "resultPos", "=", "offset", ";", "int", "remaining", "=", "length", ";", "while", "(", "remaining", ">", "0", ")", "{", "byte", "run", "=", "input", ".", "readByte", "(", ")", ";", "int", "runLength", ";", "if", "(", "(", "run", "&", "0x80", ")", "!=", "0", ")", "{", "// Compressed run", "runLength", "=", "run", "+", "131", ";", "// PackBits: -run + 1 and run == 0x80 is no-op... This allows 1 byte longer runs...", "byte", "runData", "=", "input", ".", "readByte", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "runLength", ";", "i", "++", ")", "{", "result", "[", "resultPos", "++", "]", "=", "runData", ";", "}", "}", "else", "{", "// Uncompressed run", "runLength", "=", "run", "+", "1", ";", "input", ".", "readFully", "(", "result", ",", "resultPos", ",", "runLength", ")", ";", "resultPos", "+=", "runLength", ";", "}", "remaining", "-=", "runLength", ";", "}", "}" ]
NOTE: This is very close to PackBits (as described by the Wikipedia article), but it is not PackBits!
[ "NOTE", ":", "This", "is", "very", "close", "to", "PackBits", "(", "as", "described", "by", "the", "Wikipedia", "article", ")", "but", "it", "is", "not", "PackBits!" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-icns/src/main/java/com/twelvemonkeys/imageio/plugins/icns/ICNSUtil.java#L75-L103
juebanlin/util4j
util4j/src/main/java/net/jueb/util4j/bytesStream/bytes/HexUtil.java
HexUtil.SimplePrettyHexDump
public static String SimplePrettyHexDump(byte bytes[], int offset, int length) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(bos); int rows = length / 16;//打印的行数 int ac = length % 16;//剩余的字节数 for (int i = 0; i < rows; ++i) ps.printf("%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", // bytes[offset + (16 * i) + 0], // bytes[offset + (16 * i) + 1], // bytes[offset + (16 * i) + 2], // bytes[offset + (16 * i) + 3], // bytes[offset + (16 * i) + 4], // bytes[offset + (16 * i) + 5], // bytes[offset + (16 * i) + 6], // bytes[offset + (16 * i) + 7], // bytes[offset + (16 * i) + 8], // bytes[offset + (16 * i) + 9], // bytes[offset + (16 * i) + 10], // bytes[offset + (16 * i) + 11], // bytes[offset + (16 * i) + 12], // bytes[offset + (16 * i) + 13], // bytes[offset + (16 * i) + 14], // bytes[offset + (16 * i) + 15], // byteToChar(bytes[offset + (16 * i) + 0]), // byteToChar(bytes[offset + (16 * i) + 1]), // byteToChar(bytes[offset + (16 * i) + 2]), // byteToChar(bytes[offset + (16 * i) + 3]), // byteToChar(bytes[offset + (16 * i) + 4]), // byteToChar(bytes[offset + (16 * i) + 5]), // byteToChar(bytes[offset + (16 * i) + 6]), // byteToChar(bytes[offset + (16 * i) + 7]), // byteToChar(bytes[offset + (16 * i) + 8]), // byteToChar(bytes[offset + (16 * i) + 9]), // byteToChar(bytes[offset + (16 * i) + 10]), // byteToChar(bytes[offset + (16 * i) + 11]), // byteToChar(bytes[offset + (16 * i) + 12]), // byteToChar(bytes[offset + (16 * i) + 13]), // byteToChar(bytes[offset + (16 * i) + 14]), // byteToChar(bytes[offset + (16 * i) + 15])); for (int i = 0; i < ac; i++) ps.printf("%02X ", bytes[offset + rows * 16 + i]); for (int i = 0; ac > 0 && i < 16 - ac; i++) ps.printf("%s", " "); for (int i = 0; i < ac; i++) ps.printf("%c", byteToChar(bytes[offset + rows * 16 + i])); return bos.toString(); }
java
public static String SimplePrettyHexDump(byte bytes[], int offset, int length) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(bos); int rows = length / 16;//打印的行数 int ac = length % 16;//剩余的字节数 for (int i = 0; i < rows; ++i) ps.printf("%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", // bytes[offset + (16 * i) + 0], // bytes[offset + (16 * i) + 1], // bytes[offset + (16 * i) + 2], // bytes[offset + (16 * i) + 3], // bytes[offset + (16 * i) + 4], // bytes[offset + (16 * i) + 5], // bytes[offset + (16 * i) + 6], // bytes[offset + (16 * i) + 7], // bytes[offset + (16 * i) + 8], // bytes[offset + (16 * i) + 9], // bytes[offset + (16 * i) + 10], // bytes[offset + (16 * i) + 11], // bytes[offset + (16 * i) + 12], // bytes[offset + (16 * i) + 13], // bytes[offset + (16 * i) + 14], // bytes[offset + (16 * i) + 15], // byteToChar(bytes[offset + (16 * i) + 0]), // byteToChar(bytes[offset + (16 * i) + 1]), // byteToChar(bytes[offset + (16 * i) + 2]), // byteToChar(bytes[offset + (16 * i) + 3]), // byteToChar(bytes[offset + (16 * i) + 4]), // byteToChar(bytes[offset + (16 * i) + 5]), // byteToChar(bytes[offset + (16 * i) + 6]), // byteToChar(bytes[offset + (16 * i) + 7]), // byteToChar(bytes[offset + (16 * i) + 8]), // byteToChar(bytes[offset + (16 * i) + 9]), // byteToChar(bytes[offset + (16 * i) + 10]), // byteToChar(bytes[offset + (16 * i) + 11]), // byteToChar(bytes[offset + (16 * i) + 12]), // byteToChar(bytes[offset + (16 * i) + 13]), // byteToChar(bytes[offset + (16 * i) + 14]), // byteToChar(bytes[offset + (16 * i) + 15])); for (int i = 0; i < ac; i++) ps.printf("%02X ", bytes[offset + rows * 16 + i]); for (int i = 0; ac > 0 && i < 16 - ac; i++) ps.printf("%s", " "); for (int i = 0; i < ac; i++) ps.printf("%c", byteToChar(bytes[offset + rows * 16 + i])); return bos.toString(); }
[ "public", "static", "String", "SimplePrettyHexDump", "(", "byte", "bytes", "[", "]", ",", "int", "offset", ",", "int", "length", ")", "{", "ByteArrayOutputStream", "bos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "PrintStream", "ps", "=", "new", "PrintStream", "(", "bos", ")", ";", "int", "rows", "=", "length", "/", "16", ";", "//打印的行数", "int", "ac", "=", "length", "%", "16", ";", "//剩余的字节数", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rows", ";", "++", "i", ")", "ps", ".", "printf", "(", "\"%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\\n\"", "", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "0", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "1", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "2", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "3", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "4", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "5", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "6", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "7", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "8", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "9", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "10", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "11", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "12", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "13", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "14", "]", ",", "//", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "15", "]", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "0", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "1", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "2", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "3", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "4", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "5", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "6", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "7", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "8", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "9", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "10", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "11", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "12", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "13", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "14", "]", ")", ",", "//", "byteToChar", "(", "bytes", "[", "offset", "+", "(", "16", "*", "i", ")", "+", "15", "]", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ac", ";", "i", "++", ")", "ps", ".", "printf", "(", "\"%02X \"", "", ",", "bytes", "[", "offset", "+", "rows", "*", "16", "+", "i", "]", ")", ";", "for", "(", "int", "i", "=", "0", ";", "ac", ">", "0", "&&", "i", "<", "16", "-", "ac", ";", "i", "++", ")", "ps", ".", "printf", "(", "\"%s\"", "", ",", "\" \"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ac", ";", "i", "++", ")", "ps", ".", "printf", "(", "\"%c\"", "", ",", "byteToChar", "(", "bytes", "[", "offset", "+", "rows", "*", "16", "+", "i", "]", ")", ")", ";", "return", "bos", ".", "toString", "(", ")", ";", "}" ]
将字节转换成十六进制字符串 @param bytes 数据 @param offset 起始位置 @param length 从起始位置开始的长度 @return
[ "将字节转换成十六进制字符串" ]
train
https://github.com/juebanlin/util4j/blob/c404b2dbdedf7a8890533b351257fa8af4f1439f/util4j/src/main/java/net/jueb/util4j/bytesStream/bytes/HexUtil.java#L291-L338
sculptor/sculptor
sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/HelperBase.java
HelperBase.getGetAccessor
public String getGetAccessor(TypedElement e, String prefix) { String capName = toFirstUpper(e.getName()); if (prefix != null) { capName = toFirstUpper(prefix) + capName; } // Note that Boolean object type is not named with is prefix (according // to java beans spec) String result = isBooleanPrimitiveType(e) ? "is" + capName : "get" + ("Class".equals(capName) ? "Class_" : capName); return result; }
java
public String getGetAccessor(TypedElement e, String prefix) { String capName = toFirstUpper(e.getName()); if (prefix != null) { capName = toFirstUpper(prefix) + capName; } // Note that Boolean object type is not named with is prefix (according // to java beans spec) String result = isBooleanPrimitiveType(e) ? "is" + capName : "get" + ("Class".equals(capName) ? "Class_" : capName); return result; }
[ "public", "String", "getGetAccessor", "(", "TypedElement", "e", ",", "String", "prefix", ")", "{", "String", "capName", "=", "toFirstUpper", "(", "e", ".", "getName", "(", ")", ")", ";", "if", "(", "prefix", "!=", "null", ")", "{", "capName", "=", "toFirstUpper", "(", "prefix", ")", "+", "capName", ";", "}", "// Note that Boolean object type is not named with is prefix (according", "// to java beans spec)", "String", "result", "=", "isBooleanPrimitiveType", "(", "e", ")", "?", "\"is\"", "+", "capName", ":", "\"get\"", "+", "(", "\"Class\"", ".", "equals", "(", "capName", ")", "?", "\"Class_\"", ":", "capName", ")", ";", "return", "result", ";", "}" ]
Get-accessor method name of a property, according to JavaBeans naming conventions.
[ "Get", "-", "accessor", "method", "name", "of", "a", "property", "according", "to", "JavaBeans", "naming", "conventions", "." ]
train
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/HelperBase.java#L479-L488
drinkjava2/jDialects
core/src/main/java/com/github/drinkjava2/jdialects/StrUtils.java
StrUtils.countMatches
public static int countMatches(final CharSequence str, final char ch) { if (isEmpty(str)) { return 0; } int count = 0; // We could also call str.toCharArray() for faster look ups but that // would generate more garbage. for (int i = 0; i < str.length(); i++) { if (ch == str.charAt(i)) { count++; } } return count; }
java
public static int countMatches(final CharSequence str, final char ch) { if (isEmpty(str)) { return 0; } int count = 0; // We could also call str.toCharArray() for faster look ups but that // would generate more garbage. for (int i = 0; i < str.length(); i++) { if (ch == str.charAt(i)) { count++; } } return count; }
[ "public", "static", "int", "countMatches", "(", "final", "CharSequence", "str", ",", "final", "char", "ch", ")", "{", "if", "(", "isEmpty", "(", "str", ")", ")", "{", "return", "0", ";", "}", "int", "count", "=", "0", ";", "// We could also call str.toCharArray() for faster look ups but that", "// would generate more garbage.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "str", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "ch", "==", "str", ".", "charAt", "(", "i", ")", ")", "{", "count", "++", ";", "}", "}", "return", "count", ";", "}" ]
<p> Counts how many times the char appears in the given string. </p> <p> A {@code null} or empty ("") String input returns {@code 0}. </p> <pre> StringUtils.countMatches(null, *) = 0 StringUtils.countMatches("", *) = 0 StringUtils.countMatches("abba", 0) = 0 StringUtils.countMatches("abba", 'a') = 2 StringUtils.countMatches("abba", 'b') = 2 StringUtils.countMatches("abba", 'x') = 0 </pre> @param str the CharSequence to check, may be null @param ch the char to count @return the number of occurrences, 0 if the CharSequence is {@code null} @since 3.4
[ "<p", ">", "Counts", "how", "many", "times", "the", "char", "appears", "in", "the", "given", "string", ".", "<", "/", "p", ">" ]
train
https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/StrUtils.java#L821-L834
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java
StoredPaymentChannelClientStates.getAnnouncePeerGroup
private TransactionBroadcaster getAnnouncePeerGroup() { try { return announcePeerGroupFuture.get(MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } catch (TimeoutException e) { String err = "Transaction broadcaster not set"; log.error(err); throw new RuntimeException(err, e); } }
java
private TransactionBroadcaster getAnnouncePeerGroup() { try { return announcePeerGroupFuture.get(MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } catch (TimeoutException e) { String err = "Transaction broadcaster not set"; log.error(err); throw new RuntimeException(err, e); } }
[ "private", "TransactionBroadcaster", "getAnnouncePeerGroup", "(", ")", "{", "try", "{", "return", "announcePeerGroupFuture", ".", "get", "(", "MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET", ",", "TimeUnit", ".", "SECONDS", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "catch", "(", "ExecutionException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "catch", "(", "TimeoutException", "e", ")", "{", "String", "err", "=", "\"Transaction broadcaster not set\"", ";", "log", ".", "error", "(", "err", ")", ";", "throw", "new", "RuntimeException", "(", "err", ",", "e", ")", ";", "}", "}" ]
If the peer group has not been set for MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET seconds, then the programmer probably forgot to set it and we should throw exception.
[ "If", "the", "peer", "group", "has", "not", "been", "set", "for", "MAX_SECONDS_TO_WAIT_FOR_BROADCASTER_TO_BE_SET", "seconds", "then", "the", "programmer", "probably", "forgot", "to", "set", "it", "and", "we", "should", "throw", "exception", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredPaymentChannelClientStates.java#L245-L257
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/ResourceCache.java
ResourceCache.wrapCallback
public static CompressedTextureCallback wrapCallback( ResourceCache<GVRImage> cache, CompressedTextureCallback callback) { return new CompressedTextureCallbackWrapper(cache, callback); }
java
public static CompressedTextureCallback wrapCallback( ResourceCache<GVRImage> cache, CompressedTextureCallback callback) { return new CompressedTextureCallbackWrapper(cache, callback); }
[ "public", "static", "CompressedTextureCallback", "wrapCallback", "(", "ResourceCache", "<", "GVRImage", ">", "cache", ",", "CompressedTextureCallback", "callback", ")", "{", "return", "new", "CompressedTextureCallbackWrapper", "(", "cache", ",", "callback", ")", ";", "}" ]
Wrap the callback, to cache the {@link CompressedTextureCallback#loaded(GVRHybridObject, GVRAndroidResource) loaded()} resource
[ "Wrap", "the", "callback", "to", "cache", "the", "{" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/ResourceCache.java#L77-L80
liferay/com-liferay-commerce
commerce-tax-service/src/main/java/com/liferay/commerce/tax/service/persistence/impl/CommerceTaxMethodPersistenceImpl.java
CommerceTaxMethodPersistenceImpl.findAll
@Override public List<CommerceTaxMethod> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CommerceTaxMethod> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceTaxMethod", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce tax methods. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceTaxMethodModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce tax methods @param end the upper bound of the range of commerce tax methods (not inclusive) @return the range of commerce tax methods
[ "Returns", "a", "range", "of", "all", "the", "commerce", "tax", "methods", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-service/src/main/java/com/liferay/commerce/tax/service/persistence/impl/CommerceTaxMethodPersistenceImpl.java#L2005-L2008
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaapreauthenticationpolicy_binding.java
aaapreauthenticationpolicy_binding.get
public static aaapreauthenticationpolicy_binding get(nitro_service service, String name) throws Exception{ aaapreauthenticationpolicy_binding obj = new aaapreauthenticationpolicy_binding(); obj.set_name(name); aaapreauthenticationpolicy_binding response = (aaapreauthenticationpolicy_binding) obj.get_resource(service); return response; }
java
public static aaapreauthenticationpolicy_binding get(nitro_service service, String name) throws Exception{ aaapreauthenticationpolicy_binding obj = new aaapreauthenticationpolicy_binding(); obj.set_name(name); aaapreauthenticationpolicy_binding response = (aaapreauthenticationpolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "aaapreauthenticationpolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "aaapreauthenticationpolicy_binding", "obj", "=", "new", "aaapreauthenticationpolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "aaapreauthenticationpolicy_binding", "response", "=", "(", "aaapreauthenticationpolicy_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch aaapreauthenticationpolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "aaapreauthenticationpolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaapreauthenticationpolicy_binding.java#L114-L119
liyiorg/weixin-popular
src/main/java/weixin/popular/api/CustomserviceAPI.java
CustomserviceAPI.kfsessionClose
public static BaseResult kfsessionClose(String access_token, String kf_account, String openid, String text) { String postJsonData = String.format("{\"kf_account\":\"%1s\",\"openid\":\"%2s\",\"text\":\"%3s\"}", kf_account, openid, text); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/customservice/kfsession/close") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(postJsonData, Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest, BaseResult.class); }
java
public static BaseResult kfsessionClose(String access_token, String kf_account, String openid, String text) { String postJsonData = String.format("{\"kf_account\":\"%1s\",\"openid\":\"%2s\",\"text\":\"%3s\"}", kf_account, openid, text); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/customservice/kfsession/close") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(postJsonData, Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest, BaseResult.class); }
[ "public", "static", "BaseResult", "kfsessionClose", "(", "String", "access_token", ",", "String", "kf_account", ",", "String", "openid", ",", "String", "text", ")", "{", "String", "postJsonData", "=", "String", ".", "format", "(", "\"{\\\"kf_account\\\":\\\"%1s\\\",\\\"openid\\\":\\\"%2s\\\",\\\"text\\\":\\\"%3s\\\"}\"", ",", "kf_account", ",", "openid", ",", "text", ")", ";", "HttpUriRequest", "httpUriRequest", "=", "RequestBuilder", ".", "post", "(", ")", ".", "setHeader", "(", "jsonHeader", ")", ".", "setUri", "(", "BASE_URI", "+", "\"/customservice/kfsession/close\"", ")", ".", "addParameter", "(", "PARAM_ACCESS_TOKEN", ",", "API", ".", "accessToken", "(", "access_token", ")", ")", ".", "setEntity", "(", "new", "StringEntity", "(", "postJsonData", ",", "Charset", ".", "forName", "(", "\"utf-8\"", ")", ")", ")", ".", "build", "(", ")", ";", "return", "LocalHttpClient", ".", "executeJsonResult", "(", "httpUriRequest", ",", "BaseResult", ".", "class", ")", ";", "}" ]
关闭会话 @param access_token access_token @param kf_account 完整客服账号 @param openid 客户openid @param text 附加信息,非必须 @return BaseResult
[ "关闭会话" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/CustomserviceAPI.java#L166-L178
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.toAsync
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9> Func9<T1, T2, T3, T4, T5, T6, T7, T8, T9, Observable<Void>> toAsync(Action9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9> action) { return toAsync(action, Schedulers.computation()); }
java
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9> Func9<T1, T2, T3, T4, T5, T6, T7, T8, T9, Observable<Void>> toAsync(Action9<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? super T9> action) { return toAsync(action, Schedulers.computation()); }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "T8", ",", "T9", ">", "Func9", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "T8", ",", "T9", ",", "Observable", "<", "Void", ">", ">", "toAsync", "(", "Action9", "<", "?", "super", "T1", ",", "?", "super", "T2", ",", "?", "super", "T3", ",", "?", "super", "T4", ",", "?", "super", "T5", ",", "?", "super", "T6", ",", "?", "super", "T7", ",", "?", "super", "T8", ",", "?", "super", "T9", ">", "action", ")", "{", "return", "toAsync", "(", "action", ",", "Schedulers", ".", "computation", "(", ")", ")", ";", "}" ]
Convert a synchronous action call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.an.png" alt=""> @param <T1> the first parameter type @param <T2> the second parameter type @param <T3> the third parameter type @param <T4> the fourth parameter type @param <T5> the fifth parameter type @param <T6> the sixth parameter type @param <T7> the seventh parameter type @param <T8> the eighth parameter type @param <T9> the ninth parameter type @param action the action to convert @return a function that returns an Observable that executes the {@code action} and emits {@code null} @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a> @see <a href="http://msdn.microsoft.com/en-us/library/hh211702.aspx">MSDN: Observable.ToAsync</a>
[ "Convert", "a", "synchronous", "action", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", "/", "ReactiveX", "/", "RxJava", "/", "images", "/", "rx", "-", "operators", "/", "toAsync", ".", "an", ".", "png", "alt", "=", ">" ]
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L659-L661
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policystringmap.java
policystringmap.get
public static policystringmap get(nitro_service service, String name) throws Exception{ policystringmap obj = new policystringmap(); obj.set_name(name); policystringmap response = (policystringmap) obj.get_resource(service); return response; }
java
public static policystringmap get(nitro_service service, String name) throws Exception{ policystringmap obj = new policystringmap(); obj.set_name(name); policystringmap response = (policystringmap) obj.get_resource(service); return response; }
[ "public", "static", "policystringmap", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "policystringmap", "obj", "=", "new", "policystringmap", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "policystringmap", "response", "=", "(", "policystringmap", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch policystringmap resource of given name .
[ "Use", "this", "API", "to", "fetch", "policystringmap", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policystringmap.java#L276-L281
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AoInterfaceCodeGen.java
AoInterfaceCodeGen.writeClassBody
@Override public void writeClassBody(Definition def, Writer out) throws IOException { out.write("public interface " + getClassName(def)); if (def.isAdminObjectImplRaAssociation()) { out.write(" extends Referenceable, Serializable"); } writeLeftCurlyBracket(out, 0); writeEol(out); int indent = 1; writeConfigProps(def, out, indent); writeRightCurlyBracket(out, 0); }
java
@Override public void writeClassBody(Definition def, Writer out) throws IOException { out.write("public interface " + getClassName(def)); if (def.isAdminObjectImplRaAssociation()) { out.write(" extends Referenceable, Serializable"); } writeLeftCurlyBracket(out, 0); writeEol(out); int indent = 1; writeConfigProps(def, out, indent); writeRightCurlyBracket(out, 0); }
[ "@", "Override", "public", "void", "writeClassBody", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "out", ".", "write", "(", "\"public interface \"", "+", "getClassName", "(", "def", ")", ")", ";", "if", "(", "def", ".", "isAdminObjectImplRaAssociation", "(", ")", ")", "{", "out", ".", "write", "(", "\" extends Referenceable, Serializable\"", ")", ";", "}", "writeLeftCurlyBracket", "(", "out", ",", "0", ")", ";", "writeEol", "(", "out", ")", ";", "int", "indent", "=", "1", ";", "writeConfigProps", "(", "def", ",", "out", ",", "indent", ")", ";", "writeRightCurlyBracket", "(", "out", ",", "0", ")", ";", "}" ]
Output class @param def definition @param out Writer @throws IOException ioException
[ "Output", "class" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AoInterfaceCodeGen.java#L87-L101
hdbeukel/james-core
src/main/java/org/jamesframework/core/subset/neigh/adv/MultiSwapNeighbourhood.java
MultiSwapNeighbourhood.maxSwaps
private int maxSwaps(Set<Integer> addCandidates, Set<Integer> deleteCandidates){ return Math.min(maxSwaps, Math.min(addCandidates.size(), deleteCandidates.size())); }
java
private int maxSwaps(Set<Integer> addCandidates, Set<Integer> deleteCandidates){ return Math.min(maxSwaps, Math.min(addCandidates.size(), deleteCandidates.size())); }
[ "private", "int", "maxSwaps", "(", "Set", "<", "Integer", ">", "addCandidates", ",", "Set", "<", "Integer", ">", "deleteCandidates", ")", "{", "return", "Math", ".", "min", "(", "maxSwaps", ",", "Math", ".", "min", "(", "addCandidates", ".", "size", "(", ")", ",", "deleteCandidates", ".", "size", "(", ")", ")", ")", ";", "}" ]
Computes the maximum number of swaps that can be performed, given the set of candidate IDs for addition and deletion. Takes into account the desired maximum number of swaps \(k\) specified at construction (if set). The maximum number of swaps is equal to the minimum of \(k\) and the size of both candidate sets. Thus, if any of the given candidate sets is empty, zero is returned. @param addCandidates candidate IDs to be added to the selection @param deleteCandidates candidate IDs to be removed from the selection @return maximum number of swaps to be performed
[ "Computes", "the", "maximum", "number", "of", "swaps", "that", "can", "be", "performed", "given", "the", "set", "of", "candidate", "IDs", "for", "addition", "and", "deletion", ".", "Takes", "into", "account", "the", "desired", "maximum", "number", "of", "swaps", "\\", "(", "k", "\\", ")", "specified", "at", "construction", "(", "if", "set", ")", ".", "The", "maximum", "number", "of", "swaps", "is", "equal", "to", "the", "minimum", "of", "\\", "(", "k", "\\", ")", "and", "the", "size", "of", "both", "candidate", "sets", ".", "Thus", "if", "any", "of", "the", "given", "candidate", "sets", "is", "empty", "zero", "is", "returned", "." ]
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/adv/MultiSwapNeighbourhood.java#L215-L217
LearnLib/automatalib
commons/util/src/main/java/net/automatalib/commons/util/comparison/CmpUtil.java
CmpUtil.lexCompare
public static <U> int lexCompare(Iterable<? extends U> o1, Iterable<? extends U> o2, Comparator<U> elemComparator) { Iterator<? extends U> it1 = o1.iterator(), it2 = o2.iterator(); while (it1.hasNext() && it2.hasNext()) { int cmp = elemComparator.compare(it1.next(), it2.next()); if (cmp != 0) { return cmp; } } if (it1.hasNext()) { return 1; } else if (it2.hasNext()) { return -1; } return 0; }
java
public static <U> int lexCompare(Iterable<? extends U> o1, Iterable<? extends U> o2, Comparator<U> elemComparator) { Iterator<? extends U> it1 = o1.iterator(), it2 = o2.iterator(); while (it1.hasNext() && it2.hasNext()) { int cmp = elemComparator.compare(it1.next(), it2.next()); if (cmp != 0) { return cmp; } } if (it1.hasNext()) { return 1; } else if (it2.hasNext()) { return -1; } return 0; }
[ "public", "static", "<", "U", ">", "int", "lexCompare", "(", "Iterable", "<", "?", "extends", "U", ">", "o1", ",", "Iterable", "<", "?", "extends", "U", ">", "o2", ",", "Comparator", "<", "U", ">", "elemComparator", ")", "{", "Iterator", "<", "?", "extends", "U", ">", "it1", "=", "o1", ".", "iterator", "(", ")", ",", "it2", "=", "o2", ".", "iterator", "(", ")", ";", "while", "(", "it1", ".", "hasNext", "(", ")", "&&", "it2", ".", "hasNext", "(", ")", ")", "{", "int", "cmp", "=", "elemComparator", ".", "compare", "(", "it1", ".", "next", "(", ")", ",", "it2", ".", "next", "(", ")", ")", ";", "if", "(", "cmp", "!=", "0", ")", "{", "return", "cmp", ";", "}", "}", "if", "(", "it1", ".", "hasNext", "(", ")", ")", "{", "return", "1", ";", "}", "else", "if", "(", "it2", ".", "hasNext", "(", ")", ")", "{", "return", "-", "1", ";", "}", "return", "0", ";", "}" ]
Lexicographically compares two {@link Iterable}s. Comparison of the elements is done using the specified comparator. @param o1 the first iterable. @param o2 the second iterable. @param elemComparator the comparator. @return <code>&lt; 0</code> iff o1 is lexicographically smaller, <code>0</code> if o1 equals o2 and <code>&gt; 0</code> otherwise.
[ "Lexicographically", "compares", "two", "{", "@link", "Iterable", "}", "s", ".", "Comparison", "of", "the", "elements", "is", "done", "using", "the", "specified", "comparator", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/comparison/CmpUtil.java#L103-L119
Azure/azure-sdk-for-java
resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceGroupsInner.java
ResourceGroupsInner.listAsync
public Observable<Page<ResourceGroupInner>> listAsync(final String filter, final Integer top) { return listWithServiceResponseAsync(filter, top) .map(new Func1<ServiceResponse<Page<ResourceGroupInner>>, Page<ResourceGroupInner>>() { @Override public Page<ResourceGroupInner> call(ServiceResponse<Page<ResourceGroupInner>> response) { return response.body(); } }); }
java
public Observable<Page<ResourceGroupInner>> listAsync(final String filter, final Integer top) { return listWithServiceResponseAsync(filter, top) .map(new Func1<ServiceResponse<Page<ResourceGroupInner>>, Page<ResourceGroupInner>>() { @Override public Page<ResourceGroupInner> call(ServiceResponse<Page<ResourceGroupInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ResourceGroupInner", ">", ">", "listAsync", "(", "final", "String", "filter", ",", "final", "Integer", "top", ")", "{", "return", "listWithServiceResponseAsync", "(", "filter", ",", "top", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ResourceGroupInner", ">", ">", ",", "Page", "<", "ResourceGroupInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "ResourceGroupInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ResourceGroupInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets all the resource groups for a subscription. @param filter The filter to apply on the operation. @param top The number of results to return. If null is passed, returns all resource groups. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceGroupInner&gt; object
[ "Gets", "all", "the", "resource", "groups", "for", "a", "subscription", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/resources/v2016_09_01/implementation/ResourceGroupsInner.java#L1079-L1087
weld/core
impl/src/main/java/org/jboss/weld/util/bytecode/BytecodeUtils.java
BytecodeUtils.addLoadInstruction
public static void addLoadInstruction(CodeAttribute code, String type, int variable) { char tp = type.charAt(0); if (tp != 'L' && tp != '[') { // we have a primitive type switch (tp) { case 'J': code.lload(variable); break; case 'D': code.dload(variable); break; case 'F': code.fload(variable); break; default: code.iload(variable); } } else { code.aload(variable); } }
java
public static void addLoadInstruction(CodeAttribute code, String type, int variable) { char tp = type.charAt(0); if (tp != 'L' && tp != '[') { // we have a primitive type switch (tp) { case 'J': code.lload(variable); break; case 'D': code.dload(variable); break; case 'F': code.fload(variable); break; default: code.iload(variable); } } else { code.aload(variable); } }
[ "public", "static", "void", "addLoadInstruction", "(", "CodeAttribute", "code", ",", "String", "type", ",", "int", "variable", ")", "{", "char", "tp", "=", "type", ".", "charAt", "(", "0", ")", ";", "if", "(", "tp", "!=", "'", "'", "&&", "tp", "!=", "'", "'", ")", "{", "// we have a primitive type", "switch", "(", "tp", ")", "{", "case", "'", "'", ":", "code", ".", "lload", "(", "variable", ")", ";", "break", ";", "case", "'", "'", ":", "code", ".", "dload", "(", "variable", ")", ";", "break", ";", "case", "'", "'", ":", "code", ".", "fload", "(", "variable", ")", ";", "break", ";", "default", ":", "code", ".", "iload", "(", "variable", ")", ";", "}", "}", "else", "{", "code", ".", "aload", "(", "variable", ")", ";", "}", "}" ]
Adds the correct load instruction based on the type descriptor @param code the bytecode to add the instruction to @param type the type of the variable @param variable the variable number
[ "Adds", "the", "correct", "load", "instruction", "based", "on", "the", "type", "descriptor" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/bytecode/BytecodeUtils.java#L54-L74
threerings/nenya
core/src/main/java/com/threerings/media/image/ColorPository.java
ColorPository.getRandomStartingColor
public ColorRecord getRandomStartingColor (String className, Random rand) { // make sure the class exists ClassRecord record = getClassRecord(className); return (record == null) ? null : record.randomStartingColor(rand); }
java
public ColorRecord getRandomStartingColor (String className, Random rand) { // make sure the class exists ClassRecord record = getClassRecord(className); return (record == null) ? null : record.randomStartingColor(rand); }
[ "public", "ColorRecord", "getRandomStartingColor", "(", "String", "className", ",", "Random", "rand", ")", "{", "// make sure the class exists", "ClassRecord", "record", "=", "getClassRecord", "(", "className", ")", ";", "return", "(", "record", "==", "null", ")", "?", "null", ":", "record", ".", "randomStartingColor", "(", "rand", ")", ";", "}" ]
Returns a random starting color from the specified color class.
[ "Returns", "a", "random", "starting", "color", "from", "the", "specified", "color", "class", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ColorPository.java#L354-L359
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/denoise/wavelet/SubbandShrink.java
SubbandShrink.performShrinkage
protected void performShrinkage( I transform , int numLevels ) { // step through each layer in the pyramid. for( int i = 0; i < numLevels; i++ ) { int w = transform.width; int h = transform.height; int ww = w/2; int hh = h/2; Number threshold; I subband; // HL subband = transform.subimage(ww,0,w,hh, null); threshold = computeThreshold(subband); rule.process(subband,threshold); // System.out.print("HL = "+threshold); // LH subband = transform.subimage(0,hh,ww,h, null); threshold = computeThreshold(subband); rule.process(subband,threshold); // System.out.print(" LH = "+threshold); // HH subband = transform.subimage(ww,hh,w,h, null); threshold = computeThreshold(subband); rule.process(subband,threshold); // System.out.println(" HH = "+threshold); transform = transform.subimage(0,0,ww,hh, null); } }
java
protected void performShrinkage( I transform , int numLevels ) { // step through each layer in the pyramid. for( int i = 0; i < numLevels; i++ ) { int w = transform.width; int h = transform.height; int ww = w/2; int hh = h/2; Number threshold; I subband; // HL subband = transform.subimage(ww,0,w,hh, null); threshold = computeThreshold(subband); rule.process(subband,threshold); // System.out.print("HL = "+threshold); // LH subband = transform.subimage(0,hh,ww,h, null); threshold = computeThreshold(subband); rule.process(subband,threshold); // System.out.print(" LH = "+threshold); // HH subband = transform.subimage(ww,hh,w,h, null); threshold = computeThreshold(subband); rule.process(subband,threshold); // System.out.println(" HH = "+threshold); transform = transform.subimage(0,0,ww,hh, null); } }
[ "protected", "void", "performShrinkage", "(", "I", "transform", ",", "int", "numLevels", ")", "{", "// step through each layer in the pyramid.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numLevels", ";", "i", "++", ")", "{", "int", "w", "=", "transform", ".", "width", ";", "int", "h", "=", "transform", ".", "height", ";", "int", "ww", "=", "w", "/", "2", ";", "int", "hh", "=", "h", "/", "2", ";", "Number", "threshold", ";", "I", "subband", ";", "// HL", "subband", "=", "transform", ".", "subimage", "(", "ww", ",", "0", ",", "w", ",", "hh", ",", "null", ")", ";", "threshold", "=", "computeThreshold", "(", "subband", ")", ";", "rule", ".", "process", "(", "subband", ",", "threshold", ")", ";", "//\t\t\tSystem.out.print(\"HL = \"+threshold);", "// LH", "subband", "=", "transform", ".", "subimage", "(", "0", ",", "hh", ",", "ww", ",", "h", ",", "null", ")", ";", "threshold", "=", "computeThreshold", "(", "subband", ")", ";", "rule", ".", "process", "(", "subband", ",", "threshold", ")", ";", "//\t\t\tSystem.out.print(\" LH = \"+threshold);", "// HH", "subband", "=", "transform", ".", "subimage", "(", "ww", ",", "hh", ",", "w", ",", "h", ",", "null", ")", ";", "threshold", "=", "computeThreshold", "(", "subband", ")", ";", "rule", ".", "process", "(", "subband", ",", "threshold", ")", ";", "//\t\t\tSystem.out.println(\" HH = \"+threshold);", "transform", "=", "transform", ".", "subimage", "(", "0", ",", "0", ",", "ww", ",", "hh", ",", "null", ")", ";", "}", "}" ]
Performs wavelet shrinking using the specified rule and by computing a threshold for each subband. @param transform The image being transformed. @param numLevels Number of levels in the transform.
[ "Performs", "wavelet", "shrinking", "using", "the", "specified", "rule", "and", "by", "computing", "a", "threshold", "for", "each", "subband", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/denoise/wavelet/SubbandShrink.java#L56-L91
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.expectNew
public static synchronized <T> IExpectationSetters<T> expectNew(Class<T> type, Class<?>[] parameterTypes, Object... arguments) throws Exception { return doExpectNew(type, new DefaultMockStrategy(), parameterTypes, arguments); }
java
public static synchronized <T> IExpectationSetters<T> expectNew(Class<T> type, Class<?>[] parameterTypes, Object... arguments) throws Exception { return doExpectNew(type, new DefaultMockStrategy(), parameterTypes, arguments); }
[ "public", "static", "synchronized", "<", "T", ">", "IExpectationSetters", "<", "T", ">", "expectNew", "(", "Class", "<", "T", ">", "type", ",", "Class", "<", "?", ">", "[", "]", "parameterTypes", ",", "Object", "...", "arguments", ")", "throws", "Exception", "{", "return", "doExpectNew", "(", "type", ",", "new", "DefaultMockStrategy", "(", ")", ",", "parameterTypes", ",", "arguments", ")", ";", "}" ]
Allows specifying expectations on new invocations. For example you might want to throw an exception or return a mock. Note that you must replay the class when using this method since this behavior is part of the class mock. <p/> Use this method when you need to specify parameter types for the constructor when PowerMock cannot determine which constructor to use automatically. In most cases you should use {@link #expectNew(Class, Object...)} instead.
[ "Allows", "specifying", "expectations", "on", "new", "invocations", ".", "For", "example", "you", "might", "want", "to", "throw", "an", "exception", "or", "return", "a", "mock", ".", "Note", "that", "you", "must", "replay", "the", "class", "when", "using", "this", "method", "since", "this", "behavior", "is", "part", "of", "the", "class", "mock", ".", "<p", "/", ">", "Use", "this", "method", "when", "you", "need", "to", "specify", "parameter", "types", "for", "the", "constructor", "when", "PowerMock", "cannot", "determine", "which", "constructor", "to", "use", "automatically", ".", "In", "most", "cases", "you", "should", "use", "{" ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L1615-L1618
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/GrammaticalRelation.java
GrammaticalRelation.valueOf
public static GrammaticalRelation valueOf(Language language, String s) { GrammaticalRelation reln = (stringsToRelations.get(language) != null ? valueOf(s, stringsToRelations.get(language).values()) : null); if (reln == null) { // TODO this breaks the hierarchical structure of the classes, // but it makes English relations that much likelier to work. reln = EnglishGrammaticalRelations.valueOf(s); } if (reln == null) { // the block below fails when 'specific' includes underscores. // this is possible on weird web text, which generates relations such as prep______ /* String[] names = s.split("_"); String specific = names.length > 1? names[1] : null; reln = new GrammaticalRelation(language, names[0], null, null, null, specific); */ String name; String specific; int underscorePosition = s.indexOf('_'); if (underscorePosition > 0) { name = s.substring(0, underscorePosition); specific = s.substring(underscorePosition + 1); } else { name = s; specific = null; } reln = new GrammaticalRelation(language, name, null, null, null, specific); } return reln; }
java
public static GrammaticalRelation valueOf(Language language, String s) { GrammaticalRelation reln = (stringsToRelations.get(language) != null ? valueOf(s, stringsToRelations.get(language).values()) : null); if (reln == null) { // TODO this breaks the hierarchical structure of the classes, // but it makes English relations that much likelier to work. reln = EnglishGrammaticalRelations.valueOf(s); } if (reln == null) { // the block below fails when 'specific' includes underscores. // this is possible on weird web text, which generates relations such as prep______ /* String[] names = s.split("_"); String specific = names.length > 1? names[1] : null; reln = new GrammaticalRelation(language, names[0], null, null, null, specific); */ String name; String specific; int underscorePosition = s.indexOf('_'); if (underscorePosition > 0) { name = s.substring(0, underscorePosition); specific = s.substring(underscorePosition + 1); } else { name = s; specific = null; } reln = new GrammaticalRelation(language, name, null, null, null, specific); } return reln; }
[ "public", "static", "GrammaticalRelation", "valueOf", "(", "Language", "language", ",", "String", "s", ")", "{", "GrammaticalRelation", "reln", "=", "(", "stringsToRelations", ".", "get", "(", "language", ")", "!=", "null", "?", "valueOf", "(", "s", ",", "stringsToRelations", ".", "get", "(", "language", ")", ".", "values", "(", ")", ")", ":", "null", ")", ";", "if", "(", "reln", "==", "null", ")", "{", "// TODO this breaks the hierarchical structure of the classes,\r", "// but it makes English relations that much likelier to work.\r", "reln", "=", "EnglishGrammaticalRelations", ".", "valueOf", "(", "s", ")", ";", "}", "if", "(", "reln", "==", "null", ")", "{", "// the block below fails when 'specific' includes underscores.\r", "// this is possible on weird web text, which generates relations such as prep______\r", "/*\r\n String[] names = s.split(\"_\");\r\n String specific = names.length > 1? names[1] : null;\r\n reln = new GrammaticalRelation(language, names[0], null, null, null, specific);\r\n */", "String", "name", ";", "String", "specific", ";", "int", "underscorePosition", "=", "s", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "underscorePosition", ">", "0", ")", "{", "name", "=", "s", ".", "substring", "(", "0", ",", "underscorePosition", ")", ";", "specific", "=", "s", ".", "substring", "(", "underscorePosition", "+", "1", ")", ";", "}", "else", "{", "name", "=", "s", ";", "specific", "=", "null", ";", "}", "reln", "=", "new", "GrammaticalRelation", "(", "language", ",", "name", ",", "null", ",", "null", ",", "null", ",", "specific", ")", ";", "}", "return", "reln", ";", "}" ]
Convert from a String representation of a GrammaticalRelation to a GrammaticalRelation. Where possible, you should avoid using this method and simply work with true GrammaticalRelations rather than String representations. Correct behavior of this method depends on the underlying data structure resources used being kept in sync with the toString() and equals() methods. However, there is really no choice but to use this method when storing GrammaticalRelations to text files and then reading them back in, so this method is not deprecated. @param s The String representation of a GrammaticalRelation @return The grammatical relation represented by this String
[ "Convert", "from", "a", "String", "representation", "of", "a", "GrammaticalRelation", "to", "a", "GrammaticalRelation", ".", "Where", "possible", "you", "should", "avoid", "using", "this", "method", "and", "simply", "work", "with", "true", "GrammaticalRelations", "rather", "than", "String", "representations", ".", "Correct", "behavior", "of", "this", "method", "depends", "on", "the", "underlying", "data", "structure", "resources", "used", "being", "kept", "in", "sync", "with", "the", "toString", "()", "and", "equals", "()", "methods", ".", "However", "there", "is", "really", "no", "choice", "but", "to", "use", "this", "method", "when", "storing", "GrammaticalRelations", "to", "text", "files", "and", "then", "reading", "them", "back", "in", "so", "this", "method", "is", "not", "deprecated", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/GrammaticalRelation.java#L176-L205
cdk/cdk
descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java
XLogPDescriptor.getCarbonsCount
private int getCarbonsCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int ccounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("C")) { if (!neighbour.getFlag(CDKConstants.ISAROMATIC)) { ccounter += 1; } } } return ccounter; }
java
private int getCarbonsCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int ccounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("C")) { if (!neighbour.getFlag(CDKConstants.ISAROMATIC)) { ccounter += 1; } } } return ccounter; }
[ "private", "int", "getCarbonsCount", "(", "IAtomContainer", "ac", ",", "IAtom", "atom", ")", "{", "List", "<", "IAtom", ">", "neighbours", "=", "ac", ".", "getConnectedAtomsList", "(", "atom", ")", ";", "int", "ccounter", "=", "0", ";", "for", "(", "IAtom", "neighbour", ":", "neighbours", ")", "{", "if", "(", "neighbour", ".", "getSymbol", "(", ")", ".", "equals", "(", "\"C\"", ")", ")", "{", "if", "(", "!", "neighbour", ".", "getFlag", "(", "CDKConstants", ".", "ISAROMATIC", ")", ")", "{", "ccounter", "+=", "1", ";", "}", "}", "}", "return", "ccounter", ";", "}" ]
Gets the carbonsCount attribute of the XLogPDescriptor object. @param ac Description of the Parameter @param atom Description of the Parameter @return The carbonsCount value
[ "Gets", "the", "carbonsCount", "attribute", "of", "the", "XLogPDescriptor", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1092-L1103
GoogleCloudPlatform/bigdata-interop
gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java
GoogleHadoopFileSystemBase.initializeDelegationTokenSupport
private void initializeDelegationTokenSupport(Configuration config, URI path) throws IOException { logger.atFine().log("GHFS.initializeDelegationTokenSupport"); // Load delegation token binding, if support is configured GcsDelegationTokens dts = new GcsDelegationTokens(); Text service = new Text(getScheme() + "://" + path.getAuthority()); dts.bindToFileSystem(this, service); try { dts.init(config); delegationTokens = dts; if (delegationTokens.isBoundToDT()) { logger.atFine().log( "GHFS.initializeDelegationTokenSupport: Using existing delegation token."); } } catch (IllegalStateException e) { logger.atInfo().log("GHFS.initializeDelegationTokenSupport: %s", e.getMessage()); } }
java
private void initializeDelegationTokenSupport(Configuration config, URI path) throws IOException { logger.atFine().log("GHFS.initializeDelegationTokenSupport"); // Load delegation token binding, if support is configured GcsDelegationTokens dts = new GcsDelegationTokens(); Text service = new Text(getScheme() + "://" + path.getAuthority()); dts.bindToFileSystem(this, service); try { dts.init(config); delegationTokens = dts; if (delegationTokens.isBoundToDT()) { logger.atFine().log( "GHFS.initializeDelegationTokenSupport: Using existing delegation token."); } } catch (IllegalStateException e) { logger.atInfo().log("GHFS.initializeDelegationTokenSupport: %s", e.getMessage()); } }
[ "private", "void", "initializeDelegationTokenSupport", "(", "Configuration", "config", ",", "URI", "path", ")", "throws", "IOException", "{", "logger", ".", "atFine", "(", ")", ".", "log", "(", "\"GHFS.initializeDelegationTokenSupport\"", ")", ";", "// Load delegation token binding, if support is configured", "GcsDelegationTokens", "dts", "=", "new", "GcsDelegationTokens", "(", ")", ";", "Text", "service", "=", "new", "Text", "(", "getScheme", "(", ")", "+", "\"://\"", "+", "path", ".", "getAuthority", "(", ")", ")", ";", "dts", ".", "bindToFileSystem", "(", "this", ",", "service", ")", ";", "try", "{", "dts", ".", "init", "(", "config", ")", ";", "delegationTokens", "=", "dts", ";", "if", "(", "delegationTokens", ".", "isBoundToDT", "(", ")", ")", "{", "logger", ".", "atFine", "(", ")", ".", "log", "(", "\"GHFS.initializeDelegationTokenSupport: Using existing delegation token.\"", ")", ";", "}", "}", "catch", "(", "IllegalStateException", "e", ")", "{", "logger", ".", "atInfo", "(", ")", ".", "log", "(", "\"GHFS.initializeDelegationTokenSupport: %s\"", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Initialize the delegation token support for this filesystem. @param config The filesystem configuration @param path The filesystem path @throws IOException
[ "Initialize", "the", "delegation", "token", "support", "for", "this", "filesystem", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L638-L654
lisicnu/droidUtil
src/main/java/com/github/lisicnu/libDroid/util/StringUtils.java
StringUtils.combine
public static String combine(String str1, String str2, String separator) { if (separator == null || separator.isEmpty()) { return str1 == null ? str2 : str1.concat(str2); } if (str1 == null) str1 = ""; if (str2 == null) str2 = ""; StringBuilder builder = new StringBuilder(); if (str1.endsWith(separator)) { builder.append(str1.substring(0, str1.length() - separator.length())); } else { builder.append(str1); } builder.append(separator); if (str2.startsWith(separator)) { builder.append(str2.substring(separator.length())); } else { builder.append(str2); } return builder.toString(); }
java
public static String combine(String str1, String str2, String separator) { if (separator == null || separator.isEmpty()) { return str1 == null ? str2 : str1.concat(str2); } if (str1 == null) str1 = ""; if (str2 == null) str2 = ""; StringBuilder builder = new StringBuilder(); if (str1.endsWith(separator)) { builder.append(str1.substring(0, str1.length() - separator.length())); } else { builder.append(str1); } builder.append(separator); if (str2.startsWith(separator)) { builder.append(str2.substring(separator.length())); } else { builder.append(str2); } return builder.toString(); }
[ "public", "static", "String", "combine", "(", "String", "str1", ",", "String", "str2", ",", "String", "separator", ")", "{", "if", "(", "separator", "==", "null", "||", "separator", ".", "isEmpty", "(", ")", ")", "{", "return", "str1", "==", "null", "?", "str2", ":", "str1", ".", "concat", "(", "str2", ")", ";", "}", "if", "(", "str1", "==", "null", ")", "str1", "=", "\"\"", ";", "if", "(", "str2", "==", "null", ")", "str2", "=", "\"\"", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "str1", ".", "endsWith", "(", "separator", ")", ")", "{", "builder", ".", "append", "(", "str1", ".", "substring", "(", "0", ",", "str1", ".", "length", "(", ")", "-", "separator", ".", "length", "(", ")", ")", ")", ";", "}", "else", "{", "builder", ".", "append", "(", "str1", ")", ";", "}", "builder", ".", "append", "(", "separator", ")", ";", "if", "(", "str2", ".", "startsWith", "(", "separator", ")", ")", "{", "builder", ".", "append", "(", "str2", ".", "substring", "(", "separator", ".", "length", "(", ")", ")", ")", ";", "}", "else", "{", "builder", ".", "append", "(", "str2", ")", ";", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
e.g. str1= "aaaa/", str2= "/bbb" ,separator="/" will return "aaaa/bbb" @param str1 @param str2 @param separator @return
[ "e", ".", "g", ".", "str1", "=", "aaaa", "/", "str2", "=", "/", "bbb", "separator", "=", "/", "will", "return", "aaaa", "/", "bbb" ]
train
https://github.com/lisicnu/droidUtil/blob/e4d6cf3e3f60e5efb5a75672607ded94d1725519/src/main/java/com/github/lisicnu/libDroid/util/StringUtils.java#L149-L174
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/DistanceStatisticsWithClasses.java
DistanceStatisticsWithClasses.exactMinMax
private DoubleMinMax exactMinMax(Relation<O> relation, DistanceQuery<O> distFunc) { final FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("Exact fitting distance computations", relation.size(), LOG) : null; DoubleMinMax minmax = new DoubleMinMax(); // find exact minimum and maximum first. for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { for(DBIDIter iditer2 = relation.iterDBIDs(); iditer2.valid(); iditer2.advance()) { // skip the point itself. if(DBIDUtil.equal(iditer, iditer2)) { continue; } double d = distFunc.distance(iditer, iditer2); minmax.put(d); } LOG.incrementProcessed(progress); } LOG.ensureCompleted(progress); return minmax; }
java
private DoubleMinMax exactMinMax(Relation<O> relation, DistanceQuery<O> distFunc) { final FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("Exact fitting distance computations", relation.size(), LOG) : null; DoubleMinMax minmax = new DoubleMinMax(); // find exact minimum and maximum first. for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) { for(DBIDIter iditer2 = relation.iterDBIDs(); iditer2.valid(); iditer2.advance()) { // skip the point itself. if(DBIDUtil.equal(iditer, iditer2)) { continue; } double d = distFunc.distance(iditer, iditer2); minmax.put(d); } LOG.incrementProcessed(progress); } LOG.ensureCompleted(progress); return minmax; }
[ "private", "DoubleMinMax", "exactMinMax", "(", "Relation", "<", "O", ">", "relation", ",", "DistanceQuery", "<", "O", ">", "distFunc", ")", "{", "final", "FiniteProgress", "progress", "=", "LOG", ".", "isVerbose", "(", ")", "?", "new", "FiniteProgress", "(", "\"Exact fitting distance computations\"", ",", "relation", ".", "size", "(", ")", ",", "LOG", ")", ":", "null", ";", "DoubleMinMax", "minmax", "=", "new", "DoubleMinMax", "(", ")", ";", "// find exact minimum and maximum first.", "for", "(", "DBIDIter", "iditer", "=", "relation", ".", "iterDBIDs", "(", ")", ";", "iditer", ".", "valid", "(", ")", ";", "iditer", ".", "advance", "(", ")", ")", "{", "for", "(", "DBIDIter", "iditer2", "=", "relation", ".", "iterDBIDs", "(", ")", ";", "iditer2", ".", "valid", "(", ")", ";", "iditer2", ".", "advance", "(", ")", ")", "{", "// skip the point itself.", "if", "(", "DBIDUtil", ".", "equal", "(", "iditer", ",", "iditer2", ")", ")", "{", "continue", ";", "}", "double", "d", "=", "distFunc", ".", "distance", "(", "iditer", ",", "iditer2", ")", ";", "minmax", ".", "put", "(", "d", ")", ";", "}", "LOG", ".", "incrementProcessed", "(", "progress", ")", ";", "}", "LOG", ".", "ensureCompleted", "(", "progress", ")", ";", "return", "minmax", ";", "}" ]
Compute the exact maximum and minimum. @param relation Relation to process @param distFunc Distance function @return Exact maximum and minimum
[ "Compute", "the", "exact", "maximum", "and", "minimum", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/DistanceStatisticsWithClasses.java#L357-L374
SpartaTech/sparta-spring-web-utils
src/main/java/org/sparta/springwebutils/queryloader/impl/FileQueryLoader.java
FileQueryLoader.loadfromFromFile
private String loadfromFromFile(String queryName) throws IllegalStateException { try (final InputStream is = getClass().getResourceAsStream(scriptsFolder + queryName + ".sql");) { String sql = StringUtils.join(IOUtils.readLines(is, StandardCharsets.UTF_8), IOUtils.LINE_SEPARATOR); // Look for tokens final String[] tokens = StringUtils.substringsBetween(sql, "${", "}"); if (tokens != null && tokens.length > 0) { final Map<String, String> values = Arrays.stream(tokens).collect(Collectors.toMap( Function.identity(), this::load, (o, n) -> o )); sql = StrSubstitutor.replace(sql, values); } return sql; } catch (Exception e) { throw new IllegalStateException("Could not load query " + scriptsFolder + queryName, e); } }
java
private String loadfromFromFile(String queryName) throws IllegalStateException { try (final InputStream is = getClass().getResourceAsStream(scriptsFolder + queryName + ".sql");) { String sql = StringUtils.join(IOUtils.readLines(is, StandardCharsets.UTF_8), IOUtils.LINE_SEPARATOR); // Look for tokens final String[] tokens = StringUtils.substringsBetween(sql, "${", "}"); if (tokens != null && tokens.length > 0) { final Map<String, String> values = Arrays.stream(tokens).collect(Collectors.toMap( Function.identity(), this::load, (o, n) -> o )); sql = StrSubstitutor.replace(sql, values); } return sql; } catch (Exception e) { throw new IllegalStateException("Could not load query " + scriptsFolder + queryName, e); } }
[ "private", "String", "loadfromFromFile", "(", "String", "queryName", ")", "throws", "IllegalStateException", "{", "try", "(", "final", "InputStream", "is", "=", "getClass", "(", ")", ".", "getResourceAsStream", "(", "scriptsFolder", "+", "queryName", "+", "\".sql\"", ")", ";", ")", "{", "String", "sql", "=", "StringUtils", ".", "join", "(", "IOUtils", ".", "readLines", "(", "is", ",", "StandardCharsets", ".", "UTF_8", ")", ",", "IOUtils", ".", "LINE_SEPARATOR", ")", ";", "// Look for tokens", "final", "String", "[", "]", "tokens", "=", "StringUtils", ".", "substringsBetween", "(", "sql", ",", "\"${\"", ",", "\"}\"", ")", ";", "if", "(", "tokens", "!=", "null", "&&", "tokens", ".", "length", ">", "0", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "values", "=", "Arrays", ".", "stream", "(", "tokens", ")", ".", "collect", "(", "Collectors", ".", "toMap", "(", "Function", ".", "identity", "(", ")", ",", "this", "::", "load", ",", "(", "o", ",", "n", ")", "->", "o", ")", ")", ";", "sql", "=", "StrSubstitutor", ".", "replace", "(", "sql", ",", "values", ")", ";", "}", "return", "sql", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not load query \"", "+", "scriptsFolder", "+", "queryName", ",", "e", ")", ";", "}", "}" ]
Loads the query from the informed path and adds to cache @param queryName File name for the query to be loaded @return requested Query @throws IllegalStateException In case query was not found
[ "Loads", "the", "query", "from", "the", "informed", "path", "and", "adds", "to", "cache" ]
train
https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/queryloader/impl/FileQueryLoader.java#L82-L102
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_statistics_partition_partition_GET
public OvhRtmPartition serviceName_statistics_partition_partition_GET(String serviceName, String partition) throws IOException { String qPath = "/dedicated/server/{serviceName}/statistics/partition/{partition}"; StringBuilder sb = path(qPath, serviceName, partition); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRtmPartition.class); }
java
public OvhRtmPartition serviceName_statistics_partition_partition_GET(String serviceName, String partition) throws IOException { String qPath = "/dedicated/server/{serviceName}/statistics/partition/{partition}"; StringBuilder sb = path(qPath, serviceName, partition); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRtmPartition.class); }
[ "public", "OvhRtmPartition", "serviceName_statistics_partition_partition_GET", "(", "String", "serviceName", ",", "String", "partition", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/statistics/partition/{partition}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "partition", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhRtmPartition", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /dedicated/server/{serviceName}/statistics/partition/{partition} @param serviceName [required] The internal name of your dedicated server @param partition [required] Partition
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1264-L1269
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java
TimeZoneGenericNames.getPartialLocationName
private String getPartialLocationName(String tzID, String mzID, boolean isLong, String mzDisplayName) { String letter = isLong ? "L" : "S"; String key = tzID + "&" + mzID + "#" + letter; String name = _genericPartialLocationNamesMap.get(key); if (name != null) { return name; } String location = null; String countryCode = ZoneMeta.getCanonicalCountry(tzID); if (countryCode != null) { // Is this the golden zone for the region? String regionalGolden = _tznames.getReferenceZoneID(mzID, countryCode); if (tzID.equals(regionalGolden)) { // Use country name location = getLocaleDisplayNames().regionDisplayName(countryCode); } else { // Otherwise, use exemplar city name location = _tznames.getExemplarLocationName(tzID); } } else { location = _tznames.getExemplarLocationName(tzID); if (location == null) { // This could happen when the time zone is not associated with a country, // and its ID is not hierarchical, for example, CST6CDT. // We use the canonical ID itself as the location for this case. location = tzID; } } name = formatPattern(Pattern.FALLBACK_FORMAT, location, mzDisplayName); synchronized (this) { // we have to sync the name map and the trie String tmp = _genericPartialLocationNamesMap.putIfAbsent(key.intern(), name.intern()); if (tmp == null) { NameInfo info = new NameInfo(tzID.intern(), isLong ? GenericNameType.LONG : GenericNameType.SHORT); _gnamesTrie.put(name, info); } else { name = tmp; } } return name; }
java
private String getPartialLocationName(String tzID, String mzID, boolean isLong, String mzDisplayName) { String letter = isLong ? "L" : "S"; String key = tzID + "&" + mzID + "#" + letter; String name = _genericPartialLocationNamesMap.get(key); if (name != null) { return name; } String location = null; String countryCode = ZoneMeta.getCanonicalCountry(tzID); if (countryCode != null) { // Is this the golden zone for the region? String regionalGolden = _tznames.getReferenceZoneID(mzID, countryCode); if (tzID.equals(regionalGolden)) { // Use country name location = getLocaleDisplayNames().regionDisplayName(countryCode); } else { // Otherwise, use exemplar city name location = _tznames.getExemplarLocationName(tzID); } } else { location = _tznames.getExemplarLocationName(tzID); if (location == null) { // This could happen when the time zone is not associated with a country, // and its ID is not hierarchical, for example, CST6CDT. // We use the canonical ID itself as the location for this case. location = tzID; } } name = formatPattern(Pattern.FALLBACK_FORMAT, location, mzDisplayName); synchronized (this) { // we have to sync the name map and the trie String tmp = _genericPartialLocationNamesMap.putIfAbsent(key.intern(), name.intern()); if (tmp == null) { NameInfo info = new NameInfo(tzID.intern(), isLong ? GenericNameType.LONG : GenericNameType.SHORT); _gnamesTrie.put(name, info); } else { name = tmp; } } return name; }
[ "private", "String", "getPartialLocationName", "(", "String", "tzID", ",", "String", "mzID", ",", "boolean", "isLong", ",", "String", "mzDisplayName", ")", "{", "String", "letter", "=", "isLong", "?", "\"L\"", ":", "\"S\"", ";", "String", "key", "=", "tzID", "+", "\"&\"", "+", "mzID", "+", "\"#\"", "+", "letter", ";", "String", "name", "=", "_genericPartialLocationNamesMap", ".", "get", "(", "key", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "return", "name", ";", "}", "String", "location", "=", "null", ";", "String", "countryCode", "=", "ZoneMeta", ".", "getCanonicalCountry", "(", "tzID", ")", ";", "if", "(", "countryCode", "!=", "null", ")", "{", "// Is this the golden zone for the region?", "String", "regionalGolden", "=", "_tznames", ".", "getReferenceZoneID", "(", "mzID", ",", "countryCode", ")", ";", "if", "(", "tzID", ".", "equals", "(", "regionalGolden", ")", ")", "{", "// Use country name", "location", "=", "getLocaleDisplayNames", "(", ")", ".", "regionDisplayName", "(", "countryCode", ")", ";", "}", "else", "{", "// Otherwise, use exemplar city name", "location", "=", "_tznames", ".", "getExemplarLocationName", "(", "tzID", ")", ";", "}", "}", "else", "{", "location", "=", "_tznames", ".", "getExemplarLocationName", "(", "tzID", ")", ";", "if", "(", "location", "==", "null", ")", "{", "// This could happen when the time zone is not associated with a country,", "// and its ID is not hierarchical, for example, CST6CDT.", "// We use the canonical ID itself as the location for this case.", "location", "=", "tzID", ";", "}", "}", "name", "=", "formatPattern", "(", "Pattern", ".", "FALLBACK_FORMAT", ",", "location", ",", "mzDisplayName", ")", ";", "synchronized", "(", "this", ")", "{", "// we have to sync the name map and the trie", "String", "tmp", "=", "_genericPartialLocationNamesMap", ".", "putIfAbsent", "(", "key", ".", "intern", "(", ")", ",", "name", ".", "intern", "(", ")", ")", ";", "if", "(", "tmp", "==", "null", ")", "{", "NameInfo", "info", "=", "new", "NameInfo", "(", "tzID", ".", "intern", "(", ")", ",", "isLong", "?", "GenericNameType", ".", "LONG", ":", "GenericNameType", ".", "SHORT", ")", ";", "_gnamesTrie", ".", "put", "(", "name", ",", "info", ")", ";", "}", "else", "{", "name", "=", "tmp", ";", "}", "}", "return", "name", ";", "}" ]
Private method for formatting partial location names. This format is used when a generic name of a meta zone is available, but the given time zone is not a reference zone (golden zone) of the meta zone. @param tzID the canonical time zone ID @param mzID the meta zone ID @param isLong true when long generic name @param mzDisplayName the meta zone generic display name @return the partial location format string
[ "Private", "method", "for", "formatting", "partial", "location", "names", ".", "This", "format", "is", "used", "when", "a", "generic", "name", "of", "a", "meta", "zone", "is", "available", "but", "the", "given", "time", "zone", "is", "not", "a", "reference", "zone", "(", "golden", "zone", ")", "of", "the", "meta", "zone", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneGenericNames.java#L543-L583
kiegroup/jbpm
jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/data/QueryWhere.java
QueryWhere.addParameter
public <T> QueryCriteria addParameter( String listId, T... param ) { if( param.length == 0 ) { return null; } if( QueryCriteriaType.REGEXP.equals(this.type) && ! (param[0] instanceof String) ) { throw new IllegalArgumentException("Only String parameters may be used in regular expressions."); } QueryCriteria criteria = new QueryCriteria(listId, this.union, this.type, param.length); for( T paramElem : param ) { criteria.addParameter(paramElem); } addCriteria(criteria); return criteria; }
java
public <T> QueryCriteria addParameter( String listId, T... param ) { if( param.length == 0 ) { return null; } if( QueryCriteriaType.REGEXP.equals(this.type) && ! (param[0] instanceof String) ) { throw new IllegalArgumentException("Only String parameters may be used in regular expressions."); } QueryCriteria criteria = new QueryCriteria(listId, this.union, this.type, param.length); for( T paramElem : param ) { criteria.addParameter(paramElem); } addCriteria(criteria); return criteria; }
[ "public", "<", "T", ">", "QueryCriteria", "addParameter", "(", "String", "listId", ",", "T", "...", "param", ")", "{", "if", "(", "param", ".", "length", "==", "0", ")", "{", "return", "null", ";", "}", "if", "(", "QueryCriteriaType", ".", "REGEXP", ".", "equals", "(", "this", ".", "type", ")", "&&", "!", "(", "param", "[", "0", "]", "instanceof", "String", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Only String parameters may be used in regular expressions.\"", ")", ";", "}", "QueryCriteria", "criteria", "=", "new", "QueryCriteria", "(", "listId", ",", "this", ".", "union", ",", "this", ".", "type", ",", "param", ".", "length", ")", ";", "for", "(", "T", "paramElem", ":", "param", ")", "{", "criteria", ".", "addParameter", "(", "paramElem", ")", ";", "}", "addCriteria", "(", "criteria", ")", ";", "return", "criteria", ";", "}" ]
This method should be used for<ol> <li>Normal parameters</li> <li>Regular expression parameters</li> </ol> This method should <b>not</b> be used for<ol> <li>Range parameters</li> </ol> @param listId @param param @return
[ "This", "method", "should", "be", "used", "for<ol", ">", "<li", ">", "Normal", "parameters<", "/", "li", ">", "<li", ">", "Regular", "expression", "parameters<", "/", "li", ">", "<", "/", "ol", ">", "This", "method", "should", "<b", ">", "not<", "/", "b", ">", "be", "used", "for<ol", ">", "<li", ">", "Range", "parameters<", "/", "li", ">", "<", "/", "ol", ">" ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/data/QueryWhere.java#L126-L139
Samsung/GearVRf
GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java
GVRRigidBody.setIgnoreCollisionCheck
public void setIgnoreCollisionCheck(GVRRigidBody collisionObject, boolean ignore) { Native3DRigidBody.setIgnoreCollisionCheck(getNative(), collisionObject.getNative(), ignore); }
java
public void setIgnoreCollisionCheck(GVRRigidBody collisionObject, boolean ignore) { Native3DRigidBody.setIgnoreCollisionCheck(getNative(), collisionObject.getNative(), ignore); }
[ "public", "void", "setIgnoreCollisionCheck", "(", "GVRRigidBody", "collisionObject", ",", "boolean", "ignore", ")", "{", "Native3DRigidBody", ".", "setIgnoreCollisionCheck", "(", "getNative", "(", ")", ",", "collisionObject", ".", "getNative", "(", ")", ",", "ignore", ")", ";", "}" ]
Set a {@linkplain GVRRigidBody rigid body} to be ignored (true) or not (false) @param collisionObject rigidbody object on the collision check @param ignore boolean to indicate if the specified object will be ignored or not
[ "Set", "a", "{", "@linkplain", "GVRRigidBody", "rigid", "body", "}", "to", "be", "ignored", "(", "true", ")", "or", "not", "(", "false", ")" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java#L361-L363
alkacon/opencms-core
src/org/opencms/gwt/CmsAliasHelper.java
CmsAliasHelper.saveAliases
public void saveAliases(CmsUUID structureId, List<CmsAliasBean> aliasBeans) throws CmsException { CmsAliasManager aliasManager = OpenCms.getAliasManager(); CmsObject cms = m_cms; List<CmsAlias> aliases = new ArrayList<CmsAlias>(); for (CmsAliasBean aliasBean : aliasBeans) { CmsAlias alias = new CmsAlias( structureId, cms.getRequestContext().getSiteRoot(), aliasBean.getSitePath(), aliasBean.getMode()); aliases.add(alias); } aliasManager.saveAliases(cms, structureId, aliases); }
java
public void saveAliases(CmsUUID structureId, List<CmsAliasBean> aliasBeans) throws CmsException { CmsAliasManager aliasManager = OpenCms.getAliasManager(); CmsObject cms = m_cms; List<CmsAlias> aliases = new ArrayList<CmsAlias>(); for (CmsAliasBean aliasBean : aliasBeans) { CmsAlias alias = new CmsAlias( structureId, cms.getRequestContext().getSiteRoot(), aliasBean.getSitePath(), aliasBean.getMode()); aliases.add(alias); } aliasManager.saveAliases(cms, structureId, aliases); }
[ "public", "void", "saveAliases", "(", "CmsUUID", "structureId", ",", "List", "<", "CmsAliasBean", ">", "aliasBeans", ")", "throws", "CmsException", "{", "CmsAliasManager", "aliasManager", "=", "OpenCms", ".", "getAliasManager", "(", ")", ";", "CmsObject", "cms", "=", "m_cms", ";", "List", "<", "CmsAlias", ">", "aliases", "=", "new", "ArrayList", "<", "CmsAlias", ">", "(", ")", ";", "for", "(", "CmsAliasBean", "aliasBean", ":", "aliasBeans", ")", "{", "CmsAlias", "alias", "=", "new", "CmsAlias", "(", "structureId", ",", "cms", ".", "getRequestContext", "(", ")", ".", "getSiteRoot", "(", ")", ",", "aliasBean", ".", "getSitePath", "(", ")", ",", "aliasBean", ".", "getMode", "(", ")", ")", ";", "aliases", ".", "add", "(", "alias", ")", ";", "}", "aliasManager", ".", "saveAliases", "(", "cms", ",", "structureId", ",", "aliases", ")", ";", "}" ]
Saves aliases.<p> @param structureId the structure id @param aliasBeans the alias beans @throws CmsException if something goes wrong
[ "Saves", "aliases", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsAliasHelper.java#L120-L134
rubenlagus/TelegramBots
telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java
BaseAbilityBot.getUser
protected User getUser(String username) { Integer id = userIds().get(username.toLowerCase()); if (id == null) { throw new IllegalStateException(format("Could not find ID corresponding to username [%s]", username)); } return getUser(id); }
java
protected User getUser(String username) { Integer id = userIds().get(username.toLowerCase()); if (id == null) { throw new IllegalStateException(format("Could not find ID corresponding to username [%s]", username)); } return getUser(id); }
[ "protected", "User", "getUser", "(", "String", "username", ")", "{", "Integer", "id", "=", "userIds", "(", ")", ".", "get", "(", "username", ".", "toLowerCase", "(", ")", ")", ";", "if", "(", "id", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "format", "(", "\"Could not find ID corresponding to username [%s]\"", ",", "username", ")", ")", ";", "}", "return", "getUser", "(", "id", ")", ";", "}" ]
Gets the user with the specified username. @param username the username of the required user @return the user
[ "Gets", "the", "user", "with", "the", "specified", "username", "." ]
train
https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java#L248-L255
soi-toolkit/soi-toolkit-mule
tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/model/ModelFactory.java
ModelFactory.newModel
public static IModel newModel(String groupId, String artifactId, String version, String service, MuleVersionEnum muleVersion, DeploymentModelEnum deploymentModel, List<TransportEnum> transports) { return doCreateNewModel(groupId, artifactId, version, service, muleVersion, deploymentModel, transports, null, null, TransformerEnum.JAVA, null, null); }
java
public static IModel newModel(String groupId, String artifactId, String version, String service, MuleVersionEnum muleVersion, DeploymentModelEnum deploymentModel, List<TransportEnum> transports) { return doCreateNewModel(groupId, artifactId, version, service, muleVersion, deploymentModel, transports, null, null, TransformerEnum.JAVA, null, null); }
[ "public", "static", "IModel", "newModel", "(", "String", "groupId", ",", "String", "artifactId", ",", "String", "version", ",", "String", "service", ",", "MuleVersionEnum", "muleVersion", ",", "DeploymentModelEnum", "deploymentModel", ",", "List", "<", "TransportEnum", ">", "transports", ")", "{", "return", "doCreateNewModel", "(", "groupId", ",", "artifactId", ",", "version", ",", "service", ",", "muleVersion", ",", "deploymentModel", ",", "transports", ",", "null", ",", "null", ",", "TransformerEnum", ".", "JAVA", ",", "null", ",", "null", ")", ";", "}" ]
Constructor-method to use when service descriptors are not required (e.g. schema and wsdl for services) @param groupId @param artifactId @param version @param service @param deploymentModel @return the new model instance
[ "Constructor", "-", "method", "to", "use", "when", "service", "descriptors", "are", "not", "required", "(", "e", ".", "g", ".", "schema", "and", "wsdl", "for", "services", ")" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/model/ModelFactory.java#L109-L111
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java
AbstractManagedType.onStrategyType
private InheritanceModel onStrategyType(InheritanceModel model, InheritanceType strategyType, String descriminator, String descriminatorValue, String tableName, String schemaName) { switch (strategyType) { case SINGLE_TABLE: // if single table if (superClazzType.getJavaType().isAnnotationPresent(DiscriminatorColumn.class)) { descriminator = superClazzType.getJavaType().getAnnotation(DiscriminatorColumn.class).name(); descriminatorValue = getJavaType().getAnnotation(DiscriminatorValue.class).value(); } model = new InheritanceModel(InheritanceType.SINGLE_TABLE, descriminator, descriminatorValue, tableName, schemaName); break; case JOINED: // if join table // TODOO: PRIMARY KEY JOIN COLUMN model = new InheritanceModel(InheritanceType.JOINED, tableName, schemaName); break; case TABLE_PER_CLASS: // don't override, use original ones. model = new InheritanceModel(InheritanceType.TABLE_PER_CLASS, null, null); break; default: // do nothing. break; } return model; }
java
private InheritanceModel onStrategyType(InheritanceModel model, InheritanceType strategyType, String descriminator, String descriminatorValue, String tableName, String schemaName) { switch (strategyType) { case SINGLE_TABLE: // if single table if (superClazzType.getJavaType().isAnnotationPresent(DiscriminatorColumn.class)) { descriminator = superClazzType.getJavaType().getAnnotation(DiscriminatorColumn.class).name(); descriminatorValue = getJavaType().getAnnotation(DiscriminatorValue.class).value(); } model = new InheritanceModel(InheritanceType.SINGLE_TABLE, descriminator, descriminatorValue, tableName, schemaName); break; case JOINED: // if join table // TODOO: PRIMARY KEY JOIN COLUMN model = new InheritanceModel(InheritanceType.JOINED, tableName, schemaName); break; case TABLE_PER_CLASS: // don't override, use original ones. model = new InheritanceModel(InheritanceType.TABLE_PER_CLASS, null, null); break; default: // do nothing. break; } return model; }
[ "private", "InheritanceModel", "onStrategyType", "(", "InheritanceModel", "model", ",", "InheritanceType", "strategyType", ",", "String", "descriminator", ",", "String", "descriminatorValue", ",", "String", "tableName", ",", "String", "schemaName", ")", "{", "switch", "(", "strategyType", ")", "{", "case", "SINGLE_TABLE", ":", "// if single table", "if", "(", "superClazzType", ".", "getJavaType", "(", ")", ".", "isAnnotationPresent", "(", "DiscriminatorColumn", ".", "class", ")", ")", "{", "descriminator", "=", "superClazzType", ".", "getJavaType", "(", ")", ".", "getAnnotation", "(", "DiscriminatorColumn", ".", "class", ")", ".", "name", "(", ")", ";", "descriminatorValue", "=", "getJavaType", "(", ")", ".", "getAnnotation", "(", "DiscriminatorValue", ".", "class", ")", ".", "value", "(", ")", ";", "}", "model", "=", "new", "InheritanceModel", "(", "InheritanceType", ".", "SINGLE_TABLE", ",", "descriminator", ",", "descriminatorValue", ",", "tableName", ",", "schemaName", ")", ";", "break", ";", "case", "JOINED", ":", "// if join table", "// TODOO: PRIMARY KEY JOIN COLUMN", "model", "=", "new", "InheritanceModel", "(", "InheritanceType", ".", "JOINED", ",", "tableName", ",", "schemaName", ")", ";", "break", ";", "case", "TABLE_PER_CLASS", ":", "// don't override, use original ones.", "model", "=", "new", "InheritanceModel", "(", "InheritanceType", ".", "TABLE_PER_CLASS", ",", "null", ",", "null", ")", ";", "break", ";", "default", ":", "// do nothing.", "break", ";", "}", "return", "model", ";", "}" ]
On strategy type. @param model the model @param strategyType the strategy type @param descriminator the descriminator @param descriminatorValue the descriminator value @param tableName the table name @param schemaName the schema name @return the inheritance model
[ "On", "strategy", "type", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L1324-L1364
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java
DataContextUtils.replaceDataReferencesConverter
public static Converter<String,String> replaceDataReferencesConverter(final Map<String, Map<String, String>> data) { return replaceDataReferencesConverter(data, null, false); }
java
public static Converter<String,String> replaceDataReferencesConverter(final Map<String, Map<String, String>> data) { return replaceDataReferencesConverter(data, null, false); }
[ "public", "static", "Converter", "<", "String", ",", "String", ">", "replaceDataReferencesConverter", "(", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "data", ")", "{", "return", "replaceDataReferencesConverter", "(", "data", ",", "null", ",", "false", ")", ";", "}" ]
Return a converter that can expand the property references within a string @param data property context data @return a Converter to expand property values within a string
[ "Return", "a", "converter", "that", "can", "expand", "the", "property", "references", "within", "a", "string" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java#L325-L327
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java
ApplicationGatewaysInner.beginStop
public void beginStop(String resourceGroupName, String applicationGatewayName) { beginStopWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().single().body(); }
java
public void beginStop(String resourceGroupName, String applicationGatewayName) { beginStopWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().single().body(); }
[ "public", "void", "beginStop", "(", "String", "resourceGroupName", ",", "String", "applicationGatewayName", ")", "{", "beginStopWithServiceResponseAsync", "(", "resourceGroupName", ",", "applicationGatewayName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Stops the specified application gateway in a resource group. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @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
[ "Stops", "the", "specified", "application", "gateway", "in", "a", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L1320-L1322
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
AbstractLogger.catching
protected void catching(final String fqcn, final Level level, final Throwable t) { if (isEnabled(level, CATCHING_MARKER, (Object) null, null)) { logMessageSafely(fqcn, level, CATCHING_MARKER, catchingMsg(t), t); } }
java
protected void catching(final String fqcn, final Level level, final Throwable t) { if (isEnabled(level, CATCHING_MARKER, (Object) null, null)) { logMessageSafely(fqcn, level, CATCHING_MARKER, catchingMsg(t), t); } }
[ "protected", "void", "catching", "(", "final", "String", "fqcn", ",", "final", "Level", "level", ",", "final", "Throwable", "t", ")", "{", "if", "(", "isEnabled", "(", "level", ",", "CATCHING_MARKER", ",", "(", "Object", ")", "null", ",", "null", ")", ")", "{", "logMessageSafely", "(", "fqcn", ",", "level", ",", "CATCHING_MARKER", ",", "catchingMsg", "(", "t", ")", ",", "t", ")", ";", "}", "}" ]
Logs a Throwable that has been caught with location information. @param fqcn The fully qualified class name of the <b>caller</b>. @param level The logging level. @param t The Throwable.
[ "Logs", "a", "Throwable", "that", "has", "been", "caught", "with", "location", "information", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java#L176-L180
jbundle/jbundle
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java
BaseHttpTask.setStatusText
public void setStatusText(String strStatus, int iWarningLevel) { if (strStatus == null) strStatus = Constants.BLANK; m_strCurrentStatus = strStatus; m_iCurrentWarningLevel = iWarningLevel; }
java
public void setStatusText(String strStatus, int iWarningLevel) { if (strStatus == null) strStatus = Constants.BLANK; m_strCurrentStatus = strStatus; m_iCurrentWarningLevel = iWarningLevel; }
[ "public", "void", "setStatusText", "(", "String", "strStatus", ",", "int", "iWarningLevel", ")", "{", "if", "(", "strStatus", "==", "null", ")", "strStatus", "=", "Constants", ".", "BLANK", ";", "m_strCurrentStatus", "=", "strStatus", ";", "m_iCurrentWarningLevel", "=", "iWarningLevel", ";", "}" ]
Display this status message in the status box or at the bottom of the browser. @param bWarning If true, display a message box that the user must dismiss.
[ "Display", "this", "status", "message", "in", "the", "status", "box", "or", "at", "the", "bottom", "of", "the", "browser", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L516-L522
twitter/cloudhopper-commons
ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java
DataCoding.createMessageClassGroup
static public DataCoding createMessageClassGroup(byte characterEncoding, byte messageClass) throws IllegalArgumentException { // only default or 8bit are valid if (!(characterEncoding == CHAR_ENC_DEFAULT || characterEncoding == CHAR_ENC_8BIT)) { throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only default or 8bit supported for message class group"); } // validate the message class if (messageClass < 0 || messageClass > 3) { throw new IllegalArgumentException("Invalid messageClass [0x" + HexUtil.toHexString(messageClass) + "] value used: 0x00-0x03 only valid range"); } // need to build this dcs value (top 4 bits are 1, start with 0xF0) byte dcs = (byte)0xF0; // 8bit encoding means bit 2 goes on if (characterEncoding == CHAR_ENC_8BIT) { dcs |= (byte)0x04; } // merge in the message class (bottom 2 bits) dcs |= messageClass; return new DataCoding(dcs, Group.MESSAGE_CLASS, characterEncoding, messageClass, false); }
java
static public DataCoding createMessageClassGroup(byte characterEncoding, byte messageClass) throws IllegalArgumentException { // only default or 8bit are valid if (!(characterEncoding == CHAR_ENC_DEFAULT || characterEncoding == CHAR_ENC_8BIT)) { throw new IllegalArgumentException("Invalid characterEncoding [0x" + HexUtil.toHexString(characterEncoding) + "] value used: only default or 8bit supported for message class group"); } // validate the message class if (messageClass < 0 || messageClass > 3) { throw new IllegalArgumentException("Invalid messageClass [0x" + HexUtil.toHexString(messageClass) + "] value used: 0x00-0x03 only valid range"); } // need to build this dcs value (top 4 bits are 1, start with 0xF0) byte dcs = (byte)0xF0; // 8bit encoding means bit 2 goes on if (characterEncoding == CHAR_ENC_8BIT) { dcs |= (byte)0x04; } // merge in the message class (bottom 2 bits) dcs |= messageClass; return new DataCoding(dcs, Group.MESSAGE_CLASS, characterEncoding, messageClass, false); }
[ "static", "public", "DataCoding", "createMessageClassGroup", "(", "byte", "characterEncoding", ",", "byte", "messageClass", ")", "throws", "IllegalArgumentException", "{", "// only default or 8bit are valid", "if", "(", "!", "(", "characterEncoding", "==", "CHAR_ENC_DEFAULT", "||", "characterEncoding", "==", "CHAR_ENC_8BIT", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid characterEncoding [0x\"", "+", "HexUtil", ".", "toHexString", "(", "characterEncoding", ")", "+", "\"] value used: only default or 8bit supported for message class group\"", ")", ";", "}", "// validate the message class", "if", "(", "messageClass", "<", "0", "||", "messageClass", ">", "3", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid messageClass [0x\"", "+", "HexUtil", ".", "toHexString", "(", "messageClass", ")", "+", "\"] value used: 0x00-0x03 only valid range\"", ")", ";", "}", "// need to build this dcs value (top 4 bits are 1, start with 0xF0)", "byte", "dcs", "=", "(", "byte", ")", "0xF0", ";", "// 8bit encoding means bit 2 goes on", "if", "(", "characterEncoding", "==", "CHAR_ENC_8BIT", ")", "{", "dcs", "|=", "(", "byte", ")", "0x04", ";", "}", "// merge in the message class (bottom 2 bits)", "dcs", "|=", "messageClass", ";", "return", "new", "DataCoding", "(", "dcs", ",", "Group", ".", "MESSAGE_CLASS", ",", "characterEncoding", ",", "messageClass", ",", "false", ")", ";", "}" ]
Creates a "Message Class" group data coding scheme where 2 different languages are supported (8BIT or DEFAULT). This method validates the message class. @param characterEncoding Either CHAR_ENC_DEFAULT or CHAR_ENC_8BIT @param messageClass The 4 different possible message classes (0-3) @return A new immutable DataCoding instance representing this data coding scheme @throws IllegalArgumentException Thrown if the range is not supported.
[ "Creates", "a", "Message", "Class", "group", "data", "coding", "scheme", "where", "2", "different", "languages", "are", "supported", "(", "8BIT", "or", "DEFAULT", ")", ".", "This", "method", "validates", "the", "message", "class", "." ]
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java#L220-L242
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java
PDTFormatter.getFormatterDate
@Nonnull public static DateTimeFormatter getFormatterDate (@Nonnull final FormatStyle eStyle, @Nullable final Locale aDisplayLocale, @Nonnull final EDTFormatterMode eMode) { return _getFormatter (new CacheKey (EDTType.LOCAL_DATE, aDisplayLocale, eStyle, eMode), aDisplayLocale); }
java
@Nonnull public static DateTimeFormatter getFormatterDate (@Nonnull final FormatStyle eStyle, @Nullable final Locale aDisplayLocale, @Nonnull final EDTFormatterMode eMode) { return _getFormatter (new CacheKey (EDTType.LOCAL_DATE, aDisplayLocale, eStyle, eMode), aDisplayLocale); }
[ "@", "Nonnull", "public", "static", "DateTimeFormatter", "getFormatterDate", "(", "@", "Nonnull", "final", "FormatStyle", "eStyle", ",", "@", "Nullable", "final", "Locale", "aDisplayLocale", ",", "@", "Nonnull", "final", "EDTFormatterMode", "eMode", ")", "{", "return", "_getFormatter", "(", "new", "CacheKey", "(", "EDTType", ".", "LOCAL_DATE", ",", "aDisplayLocale", ",", "eStyle", ",", "eMode", ")", ",", "aDisplayLocale", ")", ";", "}" ]
Get the date formatter for the passed locale. @param eStyle The format style to be used. May not be <code>null</code>. @param aDisplayLocale The display locale to be used. May be <code>null</code>. @param eMode Print or parse? May not be <code>null</code>. @return The created date formatter. Never <code>null</code>. @since 8.5.6
[ "Get", "the", "date", "formatter", "for", "the", "passed", "locale", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java#L257-L263
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/util/PathPattern.java
PathPattern.matches
public boolean matches(String[] path) { if (nbAny == 0 && path.length != nbWildcards) return false; if (path.length < nbWildcards) return false; return check(path, 0, 0, nbWildcards, nbAny); }
java
public boolean matches(String[] path) { if (nbAny == 0 && path.length != nbWildcards) return false; if (path.length < nbWildcards) return false; return check(path, 0, 0, nbWildcards, nbAny); }
[ "public", "boolean", "matches", "(", "String", "[", "]", "path", ")", "{", "if", "(", "nbAny", "==", "0", "&&", "path", ".", "length", "!=", "nbWildcards", ")", "return", "false", ";", "if", "(", "path", ".", "length", "<", "nbWildcards", ")", "return", "false", ";", "return", "check", "(", "path", ",", "0", ",", "0", ",", "nbWildcards", ",", "nbAny", ")", ";", "}" ]
Return true if the given list of path elements is matching this pattern.
[ "Return", "true", "if", "the", "given", "list", "of", "path", "elements", "is", "matching", "this", "pattern", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/PathPattern.java#L55-L61
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Streams.java
Streams.copy
public static void copy(final InputStream inputStream, final OutputStream outputStream) throws IOException { new ByteSource() { @Override public InputStream openStream() { return inputStream; } }.copyTo(new ByteSink() { @Override public OutputStream openStream() { return outputStream; } }); }
java
public static void copy(final InputStream inputStream, final OutputStream outputStream) throws IOException { new ByteSource() { @Override public InputStream openStream() { return inputStream; } }.copyTo(new ByteSink() { @Override public OutputStream openStream() { return outputStream; } }); }
[ "public", "static", "void", "copy", "(", "final", "InputStream", "inputStream", ",", "final", "OutputStream", "outputStream", ")", "throws", "IOException", "{", "new", "ByteSource", "(", ")", "{", "@", "Override", "public", "InputStream", "openStream", "(", ")", "{", "return", "inputStream", ";", "}", "}", ".", "copyTo", "(", "new", "ByteSink", "(", ")", "{", "@", "Override", "public", "OutputStream", "openStream", "(", ")", "{", "return", "outputStream", ";", "}", "}", ")", ";", "}" ]
Copies the {@code inputStream} into the {@code outputSteam} and finally closes the both streams.
[ "Copies", "the", "{" ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Streams.java#L131-L144
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_use_GET
public OvhUnitAndValue<Double> serviceName_use_GET(String serviceName, OvhVpsStatisticTypeEnum type) throws IOException { String qPath = "/vps/{serviceName}/use"; StringBuilder sb = path(qPath, serviceName); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
java
public OvhUnitAndValue<Double> serviceName_use_GET(String serviceName, OvhVpsStatisticTypeEnum type) throws IOException { String qPath = "/vps/{serviceName}/use"; StringBuilder sb = path(qPath, serviceName); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
[ "public", "OvhUnitAndValue", "<", "Double", ">", "serviceName_use_GET", "(", "String", "serviceName", ",", "OvhVpsStatisticTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vps/{serviceName}/use\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"type\"", ",", "type", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t5", ")", ";", "}" ]
Return many statistics about the virtual machine at that time REST: GET /vps/{serviceName}/use @param type [required] The type of statistic to be fetched @param serviceName [required] The internal name of your VPS offer
[ "Return", "many", "statistics", "about", "the", "virtual", "machine", "at", "that", "time" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L357-L363
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Types.java
Types.makeIntersectionType
public Type makeIntersectionType(Type bound1, Type bound2) { return makeIntersectionType(List.of(bound1, bound2)); }
java
public Type makeIntersectionType(Type bound1, Type bound2) { return makeIntersectionType(List.of(bound1, bound2)); }
[ "public", "Type", "makeIntersectionType", "(", "Type", "bound1", ",", "Type", "bound2", ")", "{", "return", "makeIntersectionType", "(", "List", ".", "of", "(", "bound1", ",", "bound2", ")", ")", ";", "}" ]
A convenience wrapper for {@link #makeIntersectionType(List)}; the arguments are converted to a list and passed to the other method. Note that this might cause a symbol completion. Hence, this version of makeIntersectionType may not be called during a classfile read.
[ "A", "convenience", "wrapper", "for", "{" ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L2308-L2310
samskivert/samskivert
src/main/java/com/samskivert/util/ConfigUtil.java
ConfigUtil.loadProperties
public static Properties loadProperties (String path, ClassLoader loader) throws IOException { Properties props = new Properties(); loadProperties(path, loader, props); return props; }
java
public static Properties loadProperties (String path, ClassLoader loader) throws IOException { Properties props = new Properties(); loadProperties(path, loader, props); return props; }
[ "public", "static", "Properties", "loadProperties", "(", "String", "path", ",", "ClassLoader", "loader", ")", "throws", "IOException", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "loadProperties", "(", "path", ",", "loader", ",", "props", ")", ";", "return", "props", ";", "}" ]
Like {@link #loadProperties(String)} but this method uses the supplied class loader rather than the class loader used to load the <code>ConfigUtil</code> class.
[ "Like", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ConfigUtil.java#L66-L72
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemLiteralResult.java
ElemLiteralResult.callChildVisitors
protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if (callAttrs && null != m_avts) { int nAttrs = m_avts.size(); for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); avt.callVisitors(visitor); } } super.callChildVisitors(visitor, callAttrs); }
java
protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if (callAttrs && null != m_avts) { int nAttrs = m_avts.size(); for (int i = (nAttrs - 1); i >= 0; i--) { AVT avt = (AVT) m_avts.get(i); avt.callVisitors(visitor); } } super.callChildVisitors(visitor, callAttrs); }
[ "protected", "void", "callChildVisitors", "(", "XSLTVisitor", "visitor", ",", "boolean", "callAttrs", ")", "{", "if", "(", "callAttrs", "&&", "null", "!=", "m_avts", ")", "{", "int", "nAttrs", "=", "m_avts", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "(", "nAttrs", "-", "1", ")", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "AVT", "avt", "=", "(", "AVT", ")", "m_avts", ".", "get", "(", "i", ")", ";", "avt", ".", "callVisitors", "(", "visitor", ")", ";", "}", "}", "super", ".", "callChildVisitors", "(", "visitor", ",", "callAttrs", ")", ";", "}" ]
Call the children visitors. @param visitor The visitor whose appropriate method will be called.
[ "Call", "the", "children", "visitors", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemLiteralResult.java#L1450-L1463
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java
BaseFileManager.handleOption
public boolean handleOption(Option option, String value) { switch (option) { case ENCODING: encodingName = value; return true; case MULTIRELEASE: multiReleaseValue = value; locations.setMultiReleaseValue(value); return true; default: return locations.handleOption(option, value); } }
java
public boolean handleOption(Option option, String value) { switch (option) { case ENCODING: encodingName = value; return true; case MULTIRELEASE: multiReleaseValue = value; locations.setMultiReleaseValue(value); return true; default: return locations.handleOption(option, value); } }
[ "public", "boolean", "handleOption", "(", "Option", "option", ",", "String", "value", ")", "{", "switch", "(", "option", ")", "{", "case", "ENCODING", ":", "encodingName", "=", "value", ";", "return", "true", ";", "case", "MULTIRELEASE", ":", "multiReleaseValue", "=", "value", ";", "locations", ".", "setMultiReleaseValue", "(", "value", ")", ";", "return", "true", ";", "default", ":", "return", "locations", ".", "handleOption", "(", "option", ",", "value", ")", ";", "}", "}" ]
Common back end for OptionHelper handleFileManagerOption. @param option the option whose value to be set @param value the value for the option @return true if successful, and false otherwise
[ "Common", "back", "end", "for", "OptionHelper", "handleFileManagerOption", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java#L257-L271
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java
ClusteringService.startStandalone
public static ClusteringService startStandalone(String clusterName, Channel channel) { ClusteringService clusteringService = new StandaloneClusteringService(clusterName, channel); clusteringService.init(); return clusteringService; }
java
public static ClusteringService startStandalone(String clusterName, Channel channel) { ClusteringService clusteringService = new StandaloneClusteringService(clusterName, channel); clusteringService.init(); return clusteringService; }
[ "public", "static", "ClusteringService", "startStandalone", "(", "String", "clusterName", ",", "Channel", "channel", ")", "{", "ClusteringService", "clusteringService", "=", "new", "StandaloneClusteringService", "(", "clusterName", ",", "channel", ")", ";", "clusteringService", ".", "init", "(", ")", ";", "return", "clusteringService", ";", "}" ]
Starts a standalone clustering service which uses the supplied channel. @param clusterName the name of the cluster to which the JGroups channel should connect; may not be null @param channel a {@link Channel} instance, may not be {@code null} @return a {@link org.modeshape.jcr.clustering.ClusteringService} instance, never null
[ "Starts", "a", "standalone", "clustering", "service", "which", "uses", "the", "supplied", "channel", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java#L275-L279
alkacon/opencms-core
src/org/opencms/db/oracle/CmsUserDriver.java
CmsUserDriver.internalWriteUserInfo
@Override protected void internalWriteUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value) throws CmsDataAccessException { PreparedStatement stmt = null; Connection conn = null; try { // get connection conn = m_sqlManager.getConnection(dbc); // write data to database stmt = m_sqlManager.getPreparedStatement(conn, "C_ORACLE_USERDATA_WRITE_3"); stmt.setString(1, userId.toString()); stmt.setString(2, key); stmt.setString(3, value.getClass().getName()); stmt.executeUpdate(); } catch (SQLException e) { throw new CmsDbSqlException( org.opencms.db.generic.Messages.get().container( org.opencms.db.generic.Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } internalUpdateUserInfoData(dbc, userId, key, value); }
java
@Override protected void internalWriteUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value) throws CmsDataAccessException { PreparedStatement stmt = null; Connection conn = null; try { // get connection conn = m_sqlManager.getConnection(dbc); // write data to database stmt = m_sqlManager.getPreparedStatement(conn, "C_ORACLE_USERDATA_WRITE_3"); stmt.setString(1, userId.toString()); stmt.setString(2, key); stmt.setString(3, value.getClass().getName()); stmt.executeUpdate(); } catch (SQLException e) { throw new CmsDbSqlException( org.opencms.db.generic.Messages.get().container( org.opencms.db.generic.Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } internalUpdateUserInfoData(dbc, userId, key, value); }
[ "@", "Override", "protected", "void", "internalWriteUserInfo", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "userId", ",", "String", "key", ",", "Object", "value", ")", "throws", "CmsDataAccessException", "{", "PreparedStatement", "stmt", "=", "null", ";", "Connection", "conn", "=", "null", ";", "try", "{", "// get connection", "conn", "=", "m_sqlManager", ".", "getConnection", "(", "dbc", ")", ";", "// write data to database", "stmt", "=", "m_sqlManager", ".", "getPreparedStatement", "(", "conn", ",", "\"C_ORACLE_USERDATA_WRITE_3\"", ")", ";", "stmt", ".", "setString", "(", "1", ",", "userId", ".", "toString", "(", ")", ")", ";", "stmt", ".", "setString", "(", "2", ",", "key", ")", ";", "stmt", ".", "setString", "(", "3", ",", "value", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "stmt", ".", "executeUpdate", "(", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "CmsDbSqlException", "(", "org", ".", "opencms", ".", "db", ".", "generic", ".", "Messages", ".", "get", "(", ")", ".", "container", "(", "org", ".", "opencms", ".", "db", ".", "generic", ".", "Messages", ".", "ERR_GENERIC_SQL_1", ",", "CmsDbSqlException", ".", "getErrorQuery", "(", "stmt", ")", ")", ",", "e", ")", ";", "}", "finally", "{", "m_sqlManager", ".", "closeAll", "(", "dbc", ",", "conn", ",", "stmt", ",", "null", ")", ";", "}", "internalUpdateUserInfoData", "(", "dbc", ",", "userId", ",", "key", ",", "value", ")", ";", "}" ]
Writes a new additional user info.<p> @param dbc the current dbc @param userId the user id to add the user info for @param key the name of the additional user info @param value the value of the additional user info @throws CmsDataAccessException if something goes wrong
[ "Writes", "a", "new", "additional", "user", "info", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/oracle/CmsUserDriver.java#L261-L289