repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
wcm-io/wcm-io-tooling
maven/plugins/json-dialog-conversion-plugin/src/main/java/io/wcm/maven/plugins/jsondlgcnv/DialogConverter.java
DialogConverter.rewriteProperty
private void rewriteProperty(JSONObject node, String key, JSONArray rewriteProperty) throws JSONException { if (node.get(cleanup(key)) instanceof String) { if (rewriteProperty.length() == 2) { if (rewriteProperty.get(0) instanceof String && rewriteProperty.get(1) instanceof String) { String pattern = rewriteProperty.getString(0); String replacement = rewriteProperty.getString(1); Pattern compiledPattern = Pattern.compile(pattern); Matcher matcher = compiledPattern.matcher(node.getString(cleanup(key))); node.put(cleanup(key), matcher.replaceAll(replacement)); } } } }
java
private void rewriteProperty(JSONObject node, String key, JSONArray rewriteProperty) throws JSONException { if (node.get(cleanup(key)) instanceof String) { if (rewriteProperty.length() == 2) { if (rewriteProperty.get(0) instanceof String && rewriteProperty.get(1) instanceof String) { String pattern = rewriteProperty.getString(0); String replacement = rewriteProperty.getString(1); Pattern compiledPattern = Pattern.compile(pattern); Matcher matcher = compiledPattern.matcher(node.getString(cleanup(key))); node.put(cleanup(key), matcher.replaceAll(replacement)); } } } }
[ "private", "void", "rewriteProperty", "(", "JSONObject", "node", ",", "String", "key", ",", "JSONArray", "rewriteProperty", ")", "throws", "JSONException", "{", "if", "(", "node", ".", "get", "(", "cleanup", "(", "key", ")", ")", "instanceof", "String", ")",...
Applies a string rewrite to a property. @param node Node @param key the property name to rewrite @param rewriteProperty the property that defines the string rewrite @throws JSONException
[ "Applies", "a", "string", "rewrite", "to", "a", "property", "." ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/maven/plugins/json-dialog-conversion-plugin/src/main/java/io/wcm/maven/plugins/jsondlgcnv/DialogConverter.java#L349-L362
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSliderThumbBackground
public void paintSliderThumbBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (context.getComponent().getClientProperty("Slider.paintThumbArrowShape") == Boolean.TRUE) { if (orientation == JSlider.HORIZONTAL) { orientation = JSlider.VERTICAL; } else { orientation = JSlider.HORIZONTAL; } paintBackground(context, g, x, y, w, h, orientation); } else { paintBackground(context, g, x, y, w, h, orientation); } }
java
public void paintSliderThumbBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (context.getComponent().getClientProperty("Slider.paintThumbArrowShape") == Boolean.TRUE) { if (orientation == JSlider.HORIZONTAL) { orientation = JSlider.VERTICAL; } else { orientation = JSlider.HORIZONTAL; } paintBackground(context, g, x, y, w, h, orientation); } else { paintBackground(context, g, x, y, w, h, orientation); } }
[ "public", "void", "paintSliderThumbBackground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "if", "(", "context", ".", "getComponent", "(",...
Paints the background of the thumb of a slider. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSlider.HORIZONTAL</code> or <code> JSlider.VERTICAL</code>
[ "Paints", "the", "background", "of", "the", "thumb", "of", "a", "slider", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1681-L1694
azkaban/azkaban
azkaban-common/src/main/java/azkaban/utils/StringUtils.java
StringUtils.join2
public static String join2(final Collection<String> list, final String delimiter) { final StringBuffer buffer = new StringBuffer(); boolean first = true; for (final String str : list) { if (!first) { buffer.append(delimiter); } buffer.append(str); first = false; } return buffer.toString(); }
java
public static String join2(final Collection<String> list, final String delimiter) { final StringBuffer buffer = new StringBuffer(); boolean first = true; for (final String str : list) { if (!first) { buffer.append(delimiter); } buffer.append(str); first = false; } return buffer.toString(); }
[ "public", "static", "String", "join2", "(", "final", "Collection", "<", "String", ">", "list", ",", "final", "String", "delimiter", ")", "{", "final", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "boolean", "first", "=", "true", ";"...
Don't bother to add delimiter for last element @return String - elements in the list separated by delimiter
[ "Don", "t", "bother", "to", "add", "delimiter", "for", "last", "element" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/utils/StringUtils.java#L75-L88
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.readQuote
private void readQuote( char quote, StringBuilder builder ) { builder.append( quote ); boolean isBackslash = false; for( ;; ) { char ch = read(); builder.append( ch ); if( ch == quote && !isBackslash ) { return; } isBackslash = ch == '\\'; } }
java
private void readQuote( char quote, StringBuilder builder ) { builder.append( quote ); boolean isBackslash = false; for( ;; ) { char ch = read(); builder.append( ch ); if( ch == quote && !isBackslash ) { return; } isBackslash = ch == '\\'; } }
[ "private", "void", "readQuote", "(", "char", "quote", ",", "StringBuilder", "builder", ")", "{", "builder", ".", "append", "(", "quote", ")", ";", "boolean", "isBackslash", "=", "false", ";", "for", "(", ";", ";", ")", "{", "char", "ch", "=", "read", ...
Read a quoted string and append it to the builder. @param quote the quote character. @param builder the target
[ "Read", "a", "quoted", "string", "and", "append", "it", "to", "the", "builder", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1062-L1073
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ComponentAttributesMap.java
_ComponentAttributesMap.setComponentProperty
private void setComponentProperty(_PropertyDescriptorHolder propertyDescriptor, Object value) { Method writeMethod = propertyDescriptor.getWriteMethod(); if (writeMethod == null) { throw new IllegalArgumentException("Component property " + propertyDescriptor.getName() + " is not writable"); } try { writeMethod.invoke(_component, new Object[]{value}); } catch (Exception e) { FacesContext facesContext = _component.getFacesContext(); throw new FacesException("Could not set property " + propertyDescriptor.getName() + " of component " + _component.getClientId(facesContext) + " to value : " + value + " with type : " + (value == null ? "null" : value.getClass().getName()), e); } }
java
private void setComponentProperty(_PropertyDescriptorHolder propertyDescriptor, Object value) { Method writeMethod = propertyDescriptor.getWriteMethod(); if (writeMethod == null) { throw new IllegalArgumentException("Component property " + propertyDescriptor.getName() + " is not writable"); } try { writeMethod.invoke(_component, new Object[]{value}); } catch (Exception e) { FacesContext facesContext = _component.getFacesContext(); throw new FacesException("Could not set property " + propertyDescriptor.getName() + " of component " + _component.getClientId(facesContext) + " to value : " + value + " with type : " + (value == null ? "null" : value.getClass().getName()), e); } }
[ "private", "void", "setComponentProperty", "(", "_PropertyDescriptorHolder", "propertyDescriptor", ",", "Object", "value", ")", "{", "Method", "writeMethod", "=", "propertyDescriptor", ".", "getWriteMethod", "(", ")", ";", "if", "(", "writeMethod", "==", "null", ")"...
Execute the setter method of the specified property on the underlying component. @param propertyDescriptor specifies which property to write. @throws IllegalArgumentException if the property is not writable. @throws FacesException if any other problem occurs while invoking the getter method.
[ "Execute", "the", "setter", "method", "of", "the", "specified", "property", "on", "the", "underlying", "component", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_ComponentAttributesMap.java#L705-L724
JodaOrg/joda-convert
src/main/java/org/joda/convert/StringConvert.java
StringConvert.convertFromString
public <T> T convertFromString(Class<T> cls, String str) { if (str == null) { return null; } StringConverter<T> conv = findConverter(cls); return conv.convertFromString(cls, str); }
java
public <T> T convertFromString(Class<T> cls, String str) { if (str == null) { return null; } StringConverter<T> conv = findConverter(cls); return conv.convertFromString(cls, str); }
[ "public", "<", "T", ">", "T", "convertFromString", "(", "Class", "<", "T", ">", "cls", ",", "String", "str", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "null", ";", "}", "StringConverter", "<", "T", ">", "conv", "=", "findConvert...
Converts the specified object from a {@code String}. <p> This uses {@link #findConverter} to provide the converter. @param <T> the type to convert to @param cls the class to convert to, not null @param str the string to convert, null returns null @return the converted object, may be null @throws RuntimeException (or subclass) if unable to convert
[ "Converts", "the", "specified", "object", "from", "a", "{", "@code", "String", "}", ".", "<p", ">", "This", "uses", "{", "@link", "#findConverter", "}", "to", "provide", "the", "converter", "." ]
train
https://github.com/JodaOrg/joda-convert/blob/266bd825f4550590d5dafdf4225c548559e0633b/src/main/java/org/joda/convert/StringConvert.java#L441-L447
code4everything/util
src/main/java/com/zhazhapan/util/encryption/SimpleEncrypt.java
SimpleEncrypt.mix
public static String mix(String string, int key) { return ascii(JavaEncrypt.base64(xor(string, key)), key); }
java
public static String mix(String string, int key) { return ascii(JavaEncrypt.base64(xor(string, key)), key); }
[ "public", "static", "String", "mix", "(", "String", "string", ",", "int", "key", ")", "{", "return", "ascii", "(", "JavaEncrypt", ".", "base64", "(", "xor", "(", "string", ",", "key", ")", ")", ",", "key", ")", ";", "}" ]
混合加密 @param string {@link String} @param key {@link Integer} @return {@link String}
[ "混合加密" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/encryption/SimpleEncrypt.java#L20-L22
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/execution/input/Operands.java
Operands.addArgument
public Operands addArgument(@NonNull String id, @NonNull INDArray array) { map.put(NodeDescriptor.builder().name(id).build(), array); return this; }
java
public Operands addArgument(@NonNull String id, @NonNull INDArray array) { map.put(NodeDescriptor.builder().name(id).build(), array); return this; }
[ "public", "Operands", "addArgument", "(", "@", "NonNull", "String", "id", ",", "@", "NonNull", "INDArray", "array", ")", "{", "map", ".", "put", "(", "NodeDescriptor", ".", "builder", "(", ")", ".", "name", "(", "id", ")", ".", "build", "(", ")", ","...
This method allows to pass array to the node identified by its name @param id @param array @return
[ "This", "method", "allows", "to", "pass", "array", "to", "the", "node", "identified", "by", "its", "name" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/execution/input/Operands.java#L39-L42
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setBaselineCost
public void setBaselineCost(int baselineNumber, Number value) { set(selectField(ResourceFieldLists.BASELINE_COSTS, baselineNumber), value); }
java
public void setBaselineCost(int baselineNumber, Number value) { set(selectField(ResourceFieldLists.BASELINE_COSTS, baselineNumber), value); }
[ "public", "void", "setBaselineCost", "(", "int", "baselineNumber", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "BASELINE_COSTS", ",", "baselineNumber", ")", ",", "value", ")", ";", "}" ]
Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value
[ "Set", "a", "baseline", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L2194-L2197
graphhopper/graphhopper
core/src/main/java/com/graphhopper/routing/Path.java
Path.calcDetails
public Map<String, List<PathDetail>> calcDetails(List<String> requestedPathDetails, PathDetailsBuilderFactory pathBuilderFactory, int previousIndex) { if (!isFound() || requestedPathDetails.isEmpty()) return Collections.emptyMap(); List<PathDetailsBuilder> pathBuilders = pathBuilderFactory.createPathDetailsBuilders(requestedPathDetails, encoder, weighting); if (pathBuilders.isEmpty()) return Collections.emptyMap(); forEveryEdge(new PathDetailsFromEdges(pathBuilders, previousIndex)); Map<String, List<PathDetail>> pathDetails = new HashMap<>(pathBuilders.size()); for (PathDetailsBuilder builder : pathBuilders) { Map.Entry<String, List<PathDetail>> entry = builder.build(); List<PathDetail> existing = pathDetails.put(entry.getKey(), entry.getValue()); if (existing != null) throw new IllegalStateException("Some PathDetailsBuilders use duplicate key: " + entry.getKey()); } return pathDetails; }
java
public Map<String, List<PathDetail>> calcDetails(List<String> requestedPathDetails, PathDetailsBuilderFactory pathBuilderFactory, int previousIndex) { if (!isFound() || requestedPathDetails.isEmpty()) return Collections.emptyMap(); List<PathDetailsBuilder> pathBuilders = pathBuilderFactory.createPathDetailsBuilders(requestedPathDetails, encoder, weighting); if (pathBuilders.isEmpty()) return Collections.emptyMap(); forEveryEdge(new PathDetailsFromEdges(pathBuilders, previousIndex)); Map<String, List<PathDetail>> pathDetails = new HashMap<>(pathBuilders.size()); for (PathDetailsBuilder builder : pathBuilders) { Map.Entry<String, List<PathDetail>> entry = builder.build(); List<PathDetail> existing = pathDetails.put(entry.getKey(), entry.getValue()); if (existing != null) throw new IllegalStateException("Some PathDetailsBuilders use duplicate key: " + entry.getKey()); } return pathDetails; }
[ "public", "Map", "<", "String", ",", "List", "<", "PathDetail", ">", ">", "calcDetails", "(", "List", "<", "String", ">", "requestedPathDetails", ",", "PathDetailsBuilderFactory", "pathBuilderFactory", ",", "int", "previousIndex", ")", "{", "if", "(", "!", "is...
Calculates the PathDetails for this Path. This method will return fast, if there are no calculators. @param pathBuilderFactory Generates the relevant PathBuilders @return List of PathDetails for this Path
[ "Calculates", "the", "PathDetails", "for", "this", "Path", ".", "This", "method", "will", "return", "fast", "if", "there", "are", "no", "calculators", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/Path.java#L380-L398
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/mapreduce/MRJobLauncher.java
MRJobLauncher.addHDFSFiles
@SuppressWarnings("deprecation") private void addHDFSFiles(String jobFileList, Configuration conf) { DistributedCache.createSymlink(conf); jobFileList = PasswordManager.getInstance(this.jobProps).readPassword(jobFileList); for (String jobFile : SPLITTER.split(jobFileList)) { Path srcJobFile = new Path(jobFile); // Create a URI that is in the form path#symlink URI srcFileUri = URI.create(srcJobFile.toUri().getPath() + "#" + srcJobFile.getName()); LOG.info(String.format("Adding %s to DistributedCache", srcFileUri)); // Finally add the file to DistributedCache with a symlink named after the file name DistributedCache.addCacheFile(srcFileUri, conf); } }
java
@SuppressWarnings("deprecation") private void addHDFSFiles(String jobFileList, Configuration conf) { DistributedCache.createSymlink(conf); jobFileList = PasswordManager.getInstance(this.jobProps).readPassword(jobFileList); for (String jobFile : SPLITTER.split(jobFileList)) { Path srcJobFile = new Path(jobFile); // Create a URI that is in the form path#symlink URI srcFileUri = URI.create(srcJobFile.toUri().getPath() + "#" + srcJobFile.getName()); LOG.info(String.format("Adding %s to DistributedCache", srcFileUri)); // Finally add the file to DistributedCache with a symlink named after the file name DistributedCache.addCacheFile(srcFileUri, conf); } }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "private", "void", "addHDFSFiles", "(", "String", "jobFileList", ",", "Configuration", "conf", ")", "{", "DistributedCache", ".", "createSymlink", "(", "conf", ")", ";", "jobFileList", "=", "PasswordManager", "...
Add non-jar files already on HDFS that the job depends on to DistributedCache.
[ "Add", "non", "-", "jar", "files", "already", "on", "HDFS", "that", "the", "job", "depends", "on", "to", "DistributedCache", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/mapreduce/MRJobLauncher.java#L550-L562
apache/incubator-zipkin
zipkin-storage/cassandra-v1/src/main/java/zipkin2/storage/cassandra/v1/TimestampCodec.java
TimestampCodec.deserialize
public long deserialize(Row row, String name) { return 1000L * TypeCodec.bigint().deserialize(row.getBytesUnsafe(name), protocolVersion); }
java
public long deserialize(Row row, String name) { return 1000L * TypeCodec.bigint().deserialize(row.getBytesUnsafe(name), protocolVersion); }
[ "public", "long", "deserialize", "(", "Row", "row", ",", "String", "name", ")", "{", "return", "1000L", "*", "TypeCodec", ".", "bigint", "(", ")", ".", "deserialize", "(", "row", ".", "getBytesUnsafe", "(", "name", ")", ",", "protocolVersion", ")", ";", ...
Reads timestamp binary value directly (getBytesUnsafe) to avoid allocating java.util.Date, and converts to microseconds.
[ "Reads", "timestamp", "binary", "value", "directly", "(", "getBytesUnsafe", ")", "to", "avoid", "allocating", "java", ".", "util", ".", "Date", "and", "converts", "to", "microseconds", "." ]
train
https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/cassandra-v1/src/main/java/zipkin2/storage/cassandra/v1/TimestampCodec.java#L48-L50
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java
SyncGroupsInner.refreshHubSchemaAsync
public Observable<Void> refreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { return refreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> refreshHubSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { return refreshHubSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "refreshHubSchemaAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "syncGroupName", ")", "{", "return", "refreshHubSchemaWithServiceResponseAsync", "(", "resou...
Refreshes a hub database schema. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Refreshes", "a", "hub", "database", "schema", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java#L299-L306
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/component/PathOperationComponent.java
PathOperationComponent.buildOperationTitle
private void buildOperationTitle(MarkupDocBuilder markupDocBuilder, PathOperation operation) { buildOperationTitle(markupDocBuilder, operation.getTitle(), operation.getId()); if (operation.getTitle().equals(operation.getOperation().getSummary())) { markupDocBuilder.block(operation.getMethod() + " " + operation.getPath(), MarkupBlockStyle.LITERAL); } }
java
private void buildOperationTitle(MarkupDocBuilder markupDocBuilder, PathOperation operation) { buildOperationTitle(markupDocBuilder, operation.getTitle(), operation.getId()); if (operation.getTitle().equals(operation.getOperation().getSummary())) { markupDocBuilder.block(operation.getMethod() + " " + operation.getPath(), MarkupBlockStyle.LITERAL); } }
[ "private", "void", "buildOperationTitle", "(", "MarkupDocBuilder", "markupDocBuilder", ",", "PathOperation", "operation", ")", "{", "buildOperationTitle", "(", "markupDocBuilder", ",", "operation", ".", "getTitle", "(", ")", ",", "operation", ".", "getId", "(", ")",...
Adds the operation title to the document. If the operation has a summary, the title is the summary. Otherwise the title is the method of the operation and the URL of the operation. @param operation the Swagger Operation
[ "Adds", "the", "operation", "title", "to", "the", "document", ".", "If", "the", "operation", "has", "a", "summary", "the", "title", "is", "the", "summary", ".", "Otherwise", "the", "title", "is", "the", "method", "of", "the", "operation", "and", "the", "...
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/component/PathOperationComponent.java#L135-L140
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.registerObject
public void registerObject(final JsiiObjectRef objRef, final Object obj) { if (obj instanceof JsiiObject) { ((JsiiObject) obj).setObjRef(objRef); } this.objects.put(objRef.getObjId(), obj); }
java
public void registerObject(final JsiiObjectRef objRef, final Object obj) { if (obj instanceof JsiiObject) { ((JsiiObject) obj).setObjRef(objRef); } this.objects.put(objRef.getObjId(), obj); }
[ "public", "void", "registerObject", "(", "final", "JsiiObjectRef", "objRef", ",", "final", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "JsiiObject", ")", "{", "(", "(", "JsiiObject", ")", "obj", ")", ".", "setObjRef", "(", "objRef", ")", "...
Registers an object into the object cache. @param objRef The object reference. @param obj The object to register.
[ "Registers", "an", "object", "into", "the", "object", "cache", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L116-L121
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.putAsync
public <T> CompletableFuture<T> putAsync(final Class<T> type, final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> put(type, configuration), getExecutor()); }
java
public <T> CompletableFuture<T> putAsync(final Class<T> type, final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> put(type, configuration), getExecutor()); }
[ "public", "<", "T", ">", "CompletableFuture", "<", "T", ">", "putAsync", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "Consumer", "<", "HttpConfig", ">", "configuration", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(",...
Executes an asynchronous PUT request on the configured URI (asynchronous alias to `put(Class,Consumer)`), with additional configuration provided by the configuration function. The result will be cast to the specified `type`. This method is generally used for Java-specific configuration. [source,groovy] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); CompletableFuture<String> future = http.putAsync(String.class, config -> { config.getRequest().getUri().setPath("/foo"); }); String result = future.get(); ---- The `configuration` {@link Consumer} allows additional configuration for this request based on the {@link HttpConfig} interface. @param type the type of the response content @param configuration the additional configuration function (delegated to {@link HttpConfig}) @return the resulting content cast to the specified type, wrapped in a {@link CompletableFuture}
[ "Executes", "an", "asynchronous", "PUT", "request", "on", "the", "configured", "URI", "(", "asynchronous", "alias", "to", "put", "(", "Class", "Consumer", ")", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "function", ".",...
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1081-L1083
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java
FilterInvoker.getStringMethodParam
protected String getStringMethodParam(String methodName, String paramKey, String defaultValue) { if (CommonUtils.isEmpty(configContext)) { return defaultValue; } String o = (String) configContext.get(buildMethodKey(methodName, paramKey)); if (o == null) { o = (String) configContext.get(paramKey); return o == null ? defaultValue : o; } else { return o; } }
java
protected String getStringMethodParam(String methodName, String paramKey, String defaultValue) { if (CommonUtils.isEmpty(configContext)) { return defaultValue; } String o = (String) configContext.get(buildMethodKey(methodName, paramKey)); if (o == null) { o = (String) configContext.get(paramKey); return o == null ? defaultValue : o; } else { return o; } }
[ "protected", "String", "getStringMethodParam", "(", "String", "methodName", ",", "String", "paramKey", ",", "String", "defaultValue", ")", "{", "if", "(", "CommonUtils", ".", "isEmpty", "(", "configContext", ")", ")", "{", "return", "defaultValue", ";", "}", "...
取得方法的特殊参数配置 @param methodName 方法名 @param paramKey 参数关键字 @param defaultValue 默认值 @return 都找不到为null string method param
[ "取得方法的特殊参数配置" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java#L161-L172
jimmoores/quandl4j
core/src/main/java/com/jimmoores/quandl/SearchResult.java
SearchResult.getMetaDataResultList
public List<MetaDataResult> getMetaDataResultList() { JSONArray jsonArray = null; try { jsonArray = _jsonObject.getJSONArray(DATASETS_ARRAY_FIELD); List<MetaDataResult> metaDataResults = new ArrayList<MetaDataResult>(jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { metaDataResults.add(MetaDataResult.of(jsonArray.getJSONObject(i))); } return metaDataResults; } catch (JSONException ex) { s_logger.error("Metadata had unexpected structure - could not extract datasets field, was:\n{}", _jsonObject.toString()); throw new QuandlRuntimeException("Metadata had unexpected structure", ex); } }
java
public List<MetaDataResult> getMetaDataResultList() { JSONArray jsonArray = null; try { jsonArray = _jsonObject.getJSONArray(DATASETS_ARRAY_FIELD); List<MetaDataResult> metaDataResults = new ArrayList<MetaDataResult>(jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { metaDataResults.add(MetaDataResult.of(jsonArray.getJSONObject(i))); } return metaDataResults; } catch (JSONException ex) { s_logger.error("Metadata had unexpected structure - could not extract datasets field, was:\n{}", _jsonObject.toString()); throw new QuandlRuntimeException("Metadata had unexpected structure", ex); } }
[ "public", "List", "<", "MetaDataResult", ">", "getMetaDataResultList", "(", ")", "{", "JSONArray", "jsonArray", "=", "null", ";", "try", "{", "jsonArray", "=", "_jsonObject", ".", "getJSONArray", "(", "DATASETS_ARRAY_FIELD", ")", ";", "List", "<", "MetaDataResul...
Extract a list of MetaDataResult objects, each one representing a match. Throws a QuandlRuntimeException if it cannot construct a valid HeaderDefinition @return the header definition, not null
[ "Extract", "a", "list", "of", "MetaDataResult", "objects", "each", "one", "representing", "a", "match", ".", "Throws", "a", "QuandlRuntimeException", "if", "it", "cannot", "construct", "a", "valid", "HeaderDefinition" ]
train
https://github.com/jimmoores/quandl4j/blob/5d67ae60279d889da93ae7aa3bf6b7d536f88822/core/src/main/java/com/jimmoores/quandl/SearchResult.java#L92-L105
ops4j/org.ops4j.pax.logging
pax-logging-service/src/main/java/org/apache/log4j/OsgiThrowableRenderer.java
OsgiThrowableRenderer.formatElement
private String formatElement(final StackTraceElement element, final Map<String, String> classMap) { StringBuilder buf = new StringBuilder("\tat "); buf.append(element); String className = element.getClassName(); String classDetails = classMap.get(className); if (classDetails == null) { try { Class<?> cls = findClass(className); classDetails = getClassDetail(cls); classMap.put(className, classDetails); } catch (Throwable th) { // Ignore } } if (classDetails != null) { buf.append(classDetails); } return buf.toString(); }
java
private String formatElement(final StackTraceElement element, final Map<String, String> classMap) { StringBuilder buf = new StringBuilder("\tat "); buf.append(element); String className = element.getClassName(); String classDetails = classMap.get(className); if (classDetails == null) { try { Class<?> cls = findClass(className); classDetails = getClassDetail(cls); classMap.put(className, classDetails); } catch (Throwable th) { // Ignore } } if (classDetails != null) { buf.append(classDetails); } return buf.toString(); }
[ "private", "String", "formatElement", "(", "final", "StackTraceElement", "element", ",", "final", "Map", "<", "String", ",", "String", ">", "classMap", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "\"\\tat \"", ")", ";", "buf", ".", "a...
Format one element from stack trace. @param element element, may not be null. @param classMap map of class name to location. @return string representation of element.
[ "Format", "one", "element", "from", "stack", "trace", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/OsgiThrowableRenderer.java#L161-L179
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java
Drawable.loadSpriteAnimated
public static SpriteAnimated loadSpriteAnimated(Media media, int horizontalFrames, int verticalFrames) { return new SpriteAnimatedImpl(getMediaDpi(media), horizontalFrames, verticalFrames); }
java
public static SpriteAnimated loadSpriteAnimated(Media media, int horizontalFrames, int verticalFrames) { return new SpriteAnimatedImpl(getMediaDpi(media), horizontalFrames, verticalFrames); }
[ "public", "static", "SpriteAnimated", "loadSpriteAnimated", "(", "Media", "media", ",", "int", "horizontalFrames", ",", "int", "verticalFrames", ")", "{", "return", "new", "SpriteAnimatedImpl", "(", "getMediaDpi", "(", "media", ")", ",", "horizontalFrames", ",", "...
Load an animated sprite from a file, giving horizontal and vertical frames. <p> Once created, sprite must call {@link SpriteAnimated#load()} before any other operations. </p> @param media The sprite media (must not be <code>null</code>). @param horizontalFrames The number of horizontal frames (must be strictly positive). @param verticalFrames The number of vertical frames (must be strictly positive). @return The loaded animated sprite. @throws LionEngineException If arguments are invalid or image cannot be read.
[ "Load", "an", "animated", "sprite", "from", "a", "file", "giving", "horizontal", "and", "vertical", "frames", ".", "<p", ">", "Once", "created", "sprite", "must", "call", "{", "@link", "SpriteAnimated#load", "()", "}", "before", "any", "other", "operations", ...
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java#L179-L182
dashorst/wicket-stuff-markup-validator
jing/src/main/java/com/thaiopensource/validate/nvdl/NvdlSchemaReceiverFactory.java
NvdlSchemaReceiverFactory.createSchemaReceiver
public SchemaReceiver createSchemaReceiver(String namespaceUri, PropertyMap properties) { if (!SchemaImpl.NVDL_URI.equals(namespaceUri)) return null; return new SchemaReceiverImpl(properties); }
java
public SchemaReceiver createSchemaReceiver(String namespaceUri, PropertyMap properties) { if (!SchemaImpl.NVDL_URI.equals(namespaceUri)) return null; return new SchemaReceiverImpl(properties); }
[ "public", "SchemaReceiver", "createSchemaReceiver", "(", "String", "namespaceUri", ",", "PropertyMap", "properties", ")", "{", "if", "(", "!", "SchemaImpl", ".", "NVDL_URI", ".", "equals", "(", "namespaceUri", ")", ")", "return", "null", ";", "return", "new", ...
Checks if the namespace is the NVDL namespace and if yes then it creates a schema receiver, otherwise returns null.
[ "Checks", "if", "the", "namespace", "is", "the", "NVDL", "namespace", "and", "if", "yes", "then", "it", "creates", "a", "schema", "receiver", "otherwise", "returns", "null", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/NvdlSchemaReceiverFactory.java#L16-L20
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLTemplates.java
SQLTemplates.serializeModifiers
protected void serializeModifiers(QueryMetadata metadata, SQLSerializer context) { QueryModifiers mod = metadata.getModifiers(); if (mod.getLimit() != null) { context.handle(limitTemplate, mod.getLimit()); } else if (limitRequired) { context.handle(limitTemplate, maxLimit); } if (mod.getOffset() != null) { context.handle(offsetTemplate, mod.getOffset()); } }
java
protected void serializeModifiers(QueryMetadata metadata, SQLSerializer context) { QueryModifiers mod = metadata.getModifiers(); if (mod.getLimit() != null) { context.handle(limitTemplate, mod.getLimit()); } else if (limitRequired) { context.handle(limitTemplate, maxLimit); } if (mod.getOffset() != null) { context.handle(offsetTemplate, mod.getOffset()); } }
[ "protected", "void", "serializeModifiers", "(", "QueryMetadata", "metadata", ",", "SQLSerializer", "context", ")", "{", "QueryModifiers", "mod", "=", "metadata", ".", "getModifiers", "(", ")", ";", "if", "(", "mod", ".", "getLimit", "(", ")", "!=", "null", "...
template method for LIMIT and OFFSET serialization @param metadata @param context
[ "template", "method", "for", "LIMIT", "and", "OFFSET", "serialization" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLTemplates.java#L967-L977
JodaOrg/joda-time
src/main/java/org/joda/time/YearMonth.java
YearMonth.readResolve
private Object readResolve() { if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) { return new YearMonth(this, getChronology().withUTC()); } return this; }
java
private Object readResolve() { if (DateTimeZone.UTC.equals(getChronology().getZone()) == false) { return new YearMonth(this, getChronology().withUTC()); } return this; }
[ "private", "Object", "readResolve", "(", ")", "{", "if", "(", "DateTimeZone", ".", "UTC", ".", "equals", "(", "getChronology", "(", ")", ".", "getZone", "(", ")", ")", "==", "false", ")", "{", "return", "new", "YearMonth", "(", "this", ",", "getChronol...
Handle broken serialization from other tools. @return the resolved object, not null
[ "Handle", "broken", "serialization", "from", "other", "tools", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/YearMonth.java#L371-L376
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/BsonGenerator.java
BsonGenerator.writeJavaScript
public void writeJavaScript(JavaScript javaScript, SerializerProvider provider) throws IOException { _writeArrayFieldNameIfNeeded(); _verifyValueWrite("write javascript"); if (javaScript.getScope() == null) { _buffer.putByte(_typeMarker, BsonConstants.TYPE_JAVASCRIPT); _writeString(javaScript.getCode()); } else { _buffer.putByte(_typeMarker, BsonConstants.TYPE_JAVASCRIPT_WITH_SCOPE); // reserve space for the entire structure size int p = _buffer.size(); _buffer.putInt(0); // write the code _writeString(javaScript.getCode()); nextObjectIsEmbeddedInValue = true; // write the document provider.findValueSerializer(Map.class, null).serialize(javaScript.getScope(), this, provider); // write the length if (!isEnabled(Feature.ENABLE_STREAMING)) { int l = _buffer.size() - p; _buffer.putInt(p, l); } } flushBuffer(); }
java
public void writeJavaScript(JavaScript javaScript, SerializerProvider provider) throws IOException { _writeArrayFieldNameIfNeeded(); _verifyValueWrite("write javascript"); if (javaScript.getScope() == null) { _buffer.putByte(_typeMarker, BsonConstants.TYPE_JAVASCRIPT); _writeString(javaScript.getCode()); } else { _buffer.putByte(_typeMarker, BsonConstants.TYPE_JAVASCRIPT_WITH_SCOPE); // reserve space for the entire structure size int p = _buffer.size(); _buffer.putInt(0); // write the code _writeString(javaScript.getCode()); nextObjectIsEmbeddedInValue = true; // write the document provider.findValueSerializer(Map.class, null).serialize(javaScript.getScope(), this, provider); // write the length if (!isEnabled(Feature.ENABLE_STREAMING)) { int l = _buffer.size() - p; _buffer.putInt(p, l); } } flushBuffer(); }
[ "public", "void", "writeJavaScript", "(", "JavaScript", "javaScript", ",", "SerializerProvider", "provider", ")", "throws", "IOException", "{", "_writeArrayFieldNameIfNeeded", "(", ")", ";", "_verifyValueWrite", "(", "\"write javascript\"", ")", ";", "if", "(", "javaS...
Write a BSON JavaScript object @param javaScript The javaScript to write @param provider The serializer provider, for serializing the scope @throws IOException If an error occurred in the stream while writing
[ "Write", "a", "BSON", "JavaScript", "object" ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/BsonGenerator.java#L747-L772
kohsuke/args4j
args4j/src/org/kohsuke/args4j/OptionHandlerRegistry.java
OptionHandlerRegistry.registerHandler
public void registerHandler( Class valueType, Class<? extends OptionHandler> handlerClass ) { checkNonNull(valueType, "valueType"); checkNonNull(handlerClass, "handlerClass"); if(!OptionHandler.class.isAssignableFrom(handlerClass)) throw new IllegalArgumentException(Messages.NO_OPTIONHANDLER.format()); handlers.put(valueType, new DefaultConstructorHandlerFactory(handlerClass)); }
java
public void registerHandler( Class valueType, Class<? extends OptionHandler> handlerClass ) { checkNonNull(valueType, "valueType"); checkNonNull(handlerClass, "handlerClass"); if(!OptionHandler.class.isAssignableFrom(handlerClass)) throw new IllegalArgumentException(Messages.NO_OPTIONHANDLER.format()); handlers.put(valueType, new DefaultConstructorHandlerFactory(handlerClass)); }
[ "public", "void", "registerHandler", "(", "Class", "valueType", ",", "Class", "<", "?", "extends", "OptionHandler", ">", "handlerClass", ")", "{", "checkNonNull", "(", "valueType", ",", "\"valueType\"", ")", ";", "checkNonNull", "(", "handlerClass", ",", "\"hand...
Registers a user-defined {@link OptionHandler} class with args4j. <p> This method allows users to extend the behavior of args4j by writing their own {@link OptionHandler} implementation. @param valueType The specified handler is used when the field/method annotated by {@link Option} is of this type. @param handlerClass This class must have the constructor that has the same signature as {@link OptionHandler#OptionHandler(CmdLineParser, OptionDef, Setter)} @throws NullPointerException if {@code valueType} or {@code handlerClass} is {@code null}. @throws IllegalArgumentException if {@code handlerClass} is not a subtype of {@code OptionHandler}.
[ "Registers", "a", "user", "-", "defined", "{", "@link", "OptionHandler", "}", "class", "with", "args4j", "." ]
train
https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/OptionHandlerRegistry.java#L131-L139
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/VertexDescription.java
VertexDescription.isDefaultValue
public static boolean isDefaultValue(int semantics, double v) { return NumberUtils.doubleToInt64Bits(_defaultValues[semantics]) == NumberUtils .doubleToInt64Bits(v); }
java
public static boolean isDefaultValue(int semantics, double v) { return NumberUtils.doubleToInt64Bits(_defaultValues[semantics]) == NumberUtils .doubleToInt64Bits(v); }
[ "public", "static", "boolean", "isDefaultValue", "(", "int", "semantics", ",", "double", "v", ")", "{", "return", "NumberUtils", ".", "doubleToInt64Bits", "(", "_defaultValues", "[", "semantics", "]", ")", "==", "NumberUtils", ".", "doubleToInt64Bits", "(", "v",...
Checks if the given value is the default one. The simple equality test with GetDefaultValue does not work due to the use of NaNs as default value for some parameters.
[ "Checks", "if", "the", "given", "value", "is", "the", "default", "one", ".", "The", "simple", "equality", "test", "with", "GetDefaultValue", "does", "not", "work", "due", "to", "the", "use", "of", "NaNs", "as", "default", "value", "for", "some", "parameter...
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/VertexDescription.java#L257-L260
dkharrat/NexusDialog
nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/FormSectionController.java
FormSectionController.addElement
public FormElementController addElement(FormElementController element, int position) { if (element instanceof FormSectionController) { throw new IllegalArgumentException("Sub-sections are not supported"); } if (elements.containsKey(element.getName())) { throw new IllegalArgumentException("Element with that name already exists"); } else { elements.put(element.getName(), element); orderedElements.add(position, element); return element; } }
java
public FormElementController addElement(FormElementController element, int position) { if (element instanceof FormSectionController) { throw new IllegalArgumentException("Sub-sections are not supported"); } if (elements.containsKey(element.getName())) { throw new IllegalArgumentException("Element with that name already exists"); } else { elements.put(element.getName(), element); orderedElements.add(position, element); return element; } }
[ "public", "FormElementController", "addElement", "(", "FormElementController", "element", ",", "int", "position", ")", "{", "if", "(", "element", "instanceof", "FormSectionController", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Sub-sections are not supp...
Adds a form element to this section. Note that sub-sections are not supported. @param element the form element to add @param position the position at which to insert the element @return the same instance of the form element that was added to support method chaining
[ "Adds", "a", "form", "element", "to", "this", "section", ".", "Note", "that", "sub", "-", "sections", "are", "not", "supported", "." ]
train
https://github.com/dkharrat/NexusDialog/blob/f43a6a07940cced12286c622140f3a8ae3d178a1/nexusdialog/src/main/java/com/github/dkharrat/nexusdialog/controllers/FormSectionController.java#L75-L87
cdk/cdk
base/silent/src/main/java/org/openscience/cdk/silent/BioPolymer.java
BioPolymer.getMonomer
@Override public IMonomer getMonomer(String monName, String strandName) { Strand strand = (Strand) strands.get(strandName); if (strand != null) { return (Monomer) strand.getMonomer(monName); } else { return null; } }
java
@Override public IMonomer getMonomer(String monName, String strandName) { Strand strand = (Strand) strands.get(strandName); if (strand != null) { return (Monomer) strand.getMonomer(monName); } else { return null; } }
[ "@", "Override", "public", "IMonomer", "getMonomer", "(", "String", "monName", ",", "String", "strandName", ")", "{", "Strand", "strand", "=", "(", "Strand", ")", "strands", ".", "get", "(", "strandName", ")", ";", "if", "(", "strand", "!=", "null", ")",...
Retrieves a Monomer object by specifying its name. [You have to specify the strand to enable monomers with the same name in different strands. There is at least one such case: every strand contains a monomer called "".] @param monName The name of the monomer to look for @return The Monomer object which was asked for
[ "Retrieves", "a", "Monomer", "object", "by", "specifying", "its", "name", ".", "[", "You", "have", "to", "specify", "the", "strand", "to", "enable", "monomers", "with", "the", "same", "name", "in", "different", "strands", ".", "There", "is", "at", "least",...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/BioPolymer.java#L163-L172
duracloud/duracloud
storageprovider/src/main/java/org/duracloud/storage/util/StorageProviderUtil.java
StorageProviderUtil.compareChecksum
public static String compareChecksum(String providerChecksum, String spaceId, String contentId, String checksum) throws ChecksumMismatchException { if (!providerChecksum.equals(checksum)) { String err = "Content " + contentId + " was added to space " + spaceId + " but the checksum, either provided or computed " + "enroute, (" + checksum + ") does not match the checksum " + "computed by the storage provider (" + providerChecksum + "). This content should be retransmitted."; log.warn(err); throw new ChecksumMismatchException(err, NO_RETRY); } return providerChecksum; }
java
public static String compareChecksum(String providerChecksum, String spaceId, String contentId, String checksum) throws ChecksumMismatchException { if (!providerChecksum.equals(checksum)) { String err = "Content " + contentId + " was added to space " + spaceId + " but the checksum, either provided or computed " + "enroute, (" + checksum + ") does not match the checksum " + "computed by the storage provider (" + providerChecksum + "). This content should be retransmitted."; log.warn(err); throw new ChecksumMismatchException(err, NO_RETRY); } return providerChecksum; }
[ "public", "static", "String", "compareChecksum", "(", "String", "providerChecksum", ",", "String", "spaceId", ",", "String", "contentId", ",", "String", "checksum", ")", "throws", "ChecksumMismatchException", "{", "if", "(", "!", "providerChecksum", ".", "equals", ...
Determines if two checksum values are equal @param providerChecksum The checksum provided by the StorageProvider @param spaceId The Space in which the content was stored @param contentId The Id of the content @param checksum The content checksum, either provided or computed @throws ChecksumMismatchException if the included checksum does not match the storage provider generated checksum @returns the validated checksum value from the provider
[ "Determines", "if", "two", "checksum", "values", "are", "equal" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/storageprovider/src/main/java/org/duracloud/storage/util/StorageProviderUtil.java#L139-L154
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java
SARLFormatter._format
protected void _format(SarlRequiredCapacity requiredCapacity, IFormattableDocument document) { final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(requiredCapacity); document.append(regionFor.keyword(this.keywords.getRequiresKeyword()), ONE_SPACE); formatCommaSeparatedList(requiredCapacity.getCapacities(), document); document.prepend(regionFor.keyword(this.keywords.getSemicolonKeyword()), NO_SPACE); }
java
protected void _format(SarlRequiredCapacity requiredCapacity, IFormattableDocument document) { final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(requiredCapacity); document.append(regionFor.keyword(this.keywords.getRequiresKeyword()), ONE_SPACE); formatCommaSeparatedList(requiredCapacity.getCapacities(), document); document.prepend(regionFor.keyword(this.keywords.getSemicolonKeyword()), NO_SPACE); }
[ "protected", "void", "_format", "(", "SarlRequiredCapacity", "requiredCapacity", ",", "IFormattableDocument", "document", ")", "{", "final", "ISemanticRegionsFinder", "regionFor", "=", "this", ".", "textRegionExtensions", ".", "regionFor", "(", "requiredCapacity", ")", ...
Format a required capacity. @param requiredCapacity the element ot format. @param document the document.
[ "Format", "a", "required", "capacity", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java#L487-L492
getsentry/sentry-java
sentry/src/main/java/io/sentry/event/interfaces/SentryException.java
SentryException.extractExceptionQueue
public static Deque<SentryException> extractExceptionQueue(Throwable throwable) { Deque<SentryException> exceptions = new ArrayDeque<>(); Set<Throwable> circularityDetector = new HashSet<>(); StackTraceElement[] childExceptionStackTrace = new StackTraceElement[0]; //Stack the exceptions to send them in the reverse order while (throwable != null && circularityDetector.add(throwable)) { exceptions.add(new SentryException(throwable, childExceptionStackTrace)); childExceptionStackTrace = throwable.getStackTrace(); throwable = throwable.getCause(); } return exceptions; }
java
public static Deque<SentryException> extractExceptionQueue(Throwable throwable) { Deque<SentryException> exceptions = new ArrayDeque<>(); Set<Throwable> circularityDetector = new HashSet<>(); StackTraceElement[] childExceptionStackTrace = new StackTraceElement[0]; //Stack the exceptions to send them in the reverse order while (throwable != null && circularityDetector.add(throwable)) { exceptions.add(new SentryException(throwable, childExceptionStackTrace)); childExceptionStackTrace = throwable.getStackTrace(); throwable = throwable.getCause(); } return exceptions; }
[ "public", "static", "Deque", "<", "SentryException", ">", "extractExceptionQueue", "(", "Throwable", "throwable", ")", "{", "Deque", "<", "SentryException", ">", "exceptions", "=", "new", "ArrayDeque", "<>", "(", ")", ";", "Set", "<", "Throwable", ">", "circul...
Transforms a {@link Throwable} into a Queue of {@link SentryException}. <p> Exceptions are stored in the queue from the most recent one to the oldest one. @param throwable throwable to transform in a queue of exceptions. @return a queue of exception with StackTrace.
[ "Transforms", "a", "{", "@link", "Throwable", "}", "into", "a", "Queue", "of", "{", "@link", "SentryException", "}", ".", "<p", ">", "Exceptions", "are", "stored", "in", "the", "queue", "from", "the", "most", "recent", "one", "to", "the", "oldest", "one"...
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/event/interfaces/SentryException.java#L70-L83
venmo/cursor-utils
cursor-utils/src/main/java/com/venmo/cursor/IterableCursorWrapper.java
IterableCursorWrapper.getShort
public short getShort(String columnName, short defaultValue) { int index = getColumnIndex(columnName); if (isValidIndex(index)) { return getShort(index); } else { return defaultValue; } }
java
public short getShort(String columnName, short defaultValue) { int index = getColumnIndex(columnName); if (isValidIndex(index)) { return getShort(index); } else { return defaultValue; } }
[ "public", "short", "getShort", "(", "String", "columnName", ",", "short", "defaultValue", ")", "{", "int", "index", "=", "getColumnIndex", "(", "columnName", ")", ";", "if", "(", "isValidIndex", "(", "index", ")", ")", "{", "return", "getShort", "(", "inde...
Convenience alias to {@code getShort\(getColumnIndex(columnName))}. If the column does not exist for the cursor, return {@code defaultValue}.
[ "Convenience", "alias", "to", "{" ]
train
https://github.com/venmo/cursor-utils/blob/52cf91c4253346632fe70b8d7b7eab8bbcc9b248/cursor-utils/src/main/java/com/venmo/cursor/IterableCursorWrapper.java#L190-L197
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BeanPropertyName.java
BeanPropertyName.toDashedForm
public static String toDashedForm(String name, int start) { StringBuilder result = new StringBuilder(); String replaced = name.replace('_', '-'); for (int i = start; i < replaced.length(); i++) { char ch = replaced.charAt(i); if (Character.isUpperCase(ch) && result.length() > 0 && result.charAt(result.length() - 1) != '-') { result.append('-'); } result.append(Character.toLowerCase(ch)); } return result.toString(); }
java
public static String toDashedForm(String name, int start) { StringBuilder result = new StringBuilder(); String replaced = name.replace('_', '-'); for (int i = start; i < replaced.length(); i++) { char ch = replaced.charAt(i); if (Character.isUpperCase(ch) && result.length() > 0 && result.charAt(result.length() - 1) != '-') { result.append('-'); } result.append(Character.toLowerCase(ch)); } return result.toString(); }
[ "public", "static", "String", "toDashedForm", "(", "String", "name", ",", "int", "start", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "String", "replaced", "=", "name", ".", "replace", "(", "'", "'", ",", "'", "'", ...
Return the specified Java Bean property name in dashed form. @param name the source name @param start the starting char @return the dashed from
[ "Return", "the", "specified", "Java", "Bean", "property", "name", "in", "dashed", "form", "." ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/BeanPropertyName.java#L45-L57
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java
AbstractHBCIJob.saveReturnValues
protected void saveReturnValues(HBCIMsgStatus status, int sref) { List<HBCIRetVal> retVals = status.segStatus.getRetVals(); String segref = Integer.toString(sref); retVals.forEach(retVal -> { if (retVal.segref != null && retVal.segref.equals(segref)) { jobResult.jobStatus.addRetVal(retVal); } }); /* bei Jobs, die mehrere Nachrichten benötigt haben, bewirkt das, dass nur * der globStatus der *letzten* ausgeführten Nachricht gespeichert wird. * Das ist aber auch ok, weil nach einem Fehler keine weiteren Nachrichten * ausgeführt werden, so dass im Fehlerfall der fehlerhafte globStatus zur * Verfügung steht. Im OK-Fall werden höchstens die OK-Meldungen der vorherigen * Nachrichten überschrieben. */ jobResult.globStatus = status.globStatus; }
java
protected void saveReturnValues(HBCIMsgStatus status, int sref) { List<HBCIRetVal> retVals = status.segStatus.getRetVals(); String segref = Integer.toString(sref); retVals.forEach(retVal -> { if (retVal.segref != null && retVal.segref.equals(segref)) { jobResult.jobStatus.addRetVal(retVal); } }); /* bei Jobs, die mehrere Nachrichten benötigt haben, bewirkt das, dass nur * der globStatus der *letzten* ausgeführten Nachricht gespeichert wird. * Das ist aber auch ok, weil nach einem Fehler keine weiteren Nachrichten * ausgeführt werden, so dass im Fehlerfall der fehlerhafte globStatus zur * Verfügung steht. Im OK-Fall werden höchstens die OK-Meldungen der vorherigen * Nachrichten überschrieben. */ jobResult.globStatus = status.globStatus; }
[ "protected", "void", "saveReturnValues", "(", "HBCIMsgStatus", "status", ",", "int", "sref", ")", "{", "List", "<", "HBCIRetVal", ">", "retVals", "=", "status", ".", "segStatus", ".", "getRetVals", "(", ")", ";", "String", "segref", "=", "Integer", ".", "t...
/* speichert die HBCI-Rückgabewerte für diesen GV im outStore ab. Dazu werden alle RetSegs durchgesehen; diejenigen, die den aktuellen GV betreffen, werden im @c data Property unter dem namen @c ret_i.* gespeichert. @i entspricht dabei dem @c retValCounter.
[ "/", "*", "speichert", "die", "HBCI", "-", "Rückgabewerte", "für", "diesen", "GV", "im", "outStore", "ab", ".", "Dazu", "werden", "alle", "RetSegs", "durchgesehen", ";", "diejenigen", "die", "den", "aktuellen", "GV", "betreffen", "werden", "im" ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java#L774-L791
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java
GeometryCoordinateDimension.convert
public static LinearRing convert(LinearRing linearRing,int dimension) { return gf.createLinearRing(convertSequence(linearRing.getCoordinates(),dimension)); }
java
public static LinearRing convert(LinearRing linearRing,int dimension) { return gf.createLinearRing(convertSequence(linearRing.getCoordinates(),dimension)); }
[ "public", "static", "LinearRing", "convert", "(", "LinearRing", "linearRing", ",", "int", "dimension", ")", "{", "return", "gf", ".", "createLinearRing", "(", "convertSequence", "(", "linearRing", ".", "getCoordinates", "(", ")", ",", "dimension", ")", ")", ";...
Force the dimension of the LinearRing and update correctly the coordinate dimension @param linearRing @param dimension @return
[ "Force", "the", "dimension", "of", "the", "LinearRing", "and", "update", "correctly", "the", "coordinate", "dimension" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/GeometryCoordinateDimension.java#L154-L156
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java
EJBMDOrchestrator.dealWithUnsatisfiedXMLTimers
private String dealWithUnsatisfiedXMLTimers(Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> xmlTimers, BeanMetaData bmd) throws EJBConfigurationException { String mostRecentMethodWithError = null; for (Map.Entry<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> entry : xmlTimers.entrySet()) { for (com.ibm.ws.javaee.dd.ejb.Timer timer : entry.getValue()) { String methodName = timer.getTimeoutMethod().getMethodName(); Tr.error(tc, "AUTOMATIC_TIMER_METHOD_NOT_FOUND_CNTR0210E", new Object[] { bmd.j2eeName.getComponent(), bmd.j2eeName.getModule(), methodName }); mostRecentMethodWithError = methodName; } } return mostRecentMethodWithError; }
java
private String dealWithUnsatisfiedXMLTimers(Map<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> xmlTimers, BeanMetaData bmd) throws EJBConfigurationException { String mostRecentMethodWithError = null; for (Map.Entry<String, List<com.ibm.ws.javaee.dd.ejb.Timer>> entry : xmlTimers.entrySet()) { for (com.ibm.ws.javaee.dd.ejb.Timer timer : entry.getValue()) { String methodName = timer.getTimeoutMethod().getMethodName(); Tr.error(tc, "AUTOMATIC_TIMER_METHOD_NOT_FOUND_CNTR0210E", new Object[] { bmd.j2eeName.getComponent(), bmd.j2eeName.getModule(), methodName }); mostRecentMethodWithError = methodName; } } return mostRecentMethodWithError; }
[ "private", "String", "dealWithUnsatisfiedXMLTimers", "(", "Map", "<", "String", ",", "List", "<", "com", ".", "ibm", ".", "ws", ".", "javaee", ".", "dd", ".", "ejb", ".", "Timer", ">", ">", "xmlTimers", ",", "BeanMetaData", "bmd", ")", "throws", "EJBConf...
Verifies that all timers of a certain parm type (1, 0, or unspecified parm) were successfully mapped to a Method. @param xmlTimers List of Timer instances representing timers defined in xml. @param bmd BeanMetaData @return @throws EJBConfigurationException
[ "Verifies", "that", "all", "timers", "of", "a", "certain", "parm", "type", "(", "1", "0", "or", "unspecified", "parm", ")", "were", "successfully", "mapped", "to", "a", "Method", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/EJBMDOrchestrator.java#L5293-L5305
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java
FileWriter.write
public File write(byte[] data, int off, int len, boolean isAppend) throws IORuntimeException { FileOutputStream out = null; try { out = new FileOutputStream(FileUtil.touch(file), isAppend); out.write(data, off, len); out.flush(); }catch(IOException e){ throw new IORuntimeException(e); } finally { IoUtil.close(out); } return file; }
java
public File write(byte[] data, int off, int len, boolean isAppend) throws IORuntimeException { FileOutputStream out = null; try { out = new FileOutputStream(FileUtil.touch(file), isAppend); out.write(data, off, len); out.flush(); }catch(IOException e){ throw new IORuntimeException(e); } finally { IoUtil.close(out); } return file; }
[ "public", "File", "write", "(", "byte", "[", "]", "data", ",", "int", "off", ",", "int", "len", ",", "boolean", "isAppend", ")", "throws", "IORuntimeException", "{", "FileOutputStream", "out", "=", "null", ";", "try", "{", "out", "=", "new", "FileOutputS...
写入数据到文件 @param data 数据 @param off 数据开始位置 @param len 数据长度 @param isAppend 是否追加模式 @return 目标文件 @throws IORuntimeException IO异常
[ "写入数据到文件" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileWriter.java#L287-L299
liyiorg/weixin-popular
src/main/java/weixin/popular/api/PayMchAPI.java
PayMchAPI.payDownloadfundflow
public static PayDownloadfundflowResult payDownloadfundflow(PayDownloadfundflow payDownloadfundflow,String key){ Map<String,String> map = MapUtil.objectToMap(payDownloadfundflow); String sign_type = map.get("sign_type"); //设置默认签名类型HMAC-SHA256 if(sign_type == null || "".equals(sign_type)){ sign_type = "HMAC-SHA256"; } String sign = SignatureUtil.generateSign(map,sign_type,key); payDownloadfundflow.setSign(sign); String xmlData = XMLConverUtil.convertToXML(payDownloadfundflow); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(xmlHeader) .setUri(baseURI()+ "/pay/downloadfundflow") .setEntity(new StringEntity(xmlData,Charset.forName("utf-8"))) .build(); return LocalHttpClient.keyStoreExecute(payDownloadfundflow.getMch_id(),httpUriRequest,new ResponseHandler<PayDownloadfundflowResult>() { @Override public PayDownloadfundflowResult handleResponse(HttpResponse response) throws ClientProtocolException, IOException { int status = response.getStatusLine().getStatusCode(); if (status >= 200 && status < 300) { HttpEntity entity = response.getEntity(); String str; //GZIP if (entity.getContentType().getValue().matches("(?i).*gzip.*")) { str = StreamUtils.copyToString(new GZIPInputStream(entity.getContent()), Charset.forName("UTF-8")); } else { str = EntityUtils.toString(entity, "utf-8"); } EntityUtils.consume(entity); if (str.matches(".*<xml>(.*|\\n)+</xml>.*")) { return XMLConverUtil.convertToObject(PayDownloadfundflowResult.class, str); } else { PayDownloadfundflowResult dr = new PayDownloadfundflowResult(); dr.setData(str); // 获取返回头数据 签名信息 Header headerDigest = response.getFirstHeader("Digest"); if (headerDigest != null) { String[] hkv = headerDigest.getValue().split("="); dr.setSign_type(hkv[0]); dr.setSign(hkv[1]); } return dr; } } else { throw new ClientProtocolException("Unexpected response status: " + status); } } }); }
java
public static PayDownloadfundflowResult payDownloadfundflow(PayDownloadfundflow payDownloadfundflow,String key){ Map<String,String> map = MapUtil.objectToMap(payDownloadfundflow); String sign_type = map.get("sign_type"); //设置默认签名类型HMAC-SHA256 if(sign_type == null || "".equals(sign_type)){ sign_type = "HMAC-SHA256"; } String sign = SignatureUtil.generateSign(map,sign_type,key); payDownloadfundflow.setSign(sign); String xmlData = XMLConverUtil.convertToXML(payDownloadfundflow); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(xmlHeader) .setUri(baseURI()+ "/pay/downloadfundflow") .setEntity(new StringEntity(xmlData,Charset.forName("utf-8"))) .build(); return LocalHttpClient.keyStoreExecute(payDownloadfundflow.getMch_id(),httpUriRequest,new ResponseHandler<PayDownloadfundflowResult>() { @Override public PayDownloadfundflowResult handleResponse(HttpResponse response) throws ClientProtocolException, IOException { int status = response.getStatusLine().getStatusCode(); if (status >= 200 && status < 300) { HttpEntity entity = response.getEntity(); String str; //GZIP if (entity.getContentType().getValue().matches("(?i).*gzip.*")) { str = StreamUtils.copyToString(new GZIPInputStream(entity.getContent()), Charset.forName("UTF-8")); } else { str = EntityUtils.toString(entity, "utf-8"); } EntityUtils.consume(entity); if (str.matches(".*<xml>(.*|\\n)+</xml>.*")) { return XMLConverUtil.convertToObject(PayDownloadfundflowResult.class, str); } else { PayDownloadfundflowResult dr = new PayDownloadfundflowResult(); dr.setData(str); // 获取返回头数据 签名信息 Header headerDigest = response.getFirstHeader("Digest"); if (headerDigest != null) { String[] hkv = headerDigest.getValue().split("="); dr.setSign_type(hkv[0]); dr.setSign(hkv[1]); } return dr; } } else { throw new ClientProtocolException("Unexpected response status: " + status); } } }); }
[ "public", "static", "PayDownloadfundflowResult", "payDownloadfundflow", "(", "PayDownloadfundflow", "payDownloadfundflow", ",", "String", "key", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "MapUtil", ".", "objectToMap", "(", "payDownloadfundflow", ...
下载资金账单<br> 商户可以通过该接口下载自2017年6月1日起 的历史资金流水账单。<br> 说明:<br> 1、资金账单中的数据反映的是商户微信账户资金变动情况;<br> 2、当日账单在次日上午9点开始生成,建议商户在上午10点以后获取;<br> 3、资金账单中涉及金额的字段单位为“元”。<br> @since 2.8.18 @param payDownloadfundflow payDownloadfundflow @param key key @return PayDownloadfundflowResult 对象,请求成功时包含以下数据:<br> data 文本表格数据 <br> sign_type 签名类型 <br> sign 签名
[ "下载资金账单<br", ">", "商户可以通过该接口下载自2017年6月1日起", "的历史资金流水账单。<br", ">", "说明:<br", ">", "1、资金账单中的数据反映的是商户微信账户资金变动情况;<br", ">", "2、当日账单在次日上午9点开始生成,建议商户在上午10点以后获取;<br", ">", "3、资金账单中涉及金额的字段单位为“元”。<br", ">" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/PayMchAPI.java#L315-L366
jenkinsci/jenkins
core/src/main/java/jenkins/util/FullDuplexHttpService.java
FullDuplexHttpService.download
public synchronized void download(StaplerRequest req, StaplerResponse rsp) throws InterruptedException, IOException { rsp.setStatus(HttpServletResponse.SC_OK); // server->client channel. // this is created first, and this controls the lifespan of the channel rsp.addHeader("Transfer-Encoding", "chunked"); OutputStream out = rsp.getOutputStream(); if (DIY_CHUNKING) { out = new ChunkedOutputStream(out); } // send something out so that the client will see the HTTP headers out.write(0); out.flush(); {// wait until we have the other channel long end = System.currentTimeMillis() + CONNECTION_TIMEOUT; while (upload == null && System.currentTimeMillis() < end) { LOGGER.log(Level.FINE, "Waiting for upload stream for {0}: {1}", new Object[] {uuid, this}); wait(1000); } if (upload == null) { throw new IOException("HTTP full-duplex channel timeout: " + uuid); } LOGGER.log(Level.FINE, "Received upload stream {0} for {1}: {2}", new Object[] {upload, uuid, this}); } try { run(upload, out); } finally { // publish that we are done completed = true; notify(); } }
java
public synchronized void download(StaplerRequest req, StaplerResponse rsp) throws InterruptedException, IOException { rsp.setStatus(HttpServletResponse.SC_OK); // server->client channel. // this is created first, and this controls the lifespan of the channel rsp.addHeader("Transfer-Encoding", "chunked"); OutputStream out = rsp.getOutputStream(); if (DIY_CHUNKING) { out = new ChunkedOutputStream(out); } // send something out so that the client will see the HTTP headers out.write(0); out.flush(); {// wait until we have the other channel long end = System.currentTimeMillis() + CONNECTION_TIMEOUT; while (upload == null && System.currentTimeMillis() < end) { LOGGER.log(Level.FINE, "Waiting for upload stream for {0}: {1}", new Object[] {uuid, this}); wait(1000); } if (upload == null) { throw new IOException("HTTP full-duplex channel timeout: " + uuid); } LOGGER.log(Level.FINE, "Received upload stream {0} for {1}: {2}", new Object[] {upload, uuid, this}); } try { run(upload, out); } finally { // publish that we are done completed = true; notify(); } }
[ "public", "synchronized", "void", "download", "(", "StaplerRequest", "req", ",", "StaplerResponse", "rsp", ")", "throws", "InterruptedException", ",", "IOException", "{", "rsp", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_OK", ")", ";", "// server->client...
This is where we send the data to the client. <p> If this connection is lost, we'll abort the channel.
[ "This", "is", "where", "we", "send", "the", "data", "to", "the", "client", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/FullDuplexHttpService.java#L85-L121
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.attributeValuesMatch
private boolean attributeValuesMatch(Set attributes, int runIndex1, int runIndex2) { Iterator iterator = attributes.iterator(); while (iterator.hasNext()) { Attribute key = (Attribute) iterator.next(); if (!valuesMatch(getAttribute(key, runIndex1), getAttribute(key, runIndex2))) { return false; } } return true; }
java
private boolean attributeValuesMatch(Set attributes, int runIndex1, int runIndex2) { Iterator iterator = attributes.iterator(); while (iterator.hasNext()) { Attribute key = (Attribute) iterator.next(); if (!valuesMatch(getAttribute(key, runIndex1), getAttribute(key, runIndex2))) { return false; } } return true; }
[ "private", "boolean", "attributeValuesMatch", "(", "Set", "attributes", ",", "int", "runIndex1", ",", "int", "runIndex2", ")", "{", "Iterator", "iterator", "=", "attributes", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")",...
returns whether all specified attributes have equal values in the runs with the given indices
[ "returns", "whether", "all", "specified", "attributes", "have", "equal", "values", "in", "the", "runs", "with", "the", "given", "indices" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L653-L662
icode/ameba
src/main/java/ameba/db/ebean/internal/ModelInterceptor.java
ModelInterceptor.applyRowCountHeader
public static void applyRowCountHeader(MultivaluedMap<String, Object> headerParams, Query query, FutureRowCount rowCount) { if (rowCount != null) { try { headerParams.putSingle(REQ_TOTAL_COUNT_HEADER_NAME, rowCount.get()); } catch (InterruptedException | ExecutionException e) { headerParams.putSingle(REQ_TOTAL_COUNT_HEADER_NAME, query.findCount()); } } }
java
public static void applyRowCountHeader(MultivaluedMap<String, Object> headerParams, Query query, FutureRowCount rowCount) { if (rowCount != null) { try { headerParams.putSingle(REQ_TOTAL_COUNT_HEADER_NAME, rowCount.get()); } catch (InterruptedException | ExecutionException e) { headerParams.putSingle(REQ_TOTAL_COUNT_HEADER_NAME, query.findCount()); } } }
[ "public", "static", "void", "applyRowCountHeader", "(", "MultivaluedMap", "<", "String", ",", "Object", ">", "headerParams", ",", "Query", "query", ",", "FutureRowCount", "rowCount", ")", "{", "if", "(", "rowCount", "!=", "null", ")", "{", "try", "{", "heade...
<p>applyRowCountHeader.</p> @param headerParams a {@link javax.ws.rs.core.MultivaluedMap} object. @param query a {@link io.ebean.Query} object. @param rowCount a {@link io.ebean.FutureRowCount} object.
[ "<p", ">", "applyRowCountHeader", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/internal/ModelInterceptor.java#L390-L398
WolfgangFahl/Mediawiki-Japi
src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java
WikiUser.getPropertyFile
public static File getPropertyFile(String wikiId) { String user = System.getProperty("user.name"); return getPropertyFile(wikiId, user); }
java
public static File getPropertyFile(String wikiId) { String user = System.getProperty("user.name"); return getPropertyFile(wikiId, user); }
[ "public", "static", "File", "getPropertyFile", "(", "String", "wikiId", ")", "{", "String", "user", "=", "System", ".", "getProperty", "(", "\"user.name\"", ")", ";", "return", "getPropertyFile", "(", "wikiId", ",", "user", ")", ";", "}" ]
get the propertyFile for the given wikiId @param wikiId @return the propertyFile
[ "get", "the", "propertyFile", "for", "the", "given", "wikiId" ]
train
https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java#L104-L107
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
DiagnosticsInner.executeSiteAnalysisSlotAsync
public Observable<DiagnosticAnalysisInner> executeSiteAnalysisSlotAsync(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName, String slot, DateTime startTime, DateTime endTime, String timeGrain) { return executeSiteAnalysisSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName, slot, startTime, endTime, timeGrain).map(new Func1<ServiceResponse<DiagnosticAnalysisInner>, DiagnosticAnalysisInner>() { @Override public DiagnosticAnalysisInner call(ServiceResponse<DiagnosticAnalysisInner> response) { return response.body(); } }); }
java
public Observable<DiagnosticAnalysisInner> executeSiteAnalysisSlotAsync(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName, String slot, DateTime startTime, DateTime endTime, String timeGrain) { return executeSiteAnalysisSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName, slot, startTime, endTime, timeGrain).map(new Func1<ServiceResponse<DiagnosticAnalysisInner>, DiagnosticAnalysisInner>() { @Override public DiagnosticAnalysisInner call(ServiceResponse<DiagnosticAnalysisInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DiagnosticAnalysisInner", ">", "executeSiteAnalysisSlotAsync", "(", "String", "resourceGroupName", ",", "String", "siteName", ",", "String", "diagnosticCategory", ",", "String", "analysisName", ",", "String", "slot", ",", "DateTime", "start...
Execute Analysis. Execute Analysis. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Category Name @param analysisName Analysis Resource Name @param slot Slot Name @param startTime Start Time @param endTime End Time @param timeGrain Time Grain @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DiagnosticAnalysisInner object
[ "Execute", "Analysis", ".", "Execute", "Analysis", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1995-L2002
alkacon/opencms-core
src-gwt/org/opencms/ade/contenteditor/client/CmsContentEditor.java
CmsContentEditor.saveAndDeleteEntities
public void saveAndDeleteEntities(final boolean clearOnSuccess, final I_CmsSimpleCallback<Boolean> callback) { final CmsEntity entity = m_entityBackend.getEntity(m_entityId); saveAndDeleteEntities(entity, new ArrayList<String>(m_deletedEntities), clearOnSuccess, callback); }
java
public void saveAndDeleteEntities(final boolean clearOnSuccess, final I_CmsSimpleCallback<Boolean> callback) { final CmsEntity entity = m_entityBackend.getEntity(m_entityId); saveAndDeleteEntities(entity, new ArrayList<String>(m_deletedEntities), clearOnSuccess, callback); }
[ "public", "void", "saveAndDeleteEntities", "(", "final", "boolean", "clearOnSuccess", ",", "final", "I_CmsSimpleCallback", "<", "Boolean", ">", "callback", ")", "{", "final", "CmsEntity", "entity", "=", "m_entityBackend", ".", "getEntity", "(", "m_entityId", ")", ...
Saves the given entities.<p> @param clearOnSuccess <code>true</code> to clear the VIE instance on success @param callback the call back command
[ "Saves", "the", "given", "entities", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/contenteditor/client/CmsContentEditor.java#L1025-L1029
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/css/CSSClassManager.java
CSSClassManager.updateStyleElement
public void updateStyleElement(Document document, Element style) { StringBuilder buf = new StringBuilder(); serialize(buf); Text cont = document.createTextNode(buf.toString()); while (style.hasChildNodes()) { style.removeChild(style.getFirstChild()); } style.appendChild(cont); }
java
public void updateStyleElement(Document document, Element style) { StringBuilder buf = new StringBuilder(); serialize(buf); Text cont = document.createTextNode(buf.toString()); while (style.hasChildNodes()) { style.removeChild(style.getFirstChild()); } style.appendChild(cont); }
[ "public", "void", "updateStyleElement", "(", "Document", "document", ",", "Element", "style", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "serialize", "(", "buf", ")", ";", "Text", "cont", "=", "document", ".", "createTextNo...
Update the text contents of an existing style element. @param document Document element (factory) @param style Style element
[ "Update", "the", "text", "contents", "of", "an", "existing", "style", "element", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/css/CSSClassManager.java#L192-L200
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/broker/SharedResourcesBrokerUtils.java
SharedResourcesBrokerUtils.isScopeAncestor
static <S extends ScopeType<S>> boolean isScopeAncestor(ScopeWrapper<S> scope, ScopeWrapper<S> possibleAncestor) { Queue<ScopeWrapper<S>> ancestors = new LinkedList<>(); ancestors.add(scope); while (true) { if (ancestors.isEmpty()) { return false; } if (ancestors.peek().equals(possibleAncestor)) { return true; } ancestors.addAll(ancestors.poll().getParentScopes()); } }
java
static <S extends ScopeType<S>> boolean isScopeAncestor(ScopeWrapper<S> scope, ScopeWrapper<S> possibleAncestor) { Queue<ScopeWrapper<S>> ancestors = new LinkedList<>(); ancestors.add(scope); while (true) { if (ancestors.isEmpty()) { return false; } if (ancestors.peek().equals(possibleAncestor)) { return true; } ancestors.addAll(ancestors.poll().getParentScopes()); } }
[ "static", "<", "S", "extends", "ScopeType", "<", "S", ">", ">", "boolean", "isScopeAncestor", "(", "ScopeWrapper", "<", "S", ">", "scope", ",", "ScopeWrapper", "<", "S", ">", "possibleAncestor", ")", "{", "Queue", "<", "ScopeWrapper", "<", "S", ">>", "an...
Determine if a {@link ScopeWrapper} is an ancestor of another {@link ScopeWrapper}.
[ "Determine", "if", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/broker/SharedResourcesBrokerUtils.java#L61-L73
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java
MaterialCutOut.setupCutOutPosition
protected void setupCutOutPosition(Element cutOut, Element relativeTo, int padding, boolean circle) { float top = relativeTo.getOffsetTop() - (Math.max($("html").scrollTop(), $("body").scrollTop())); float left = relativeTo.getAbsoluteLeft(); float width = relativeTo.getOffsetWidth(); float height = relativeTo.getOffsetHeight(); if (circle) { if (width != height) { float dif = width - height; if (width > height) { height += dif; top -= dif / 2; } else { dif = -dif; width += dif; left -= dif / 2; } } } top -= padding; left -= padding; width += padding * 2; height += padding * 2; $(cutOut).css("top", top + "px"); $(cutOut).css("left", left + "px"); $(cutOut).css("width", width + "px"); $(cutOut).css("height", height + "px"); }
java
protected void setupCutOutPosition(Element cutOut, Element relativeTo, int padding, boolean circle) { float top = relativeTo.getOffsetTop() - (Math.max($("html").scrollTop(), $("body").scrollTop())); float left = relativeTo.getAbsoluteLeft(); float width = relativeTo.getOffsetWidth(); float height = relativeTo.getOffsetHeight(); if (circle) { if (width != height) { float dif = width - height; if (width > height) { height += dif; top -= dif / 2; } else { dif = -dif; width += dif; left -= dif / 2; } } } top -= padding; left -= padding; width += padding * 2; height += padding * 2; $(cutOut).css("top", top + "px"); $(cutOut).css("left", left + "px"); $(cutOut).css("width", width + "px"); $(cutOut).css("height", height + "px"); }
[ "protected", "void", "setupCutOutPosition", "(", "Element", "cutOut", ",", "Element", "relativeTo", ",", "int", "padding", ",", "boolean", "circle", ")", "{", "float", "top", "=", "relativeTo", ".", "getOffsetTop", "(", ")", "-", "(", "Math", ".", "max", "...
Setups the cut out position when the screen changes size or is scrolled.
[ "Setups", "the", "cut", "out", "position", "when", "the", "screen", "changes", "size", "or", "is", "scrolled", "." ]
train
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java#L371-L401
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobStreamsInner.java
JobStreamsInner.get
public JobStreamInner get(String resourceGroupName, String automationAccountName, String jobId, String jobStreamId) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId, jobStreamId).toBlocking().single().body(); }
java
public JobStreamInner get(String resourceGroupName, String automationAccountName, String jobId, String jobStreamId) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId, jobStreamId).toBlocking().single().body(); }
[ "public", "JobStreamInner", "get", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "jobId", ",", "String", "jobStreamId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ...
Retrieve the job stream identified by job stream id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job id. @param jobStreamId The job stream id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JobStreamInner object if successful.
[ "Retrieve", "the", "job", "stream", "identified", "by", "job", "stream", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobStreamsInner.java#L86-L88
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java
AbstractSARLLaunchConfigurationDelegate.getProgramArguments
@Override @SuppressWarnings("checkstyle:variabledeclarationusagedistance") public final String getProgramArguments(ILaunchConfiguration configuration) throws CoreException { // The following line get the standard arguments final String standardProgramArguments = super.getProgramArguments(configuration); // Get the specific SRE arguments final ISREInstall sre = getSREInstallFor(configuration, this.configAccessor, cfg -> getJavaProject(cfg)); assert sre != null; return getProgramArguments(configuration, sre, standardProgramArguments); }
java
@Override @SuppressWarnings("checkstyle:variabledeclarationusagedistance") public final String getProgramArguments(ILaunchConfiguration configuration) throws CoreException { // The following line get the standard arguments final String standardProgramArguments = super.getProgramArguments(configuration); // Get the specific SRE arguments final ISREInstall sre = getSREInstallFor(configuration, this.configAccessor, cfg -> getJavaProject(cfg)); assert sre != null; return getProgramArguments(configuration, sre, standardProgramArguments); }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"checkstyle:variabledeclarationusagedistance\"", ")", "public", "final", "String", "getProgramArguments", "(", "ILaunchConfiguration", "configuration", ")", "throws", "CoreException", "{", "// The following line get the standard ar...
Replies the arguments of the program including the boot agent name. {@inheritDoc}
[ "Replies", "the", "arguments", "of", "the", "program", "including", "the", "boot", "agent", "name", ".", "{" ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java#L296-L307
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java
EvaluateRetrievalPerformance.computeDistances
private void computeDistances(ModifiableDoubleDBIDList nlist, DBIDIter query, final DistanceQuery<O> distQuery, Relation<O> relation) { nlist.clear(); O qo = relation.get(query); for(DBIDIter ri = relation.iterDBIDs(); ri.valid(); ri.advance()) { if(!includeSelf && DBIDUtil.equal(ri, query)) { continue; } double dist = distQuery.distance(qo, ri); if(dist != dist) { /* NaN */ dist = Double.POSITIVE_INFINITY; } nlist.add(dist, ri); } nlist.sort(); }
java
private void computeDistances(ModifiableDoubleDBIDList nlist, DBIDIter query, final DistanceQuery<O> distQuery, Relation<O> relation) { nlist.clear(); O qo = relation.get(query); for(DBIDIter ri = relation.iterDBIDs(); ri.valid(); ri.advance()) { if(!includeSelf && DBIDUtil.equal(ri, query)) { continue; } double dist = distQuery.distance(qo, ri); if(dist != dist) { /* NaN */ dist = Double.POSITIVE_INFINITY; } nlist.add(dist, ri); } nlist.sort(); }
[ "private", "void", "computeDistances", "(", "ModifiableDoubleDBIDList", "nlist", ",", "DBIDIter", "query", ",", "final", "DistanceQuery", "<", "O", ">", "distQuery", ",", "Relation", "<", "O", ">", "relation", ")", "{", "nlist", ".", "clear", "(", ")", ";", ...
Compute the distances to the neighbor objects. @param nlist Neighbor list (output) @param query Query object @param distQuery Distance function @param relation Data relation
[ "Compute", "the", "distances", "to", "the", "neighbor", "objects", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java#L244-L258
mcxiaoke/Android-Next
core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java
IOUtils.skipFully
public static void skipFully(Reader input, long toSkip) throws IOException { long skipped = skip(input, toSkip); if (skipped != toSkip) { throw new EOFException("Chars to skip: " + toSkip + " actual: " + skipped); } }
java
public static void skipFully(Reader input, long toSkip) throws IOException { long skipped = skip(input, toSkip); if (skipped != toSkip) { throw new EOFException("Chars to skip: " + toSkip + " actual: " + skipped); } }
[ "public", "static", "void", "skipFully", "(", "Reader", "input", ",", "long", "toSkip", ")", "throws", "IOException", "{", "long", "skipped", "=", "skip", "(", "input", ",", "toSkip", ")", ";", "if", "(", "skipped", "!=", "toSkip", ")", "{", "throw", "...
Skip the requested number of characters or fail if there are not enough left. <p/> This allows for the possibility that {@link Reader#skip(long)} may not skip as many characters as requested (most likely because of reaching EOF). @param input stream to skip @param toSkip the number of characters to skip @throws IOException if there is a problem reading the file @throws IllegalArgumentException if toSkip is negative @throws EOFException if the number of characters skipped was incorrect @see Reader#skip(long) @since 2.0
[ "Skip", "the", "requested", "number", "of", "characters", "or", "fail", "if", "there", "are", "not", "enough", "left", ".", "<p", "/", ">", "This", "allows", "for", "the", "possibility", "that", "{", "@link", "Reader#skip", "(", "long", ")", "}", "may", ...
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java#L869-L874
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/interestrate/products/LIBORBond.java
LIBORBond.getValue
@Override public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException { if(evaluationTime > maturity) { return new Scalar(0); } return model.getLIBOR(evaluationTime, evaluationTime, maturity).mult(maturity - evaluationTime).add(1.0).invert(); }
java
@Override public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException { if(evaluationTime > maturity) { return new Scalar(0); } return model.getLIBOR(evaluationTime, evaluationTime, maturity).mult(maturity - evaluationTime).add(1.0).invert(); }
[ "@", "Override", "public", "RandomVariable", "getValue", "(", "double", "evaluationTime", ",", "LIBORModelMonteCarloSimulationModel", "model", ")", "throws", "CalculationException", "{", "if", "(", "evaluationTime", ">", "maturity", ")", "{", "return", "new", "Scalar"...
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Note", ":", "For", "a", "lattice", "this", "is", "often", "the", "valu...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/LIBORBond.java#L43-L50
undera/jmeter-plugins
tools/synthesis/src/main/java/kg/apc/jmeter/vizualizers/SynthesisReportGui.java
SynthesisReportGui.getAllDataAsTable
public static DefaultTableModel getAllDataAsTable(ObjectTableModel model, Format[] formats, String[] columns) { final List<List<Object>> table = getAllTableData(model, formats); final DefaultTableModel tableModel = new DefaultTableModel(); for (String header : columns) { tableModel.addColumn(header); } for (List<Object> row : table) { tableModel.addRow(new Vector(row)); } return tableModel; }
java
public static DefaultTableModel getAllDataAsTable(ObjectTableModel model, Format[] formats, String[] columns) { final List<List<Object>> table = getAllTableData(model, formats); final DefaultTableModel tableModel = new DefaultTableModel(); for (String header : columns) { tableModel.addColumn(header); } for (List<Object> row : table) { tableModel.addRow(new Vector(row)); } return tableModel; }
[ "public", "static", "DefaultTableModel", "getAllDataAsTable", "(", "ObjectTableModel", "model", ",", "Format", "[", "]", "formats", ",", "String", "[", "]", "columns", ")", "{", "final", "List", "<", "List", "<", "Object", ">", ">", "table", "=", "getAllTabl...
Present data in javax.swing.table.DefaultTableModel form. @param model {@link ObjectTableModel} @param formats Array of {@link Format} array can contain null formatters in this case value is added as is @param columns Columns headers @return data in table form
[ "Present", "data", "in", "javax", ".", "swing", ".", "table", ".", "DefaultTableModel", "form", "." ]
train
https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/tools/synthesis/src/main/java/kg/apc/jmeter/vizualizers/SynthesisReportGui.java#L467-L481
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_PUT
public void billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_PUT(String billingAccount, String serviceName, Long conditionId, OvhEasyHuntingTimeConditions body) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_PUT(String billingAccount, String serviceName, Long conditionId, OvhEasyHuntingTimeConditions body) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "conditionId", ",", "OvhEasyHuntingTimeConditions", "body", ")", "throws", "IOException", "{", "Stri...
Alter this object properties REST: PUT /telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param conditionId [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3341-L3345
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/impl/FEELImpl.java
FEELImpl.newEvaluationContext
public EvaluationContextImpl newEvaluationContext(ClassLoader cl, Collection<FEELEventListener> listeners, Map<String, Object> inputVariables) { FEELEventListenersManager eventsManager = getEventsManager(listeners); EvaluationContextImpl ctx = new EvaluationContextImpl(cl, eventsManager, inputVariables.size()); if (customFrame.isPresent()) { ExecutionFrameImpl globalFrame = (ExecutionFrameImpl) ctx.pop(); ExecutionFrameImpl interveawedFrame = customFrame.get(); interveawedFrame.setParentFrame(ctx.peek()); globalFrame.setParentFrame(interveawedFrame); ctx.push(interveawedFrame); ctx.push(globalFrame); } ctx.setValues(inputVariables); return ctx; }
java
public EvaluationContextImpl newEvaluationContext(ClassLoader cl, Collection<FEELEventListener> listeners, Map<String, Object> inputVariables) { FEELEventListenersManager eventsManager = getEventsManager(listeners); EvaluationContextImpl ctx = new EvaluationContextImpl(cl, eventsManager, inputVariables.size()); if (customFrame.isPresent()) { ExecutionFrameImpl globalFrame = (ExecutionFrameImpl) ctx.pop(); ExecutionFrameImpl interveawedFrame = customFrame.get(); interveawedFrame.setParentFrame(ctx.peek()); globalFrame.setParentFrame(interveawedFrame); ctx.push(interveawedFrame); ctx.push(globalFrame); } ctx.setValues(inputVariables); return ctx; }
[ "public", "EvaluationContextImpl", "newEvaluationContext", "(", "ClassLoader", "cl", ",", "Collection", "<", "FEELEventListener", ">", "listeners", ",", "Map", "<", "String", ",", "Object", ">", "inputVariables", ")", "{", "FEELEventListenersManager", "eventsManager", ...
Creates a new EvaluationContext with the supplied classloader, and the supplied parameters listeners and inputVariables
[ "Creates", "a", "new", "EvaluationContext", "with", "the", "supplied", "classloader", "and", "the", "supplied", "parameters", "listeners", "and", "inputVariables" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/impl/FEELImpl.java#L177-L190
zaproxy/zaproxy
src/org/zaproxy/zap/view/StandardFieldsDialog.java
StandardFieldsDialog.createTabScrollable
protected JScrollPane createTabScrollable(String tabLabel, JPanel tabPanel) { return new JScrollPane(tabPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); }
java
protected JScrollPane createTabScrollable(String tabLabel, JPanel tabPanel) { return new JScrollPane(tabPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); }
[ "protected", "JScrollPane", "createTabScrollable", "(", "String", "tabLabel", ",", "JPanel", "tabPanel", ")", "{", "return", "new", "JScrollPane", "(", "tabPanel", ",", "JScrollPane", ".", "VERTICAL_SCROLLBAR_AS_NEEDED", ",", "JScrollPane", ".", "HORIZONTAL_SCROLLBAR_AS...
Creates and returns a {@link JScrollPane} for the given panel. Called when a tab is {@link #setTabScrollable(String, boolean) set to be scrollable}. <p> By default this method returns a {@code JScrollPane} that has the vertical and horizontal scrollbars shown as needed. @param tabLabel the label of the tab, as set during construction of the dialogue. @param tabPanel the panel of the tab that should be scrollable, never {@code null}. @return the JScrollPane @since 2.7.0
[ "Creates", "and", "returns", "a", "{", "@link", "JScrollPane", "}", "for", "the", "given", "panel", ".", "Called", "when", "a", "tab", "is", "{", "@link", "#setTabScrollable", "(", "String", "boolean", ")", "set", "to", "be", "scrollable", "}", ".", "<p"...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/StandardFieldsDialog.java#L1939-L1941
syphr42/prom
src/main/java/org/syphr/prom/PropertiesManager.java
PropertiesManager.getEnumProperty
public <E extends Enum<E>> E getEnumProperty(T property, Class<E> type) throws IllegalArgumentException { return Enum.valueOf(type, getProperty(property).toUpperCase()); }
java
public <E extends Enum<E>> E getEnumProperty(T property, Class<E> type) throws IllegalArgumentException { return Enum.valueOf(type, getProperty(property).toUpperCase()); }
[ "public", "<", "E", "extends", "Enum", "<", "E", ">", ">", "E", "getEnumProperty", "(", "T", "property", ",", "Class", "<", "E", ">", "type", ")", "throws", "IllegalArgumentException", "{", "return", "Enum", ".", "valueOf", "(", "type", ",", "getProperty...
Retrieve the value of the given property as an Enum constant of the given type.<br> <br> Note that this method requires the Enum constants to all have upper case names (following Java naming conventions). This allows for case insensitivity in the properties file. @param <E> the type of Enum that will be returned @param property the property to retrieve @param type the Enum type to which the property will be converted @return the Enum constant corresponding to the value of the given property @throws IllegalArgumentException if the current value is not a valid constant of the given type
[ "Retrieve", "the", "value", "of", "the", "given", "property", "as", "an", "Enum", "constant", "of", "the", "given", "type", ".", "<br", ">", "<br", ">", "Note", "that", "this", "method", "requires", "the", "Enum", "constants", "to", "all", "have", "upper...
train
https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/PropertiesManager.java#L582-L585
mcaserta/spring-crypto-utils
src/main/java/com/springcryptoutils/core/key/PublicKeyRegistryByAliasImpl.java
PublicKeyRegistryByAliasImpl.get
public PublicKey get(KeyStoreChooser keyStoreChooser, PublicKeyChooserByAlias publicKeyChooserByAlias) { CacheKey cacheKey = new CacheKey(keyStoreChooser.getKeyStoreName(), publicKeyChooserByAlias.getAlias()); PublicKey retrievedPublicKey = cache.get(cacheKey); if (retrievedPublicKey != null) { return retrievedPublicKey; } KeyStore keyStore = keyStoreRegistry.get(keyStoreChooser); if (keyStore != null) { PublicKeyFactoryBean factory = new PublicKeyFactoryBean(); factory.setKeystore(keyStore); factory.setAlias(publicKeyChooserByAlias.getAlias()); try { factory.afterPropertiesSet(); PublicKey publicKey = (PublicKey) factory.getObject(); if (publicKey != null) { cache.put(cacheKey, publicKey); } return publicKey; } catch (Exception e) { throw new PublicKeyException("error initializing the public key factory bean", e); } } return null; }
java
public PublicKey get(KeyStoreChooser keyStoreChooser, PublicKeyChooserByAlias publicKeyChooserByAlias) { CacheKey cacheKey = new CacheKey(keyStoreChooser.getKeyStoreName(), publicKeyChooserByAlias.getAlias()); PublicKey retrievedPublicKey = cache.get(cacheKey); if (retrievedPublicKey != null) { return retrievedPublicKey; } KeyStore keyStore = keyStoreRegistry.get(keyStoreChooser); if (keyStore != null) { PublicKeyFactoryBean factory = new PublicKeyFactoryBean(); factory.setKeystore(keyStore); factory.setAlias(publicKeyChooserByAlias.getAlias()); try { factory.afterPropertiesSet(); PublicKey publicKey = (PublicKey) factory.getObject(); if (publicKey != null) { cache.put(cacheKey, publicKey); } return publicKey; } catch (Exception e) { throw new PublicKeyException("error initializing the public key factory bean", e); } } return null; }
[ "public", "PublicKey", "get", "(", "KeyStoreChooser", "keyStoreChooser", ",", "PublicKeyChooserByAlias", "publicKeyChooserByAlias", ")", "{", "CacheKey", "cacheKey", "=", "new", "CacheKey", "(", "keyStoreChooser", ".", "getKeyStoreName", "(", ")", ",", "publicKeyChooser...
Returns the selected public key or null if not found. @param keyStoreChooser the keystore chooser @param publicKeyChooserByAlias the public key chooser by alias @return the selected public key or null if not found
[ "Returns", "the", "selected", "public", "key", "or", "null", "if", "not", "found", "." ]
train
https://github.com/mcaserta/spring-crypto-utils/blob/1dbf6211542fb1e3f9297941d691e7e89cc72c46/src/main/java/com/springcryptoutils/core/key/PublicKeyRegistryByAliasImpl.java#L53-L81
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
Configuration.getInteger
@PublicEvolving public int getInteger(ConfigOption<Integer> configOption, int overrideDefault) { Object o = getRawValueFromOption(configOption); if (o == null) { return overrideDefault; } return convertToInt(o, configOption.defaultValue()); }
java
@PublicEvolving public int getInteger(ConfigOption<Integer> configOption, int overrideDefault) { Object o = getRawValueFromOption(configOption); if (o == null) { return overrideDefault; } return convertToInt(o, configOption.defaultValue()); }
[ "@", "PublicEvolving", "public", "int", "getInteger", "(", "ConfigOption", "<", "Integer", ">", "configOption", ",", "int", "overrideDefault", ")", "{", "Object", "o", "=", "getRawValueFromOption", "(", "configOption", ")", ";", "if", "(", "o", "==", "null", ...
Returns the value associated with the given config option as an integer. If no value is mapped under any key of the option, it returns the specified default instead of the option's default value. @param configOption The configuration option @param overrideDefault The value to return if no value was mapper for any key of the option @return the configured value associated with the given config option, or the overrideDefault
[ "Returns", "the", "value", "associated", "with", "the", "given", "config", "option", "as", "an", "integer", ".", "If", "no", "value", "is", "mapped", "under", "any", "key", "of", "the", "option", "it", "returns", "the", "specified", "default", "instead", "...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L234-L241
podio/podio-java
src/main/java/com/podio/app/AppAPI.java
AppAPI.getField
public ApplicationField getField(int appId, String externalId) { return getResourceFactory().getApiResource( "/app/" + appId + "/field/" + externalId).get( ApplicationField.class); }
java
public ApplicationField getField(int appId, String externalId) { return getResourceFactory().getApiResource( "/app/" + appId + "/field/" + externalId).get( ApplicationField.class); }
[ "public", "ApplicationField", "getField", "(", "int", "appId", ",", "String", "externalId", ")", "{", "return", "getResourceFactory", "(", ")", ".", "getApiResource", "(", "\"/app/\"", "+", "appId", "+", "\"/field/\"", "+", "externalId", ")", ".", "get", "(", ...
Returns a single field from an app. @param appId The id of the app the field is on @param externalId The id of the field to be returned @return The definition and current configuration of the requested field
[ "Returns", "a", "single", "field", "from", "an", "app", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/app/AppAPI.java#L159-L163
Frostman/dropbox4j
src/main/java/ru/frostman/dropbox/api/DropboxClient.java
DropboxClient.createFolder
public Entry createFolder(String path) { OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_CREATE_FOLDER_URL); request.addQuerystringParameter("root", "dropbox"); request.addQuerystringParameter("path", encode(path)); service.signRequest(accessToken, request); String content = checkCreateFolder(request.send()).getBody(); return Json.parse(content, Entry.class); }
java
public Entry createFolder(String path) { OAuthRequest request = new OAuthRequest(Verb.GET, FILE_OPS_CREATE_FOLDER_URL); request.addQuerystringParameter("root", "dropbox"); request.addQuerystringParameter("path", encode(path)); service.signRequest(accessToken, request); String content = checkCreateFolder(request.send()).getBody(); return Json.parse(content, Entry.class); }
[ "public", "Entry", "createFolder", "(", "String", "path", ")", "{", "OAuthRequest", "request", "=", "new", "OAuthRequest", "(", "Verb", ".", "GET", ",", "FILE_OPS_CREATE_FOLDER_URL", ")", ";", "request", ".", "addQuerystringParameter", "(", "\"root\"", ",", "\"d...
Create folder with specified path. @param path to create @return metadata of created folder @see Entry
[ "Create", "folder", "with", "specified", "path", "." ]
train
https://github.com/Frostman/dropbox4j/blob/774c817e5bf294d0139ecb5ac81399be50ada5e0/src/main/java/ru/frostman/dropbox/api/DropboxClient.java#L258-L267
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderNotePersistenceImpl.java
CommerceOrderNotePersistenceImpl.findAll
@Override public List<CommerceOrderNote> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CommerceOrderNote> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceOrderNote", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce order notes. <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 CommerceOrderNoteModelImpl}. 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 order notes @param end the upper bound of the range of commerce order notes (not inclusive) @return the range of commerce order notes
[ "Returns", "a", "range", "of", "all", "the", "commerce", "order", "notes", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderNotePersistenceImpl.java#L2027-L2030
twitter/hraven
hraven-etl/src/main/java/com/twitter/hraven/mapreduce/JobFileTableMapper.java
JobFileTableMapper.getMegaByteMillisPut
private Put getMegaByteMillisPut(Long mbMillis, JobKey jobKey) { Put pMb = new Put(jobKeyConv.toBytes(jobKey)); pMb.addColumn(Constants.INFO_FAM_BYTES, Constants.MEGABYTEMILLIS_BYTES, Bytes.toBytes(mbMillis)); return pMb; }
java
private Put getMegaByteMillisPut(Long mbMillis, JobKey jobKey) { Put pMb = new Put(jobKeyConv.toBytes(jobKey)); pMb.addColumn(Constants.INFO_FAM_BYTES, Constants.MEGABYTEMILLIS_BYTES, Bytes.toBytes(mbMillis)); return pMb; }
[ "private", "Put", "getMegaByteMillisPut", "(", "Long", "mbMillis", ",", "JobKey", "jobKey", ")", "{", "Put", "pMb", "=", "new", "Put", "(", "jobKeyConv", ".", "toBytes", "(", "jobKey", ")", ")", ";", "pMb", ".", "addColumn", "(", "Constants", ".", "INFO_...
generates a put for the megabytemillis @param mbMillis @param jobKey @return the put with megabytemillis
[ "generates", "a", "put", "for", "the", "megabytemillis" ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/mapreduce/JobFileTableMapper.java#L431-L436
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.availabilities_raw_GET
public ArrayList<OvhAvailabilitiesRaw> availabilities_raw_GET() throws IOException { String qPath = "/dedicated/server/availabilities/raw"; StringBuilder sb = path(qPath); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t16); }
java
public ArrayList<OvhAvailabilitiesRaw> availabilities_raw_GET() throws IOException { String qPath = "/dedicated/server/availabilities/raw"; StringBuilder sb = path(qPath); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t16); }
[ "public", "ArrayList", "<", "OvhAvailabilitiesRaw", ">", "availabilities_raw_GET", "(", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/availabilities/raw\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "String", ...
List the availability of dedicated server REST: GET /dedicated/server/availabilities/raw
[ "List", "the", "availability", "of", "dedicated", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2360-L2365
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/processor/map/SetTiledWmsProcessor.java
SetTiledWmsProcessor.adaptTileDimensions
private static Dimension adaptTileDimensions( final Dimension pixels, final int maxWidth, final int maxHeight) { return new Dimension(adaptTileDimension(pixels.width, maxWidth), adaptTileDimension(pixels.height, maxHeight)); }
java
private static Dimension adaptTileDimensions( final Dimension pixels, final int maxWidth, final int maxHeight) { return new Dimension(adaptTileDimension(pixels.width, maxWidth), adaptTileDimension(pixels.height, maxHeight)); }
[ "private", "static", "Dimension", "adaptTileDimensions", "(", "final", "Dimension", "pixels", ",", "final", "int", "maxWidth", ",", "final", "int", "maxHeight", ")", "{", "return", "new", "Dimension", "(", "adaptTileDimension", "(", "pixels", ".", "width", ",", ...
Adapt the size of the tiles so that we have the same amount of tiles as we would have had with maxWidth and maxHeight, but with the smallest tiles as possible.
[ "Adapt", "the", "size", "of", "the", "tiles", "so", "that", "we", "have", "the", "same", "amount", "of", "tiles", "as", "we", "would", "have", "had", "with", "maxWidth", "and", "maxHeight", "but", "with", "the", "smallest", "tiles", "as", "possible", "."...
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/map/SetTiledWmsProcessor.java#L67-L71
Alluxio/alluxio
core/base/src/main/java/alluxio/util/SleepUtils.java
SleepUtils.sleepMs
public static void sleepMs(Logger logger, long timeMs) { try { Thread.sleep(timeMs); } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (logger != null) { logger.warn(e.getMessage(), e); } } }
java
public static void sleepMs(Logger logger, long timeMs) { try { Thread.sleep(timeMs); } catch (InterruptedException e) { Thread.currentThread().interrupt(); if (logger != null) { logger.warn(e.getMessage(), e); } } }
[ "public", "static", "void", "sleepMs", "(", "Logger", "logger", ",", "long", "timeMs", ")", "{", "try", "{", "Thread", ".", "sleep", "(", "timeMs", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "Thread", ".", "currentThread", "(", ...
Sleeps for the given number of milliseconds, reporting interruptions using the given logger. Unlike Thread.sleep(), this method responds to interrupts by setting the thread interrupt status. This means that callers must check the interrupt status if they need to handle interrupts. @param logger logger for reporting interruptions; no reporting is done if the logger is null @param timeMs sleep duration in milliseconds
[ "Sleeps", "for", "the", "given", "number", "of", "milliseconds", "reporting", "interruptions", "using", "the", "given", "logger", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/util/SleepUtils.java#L45-L54
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/boosting/Bagging.java
Bagging.getWeightSampledDataSet
public static ClassificationDataSet getWeightSampledDataSet(ClassificationDataSet dataSet, int[] sampledCounts) { ClassificationDataSet destination = new ClassificationDataSet(dataSet.getNumNumericalVars(), dataSet.getCategories(), dataSet.getPredicting()); for (int i = 0; i < sampledCounts.length; i++) { if(sampledCounts[i] <= 0) continue; DataPoint dp = dataSet.getDataPoint(i); destination.addDataPoint(dp, dataSet.getDataPointCategory(i), dataSet.getWeight(i)*sampledCounts[i]); } return destination; }
java
public static ClassificationDataSet getWeightSampledDataSet(ClassificationDataSet dataSet, int[] sampledCounts) { ClassificationDataSet destination = new ClassificationDataSet(dataSet.getNumNumericalVars(), dataSet.getCategories(), dataSet.getPredicting()); for (int i = 0; i < sampledCounts.length; i++) { if(sampledCounts[i] <= 0) continue; DataPoint dp = dataSet.getDataPoint(i); destination.addDataPoint(dp, dataSet.getDataPointCategory(i), dataSet.getWeight(i)*sampledCounts[i]); } return destination; }
[ "public", "static", "ClassificationDataSet", "getWeightSampledDataSet", "(", "ClassificationDataSet", "dataSet", ",", "int", "[", "]", "sampledCounts", ")", "{", "ClassificationDataSet", "destination", "=", "new", "ClassificationDataSet", "(", "dataSet", ".", "getNumNumer...
Creates a new data set from the given sample counts. Points sampled multiple times will be added once to the data set with their weight multiplied by the number of times it was sampled. @param dataSet the data set that was sampled from @param sampledCounts the sampling values obtained from {@link #sampleWithReplacement(int[], int, java.util.Random) } @return a new sampled classification data set
[ "Creates", "a", "new", "data", "set", "from", "the", "given", "sample", "counts", ".", "Points", "sampled", "multiple", "times", "will", "be", "added", "once", "to", "the", "data", "set", "with", "their", "weight", "multiplied", "by", "the", "number", "of"...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/boosting/Bagging.java#L301-L314
pip-services3-java/pip-services3-components-java
src/org/pipservices3/components/count/CachedCounters.java
CachedCounters.stats
public void stats(String name, float value) { Counter counter = get(name, CounterType.Statistics); calculateStats(counter, value); update(); }
java
public void stats(String name, float value) { Counter counter = get(name, CounterType.Statistics); calculateStats(counter, value); update(); }
[ "public", "void", "stats", "(", "String", "name", ",", "float", "value", ")", "{", "Counter", "counter", "=", "get", "(", "name", ",", "CounterType", ".", "Statistics", ")", ";", "calculateStats", "(", "counter", ",", "value", ")", ";", "update", "(", ...
Calculates min/average/max statistics based on the current and previous values. @param name a counter name of Statistics type @param value a value to update statistics
[ "Calculates", "min", "/", "average", "/", "max", "statistics", "based", "on", "the", "current", "and", "previous", "values", "." ]
train
https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/count/CachedCounters.java#L205-L209
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java
DefaultEntityManager.executeEntityListeners
public void executeEntityListeners(CallbackType callbackType, List<?> entities) { for (Object entity : entities) { executeEntityListeners(callbackType, entity); } }
java
public void executeEntityListeners(CallbackType callbackType, List<?> entities) { for (Object entity : entities) { executeEntityListeners(callbackType, entity); } }
[ "public", "void", "executeEntityListeners", "(", "CallbackType", "callbackType", ",", "List", "<", "?", ">", "entities", ")", "{", "for", "(", "Object", "entity", ":", "entities", ")", "{", "executeEntityListeners", "(", "callbackType", ",", "entity", ")", ";"...
Executes the entity listeners associated with the given list of entities. @param callbackType the callback type @param entities the entities
[ "Executes", "the", "entity", "listeners", "associated", "with", "the", "given", "list", "of", "entities", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java#L480-L484
lucee/Lucee
core/src/main/java/lucee/runtime/registry/RegistryQuery.java
RegistryQuery.setValue
public static void setValue(String branch, String entry, short type, String value) throws RegistryException, IOException, InterruptedException { if (type == RegistryEntry.TYPE_KEY) { String fullKey = ListUtil.trim(branch, "\\") + "\\" + ListUtil.trim(entry, "\\"); // String[] cmd = new String[]{"reg","add",cleanBrunch(fullKey),"/ve","/f"}; String[] cmd = new String[] { "reg", "add", cleanBrunch(fullKey), "/f" }; executeQuery(cmd); } else { if (type == RegistryEntry.TYPE_DWORD) value = Caster.toString(Caster.toIntValue(value, 0)); String[] cmd = new String[] { "reg", "add", cleanBrunch(branch), "/v", entry, "/t", RegistryEntry.toStringType(type), "/d", value, "/f" }; executeQuery(cmd); } }
java
public static void setValue(String branch, String entry, short type, String value) throws RegistryException, IOException, InterruptedException { if (type == RegistryEntry.TYPE_KEY) { String fullKey = ListUtil.trim(branch, "\\") + "\\" + ListUtil.trim(entry, "\\"); // String[] cmd = new String[]{"reg","add",cleanBrunch(fullKey),"/ve","/f"}; String[] cmd = new String[] { "reg", "add", cleanBrunch(fullKey), "/f" }; executeQuery(cmd); } else { if (type == RegistryEntry.TYPE_DWORD) value = Caster.toString(Caster.toIntValue(value, 0)); String[] cmd = new String[] { "reg", "add", cleanBrunch(branch), "/v", entry, "/t", RegistryEntry.toStringType(type), "/d", value, "/f" }; executeQuery(cmd); } }
[ "public", "static", "void", "setValue", "(", "String", "branch", ",", "String", "entry", ",", "short", "type", ",", "String", "value", ")", "throws", "RegistryException", ",", "IOException", ",", "InterruptedException", "{", "if", "(", "type", "==", "RegistryE...
writes a value to registry @param branch @param entry @param type @param value @throws RegistryException @throws IOException @throws InterruptedException
[ "writes", "a", "value", "to", "registry" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/registry/RegistryQuery.java#L101-L114
alkacon/opencms-core
src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java
CmsImportExportUserDialog.getExportUserDialogForGroup
public static CmsImportExportUserDialog getExportUserDialogForGroup( CmsUUID groupID, String ou, Window window, boolean allowTechnicalFieldsExport) { CmsImportExportUserDialog res = new CmsImportExportUserDialog(ou, groupID, window, allowTechnicalFieldsExport); return res; }
java
public static CmsImportExportUserDialog getExportUserDialogForGroup( CmsUUID groupID, String ou, Window window, boolean allowTechnicalFieldsExport) { CmsImportExportUserDialog res = new CmsImportExportUserDialog(ou, groupID, window, allowTechnicalFieldsExport); return res; }
[ "public", "static", "CmsImportExportUserDialog", "getExportUserDialogForGroup", "(", "CmsUUID", "groupID", ",", "String", "ou", ",", "Window", "window", ",", "boolean", "allowTechnicalFieldsExport", ")", "{", "CmsImportExportUserDialog", "res", "=", "new", "CmsImportExpor...
Gets an dialog instance for fixed group.<p> @param groupID id @param ou ou name @param window window @param allowTechnicalFieldsExport flag indicates if technical field export option should be available @return an instance of this class
[ "Gets", "an", "dialog", "instance", "for", "fixed", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsImportExportUserDialog.java#L453-L461
apereo/cas
support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSaml20ObjectBuilder.java
AbstractSaml20ObjectBuilder.newSubject
public Subject newSubject(final String nameIdFormat, final String nameIdValue, final String recipient, final ZonedDateTime notOnOrAfter, final String inResponseTo, final ZonedDateTime notBefore) { val nameID = getNameID(nameIdFormat, nameIdValue); return newSubject(nameID, null, recipient, notOnOrAfter, inResponseTo, notBefore); }
java
public Subject newSubject(final String nameIdFormat, final String nameIdValue, final String recipient, final ZonedDateTime notOnOrAfter, final String inResponseTo, final ZonedDateTime notBefore) { val nameID = getNameID(nameIdFormat, nameIdValue); return newSubject(nameID, null, recipient, notOnOrAfter, inResponseTo, notBefore); }
[ "public", "Subject", "newSubject", "(", "final", "String", "nameIdFormat", ",", "final", "String", "nameIdValue", ",", "final", "String", "recipient", ",", "final", "ZonedDateTime", "notOnOrAfter", ",", "final", "String", "inResponseTo", ",", "final", "ZonedDateTime...
New subject subject. @param nameIdFormat the name id format @param nameIdValue the name id value @param recipient the recipient @param notOnOrAfter the not on or after @param inResponseTo the in response to @param notBefore the not before @return the subject
[ "New", "subject", "subject", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSaml20ObjectBuilder.java#L410-L415
btrplace/scheduler
api/src/main/java/org/btrplace/plan/event/Action.java
Action.addEvent
public boolean addEvent(Hook k, Event n) { Set<Event> l = events.get(k); if (l == null) { l = new HashSet<>(); events.put(k, l); } return l.add(n); }
java
public boolean addEvent(Hook k, Event n) { Set<Event> l = events.get(k); if (l == null) { l = new HashSet<>(); events.put(k, l); } return l.add(n); }
[ "public", "boolean", "addEvent", "(", "Hook", "k", ",", "Event", "n", ")", "{", "Set", "<", "Event", ">", "l", "=", "events", ".", "get", "(", "k", ")", ";", "if", "(", "l", "==", "null", ")", "{", "l", "=", "new", "HashSet", "<>", "(", ")", ...
Add an event to the action. The moment the event will be executed depends on its hook. @param k the hook @param n the event to attach @return {@code true} iff the event was added
[ "Add", "an", "event", "to", "the", "action", ".", "The", "moment", "the", "event", "will", "be", "executed", "depends", "on", "its", "hook", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/plan/event/Action.java#L151-L158
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java
URLUtil.getReader
public static BufferedReader getReader(URL url, Charset charset) { return IoUtil.getReader(getStream(url), charset); }
java
public static BufferedReader getReader(URL url, Charset charset) { return IoUtil.getReader(getStream(url), charset); }
[ "public", "static", "BufferedReader", "getReader", "(", "URL", "url", ",", "Charset", "charset", ")", "{", "return", "IoUtil", ".", "getReader", "(", "getStream", "(", "url", ")", ",", "charset", ")", ";", "}" ]
获得Reader @param url {@link URL} @param charset 编码 @return {@link BufferedReader} @since 3.2.1
[ "获得Reader" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L523-L525
alkacon/opencms-core
src/org/opencms/synchronize/CmsSynchronize.java
CmsSynchronize.importToVfs
private void importToVfs(File fsFile, String resName, String folder) throws CmsException { try { // get the content of the FS file byte[] content = CmsFileUtil.readFile(fsFile); // create the file String filename = translate(fsFile.getName()); m_report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_SUCCESSION_1, String.valueOf(m_count++)), I_CmsReport.FORMAT_NOTE); if (fsFile.isFile()) { m_report.print(Messages.get().container(Messages.RPT_IMPORT_FILE_0), I_CmsReport.FORMAT_NOTE); } else { m_report.print(Messages.get().container(Messages.RPT_IMPORT_FOLDER_0), I_CmsReport.FORMAT_NOTE); } m_report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, fsFile.getAbsolutePath().replace('\\', '/'))); m_report.print(Messages.get().container(Messages.RPT_FROM_FS_TO_0), I_CmsReport.FORMAT_NOTE); // get the file type of the FS file int resType = OpenCms.getResourceManager().getDefaultTypeForName(resName).getTypeId(); CmsResource newFile = m_cms.createResource( translate(folder) + filename, resType, content, new ArrayList<CmsProperty>()); m_report.print(org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, m_cms.getSitePath(newFile))); m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0)); // now check if there is some external method to be called which // should modify the imported resource in the VFS Iterator<I_CmsSynchronizeModification> i = m_synchronizeModifications.iterator(); while (i.hasNext()) { try { i.next().modifyVfs(m_cms, newFile, fsFile); } catch (CmsSynchronizeException e) { break; } } // we have to read the new resource again, to get the correct timestamp m_cms.setDateLastModified(m_cms.getSitePath(newFile), fsFile.lastModified(), false); CmsResource newRes = m_cms.readResource(m_cms.getSitePath(newFile)); // add resource to synchronization list CmsSynchronizeList syncList = new CmsSynchronizeList( resName, translate(resName), newRes.getDateLastModified(), fsFile.lastModified()); m_newSyncList.put(translate(resName), syncList); m_report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); } catch (IOException e) { throw new CmsSynchronizeException( Messages.get().container(Messages.ERR_READING_FILE_1, fsFile.getName()), e); } }
java
private void importToVfs(File fsFile, String resName, String folder) throws CmsException { try { // get the content of the FS file byte[] content = CmsFileUtil.readFile(fsFile); // create the file String filename = translate(fsFile.getName()); m_report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_SUCCESSION_1, String.valueOf(m_count++)), I_CmsReport.FORMAT_NOTE); if (fsFile.isFile()) { m_report.print(Messages.get().container(Messages.RPT_IMPORT_FILE_0), I_CmsReport.FORMAT_NOTE); } else { m_report.print(Messages.get().container(Messages.RPT_IMPORT_FOLDER_0), I_CmsReport.FORMAT_NOTE); } m_report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, fsFile.getAbsolutePath().replace('\\', '/'))); m_report.print(Messages.get().container(Messages.RPT_FROM_FS_TO_0), I_CmsReport.FORMAT_NOTE); // get the file type of the FS file int resType = OpenCms.getResourceManager().getDefaultTypeForName(resName).getTypeId(); CmsResource newFile = m_cms.createResource( translate(folder) + filename, resType, content, new ArrayList<CmsProperty>()); m_report.print(org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, m_cms.getSitePath(newFile))); m_report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0)); // now check if there is some external method to be called which // should modify the imported resource in the VFS Iterator<I_CmsSynchronizeModification> i = m_synchronizeModifications.iterator(); while (i.hasNext()) { try { i.next().modifyVfs(m_cms, newFile, fsFile); } catch (CmsSynchronizeException e) { break; } } // we have to read the new resource again, to get the correct timestamp m_cms.setDateLastModified(m_cms.getSitePath(newFile), fsFile.lastModified(), false); CmsResource newRes = m_cms.readResource(m_cms.getSitePath(newFile)); // add resource to synchronization list CmsSynchronizeList syncList = new CmsSynchronizeList( resName, translate(resName), newRes.getDateLastModified(), fsFile.lastModified()); m_newSyncList.put(translate(resName), syncList); m_report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); } catch (IOException e) { throw new CmsSynchronizeException( Messages.get().container(Messages.ERR_READING_FILE_1, fsFile.getName()), e); } }
[ "private", "void", "importToVfs", "(", "File", "fsFile", ",", "String", "resName", ",", "String", "folder", ")", "throws", "CmsException", "{", "try", "{", "// get the content of the FS file", "byte", "[", "]", "content", "=", "CmsFileUtil", ".", "readFile", "("...
Imports a new resource from the FS into the VFS and updates the synchronization lists.<p> @param fsFile the file in the FS @param resName the name of the resource in the VFS @param folder the folder to import the file into @throws CmsException if something goes wrong
[ "Imports", "a", "new", "resource", "from", "the", "FS", "into", "the", "VFS", "and", "updates", "the", "synchronization", "lists", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/synchronize/CmsSynchronize.java#L528-L596
lightbend/config
config/src/main/java/com/typesafe/config/ConfigFactory.java
ConfigFactory.parseReader
public static Config parseReader(Reader reader, ConfigParseOptions options) { return Parseable.newReader(reader, options).parse().toConfig(); }
java
public static Config parseReader(Reader reader, ConfigParseOptions options) { return Parseable.newReader(reader, options).parse().toConfig(); }
[ "public", "static", "Config", "parseReader", "(", "Reader", "reader", ",", "ConfigParseOptions", "options", ")", "{", "return", "Parseable", ".", "newReader", "(", "reader", ",", "options", ")", ".", "parse", "(", ")", ".", "toConfig", "(", ")", ";", "}" ]
Parses a Reader into a Config instance. Does not call {@link Config#resolve} or merge the parsed stream with any other configuration; this method parses a single stream and does nothing else. It does process "include" statements in the parsed stream, and may end up doing other IO due to those statements. @param reader the reader to parse @param options parse options to control how the reader is interpreted @return the parsed configuration @throws ConfigException on IO or parse errors
[ "Parses", "a", "Reader", "into", "a", "Config", "instance", ".", "Does", "not", "call", "{", "@link", "Config#resolve", "}", "or", "merge", "the", "parsed", "stream", "with", "any", "other", "configuration", ";", "this", "method", "parses", "a", "single", ...
train
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigFactory.java#L672-L674
apache/incubator-gobblin
gobblin-core-base/src/main/java/org/apache/gobblin/converter/AsyncConverter1to1.java
AsyncConverter1to1.processStream
@Override public RecordStreamWithMetadata<DO, SO> processStream(RecordStreamWithMetadata<DI, SI> inputStream, WorkUnitState workUnitState) throws SchemaConversionException { int maxConcurrentAsyncConversions = workUnitState.getPropAsInt(MAX_CONCURRENT_ASYNC_CONVERSIONS_KEY, DEFAULT_MAX_CONCURRENT_ASYNC_CONVERSIONS); SO outputSchema = convertSchema(inputStream.getGlobalMetadata().getSchema(), workUnitState); Flowable<StreamEntity<DO>> outputStream = inputStream.getRecordStream() .flatMapSingle(in -> { if (in instanceof ControlMessage) { getMessageHandler().handleMessage((ControlMessage) in); return Single.just((ControlMessage<DO>) in); } else if (in instanceof RecordEnvelope) { RecordEnvelope<DI> recordEnvelope = (RecordEnvelope<DI>) in; return new SingleAsync(recordEnvelope, convertRecordAsync(outputSchema, recordEnvelope.getRecord(), workUnitState)); } else { throw new IllegalStateException("Expected ControlMessage or RecordEnvelope."); } }, false, maxConcurrentAsyncConversions); return inputStream.withRecordStream(outputStream, GlobalMetadata.<SI, SO>builderWithInput(inputStream.getGlobalMetadata(), Optional.fromNullable(outputSchema)).build()); }
java
@Override public RecordStreamWithMetadata<DO, SO> processStream(RecordStreamWithMetadata<DI, SI> inputStream, WorkUnitState workUnitState) throws SchemaConversionException { int maxConcurrentAsyncConversions = workUnitState.getPropAsInt(MAX_CONCURRENT_ASYNC_CONVERSIONS_KEY, DEFAULT_MAX_CONCURRENT_ASYNC_CONVERSIONS); SO outputSchema = convertSchema(inputStream.getGlobalMetadata().getSchema(), workUnitState); Flowable<StreamEntity<DO>> outputStream = inputStream.getRecordStream() .flatMapSingle(in -> { if (in instanceof ControlMessage) { getMessageHandler().handleMessage((ControlMessage) in); return Single.just((ControlMessage<DO>) in); } else if (in instanceof RecordEnvelope) { RecordEnvelope<DI> recordEnvelope = (RecordEnvelope<DI>) in; return new SingleAsync(recordEnvelope, convertRecordAsync(outputSchema, recordEnvelope.getRecord(), workUnitState)); } else { throw new IllegalStateException("Expected ControlMessage or RecordEnvelope."); } }, false, maxConcurrentAsyncConversions); return inputStream.withRecordStream(outputStream, GlobalMetadata.<SI, SO>builderWithInput(inputStream.getGlobalMetadata(), Optional.fromNullable(outputSchema)).build()); }
[ "@", "Override", "public", "RecordStreamWithMetadata", "<", "DO", ",", "SO", ">", "processStream", "(", "RecordStreamWithMetadata", "<", "DI", ",", "SI", ">", "inputStream", ",", "WorkUnitState", "workUnitState", ")", "throws", "SchemaConversionException", "{", "int...
Return a {@link RecordStreamWithMetadata} with the appropriate modifications. @param inputStream @param workUnitState @return @throws SchemaConversionException @implNote this processStream does not handle {@link org.apache.gobblin.stream.MetadataUpdateControlMessage}s
[ "Return", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/converter/AsyncConverter1to1.java#L78-L99
OrienteerBAP/wicket-orientdb
wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java
OSchemaHelper.oClass
public OSchemaHelper oClass(String className, String... superClasses) { return oClass(className, false, superClasses); }
java
public OSchemaHelper oClass(String className, String... superClasses) { return oClass(className, false, superClasses); }
[ "public", "OSchemaHelper", "oClass", "(", "String", "className", ",", "String", "...", "superClasses", ")", "{", "return", "oClass", "(", "className", ",", "false", ",", "superClasses", ")", ";", "}" ]
Create if required {@link OClass} @param className name of a class to create @param superClasses list of superclasses @return this helper
[ "Create", "if", "required", "{" ]
train
https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java#L65-L68
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/utils/SchedulerUtils.java
SchedulerUtils.createJobDetail
public static JobDetail createJobDetail(String identity, String groupName, Class<? extends Job> clazz) { Objects.requireNonNull(identity, Required.IDENTITY.toString()); Objects.requireNonNull(groupName, Required.GROUP_NAME.toString()); Objects.requireNonNull(clazz, Required.CLASS.toString()); return newJob(clazz) .withIdentity(identity, groupName) .build(); }
java
public static JobDetail createJobDetail(String identity, String groupName, Class<? extends Job> clazz) { Objects.requireNonNull(identity, Required.IDENTITY.toString()); Objects.requireNonNull(groupName, Required.GROUP_NAME.toString()); Objects.requireNonNull(clazz, Required.CLASS.toString()); return newJob(clazz) .withIdentity(identity, groupName) .build(); }
[ "public", "static", "JobDetail", "createJobDetail", "(", "String", "identity", ",", "String", "groupName", ",", "Class", "<", "?", "extends", "Job", ">", "clazz", ")", "{", "Objects", ".", "requireNonNull", "(", "identity", ",", "Required", ".", "IDENTITY", ...
Creates a new quartz scheduler JobDetail, which can be used to schedule a new job by passing it into {@link io.mangoo.scheduler.Scheduler#schedule(JobDetail, Trigger) schedule} @param identity The name of the job @param groupName The name of the job Group @param clazz The class where the actual execution takes place @return A new JobDetail object
[ "Creates", "a", "new", "quartz", "scheduler", "JobDetail", "which", "can", "be", "used", "to", "schedule", "a", "new", "job", "by", "passing", "it", "into", "{", "@link", "io", ".", "mangoo", ".", "scheduler", ".", "Scheduler#schedule", "(", "JobDetail", "...
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/SchedulerUtils.java#L62-L70
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java
AbstractClassFileWriter.getTypeDescriptor
protected static String getTypeDescriptor(Object type) { if (type instanceof Class) { return Type.getDescriptor((Class) type); } else if (type instanceof Type) { return ((Type) type).getDescriptor(); } else { String className = type.toString(); return getTypeDescriptor(className, new String[0]); } }
java
protected static String getTypeDescriptor(Object type) { if (type instanceof Class) { return Type.getDescriptor((Class) type); } else if (type instanceof Type) { return ((Type) type).getDescriptor(); } else { String className = type.toString(); return getTypeDescriptor(className, new String[0]); } }
[ "protected", "static", "String", "getTypeDescriptor", "(", "Object", "type", ")", "{", "if", "(", "type", "instanceof", "Class", ")", "{", "return", "Type", ".", "getDescriptor", "(", "(", "Class", ")", "type", ")", ";", "}", "else", "if", "(", "type", ...
Returns the descriptor corresponding to the given class. @param type The type @return The descriptor for the class
[ "Returns", "the", "descriptor", "corresponding", "to", "the", "given", "class", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java#L386-L395
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java
Item.withNumber
public Item withNumber(String attrName, BigDecimal val) { checkInvalidAttribute(attrName, val); attributes.put(attrName, val); return this; }
java
public Item withNumber(String attrName, BigDecimal val) { checkInvalidAttribute(attrName, val); attributes.put(attrName, val); return this; }
[ "public", "Item", "withNumber", "(", "String", "attrName", ",", "BigDecimal", "val", ")", "{", "checkInvalidAttribute", "(", "attrName", ",", "val", ")", ";", "attributes", ".", "put", "(", "attrName", ",", "val", ")", ";", "return", "this", ";", "}" ]
Sets the value of the specified attribute in the current item to the given value.
[ "Sets", "the", "value", "of", "the", "specified", "attribute", "in", "the", "current", "item", "to", "the", "given", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java#L267-L271
js-lib-com/template.xhtml
src/main/java/js/template/xhtml/OMapOperator.java
OMapOperator.doExec
@Override protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws IOException, TemplateException { if (!propertyPath.equals(".") && ConverterRegistry.hasType(scope.getClass())) { throw new TemplateException("Operand is property path but scope is not an object."); } Element keyTemplate = element.getFirstChild(); if (keyTemplate == null) { throw new TemplateException("Invalid map element |%s|. Missing key template.", element); } Element valueTemplate = keyTemplate.getNextSibling(); if (valueTemplate == null) { throw new TemplateException("Invalid map element |%s|. Missing value template.", element); } Stack<Index> indexes = serializer.getIndexes(); Index index = new Index(); indexes.push(index); Map<?, ?> map = content.getMap(scope, propertyPath); for (Object key : map.keySet()) { index.increment(); serializer.writeItem(keyTemplate, key); serializer.writeItem(valueTemplate, map.get(key)); } indexes.pop(); return null; }
java
@Override protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws IOException, TemplateException { if (!propertyPath.equals(".") && ConverterRegistry.hasType(scope.getClass())) { throw new TemplateException("Operand is property path but scope is not an object."); } Element keyTemplate = element.getFirstChild(); if (keyTemplate == null) { throw new TemplateException("Invalid map element |%s|. Missing key template.", element); } Element valueTemplate = keyTemplate.getNextSibling(); if (valueTemplate == null) { throw new TemplateException("Invalid map element |%s|. Missing value template.", element); } Stack<Index> indexes = serializer.getIndexes(); Index index = new Index(); indexes.push(index); Map<?, ?> map = content.getMap(scope, propertyPath); for (Object key : map.keySet()) { index.increment(); serializer.writeItem(keyTemplate, key); serializer.writeItem(valueTemplate, map.get(key)); } indexes.pop(); return null; }
[ "@", "Override", "protected", "Object", "doExec", "(", "Element", "element", ",", "Object", "scope", ",", "String", "propertyPath", ",", "Object", "...", "arguments", ")", "throws", "IOException", ",", "TemplateException", "{", "if", "(", "!", "propertyPath", ...
Execute OMAP operator. Behaves like {@link MapOperator#doExec(Element, Object, String, Object...)} counterpart but takes care to create index and increment it before every key / value pair processing. @param element context element, @param scope scope object, @param propertyPath property path, @param arguments optional arguments, not used. @return always returns null to signal full processing. @throws IOException if underlying writer fails to write. @throws TemplateException if element has not at least two children or content map is undefined.
[ "Execute", "OMAP", "operator", ".", "Behaves", "like", "{", "@link", "MapOperator#doExec", "(", "Element", "Object", "String", "Object", "...", ")", "}", "counterpart", "but", "takes", "care", "to", "create", "index", "and", "increment", "it", "before", "every...
train
https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/OMapOperator.java#L60-L84
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/source/FunctionalType.java
FunctionalType.functionalTypeAcceptedByMethod
public static FunctionalType functionalTypeAcceptedByMethod( DeclaredType type, String methodName, FunctionalType prototype, Elements elements, Types types) { return functionalTypesAcceptedByMethod(type, methodName, elements, types) .stream() .filter(functionalType -> isAssignable(functionalType, prototype, types)) .findAny() .orElse(prototype); }
java
public static FunctionalType functionalTypeAcceptedByMethod( DeclaredType type, String methodName, FunctionalType prototype, Elements elements, Types types) { return functionalTypesAcceptedByMethod(type, methodName, elements, types) .stream() .filter(functionalType -> isAssignable(functionalType, prototype, types)) .findAny() .orElse(prototype); }
[ "public", "static", "FunctionalType", "functionalTypeAcceptedByMethod", "(", "DeclaredType", "type", ",", "String", "methodName", ",", "FunctionalType", "prototype", ",", "Elements", "elements", ",", "Types", "types", ")", "{", "return", "functionalTypesAcceptedByMethod",...
Returns the functional type accepted by {@code methodName} on {@code type}, assignable to {@code prototype}, or {@code prototype} itself if no such method has been declared. <p>Used to allow the user to override the functional interface used on builder methods, e.g. to force boxing, or to use Guava types.
[ "Returns", "the", "functional", "type", "accepted", "by", "{", "@code", "methodName", "}", "on", "{", "@code", "type", "}", "assignable", "to", "{", "@code", "prototype", "}", "or", "{", "@code", "prototype", "}", "itself", "if", "no", "such", "method", ...
train
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/FunctionalType.java#L135-L146
geomajas/geomajas-project-graphics
graphics/src/main/java/org/geomajas/graphics/client/util/CopyUtil.java
CopyUtil.copyStrokableProperties
public static void copyStrokableProperties(HasStroke strokableOriginal, HasStroke strokableCopy) { strokableCopy.setStrokeOpacity(strokableOriginal.getStrokeOpacity()); strokableCopy.setStrokeColor(strokableOriginal.getStrokeColor()); strokableCopy.setStrokeWidth(strokableOriginal.getStrokeWidth()); }
java
public static void copyStrokableProperties(HasStroke strokableOriginal, HasStroke strokableCopy) { strokableCopy.setStrokeOpacity(strokableOriginal.getStrokeOpacity()); strokableCopy.setStrokeColor(strokableOriginal.getStrokeColor()); strokableCopy.setStrokeWidth(strokableOriginal.getStrokeWidth()); }
[ "public", "static", "void", "copyStrokableProperties", "(", "HasStroke", "strokableOriginal", ",", "HasStroke", "strokableCopy", ")", "{", "strokableCopy", ".", "setStrokeOpacity", "(", "strokableOriginal", ".", "getStrokeOpacity", "(", ")", ")", ";", "strokableCopy", ...
Copy all {@link HasStroke} properties from original to copy. @param strokableOriginal @param strokableCopy
[ "Copy", "all", "{", "@link", "HasStroke", "}", "properties", "from", "original", "to", "copy", "." ]
train
https://github.com/geomajas/geomajas-project-graphics/blob/1104196640e0ba455b8a619e774352a8e1e319ba/graphics/src/main/java/org/geomajas/graphics/client/util/CopyUtil.java#L55-L59
OpenTSDB/opentsdb
src/meta/Annotation.java
Annotation.getAnnotation
public static Deferred<Annotation> getAnnotation(final TSDB tsdb, final long start_time) { return getAnnotation(tsdb, (byte[])null, start_time); }
java
public static Deferred<Annotation> getAnnotation(final TSDB tsdb, final long start_time) { return getAnnotation(tsdb, (byte[])null, start_time); }
[ "public", "static", "Deferred", "<", "Annotation", ">", "getAnnotation", "(", "final", "TSDB", "tsdb", ",", "final", "long", "start_time", ")", "{", "return", "getAnnotation", "(", "tsdb", ",", "(", "byte", "[", "]", ")", "null", ",", "start_time", ")", ...
Attempts to fetch a global annotation from storage @param tsdb The TSDB to use for storage access @param start_time The start time as a Unix epoch timestamp @return A valid annotation object if found, null if not
[ "Attempts", "to", "fetch", "a", "global", "annotation", "from", "storage" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/meta/Annotation.java#L231-L234
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java
WordVectorSerializer.writeWordVectors
public static void writeWordVectors(@NonNull Glove vectors, @NonNull String path) { try (BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(path))) { writeWordVectors(vectors, fos); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static void writeWordVectors(@NonNull Glove vectors, @NonNull String path) { try (BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(path))) { writeWordVectors(vectors, fos); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "writeWordVectors", "(", "@", "NonNull", "Glove", "vectors", ",", "@", "NonNull", "String", "path", ")", "{", "try", "(", "BufferedOutputStream", "fos", "=", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "path", ...
This method saves GloVe model to the given output stream. @param vectors GloVe model to be saved @param path path where model should be saved to
[ "This", "method", "saves", "GloVe", "model", "to", "the", "given", "output", "stream", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L1127-L1133
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java
DefaultImageFormatChecker.isJpegHeader
private static boolean isJpegHeader(final byte[] imageHeaderBytes, final int headerSize) { return headerSize >= JPEG_HEADER.length && ImageFormatCheckerUtils.startsWithPattern(imageHeaderBytes, JPEG_HEADER); }
java
private static boolean isJpegHeader(final byte[] imageHeaderBytes, final int headerSize) { return headerSize >= JPEG_HEADER.length && ImageFormatCheckerUtils.startsWithPattern(imageHeaderBytes, JPEG_HEADER); }
[ "private", "static", "boolean", "isJpegHeader", "(", "final", "byte", "[", "]", "imageHeaderBytes", ",", "final", "int", "headerSize", ")", "{", "return", "headerSize", ">=", "JPEG_HEADER", ".", "length", "&&", "ImageFormatCheckerUtils", ".", "startsWithPattern", ...
Checks if imageHeaderBytes starts with SOI (start of image) marker, followed by 0xFF. If headerSize is lower than 3 false is returned. Description of jpeg format can be found here: <a href="http://www.w3.org/Graphics/JPEG/itu-t81.pdf"> http://www.w3.org/Graphics/JPEG/itu-t81.pdf</a> Annex B deals with compressed data format @param imageHeaderBytes @param headerSize @return true if imageHeaderBytes starts with SOI_BYTES and headerSize >= 3
[ "Checks", "if", "imageHeaderBytes", "starts", "with", "SOI", "(", "start", "of", "image", ")", "marker", "followed", "by", "0xFF", ".", "If", "headerSize", "is", "lower", "than", "3", "false", "is", "returned", ".", "Description", "of", "jpeg", "format", "...
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java#L145-L148
jmxtrans/embedded-jmxtrans
src/main/java/org/jmxtrans/embedded/output/GraphitePickleWriter.java
GraphitePickleWriter.start
@Override public void start() { int port = getIntSetting(SETTING_PORT, DEFAULT_GRAPHITE_SERVER_PORT); String host = getStringSetting(SETTING_HOST); graphiteServerHostAndPort = new HostAndPort(host, port); logger.info("Start Graphite Pickle writer connected to '{}'...", graphiteServerHostAndPort); metricPathPrefix = getStringSetting(SETTING_NAME_PREFIX, DEFAULT_NAME_PREFIX); metricPathPrefix = getStrategy().resolveExpression(metricPathPrefix); if (!metricPathPrefix.isEmpty() && !metricPathPrefix.endsWith(".")) { metricPathPrefix = metricPathPrefix + "."; } GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig(); config.setTestOnBorrow(getBooleanSetting("pool.testOnBorrow", true)); config.setTestWhileIdle(getBooleanSetting("pool.testWhileIdle", true)); config.setMaxTotal(getIntSetting("pool.maxActive", -1)); config.setMaxIdlePerKey(getIntSetting("pool.maxIdle", -1)); config.setMinEvictableIdleTimeMillis(getLongSetting("pool.minEvictableIdleTimeMillis", TimeUnit.MINUTES.toMillis(5))); config.setTimeBetweenEvictionRunsMillis(getLongSetting("pool.timeBetweenEvictionRunsMillis", TimeUnit.MINUTES.toMillis(5))); config.setJmxNameBase("org.jmxtrans.embedded:type=GenericKeyedObjectPool,writer=GraphitePickleWriter,name="); config.setJmxNamePrefix(graphiteServerHostAndPort.getHost() + "_" + graphiteServerHostAndPort.getPort()); int socketConnectTimeoutInMillis = getIntSetting("graphite.socketConnectTimeoutInMillis", SocketOutputStreamPoolFactory.DEFAULT_SOCKET_CONNECT_TIMEOUT_IN_MILLIS); socketOutputStreamPool = new GenericKeyedObjectPool<HostAndPort, SocketOutputStream>(new SocketOutputStreamPoolFactory(socketConnectTimeoutInMillis), config); if (isEnabled()) { try { SocketOutputStream socketOutputStream = socketOutputStreamPool.borrowObject(graphiteServerHostAndPort); socketOutputStreamPool.returnObject(graphiteServerHostAndPort, socketOutputStream); } catch (Exception e) { logger.warn("Test Connection: FAILURE to connect to Graphite server '{}'", graphiteServerHostAndPort, e); } } try { Class.forName("org.python.modules.cPickle"); } catch (ClassNotFoundException e) { throw new EmbeddedJmxTransException("jython librarie is required by the " + getClass().getSimpleName() + " but is not found in the classpath. Please add org.python:jython:2.5.3+ to the classpath."); } }
java
@Override public void start() { int port = getIntSetting(SETTING_PORT, DEFAULT_GRAPHITE_SERVER_PORT); String host = getStringSetting(SETTING_HOST); graphiteServerHostAndPort = new HostAndPort(host, port); logger.info("Start Graphite Pickle writer connected to '{}'...", graphiteServerHostAndPort); metricPathPrefix = getStringSetting(SETTING_NAME_PREFIX, DEFAULT_NAME_PREFIX); metricPathPrefix = getStrategy().resolveExpression(metricPathPrefix); if (!metricPathPrefix.isEmpty() && !metricPathPrefix.endsWith(".")) { metricPathPrefix = metricPathPrefix + "."; } GenericKeyedObjectPoolConfig config = new GenericKeyedObjectPoolConfig(); config.setTestOnBorrow(getBooleanSetting("pool.testOnBorrow", true)); config.setTestWhileIdle(getBooleanSetting("pool.testWhileIdle", true)); config.setMaxTotal(getIntSetting("pool.maxActive", -1)); config.setMaxIdlePerKey(getIntSetting("pool.maxIdle", -1)); config.setMinEvictableIdleTimeMillis(getLongSetting("pool.minEvictableIdleTimeMillis", TimeUnit.MINUTES.toMillis(5))); config.setTimeBetweenEvictionRunsMillis(getLongSetting("pool.timeBetweenEvictionRunsMillis", TimeUnit.MINUTES.toMillis(5))); config.setJmxNameBase("org.jmxtrans.embedded:type=GenericKeyedObjectPool,writer=GraphitePickleWriter,name="); config.setJmxNamePrefix(graphiteServerHostAndPort.getHost() + "_" + graphiteServerHostAndPort.getPort()); int socketConnectTimeoutInMillis = getIntSetting("graphite.socketConnectTimeoutInMillis", SocketOutputStreamPoolFactory.DEFAULT_SOCKET_CONNECT_TIMEOUT_IN_MILLIS); socketOutputStreamPool = new GenericKeyedObjectPool<HostAndPort, SocketOutputStream>(new SocketOutputStreamPoolFactory(socketConnectTimeoutInMillis), config); if (isEnabled()) { try { SocketOutputStream socketOutputStream = socketOutputStreamPool.borrowObject(graphiteServerHostAndPort); socketOutputStreamPool.returnObject(graphiteServerHostAndPort, socketOutputStream); } catch (Exception e) { logger.warn("Test Connection: FAILURE to connect to Graphite server '{}'", graphiteServerHostAndPort, e); } } try { Class.forName("org.python.modules.cPickle"); } catch (ClassNotFoundException e) { throw new EmbeddedJmxTransException("jython librarie is required by the " + getClass().getSimpleName() + " but is not found in the classpath. Please add org.python:jython:2.5.3+ to the classpath."); } }
[ "@", "Override", "public", "void", "start", "(", ")", "{", "int", "port", "=", "getIntSetting", "(", "SETTING_PORT", ",", "DEFAULT_GRAPHITE_SERVER_PORT", ")", ";", "String", "host", "=", "getStringSetting", "(", "SETTING_HOST", ")", ";", "graphiteServerHostAndPort...
Load settings, initialize the {@link SocketWriter} pool and test the connection to the graphite server. a {@link Logger#warn(String)} message is emitted if the connection to the graphite server fails.
[ "Load", "settings", "initialize", "the", "{", "@link", "SocketWriter", "}", "pool", "and", "test", "the", "connection", "to", "the", "graphite", "server", "." ]
train
https://github.com/jmxtrans/embedded-jmxtrans/blob/17224389e7d8323284cabc2a5167fc03bed6d223/src/main/java/org/jmxtrans/embedded/output/GraphitePickleWriter.java#L81-L123
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESQuery.java
ESQuery.buildWhereAggregations
private FilterAggregationBuilder buildWhereAggregations(EntityMetadata entityMetadata, QueryBuilder filter) { filter = filter != null ? filter : QueryBuilders.matchAllQuery(); FilterAggregationBuilder filteragg = AggregationBuilders.filter(ESConstants.AGGREGATION_NAME).filter(filter); return filteragg; }
java
private FilterAggregationBuilder buildWhereAggregations(EntityMetadata entityMetadata, QueryBuilder filter) { filter = filter != null ? filter : QueryBuilders.matchAllQuery(); FilterAggregationBuilder filteragg = AggregationBuilders.filter(ESConstants.AGGREGATION_NAME).filter(filter); return filteragg; }
[ "private", "FilterAggregationBuilder", "buildWhereAggregations", "(", "EntityMetadata", "entityMetadata", ",", "QueryBuilder", "filter", ")", "{", "filter", "=", "filter", "!=", "null", "?", "filter", ":", "QueryBuilders", ".", "matchAllQuery", "(", ")", ";", "Filte...
Builds the where aggregations. @param entityMetadata the entity metadata @param filter the filter @return the filter aggregation builder
[ "Builds", "the", "where", "aggregations", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESQuery.java#L410-L416
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/cache/TagTrackingCacheEventListener.java
TagTrackingCacheEventListener.putElement
protected void putElement(Ehcache cache, Element element) { final Set<CacheEntryTag> tags = this.getTags(element); // Check if the key is tagged if (tags != null && !tags.isEmpty()) { final String cacheName = cache.getName(); final Object key = element.getObjectKey(); final LoadingCache<CacheEntryTag, Set<Object>> cacheKeys = taggedCacheKeys.getUnchecked(cacheName); logger.debug("Tracking {} tags in cache {} for key {}", tags.size(), cacheName, key); // Add all the tags to the tracking map for (final CacheEntryTag tag : tags) { // Record that this tag type is stored in this cache final String tagType = tag.getTagType(); final Set<Ehcache> caches = taggedCaches.getUnchecked(tagType); caches.add(cache); // Record the tag->key association final Set<Object> taggedKeys = cacheKeys.getUnchecked(tag); taggedKeys.add(key); } } }
java
protected void putElement(Ehcache cache, Element element) { final Set<CacheEntryTag> tags = this.getTags(element); // Check if the key is tagged if (tags != null && !tags.isEmpty()) { final String cacheName = cache.getName(); final Object key = element.getObjectKey(); final LoadingCache<CacheEntryTag, Set<Object>> cacheKeys = taggedCacheKeys.getUnchecked(cacheName); logger.debug("Tracking {} tags in cache {} for key {}", tags.size(), cacheName, key); // Add all the tags to the tracking map for (final CacheEntryTag tag : tags) { // Record that this tag type is stored in this cache final String tagType = tag.getTagType(); final Set<Ehcache> caches = taggedCaches.getUnchecked(tagType); caches.add(cache); // Record the tag->key association final Set<Object> taggedKeys = cacheKeys.getUnchecked(tag); taggedKeys.add(key); } } }
[ "protected", "void", "putElement", "(", "Ehcache", "cache", ",", "Element", "element", ")", "{", "final", "Set", "<", "CacheEntryTag", ">", "tags", "=", "this", ".", "getTags", "(", "element", ")", ";", "// Check if the key is tagged", "if", "(", "tags", "!=...
If the element has a TaggedCacheKey record the tag associations
[ "If", "the", "element", "has", "a", "TaggedCacheKey", "record", "the", "tag", "associations" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/cache/TagTrackingCacheEventListener.java#L134-L158
Azure/azure-sdk-for-java
signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java
SignalRsInner.beginUpdateAsync
public Observable<SignalRResourceInner> beginUpdateAsync(String resourceGroupName, String resourceName) { return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() { @Override public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) { return response.body(); } }); }
java
public Observable<SignalRResourceInner> beginUpdateAsync(String resourceGroupName, String resourceName) { return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() { @Override public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SignalRResourceInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "map", "(...
Operation to update an exiting SignalR service. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param resourceName The name of the SignalR resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SignalRResourceInner object
[ "Operation", "to", "update", "an", "exiting", "SignalR", "service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java#L1606-L1613
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java
JdbcControlImpl.onAquire
@EventHandler(field = "_resourceContext", eventSet = ResourceEvents.class, eventName = "onAcquire") public void onAquire() { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Enter: onAquire()"); } try { getConnection(); } catch (SQLException se) { throw new ControlException("SQL Exception while attempting to connect to database.", se); } }
java
@EventHandler(field = "_resourceContext", eventSet = ResourceEvents.class, eventName = "onAcquire") public void onAquire() { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Enter: onAquire()"); } try { getConnection(); } catch (SQLException se) { throw new ControlException("SQL Exception while attempting to connect to database.", se); } }
[ "@", "EventHandler", "(", "field", "=", "\"_resourceContext\"", ",", "eventSet", "=", "ResourceEvents", ".", "class", ",", "eventName", "=", "\"onAcquire\"", ")", "public", "void", "onAquire", "(", ")", "{", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", "...
Invoked by the controls runtime when a new instance of this class is aquired by the runtime
[ "Invoked", "by", "the", "controls", "runtime", "when", "a", "new", "instance", "of", "this", "class", "is", "aquired", "by", "the", "runtime" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java#L103-L115
Netflix/frigga
src/main/java/com/netflix/frigga/cluster/ClusterGrouper.java
ClusterGrouper.groupAsgNamesByClusterName
public static Map<String, List<String>> groupAsgNamesByClusterName(List<String> asgNames) { return groupByClusterName(asgNames, new AsgNameProvider<String>() { public String extractAsgName(String asgName) { return asgName; } }); }
java
public static Map<String, List<String>> groupAsgNamesByClusterName(List<String> asgNames) { return groupByClusterName(asgNames, new AsgNameProvider<String>() { public String extractAsgName(String asgName) { return asgName; } }); }
[ "public", "static", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "groupAsgNamesByClusterName", "(", "List", "<", "String", ">", "asgNames", ")", "{", "return", "groupByClusterName", "(", "asgNames", ",", "new", "AsgNameProvider", "<", "String", ...
Groups a list of ASG names by cluster name. @param asgNames list of asg names @return map of cluster name to list of ASG names in that cluster
[ "Groups", "a", "list", "of", "ASG", "names", "by", "cluster", "name", "." ]
train
https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/cluster/ClusterGrouper.java#L57-L63
google/truth
core/src/main/java/com/google/common/truth/Correspondence.java
Correspondence.formatDiff
@NullableDecl public String formatDiff(@NullableDecl A actual, @NullableDecl E expected) { return null; }
java
@NullableDecl public String formatDiff(@NullableDecl A actual, @NullableDecl E expected) { return null; }
[ "@", "NullableDecl", "public", "String", "formatDiff", "(", "@", "NullableDecl", "A", "actual", ",", "@", "NullableDecl", "E", "expected", ")", "{", "return", "null", ";", "}" ]
Returns a {@link String} describing the difference between the {@code actual} and {@code expected} values, if possible, or {@code null} if not. <p>The implementation on the {@link Correspondence} base class always returns {@code null}. To enable diffing, use {@link #formattingDiffsUsing} (or override this method in a subclass, but factory methods are recommended over subclassing). <p>Assertions should only invoke this with parameters for which {@link #compare} returns {@code false}. <p>If this throws an exception, that implies that it is not possible to describe the diffs. An assertion will normally only call this method if it has established that its condition does not hold: good practice dictates that, if this method throws, the assertion should catch the exception and continue to describe the original failure as if this method had returned null, mentioning the failure from this method as additional information.
[ "Returns", "a", "{", "@link", "String", "}", "describing", "the", "difference", "between", "the", "{", "@code", "actual", "}", "and", "{", "@code", "expected", "}", "values", "if", "possible", "or", "{", "@code", "null", "}", "if", "not", "." ]
train
https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Correspondence.java#L709-L712
magro/memcached-session-manager
core/src/main/java/de/javakaffee/web/msm/StorageKeyFormat.java
StorageKeyFormat.of
public static StorageKeyFormat of(final String config, final String host, final String context, final String webappVersion) { if(config == null || config.trim().isEmpty()) return EMPTY; final String[] tokens = config.split(","); final StringBuilder sb = new StringBuilder(); for (int i = 0; i < tokens.length; i++) { final String value = PrefixTokenFactory.parse(tokens[i], host, context, webappVersion); if(value != null && !value.trim().isEmpty()) { if(sb.length() > 0) sb.append(STORAGE_TOKEN_SEP); sb.append(value); } } final String prefix = sb.length() == 0 ? null : sb.append(STORAGE_KEY_SEP).toString(); return new StorageKeyFormat(prefix, config); }
java
public static StorageKeyFormat of(final String config, final String host, final String context, final String webappVersion) { if(config == null || config.trim().isEmpty()) return EMPTY; final String[] tokens = config.split(","); final StringBuilder sb = new StringBuilder(); for (int i = 0; i < tokens.length; i++) { final String value = PrefixTokenFactory.parse(tokens[i], host, context, webappVersion); if(value != null && !value.trim().isEmpty()) { if(sb.length() > 0) sb.append(STORAGE_TOKEN_SEP); sb.append(value); } } final String prefix = sb.length() == 0 ? null : sb.append(STORAGE_KEY_SEP).toString(); return new StorageKeyFormat(prefix, config); }
[ "public", "static", "StorageKeyFormat", "of", "(", "final", "String", "config", ",", "final", "String", "host", ",", "final", "String", "context", ",", "final", "String", "webappVersion", ")", "{", "if", "(", "config", "==", "null", "||", "config", ".", "t...
Creates a new {@link StorageKeyFormat} for the given configuration. The configuration has the form <code>$token,$token</code> Some examples which config would create which output for the key / session id "foo" with context path "ctxt" and host "hst": <dl> <dt>static:x</dt><dd>x_foo</dd> <dt>host</dt><dd>hst_foo</dd> <dt>host.hash</dt><dd>e93c085e_foo</dd> <dt>context</dt><dd>ctxt_foo</dd> <dt>context.hash</dt><dd>45e6345f_foo</dd> <dt>host,context</dt><dd>hst:ctxt_foo</dd> <dt>webappVersion</dt><dd>001_foo</dd> <dt>host.hash,context.hash,webappVersion</dt><dd>e93c085e:45e6345f:001_foo</dd> </dl>
[ "Creates", "a", "new", "{", "@link", "StorageKeyFormat", "}", "for", "the", "given", "configuration", ".", "The", "configuration", "has", "the", "form", "<code", ">", "$token", "$token<", "/", "code", ">" ]
train
https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/StorageKeyFormat.java#L71-L88
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_network_public_GET
public ArrayList<OvhNetwork> project_serviceName_network_public_GET(String serviceName) throws IOException { String qPath = "/cloud/project/{serviceName}/network/public"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
java
public ArrayList<OvhNetwork> project_serviceName_network_public_GET(String serviceName) throws IOException { String qPath = "/cloud/project/{serviceName}/network/public"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
[ "public", "ArrayList", "<", "OvhNetwork", ">", "project_serviceName_network_public_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/network/public\"", ";", "StringBuilder", "sb", "=", "path", "(...
Get public networks REST: GET /cloud/project/{serviceName}/network/public @param serviceName [required] Service name
[ "Get", "public", "networks" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L861-L866
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.loadClass
Symbol loadClass(Env<AttrContext> env, Name name) { try { ClassSymbol c = reader.loadClass(name); return isAccessible(env, c) ? c : new AccessError(c); } catch (ClassReader.BadClassFile err) { throw err; } catch (CompletionFailure ex) { return typeNotFound; } }
java
Symbol loadClass(Env<AttrContext> env, Name name) { try { ClassSymbol c = reader.loadClass(name); return isAccessible(env, c) ? c : new AccessError(c); } catch (ClassReader.BadClassFile err) { throw err; } catch (CompletionFailure ex) { return typeNotFound; } }
[ "Symbol", "loadClass", "(", "Env", "<", "AttrContext", ">", "env", ",", "Name", "name", ")", "{", "try", "{", "ClassSymbol", "c", "=", "reader", ".", "loadClass", "(", "name", ")", ";", "return", "isAccessible", "(", "env", ",", "c", ")", "?", "c", ...
Load toplevel or member class with given fully qualified name and verify that it is accessible. @param env The current environment. @param name The fully qualified name of the class to be loaded.
[ "Load", "toplevel", "or", "member", "class", "with", "given", "fully", "qualified", "name", "and", "verify", "that", "it", "is", "accessible", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L1905-L1914
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitConfigMonitor.java
GitConfigMonitor.addChange
@Override public void addChange(DiffEntry change) { if (checkConfigFilePath(change.getNewPath())) { Path configFilePath = new Path(this.repositoryDir, change.getNewPath()); try { Config flowConfig = loadConfigFileWithFlowNameOverrides(configFilePath); this.flowCatalog.put(FlowSpec.builder() .withConfig(flowConfig) .withVersion(SPEC_VERSION) .withDescription(SPEC_DESCRIPTION) .build()); } catch (IOException e) { log.warn("Could not load config file: " + configFilePath); } } }
java
@Override public void addChange(DiffEntry change) { if (checkConfigFilePath(change.getNewPath())) { Path configFilePath = new Path(this.repositoryDir, change.getNewPath()); try { Config flowConfig = loadConfigFileWithFlowNameOverrides(configFilePath); this.flowCatalog.put(FlowSpec.builder() .withConfig(flowConfig) .withVersion(SPEC_VERSION) .withDescription(SPEC_DESCRIPTION) .build()); } catch (IOException e) { log.warn("Could not load config file: " + configFilePath); } } }
[ "@", "Override", "public", "void", "addChange", "(", "DiffEntry", "change", ")", "{", "if", "(", "checkConfigFilePath", "(", "change", ".", "getNewPath", "(", ")", ")", ")", "{", "Path", "configFilePath", "=", "new", "Path", "(", "this", ".", "repositoryDi...
Add a {@link FlowSpec} for an added, updated, or modified flow config @param change
[ "Add", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitConfigMonitor.java#L94-L111
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/util/InjectionUtil.java
InjectionUtil.callMethod
public static <T> T callMethod(Class<T> retClass, Class<?> targetClass, Object target, String method, Class[] argClasses, Object[] args) { try { Method classMethod = targetClass.getDeclaredMethod(method, argClasses); return AccessController.doPrivileged( new SetMethodPrivilegedAction<T>(classMethod, target, args)); } catch (NoSuchMethodException e) { throw new TransfuseInjectionException("Exception during method injection: NoSuchFieldException", e); } catch (PrivilegedActionException e) { throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e); } catch (Exception e) { throw new TransfuseInjectionException("Exception during field injection", e); } }
java
public static <T> T callMethod(Class<T> retClass, Class<?> targetClass, Object target, String method, Class[] argClasses, Object[] args) { try { Method classMethod = targetClass.getDeclaredMethod(method, argClasses); return AccessController.doPrivileged( new SetMethodPrivilegedAction<T>(classMethod, target, args)); } catch (NoSuchMethodException e) { throw new TransfuseInjectionException("Exception during method injection: NoSuchFieldException", e); } catch (PrivilegedActionException e) { throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e); } catch (Exception e) { throw new TransfuseInjectionException("Exception during field injection", e); } }
[ "public", "static", "<", "T", ">", "T", "callMethod", "(", "Class", "<", "T", ">", "retClass", ",", "Class", "<", "?", ">", "targetClass", ",", "Object", "target", ",", "String", "method", ",", "Class", "[", "]", "argClasses", ",", "Object", "[", "]"...
Calls a method with the provided arguments as parameters. @param retClass the method return value @param targetClass the instance class @param target the instance containing the method @param method the method name @param argClasses types of the method arguments @param args method arguments used during invocation @param <T> relating type parameter @return method return value
[ "Calls", "a", "method", "with", "the", "provided", "arguments", "as", "parameters", "." ]
train
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/util/InjectionUtil.java#L144-L158
alkacon/opencms-core
src/org/opencms/xml/types/CmsXmlVfsImageValue.java
CmsXmlVfsImageValue.setParameterValue
private void setParameterValue(CmsObject cms, String key, String value) { if (m_parameters == null) { m_parameters = getParameterMap(getStringValue(cms)); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(value) && m_parameters.containsKey(key)) { m_parameters.remove(key); } else if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) { m_parameters.put(key, new String[] {value}); } String result = CmsRequestUtil.getRequestLink(getStringValue(cms)); result = CmsRequestUtil.appendParameters(result, m_parameters, false); setStringValue(cms, result); }
java
private void setParameterValue(CmsObject cms, String key, String value) { if (m_parameters == null) { m_parameters = getParameterMap(getStringValue(cms)); } if (CmsStringUtil.isEmptyOrWhitespaceOnly(value) && m_parameters.containsKey(key)) { m_parameters.remove(key); } else if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) { m_parameters.put(key, new String[] {value}); } String result = CmsRequestUtil.getRequestLink(getStringValue(cms)); result = CmsRequestUtil.appendParameters(result, m_parameters, false); setStringValue(cms, result); }
[ "private", "void", "setParameterValue", "(", "CmsObject", "cms", ",", "String", "key", ",", "String", "value", ")", "{", "if", "(", "m_parameters", "==", "null", ")", "{", "m_parameters", "=", "getParameterMap", "(", "getStringValue", "(", "cms", ")", ")", ...
Sets a parameter for the image with the provided key as name and the value.<p> @param cms the current users context @param key the parameter name to set @param value the value of the parameter
[ "Sets", "a", "parameter", "for", "the", "image", "with", "the", "provided", "key", "as", "name", "and", "the", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/types/CmsXmlVfsImageValue.java#L381-L394