repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/matcher/hamcrest/HamcrestValidationMatcher.java
HamcrestValidationMatcher.getMap
private Map<String, Object> getMap(String mapString) { """ Construct collection from delimited string expression. @param mapString @return """ Properties props = new Properties(); try { props.load(new StringReader(mapString.substring(1, mapString.length() - 1).replaceAll(",\\s*", "\n"))); } catch (IOException e) { throw new CitrusRuntimeException("Failed to reconstruct object of type map", e); } Map<String, Object> map = new LinkedHashMap<>(); for (Map.Entry<Object, Object> entry : props.entrySet()) { String key; Object value; if (entry.getKey() instanceof String) { key = VariableUtils.cutOffDoubleQuotes(entry.getKey().toString()); } else { key = entry.getKey().toString(); } if (entry.getValue() instanceof String) { value = VariableUtils.cutOffDoubleQuotes(entry.getValue().toString()).trim(); } else { value = entry.getValue(); } map.put(key, value); } return map; }
java
private Map<String, Object> getMap(String mapString) { Properties props = new Properties(); try { props.load(new StringReader(mapString.substring(1, mapString.length() - 1).replaceAll(",\\s*", "\n"))); } catch (IOException e) { throw new CitrusRuntimeException("Failed to reconstruct object of type map", e); } Map<String, Object> map = new LinkedHashMap<>(); for (Map.Entry<Object, Object> entry : props.entrySet()) { String key; Object value; if (entry.getKey() instanceof String) { key = VariableUtils.cutOffDoubleQuotes(entry.getKey().toString()); } else { key = entry.getKey().toString(); } if (entry.getValue() instanceof String) { value = VariableUtils.cutOffDoubleQuotes(entry.getValue().toString()).trim(); } else { value = entry.getValue(); } map.put(key, value); } return map; }
[ "private", "Map", "<", "String", ",", "Object", ">", "getMap", "(", "String", "mapString", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "try", "{", "props", ".", "load", "(", "new", "StringReader", "(", "mapString", ".", "substring", "(", "1", ",", "mapString", ".", "length", "(", ")", "-", "1", ")", ".", "replaceAll", "(", "\",\\\\s*\"", ",", "\"\\n\"", ")", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Failed to reconstruct object of type map\"", ",", "e", ")", ";", "}", "Map", "<", "String", ",", "Object", ">", "map", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "props", ".", "entrySet", "(", ")", ")", "{", "String", "key", ";", "Object", "value", ";", "if", "(", "entry", ".", "getKey", "(", ")", "instanceof", "String", ")", "{", "key", "=", "VariableUtils", ".", "cutOffDoubleQuotes", "(", "entry", ".", "getKey", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "else", "{", "key", "=", "entry", ".", "getKey", "(", ")", ".", "toString", "(", ")", ";", "}", "if", "(", "entry", ".", "getValue", "(", ")", "instanceof", "String", ")", "{", "value", "=", "VariableUtils", ".", "cutOffDoubleQuotes", "(", "entry", ".", "getValue", "(", ")", ".", "toString", "(", ")", ")", ".", "trim", "(", ")", ";", "}", "else", "{", "value", "=", "entry", ".", "getValue", "(", ")", ";", "}", "map", ".", "put", "(", "key", ",", "value", ")", ";", "}", "return", "map", ";", "}" ]
Construct collection from delimited string expression. @param mapString @return
[ "Construct", "collection", "from", "delimited", "string", "expression", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/matcher/hamcrest/HamcrestValidationMatcher.java#L271-L300
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java
ExtendedByteBuf.readMaybeVInt
public static Optional<Integer> readMaybeVInt(ByteBuf bf) { """ Reads a variable size int if possible. If not present the reader index is reset to the last mark. @param bf @return """ if (bf.readableBytes() >= 1) { byte b = bf.readByte(); return read(bf, b, 7, b & 0x7F, 1); } else { bf.resetReaderIndex(); return Optional.empty(); } }
java
public static Optional<Integer> readMaybeVInt(ByteBuf bf) { if (bf.readableBytes() >= 1) { byte b = bf.readByte(); return read(bf, b, 7, b & 0x7F, 1); } else { bf.resetReaderIndex(); return Optional.empty(); } }
[ "public", "static", "Optional", "<", "Integer", ">", "readMaybeVInt", "(", "ByteBuf", "bf", ")", "{", "if", "(", "bf", ".", "readableBytes", "(", ")", ">=", "1", ")", "{", "byte", "b", "=", "bf", ".", "readByte", "(", ")", ";", "return", "read", "(", "bf", ",", "b", ",", "7", ",", "b", "&", "0x7F", ",", "1", ")", ";", "}", "else", "{", "bf", ".", "resetReaderIndex", "(", ")", ";", "return", "Optional", ".", "empty", "(", ")", ";", "}", "}" ]
Reads a variable size int if possible. If not present the reader index is reset to the last mark. @param bf @return
[ "Reads", "a", "variable", "size", "int", "if", "possible", ".", "If", "not", "present", "the", "reader", "index", "is", "reset", "to", "the", "last", "mark", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java#L145-L153
facebookarchive/nifty
nifty-ssl/src/main/java/com/facebook/nifty/ssl/NiftyOpenSslServerContext.java
NiftyOpenSslServerContext.newEngine
public SSLEngine newEngine() { """ Returns a new server-side {@link SSLEngine} with the current configuration. """ if (nextProtocols.isEmpty()) { return new OpenSslEngine(ctx, bufferPool, null); } else { return new OpenSslEngine( ctx, bufferPool, nextProtocols.get(nextProtocols.size() - 1)); } }
java
public SSLEngine newEngine() { if (nextProtocols.isEmpty()) { return new OpenSslEngine(ctx, bufferPool, null); } else { return new OpenSslEngine( ctx, bufferPool, nextProtocols.get(nextProtocols.size() - 1)); } }
[ "public", "SSLEngine", "newEngine", "(", ")", "{", "if", "(", "nextProtocols", ".", "isEmpty", "(", ")", ")", "{", "return", "new", "OpenSslEngine", "(", "ctx", ",", "bufferPool", ",", "null", ")", ";", "}", "else", "{", "return", "new", "OpenSslEngine", "(", "ctx", ",", "bufferPool", ",", "nextProtocols", ".", "get", "(", "nextProtocols", ".", "size", "(", ")", "-", "1", ")", ")", ";", "}", "}" ]
Returns a new server-side {@link SSLEngine} with the current configuration.
[ "Returns", "a", "new", "server", "-", "side", "{" ]
train
https://github.com/facebookarchive/nifty/blob/ccacff7f0a723abe0b9ed399bcc3bc85784e7396/nifty-ssl/src/main/java/com/facebook/nifty/ssl/NiftyOpenSslServerContext.java#L266-L273
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/protocol/json/JsonContent.java
JsonContent.createJsonContent
public static JsonContent createJsonContent(HttpResponse httpResponse, JsonFactory jsonFactory) { """ Static factory method to create a JsonContent object from the contents of the HttpResponse provided """ byte[] rawJsonContent = null; try { if (httpResponse.getContent() != null) { rawJsonContent = IOUtils.toByteArray(httpResponse.getContent()); } } catch (Exception e) { LOG.debug("Unable to read HTTP response content", e); } return new JsonContent(rawJsonContent, new ObjectMapper(jsonFactory) .configure(JsonParser.Feature.ALLOW_COMMENTS, true)); }
java
public static JsonContent createJsonContent(HttpResponse httpResponse, JsonFactory jsonFactory) { byte[] rawJsonContent = null; try { if (httpResponse.getContent() != null) { rawJsonContent = IOUtils.toByteArray(httpResponse.getContent()); } } catch (Exception e) { LOG.debug("Unable to read HTTP response content", e); } return new JsonContent(rawJsonContent, new ObjectMapper(jsonFactory) .configure(JsonParser.Feature.ALLOW_COMMENTS, true)); }
[ "public", "static", "JsonContent", "createJsonContent", "(", "HttpResponse", "httpResponse", ",", "JsonFactory", "jsonFactory", ")", "{", "byte", "[", "]", "rawJsonContent", "=", "null", ";", "try", "{", "if", "(", "httpResponse", ".", "getContent", "(", ")", "!=", "null", ")", "{", "rawJsonContent", "=", "IOUtils", ".", "toByteArray", "(", "httpResponse", ".", "getContent", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "debug", "(", "\"Unable to read HTTP response content\"", ",", "e", ")", ";", "}", "return", "new", "JsonContent", "(", "rawJsonContent", ",", "new", "ObjectMapper", "(", "jsonFactory", ")", ".", "configure", "(", "JsonParser", ".", "Feature", ".", "ALLOW_COMMENTS", ",", "true", ")", ")", ";", "}" ]
Static factory method to create a JsonContent object from the contents of the HttpResponse provided
[ "Static", "factory", "method", "to", "create", "a", "JsonContent", "object", "from", "the", "contents", "of", "the", "HttpResponse", "provided" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/protocol/json/JsonContent.java#L43-L55
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/AWSS3V4Signer.java
AWSS3V4Signer.getContentLength
static long getContentLength(SignableRequest<?> request) throws IOException { """ Read the content of the request to get the length of the stream. This method will wrap the stream by SdkBufferedInputStream if it is not mark-supported. """ final InputStream content = request.getContent(); if (!content.markSupported()) throw new IllegalStateException("Bug: request input stream must have been made mark-and-resettable at this point"); ReadLimitInfo info = request.getReadLimitInfo(); final int readLimit = info.getReadLimit(); long contentLength = 0; byte[] tmp = new byte[4096]; int read; content.mark(readLimit); while ((read = content.read(tmp)) != -1) { contentLength += read; } try { content.reset(); } catch(IOException ex) { throw new ResetException("Failed to reset the input stream", ex); } return contentLength; }
java
static long getContentLength(SignableRequest<?> request) throws IOException { final InputStream content = request.getContent(); if (!content.markSupported()) throw new IllegalStateException("Bug: request input stream must have been made mark-and-resettable at this point"); ReadLimitInfo info = request.getReadLimitInfo(); final int readLimit = info.getReadLimit(); long contentLength = 0; byte[] tmp = new byte[4096]; int read; content.mark(readLimit); while ((read = content.read(tmp)) != -1) { contentLength += read; } try { content.reset(); } catch(IOException ex) { throw new ResetException("Failed to reset the input stream", ex); } return contentLength; }
[ "static", "long", "getContentLength", "(", "SignableRequest", "<", "?", ">", "request", ")", "throws", "IOException", "{", "final", "InputStream", "content", "=", "request", ".", "getContent", "(", ")", ";", "if", "(", "!", "content", ".", "markSupported", "(", ")", ")", "throw", "new", "IllegalStateException", "(", "\"Bug: request input stream must have been made mark-and-resettable at this point\"", ")", ";", "ReadLimitInfo", "info", "=", "request", ".", "getReadLimitInfo", "(", ")", ";", "final", "int", "readLimit", "=", "info", ".", "getReadLimit", "(", ")", ";", "long", "contentLength", "=", "0", ";", "byte", "[", "]", "tmp", "=", "new", "byte", "[", "4096", "]", ";", "int", "read", ";", "content", ".", "mark", "(", "readLimit", ")", ";", "while", "(", "(", "read", "=", "content", ".", "read", "(", "tmp", ")", ")", "!=", "-", "1", ")", "{", "contentLength", "+=", "read", ";", "}", "try", "{", "content", ".", "reset", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "ResetException", "(", "\"Failed to reset the input stream\"", ",", "ex", ")", ";", "}", "return", "contentLength", ";", "}" ]
Read the content of the request to get the length of the stream. This method will wrap the stream by SdkBufferedInputStream if it is not mark-supported.
[ "Read", "the", "content", "of", "the", "request", "to", "get", "the", "length", "of", "the", "stream", ".", "This", "method", "will", "wrap", "the", "stream", "by", "SdkBufferedInputStream", "if", "it", "is", "not", "mark", "-", "supported", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/AWSS3V4Signer.java#L180-L199
getsentry/sentry-java
sentry/src/main/java/io/sentry/jvmti/FrameCache.java
FrameCache.add
public static void add(Throwable throwable, Frame[] frames) { """ Store the per-frame local variable information for the last exception thrown on this thread. @param throwable Throwable that the provided {@link Frame}s represent. @param frames Array of {@link Frame}s to store """ Map<Throwable, Frame[]> weakMap = cache.get(); weakMap.put(throwable, frames); }
java
public static void add(Throwable throwable, Frame[] frames) { Map<Throwable, Frame[]> weakMap = cache.get(); weakMap.put(throwable, frames); }
[ "public", "static", "void", "add", "(", "Throwable", "throwable", ",", "Frame", "[", "]", "frames", ")", "{", "Map", "<", "Throwable", ",", "Frame", "[", "]", ">", "weakMap", "=", "cache", ".", "get", "(", ")", ";", "weakMap", ".", "put", "(", "throwable", ",", "frames", ")", ";", "}" ]
Store the per-frame local variable information for the last exception thrown on this thread. @param throwable Throwable that the provided {@link Frame}s represent. @param frames Array of {@link Frame}s to store
[ "Store", "the", "per", "-", "frame", "local", "variable", "information", "for", "the", "last", "exception", "thrown", "on", "this", "thread", "." ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/jvmti/FrameCache.java#L33-L36
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java
JsonUtil.writeValue
public static void writeValue(JsonWriter writer, String name, String value) throws IOException { """ helper methods to decouple value write from value get (can probably throw an exception) """ writer.name(name).value(value); }
java
public static void writeValue(JsonWriter writer, String name, String value) throws IOException { writer.name(name).value(value); }
[ "public", "static", "void", "writeValue", "(", "JsonWriter", "writer", ",", "String", "name", ",", "String", "value", ")", "throws", "IOException", "{", "writer", ".", "name", "(", "name", ")", ".", "value", "(", "value", ")", ";", "}" ]
helper methods to decouple value write from value get (can probably throw an exception)
[ "helper", "methods", "to", "decouple", "value", "write", "from", "value", "get", "(", "can", "probably", "throw", "an", "exception", ")" ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java#L920-L922
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java
AvroUtils.removeUncomparableFields
public static Optional<Schema> removeUncomparableFields(Schema schema) { """ Remove map, array, enum fields, as well as union fields that contain map, array or enum, from an Avro schema. A schema with these fields cannot be used as Mapper key in a MapReduce job. """ return removeUncomparableFields(schema, Sets.<Schema> newHashSet()); }
java
public static Optional<Schema> removeUncomparableFields(Schema schema) { return removeUncomparableFields(schema, Sets.<Schema> newHashSet()); }
[ "public", "static", "Optional", "<", "Schema", ">", "removeUncomparableFields", "(", "Schema", "schema", ")", "{", "return", "removeUncomparableFields", "(", "schema", ",", "Sets", ".", "<", "Schema", ">", "newHashSet", "(", ")", ")", ";", "}" ]
Remove map, array, enum fields, as well as union fields that contain map, array or enum, from an Avro schema. A schema with these fields cannot be used as Mapper key in a MapReduce job.
[ "Remove", "map", "array", "enum", "fields", "as", "well", "as", "union", "fields", "that", "contain", "map", "array", "or", "enum", "from", "an", "Avro", "schema", ".", "A", "schema", "with", "these", "fields", "cannot", "be", "used", "as", "Mapper", "key", "in", "a", "MapReduce", "job", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java#L602-L604
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/StringUtils.java
StringUtils.getEnumFromString
public static <T extends Enum<T>> T getEnumFromString(Class<T> c, String string) { """ A common method for all enums since they can't have another base class @param <T> Enum type @param c enum type. All enums must be all caps. @param string case insensitive @return corresponding enum, or null """ if (c != null && string != null) { return Enum.valueOf(c, string.trim().toUpperCase()); } return null; }
java
public static <T extends Enum<T>> T getEnumFromString(Class<T> c, String string) { if (c != null && string != null) { return Enum.valueOf(c, string.trim().toUpperCase()); } return null; }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "getEnumFromString", "(", "Class", "<", "T", ">", "c", ",", "String", "string", ")", "{", "if", "(", "c", "!=", "null", "&&", "string", "!=", "null", ")", "{", "return", "Enum", ".", "valueOf", "(", "c", ",", "string", ".", "trim", "(", ")", ".", "toUpperCase", "(", ")", ")", ";", "}", "return", "null", ";", "}" ]
A common method for all enums since they can't have another base class @param <T> Enum type @param c enum type. All enums must be all caps. @param string case insensitive @return corresponding enum, or null
[ "A", "common", "method", "for", "all", "enums", "since", "they", "can", "t", "have", "another", "base", "class" ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/StringUtils.java#L108-L113
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableProperty.java
AbstractReadableProperty.doNotifyListeners
private void doNotifyListeners(R oldValue, R newValue) { """ Notifies the listeners that the property value has changed, unconditionally. @param oldValue Previous value. @param newValue New value. """ List<ValueChangeListener<R>> listenersCopy = new ArrayList<ValueChangeListener<R>>(listeners); notifyingListeners = true; for (ValueChangeListener<R> listener : listenersCopy) { listener.valueChanged(this, oldValue, newValue); } notifyingListeners = false; }
java
private void doNotifyListeners(R oldValue, R newValue) { List<ValueChangeListener<R>> listenersCopy = new ArrayList<ValueChangeListener<R>>(listeners); notifyingListeners = true; for (ValueChangeListener<R> listener : listenersCopy) { listener.valueChanged(this, oldValue, newValue); } notifyingListeners = false; }
[ "private", "void", "doNotifyListeners", "(", "R", "oldValue", ",", "R", "newValue", ")", "{", "List", "<", "ValueChangeListener", "<", "R", ">>", "listenersCopy", "=", "new", "ArrayList", "<", "ValueChangeListener", "<", "R", ">", ">", "(", "listeners", ")", ";", "notifyingListeners", "=", "true", ";", "for", "(", "ValueChangeListener", "<", "R", ">", "listener", ":", "listenersCopy", ")", "{", "listener", ".", "valueChanged", "(", "this", ",", "oldValue", ",", "newValue", ")", ";", "}", "notifyingListeners", "=", "false", ";", "}" ]
Notifies the listeners that the property value has changed, unconditionally. @param oldValue Previous value. @param newValue New value.
[ "Notifies", "the", "listeners", "that", "the", "property", "value", "has", "changed", "unconditionally", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableProperty.java#L203-L210
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsFadeAnimation.java
CmsFadeAnimation.fadeOut
public static CmsFadeAnimation fadeOut(Element element, Command callback, int duration) { """ Fades the given element out of view executing the callback afterwards.<p> @param element the element to fade out @param callback the callback @param duration the animation duration @return the running animation object """ CmsFadeAnimation animation = new CmsFadeAnimation(element, false, callback); animation.run(duration); return animation; }
java
public static CmsFadeAnimation fadeOut(Element element, Command callback, int duration) { CmsFadeAnimation animation = new CmsFadeAnimation(element, false, callback); animation.run(duration); return animation; }
[ "public", "static", "CmsFadeAnimation", "fadeOut", "(", "Element", "element", ",", "Command", "callback", ",", "int", "duration", ")", "{", "CmsFadeAnimation", "animation", "=", "new", "CmsFadeAnimation", "(", "element", ",", "false", ",", "callback", ")", ";", "animation", ".", "run", "(", "duration", ")", ";", "return", "animation", ";", "}" ]
Fades the given element out of view executing the callback afterwards.<p> @param element the element to fade out @param callback the callback @param duration the animation duration @return the running animation object
[ "Fades", "the", "given", "element", "out", "of", "view", "executing", "the", "callback", "afterwards", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsFadeAnimation.java#L85-L90
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/release/maven/PomTransformer.java
PomTransformer.invoke
public Boolean invoke(File pomFile, VirtualChannel channel) throws IOException, InterruptedException { """ Performs the transformation. @return True if the file was modified. """ org.jfrog.build.extractor.maven.reader.ModuleName current = new org.jfrog.build.extractor.maven.reader.ModuleName( currentModule.groupId, currentModule.artifactId); Map<org.jfrog.build.extractor.maven.reader.ModuleName, String> modules = Maps.newLinkedHashMap(); for (Map.Entry<ModuleName, String> entry : versionsByModule.entrySet()) { modules.put(new org.jfrog.build.extractor.maven.reader.ModuleName( entry.getKey().groupId, entry.getKey().artifactId), entry.getValue()); } org.jfrog.build.extractor.maven.transformer.PomTransformer transformer = new org.jfrog.build.extractor.maven.transformer.PomTransformer(current, modules, scmUrl, failOnSnapshot); return transformer.transform(pomFile); }
java
public Boolean invoke(File pomFile, VirtualChannel channel) throws IOException, InterruptedException { org.jfrog.build.extractor.maven.reader.ModuleName current = new org.jfrog.build.extractor.maven.reader.ModuleName( currentModule.groupId, currentModule.artifactId); Map<org.jfrog.build.extractor.maven.reader.ModuleName, String> modules = Maps.newLinkedHashMap(); for (Map.Entry<ModuleName, String> entry : versionsByModule.entrySet()) { modules.put(new org.jfrog.build.extractor.maven.reader.ModuleName( entry.getKey().groupId, entry.getKey().artifactId), entry.getValue()); } org.jfrog.build.extractor.maven.transformer.PomTransformer transformer = new org.jfrog.build.extractor.maven.transformer.PomTransformer(current, modules, scmUrl, failOnSnapshot); return transformer.transform(pomFile); }
[ "public", "Boolean", "invoke", "(", "File", "pomFile", ",", "VirtualChannel", "channel", ")", "throws", "IOException", ",", "InterruptedException", "{", "org", ".", "jfrog", ".", "build", ".", "extractor", ".", "maven", ".", "reader", ".", "ModuleName", "current", "=", "new", "org", ".", "jfrog", ".", "build", ".", "extractor", ".", "maven", ".", "reader", ".", "ModuleName", "(", "currentModule", ".", "groupId", ",", "currentModule", ".", "artifactId", ")", ";", "Map", "<", "org", ".", "jfrog", ".", "build", ".", "extractor", ".", "maven", ".", "reader", ".", "ModuleName", ",", "String", ">", "modules", "=", "Maps", ".", "newLinkedHashMap", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "ModuleName", ",", "String", ">", "entry", ":", "versionsByModule", ".", "entrySet", "(", ")", ")", "{", "modules", ".", "put", "(", "new", "org", ".", "jfrog", ".", "build", ".", "extractor", ".", "maven", ".", "reader", ".", "ModuleName", "(", "entry", ".", "getKey", "(", ")", ".", "groupId", ",", "entry", ".", "getKey", "(", ")", ".", "artifactId", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "org", ".", "jfrog", ".", "build", ".", "extractor", ".", "maven", ".", "transformer", ".", "PomTransformer", "transformer", "=", "new", "org", ".", "jfrog", ".", "build", ".", "extractor", ".", "maven", ".", "transformer", ".", "PomTransformer", "(", "current", ",", "modules", ",", "scmUrl", ",", "failOnSnapshot", ")", ";", "return", "transformer", ".", "transform", "(", "pomFile", ")", ";", "}" ]
Performs the transformation. @return True if the file was modified.
[ "Performs", "the", "transformation", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/maven/PomTransformer.java#L61-L77
Harium/keel
src/main/java/com/harium/keel/catalano/math/tools/ImageStatistics.java
ImageStatistics.Variance
public static float Variance(ImageSource fastBitmap, float mean, int startX, int startY, int width, int height) { """ Calculate Variance. @param fastBitmap Image to be processed. @param mean Mean. @param startX Initial X axis coordinate. @param startY Initial Y axis coordinate. @param width Width. @param height Height. @return Variance. """ float sum = 0; if (fastBitmap.isGrayscale()) { for (int i = startX; i < height; i++) { for (int j = startY; j < width; j++) { sum += Math.pow(fastBitmap.getRGB(j, i) - mean, 2); } } return sum / (float) ((width * height) - 1); } else { throw new IllegalArgumentException("ImageStatistics: Only compute variance in grayscale images."); } }
java
public static float Variance(ImageSource fastBitmap, float mean, int startX, int startY, int width, int height) { float sum = 0; if (fastBitmap.isGrayscale()) { for (int i = startX; i < height; i++) { for (int j = startY; j < width; j++) { sum += Math.pow(fastBitmap.getRGB(j, i) - mean, 2); } } return sum / (float) ((width * height) - 1); } else { throw new IllegalArgumentException("ImageStatistics: Only compute variance in grayscale images."); } }
[ "public", "static", "float", "Variance", "(", "ImageSource", "fastBitmap", ",", "float", "mean", ",", "int", "startX", ",", "int", "startY", ",", "int", "width", ",", "int", "height", ")", "{", "float", "sum", "=", "0", ";", "if", "(", "fastBitmap", ".", "isGrayscale", "(", ")", ")", "{", "for", "(", "int", "i", "=", "startX", ";", "i", "<", "height", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "startY", ";", "j", "<", "width", ";", "j", "++", ")", "{", "sum", "+=", "Math", ".", "pow", "(", "fastBitmap", ".", "getRGB", "(", "j", ",", "i", ")", "-", "mean", ",", "2", ")", ";", "}", "}", "return", "sum", "/", "(", "float", ")", "(", "(", "width", "*", "height", ")", "-", "1", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"ImageStatistics: Only compute variance in grayscale images.\"", ")", ";", "}", "}" ]
Calculate Variance. @param fastBitmap Image to be processed. @param mean Mean. @param startX Initial X axis coordinate. @param startY Initial Y axis coordinate. @param width Width. @param height Height. @return Variance.
[ "Calculate", "Variance", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/tools/ImageStatistics.java#L228-L241
jenkinsci/jenkins
core/src/main/java/hudson/model/Computer.java
Computer.getDisplayExecutors
@Restricted(NoExternalUse.class) public List<DisplayExecutor> getDisplayExecutors() { """ Used to render the list of executors. @return a snapshot of the executor display information @since 1.607 """ // The size may change while we are populating, but let's start with a reasonable guess to minimize resizing List<DisplayExecutor> result = new ArrayList<>(executors.size() + oneOffExecutors.size()); int index = 0; for (Executor e: executors) { if (e.isDisplayCell()) { result.add(new DisplayExecutor(Integer.toString(index + 1), String.format("executors/%d", index), e)); } index++; } index = 0; for (OneOffExecutor e: oneOffExecutors) { if (e.isDisplayCell()) { result.add(new DisplayExecutor("", String.format("oneOffExecutors/%d", index), e)); } index++; } return result; }
java
@Restricted(NoExternalUse.class) public List<DisplayExecutor> getDisplayExecutors() { // The size may change while we are populating, but let's start with a reasonable guess to minimize resizing List<DisplayExecutor> result = new ArrayList<>(executors.size() + oneOffExecutors.size()); int index = 0; for (Executor e: executors) { if (e.isDisplayCell()) { result.add(new DisplayExecutor(Integer.toString(index + 1), String.format("executors/%d", index), e)); } index++; } index = 0; for (OneOffExecutor e: oneOffExecutors) { if (e.isDisplayCell()) { result.add(new DisplayExecutor("", String.format("oneOffExecutors/%d", index), e)); } index++; } return result; }
[ "@", "Restricted", "(", "NoExternalUse", ".", "class", ")", "public", "List", "<", "DisplayExecutor", ">", "getDisplayExecutors", "(", ")", "{", "// The size may change while we are populating, but let's start with a reasonable guess to minimize resizing", "List", "<", "DisplayExecutor", ">", "result", "=", "new", "ArrayList", "<>", "(", "executors", ".", "size", "(", ")", "+", "oneOffExecutors", ".", "size", "(", ")", ")", ";", "int", "index", "=", "0", ";", "for", "(", "Executor", "e", ":", "executors", ")", "{", "if", "(", "e", ".", "isDisplayCell", "(", ")", ")", "{", "result", ".", "add", "(", "new", "DisplayExecutor", "(", "Integer", ".", "toString", "(", "index", "+", "1", ")", ",", "String", ".", "format", "(", "\"executors/%d\"", ",", "index", ")", ",", "e", ")", ")", ";", "}", "index", "++", ";", "}", "index", "=", "0", ";", "for", "(", "OneOffExecutor", "e", ":", "oneOffExecutors", ")", "{", "if", "(", "e", ".", "isDisplayCell", "(", ")", ")", "{", "result", ".", "add", "(", "new", "DisplayExecutor", "(", "\"\"", ",", "String", ".", "format", "(", "\"oneOffExecutors/%d\"", ",", "index", ")", ",", "e", ")", ")", ";", "}", "index", "++", ";", "}", "return", "result", ";", "}" ]
Used to render the list of executors. @return a snapshot of the executor display information @since 1.607
[ "Used", "to", "render", "the", "list", "of", "executors", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Computer.java#L997-L1016
Red5/red5-io
src/main/java/org/red5/compatibility/flex/messaging/io/ObjectProxy.java
ObjectProxy.put
@Override public V put(T name, V value) { """ Change a property of the proxied object. @param name name @param value value @return old value """ return item.put(name, value); }
java
@Override public V put(T name, V value) { return item.put(name, value); }
[ "@", "Override", "public", "V", "put", "(", "T", "name", ",", "V", "value", ")", "{", "return", "item", ".", "put", "(", "name", ",", "value", ")", ";", "}" ]
Change a property of the proxied object. @param name name @param value value @return old value
[ "Change", "a", "property", "of", "the", "proxied", "object", "." ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/compatibility/flex/messaging/io/ObjectProxy.java#L147-L150
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/utils/reflection/ClassUtils.java
ClassUtils.getClass
public static Class<?> getClass(ClassLoader classLoader, String className) { """ Attempt to load the class matching the given qualified name @param classLoader Classloader to use @param className The classname to use @throws IllegalArgumentException If the class cannot be loaded @return The {@link Class} representing the given class """ try { final Class<?> clazz; if (PRIMITIVE_MAPPING.containsKey(className)) { String qualifiedName = "[" + PRIMITIVE_MAPPING.get(className); clazz = Class.forName(qualifiedName, true, classLoader).getComponentType(); } else { clazz = Class.forName(determineQualifiedName(className), true, classLoader); } return clazz; } catch (ClassNotFoundException ex) { int lastSeparatorIndex = className.lastIndexOf(PACKAGE_SEPARATOR_CHARACTER); if (lastSeparatorIndex != -1) { return getClass(classLoader, className.substring(0, lastSeparatorIndex) + INNER_CLASS_SEPARATOR_CHAR + className.substring(lastSeparatorIndex + 1)); } throw new IllegalArgumentException("Unable to unmarshall String to Class: " + className); } }
java
public static Class<?> getClass(ClassLoader classLoader, String className) { try { final Class<?> clazz; if (PRIMITIVE_MAPPING.containsKey(className)) { String qualifiedName = "[" + PRIMITIVE_MAPPING.get(className); clazz = Class.forName(qualifiedName, true, classLoader).getComponentType(); } else { clazz = Class.forName(determineQualifiedName(className), true, classLoader); } return clazz; } catch (ClassNotFoundException ex) { int lastSeparatorIndex = className.lastIndexOf(PACKAGE_SEPARATOR_CHARACTER); if (lastSeparatorIndex != -1) { return getClass(classLoader, className.substring(0, lastSeparatorIndex) + INNER_CLASS_SEPARATOR_CHAR + className.substring(lastSeparatorIndex + 1)); } throw new IllegalArgumentException("Unable to unmarshall String to Class: " + className); } }
[ "public", "static", "Class", "<", "?", ">", "getClass", "(", "ClassLoader", "classLoader", ",", "String", "className", ")", "{", "try", "{", "final", "Class", "<", "?", ">", "clazz", ";", "if", "(", "PRIMITIVE_MAPPING", ".", "containsKey", "(", "className", ")", ")", "{", "String", "qualifiedName", "=", "\"[\"", "+", "PRIMITIVE_MAPPING", ".", "get", "(", "className", ")", ";", "clazz", "=", "Class", ".", "forName", "(", "qualifiedName", ",", "true", ",", "classLoader", ")", ".", "getComponentType", "(", ")", ";", "}", "else", "{", "clazz", "=", "Class", ".", "forName", "(", "determineQualifiedName", "(", "className", ")", ",", "true", ",", "classLoader", ")", ";", "}", "return", "clazz", ";", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "int", "lastSeparatorIndex", "=", "className", ".", "lastIndexOf", "(", "PACKAGE_SEPARATOR_CHARACTER", ")", ";", "if", "(", "lastSeparatorIndex", "!=", "-", "1", ")", "{", "return", "getClass", "(", "classLoader", ",", "className", ".", "substring", "(", "0", ",", "lastSeparatorIndex", ")", "+", "INNER_CLASS_SEPARATOR_CHAR", "+", "className", ".", "substring", "(", "lastSeparatorIndex", "+", "1", ")", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Unable to unmarshall String to Class: \"", "+", "className", ")", ";", "}", "}" ]
Attempt to load the class matching the given qualified name @param classLoader Classloader to use @param className The classname to use @throws IllegalArgumentException If the class cannot be loaded @return The {@link Class} representing the given class
[ "Attempt", "to", "load", "the", "class", "matching", "the", "given", "qualified", "name" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/utils/reflection/ClassUtils.java#L67-L90
scaleset/scaleset-geo
src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java
GoogleMapsTileMath.lngLatToMeters
public Envelope lngLatToMeters(Envelope env) { """ Transforms given lat/lon in WGS84 Datum to XY in Spherical Mercator EPSG:3857 @param env The envelope to transform @return The envelope transformed to EPSG:3857 """ Coordinate min = lngLatToMeters(env.getMinX(), env.getMinY()); Coordinate max = lngLatToMeters(env.getMaxX(), env.getMaxY()); Envelope result = new Envelope(min.x, max.x, min.y, max.y); return result; }
java
public Envelope lngLatToMeters(Envelope env) { Coordinate min = lngLatToMeters(env.getMinX(), env.getMinY()); Coordinate max = lngLatToMeters(env.getMaxX(), env.getMaxY()); Envelope result = new Envelope(min.x, max.x, min.y, max.y); return result; }
[ "public", "Envelope", "lngLatToMeters", "(", "Envelope", "env", ")", "{", "Coordinate", "min", "=", "lngLatToMeters", "(", "env", ".", "getMinX", "(", ")", ",", "env", ".", "getMinY", "(", ")", ")", ";", "Coordinate", "max", "=", "lngLatToMeters", "(", "env", ".", "getMaxX", "(", ")", ",", "env", ".", "getMaxY", "(", ")", ")", ";", "Envelope", "result", "=", "new", "Envelope", "(", "min", ".", "x", ",", "max", ".", "x", ",", "min", ".", "y", ",", "max", ".", "y", ")", ";", "return", "result", ";", "}" ]
Transforms given lat/lon in WGS84 Datum to XY in Spherical Mercator EPSG:3857 @param env The envelope to transform @return The envelope transformed to EPSG:3857
[ "Transforms", "given", "lat", "/", "lon", "in", "WGS84", "Datum", "to", "XY", "in", "Spherical", "Mercator", "EPSG", ":", "3857" ]
train
https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L95-L100
pravega/pravega
common/src/main/java/io/pravega/common/util/BitConverter.java
BitConverter.readLong
public static long readLong(byte[] source, int position) { """ Reads a 64-bit long from the given byte array starting at the given position. @param source The byte array to read from. @param position The position in the byte array to start reading at. @return The read number. """ return (long) (source[position] & 0xFF) << 56 | (long) (source[position + 1] & 0xFF) << 48 | (long) (source[position + 2] & 0xFF) << 40 | (long) (source[position + 3] & 0xFF) << 32 | (long) (source[position + 4] & 0xFF) << 24 | (source[position + 5] & 0xFF) << 16 | (source[position + 6] & 0xFF) << 8 | (source[position + 7] & 0xFF); }
java
public static long readLong(byte[] source, int position) { return (long) (source[position] & 0xFF) << 56 | (long) (source[position + 1] & 0xFF) << 48 | (long) (source[position + 2] & 0xFF) << 40 | (long) (source[position + 3] & 0xFF) << 32 | (long) (source[position + 4] & 0xFF) << 24 | (source[position + 5] & 0xFF) << 16 | (source[position + 6] & 0xFF) << 8 | (source[position + 7] & 0xFF); }
[ "public", "static", "long", "readLong", "(", "byte", "[", "]", "source", ",", "int", "position", ")", "{", "return", "(", "long", ")", "(", "source", "[", "position", "]", "&", "0xFF", ")", "<<", "56", "|", "(", "long", ")", "(", "source", "[", "position", "+", "1", "]", "&", "0xFF", ")", "<<", "48", "|", "(", "long", ")", "(", "source", "[", "position", "+", "2", "]", "&", "0xFF", ")", "<<", "40", "|", "(", "long", ")", "(", "source", "[", "position", "+", "3", "]", "&", "0xFF", ")", "<<", "32", "|", "(", "long", ")", "(", "source", "[", "position", "+", "4", "]", "&", "0xFF", ")", "<<", "24", "|", "(", "source", "[", "position", "+", "5", "]", "&", "0xFF", ")", "<<", "16", "|", "(", "source", "[", "position", "+", "6", "]", "&", "0xFF", ")", "<<", "8", "|", "(", "source", "[", "position", "+", "7", "]", "&", "0xFF", ")", ";", "}" ]
Reads a 64-bit long from the given byte array starting at the given position. @param source The byte array to read from. @param position The position in the byte array to start reading at. @return The read number.
[ "Reads", "a", "64", "-", "bit", "long", "from", "the", "given", "byte", "array", "starting", "at", "the", "given", "position", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L260-L269
graphql-java/graphql-java
src/main/java/graphql/schema/idl/ArgValueOfAllowedTypeChecker.java
ArgValueOfAllowedTypeChecker.checkArgValueMatchesAllowedType
void checkArgValueMatchesAllowedType(List<GraphQLError> errors, Value instanceValue, Type allowedArgType) { """ Recursively inspects an argument value given an allowed type. Given the (invalid) SDL below: directive @myDirective(arg: [[String]] ) on FIELD_DEFINITION query { f: String @myDirective(arg: ["A String"]) } it will first check that the `myDirective.arg` type is an array and fail when finding "A String" as it expected a nested array ([[String]]). @param errors validation error collector @param instanceValue directive argument value @param allowedArgType directive definition argument allowed type """ if (allowedArgType instanceof TypeName) { checkArgValueMatchesAllowedTypeName(errors, instanceValue, allowedArgType); } else if (allowedArgType instanceof ListType) { checkArgValueMatchesAllowedListType(errors, instanceValue, (ListType) allowedArgType); } else if (allowedArgType instanceof NonNullType) { checkArgValueMatchesAllowedNonNullType(errors, instanceValue, (NonNullType) allowedArgType); } else { assertShouldNeverHappen("Unsupported Type '%s' was added. ", allowedArgType); } }
java
void checkArgValueMatchesAllowedType(List<GraphQLError> errors, Value instanceValue, Type allowedArgType) { if (allowedArgType instanceof TypeName) { checkArgValueMatchesAllowedTypeName(errors, instanceValue, allowedArgType); } else if (allowedArgType instanceof ListType) { checkArgValueMatchesAllowedListType(errors, instanceValue, (ListType) allowedArgType); } else if (allowedArgType instanceof NonNullType) { checkArgValueMatchesAllowedNonNullType(errors, instanceValue, (NonNullType) allowedArgType); } else { assertShouldNeverHappen("Unsupported Type '%s' was added. ", allowedArgType); } }
[ "void", "checkArgValueMatchesAllowedType", "(", "List", "<", "GraphQLError", ">", "errors", ",", "Value", "instanceValue", ",", "Type", "allowedArgType", ")", "{", "if", "(", "allowedArgType", "instanceof", "TypeName", ")", "{", "checkArgValueMatchesAllowedTypeName", "(", "errors", ",", "instanceValue", ",", "allowedArgType", ")", ";", "}", "else", "if", "(", "allowedArgType", "instanceof", "ListType", ")", "{", "checkArgValueMatchesAllowedListType", "(", "errors", ",", "instanceValue", ",", "(", "ListType", ")", "allowedArgType", ")", ";", "}", "else", "if", "(", "allowedArgType", "instanceof", "NonNullType", ")", "{", "checkArgValueMatchesAllowedNonNullType", "(", "errors", ",", "instanceValue", ",", "(", "NonNullType", ")", "allowedArgType", ")", ";", "}", "else", "{", "assertShouldNeverHappen", "(", "\"Unsupported Type '%s' was added. \"", ",", "allowedArgType", ")", ";", "}", "}" ]
Recursively inspects an argument value given an allowed type. Given the (invalid) SDL below: directive @myDirective(arg: [[String]] ) on FIELD_DEFINITION query { f: String @myDirective(arg: ["A String"]) } it will first check that the `myDirective.arg` type is an array and fail when finding "A String" as it expected a nested array ([[String]]). @param errors validation error collector @param instanceValue directive argument value @param allowedArgType directive definition argument allowed type
[ "Recursively", "inspects", "an", "argument", "value", "given", "an", "allowed", "type", ".", "Given", "the", "(", "invalid", ")", "SDL", "below", ":" ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/idl/ArgValueOfAllowedTypeChecker.java#L95-L105
geomajas/geomajas-project-graphics
graphics/src/main/java/org/geomajas/graphics/client/widget/SliderBar.java
SliderBar.stopSliding
private void stopSliding(boolean unhighlight, boolean fireEvent) { """ Stop sliding the knob. @param unhighlight true to change the style @param fireEvent true to fire the event """ if (unhighlight) { DOM.setElementProperty(lineElement, "className", SLIDER_LINE); DOM.setElementProperty(knobImage.getElement(), "className", SLIDER_KNOB); } }
java
private void stopSliding(boolean unhighlight, boolean fireEvent) { if (unhighlight) { DOM.setElementProperty(lineElement, "className", SLIDER_LINE); DOM.setElementProperty(knobImage.getElement(), "className", SLIDER_KNOB); } }
[ "private", "void", "stopSliding", "(", "boolean", "unhighlight", ",", "boolean", "fireEvent", ")", "{", "if", "(", "unhighlight", ")", "{", "DOM", ".", "setElementProperty", "(", "lineElement", ",", "\"className\"", ",", "SLIDER_LINE", ")", ";", "DOM", ".", "setElementProperty", "(", "knobImage", ".", "getElement", "(", ")", ",", "\"className\"", ",", "SLIDER_KNOB", ")", ";", "}", "}" ]
Stop sliding the knob. @param unhighlight true to change the style @param fireEvent true to fire the event
[ "Stop", "sliding", "the", "knob", "." ]
train
https://github.com/geomajas/geomajas-project-graphics/blob/1104196640e0ba455b8a619e774352a8e1e319ba/graphics/src/main/java/org/geomajas/graphics/client/widget/SliderBar.java#L945-L951
m-m-m/util
sandbox/src/main/java/net/sf/mmm/util/path/base/AbstractPathFactory.java
AbstractPathFactory.createPath
private Path createPath(PathUri uri) { """ @see #createPath(String) @param uri is the {@link PathUri}. @return the according {@link Path}. """ PathProvider provider = getProvider(uri); if (provider == null) { if (uri.getSchemePrefix() == null) { return Paths.get(uri.getPath()); } else { try { return Paths.get(new URI(uri.getUri())); } catch (URISyntaxException e) { throw new ResourceUriUndefinedException(e, uri.getUri()); } } } return provider.createResource(uri); }
java
private Path createPath(PathUri uri) { PathProvider provider = getProvider(uri); if (provider == null) { if (uri.getSchemePrefix() == null) { return Paths.get(uri.getPath()); } else { try { return Paths.get(new URI(uri.getUri())); } catch (URISyntaxException e) { throw new ResourceUriUndefinedException(e, uri.getUri()); } } } return provider.createResource(uri); }
[ "private", "Path", "createPath", "(", "PathUri", "uri", ")", "{", "PathProvider", "provider", "=", "getProvider", "(", "uri", ")", ";", "if", "(", "provider", "==", "null", ")", "{", "if", "(", "uri", ".", "getSchemePrefix", "(", ")", "==", "null", ")", "{", "return", "Paths", ".", "get", "(", "uri", ".", "getPath", "(", ")", ")", ";", "}", "else", "{", "try", "{", "return", "Paths", ".", "get", "(", "new", "URI", "(", "uri", ".", "getUri", "(", ")", ")", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "ResourceUriUndefinedException", "(", "e", ",", "uri", ".", "getUri", "(", ")", ")", ";", "}", "}", "}", "return", "provider", ".", "createResource", "(", "uri", ")", ";", "}" ]
@see #createPath(String) @param uri is the {@link PathUri}. @return the according {@link Path}.
[ "@see", "#createPath", "(", "String", ")" ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/sandbox/src/main/java/net/sf/mmm/util/path/base/AbstractPathFactory.java#L119-L134
eBay/parallec
src/main/java/io/parallec/core/task/ParallelTaskManager.java
ParallelTaskManager.removeTaskFromWaitQ
public synchronized boolean removeTaskFromWaitQ(ParallelTask taskTobeRemoved) { """ Removes the task from wait q. @param taskTobeRemoved the task tobe removed @return true, if successful """ boolean removed = false; for (ParallelTask task : waitQ) { if (task.getTaskId() == taskTobeRemoved.getTaskId()) { task.setState(ParallelTaskState.COMPLETED_WITH_ERROR); task.getTaskErrorMetas().add( new TaskErrorMeta(TaskErrorType.USER_CANCELED, "NA")); logger.info( "task {} removed from wait q. This task has been marked as USER CANCELED.", task.getTaskId()); removed = true; } } return removed; }
java
public synchronized boolean removeTaskFromWaitQ(ParallelTask taskTobeRemoved) { boolean removed = false; for (ParallelTask task : waitQ) { if (task.getTaskId() == taskTobeRemoved.getTaskId()) { task.setState(ParallelTaskState.COMPLETED_WITH_ERROR); task.getTaskErrorMetas().add( new TaskErrorMeta(TaskErrorType.USER_CANCELED, "NA")); logger.info( "task {} removed from wait q. This task has been marked as USER CANCELED.", task.getTaskId()); removed = true; } } return removed; }
[ "public", "synchronized", "boolean", "removeTaskFromWaitQ", "(", "ParallelTask", "taskTobeRemoved", ")", "{", "boolean", "removed", "=", "false", ";", "for", "(", "ParallelTask", "task", ":", "waitQ", ")", "{", "if", "(", "task", ".", "getTaskId", "(", ")", "==", "taskTobeRemoved", ".", "getTaskId", "(", ")", ")", "{", "task", ".", "setState", "(", "ParallelTaskState", ".", "COMPLETED_WITH_ERROR", ")", ";", "task", ".", "getTaskErrorMetas", "(", ")", ".", "add", "(", "new", "TaskErrorMeta", "(", "TaskErrorType", ".", "USER_CANCELED", ",", "\"NA\"", ")", ")", ";", "logger", ".", "info", "(", "\"task {} removed from wait q. This task has been marked as USER CANCELED.\"", ",", "task", ".", "getTaskId", "(", ")", ")", ";", "removed", "=", "true", ";", "}", "}", "return", "removed", ";", "}" ]
Removes the task from wait q. @param taskTobeRemoved the task tobe removed @return true, if successful
[ "Removes", "the", "task", "from", "wait", "q", "." ]
train
https://github.com/eBay/parallec/blob/1b4f1628f34fedfb06b24c33a5372d64d3df0952/src/main/java/io/parallec/core/task/ParallelTaskManager.java#L228-L244
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/handler/bundle/AbstractResourceBundleHandler.java
AbstractResourceBundleHandler.getStoredBundlePath
private String getStoredBundlePath(String rootDir, String bundleName) { """ Resolves the file path of the bundle from the root directory. @param rootDir the rootDir @param bundleName the bundle name @return the file path """ if (bundleName.indexOf('/') != -1) { bundleName = bundleName.replace('/', File.separatorChar); } if (!bundleName.startsWith(File.separator)) { rootDir += File.separator; } return rootDir + PathNormalizer.escapeToPhysicalPath(bundleName); }
java
private String getStoredBundlePath(String rootDir, String bundleName) { if (bundleName.indexOf('/') != -1) { bundleName = bundleName.replace('/', File.separatorChar); } if (!bundleName.startsWith(File.separator)) { rootDir += File.separator; } return rootDir + PathNormalizer.escapeToPhysicalPath(bundleName); }
[ "private", "String", "getStoredBundlePath", "(", "String", "rootDir", ",", "String", "bundleName", ")", "{", "if", "(", "bundleName", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "{", "bundleName", "=", "bundleName", ".", "replace", "(", "'", "'", ",", "File", ".", "separatorChar", ")", ";", "}", "if", "(", "!", "bundleName", ".", "startsWith", "(", "File", ".", "separator", ")", ")", "{", "rootDir", "+=", "File", ".", "separator", ";", "}", "return", "rootDir", "+", "PathNormalizer", ".", "escapeToPhysicalPath", "(", "bundleName", ")", ";", "}" ]
Resolves the file path of the bundle from the root directory. @param rootDir the rootDir @param bundleName the bundle name @return the file path
[ "Resolves", "the", "file", "path", "of", "the", "bundle", "from", "the", "root", "directory", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/handler/bundle/AbstractResourceBundleHandler.java#L449-L459
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processProjectProperties
public void processProjectProperties(List<Row> rows, Integer projectID) { """ Process project properties. @param rows project properties data. @param projectID project ID """ if (rows.isEmpty() == false) { Row row = rows.get(0); ProjectProperties properties = m_project.getProjectProperties(); properties.setCreationDate(row.getDate("create_date")); properties.setFinishDate(row.getDate("plan_end_date")); properties.setName(row.getString("proj_short_name")); properties.setStartDate(row.getDate("plan_start_date")); // data_date? properties.setDefaultTaskType(TASK_TYPE_MAP.get(row.getString("def_duration_type"))); properties.setStatusDate(row.getDate("last_recalc_date")); properties.setFiscalYearStartMonth(row.getInteger("fy_start_month_num")); properties.setUniqueID(projectID == null ? null : projectID.toString()); properties.setExportFlag(row.getBoolean("export_flag")); // cannot assign actual calendar yet as it has not been read yet m_defaultCalendarID = row.getInteger("clndr_id"); } }
java
public void processProjectProperties(List<Row> rows, Integer projectID) { if (rows.isEmpty() == false) { Row row = rows.get(0); ProjectProperties properties = m_project.getProjectProperties(); properties.setCreationDate(row.getDate("create_date")); properties.setFinishDate(row.getDate("plan_end_date")); properties.setName(row.getString("proj_short_name")); properties.setStartDate(row.getDate("plan_start_date")); // data_date? properties.setDefaultTaskType(TASK_TYPE_MAP.get(row.getString("def_duration_type"))); properties.setStatusDate(row.getDate("last_recalc_date")); properties.setFiscalYearStartMonth(row.getInteger("fy_start_month_num")); properties.setUniqueID(projectID == null ? null : projectID.toString()); properties.setExportFlag(row.getBoolean("export_flag")); // cannot assign actual calendar yet as it has not been read yet m_defaultCalendarID = row.getInteger("clndr_id"); } }
[ "public", "void", "processProjectProperties", "(", "List", "<", "Row", ">", "rows", ",", "Integer", "projectID", ")", "{", "if", "(", "rows", ".", "isEmpty", "(", ")", "==", "false", ")", "{", "Row", "row", "=", "rows", ".", "get", "(", "0", ")", ";", "ProjectProperties", "properties", "=", "m_project", ".", "getProjectProperties", "(", ")", ";", "properties", ".", "setCreationDate", "(", "row", ".", "getDate", "(", "\"create_date\"", ")", ")", ";", "properties", ".", "setFinishDate", "(", "row", ".", "getDate", "(", "\"plan_end_date\"", ")", ")", ";", "properties", ".", "setName", "(", "row", ".", "getString", "(", "\"proj_short_name\"", ")", ")", ";", "properties", ".", "setStartDate", "(", "row", ".", "getDate", "(", "\"plan_start_date\"", ")", ")", ";", "// data_date?", "properties", ".", "setDefaultTaskType", "(", "TASK_TYPE_MAP", ".", "get", "(", "row", ".", "getString", "(", "\"def_duration_type\"", ")", ")", ")", ";", "properties", ".", "setStatusDate", "(", "row", ".", "getDate", "(", "\"last_recalc_date\"", ")", ")", ";", "properties", ".", "setFiscalYearStartMonth", "(", "row", ".", "getInteger", "(", "\"fy_start_month_num\"", ")", ")", ";", "properties", ".", "setUniqueID", "(", "projectID", "==", "null", "?", "null", ":", "projectID", ".", "toString", "(", ")", ")", ";", "properties", ".", "setExportFlag", "(", "row", ".", "getBoolean", "(", "\"export_flag\"", ")", ")", ";", "// cannot assign actual calendar yet as it has not been read yet", "m_defaultCalendarID", "=", "row", ".", "getInteger", "(", "\"clndr_id\"", ")", ";", "}", "}" ]
Process project properties. @param rows project properties data. @param projectID project ID
[ "Process", "project", "properties", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L157-L175
noties/Handle
handle-library/src/main/java/ru/noties/handle/Handle.java
Handle.postDelayed
public static void postDelayed(Object what, long delay) { """ The same as {@link #post(Object)} but with a delay before delivering an event @see #post(Object) @param what an Object to be queued @param delay in milliseconds before delivery """ Handle.getInstance().mHandler.postDelayed(what, delay); }
java
public static void postDelayed(Object what, long delay) { Handle.getInstance().mHandler.postDelayed(what, delay); }
[ "public", "static", "void", "postDelayed", "(", "Object", "what", ",", "long", "delay", ")", "{", "Handle", ".", "getInstance", "(", ")", ".", "mHandler", ".", "postDelayed", "(", "what", ",", "delay", ")", ";", "}" ]
The same as {@link #post(Object)} but with a delay before delivering an event @see #post(Object) @param what an Object to be queued @param delay in milliseconds before delivery
[ "The", "same", "as", "{" ]
train
https://github.com/noties/Handle/blob/257c5e71334ce442b5c55b50bae6d5ae3a667ab9/handle-library/src/main/java/ru/noties/handle/Handle.java#L124-L126
jayantk/jklol
src/com/jayantkrish/jklol/models/TableFactor.java
TableFactor.logUnity
public static TableFactor logUnity(VariableNumMap vars) { """ Gets a {@code TableFactor} over {@code vars} which assigns weight 1 to all assignments. The weights are represented in log space. @param vars @return """ TableFactorBuilder builder = new TableFactorBuilder(vars, SparseTensorBuilder.getFactory()); return builder.buildSparseInLogSpace(); }
java
public static TableFactor logUnity(VariableNumMap vars) { TableFactorBuilder builder = new TableFactorBuilder(vars, SparseTensorBuilder.getFactory()); return builder.buildSparseInLogSpace(); }
[ "public", "static", "TableFactor", "logUnity", "(", "VariableNumMap", "vars", ")", "{", "TableFactorBuilder", "builder", "=", "new", "TableFactorBuilder", "(", "vars", ",", "SparseTensorBuilder", ".", "getFactory", "(", ")", ")", ";", "return", "builder", ".", "buildSparseInLogSpace", "(", ")", ";", "}" ]
Gets a {@code TableFactor} over {@code vars} which assigns weight 1 to all assignments. The weights are represented in log space. @param vars @return
[ "Gets", "a", "{", "@code", "TableFactor", "}", "over", "{", "@code", "vars", "}", "which", "assigns", "weight", "1", "to", "all", "assignments", ".", "The", "weights", "are", "represented", "in", "log", "space", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/TableFactor.java#L119-L122
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java
ThreadGroupTracker.threadFactoryDestroyed
void threadFactoryDestroyed(String threadFactoryName, ThreadGroup parentGroup) { """ Invoke this method when destroying a ManagedThreadFactory in order to interrupt all managed threads that it created. @param threadFactoryName unique identifier for the managed thread factory. """ Collection<ThreadGroup> groupsToDestroy = new LinkedList<ThreadGroup>(); for (ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup : metadataIdentifierToThreadGroups.values()) { ThreadGroup group = threadFactoryToThreadGroup.remove(threadFactoryName); if (group != null) groupsToDestroy.add(group); } groupsToDestroy.add(parentGroup); AccessController.doPrivileged(new InterruptAndDestroyThreadGroups(groupsToDestroy, deferrableScheduledExecutor), serverAccessControlContext); }
java
void threadFactoryDestroyed(String threadFactoryName, ThreadGroup parentGroup) { Collection<ThreadGroup> groupsToDestroy = new LinkedList<ThreadGroup>(); for (ConcurrentHashMap<String, ThreadGroup> threadFactoryToThreadGroup : metadataIdentifierToThreadGroups.values()) { ThreadGroup group = threadFactoryToThreadGroup.remove(threadFactoryName); if (group != null) groupsToDestroy.add(group); } groupsToDestroy.add(parentGroup); AccessController.doPrivileged(new InterruptAndDestroyThreadGroups(groupsToDestroy, deferrableScheduledExecutor), serverAccessControlContext); }
[ "void", "threadFactoryDestroyed", "(", "String", "threadFactoryName", ",", "ThreadGroup", "parentGroup", ")", "{", "Collection", "<", "ThreadGroup", ">", "groupsToDestroy", "=", "new", "LinkedList", "<", "ThreadGroup", ">", "(", ")", ";", "for", "(", "ConcurrentHashMap", "<", "String", ",", "ThreadGroup", ">", "threadFactoryToThreadGroup", ":", "metadataIdentifierToThreadGroups", ".", "values", "(", ")", ")", "{", "ThreadGroup", "group", "=", "threadFactoryToThreadGroup", ".", "remove", "(", "threadFactoryName", ")", ";", "if", "(", "group", "!=", "null", ")", "groupsToDestroy", ".", "add", "(", "group", ")", ";", "}", "groupsToDestroy", ".", "add", "(", "parentGroup", ")", ";", "AccessController", ".", "doPrivileged", "(", "new", "InterruptAndDestroyThreadGroups", "(", "groupsToDestroy", ",", "deferrableScheduledExecutor", ")", ",", "serverAccessControlContext", ")", ";", "}" ]
Invoke this method when destroying a ManagedThreadFactory in order to interrupt all managed threads that it created. @param threadFactoryName unique identifier for the managed thread factory.
[ "Invoke", "this", "method", "when", "destroying", "a", "ManagedThreadFactory", "in", "order", "to", "interrupt", "all", "managed", "threads", "that", "it", "created", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ThreadGroupTracker.java#L149-L158
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/Centroid.java
Centroid.put
public void put(NumberVector val, double weight) { """ Add data with a given weight. @param val data @param weight weight """ assert (val.getDimensionality() == elements.length); if(weight == 0) { return; // Skip zero weights. } final double nwsum = weight + wsum; for(int i = 0; i < elements.length; i++) { final double delta = val.doubleValue(i) - elements[i]; final double rval = delta * weight / nwsum; elements[i] += rval; } wsum = nwsum; }
java
public void put(NumberVector val, double weight) { assert (val.getDimensionality() == elements.length); if(weight == 0) { return; // Skip zero weights. } final double nwsum = weight + wsum; for(int i = 0; i < elements.length; i++) { final double delta = val.doubleValue(i) - elements[i]; final double rval = delta * weight / nwsum; elements[i] += rval; } wsum = nwsum; }
[ "public", "void", "put", "(", "NumberVector", "val", ",", "double", "weight", ")", "{", "assert", "(", "val", ".", "getDimensionality", "(", ")", "==", "elements", ".", "length", ")", ";", "if", "(", "weight", "==", "0", ")", "{", "return", ";", "// Skip zero weights.", "}", "final", "double", "nwsum", "=", "weight", "+", "wsum", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")", "{", "final", "double", "delta", "=", "val", ".", "doubleValue", "(", "i", ")", "-", "elements", "[", "i", "]", ";", "final", "double", "rval", "=", "delta", "*", "weight", "/", "nwsum", ";", "elements", "[", "i", "]", "+=", "rval", ";", "}", "wsum", "=", "nwsum", ";", "}" ]
Add data with a given weight. @param val data @param weight weight
[ "Add", "data", "with", "a", "given", "weight", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/Centroid.java#L114-L126
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java
MailUtil.send
public static void send(String to, String cc, String bcc, String subject, String content, boolean isHtml, File... files) { """ 使用配置文件中设置的账户发送邮件,发送单个或多个收件人<br> 多个收件人、抄送人、密送人可以使用逗号“,”分隔,也可以通过分号“;”分隔 @param to 收件人,可以使用逗号“,”分隔,也可以通过分号“;”分隔 @param cc 抄送人,可以使用逗号“,”分隔,也可以通过分号“;”分隔 @param bcc 密送人,可以使用逗号“,”分隔,也可以通过分号“;”分隔 @param subject 标题 @param content 正文 @param isHtml 是否为HTML @param files 附件列表 @since 4.0.3 """ send(splitAddress(to), splitAddress(cc), splitAddress(bcc), subject, content, isHtml, files); }
java
public static void send(String to, String cc, String bcc, String subject, String content, boolean isHtml, File... files) { send(splitAddress(to), splitAddress(cc), splitAddress(bcc), subject, content, isHtml, files); }
[ "public", "static", "void", "send", "(", "String", "to", ",", "String", "cc", ",", "String", "bcc", ",", "String", "subject", ",", "String", "content", ",", "boolean", "isHtml", ",", "File", "...", "files", ")", "{", "send", "(", "splitAddress", "(", "to", ")", ",", "splitAddress", "(", "cc", ")", ",", "splitAddress", "(", "bcc", ")", ",", "subject", ",", "content", ",", "isHtml", ",", "files", ")", ";", "}" ]
使用配置文件中设置的账户发送邮件,发送单个或多个收件人<br> 多个收件人、抄送人、密送人可以使用逗号“,”分隔,也可以通过分号“;”分隔 @param to 收件人,可以使用逗号“,”分隔,也可以通过分号“;”分隔 @param cc 抄送人,可以使用逗号“,”分隔,也可以通过分号“;”分隔 @param bcc 密送人,可以使用逗号“,”分隔,也可以通过分号“;”分隔 @param subject 标题 @param content 正文 @param isHtml 是否为HTML @param files 附件列表 @since 4.0.3
[ "使用配置文件中设置的账户发送邮件,发送单个或多个收件人<br", ">", "多个收件人、抄送人、密送人可以使用逗号“", "”分隔,也可以通过分号“", ";", "”分隔" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L73-L75
overturetool/overture
core/ast/src/main/java/org/overture/ast/preview/GraphViz.java
GraphViz.get_img_stream
private byte[] get_img_stream(File dot, String type) throws GraphVizException { """ It will call the external dot program, and return the image in binary format. @param dot Source of the graph (in dot language). @param type Type of the output image to be produced, e.g.: gif, dot, fig, pdf, ps, svg, png. @return The image of the graph in .gif format. @throws GraphVizException """ File img; byte[] img_stream = null; try { img = File.createTempFile("graph_", "." + type); Runtime rt = Runtime.getRuntime(); // patch by Mike Chenault String[] args = { dotPath, "-T" + type, dot.getAbsolutePath(), "-o", img.getAbsolutePath() }; Process p = rt.exec(args); p.waitFor(); FileInputStream in = new FileInputStream(img.getAbsolutePath()); img_stream = new byte[in.available()]; in.read(img_stream); // Close it if we need to if (in != null) { in.close(); } if (!img.delete()) { throw new GraphVizException("Warning: " + img.getAbsolutePath() + " could not be deleted!"); } } catch (IOException ioe) { throw new GraphVizException("Error: in I/O processing of tempfile in dir. Or in calling external command", ioe); } catch (InterruptedException ie) { throw new GraphVizException("Error: the execution of the external program was interrupted", ie); } return img_stream; }
java
private byte[] get_img_stream(File dot, String type) throws GraphVizException { File img; byte[] img_stream = null; try { img = File.createTempFile("graph_", "." + type); Runtime rt = Runtime.getRuntime(); // patch by Mike Chenault String[] args = { dotPath, "-T" + type, dot.getAbsolutePath(), "-o", img.getAbsolutePath() }; Process p = rt.exec(args); p.waitFor(); FileInputStream in = new FileInputStream(img.getAbsolutePath()); img_stream = new byte[in.available()]; in.read(img_stream); // Close it if we need to if (in != null) { in.close(); } if (!img.delete()) { throw new GraphVizException("Warning: " + img.getAbsolutePath() + " could not be deleted!"); } } catch (IOException ioe) { throw new GraphVizException("Error: in I/O processing of tempfile in dir. Or in calling external command", ioe); } catch (InterruptedException ie) { throw new GraphVizException("Error: the execution of the external program was interrupted", ie); } return img_stream; }
[ "private", "byte", "[", "]", "get_img_stream", "(", "File", "dot", ",", "String", "type", ")", "throws", "GraphVizException", "{", "File", "img", ";", "byte", "[", "]", "img_stream", "=", "null", ";", "try", "{", "img", "=", "File", ".", "createTempFile", "(", "\"graph_\"", ",", "\".\"", "+", "type", ")", ";", "Runtime", "rt", "=", "Runtime", ".", "getRuntime", "(", ")", ";", "// patch by Mike Chenault", "String", "[", "]", "args", "=", "{", "dotPath", ",", "\"-T\"", "+", "type", ",", "dot", ".", "getAbsolutePath", "(", ")", ",", "\"-o\"", ",", "img", ".", "getAbsolutePath", "(", ")", "}", ";", "Process", "p", "=", "rt", ".", "exec", "(", "args", ")", ";", "p", ".", "waitFor", "(", ")", ";", "FileInputStream", "in", "=", "new", "FileInputStream", "(", "img", ".", "getAbsolutePath", "(", ")", ")", ";", "img_stream", "=", "new", "byte", "[", "in", ".", "available", "(", ")", "]", ";", "in", ".", "read", "(", "img_stream", ")", ";", "// Close it if we need to", "if", "(", "in", "!=", "null", ")", "{", "in", ".", "close", "(", ")", ";", "}", "if", "(", "!", "img", ".", "delete", "(", ")", ")", "{", "throw", "new", "GraphVizException", "(", "\"Warning: \"", "+", "img", ".", "getAbsolutePath", "(", ")", "+", "\" could not be deleted!\"", ")", ";", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "GraphVizException", "(", "\"Error: in I/O processing of tempfile in dir. Or in calling external command\"", ",", "ioe", ")", ";", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "throw", "new", "GraphVizException", "(", "\"Error: the execution of the external program was interrupted\"", ",", "ie", ")", ";", "}", "return", "img_stream", ";", "}" ]
It will call the external dot program, and return the image in binary format. @param dot Source of the graph (in dot language). @param type Type of the output image to be produced, e.g.: gif, dot, fig, pdf, ps, svg, png. @return The image of the graph in .gif format. @throws GraphVizException
[ "It", "will", "call", "the", "external", "dot", "program", "and", "return", "the", "image", "in", "binary", "format", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/ast/src/main/java/org/overture/ast/preview/GraphViz.java#L212-L248
apache/incubator-druid
indexing-service/src/main/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunner.java
SingleTaskBackgroundRunner.shutdown
@Override public void shutdown(final String taskid, String reason) { """ There might be a race between {@link #run(Task)} and this method, but it shouldn't happen in real applications because this method is called only in unit tests. See TaskLifecycleTest. @param taskid task ID to clean up resources for """ log.info("Shutdown [%s] because: [%s]", taskid, reason); if (runningItem != null && runningItem.getTask().getId().equals(taskid)) { runningItem.getResult().cancel(true); } }
java
@Override public void shutdown(final String taskid, String reason) { log.info("Shutdown [%s] because: [%s]", taskid, reason); if (runningItem != null && runningItem.getTask().getId().equals(taskid)) { runningItem.getResult().cancel(true); } }
[ "@", "Override", "public", "void", "shutdown", "(", "final", "String", "taskid", ",", "String", "reason", ")", "{", "log", ".", "info", "(", "\"Shutdown [%s] because: [%s]\"", ",", "taskid", ",", "reason", ")", ";", "if", "(", "runningItem", "!=", "null", "&&", "runningItem", ".", "getTask", "(", ")", ".", "getId", "(", ")", ".", "equals", "(", "taskid", ")", ")", "{", "runningItem", ".", "getResult", "(", ")", ".", "cancel", "(", "true", ")", ";", "}", "}" ]
There might be a race between {@link #run(Task)} and this method, but it shouldn't happen in real applications because this method is called only in unit tests. See TaskLifecycleTest. @param taskid task ID to clean up resources for
[ "There", "might", "be", "a", "race", "between", "{", "@link", "#run", "(", "Task", ")", "}", "and", "this", "method", "but", "it", "shouldn", "t", "happen", "in", "real", "applications", "because", "this", "method", "is", "called", "only", "in", "unit", "tests", ".", "See", "TaskLifecycleTest", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/indexing-service/src/main/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunner.java#L277-L284
NLPchina/elasticsearch-sql
src/main/java/org/nlpcn/es4sql/query/DefaultQueryAction.java
DefaultQueryAction.handleScriptField
private void handleScriptField(MethodField method) throws SqlParseException { """ zhongshu-comment scripted_field only allows script(name,script) or script(name,lang,script) @param method @throws SqlParseException """ List<KVValue> params = method.getParams(); if (params.size() == 2) { String f = params.get(0).value.toString(); fieldNames.add(f); request.addScriptField(f, new Script(params.get(1).value.toString())); } else if (params.size() == 3) { String f = params.get(0).value.toString(); fieldNames.add(f); request.addScriptField(f, new Script( ScriptType.INLINE, params.get(1).value.toString(), params.get(2).value.toString(), Collections.emptyMap() ) ); } else { throw new SqlParseException("scripted_field only allows script(name,script) or script(name,lang,script)"); } }
java
private void handleScriptField(MethodField method) throws SqlParseException { List<KVValue> params = method.getParams(); if (params.size() == 2) { String f = params.get(0).value.toString(); fieldNames.add(f); request.addScriptField(f, new Script(params.get(1).value.toString())); } else if (params.size() == 3) { String f = params.get(0).value.toString(); fieldNames.add(f); request.addScriptField(f, new Script( ScriptType.INLINE, params.get(1).value.toString(), params.get(2).value.toString(), Collections.emptyMap() ) ); } else { throw new SqlParseException("scripted_field only allows script(name,script) or script(name,lang,script)"); } }
[ "private", "void", "handleScriptField", "(", "MethodField", "method", ")", "throws", "SqlParseException", "{", "List", "<", "KVValue", ">", "params", "=", "method", ".", "getParams", "(", ")", ";", "if", "(", "params", ".", "size", "(", ")", "==", "2", ")", "{", "String", "f", "=", "params", ".", "get", "(", "0", ")", ".", "value", ".", "toString", "(", ")", ";", "fieldNames", ".", "add", "(", "f", ")", ";", "request", ".", "addScriptField", "(", "f", ",", "new", "Script", "(", "params", ".", "get", "(", "1", ")", ".", "value", ".", "toString", "(", ")", ")", ")", ";", "}", "else", "if", "(", "params", ".", "size", "(", ")", "==", "3", ")", "{", "String", "f", "=", "params", ".", "get", "(", "0", ")", ".", "value", ".", "toString", "(", ")", ";", "fieldNames", ".", "add", "(", "f", ")", ";", "request", ".", "addScriptField", "(", "f", ",", "new", "Script", "(", "ScriptType", ".", "INLINE", ",", "params", ".", "get", "(", "1", ")", ".", "value", ".", "toString", "(", ")", ",", "params", ".", "get", "(", "2", ")", ".", "value", ".", "toString", "(", ")", ",", "Collections", ".", "emptyMap", "(", ")", ")", ")", ";", "}", "else", "{", "throw", "new", "SqlParseException", "(", "\"scripted_field only allows script(name,script) or script(name,lang,script)\"", ")", ";", "}", "}" ]
zhongshu-comment scripted_field only allows script(name,script) or script(name,lang,script) @param method @throws SqlParseException
[ "zhongshu", "-", "comment", "scripted_field", "only", "allows", "script", "(", "name", "script", ")", "or", "script", "(", "name", "lang", "script", ")" ]
train
https://github.com/NLPchina/elasticsearch-sql/blob/eaab70b4bf1729978911b83eb96e816ebcfe6e7f/src/main/java/org/nlpcn/es4sql/query/DefaultQueryAction.java#L166-L186
ptgoetz/flux
flux-examples/src/main/java/org/apache/storm/flux/examples/WordCounter.java
WordCounter.execute
public void execute(Tuple input, BasicOutputCollector collector) { """ /* Just output the word value with a count of 1. The HBaseBolt will handle incrementing the counter. """ collector.emit(tuple(input.getValues().get(0), 1)); }
java
public void execute(Tuple input, BasicOutputCollector collector) { collector.emit(tuple(input.getValues().get(0), 1)); }
[ "public", "void", "execute", "(", "Tuple", "input", ",", "BasicOutputCollector", "collector", ")", "{", "collector", ".", "emit", "(", "tuple", "(", "input", ".", "getValues", "(", ")", ".", "get", "(", "0", ")", ",", "1", ")", ")", ";", "}" ]
/* Just output the word value with a count of 1. The HBaseBolt will handle incrementing the counter.
[ "/", "*", "Just", "output", "the", "word", "value", "with", "a", "count", "of", "1", ".", "The", "HBaseBolt", "will", "handle", "incrementing", "the", "counter", "." ]
train
https://github.com/ptgoetz/flux/blob/24b060a13a4f1fd876fa25cebe03a7d5b6f20b20/flux-examples/src/main/java/org/apache/storm/flux/examples/WordCounter.java#L54-L56
micrometer-metrics/micrometer
micrometer-spring-legacy/src/main/java/io/micrometer/spring/cache/ConcurrentMapCacheMetrics.java
ConcurrentMapCacheMetrics.monitor
public static ConcurrentMapCache monitor(MeterRegistry registry, ConcurrentMapCache cache, Iterable<Tag> tags) { """ Record metrics on a ConcurrentMapCache cache. @param registry The registry to bind metrics to. @param cache The cache to instrument. @param tags Tags to apply to all recorded metrics. @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way. """ new ConcurrentMapCacheMetrics(cache, tags).bindTo(registry); return cache; }
java
public static ConcurrentMapCache monitor(MeterRegistry registry, ConcurrentMapCache cache, Iterable<Tag> tags) { new ConcurrentMapCacheMetrics(cache, tags).bindTo(registry); return cache; }
[ "public", "static", "ConcurrentMapCache", "monitor", "(", "MeterRegistry", "registry", ",", "ConcurrentMapCache", "cache", ",", "Iterable", "<", "Tag", ">", "tags", ")", "{", "new", "ConcurrentMapCacheMetrics", "(", "cache", ",", "tags", ")", ".", "bindTo", "(", "registry", ")", ";", "return", "cache", ";", "}" ]
Record metrics on a ConcurrentMapCache cache. @param registry The registry to bind metrics to. @param cache The cache to instrument. @param tags Tags to apply to all recorded metrics. @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way.
[ "Record", "metrics", "on", "a", "ConcurrentMapCache", "cache", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-spring-legacy/src/main/java/io/micrometer/spring/cache/ConcurrentMapCacheMetrics.java#L54-L57
taimos/dvalin
mongodb/src/main/java/de/taimos/dvalin/mongo/AbstractMongoDAO.java
AbstractMongoDAO.findFirstByQuery
protected final T findFirstByQuery(String query, String sort, Object... params) { """ queries with the given string, sorts the result and returns the first element. <code>null</code> is returned if no element is found. @param query the query string @param sort the sort string @param params the parameters to replace # symbols @return the first element found or <code>null</code> if none is found """ return this.dataAccess.findFirstByQuery(query, sort, params).orElse(null); }
java
protected final T findFirstByQuery(String query, String sort, Object... params) { return this.dataAccess.findFirstByQuery(query, sort, params).orElse(null); }
[ "protected", "final", "T", "findFirstByQuery", "(", "String", "query", ",", "String", "sort", ",", "Object", "...", "params", ")", "{", "return", "this", ".", "dataAccess", ".", "findFirstByQuery", "(", "query", ",", "sort", ",", "params", ")", ".", "orElse", "(", "null", ")", ";", "}" ]
queries with the given string, sorts the result and returns the first element. <code>null</code> is returned if no element is found. @param query the query string @param sort the sort string @param params the parameters to replace # symbols @return the first element found or <code>null</code> if none is found
[ "queries", "with", "the", "given", "string", "sorts", "the", "result", "and", "returns", "the", "first", "element", ".", "<code", ">", "null<", "/", "code", ">", "is", "returned", "if", "no", "element", "is", "found", "." ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/mongodb/src/main/java/de/taimos/dvalin/mongo/AbstractMongoDAO.java#L243-L245
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/internal/classes/commonslang/reflect/ConstructorUtils.java
ConstructorUtils.invokeConstructor
public static <T> T invokeConstructor(final Class<T> cls, Object[] args, Class<?>[] parameterTypes) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { """ <p>Returns a new instance of the specified class choosing the right constructor from the list of parameter types.</p> <p>This locates and calls a constructor. The constructor signature must match the parameter types by assignment compatibility.</p> @param <T> the type to be constructed @param cls the class to be constructed, not {@code null} @param args the array of arguments, {@code null} treated as empty @param parameterTypes the array of parameter types, {@code null} treated as empty @return new instance of {@code cls}, not {@code null} @throws NullPointerException if {@code cls} is {@code null} @throws NoSuchMethodException if a matching constructor cannot be found @throws IllegalAccessException if invocation is not permitted by security @throws InvocationTargetException if an error occurs on invocation @throws InstantiationException if an error occurs on instantiation @see Constructor#newInstance """ args = ArrayUtils.nullToEmpty(args); parameterTypes = ArrayUtils.nullToEmpty(parameterTypes); final Constructor<T> ctor = getMatchingAccessibleConstructor(cls, parameterTypes); if (ctor == null) { throw new NoSuchMethodException( "No such accessible constructor on object: " + cls.getName()); } if (ctor.isVarArgs()) { final Class<?>[] methodParameterTypes = ctor.getParameterTypes(); args = MethodUtils.getVarArgs(args, methodParameterTypes); } return ctor.newInstance(args); }
java
public static <T> T invokeConstructor(final Class<T> cls, Object[] args, Class<?>[] parameterTypes) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { args = ArrayUtils.nullToEmpty(args); parameterTypes = ArrayUtils.nullToEmpty(parameterTypes); final Constructor<T> ctor = getMatchingAccessibleConstructor(cls, parameterTypes); if (ctor == null) { throw new NoSuchMethodException( "No such accessible constructor on object: " + cls.getName()); } if (ctor.isVarArgs()) { final Class<?>[] methodParameterTypes = ctor.getParameterTypes(); args = MethodUtils.getVarArgs(args, methodParameterTypes); } return ctor.newInstance(args); }
[ "public", "static", "<", "T", ">", "T", "invokeConstructor", "(", "final", "Class", "<", "T", ">", "cls", ",", "Object", "[", "]", "args", ",", "Class", "<", "?", ">", "[", "]", "parameterTypes", ")", "throws", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", ",", "InstantiationException", "{", "args", "=", "ArrayUtils", ".", "nullToEmpty", "(", "args", ")", ";", "parameterTypes", "=", "ArrayUtils", ".", "nullToEmpty", "(", "parameterTypes", ")", ";", "final", "Constructor", "<", "T", ">", "ctor", "=", "getMatchingAccessibleConstructor", "(", "cls", ",", "parameterTypes", ")", ";", "if", "(", "ctor", "==", "null", ")", "{", "throw", "new", "NoSuchMethodException", "(", "\"No such accessible constructor on object: \"", "+", "cls", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "ctor", ".", "isVarArgs", "(", ")", ")", "{", "final", "Class", "<", "?", ">", "[", "]", "methodParameterTypes", "=", "ctor", ".", "getParameterTypes", "(", ")", ";", "args", "=", "MethodUtils", ".", "getVarArgs", "(", "args", ",", "methodParameterTypes", ")", ";", "}", "return", "ctor", ".", "newInstance", "(", "args", ")", ";", "}" ]
<p>Returns a new instance of the specified class choosing the right constructor from the list of parameter types.</p> <p>This locates and calls a constructor. The constructor signature must match the parameter types by assignment compatibility.</p> @param <T> the type to be constructed @param cls the class to be constructed, not {@code null} @param args the array of arguments, {@code null} treated as empty @param parameterTypes the array of parameter types, {@code null} treated as empty @return new instance of {@code cls}, not {@code null} @throws NullPointerException if {@code cls} is {@code null} @throws NoSuchMethodException if a matching constructor cannot be found @throws IllegalAccessException if invocation is not permitted by security @throws InvocationTargetException if an error occurs on invocation @throws InstantiationException if an error occurs on instantiation @see Constructor#newInstance
[ "<p", ">", "Returns", "a", "new", "instance", "of", "the", "specified", "class", "choosing", "the", "right", "constructor", "from", "the", "list", "of", "parameter", "types", ".", "<", "/", "p", ">" ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/classes/commonslang/reflect/ConstructorUtils.java#L100-L115
icode/ameba
src/main/java/ameba/lib/Fibers.java
Fibers.runInFiber
public static <V> V runInFiber(FiberScheduler scheduler, SuspendableCallable<V> target) throws ExecutionException, InterruptedException { """ Runs an action in a new fiber, awaits the fiber's termination, and returns its result. @param <V> @param scheduler the {@link FiberScheduler} to use when scheduling the fiber. @param target the operation @return the operations return value @throws ExecutionException @throws InterruptedException """ return FiberUtil.runInFiber(scheduler, target); }
java
public static <V> V runInFiber(FiberScheduler scheduler, SuspendableCallable<V> target) throws ExecutionException, InterruptedException { return FiberUtil.runInFiber(scheduler, target); }
[ "public", "static", "<", "V", ">", "V", "runInFiber", "(", "FiberScheduler", "scheduler", ",", "SuspendableCallable", "<", "V", ">", "target", ")", "throws", "ExecutionException", ",", "InterruptedException", "{", "return", "FiberUtil", ".", "runInFiber", "(", "scheduler", ",", "target", ")", ";", "}" ]
Runs an action in a new fiber, awaits the fiber's termination, and returns its result. @param <V> @param scheduler the {@link FiberScheduler} to use when scheduling the fiber. @param target the operation @return the operations return value @throws ExecutionException @throws InterruptedException
[ "Runs", "an", "action", "in", "a", "new", "fiber", "awaits", "the", "fiber", "s", "termination", "and", "returns", "its", "result", "." ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/lib/Fibers.java#L262-L264
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java
ExcelSaxUtil.getDataValue
public static Object getDataValue(CellDataType cellDataType, String value, SharedStringsTable sharedStringsTable, String numFmtString) { """ 根据数据类型获取数据 @param cellDataType 数据类型枚举 @param value 数据值 @param sharedStringsTable {@link SharedStringsTable} @param numFmtString 数字格式名 @return 数据值 """ if (null == value) { return null; } Object result; switch (cellDataType) { case BOOL: result = (value.charAt(0) != '0'); break; case ERROR: result = StrUtil.format("\\\"ERROR: {} ", value); break; case FORMULA: result = StrUtil.format("\"{}\"", value); break; case INLINESTR: result = new XSSFRichTextString(value).toString(); break; case SSTINDEX: try { final int index = Integer.parseInt(value); result = new XSSFRichTextString(sharedStringsTable.getEntryAt(index)).getString(); } catch (NumberFormatException e) { result = value; } break; case NUMBER: result = getNumberValue(value, numFmtString); break; case DATE: try { result = getDateValue(value); } catch (Exception e) { result = value; } break; default: result = value; break; } return result; }
java
public static Object getDataValue(CellDataType cellDataType, String value, SharedStringsTable sharedStringsTable, String numFmtString) { if (null == value) { return null; } Object result; switch (cellDataType) { case BOOL: result = (value.charAt(0) != '0'); break; case ERROR: result = StrUtil.format("\\\"ERROR: {} ", value); break; case FORMULA: result = StrUtil.format("\"{}\"", value); break; case INLINESTR: result = new XSSFRichTextString(value).toString(); break; case SSTINDEX: try { final int index = Integer.parseInt(value); result = new XSSFRichTextString(sharedStringsTable.getEntryAt(index)).getString(); } catch (NumberFormatException e) { result = value; } break; case NUMBER: result = getNumberValue(value, numFmtString); break; case DATE: try { result = getDateValue(value); } catch (Exception e) { result = value; } break; default: result = value; break; } return result; }
[ "public", "static", "Object", "getDataValue", "(", "CellDataType", "cellDataType", ",", "String", "value", ",", "SharedStringsTable", "sharedStringsTable", ",", "String", "numFmtString", ")", "{", "if", "(", "null", "==", "value", ")", "{", "return", "null", ";", "}", "Object", "result", ";", "switch", "(", "cellDataType", ")", "{", "case", "BOOL", ":", "result", "=", "(", "value", ".", "charAt", "(", "0", ")", "!=", "'", "'", ")", ";", "break", ";", "case", "ERROR", ":", "result", "=", "StrUtil", ".", "format", "(", "\"\\\\\\\"ERROR: {} \"", ",", "value", ")", ";", "break", ";", "case", "FORMULA", ":", "result", "=", "StrUtil", ".", "format", "(", "\"\\\"{}\\\"\"", ",", "value", ")", ";", "break", ";", "case", "INLINESTR", ":", "result", "=", "new", "XSSFRichTextString", "(", "value", ")", ".", "toString", "(", ")", ";", "break", ";", "case", "SSTINDEX", ":", "try", "{", "final", "int", "index", "=", "Integer", ".", "parseInt", "(", "value", ")", ";", "result", "=", "new", "XSSFRichTextString", "(", "sharedStringsTable", ".", "getEntryAt", "(", "index", ")", ")", ".", "getString", "(", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "result", "=", "value", ";", "}", "break", ";", "case", "NUMBER", ":", "result", "=", "getNumberValue", "(", "value", ",", "numFmtString", ")", ";", "break", ";", "case", "DATE", ":", "try", "{", "result", "=", "getDateValue", "(", "value", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "result", "=", "value", ";", "}", "break", ";", "default", ":", "result", "=", "value", ";", "break", ";", "}", "return", "result", ";", "}" ]
根据数据类型获取数据 @param cellDataType 数据类型枚举 @param value 数据值 @param sharedStringsTable {@link SharedStringsTable} @param numFmtString 数字格式名 @return 数据值
[ "根据数据类型获取数据" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java#L33-L75
mapsforge/mapsforge
mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/Deserializer.java
Deserializer.getInt
static int getInt(byte[] buffer, int offset) { """ Converts four bytes of a byte array to a signed int. <p/> The byte order is big-endian. @param buffer the byte array. @param offset the offset in the array. @return the int value. """ return buffer[offset] << 24 | (buffer[offset + 1] & 0xff) << 16 | (buffer[offset + 2] & 0xff) << 8 | (buffer[offset + 3] & 0xff); }
java
static int getInt(byte[] buffer, int offset) { return buffer[offset] << 24 | (buffer[offset + 1] & 0xff) << 16 | (buffer[offset + 2] & 0xff) << 8 | (buffer[offset + 3] & 0xff); }
[ "static", "int", "getInt", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ")", "{", "return", "buffer", "[", "offset", "]", "<<", "24", "|", "(", "buffer", "[", "offset", "+", "1", "]", "&", "0xff", ")", "<<", "16", "|", "(", "buffer", "[", "offset", "+", "2", "]", "&", "0xff", ")", "<<", "8", "|", "(", "buffer", "[", "offset", "+", "3", "]", "&", "0xff", ")", ";", "}" ]
Converts four bytes of a byte array to a signed int. <p/> The byte order is big-endian. @param buffer the byte array. @param offset the offset in the array. @return the int value.
[ "Converts", "four", "bytes", "of", "a", "byte", "array", "to", "a", "signed", "int", ".", "<p", "/", ">", "The", "byte", "order", "is", "big", "-", "endian", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/Deserializer.java#L44-L47
fcrepo4/fcrepo4
fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java
ViewHelpers.getVersionDate
public Instant getVersionDate(final Graph graph, final Node subject) { """ Gets a modification date of a subject from the graph @param graph the graph @param subject the subject @return the modification date if it exists """ final String[] pathParts = subject.getURI().split("/"); return MEMENTO_LABEL_FORMATTER.parse(pathParts[pathParts.length - 1], Instant::from); }
java
public Instant getVersionDate(final Graph graph, final Node subject) { final String[] pathParts = subject.getURI().split("/"); return MEMENTO_LABEL_FORMATTER.parse(pathParts[pathParts.length - 1], Instant::from); }
[ "public", "Instant", "getVersionDate", "(", "final", "Graph", "graph", ",", "final", "Node", "subject", ")", "{", "final", "String", "[", "]", "pathParts", "=", "subject", ".", "getURI", "(", ")", ".", "split", "(", "\"/\"", ")", ";", "return", "MEMENTO_LABEL_FORMATTER", ".", "parse", "(", "pathParts", "[", "pathParts", ".", "length", "-", "1", "]", ",", "Instant", "::", "from", ")", ";", "}" ]
Gets a modification date of a subject from the graph @param graph the graph @param subject the subject @return the modification date if it exists
[ "Gets", "a", "modification", "date", "of", "a", "subject", "from", "the", "graph" ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L167-L170
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRImporter.java
LRImporter.getExtractDiscriminatorJSONData
public LRResult getExtractDiscriminatorJSONData(String dataServiceName, String viewName, String discriminator, Boolean partial, Date from, Date until, Boolean idsOnly) throws LRException { """ Get a result from an extract discriminator request @param dataServiceName the name of the data service to request through (e.g. resource-by-discriminator) @param viewName the name of the view to request through (e.g. standards-alignment-related) @param discriminator the discriminator for the request @param partial true/false if this is a partial start of a discriminator, rather than a full discriminator @param from the starting date from which to extract items @param until the ending date from which to extract items @param idsOnly true/false to only extract ids with this request @return result of the request """ String path = getExtractRequestPath(dataServiceName, viewName, from, until, idsOnly, discriminator, partial, discriminatorParam); JSONObject json = getJSONFromPath(path); return new LRResult(json); }
java
public LRResult getExtractDiscriminatorJSONData(String dataServiceName, String viewName, String discriminator, Boolean partial, Date from, Date until, Boolean idsOnly) throws LRException { String path = getExtractRequestPath(dataServiceName, viewName, from, until, idsOnly, discriminator, partial, discriminatorParam); JSONObject json = getJSONFromPath(path); return new LRResult(json); }
[ "public", "LRResult", "getExtractDiscriminatorJSONData", "(", "String", "dataServiceName", ",", "String", "viewName", ",", "String", "discriminator", ",", "Boolean", "partial", ",", "Date", "from", ",", "Date", "until", ",", "Boolean", "idsOnly", ")", "throws", "LRException", "{", "String", "path", "=", "getExtractRequestPath", "(", "dataServiceName", ",", "viewName", ",", "from", ",", "until", ",", "idsOnly", ",", "discriminator", ",", "partial", ",", "discriminatorParam", ")", ";", "JSONObject", "json", "=", "getJSONFromPath", "(", "path", ")", ";", "return", "new", "LRResult", "(", "json", ")", ";", "}" ]
Get a result from an extract discriminator request @param dataServiceName the name of the data service to request through (e.g. resource-by-discriminator) @param viewName the name of the view to request through (e.g. standards-alignment-related) @param discriminator the discriminator for the request @param partial true/false if this is a partial start of a discriminator, rather than a full discriminator @param from the starting date from which to extract items @param until the ending date from which to extract items @param idsOnly true/false to only extract ids with this request @return result of the request
[ "Get", "a", "result", "from", "an", "extract", "discriminator", "request" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRImporter.java#L354-L361
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/AsyncTableEntryReader.java
AsyncTableEntryReader.readEntryComponents
static DeserializedEntry readEntryComponents(InputStream input, long segmentOffset, EntrySerializer serializer) throws IOException { """ Reads a single {@link TableEntry} from the given InputStream. The {@link TableEntry} itself is not constructed, rather all of its components are returned individually. @param input An InputStream to read from. @param segmentOffset The Segment Offset that the first byte of the InputStream maps to. This wll be used as a Version, unless the deserialized segment's Header contains an explicit version. @param serializer The {@link EntrySerializer} to use for deserializing entries. @return A {@link DeserializedEntry} that contains all the components of the {@link TableEntry}. @throws IOException If an Exception occurred while reading from the given InputStream. """ val h = serializer.readHeader(input); long version = getKeyVersion(h, segmentOffset); byte[] key = StreamHelpers.readAll(input, h.getKeyLength()); byte[] value = h.isDeletion() ? null : (h.getValueLength() == 0 ? new byte[0] : StreamHelpers.readAll(input, h.getValueLength())); return new DeserializedEntry(h, version, key, value); }
java
static DeserializedEntry readEntryComponents(InputStream input, long segmentOffset, EntrySerializer serializer) throws IOException { val h = serializer.readHeader(input); long version = getKeyVersion(h, segmentOffset); byte[] key = StreamHelpers.readAll(input, h.getKeyLength()); byte[] value = h.isDeletion() ? null : (h.getValueLength() == 0 ? new byte[0] : StreamHelpers.readAll(input, h.getValueLength())); return new DeserializedEntry(h, version, key, value); }
[ "static", "DeserializedEntry", "readEntryComponents", "(", "InputStream", "input", ",", "long", "segmentOffset", ",", "EntrySerializer", "serializer", ")", "throws", "IOException", "{", "val", "h", "=", "serializer", ".", "readHeader", "(", "input", ")", ";", "long", "version", "=", "getKeyVersion", "(", "h", ",", "segmentOffset", ")", ";", "byte", "[", "]", "key", "=", "StreamHelpers", ".", "readAll", "(", "input", ",", "h", ".", "getKeyLength", "(", ")", ")", ";", "byte", "[", "]", "value", "=", "h", ".", "isDeletion", "(", ")", "?", "null", ":", "(", "h", ".", "getValueLength", "(", ")", "==", "0", "?", "new", "byte", "[", "0", "]", ":", "StreamHelpers", ".", "readAll", "(", "input", ",", "h", ".", "getValueLength", "(", ")", ")", ")", ";", "return", "new", "DeserializedEntry", "(", "h", ",", "version", ",", "key", ",", "value", ")", ";", "}" ]
Reads a single {@link TableEntry} from the given InputStream. The {@link TableEntry} itself is not constructed, rather all of its components are returned individually. @param input An InputStream to read from. @param segmentOffset The Segment Offset that the first byte of the InputStream maps to. This wll be used as a Version, unless the deserialized segment's Header contains an explicit version. @param serializer The {@link EntrySerializer} to use for deserializing entries. @return A {@link DeserializedEntry} that contains all the components of the {@link TableEntry}. @throws IOException If an Exception occurred while reading from the given InputStream.
[ "Reads", "a", "single", "{", "@link", "TableEntry", "}", "from", "the", "given", "InputStream", ".", "The", "{", "@link", "TableEntry", "}", "itself", "is", "not", "constructed", "rather", "all", "of", "its", "components", "are", "returned", "individually", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/AsyncTableEntryReader.java#L120-L126
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.formatRecord
@Override public String formatRecord(RepositoryLogRecord record, Locale locale) { """ Formats a RepositoryLogRecord into a localized CBE format output String. @param record the RepositoryLogRecord to be formatted @param locale the Locale to use for localization when formatting this record. @return the formated string output. """ if (null == record) { throw new IllegalArgumentException("Record cannot be null"); } return getFormattedRecord(record, locale); }
java
@Override public String formatRecord(RepositoryLogRecord record, Locale locale) { if (null == record) { throw new IllegalArgumentException("Record cannot be null"); } return getFormattedRecord(record, locale); }
[ "@", "Override", "public", "String", "formatRecord", "(", "RepositoryLogRecord", "record", ",", "Locale", "locale", ")", "{", "if", "(", "null", "==", "record", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Record cannot be null\"", ")", ";", "}", "return", "getFormattedRecord", "(", "record", ",", "locale", ")", ";", "}" ]
Formats a RepositoryLogRecord into a localized CBE format output String. @param record the RepositoryLogRecord to be formatted @param locale the Locale to use for localization when formatting this record. @return the formated string output.
[ "Formats", "a", "RepositoryLogRecord", "into", "a", "localized", "CBE", "format", "output", "String", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L51-L58
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/OperandStackStateGenerators.java
OperandStackStateGenerators.loadOperandStack
public static InsnList loadOperandStack(MarkerType markerType, StorageVariables storageVars, Frame<BasicValue> frame) { """ Generates instructions to load the entire operand stack. Equivalent to calling {@code loadOperandStack(markerType, storageVars, frame, 0, 0, frame.getStackSize())}. @param markerType debug marker type @param storageVars variables to load operand stack from @param frame execution frame at the instruction where the operand stack is to be loaded @return instructions to load the operand stack from the storage variables @throws NullPointerException if any argument is {@code null} """ return loadOperandStack(markerType, storageVars, frame, 0, 0, frame.getStackSize()); }
java
public static InsnList loadOperandStack(MarkerType markerType, StorageVariables storageVars, Frame<BasicValue> frame) { return loadOperandStack(markerType, storageVars, frame, 0, 0, frame.getStackSize()); }
[ "public", "static", "InsnList", "loadOperandStack", "(", "MarkerType", "markerType", ",", "StorageVariables", "storageVars", ",", "Frame", "<", "BasicValue", ">", "frame", ")", "{", "return", "loadOperandStack", "(", "markerType", ",", "storageVars", ",", "frame", ",", "0", ",", "0", ",", "frame", ".", "getStackSize", "(", ")", ")", ";", "}" ]
Generates instructions to load the entire operand stack. Equivalent to calling {@code loadOperandStack(markerType, storageVars, frame, 0, 0, frame.getStackSize())}. @param markerType debug marker type @param storageVars variables to load operand stack from @param frame execution frame at the instruction where the operand stack is to be loaded @return instructions to load the operand stack from the storage variables @throws NullPointerException if any argument is {@code null}
[ "Generates", "instructions", "to", "load", "the", "entire", "operand", "stack", ".", "Equivalent", "to", "calling", "{" ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/OperandStackStateGenerators.java#L98-L100
wcm-io-caravan/caravan-commons
httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java
CertificateLoader.getKeyManagerFactory
private static KeyManagerFactory getKeyManagerFactory(InputStream keyStoreStream, StoreProperties storeProperties) throws IOException, GeneralSecurityException { """ Get key manager factory @param keyStoreStream Keystore input stream @param storeProperties store properties @return Key manager factory @throws IOException @throws GeneralSecurityException """ // use provider if given, otherwise use the first matching security provider final KeyStore ks; if (StringUtils.isNotBlank(storeProperties.getProvider())) { ks = KeyStore.getInstance(storeProperties.getType(), storeProperties.getProvider()); } else { ks = KeyStore.getInstance(storeProperties.getType()); } ks.load(keyStoreStream, storeProperties.getPassword().toCharArray()); KeyManagerFactory kmf = KeyManagerFactory.getInstance(storeProperties.getManagerType()); kmf.init(ks, storeProperties.getPassword().toCharArray()); return kmf; }
java
private static KeyManagerFactory getKeyManagerFactory(InputStream keyStoreStream, StoreProperties storeProperties) throws IOException, GeneralSecurityException { // use provider if given, otherwise use the first matching security provider final KeyStore ks; if (StringUtils.isNotBlank(storeProperties.getProvider())) { ks = KeyStore.getInstance(storeProperties.getType(), storeProperties.getProvider()); } else { ks = KeyStore.getInstance(storeProperties.getType()); } ks.load(keyStoreStream, storeProperties.getPassword().toCharArray()); KeyManagerFactory kmf = KeyManagerFactory.getInstance(storeProperties.getManagerType()); kmf.init(ks, storeProperties.getPassword().toCharArray()); return kmf; }
[ "private", "static", "KeyManagerFactory", "getKeyManagerFactory", "(", "InputStream", "keyStoreStream", ",", "StoreProperties", "storeProperties", ")", "throws", "IOException", ",", "GeneralSecurityException", "{", "// use provider if given, otherwise use the first matching security provider", "final", "KeyStore", "ks", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "storeProperties", ".", "getProvider", "(", ")", ")", ")", "{", "ks", "=", "KeyStore", ".", "getInstance", "(", "storeProperties", ".", "getType", "(", ")", ",", "storeProperties", ".", "getProvider", "(", ")", ")", ";", "}", "else", "{", "ks", "=", "KeyStore", ".", "getInstance", "(", "storeProperties", ".", "getType", "(", ")", ")", ";", "}", "ks", ".", "load", "(", "keyStoreStream", ",", "storeProperties", ".", "getPassword", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "KeyManagerFactory", "kmf", "=", "KeyManagerFactory", ".", "getInstance", "(", "storeProperties", ".", "getManagerType", "(", ")", ")", ";", "kmf", ".", "init", "(", "ks", ",", "storeProperties", ".", "getPassword", "(", ")", ".", "toCharArray", "(", ")", ")", ";", "return", "kmf", ";", "}" ]
Get key manager factory @param keyStoreStream Keystore input stream @param storeProperties store properties @return Key manager factory @throws IOException @throws GeneralSecurityException
[ "Get", "key", "manager", "factory" ]
train
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/httpclient/src/main/java/io/wcm/caravan/commons/httpclient/impl/helpers/CertificateLoader.java#L140-L154
looly/hutool
hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/DayOfMonthValueMatcher.java
DayOfMonthValueMatcher.match
public boolean match(int value, int month, boolean isLeapYear) { """ 给定的日期是否匹配当前匹配器 @param value 被检查的值,此处为日 @param month 实际的月份 @param isLeapYear 是否闰年 @return 是否匹配 """ return (super.match(value) // 在约定日范围内的某一天 //匹配器中用户定义了最后一天(32表示最后一天) || (value > 27 && match(32) && isLastDayOfMonth(value, month, isLeapYear))); }
java
public boolean match(int value, int month, boolean isLeapYear) { return (super.match(value) // 在约定日范围内的某一天 //匹配器中用户定义了最后一天(32表示最后一天) || (value > 27 && match(32) && isLastDayOfMonth(value, month, isLeapYear))); }
[ "public", "boolean", "match", "(", "int", "value", ",", "int", "month", ",", "boolean", "isLeapYear", ")", "{", "return", "(", "super", ".", "match", "(", "value", ")", "// 在约定日范围内的某一天\r", "//匹配器中用户定义了最后一天(32表示最后一天)\r", "||", "(", "value", ">", "27", "&&", "match", "(", "32", ")", "&&", "isLastDayOfMonth", "(", "value", ",", "month", ",", "isLeapYear", ")", ")", ")", ";", "}" ]
给定的日期是否匹配当前匹配器 @param value 被检查的值,此处为日 @param month 实际的月份 @param isLeapYear 是否闰年 @return 是否匹配
[ "给定的日期是否匹配当前匹配器" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/pattern/matcher/DayOfMonthValueMatcher.java#L33-L37
eclipse/xtext-extras
org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java
AbstractXbaseSemanticSequencer.sequence_XSynchronizedExpression
protected void sequence_XSynchronizedExpression(ISerializationContext context, XSynchronizedExpression semanticObject) { """ Contexts: XExpression returns XSynchronizedExpression XAssignment returns XSynchronizedExpression XAssignment.XBinaryOperation_1_1_0_0_0 returns XSynchronizedExpression XOrExpression returns XSynchronizedExpression XOrExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XAndExpression returns XSynchronizedExpression XAndExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XEqualityExpression returns XSynchronizedExpression XEqualityExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XRelationalExpression returns XSynchronizedExpression XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XSynchronizedExpression XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XSynchronizedExpression XOtherOperatorExpression returns XSynchronizedExpression XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XAdditiveExpression returns XSynchronizedExpression XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XMultiplicativeExpression returns XSynchronizedExpression XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XUnaryOperation returns XSynchronizedExpression XCastedExpression returns XSynchronizedExpression XCastedExpression.XCastedExpression_1_0_0_0 returns XSynchronizedExpression XPostfixOperation returns XSynchronizedExpression XPostfixOperation.XPostfixOperation_1_0_0 returns XSynchronizedExpression XMemberFeatureCall returns XSynchronizedExpression XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XSynchronizedExpression XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XSynchronizedExpression XPrimaryExpression returns XSynchronizedExpression XParenthesizedExpression returns XSynchronizedExpression XExpressionOrVarDeclaration returns XSynchronizedExpression XSynchronizedExpression returns XSynchronizedExpression Constraint: (param=XExpression expression=XExpression) """ if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__EXPRESSION) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__EXPRESSION)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getParamXExpressionParserRuleCall_1_0(), semanticObject.getParam()); feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getExpressionXExpressionParserRuleCall_3_0(), semanticObject.getExpression()); feeder.finish(); }
java
protected void sequence_XSynchronizedExpression(ISerializationContext context, XSynchronizedExpression semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__PARAM)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__EXPRESSION) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XSYNCHRONIZED_EXPRESSION__EXPRESSION)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getParamXExpressionParserRuleCall_1_0(), semanticObject.getParam()); feeder.accept(grammarAccess.getXSynchronizedExpressionAccess().getExpressionXExpressionParserRuleCall_3_0(), semanticObject.getExpression()); feeder.finish(); }
[ "protected", "void", "sequence_XSynchronizedExpression", "(", "ISerializationContext", "context", ",", "XSynchronizedExpression", "semanticObject", ")", "{", "if", "(", "errorAcceptor", "!=", "null", ")", "{", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XSYNCHRONIZED_EXPRESSION__PARAM", ")", "==", "ValueTransient", ".", "YES", ")", "errorAcceptor", ".", "accept", "(", "diagnosticProvider", ".", "createFeatureValueMissing", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XSYNCHRONIZED_EXPRESSION__PARAM", ")", ")", ";", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XSYNCHRONIZED_EXPRESSION__EXPRESSION", ")", "==", "ValueTransient", ".", "YES", ")", "errorAcceptor", ".", "accept", "(", "diagnosticProvider", ".", "createFeatureValueMissing", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XSYNCHRONIZED_EXPRESSION__EXPRESSION", ")", ")", ";", "}", "SequenceFeeder", "feeder", "=", "createSequencerFeeder", "(", "context", ",", "semanticObject", ")", ";", "feeder", ".", "accept", "(", "grammarAccess", ".", "getXSynchronizedExpressionAccess", "(", ")", ".", "getParamXExpressionParserRuleCall_1_0", "(", ")", ",", "semanticObject", ".", "getParam", "(", ")", ")", ";", "feeder", ".", "accept", "(", "grammarAccess", ".", "getXSynchronizedExpressionAccess", "(", ")", ".", "getExpressionXExpressionParserRuleCall_3_0", "(", ")", ",", "semanticObject", ".", "getExpression", "(", ")", ")", ";", "feeder", ".", "finish", "(", ")", ";", "}" ]
Contexts: XExpression returns XSynchronizedExpression XAssignment returns XSynchronizedExpression XAssignment.XBinaryOperation_1_1_0_0_0 returns XSynchronizedExpression XOrExpression returns XSynchronizedExpression XOrExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XAndExpression returns XSynchronizedExpression XAndExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XEqualityExpression returns XSynchronizedExpression XEqualityExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XRelationalExpression returns XSynchronizedExpression XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XSynchronizedExpression XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XSynchronizedExpression XOtherOperatorExpression returns XSynchronizedExpression XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XAdditiveExpression returns XSynchronizedExpression XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XMultiplicativeExpression returns XSynchronizedExpression XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XSynchronizedExpression XUnaryOperation returns XSynchronizedExpression XCastedExpression returns XSynchronizedExpression XCastedExpression.XCastedExpression_1_0_0_0 returns XSynchronizedExpression XPostfixOperation returns XSynchronizedExpression XPostfixOperation.XPostfixOperation_1_0_0 returns XSynchronizedExpression XMemberFeatureCall returns XSynchronizedExpression XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XSynchronizedExpression XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XSynchronizedExpression XPrimaryExpression returns XSynchronizedExpression XParenthesizedExpression returns XSynchronizedExpression XExpressionOrVarDeclaration returns XSynchronizedExpression XSynchronizedExpression returns XSynchronizedExpression Constraint: (param=XExpression expression=XExpression)
[ "Contexts", ":", "XExpression", "returns", "XSynchronizedExpression", "XAssignment", "returns", "XSynchronizedExpression", "XAssignment", ".", "XBinaryOperation_1_1_0_0_0", "returns", "XSynchronizedExpression", "XOrExpression", "returns", "XSynchronizedExpression", "XOrExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XSynchronizedExpression", "XAndExpression", "returns", "XSynchronizedExpression", "XAndExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XSynchronizedExpression", "XEqualityExpression", "returns", "XSynchronizedExpression", "XEqualityExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XSynchronizedExpression", "XRelationalExpression", "returns", "XSynchronizedExpression", "XRelationalExpression", ".", "XInstanceOfExpression_1_0_0_0_0", "returns", "XSynchronizedExpression", "XRelationalExpression", ".", "XBinaryOperation_1_1_0_0_0", "returns", "XSynchronizedExpression", "XOtherOperatorExpression", "returns", "XSynchronizedExpression", "XOtherOperatorExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XSynchronizedExpression", "XAdditiveExpression", "returns", "XSynchronizedExpression", "XAdditiveExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XSynchronizedExpression", "XMultiplicativeExpression", "returns", "XSynchronizedExpression", "XMultiplicativeExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XSynchronizedExpression", "XUnaryOperation", "returns", "XSynchronizedExpression", "XCastedExpression", "returns", "XSynchronizedExpression", "XCastedExpression", ".", "XCastedExpression_1_0_0_0", "returns", "XSynchronizedExpression", "XPostfixOperation", "returns", "XSynchronizedExpression", "XPostfixOperation", ".", "XPostfixOperation_1_0_0", "returns", "XSynchronizedExpression", "XMemberFeatureCall", "returns", "XSynchronizedExpression", "XMemberFeatureCall", ".", "XAssignment_1_0_0_0_0", "returns", "XSynchronizedExpression", "XMemberFeatureCall", ".", "XMemberFeatureCall_1_1_0_0_0", "returns", "XSynchronizedExpression", "XPrimaryExpression", "returns", "XSynchronizedExpression", "XParenthesizedExpression", "returns", "XSynchronizedExpression", "XExpressionOrVarDeclaration", "returns", "XSynchronizedExpression", "XSynchronizedExpression", "returns", "XSynchronizedExpression" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java#L1566-L1577
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java
Locale.getStringFrom
@Pure @Inline(value = "Locale.getStringWithDefaultFrom(($1), ($2), ($3), ($4))", imported = { """ Replies the text that corresponds to the specified resource. <p>The <code>resourcePath</code> argument should be a fully qualified class name. However, for compatibility with earlier versions, Sun's Java SE Runtime Environments do not verify this, and so it is possible to access <code>PropertyResourceBundle</code>s by specifying a path name (using "/") instead of a fully qualified class name (using "."). @param resourcePath is the name (path) of the resource file, a fully qualified class name @param key is the name of the resource into the specified file @param params is the the list of parameters which will replaces the <code>#1</code>, <code>#2</code>... into the string. @return the text that corresponds to the specified resource """Locale.class}) public static String getStringFrom(String resourcePath, String key, Object... params) { return getStringWithDefaultFrom(resourcePath, key, key, params); }
java
@Pure @Inline(value = "Locale.getStringWithDefaultFrom(($1), ($2), ($3), ($4))", imported = {Locale.class}) public static String getStringFrom(String resourcePath, String key, Object... params) { return getStringWithDefaultFrom(resourcePath, key, key, params); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"Locale.getStringWithDefaultFrom(($1), ($2), ($3), ($4))\"", ",", "imported", "=", "{", "Locale", ".", "class", "}", ")", "public", "static", "String", "getStringFrom", "(", "String", "resourcePath", ",", "String", "key", ",", "Object", "...", "params", ")", "{", "return", "getStringWithDefaultFrom", "(", "resourcePath", ",", "key", ",", "key", ",", "params", ")", ";", "}" ]
Replies the text that corresponds to the specified resource. <p>The <code>resourcePath</code> argument should be a fully qualified class name. However, for compatibility with earlier versions, Sun's Java SE Runtime Environments do not verify this, and so it is possible to access <code>PropertyResourceBundle</code>s by specifying a path name (using "/") instead of a fully qualified class name (using "."). @param resourcePath is the name (path) of the resource file, a fully qualified class name @param key is the name of the resource into the specified file @param params is the the list of parameters which will replaces the <code>#1</code>, <code>#2</code>... into the string. @return the text that corresponds to the specified resource
[ "Replies", "the", "text", "that", "corresponds", "to", "the", "specified", "resource", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java#L221-L226
Steveice10/OpenNBT
src/main/java/com/github/steveice10/opennbt/NBTIO.java
NBTIO.readTag
public static Tag readTag(DataInput in) throws IOException { """ Reads an NBT tag. @param in Data input to read from. @return The read tag, or null if the tag is an end tag. @throws java.io.IOException If an I/O error occurs. """ int id = in.readUnsignedByte(); if(id == 0) { return null; } String name = in.readUTF(); Tag tag; try { tag = TagRegistry.createInstance(id, name); } catch(TagCreateException e) { throw new IOException("Failed to create tag.", e); } tag.read(in); return tag; }
java
public static Tag readTag(DataInput in) throws IOException { int id = in.readUnsignedByte(); if(id == 0) { return null; } String name = in.readUTF(); Tag tag; try { tag = TagRegistry.createInstance(id, name); } catch(TagCreateException e) { throw new IOException("Failed to create tag.", e); } tag.read(in); return tag; }
[ "public", "static", "Tag", "readTag", "(", "DataInput", "in", ")", "throws", "IOException", "{", "int", "id", "=", "in", ".", "readUnsignedByte", "(", ")", ";", "if", "(", "id", "==", "0", ")", "{", "return", "null", ";", "}", "String", "name", "=", "in", ".", "readUTF", "(", ")", ";", "Tag", "tag", ";", "try", "{", "tag", "=", "TagRegistry", ".", "createInstance", "(", "id", ",", "name", ")", ";", "}", "catch", "(", "TagCreateException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Failed to create tag.\"", ",", "e", ")", ";", "}", "tag", ".", "read", "(", "in", ")", ";", "return", "tag", ";", "}" ]
Reads an NBT tag. @param in Data input to read from. @return The read tag, or null if the tag is an end tag. @throws java.io.IOException If an I/O error occurs.
[ "Reads", "an", "NBT", "tag", "." ]
train
https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/NBTIO.java#L178-L195
lessthanoptimal/BoofCV
main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationLinearRotationMulti.java
SelfCalibrationLinearRotationMulti.convertW
void convertW( Homography2D_F64 w , CameraPinhole c ) { """ Converts W into a pinhole camera model by finding the cholesky decomposition """ // inv(w) = K*K' tmp.set(w); CommonOps_DDF3.divide(tmp,tmp.a33); CommonOps_DDF3.cholU(tmp); CommonOps_DDF3.invert(tmp,K); CommonOps_DDF3.divide(K,K.a33); c.fx = K.a11; c.fy = knownAspectRatio ? (K.a22 + c.fx*aspectRatio)/2.0 : K.a22; c.skew = zeroSkew ? 0 : K.a12; c.cx = principlePointOrigin ? 0 : K.a13; c.cy = principlePointOrigin ? 0 : K.a23; }
java
void convertW( Homography2D_F64 w , CameraPinhole c ) { // inv(w) = K*K' tmp.set(w); CommonOps_DDF3.divide(tmp,tmp.a33); CommonOps_DDF3.cholU(tmp); CommonOps_DDF3.invert(tmp,K); CommonOps_DDF3.divide(K,K.a33); c.fx = K.a11; c.fy = knownAspectRatio ? (K.a22 + c.fx*aspectRatio)/2.0 : K.a22; c.skew = zeroSkew ? 0 : K.a12; c.cx = principlePointOrigin ? 0 : K.a13; c.cy = principlePointOrigin ? 0 : K.a23; }
[ "void", "convertW", "(", "Homography2D_F64", "w", ",", "CameraPinhole", "c", ")", "{", "// inv(w) = K*K'", "tmp", ".", "set", "(", "w", ")", ";", "CommonOps_DDF3", ".", "divide", "(", "tmp", ",", "tmp", ".", "a33", ")", ";", "CommonOps_DDF3", ".", "cholU", "(", "tmp", ")", ";", "CommonOps_DDF3", ".", "invert", "(", "tmp", ",", "K", ")", ";", "CommonOps_DDF3", ".", "divide", "(", "K", ",", "K", ".", "a33", ")", ";", "c", ".", "fx", "=", "K", ".", "a11", ";", "c", ".", "fy", "=", "knownAspectRatio", "?", "(", "K", ".", "a22", "+", "c", ".", "fx", "*", "aspectRatio", ")", "/", "2.0", ":", "K", ".", "a22", ";", "c", ".", "skew", "=", "zeroSkew", "?", "0", ":", "K", ".", "a12", ";", "c", ".", "cx", "=", "principlePointOrigin", "?", "0", ":", "K", ".", "a13", ";", "c", ".", "cy", "=", "principlePointOrigin", "?", "0", ":", "K", ".", "a23", ";", "}" ]
Converts W into a pinhole camera model by finding the cholesky decomposition
[ "Converts", "W", "into", "a", "pinhole", "camera", "model", "by", "finding", "the", "cholesky", "decomposition" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationLinearRotationMulti.java#L245-L258
cdapio/tigon
tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/flow/FlowUtils.java
FlowUtils.generateConsumerGroupId
public static long generateConsumerGroupId(String flowId, String flowletId) { """ Generates a queue consumer groupId for the given flowlet in the given program id. """ return Hashing.md5().newHasher() .putString(flowId) .putString(flowletId).hash().asLong(); }
java
public static long generateConsumerGroupId(String flowId, String flowletId) { return Hashing.md5().newHasher() .putString(flowId) .putString(flowletId).hash().asLong(); }
[ "public", "static", "long", "generateConsumerGroupId", "(", "String", "flowId", ",", "String", "flowletId", ")", "{", "return", "Hashing", ".", "md5", "(", ")", ".", "newHasher", "(", ")", ".", "putString", "(", "flowId", ")", ".", "putString", "(", "flowletId", ")", ".", "hash", "(", ")", ".", "asLong", "(", ")", ";", "}" ]
Generates a queue consumer groupId for the given flowlet in the given program id.
[ "Generates", "a", "queue", "consumer", "groupId", "for", "the", "given", "flowlet", "in", "the", "given", "program", "id", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/flow/FlowUtils.java#L57-L61
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java
ConfigurationAbstractImpl.getStrings
public String[] getStrings(String key, String defaultValue, String seperators) { """ Gets an array of Strings from the value of the specified key, seperated by any key from <code>seperators</code>. If no value for this key is found the array contained in <code>defaultValue</code> is returned. @param key the key @param defaultValue the default Value @param seperators the seprators to be used @return the strings for the key, or the strings contained in <code>defaultValue</code> @see StringTokenizer """ StringTokenizer st = new StringTokenizer(getString(key, defaultValue), seperators); String[] ret = new String[st.countTokens()]; for (int i = 0; i < ret.length; i++) { ret[i] = st.nextToken(); } return ret; }
java
public String[] getStrings(String key, String defaultValue, String seperators) { StringTokenizer st = new StringTokenizer(getString(key, defaultValue), seperators); String[] ret = new String[st.countTokens()]; for (int i = 0; i < ret.length; i++) { ret[i] = st.nextToken(); } return ret; }
[ "public", "String", "[", "]", "getStrings", "(", "String", "key", ",", "String", "defaultValue", ",", "String", "seperators", ")", "{", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "getString", "(", "key", ",", "defaultValue", ")", ",", "seperators", ")", ";", "String", "[", "]", "ret", "=", "new", "String", "[", "st", ".", "countTokens", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ret", ".", "length", ";", "i", "++", ")", "{", "ret", "[", "i", "]", "=", "st", ".", "nextToken", "(", ")", ";", "}", "return", "ret", ";", "}" ]
Gets an array of Strings from the value of the specified key, seperated by any key from <code>seperators</code>. If no value for this key is found the array contained in <code>defaultValue</code> is returned. @param key the key @param defaultValue the default Value @param seperators the seprators to be used @return the strings for the key, or the strings contained in <code>defaultValue</code> @see StringTokenizer
[ "Gets", "an", "array", "of", "Strings", "from", "the", "value", "of", "the", "specified", "key", "seperated", "by", "any", "key", "from", "<code", ">", "seperators<", "/", "code", ">", ".", "If", "no", "value", "for", "this", "key", "is", "found", "the", "array", "contained", "in", "<code", ">", "defaultValue<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java#L112-L121
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java
AbstractMySQLQuery.bufferResult
@WithBridgeMethods(value = MySQLQuery.class, castRequired = true) public C bufferResult() { """ SQL_BUFFER_RESULT forces the result to be put into a temporary table. This helps MySQL free the table locks early and helps in cases where it takes a long time to send the result set to the client. This option can be used only for top-level SELECT statements, not for subqueries or following UNION. @return the current object """ return addFlag(Position.AFTER_SELECT, SQL_BUFFER_RESULT); }
java
@WithBridgeMethods(value = MySQLQuery.class, castRequired = true) public C bufferResult() { return addFlag(Position.AFTER_SELECT, SQL_BUFFER_RESULT); }
[ "@", "WithBridgeMethods", "(", "value", "=", "MySQLQuery", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "bufferResult", "(", ")", "{", "return", "addFlag", "(", "Position", ".", "AFTER_SELECT", ",", "SQL_BUFFER_RESULT", ")", ";", "}" ]
SQL_BUFFER_RESULT forces the result to be put into a temporary table. This helps MySQL free the table locks early and helps in cases where it takes a long time to send the result set to the client. This option can be used only for top-level SELECT statements, not for subqueries or following UNION. @return the current object
[ "SQL_BUFFER_RESULT", "forces", "the", "result", "to", "be", "put", "into", "a", "temporary", "table", ".", "This", "helps", "MySQL", "free", "the", "table", "locks", "early", "and", "helps", "in", "cases", "where", "it", "takes", "a", "long", "time", "to", "send", "the", "result", "set", "to", "the", "client", ".", "This", "option", "can", "be", "used", "only", "for", "top", "-", "level", "SELECT", "statements", "not", "for", "subqueries", "or", "following", "UNION", "." ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java#L89-L92
OpenLiberty/open-liberty
dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java
AccessIdUtil.createAccessId
public static String createAccessId(String type, String realm, String uniqueId) { """ Constructs the full access identifier: type:realm/uniqueId @param type Entity type, must not be null or empty @param realm Realm, must not be null or empty @param uniqueId Entity unique ID, must not be null or empty @return An accessId representing the entity. Will not be null. """ if (type == null || type.isEmpty()) { throw new IllegalArgumentException("An internal error occured. type is null"); } if (realm == null || realm.isEmpty()) { throw new IllegalArgumentException("An internal error occured. realm is null"); } if (uniqueId == null || uniqueId.isEmpty()) { throw new IllegalArgumentException("An internal error occured. uniqueId is null"); } return type + TYPE_SEPARATOR + realm + REALM_SEPARATOR + uniqueId; }
java
public static String createAccessId(String type, String realm, String uniqueId) { if (type == null || type.isEmpty()) { throw new IllegalArgumentException("An internal error occured. type is null"); } if (realm == null || realm.isEmpty()) { throw new IllegalArgumentException("An internal error occured. realm is null"); } if (uniqueId == null || uniqueId.isEmpty()) { throw new IllegalArgumentException("An internal error occured. uniqueId is null"); } return type + TYPE_SEPARATOR + realm + REALM_SEPARATOR + uniqueId; }
[ "public", "static", "String", "createAccessId", "(", "String", "type", ",", "String", "realm", ",", "String", "uniqueId", ")", "{", "if", "(", "type", "==", "null", "||", "type", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"An internal error occured. type is null\"", ")", ";", "}", "if", "(", "realm", "==", "null", "||", "realm", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"An internal error occured. realm is null\"", ")", ";", "}", "if", "(", "uniqueId", "==", "null", "||", "uniqueId", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"An internal error occured. uniqueId is null\"", ")", ";", "}", "return", "type", "+", "TYPE_SEPARATOR", "+", "realm", "+", "REALM_SEPARATOR", "+", "uniqueId", ";", "}" ]
Constructs the full access identifier: type:realm/uniqueId @param type Entity type, must not be null or empty @param realm Realm, must not be null or empty @param uniqueId Entity unique ID, must not be null or empty @return An accessId representing the entity. Will not be null.
[ "Constructs", "the", "full", "access", "identifier", ":", "type", ":", "realm", "/", "uniqueId" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security/src/com/ibm/ws/security/AccessIdUtil.java#L84-L95
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java
MaterialListValueBox.addItem
public void addItem(T value, Direction dir, String text) { """ Adds an item to the list box, specifying its direction and an initial value for the item. @param value the item's value, to be submitted if it is part of a {@link FormPanel}; cannot be <code>null</code> @param dir the item's direction @param text the text of the item to be added """ addItem(value, dir, text, true); }
java
public void addItem(T value, Direction dir, String text) { addItem(value, dir, text, true); }
[ "public", "void", "addItem", "(", "T", "value", ",", "Direction", "dir", ",", "String", "text", ")", "{", "addItem", "(", "value", ",", "dir", ",", "text", ",", "true", ")", ";", "}" ]
Adds an item to the list box, specifying its direction and an initial value for the item. @param value the item's value, to be submitted if it is part of a {@link FormPanel}; cannot be <code>null</code> @param dir the item's direction @param text the text of the item to be added
[ "Adds", "an", "item", "to", "the", "list", "box", "specifying", "its", "direction", "and", "an", "initial", "value", "for", "the", "item", "." ]
train
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java#L276-L278
FasterXML/woodstox
src/main/java/com/ctc/wstx/io/StreamBootstrapper.java
StreamBootstrapper.getInstance
public static StreamBootstrapper getInstance(String pubId, SystemId sysId, InputStream in) { """ Factory method used when the underlying data provider is an actual stream. """ return new StreamBootstrapper(pubId, sysId, in); }
java
public static StreamBootstrapper getInstance(String pubId, SystemId sysId, InputStream in) { return new StreamBootstrapper(pubId, sysId, in); }
[ "public", "static", "StreamBootstrapper", "getInstance", "(", "String", "pubId", ",", "SystemId", "sysId", ",", "InputStream", "in", ")", "{", "return", "new", "StreamBootstrapper", "(", "pubId", ",", "sysId", ",", "in", ")", ";", "}" ]
Factory method used when the underlying data provider is an actual stream.
[ "Factory", "method", "used", "when", "the", "underlying", "data", "provider", "is", "an", "actual", "stream", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/StreamBootstrapper.java#L136-L139
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintTabbedPaneTabBorder
public void paintTabbedPaneTabBorder(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex, int orientation) { """ Paints the border of a tab of a tabbed pane. This implementation invokes the method of the same name without the orientation. @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 tabIndex Index of tab being painted. @param orientation One of <code>JTabbedPane.TOP</code>, <code> JTabbedPane.LEFT</code>, <code> JTabbedPane.BOTTOM</code> , or <code> JTabbedPane.RIGHT</code> """ paintBorder(context, g, x, y, w, h, null); }
java
public void paintTabbedPaneTabBorder(SynthContext context, Graphics g, int x, int y, int w, int h, int tabIndex, int orientation) { paintBorder(context, g, x, y, w, h, null); }
[ "public", "void", "paintTabbedPaneTabBorder", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "tabIndex", ",", "int", "orientation", ")", "{", "paintBorder", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}" ]
Paints the border of a tab of a tabbed pane. This implementation invokes the method of the same name without the orientation. @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 tabIndex Index of tab being painted. @param orientation One of <code>JTabbedPane.TOP</code>, <code> JTabbedPane.LEFT</code>, <code> JTabbedPane.BOTTOM</code> , or <code> JTabbedPane.RIGHT</code>
[ "Paints", "the", "border", "of", "a", "tab", "of", "a", "tabbed", "pane", ".", "This", "implementation", "invokes", "the", "method", "of", "the", "same", "name", "without", "the", "orientation", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L2127-L2129
d-michail/jheaps
src/main/java/org/jheaps/tree/SimpleFibonacciHeap.java
SimpleFibonacciHeap.forceDecreaseKeyToMinimum
private void forceDecreaseKeyToMinimum(Node<K, V> n) { """ /* Decrease the key of a node to the minimum. Helper function for performing a delete operation. Does not change the node's actual key, but behaves as the key is the minimum key in the heap. """ Node<K, V> y = n.parent; if (y != null) { cut(n, y); root.mark = false; cascadingRankChange(y); root = link(root, n); } }
java
private void forceDecreaseKeyToMinimum(Node<K, V> n) { Node<K, V> y = n.parent; if (y != null) { cut(n, y); root.mark = false; cascadingRankChange(y); root = link(root, n); } }
[ "private", "void", "forceDecreaseKeyToMinimum", "(", "Node", "<", "K", ",", "V", ">", "n", ")", "{", "Node", "<", "K", ",", "V", ">", "y", "=", "n", ".", "parent", ";", "if", "(", "y", "!=", "null", ")", "{", "cut", "(", "n", ",", "y", ")", ";", "root", ".", "mark", "=", "false", ";", "cascadingRankChange", "(", "y", ")", ";", "root", "=", "link", "(", "root", ",", "n", ")", ";", "}", "}" ]
/* Decrease the key of a node to the minimum. Helper function for performing a delete operation. Does not change the node's actual key, but behaves as the key is the minimum key in the heap.
[ "/", "*", "Decrease", "the", "key", "of", "a", "node", "to", "the", "minimum", ".", "Helper", "function", "for", "performing", "a", "delete", "operation", ".", "Does", "not", "change", "the", "node", "s", "actual", "key", "but", "behaves", "as", "the", "key", "is", "the", "minimum", "key", "in", "the", "heap", "." ]
train
https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/tree/SimpleFibonacciHeap.java#L520-L528
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java
ClassHelper.getResourceAsStream
@Nullable public static InputStream getResourceAsStream (@Nonnull final Class <?> aClass, @Nonnull @Nonempty final String sPath) { """ Get the input stream of the passed resource using the class loader of the specified class only. This is a sanity wrapper around <code>class.getResourceAsStream (sPath)</code>. @param aClass The class to be used. May not be <code>null</code>. @param sPath The path to be resolved. May neither be <code>null</code> nor empty. Internally it is ensured that the provided path does start with a slash. @return <code>null</code> if the path could not be resolved using the specified class loader. """ ValueEnforcer.notNull (aClass, "Class"); ValueEnforcer.notEmpty (sPath, "Path"); // Ensure the path does start with a "/" final String sPathWithSlash = _getPathWithLeadingSlash (sPath); // returns null if not found final InputStream aIS = aClass.getResourceAsStream (sPathWithSlash); return StreamHelper.checkForInvalidFilterInputStream (aIS); }
java
@Nullable public static InputStream getResourceAsStream (@Nonnull final Class <?> aClass, @Nonnull @Nonempty final String sPath) { ValueEnforcer.notNull (aClass, "Class"); ValueEnforcer.notEmpty (sPath, "Path"); // Ensure the path does start with a "/" final String sPathWithSlash = _getPathWithLeadingSlash (sPath); // returns null if not found final InputStream aIS = aClass.getResourceAsStream (sPathWithSlash); return StreamHelper.checkForInvalidFilterInputStream (aIS); }
[ "@", "Nullable", "public", "static", "InputStream", "getResourceAsStream", "(", "@", "Nonnull", "final", "Class", "<", "?", ">", "aClass", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sPath", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aClass", ",", "\"Class\"", ")", ";", "ValueEnforcer", ".", "notEmpty", "(", "sPath", ",", "\"Path\"", ")", ";", "// Ensure the path does start with a \"/\"", "final", "String", "sPathWithSlash", "=", "_getPathWithLeadingSlash", "(", "sPath", ")", ";", "// returns null if not found", "final", "InputStream", "aIS", "=", "aClass", ".", "getResourceAsStream", "(", "sPathWithSlash", ")", ";", "return", "StreamHelper", ".", "checkForInvalidFilterInputStream", "(", "aIS", ")", ";", "}" ]
Get the input stream of the passed resource using the class loader of the specified class only. This is a sanity wrapper around <code>class.getResourceAsStream (sPath)</code>. @param aClass The class to be used. May not be <code>null</code>. @param sPath The path to be resolved. May neither be <code>null</code> nor empty. Internally it is ensured that the provided path does start with a slash. @return <code>null</code> if the path could not be resolved using the specified class loader.
[ "Get", "the", "input", "stream", "of", "the", "passed", "resource", "using", "the", "class", "loader", "of", "the", "specified", "class", "only", ".", "This", "is", "a", "sanity", "wrapper", "around", "<code", ">", "class", ".", "getResourceAsStream", "(", "sPath", ")", "<", "/", "code", ">", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassHelper.java#L585-L597
chen0040/java-genetic-programming
src/main/java/com/github/chen0040/gp/treegp/program/TreeGenerator.java
TreeGenerator.createWithDepth
public static void createWithDepth(Program program, TreeNode x, int allowableDepth, TGPInitializationStrategy method, RandEngine randEngine) { """ / <param name="method">The method used to build the subtree</param> """ int child_count = x.arity(); for (int i = 0; i != child_count; ++i) { Primitive primitive = anyPrimitive(program, allowableDepth, method, randEngine); TreeNode child = new TreeNode(primitive); x.getChildren().add(child); if (!primitive.isTerminal()) { createWithDepth(program, child, allowableDepth - 1, method, randEngine); } } }
java
public static void createWithDepth(Program program, TreeNode x, int allowableDepth, TGPInitializationStrategy method, RandEngine randEngine) { int child_count = x.arity(); for (int i = 0; i != child_count; ++i) { Primitive primitive = anyPrimitive(program, allowableDepth, method, randEngine); TreeNode child = new TreeNode(primitive); x.getChildren().add(child); if (!primitive.isTerminal()) { createWithDepth(program, child, allowableDepth - 1, method, randEngine); } } }
[ "public", "static", "void", "createWithDepth", "(", "Program", "program", ",", "TreeNode", "x", ",", "int", "allowableDepth", ",", "TGPInitializationStrategy", "method", ",", "RandEngine", "randEngine", ")", "{", "int", "child_count", "=", "x", ".", "arity", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "!=", "child_count", ";", "++", "i", ")", "{", "Primitive", "primitive", "=", "anyPrimitive", "(", "program", ",", "allowableDepth", ",", "method", ",", "randEngine", ")", ";", "TreeNode", "child", "=", "new", "TreeNode", "(", "primitive", ")", ";", "x", ".", "getChildren", "(", ")", ".", "add", "(", "child", ")", ";", "if", "(", "!", "primitive", ".", "isTerminal", "(", ")", ")", "{", "createWithDepth", "(", "program", ",", "child", ",", "allowableDepth", "-", "1", ",", "method", ",", "randEngine", ")", ";", "}", "}", "}" ]
/ <param name="method">The method used to build the subtree</param>
[ "/", "<param", "name", "=", "method", ">", "The", "method", "used", "to", "build", "the", "subtree<", "/", "param", ">" ]
train
https://github.com/chen0040/java-genetic-programming/blob/498fc8f4407ea9d45f2e0ac797a8948da337c74f/src/main/java/com/github/chen0040/gp/treegp/program/TreeGenerator.java#L20-L35
cdapio/tigon
tigon-sql/src/main/java/co/cask/tigon/sql/internal/StreamConfigGenerator.java
StreamConfigGenerator.createProtocol
private String createProtocol(String name, StreamSchema schema) { """ Takes a name for the Schema and the StreamSchema object to create the contents for packet_schema.txt file. Sample file content : PROTOCOL name { ullong timestamp get_gdat_ullong_pos1 (increasing); uint istream get_gdat_uint_pos2; } """ StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("PROTOCOL ").append(name).append(" {").append(Constants.NEWLINE); stringBuilder.append(StreamSchemaCodec.serialize(schema)); stringBuilder.append("}").append(Constants.NEWLINE); return stringBuilder.toString(); }
java
private String createProtocol(String name, StreamSchema schema) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("PROTOCOL ").append(name).append(" {").append(Constants.NEWLINE); stringBuilder.append(StreamSchemaCodec.serialize(schema)); stringBuilder.append("}").append(Constants.NEWLINE); return stringBuilder.toString(); }
[ "private", "String", "createProtocol", "(", "String", "name", ",", "StreamSchema", "schema", ")", "{", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "stringBuilder", ".", "append", "(", "\"PROTOCOL \"", ")", ".", "append", "(", "name", ")", ".", "append", "(", "\" {\"", ")", ".", "append", "(", "Constants", ".", "NEWLINE", ")", ";", "stringBuilder", ".", "append", "(", "StreamSchemaCodec", ".", "serialize", "(", "schema", ")", ")", ";", "stringBuilder", ".", "append", "(", "\"}\"", ")", ".", "append", "(", "Constants", ".", "NEWLINE", ")", ";", "return", "stringBuilder", ".", "toString", "(", ")", ";", "}" ]
Takes a name for the Schema and the StreamSchema object to create the contents for packet_schema.txt file. Sample file content : PROTOCOL name { ullong timestamp get_gdat_ullong_pos1 (increasing); uint istream get_gdat_uint_pos2; }
[ "Takes", "a", "name", "for", "the", "Schema", "and", "the", "StreamSchema", "object", "to", "create", "the", "contents", "for", "packet_schema", ".", "txt", "file", ".", "Sample", "file", "content", ":", "PROTOCOL", "name", "{", "ullong", "timestamp", "get_gdat_ullong_pos1", "(", "increasing", ")", ";", "uint", "istream", "get_gdat_uint_pos2", ";", "}" ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-sql/src/main/java/co/cask/tigon/sql/internal/StreamConfigGenerator.java#L112-L118
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateRegexEntityRole
public OperationStatus updateRegexEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateRegexEntityRoleOptionalParameter updateRegexEntityRoleOptionalParameter) { """ Update an entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role ID. @param updateRegexEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful. """ return updateRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateRegexEntityRoleOptionalParameter).toBlocking().single().body(); }
java
public OperationStatus updateRegexEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateRegexEntityRoleOptionalParameter updateRegexEntityRoleOptionalParameter) { return updateRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateRegexEntityRoleOptionalParameter).toBlocking().single().body(); }
[ "public", "OperationStatus", "updateRegexEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ",", "UpdateRegexEntityRoleOptionalParameter", "updateRegexEntityRoleOptionalParameter", ")", "{", "return", "updateRegexEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ",", "roleId", ",", "updateRegexEntityRoleOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Update an entity role for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role ID. @param updateRegexEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Update", "an", "entity", "role", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12051-L12053
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/querycache/subscriber/EventPublisherHelper.java
EventPublisherHelper.publishCacheWideEvent
static void publishCacheWideEvent(InternalQueryCache queryCache, int numberOfEntriesAffected, EntryEventType eventType) { """ As a result of map-wide events like {@link EntryEventType#CLEAR_ALL} or {@link EntryEventType#EVICT_ALL} we also publish a matching event for query-cache listeners. """ if (!hasListener(queryCache)) { return; } DefaultQueryCache defaultQueryCache = (DefaultQueryCache) queryCache; QueryCacheContext context = defaultQueryCache.context; String mapName = defaultQueryCache.mapName; String cacheId = defaultQueryCache.cacheId; QueryCacheEventService eventService = getQueryCacheEventService(context); LocalCacheWideEventData eventData = new LocalCacheWideEventData(cacheId, eventType.getType(), numberOfEntriesAffected); eventService.publish(mapName, cacheId, eventData, cacheId.hashCode(), queryCache.getExtractors()); }
java
static void publishCacheWideEvent(InternalQueryCache queryCache, int numberOfEntriesAffected, EntryEventType eventType) { if (!hasListener(queryCache)) { return; } DefaultQueryCache defaultQueryCache = (DefaultQueryCache) queryCache; QueryCacheContext context = defaultQueryCache.context; String mapName = defaultQueryCache.mapName; String cacheId = defaultQueryCache.cacheId; QueryCacheEventService eventService = getQueryCacheEventService(context); LocalCacheWideEventData eventData = new LocalCacheWideEventData(cacheId, eventType.getType(), numberOfEntriesAffected); eventService.publish(mapName, cacheId, eventData, cacheId.hashCode(), queryCache.getExtractors()); }
[ "static", "void", "publishCacheWideEvent", "(", "InternalQueryCache", "queryCache", ",", "int", "numberOfEntriesAffected", ",", "EntryEventType", "eventType", ")", "{", "if", "(", "!", "hasListener", "(", "queryCache", ")", ")", "{", "return", ";", "}", "DefaultQueryCache", "defaultQueryCache", "=", "(", "DefaultQueryCache", ")", "queryCache", ";", "QueryCacheContext", "context", "=", "defaultQueryCache", ".", "context", ";", "String", "mapName", "=", "defaultQueryCache", ".", "mapName", ";", "String", "cacheId", "=", "defaultQueryCache", ".", "cacheId", ";", "QueryCacheEventService", "eventService", "=", "getQueryCacheEventService", "(", "context", ")", ";", "LocalCacheWideEventData", "eventData", "=", "new", "LocalCacheWideEventData", "(", "cacheId", ",", "eventType", ".", "getType", "(", ")", ",", "numberOfEntriesAffected", ")", ";", "eventService", ".", "publish", "(", "mapName", ",", "cacheId", ",", "eventData", ",", "cacheId", ".", "hashCode", "(", ")", ",", "queryCache", ".", "getExtractors", "(", ")", ")", ";", "}" ]
As a result of map-wide events like {@link EntryEventType#CLEAR_ALL} or {@link EntryEventType#EVICT_ALL} we also publish a matching event for query-cache listeners.
[ "As", "a", "result", "of", "map", "-", "wide", "events", "like", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/querycache/subscriber/EventPublisherHelper.java#L89-L107
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java
ExpressionUtils.predicate
public static PredicateOperation predicate(Operator operator, Expression<?>... args) { """ Create a new Operation expression @param operator operator @param args operation arguments @return operation expression """ return predicate(operator, ImmutableList.copyOf(args)); }
java
public static PredicateOperation predicate(Operator operator, Expression<?>... args) { return predicate(operator, ImmutableList.copyOf(args)); }
[ "public", "static", "PredicateOperation", "predicate", "(", "Operator", "operator", ",", "Expression", "<", "?", ">", "...", "args", ")", "{", "return", "predicate", "(", "operator", ",", "ImmutableList", ".", "copyOf", "(", "args", ")", ")", ";", "}" ]
Create a new Operation expression @param operator operator @param args operation arguments @return operation expression
[ "Create", "a", "new", "Operation", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L83-L85
ThreeTen/threetenbp
src/main/java/org/threeten/bp/jdk8/Jdk8Methods.java
Jdk8Methods.safeMultiply
public static int safeMultiply(int a, int b) { """ Safely multiply one int by another. @param a the first value @param b the second value @return the result @throws ArithmeticException if the result overflows an int """ long total = (long) a * (long) b; if (total < Integer.MIN_VALUE || total > Integer.MAX_VALUE) { throw new ArithmeticException("Multiplication overflows an int: " + a + " * " + b); } return (int) total; }
java
public static int safeMultiply(int a, int b) { long total = (long) a * (long) b; if (total < Integer.MIN_VALUE || total > Integer.MAX_VALUE) { throw new ArithmeticException("Multiplication overflows an int: " + a + " * " + b); } return (int) total; }
[ "public", "static", "int", "safeMultiply", "(", "int", "a", ",", "int", "b", ")", "{", "long", "total", "=", "(", "long", ")", "a", "*", "(", "long", ")", "b", ";", "if", "(", "total", "<", "Integer", ".", "MIN_VALUE", "||", "total", ">", "Integer", ".", "MAX_VALUE", ")", "{", "throw", "new", "ArithmeticException", "(", "\"Multiplication overflows an int: \"", "+", "a", "+", "\" * \"", "+", "b", ")", ";", "}", "return", "(", "int", ")", "total", ";", "}" ]
Safely multiply one int by another. @param a the first value @param b the second value @return the result @throws ArithmeticException if the result overflows an int
[ "Safely", "multiply", "one", "int", "by", "another", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/jdk8/Jdk8Methods.java#L215-L221
f2prateek/rx-preferences
rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java
RxSharedPreferences.getInteger
@CheckResult @NonNull public Preference<Integer> getInteger(@NonNull String key) { """ Create an integer preference for {@code key}. Default is {@code 0}. """ return getInteger(key, DEFAULT_INTEGER); }
java
@CheckResult @NonNull public Preference<Integer> getInteger(@NonNull String key) { return getInteger(key, DEFAULT_INTEGER); }
[ "@", "CheckResult", "@", "NonNull", "public", "Preference", "<", "Integer", ">", "getInteger", "(", "@", "NonNull", "String", "key", ")", "{", "return", "getInteger", "(", "key", ",", "DEFAULT_INTEGER", ")", ";", "}" ]
Create an integer preference for {@code key}. Default is {@code 0}.
[ "Create", "an", "integer", "preference", "for", "{" ]
train
https://github.com/f2prateek/rx-preferences/blob/e338b4e6cee9c0c7b850be86ab41ed7b39a3637e/rx-preferences/src/main/java/com/f2prateek/rx/preferences2/RxSharedPreferences.java#L100-L103
osglworks/java-tool-ext
src/main/java/org/osgl/util/Token.java
Token.isTokenValid
@SuppressWarnings("unused") public static boolean isTokenValid(byte[] secret, String oid, String token) { """ Check if a string is a valid token @param secret the secret to decrypt the string @param oid the ID supposed to be encapsulated in the token @param token the token string @return {@code true} if the token is valid """ if (S.anyBlank(oid, token)) { return false; } String s = Crypto.decryptAES(token, secret); String[] sa = s.split("\\|"); if (sa.length < 2) return false; if (!S.isEqual(oid, sa[0])) return false; try { long due = Long.parseLong(sa[1]); return (due < 1 || due > System.currentTimeMillis()); } catch (Exception e) { return false; } }
java
@SuppressWarnings("unused") public static boolean isTokenValid(byte[] secret, String oid, String token) { if (S.anyBlank(oid, token)) { return false; } String s = Crypto.decryptAES(token, secret); String[] sa = s.split("\\|"); if (sa.length < 2) return false; if (!S.isEqual(oid, sa[0])) return false; try { long due = Long.parseLong(sa[1]); return (due < 1 || due > System.currentTimeMillis()); } catch (Exception e) { return false; } }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "boolean", "isTokenValid", "(", "byte", "[", "]", "secret", ",", "String", "oid", ",", "String", "token", ")", "{", "if", "(", "S", ".", "anyBlank", "(", "oid", ",", "token", ")", ")", "{", "return", "false", ";", "}", "String", "s", "=", "Crypto", ".", "decryptAES", "(", "token", ",", "secret", ")", ";", "String", "[", "]", "sa", "=", "s", ".", "split", "(", "\"\\\\|\"", ")", ";", "if", "(", "sa", ".", "length", "<", "2", ")", "return", "false", ";", "if", "(", "!", "S", ".", "isEqual", "(", "oid", ",", "sa", "[", "0", "]", ")", ")", "return", "false", ";", "try", "{", "long", "due", "=", "Long", ".", "parseLong", "(", "sa", "[", "1", "]", ")", ";", "return", "(", "due", "<", "1", "||", "due", ">", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "false", ";", "}", "}" ]
Check if a string is a valid token @param secret the secret to decrypt the string @param oid the ID supposed to be encapsulated in the token @param token the token string @return {@code true} if the token is valid
[ "Check", "if", "a", "string", "is", "a", "valid", "token" ]
train
https://github.com/osglworks/java-tool-ext/blob/43f034bd0a42e571e437f44aa20487d45248a30b/src/main/java/org/osgl/util/Token.java#L415-L430
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java
PutCommand.createVersion
private void createVersion(Node fileNode, InputStream inputStream, String autoVersion, List<String> mixins) throws RepositoryException { """ Creates the new version of file. @param fileNode file node @param inputStream input stream that contains the content of file @param autoVersion auto-version value @param mixins list of mixins @throws RepositoryException {@link RepositoryException} """ if (!fileNode.isNodeType(VersionHistoryUtils.MIX_VERSIONABLE)) { if (fileNode.canAddMixin(VersionHistoryUtils.MIX_VERSIONABLE)) { fileNode.addMixin(VersionHistoryUtils.MIX_VERSIONABLE); fileNode.getSession().save(); } if (!(CHECKIN_CHECKOUT.equals(autoVersion))) { fileNode.checkin(); fileNode.getSession().save(); } } if (CHECKIN_CHECKOUT.equals(autoVersion)) { fileNode.checkin(); fileNode.checkout(); fileNode.getSession().save(); updateContent(fileNode, inputStream, mixins); fileNode.getSession().save(); } else { createVersion(fileNode, inputStream, mixins); } }
java
private void createVersion(Node fileNode, InputStream inputStream, String autoVersion, List<String> mixins) throws RepositoryException { if (!fileNode.isNodeType(VersionHistoryUtils.MIX_VERSIONABLE)) { if (fileNode.canAddMixin(VersionHistoryUtils.MIX_VERSIONABLE)) { fileNode.addMixin(VersionHistoryUtils.MIX_VERSIONABLE); fileNode.getSession().save(); } if (!(CHECKIN_CHECKOUT.equals(autoVersion))) { fileNode.checkin(); fileNode.getSession().save(); } } if (CHECKIN_CHECKOUT.equals(autoVersion)) { fileNode.checkin(); fileNode.checkout(); fileNode.getSession().save(); updateContent(fileNode, inputStream, mixins); fileNode.getSession().save(); } else { createVersion(fileNode, inputStream, mixins); } }
[ "private", "void", "createVersion", "(", "Node", "fileNode", ",", "InputStream", "inputStream", ",", "String", "autoVersion", ",", "List", "<", "String", ">", "mixins", ")", "throws", "RepositoryException", "{", "if", "(", "!", "fileNode", ".", "isNodeType", "(", "VersionHistoryUtils", ".", "MIX_VERSIONABLE", ")", ")", "{", "if", "(", "fileNode", ".", "canAddMixin", "(", "VersionHistoryUtils", ".", "MIX_VERSIONABLE", ")", ")", "{", "fileNode", ".", "addMixin", "(", "VersionHistoryUtils", ".", "MIX_VERSIONABLE", ")", ";", "fileNode", ".", "getSession", "(", ")", ".", "save", "(", ")", ";", "}", "if", "(", "!", "(", "CHECKIN_CHECKOUT", ".", "equals", "(", "autoVersion", ")", ")", ")", "{", "fileNode", ".", "checkin", "(", ")", ";", "fileNode", ".", "getSession", "(", ")", ".", "save", "(", ")", ";", "}", "}", "if", "(", "CHECKIN_CHECKOUT", ".", "equals", "(", "autoVersion", ")", ")", "{", "fileNode", ".", "checkin", "(", ")", ";", "fileNode", ".", "checkout", "(", ")", ";", "fileNode", ".", "getSession", "(", ")", ".", "save", "(", ")", ";", "updateContent", "(", "fileNode", ",", "inputStream", ",", "mixins", ")", ";", "fileNode", ".", "getSession", "(", ")", ".", "save", "(", ")", ";", "}", "else", "{", "createVersion", "(", "fileNode", ",", "inputStream", ",", "mixins", ")", ";", "}", "}" ]
Creates the new version of file. @param fileNode file node @param inputStream input stream that contains the content of file @param autoVersion auto-version value @param mixins list of mixins @throws RepositoryException {@link RepositoryException}
[ "Creates", "the", "new", "version", "of", "file", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/PutCommand.java#L323-L350
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.feed_publishTemplatizedAction
public boolean feed_publishTemplatizedAction(Integer actorId, CharSequence titleTemplate) throws FacebookException, IOException { """ Publishes a Mini-Feed story describing an action taken by a user, and publishes aggregating News Feed stories to the friends of that user. Stories are identified as being combinable if they have matching templates and substituted values. @param actorId deprecated @param titleTemplate markup (up to 60 chars, tags excluded) for the feed story's title section. Must include the token <code>{actor}</code>. @return whether the action story was successfully published; false in case of a permission error @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction"> Developers Wiki: Feed.publishTemplatizedAction</a> @see <a href="http://developers.facebook.com/tools.php?feed"> Developers Resources: Feed Preview Console </a> @deprecated since 01/18/2008 """ if (null != actorId && actorId != this._userId) { throw new IllegalArgumentException("Actor ID parameter is deprecated"); } return feed_publishTemplatizedAction(titleTemplate, null, null, null, null, null, null, /*pageActorId*/ null); }
java
public boolean feed_publishTemplatizedAction(Integer actorId, CharSequence titleTemplate) throws FacebookException, IOException { if (null != actorId && actorId != this._userId) { throw new IllegalArgumentException("Actor ID parameter is deprecated"); } return feed_publishTemplatizedAction(titleTemplate, null, null, null, null, null, null, /*pageActorId*/ null); }
[ "public", "boolean", "feed_publishTemplatizedAction", "(", "Integer", "actorId", ",", "CharSequence", "titleTemplate", ")", "throws", "FacebookException", ",", "IOException", "{", "if", "(", "null", "!=", "actorId", "&&", "actorId", "!=", "this", ".", "_userId", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Actor ID parameter is deprecated\"", ")", ";", "}", "return", "feed_publishTemplatizedAction", "(", "titleTemplate", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "/*pageActorId*/", "null", ")", ";", "}" ]
Publishes a Mini-Feed story describing an action taken by a user, and publishes aggregating News Feed stories to the friends of that user. Stories are identified as being combinable if they have matching templates and substituted values. @param actorId deprecated @param titleTemplate markup (up to 60 chars, tags excluded) for the feed story's title section. Must include the token <code>{actor}</code>. @return whether the action story was successfully published; false in case of a permission error @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishTemplatizedAction"> Developers Wiki: Feed.publishTemplatizedAction</a> @see <a href="http://developers.facebook.com/tools.php?feed"> Developers Resources: Feed Preview Console </a> @deprecated since 01/18/2008
[ "Publishes", "a", "Mini", "-", "Feed", "story", "describing", "an", "action", "taken", "by", "a", "user", "and", "publishes", "aggregating", "News", "Feed", "stories", "to", "the", "friends", "of", "that", "user", ".", "Stories", "are", "identified", "as", "being", "combinable", "if", "they", "have", "matching", "templates", "and", "substituted", "values", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L386-L392
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.copy
public static long copy(ReadableByteChannel in, WritableByteChannel out, int bufferSize) throws IORuntimeException { """ 拷贝流,使用NIO,不会关闭流 @param in {@link ReadableByteChannel} @param out {@link WritableByteChannel} @param bufferSize 缓冲大小,如果小于等于0,使用默认 @return 拷贝的字节数 @throws IORuntimeException IO异常 @since 4.5.0 """ return copy(in, out, bufferSize, null); }
java
public static long copy(ReadableByteChannel in, WritableByteChannel out, int bufferSize) throws IORuntimeException { return copy(in, out, bufferSize, null); }
[ "public", "static", "long", "copy", "(", "ReadableByteChannel", "in", ",", "WritableByteChannel", "out", ",", "int", "bufferSize", ")", "throws", "IORuntimeException", "{", "return", "copy", "(", "in", ",", "out", ",", "bufferSize", ",", "null", ")", ";", "}" ]
拷贝流,使用NIO,不会关闭流 @param in {@link ReadableByteChannel} @param out {@link WritableByteChannel} @param bufferSize 缓冲大小,如果小于等于0,使用默认 @return 拷贝的字节数 @throws IORuntimeException IO异常 @since 4.5.0
[ "拷贝流,使用NIO,不会关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L250-L252
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
PacketParserUtils.parseMessage
public static Message parseMessage(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { """ Parses a message packet. @param parser the XML parser, positioned at the start of a message packet. @param outerXmlEnvironment the outer XML environment (optional). @return a Message packet. @throws XmlPullParserException @throws IOException @throws SmackParsingException """ ParserUtils.assertAtStartTag(parser); assert (parser.getName().equals(Message.ELEMENT)); XmlEnvironment messageXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment); final int initialDepth = parser.getDepth(); Message message = new Message(); message.setStanzaId(parser.getAttributeValue("", "id")); message.setTo(ParserUtils.getJidAttribute(parser, "to")); message.setFrom(ParserUtils.getJidAttribute(parser, "from")); String typeString = parser.getAttributeValue("", "type"); if (typeString != null) { message.setType(Message.Type.fromString(typeString)); } String language = ParserUtils.getXmlLang(parser); message.setLanguage(language); // Parse sub-elements. We include extra logic to make sure the values // are only read once. This is because it's possible for the names to appear // in arbitrary sub-elements. String thread = null; outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: String elementName = parser.getName(); String namespace = parser.getNamespace(); switch (elementName) { case "subject": String xmlLangSubject = ParserUtils.getXmlLang(parser); String subject = parseElementText(parser); if (message.getSubject(xmlLangSubject) == null) { message.addSubject(xmlLangSubject, subject); } break; case "thread": if (thread == null) { thread = parser.nextText(); } break; case "error": message.setError(parseError(parser, messageXmlEnvironment)); break; default: PacketParserUtils.addExtensionElement(message, parser, elementName, namespace, messageXmlEnvironment); break; } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } message.setThread(thread); // TODO check for duplicate body elements. This means we need to check for duplicate xml:lang pairs and for // situations where we have a body element with an explicit xml lang set and once where the value is inherited // and both values are equal. return message; }
java
public static Message parseMessage(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { ParserUtils.assertAtStartTag(parser); assert (parser.getName().equals(Message.ELEMENT)); XmlEnvironment messageXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment); final int initialDepth = parser.getDepth(); Message message = new Message(); message.setStanzaId(parser.getAttributeValue("", "id")); message.setTo(ParserUtils.getJidAttribute(parser, "to")); message.setFrom(ParserUtils.getJidAttribute(parser, "from")); String typeString = parser.getAttributeValue("", "type"); if (typeString != null) { message.setType(Message.Type.fromString(typeString)); } String language = ParserUtils.getXmlLang(parser); message.setLanguage(language); // Parse sub-elements. We include extra logic to make sure the values // are only read once. This is because it's possible for the names to appear // in arbitrary sub-elements. String thread = null; outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: String elementName = parser.getName(); String namespace = parser.getNamespace(); switch (elementName) { case "subject": String xmlLangSubject = ParserUtils.getXmlLang(parser); String subject = parseElementText(parser); if (message.getSubject(xmlLangSubject) == null) { message.addSubject(xmlLangSubject, subject); } break; case "thread": if (thread == null) { thread = parser.nextText(); } break; case "error": message.setError(parseError(parser, messageXmlEnvironment)); break; default: PacketParserUtils.addExtensionElement(message, parser, elementName, namespace, messageXmlEnvironment); break; } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } message.setThread(thread); // TODO check for duplicate body elements. This means we need to check for duplicate xml:lang pairs and for // situations where we have a body element with an explicit xml lang set and once where the value is inherited // and both values are equal. return message; }
[ "public", "static", "Message", "parseMessage", "(", "XmlPullParser", "parser", ",", "XmlEnvironment", "outerXmlEnvironment", ")", "throws", "XmlPullParserException", ",", "IOException", ",", "SmackParsingException", "{", "ParserUtils", ".", "assertAtStartTag", "(", "parser", ")", ";", "assert", "(", "parser", ".", "getName", "(", ")", ".", "equals", "(", "Message", ".", "ELEMENT", ")", ")", ";", "XmlEnvironment", "messageXmlEnvironment", "=", "XmlEnvironment", ".", "from", "(", "parser", ",", "outerXmlEnvironment", ")", ";", "final", "int", "initialDepth", "=", "parser", ".", "getDepth", "(", ")", ";", "Message", "message", "=", "new", "Message", "(", ")", ";", "message", ".", "setStanzaId", "(", "parser", ".", "getAttributeValue", "(", "\"\"", ",", "\"id\"", ")", ")", ";", "message", ".", "setTo", "(", "ParserUtils", ".", "getJidAttribute", "(", "parser", ",", "\"to\"", ")", ")", ";", "message", ".", "setFrom", "(", "ParserUtils", ".", "getJidAttribute", "(", "parser", ",", "\"from\"", ")", ")", ";", "String", "typeString", "=", "parser", ".", "getAttributeValue", "(", "\"\"", ",", "\"type\"", ")", ";", "if", "(", "typeString", "!=", "null", ")", "{", "message", ".", "setType", "(", "Message", ".", "Type", ".", "fromString", "(", "typeString", ")", ")", ";", "}", "String", "language", "=", "ParserUtils", ".", "getXmlLang", "(", "parser", ")", ";", "message", ".", "setLanguage", "(", "language", ")", ";", "// Parse sub-elements. We include extra logic to make sure the values", "// are only read once. This is because it's possible for the names to appear", "// in arbitrary sub-elements.", "String", "thread", "=", "null", ";", "outerloop", ":", "while", "(", "true", ")", "{", "int", "eventType", "=", "parser", ".", "next", "(", ")", ";", "switch", "(", "eventType", ")", "{", "case", "XmlPullParser", ".", "START_TAG", ":", "String", "elementName", "=", "parser", ".", "getName", "(", ")", ";", "String", "namespace", "=", "parser", ".", "getNamespace", "(", ")", ";", "switch", "(", "elementName", ")", "{", "case", "\"subject\"", ":", "String", "xmlLangSubject", "=", "ParserUtils", ".", "getXmlLang", "(", "parser", ")", ";", "String", "subject", "=", "parseElementText", "(", "parser", ")", ";", "if", "(", "message", ".", "getSubject", "(", "xmlLangSubject", ")", "==", "null", ")", "{", "message", ".", "addSubject", "(", "xmlLangSubject", ",", "subject", ")", ";", "}", "break", ";", "case", "\"thread\"", ":", "if", "(", "thread", "==", "null", ")", "{", "thread", "=", "parser", ".", "nextText", "(", ")", ";", "}", "break", ";", "case", "\"error\"", ":", "message", ".", "setError", "(", "parseError", "(", "parser", ",", "messageXmlEnvironment", ")", ")", ";", "break", ";", "default", ":", "PacketParserUtils", ".", "addExtensionElement", "(", "message", ",", "parser", ",", "elementName", ",", "namespace", ",", "messageXmlEnvironment", ")", ";", "break", ";", "}", "break", ";", "case", "XmlPullParser", ".", "END_TAG", ":", "if", "(", "parser", ".", "getDepth", "(", ")", "==", "initialDepth", ")", "{", "break", "outerloop", ";", "}", "break", ";", "}", "}", "message", ".", "setThread", "(", "thread", ")", ";", "// TODO check for duplicate body elements. This means we need to check for duplicate xml:lang pairs and for", "// situations where we have a body element with an explicit xml lang set and once where the value is inherited", "// and both values are equal.", "return", "message", ";", "}" ]
Parses a message packet. @param parser the XML parser, positioned at the start of a message packet. @param outerXmlEnvironment the outer XML environment (optional). @return a Message packet. @throws XmlPullParserException @throws IOException @throws SmackParsingException
[ "Parses", "a", "message", "packet", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L230-L294
alkacon/opencms-core
src-modules/org/opencms/workplace/explorer/CmsExplorer.java
CmsExplorer.folderExists
private boolean folderExists(CmsObject cms, String folder) { """ Checks if a folder with a given name exits in the VFS.<p> @param cms the current cms context @param folder the folder to check for @return true if the folder exists in the VFS """ try { CmsFolder test = cms.readFolder(folder, CmsResourceFilter.IGNORE_EXPIRATION); if (test.isFile()) { return false; } return true; } catch (Exception e) { return false; } }
java
private boolean folderExists(CmsObject cms, String folder) { try { CmsFolder test = cms.readFolder(folder, CmsResourceFilter.IGNORE_EXPIRATION); if (test.isFile()) { return false; } return true; } catch (Exception e) { return false; } }
[ "private", "boolean", "folderExists", "(", "CmsObject", "cms", ",", "String", "folder", ")", "{", "try", "{", "CmsFolder", "test", "=", "cms", ".", "readFolder", "(", "folder", ",", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ")", ";", "if", "(", "test", ".", "isFile", "(", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "false", ";", "}", "}" ]
Checks if a folder with a given name exits in the VFS.<p> @param cms the current cms context @param folder the folder to check for @return true if the folder exists in the VFS
[ "Checks", "if", "a", "folder", "with", "a", "given", "name", "exits", "in", "the", "VFS", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/explorer/CmsExplorer.java#L805-L816
khmarbaise/sapm
src/main/java/com/soebes/subversion/sapm/AccessRule.java
AccessRule.addNegative
public void addNegative(User user, AccessLevel accessLevel) { """ Add the user to the access list with it's appropriate {@link AccessLevel} but this rule means not this user (~user) @param user The user which it shouldn't be. @param accessLevel The level of access for the non users. """ getAccessList().add(new Access(user, accessLevel, true)); }
java
public void addNegative(User user, AccessLevel accessLevel) { getAccessList().add(new Access(user, accessLevel, true)); }
[ "public", "void", "addNegative", "(", "User", "user", ",", "AccessLevel", "accessLevel", ")", "{", "getAccessList", "(", ")", ".", "add", "(", "new", "Access", "(", "user", ",", "accessLevel", ",", "true", ")", ")", ";", "}" ]
Add the user to the access list with it's appropriate {@link AccessLevel} but this rule means not this user (~user) @param user The user which it shouldn't be. @param accessLevel The level of access for the non users.
[ "Add", "the", "user", "to", "the", "access", "list", "with", "it", "s", "appropriate", "{" ]
train
https://github.com/khmarbaise/sapm/blob/b5da5b0d8929324f03cb3a4233a3534813f93eea/src/main/java/com/soebes/subversion/sapm/AccessRule.java#L146-L148
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java
JanusConfig.getSystemPropertyAsClass
public static <S> Class<? extends S> getSystemPropertyAsClass(Class<S> type, String name) { """ Replies the value of the type system property. @param <S> - type to reply. @param type - type to reply. @param name - name of the property. @return the type, or <code>null</code> if no property found. """ return getSystemPropertyAsClass(type, name, (Class<S>) null); }
java
public static <S> Class<? extends S> getSystemPropertyAsClass(Class<S> type, String name) { return getSystemPropertyAsClass(type, name, (Class<S>) null); }
[ "public", "static", "<", "S", ">", "Class", "<", "?", "extends", "S", ">", "getSystemPropertyAsClass", "(", "Class", "<", "S", ">", "type", ",", "String", "name", ")", "{", "return", "getSystemPropertyAsClass", "(", "type", ",", "name", ",", "(", "Class", "<", "S", ">", ")", "null", ")", ";", "}" ]
Replies the value of the type system property. @param <S> - type to reply. @param type - type to reply. @param name - name of the property. @return the type, or <code>null</code> if no property found.
[ "Replies", "the", "value", "of", "the", "type", "system", "property", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java#L492-L494
cdk/cdk
base/core/src/main/java/org/openscience/cdk/ringsearch/JumboCyclicVertexSearch.java
JumboCyclicVertexSearch.indexOfFused
private int indexOfFused(int start, BitSet cycle) { """ Find the next index that the <i>cycle</i> intersects with by at least two vertices. If the intersect of a vertex set with another contains more then two vertices it cannot be edge disjoint. @param start start searching from here @param cycle test whether any current cycles are fused with this one @return the index of the first fused after 'start', -1 if none """ for (int i = start; i < cycles.size(); i++) { if (and(cycles.get(i), cycle).cardinality() > 1) { return i; } } return -1; }
java
private int indexOfFused(int start, BitSet cycle) { for (int i = start; i < cycles.size(); i++) { if (and(cycles.get(i), cycle).cardinality() > 1) { return i; } } return -1; }
[ "private", "int", "indexOfFused", "(", "int", "start", ",", "BitSet", "cycle", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "cycles", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "and", "(", "cycles", ".", "get", "(", "i", ")", ",", "cycle", ")", ".", "cardinality", "(", ")", ">", "1", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Find the next index that the <i>cycle</i> intersects with by at least two vertices. If the intersect of a vertex set with another contains more then two vertices it cannot be edge disjoint. @param start start searching from here @param cycle test whether any current cycles are fused with this one @return the index of the first fused after 'start', -1 if none
[ "Find", "the", "next", "index", "that", "the", "<i", ">", "cycle<", "/", "i", ">", "intersects", "with", "by", "at", "least", "two", "vertices", ".", "If", "the", "intersect", "of", "a", "vertex", "set", "with", "another", "contains", "more", "then", "two", "vertices", "it", "cannot", "be", "edge", "disjoint", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/ringsearch/JumboCyclicVertexSearch.java#L327-L334
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipPhone.java
SipPhone.createSipCall
public SipCall createSipCall() { """ This method is used to create a SipCall object for handling one leg of a call. That is, it represents an outgoing call leg or an incoming call leg. In a telephone call, there are two call legs. The outgoing call leg is the connection from the phone making the call to the telephone network. The incoming call leg is a connection from the telephone network to the phone being called. For a SIP call, the outbound leg is the user agent originating the call and the inbound leg is the user agent receiving the call. The test program can use this method to create a SipCall object for handling an incoming call leg or an outgoing call leg. Currently, only one SipCall object is supported per SipPhone. In future, when more than one SipCall per SipPhone is supported, this method can be called multiple times to create multiple call legs on the same SipPhone object. @return A SipCall object unless an error is encountered. """ initErrorInfo(); SipCall call = new SipCall(this, myAddress); callList.add(call); return call; }
java
public SipCall createSipCall() { initErrorInfo(); SipCall call = new SipCall(this, myAddress); callList.add(call); return call; }
[ "public", "SipCall", "createSipCall", "(", ")", "{", "initErrorInfo", "(", ")", ";", "SipCall", "call", "=", "new", "SipCall", "(", "this", ",", "myAddress", ")", ";", "callList", ".", "add", "(", "call", ")", ";", "return", "call", ";", "}" ]
This method is used to create a SipCall object for handling one leg of a call. That is, it represents an outgoing call leg or an incoming call leg. In a telephone call, there are two call legs. The outgoing call leg is the connection from the phone making the call to the telephone network. The incoming call leg is a connection from the telephone network to the phone being called. For a SIP call, the outbound leg is the user agent originating the call and the inbound leg is the user agent receiving the call. The test program can use this method to create a SipCall object for handling an incoming call leg or an outgoing call leg. Currently, only one SipCall object is supported per SipPhone. In future, when more than one SipCall per SipPhone is supported, this method can be called multiple times to create multiple call legs on the same SipPhone object. @return A SipCall object unless an error is encountered.
[ "This", "method", "is", "used", "to", "create", "a", "SipCall", "object", "for", "handling", "one", "leg", "of", "a", "call", ".", "That", "is", "it", "represents", "an", "outgoing", "call", "leg", "or", "an", "incoming", "call", "leg", ".", "In", "a", "telephone", "call", "there", "are", "two", "call", "legs", ".", "The", "outgoing", "call", "leg", "is", "the", "connection", "from", "the", "phone", "making", "the", "call", "to", "the", "telephone", "network", ".", "The", "incoming", "call", "leg", "is", "a", "connection", "from", "the", "telephone", "network", "to", "the", "phone", "being", "called", ".", "For", "a", "SIP", "call", "the", "outbound", "leg", "is", "the", "user", "agent", "originating", "the", "call", "and", "the", "inbound", "leg", "is", "the", "user", "agent", "receiving", "the", "call", ".", "The", "test", "program", "can", "use", "this", "method", "to", "create", "a", "SipCall", "object", "for", "handling", "an", "incoming", "call", "leg", "or", "an", "outgoing", "call", "leg", ".", "Currently", "only", "one", "SipCall", "object", "is", "supported", "per", "SipPhone", ".", "In", "future", "when", "more", "than", "one", "SipCall", "per", "SipPhone", "is", "supported", "this", "method", "can", "be", "called", "multiple", "times", "to", "create", "multiple", "call", "legs", "on", "the", "same", "SipPhone", "object", "." ]
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipPhone.java#L725-L733
brettwooldridge/SansOrm
src/main/java/com/zaxxer/sansorm/OrmElf.java
OrmElf.insertListBatched
public static <T> void insertListBatched(Connection connection, Iterable<T> iterable) throws SQLException { """ Insert a collection of objects using JDBC batching. @param connection a SQL connection @param iterable a list (or other {@link Iterable} collection) of annotated objects to insert @param <T> the class template @throws SQLException if a {@link SQLException} occurs """ OrmWriter.insertListBatched(connection, iterable); }
java
public static <T> void insertListBatched(Connection connection, Iterable<T> iterable) throws SQLException { OrmWriter.insertListBatched(connection, iterable); }
[ "public", "static", "<", "T", ">", "void", "insertListBatched", "(", "Connection", "connection", ",", "Iterable", "<", "T", ">", "iterable", ")", "throws", "SQLException", "{", "OrmWriter", ".", "insertListBatched", "(", "connection", ",", "iterable", ")", ";", "}" ]
Insert a collection of objects using JDBC batching. @param connection a SQL connection @param iterable a list (or other {@link Iterable} collection) of annotated objects to insert @param <T> the class template @throws SQLException if a {@link SQLException} occurs
[ "Insert", "a", "collection", "of", "objects", "using", "JDBC", "batching", "." ]
train
https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L233-L236
paymill/paymill-java
src/main/java/com/paymill/services/SubscriptionService.java
SubscriptionService.limitValidity
public Subscription limitValidity( String subscription, Interval.Period newValidity ) { """ Change the period of validity for a subscription. @param subscription the subscription. @param newValidity the new validity. @return the updated subscription. """ return limitValidity( new Subscription( subscription ), newValidity ); }
java
public Subscription limitValidity( String subscription, Interval.Period newValidity ) { return limitValidity( new Subscription( subscription ), newValidity ); }
[ "public", "Subscription", "limitValidity", "(", "String", "subscription", ",", "Interval", ".", "Period", "newValidity", ")", "{", "return", "limitValidity", "(", "new", "Subscription", "(", "subscription", ")", ",", "newValidity", ")", ";", "}" ]
Change the period of validity for a subscription. @param subscription the subscription. @param newValidity the new validity. @return the updated subscription.
[ "Change", "the", "period", "of", "validity", "for", "a", "subscription", "." ]
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/SubscriptionService.java#L565-L567
netheosgithub/pcs_api
java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java
Dropbox.buildUrl
private String buildUrl( String methodPath, CPath path ) { """ Url encodes object path, and concatenate to API endpoint and method to get full URL @param methodPath API method path @param path path @return built url """ StringBuilder sb = new StringBuilder(); sb.append( END_POINT ).append( '/' ).append( methodPath ); if ( path != null ) { sb.append( '/' ).append( scope ).append( path.getUrlEncoded() ); } return sb.toString(); }
java
private String buildUrl( String methodPath, CPath path ) { StringBuilder sb = new StringBuilder(); sb.append( END_POINT ).append( '/' ).append( methodPath ); if ( path != null ) { sb.append( '/' ).append( scope ).append( path.getUrlEncoded() ); } return sb.toString(); }
[ "private", "String", "buildUrl", "(", "String", "methodPath", ",", "CPath", "path", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "END_POINT", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "methodPath", ")", ";", "if", "(", "path", "!=", "null", ")", "{", "sb", ".", "append", "(", "'", "'", ")", ".", "append", "(", "scope", ")", ".", "append", "(", "path", ".", "getUrlEncoded", "(", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Url encodes object path, and concatenate to API endpoint and method to get full URL @param methodPath API method path @param path path @return built url
[ "Url", "encodes", "object", "path", "and", "concatenate", "to", "API", "endpoint", "and", "method", "to", "get", "full", "URL" ]
train
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java#L227-L238
knowm/XChart
xchart/src/main/java/org/knowm/xchart/CategoryChart.java
CategoryChart.addSeries
public CategorySeries addSeries( String seriesName, List<?> xData, List<? extends Number> yData, List<? extends Number> errorBars) { """ Add a series for a Category type chart using Lists with error bars @param seriesName @param xData the X-Axis data @param yData the Y-Axis data @param errorBars the error bar data @return A Series object that you can set properties on """ // Sanity checks sanityCheck(seriesName, xData, yData, errorBars); CategorySeries series; if (xData != null) { // Sanity check if (xData.size() != yData.size()) { throw new IllegalArgumentException("X and Y-Axis sizes are not the same!!!"); } series = new CategorySeries(seriesName, xData, yData, errorBars, getDataType(xData)); } else { // generate xData xData = Utils.getGeneratedDataAsList(yData.size()); series = new CategorySeries(seriesName, xData, yData, errorBars, getDataType(xData)); } seriesMap.put(seriesName, series); return series; }
java
public CategorySeries addSeries( String seriesName, List<?> xData, List<? extends Number> yData, List<? extends Number> errorBars) { // Sanity checks sanityCheck(seriesName, xData, yData, errorBars); CategorySeries series; if (xData != null) { // Sanity check if (xData.size() != yData.size()) { throw new IllegalArgumentException("X and Y-Axis sizes are not the same!!!"); } series = new CategorySeries(seriesName, xData, yData, errorBars, getDataType(xData)); } else { // generate xData xData = Utils.getGeneratedDataAsList(yData.size()); series = new CategorySeries(seriesName, xData, yData, errorBars, getDataType(xData)); } seriesMap.put(seriesName, series); return series; }
[ "public", "CategorySeries", "addSeries", "(", "String", "seriesName", ",", "List", "<", "?", ">", "xData", ",", "List", "<", "?", "extends", "Number", ">", "yData", ",", "List", "<", "?", "extends", "Number", ">", "errorBars", ")", "{", "// Sanity checks", "sanityCheck", "(", "seriesName", ",", "xData", ",", "yData", ",", "errorBars", ")", ";", "CategorySeries", "series", ";", "if", "(", "xData", "!=", "null", ")", "{", "// Sanity check", "if", "(", "xData", ".", "size", "(", ")", "!=", "yData", ".", "size", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"X and Y-Axis sizes are not the same!!!\"", ")", ";", "}", "series", "=", "new", "CategorySeries", "(", "seriesName", ",", "xData", ",", "yData", ",", "errorBars", ",", "getDataType", "(", "xData", ")", ")", ";", "}", "else", "{", "// generate xData", "xData", "=", "Utils", ".", "getGeneratedDataAsList", "(", "yData", ".", "size", "(", ")", ")", ";", "series", "=", "new", "CategorySeries", "(", "seriesName", ",", "xData", ",", "yData", ",", "errorBars", ",", "getDataType", "(", "xData", ")", ")", ";", "}", "seriesMap", ".", "put", "(", "seriesName", ",", "series", ")", ";", "return", "series", ";", "}" ]
Add a series for a Category type chart using Lists with error bars @param seriesName @param xData the X-Axis data @param yData the Y-Axis data @param errorBars the error bar data @return A Series object that you can set properties on
[ "Add", "a", "series", "for", "a", "Category", "type", "chart", "using", "Lists", "with", "error", "bars" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/CategoryChart.java#L160-L186
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/AsyncCacheRequestManager.java
AsyncCacheRequestManager.cacheBlockFromRemoteWorker
private boolean cacheBlockFromRemoteWorker(long blockId, long blockSize, InetSocketAddress sourceAddress, Protocol.OpenUfsBlockOptions openUfsBlockOptions) { """ Caches the block at best effort from a remote worker (possibly from UFS indirectly). @param blockId block ID @param blockSize block size @param sourceAddress the source to read the block previously by client @param openUfsBlockOptions options to open the UFS file @return if the block is cached """ try { mBlockWorker.createBlockRemote(Sessions.ASYNC_CACHE_SESSION_ID, blockId, mStorageTierAssoc.getAlias(0), blockSize); } catch (BlockAlreadyExistsException e) { // It is already cached return true; } catch (AlluxioException | IOException e) { LOG.warn( "Failed to async cache block {} from remote worker ({}) on creating the temp block: {}", blockId, sourceAddress, e.getMessage()); return false; } try (BlockReader reader = new RemoteBlockReader(mFsContext, blockId, blockSize, sourceAddress, openUfsBlockOptions); BlockWriter writer = mBlockWorker.getTempBlockWriterRemote(Sessions.ASYNC_CACHE_SESSION_ID, blockId)) { BufferUtils.fastCopy(reader.getChannel(), writer.getChannel()); mBlockWorker.commitBlock(Sessions.ASYNC_CACHE_SESSION_ID, blockId); return true; } catch (AlluxioException | IOException e) { LOG.warn("Failed to async cache block {} from remote worker ({}) on copying the block: {}", blockId, sourceAddress, e.getMessage()); try { mBlockWorker.abortBlock(Sessions.ASYNC_CACHE_SESSION_ID, blockId); } catch (AlluxioException | IOException ee) { LOG.warn("Failed to abort block {}: {}", blockId, ee.getMessage()); } return false; } }
java
private boolean cacheBlockFromRemoteWorker(long blockId, long blockSize, InetSocketAddress sourceAddress, Protocol.OpenUfsBlockOptions openUfsBlockOptions) { try { mBlockWorker.createBlockRemote(Sessions.ASYNC_CACHE_SESSION_ID, blockId, mStorageTierAssoc.getAlias(0), blockSize); } catch (BlockAlreadyExistsException e) { // It is already cached return true; } catch (AlluxioException | IOException e) { LOG.warn( "Failed to async cache block {} from remote worker ({}) on creating the temp block: {}", blockId, sourceAddress, e.getMessage()); return false; } try (BlockReader reader = new RemoteBlockReader(mFsContext, blockId, blockSize, sourceAddress, openUfsBlockOptions); BlockWriter writer = mBlockWorker.getTempBlockWriterRemote(Sessions.ASYNC_CACHE_SESSION_ID, blockId)) { BufferUtils.fastCopy(reader.getChannel(), writer.getChannel()); mBlockWorker.commitBlock(Sessions.ASYNC_CACHE_SESSION_ID, blockId); return true; } catch (AlluxioException | IOException e) { LOG.warn("Failed to async cache block {} from remote worker ({}) on copying the block: {}", blockId, sourceAddress, e.getMessage()); try { mBlockWorker.abortBlock(Sessions.ASYNC_CACHE_SESSION_ID, blockId); } catch (AlluxioException | IOException ee) { LOG.warn("Failed to abort block {}: {}", blockId, ee.getMessage()); } return false; } }
[ "private", "boolean", "cacheBlockFromRemoteWorker", "(", "long", "blockId", ",", "long", "blockSize", ",", "InetSocketAddress", "sourceAddress", ",", "Protocol", ".", "OpenUfsBlockOptions", "openUfsBlockOptions", ")", "{", "try", "{", "mBlockWorker", ".", "createBlockRemote", "(", "Sessions", ".", "ASYNC_CACHE_SESSION_ID", ",", "blockId", ",", "mStorageTierAssoc", ".", "getAlias", "(", "0", ")", ",", "blockSize", ")", ";", "}", "catch", "(", "BlockAlreadyExistsException", "e", ")", "{", "// It is already cached", "return", "true", ";", "}", "catch", "(", "AlluxioException", "|", "IOException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Failed to async cache block {} from remote worker ({}) on creating the temp block: {}\"", ",", "blockId", ",", "sourceAddress", ",", "e", ".", "getMessage", "(", ")", ")", ";", "return", "false", ";", "}", "try", "(", "BlockReader", "reader", "=", "new", "RemoteBlockReader", "(", "mFsContext", ",", "blockId", ",", "blockSize", ",", "sourceAddress", ",", "openUfsBlockOptions", ")", ";", "BlockWriter", "writer", "=", "mBlockWorker", ".", "getTempBlockWriterRemote", "(", "Sessions", ".", "ASYNC_CACHE_SESSION_ID", ",", "blockId", ")", ")", "{", "BufferUtils", ".", "fastCopy", "(", "reader", ".", "getChannel", "(", ")", ",", "writer", ".", "getChannel", "(", ")", ")", ";", "mBlockWorker", ".", "commitBlock", "(", "Sessions", ".", "ASYNC_CACHE_SESSION_ID", ",", "blockId", ")", ";", "return", "true", ";", "}", "catch", "(", "AlluxioException", "|", "IOException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Failed to async cache block {} from remote worker ({}) on copying the block: {}\"", ",", "blockId", ",", "sourceAddress", ",", "e", ".", "getMessage", "(", ")", ")", ";", "try", "{", "mBlockWorker", ".", "abortBlock", "(", "Sessions", ".", "ASYNC_CACHE_SESSION_ID", ",", "blockId", ")", ";", "}", "catch", "(", "AlluxioException", "|", "IOException", "ee", ")", "{", "LOG", ".", "warn", "(", "\"Failed to abort block {}: {}\"", ",", "blockId", ",", "ee", ".", "getMessage", "(", ")", ")", ";", "}", "return", "false", ";", "}", "}" ]
Caches the block at best effort from a remote worker (possibly from UFS indirectly). @param blockId block ID @param blockSize block size @param sourceAddress the source to read the block previously by client @param openUfsBlockOptions options to open the UFS file @return if the block is cached
[ "Caches", "the", "block", "at", "best", "effort", "from", "a", "remote", "worker", "(", "possibly", "from", "UFS", "indirectly", ")", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/AsyncCacheRequestManager.java#L196-L227
zaproxy/zaproxy
src/org/zaproxy/zap/extension/users/ExtensionUserManagement.java
ExtensionUserManagement.getContextPanel
private ContextUsersPanel getContextPanel(int contextId) { """ Gets the context panel for a given context. @param contextId the context id @return the context panel """ ContextUsersPanel panel = this.userPanelsMap.get(contextId); if (panel == null) { panel = new ContextUsersPanel(this, contextId); this.userPanelsMap.put(contextId, panel); } return panel; }
java
private ContextUsersPanel getContextPanel(int contextId) { ContextUsersPanel panel = this.userPanelsMap.get(contextId); if (panel == null) { panel = new ContextUsersPanel(this, contextId); this.userPanelsMap.put(contextId, panel); } return panel; }
[ "private", "ContextUsersPanel", "getContextPanel", "(", "int", "contextId", ")", "{", "ContextUsersPanel", "panel", "=", "this", ".", "userPanelsMap", ".", "get", "(", "contextId", ")", ";", "if", "(", "panel", "==", "null", ")", "{", "panel", "=", "new", "ContextUsersPanel", "(", "this", ",", "contextId", ")", ";", "this", ".", "userPanelsMap", ".", "put", "(", "contextId", ",", "panel", ")", ";", "}", "return", "panel", ";", "}" ]
Gets the context panel for a given context. @param contextId the context id @return the context panel
[ "Gets", "the", "context", "panel", "for", "a", "given", "context", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/users/ExtensionUserManagement.java#L184-L191
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
DocEnv.getMethodDoc
public MethodDocImpl getMethodDoc(MethodSymbol meth) { """ Return the MethodDoc for a MethodSymbol. Should be called only on symbols representing methods. """ assert !meth.isConstructor() : "not expecting a constructor symbol"; MethodDocImpl result = (MethodDocImpl)methodMap.get(meth); if (result != null) return result; result = new MethodDocImpl(this, meth); methodMap.put(meth, result); return result; }
java
public MethodDocImpl getMethodDoc(MethodSymbol meth) { assert !meth.isConstructor() : "not expecting a constructor symbol"; MethodDocImpl result = (MethodDocImpl)methodMap.get(meth); if (result != null) return result; result = new MethodDocImpl(this, meth); methodMap.put(meth, result); return result; }
[ "public", "MethodDocImpl", "getMethodDoc", "(", "MethodSymbol", "meth", ")", "{", "assert", "!", "meth", ".", "isConstructor", "(", ")", ":", "\"not expecting a constructor symbol\"", ";", "MethodDocImpl", "result", "=", "(", "MethodDocImpl", ")", "methodMap", ".", "get", "(", "meth", ")", ";", "if", "(", "result", "!=", "null", ")", "return", "result", ";", "result", "=", "new", "MethodDocImpl", "(", "this", ",", "meth", ")", ";", "methodMap", ".", "put", "(", "meth", ",", "result", ")", ";", "return", "result", ";", "}" ]
Return the MethodDoc for a MethodSymbol. Should be called only on symbols representing methods.
[ "Return", "the", "MethodDoc", "for", "a", "MethodSymbol", ".", "Should", "be", "called", "only", "on", "symbols", "representing", "methods", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L675-L682
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldprocessor/impl/IterateTablesProcessor.java
IterateTablesProcessor.checkRecordAnnotation
private void checkRecordAnnotation(final Class<?> tableClass, final AnnotationReader annoReader) { """ レコード用のアノテーションの整合性のチェックを行う。 <p>{@link XlsHorizontalRecords}と{@link XlsVerticalRecords}は、どちらか一方のみ指定可能。</p> @param tableClass テーブル用のクラス情報 @param annoReader アノテーションの提供クラス """ final int horizontalSize = FieldAccessorUtils.getPropertiesWithAnnotation( tableClass, annoReader, XlsHorizontalRecords.class) .size(); final int verticalSize = FieldAccessorUtils.getPropertiesWithAnnotation( tableClass, annoReader, XlsVerticalRecords.class) .size(); if(horizontalSize > 0 && verticalSize > 0) { throw new AnnotationInvalidException(MessageBuilder.create("anno.XlsIterateTables.horizontalAndVertical") .varWithClass("tableClass", tableClass) .format()); } }
java
private void checkRecordAnnotation(final Class<?> tableClass, final AnnotationReader annoReader) { final int horizontalSize = FieldAccessorUtils.getPropertiesWithAnnotation( tableClass, annoReader, XlsHorizontalRecords.class) .size(); final int verticalSize = FieldAccessorUtils.getPropertiesWithAnnotation( tableClass, annoReader, XlsVerticalRecords.class) .size(); if(horizontalSize > 0 && verticalSize > 0) { throw new AnnotationInvalidException(MessageBuilder.create("anno.XlsIterateTables.horizontalAndVertical") .varWithClass("tableClass", tableClass) .format()); } }
[ "private", "void", "checkRecordAnnotation", "(", "final", "Class", "<", "?", ">", "tableClass", ",", "final", "AnnotationReader", "annoReader", ")", "{", "final", "int", "horizontalSize", "=", "FieldAccessorUtils", ".", "getPropertiesWithAnnotation", "(", "tableClass", ",", "annoReader", ",", "XlsHorizontalRecords", ".", "class", ")", ".", "size", "(", ")", ";", "final", "int", "verticalSize", "=", "FieldAccessorUtils", ".", "getPropertiesWithAnnotation", "(", "tableClass", ",", "annoReader", ",", "XlsVerticalRecords", ".", "class", ")", ".", "size", "(", ")", ";", "if", "(", "horizontalSize", ">", "0", "&&", "verticalSize", ">", "0", ")", "{", "throw", "new", "AnnotationInvalidException", "(", "MessageBuilder", ".", "create", "(", "\"anno.XlsIterateTables.horizontalAndVertical\"", ")", ".", "varWithClass", "(", "\"tableClass\"", ",", "tableClass", ")", ".", "format", "(", ")", ")", ";", "}", "}" ]
レコード用のアノテーションの整合性のチェックを行う。 <p>{@link XlsHorizontalRecords}と{@link XlsVerticalRecords}は、どちらか一方のみ指定可能。</p> @param tableClass テーブル用のクラス情報 @param annoReader アノテーションの提供クラス
[ "レコード用のアノテーションの整合性のチェックを行う。", "<p", ">", "{" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldprocessor/impl/IterateTablesProcessor.java#L195-L211
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java
MetadataService.findPermissions
public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName, String appId) { """ Finds {@link Permission}s which belong to the specified {@code appId} from the specified {@code repoName} in the specified {@code projectName}. """ requireNonNull(projectName, "projectName"); requireNonNull(repoName, "repoName"); requireNonNull(appId, "appId"); return getProject(projectName).thenApply(metadata -> { final RepositoryMetadata repositoryMetadata = metadata.repo(repoName); final TokenRegistration registration = metadata.tokens().getOrDefault(appId, null); // If the token is guest. if (registration == null) { return repositoryMetadata.perRolePermissions().guest(); } final Collection<Permission> p = repositoryMetadata.perTokenPermissions().get(registration.id()); if (p != null) { return p; } return findPerRolePermissions(repositoryMetadata, registration.role()); }); }
java
public CompletableFuture<Collection<Permission>> findPermissions(String projectName, String repoName, String appId) { requireNonNull(projectName, "projectName"); requireNonNull(repoName, "repoName"); requireNonNull(appId, "appId"); return getProject(projectName).thenApply(metadata -> { final RepositoryMetadata repositoryMetadata = metadata.repo(repoName); final TokenRegistration registration = metadata.tokens().getOrDefault(appId, null); // If the token is guest. if (registration == null) { return repositoryMetadata.perRolePermissions().guest(); } final Collection<Permission> p = repositoryMetadata.perTokenPermissions().get(registration.id()); if (p != null) { return p; } return findPerRolePermissions(repositoryMetadata, registration.role()); }); }
[ "public", "CompletableFuture", "<", "Collection", "<", "Permission", ">", ">", "findPermissions", "(", "String", "projectName", ",", "String", "repoName", ",", "String", "appId", ")", "{", "requireNonNull", "(", "projectName", ",", "\"projectName\"", ")", ";", "requireNonNull", "(", "repoName", ",", "\"repoName\"", ")", ";", "requireNonNull", "(", "appId", ",", "\"appId\"", ")", ";", "return", "getProject", "(", "projectName", ")", ".", "thenApply", "(", "metadata", "->", "{", "final", "RepositoryMetadata", "repositoryMetadata", "=", "metadata", ".", "repo", "(", "repoName", ")", ";", "final", "TokenRegistration", "registration", "=", "metadata", ".", "tokens", "(", ")", ".", "getOrDefault", "(", "appId", ",", "null", ")", ";", "// If the token is guest.", "if", "(", "registration", "==", "null", ")", "{", "return", "repositoryMetadata", ".", "perRolePermissions", "(", ")", ".", "guest", "(", ")", ";", "}", "final", "Collection", "<", "Permission", ">", "p", "=", "repositoryMetadata", ".", "perTokenPermissions", "(", ")", ".", "get", "(", "registration", ".", "id", "(", ")", ")", ";", "if", "(", "p", "!=", "null", ")", "{", "return", "p", ";", "}", "return", "findPerRolePermissions", "(", "repositoryMetadata", ",", "registration", ".", "role", "(", ")", ")", ";", "}", ")", ";", "}" ]
Finds {@link Permission}s which belong to the specified {@code appId} from the specified {@code repoName} in the specified {@code projectName}.
[ "Finds", "{" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L602-L622
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/BranchUrlBuilder.java
BranchUrlBuilder.addParameters
@SuppressWarnings("unchecked") public T addParameters(String key, Object value) { """ <p>Adds the the given key value pair to the parameters associated with this link.</p> @param key A {@link String} with value of key for the parameter @param value A {@link Object} with value of value for the parameter @return This Builder object to allow for chaining of calls to set methods. """ try { if (this.params_ == null) { this.params_ = new JSONObject(); } this.params_.put(key, value); } catch (JSONException ignore) { } return (T) this; }
java
@SuppressWarnings("unchecked") public T addParameters(String key, Object value) { try { if (this.params_ == null) { this.params_ = new JSONObject(); } this.params_.put(key, value); } catch (JSONException ignore) { } return (T) this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "addParameters", "(", "String", "key", ",", "Object", "value", ")", "{", "try", "{", "if", "(", "this", ".", "params_", "==", "null", ")", "{", "this", ".", "params_", "=", "new", "JSONObject", "(", ")", ";", "}", "this", ".", "params_", ".", "put", "(", "key", ",", "value", ")", ";", "}", "catch", "(", "JSONException", "ignore", ")", "{", "}", "return", "(", "T", ")", "this", ";", "}" ]
<p>Adds the the given key value pair to the parameters associated with this link.</p> @param key A {@link String} with value of key for the parameter @param value A {@link Object} with value of value for the parameter @return This Builder object to allow for chaining of calls to set methods.
[ "<p", ">", "Adds", "the", "the", "given", "key", "value", "pair", "to", "the", "parameters", "associated", "with", "this", "link", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/BranchUrlBuilder.java#L97-L108
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFitSegment.java
SplitMergeLineFitSegment.selectSplitBetween
protected int selectSplitBetween(int indexStart, int indexEnd) { """ Finds the point between indexStart and the end point which is the greater distance from the line (set up prior to calling). Returns the index if the distance is less than tolerance, otherwise -1 """ Point2D_I32 a = contour.get(indexStart); Point2D_I32 c = contour.get(indexEnd); line.p.set(a.x,a.y); line.slope.set(c.x-a.x,c.y-a.y); int bestIndex = -1; double bestDistanceSq = splitThresholdSq(contour.get(indexStart), contour.get(indexEnd)); // adjusting using 'minimumSideLengthPixel' to ensure it doesn't create a new line which is too short int minLength = Math.max(1,minimumSideLengthPixel);// 1 is the minimum so that you don't split on the same corner int length = indexEnd-indexStart-minLength; // don't try splitting at the two end points for( int i = minLength; i <= length; i++ ) { int index = indexStart+i; Point2D_I32 b = contour.get(index); point2D.set(b.x,b.y); double dist = Distance2D_F64.distanceSq(line, point2D); if( dist >= bestDistanceSq ) { bestDistanceSq = dist; bestIndex = index; } } return bestIndex; }
java
protected int selectSplitBetween(int indexStart, int indexEnd) { Point2D_I32 a = contour.get(indexStart); Point2D_I32 c = contour.get(indexEnd); line.p.set(a.x,a.y); line.slope.set(c.x-a.x,c.y-a.y); int bestIndex = -1; double bestDistanceSq = splitThresholdSq(contour.get(indexStart), contour.get(indexEnd)); // adjusting using 'minimumSideLengthPixel' to ensure it doesn't create a new line which is too short int minLength = Math.max(1,minimumSideLengthPixel);// 1 is the minimum so that you don't split on the same corner int length = indexEnd-indexStart-minLength; // don't try splitting at the two end points for( int i = minLength; i <= length; i++ ) { int index = indexStart+i; Point2D_I32 b = contour.get(index); point2D.set(b.x,b.y); double dist = Distance2D_F64.distanceSq(line, point2D); if( dist >= bestDistanceSq ) { bestDistanceSq = dist; bestIndex = index; } } return bestIndex; }
[ "protected", "int", "selectSplitBetween", "(", "int", "indexStart", ",", "int", "indexEnd", ")", "{", "Point2D_I32", "a", "=", "contour", ".", "get", "(", "indexStart", ")", ";", "Point2D_I32", "c", "=", "contour", ".", "get", "(", "indexEnd", ")", ";", "line", ".", "p", ".", "set", "(", "a", ".", "x", ",", "a", ".", "y", ")", ";", "line", ".", "slope", ".", "set", "(", "c", ".", "x", "-", "a", ".", "x", ",", "c", ".", "y", "-", "a", ".", "y", ")", ";", "int", "bestIndex", "=", "-", "1", ";", "double", "bestDistanceSq", "=", "splitThresholdSq", "(", "contour", ".", "get", "(", "indexStart", ")", ",", "contour", ".", "get", "(", "indexEnd", ")", ")", ";", "// adjusting using 'minimumSideLengthPixel' to ensure it doesn't create a new line which is too short", "int", "minLength", "=", "Math", ".", "max", "(", "1", ",", "minimumSideLengthPixel", ")", ";", "// 1 is the minimum so that you don't split on the same corner", "int", "length", "=", "indexEnd", "-", "indexStart", "-", "minLength", ";", "// don't try splitting at the two end points", "for", "(", "int", "i", "=", "minLength", ";", "i", "<=", "length", ";", "i", "++", ")", "{", "int", "index", "=", "indexStart", "+", "i", ";", "Point2D_I32", "b", "=", "contour", ".", "get", "(", "index", ")", ";", "point2D", ".", "set", "(", "b", ".", "x", ",", "b", ".", "y", ")", ";", "double", "dist", "=", "Distance2D_F64", ".", "distanceSq", "(", "line", ",", "point2D", ")", ";", "if", "(", "dist", ">=", "bestDistanceSq", ")", "{", "bestDistanceSq", "=", "dist", ";", "bestIndex", "=", "index", ";", "}", "}", "return", "bestIndex", ";", "}" ]
Finds the point between indexStart and the end point which is the greater distance from the line (set up prior to calling). Returns the index if the distance is less than tolerance, otherwise -1
[ "Finds", "the", "point", "between", "indexStart", "and", "the", "end", "point", "which", "is", "the", "greater", "distance", "from", "the", "line", "(", "set", "up", "prior", "to", "calling", ")", ".", "Returns", "the", "index", "if", "the", "distance", "is", "less", "than", "tolerance", "otherwise", "-", "1" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/SplitMergeLineFitSegment.java#L119-L147
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java
ClassReflectionIndexUtil.findMethods
public static Collection<Method> findMethods(final DeploymentReflectionIndex deploymentReflectionIndex, final ClassReflectionIndex classReflectionIndex, final String methodName, final String... paramTypes) { """ Finds and returns methods corresponding to the passed method <code>name</code> and method <code>paramTypes</code>. The passed <code>classReflectionIndex</code> will be used to traverse the class hierarchy while finding the method. <p/> Returns empty collection if no such method is found @param deploymentReflectionIndex The deployment reflection index @param classReflectionIndex The class reflection index which will be used to traverse the class hierarchy to find the method @param methodName The name of the method @param paramTypes The param types accepted by the method @return """ final Collection<Method> methods = classReflectionIndex.getMethods(methodName, paramTypes); if (!methods.isEmpty()) { return methods; } // find on super class Class<?> superClass = classReflectionIndex.getIndexedClass().getSuperclass(); if (superClass != null) { ClassReflectionIndex superClassIndex = deploymentReflectionIndex.getClassIndex(superClass); if (superClassIndex != null) { return findMethods(deploymentReflectionIndex, superClassIndex, methodName, paramTypes); } } return methods; }
java
public static Collection<Method> findMethods(final DeploymentReflectionIndex deploymentReflectionIndex, final ClassReflectionIndex classReflectionIndex, final String methodName, final String... paramTypes) { final Collection<Method> methods = classReflectionIndex.getMethods(methodName, paramTypes); if (!methods.isEmpty()) { return methods; } // find on super class Class<?> superClass = classReflectionIndex.getIndexedClass().getSuperclass(); if (superClass != null) { ClassReflectionIndex superClassIndex = deploymentReflectionIndex.getClassIndex(superClass); if (superClassIndex != null) { return findMethods(deploymentReflectionIndex, superClassIndex, methodName, paramTypes); } } return methods; }
[ "public", "static", "Collection", "<", "Method", ">", "findMethods", "(", "final", "DeploymentReflectionIndex", "deploymentReflectionIndex", ",", "final", "ClassReflectionIndex", "classReflectionIndex", ",", "final", "String", "methodName", ",", "final", "String", "...", "paramTypes", ")", "{", "final", "Collection", "<", "Method", ">", "methods", "=", "classReflectionIndex", ".", "getMethods", "(", "methodName", ",", "paramTypes", ")", ";", "if", "(", "!", "methods", ".", "isEmpty", "(", ")", ")", "{", "return", "methods", ";", "}", "// find on super class", "Class", "<", "?", ">", "superClass", "=", "classReflectionIndex", ".", "getIndexedClass", "(", ")", ".", "getSuperclass", "(", ")", ";", "if", "(", "superClass", "!=", "null", ")", "{", "ClassReflectionIndex", "superClassIndex", "=", "deploymentReflectionIndex", ".", "getClassIndex", "(", "superClass", ")", ";", "if", "(", "superClassIndex", "!=", "null", ")", "{", "return", "findMethods", "(", "deploymentReflectionIndex", ",", "superClassIndex", ",", "methodName", ",", "paramTypes", ")", ";", "}", "}", "return", "methods", ";", "}" ]
Finds and returns methods corresponding to the passed method <code>name</code> and method <code>paramTypes</code>. The passed <code>classReflectionIndex</code> will be used to traverse the class hierarchy while finding the method. <p/> Returns empty collection if no such method is found @param deploymentReflectionIndex The deployment reflection index @param classReflectionIndex The class reflection index which will be used to traverse the class hierarchy to find the method @param methodName The name of the method @param paramTypes The param types accepted by the method @return
[ "Finds", "and", "returns", "methods", "corresponding", "to", "the", "passed", "method", "<code", ">", "name<", "/", "code", ">", "and", "method", "<code", ">", "paramTypes<", "/", "code", ">", ".", "The", "passed", "<code", ">", "classReflectionIndex<", "/", "code", ">", "will", "be", "used", "to", "traverse", "the", "class", "hierarchy", "while", "finding", "the", "method", ".", "<p", "/", ">", "Returns", "empty", "collection", "if", "no", "such", "method", "is", "found" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java#L154-L169
buschmais/jqa-maven3-plugin
src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java
MavenModelScannerPlugin.addModules
private void addModules(BaseProfileDescriptor pomDescriptor, List<String> modules, Store store) { """ Adds information about referenced modules. @param pomDescriptor The descriptor for the current POM. @param modules The modules. @param store The database. """ for (String module : modules) { MavenModuleDescriptor moduleDescriptor = store.create(MavenModuleDescriptor.class); moduleDescriptor.setName(module); pomDescriptor.getModules().add(moduleDescriptor); } }
java
private void addModules(BaseProfileDescriptor pomDescriptor, List<String> modules, Store store) { for (String module : modules) { MavenModuleDescriptor moduleDescriptor = store.create(MavenModuleDescriptor.class); moduleDescriptor.setName(module); pomDescriptor.getModules().add(moduleDescriptor); } }
[ "private", "void", "addModules", "(", "BaseProfileDescriptor", "pomDescriptor", ",", "List", "<", "String", ">", "modules", ",", "Store", "store", ")", "{", "for", "(", "String", "module", ":", "modules", ")", "{", "MavenModuleDescriptor", "moduleDescriptor", "=", "store", ".", "create", "(", "MavenModuleDescriptor", ".", "class", ")", ";", "moduleDescriptor", ".", "setName", "(", "module", ")", ";", "pomDescriptor", ".", "getModules", "(", ")", ".", "add", "(", "moduleDescriptor", ")", ";", "}", "}" ]
Adds information about referenced modules. @param pomDescriptor The descriptor for the current POM. @param modules The modules. @param store The database.
[ "Adds", "information", "about", "referenced", "modules", "." ]
train
https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L462-L469
ysc/word
src/main/java/org/apdplat/word/segmentation/impl/FullSegmentation.java
FullSegmentation.buildNode
private void buildNode(Node parent, List<String>[] sequence, int from, List<Node> leaf) { """ 根据全切分中间结果构造切分树 @param parent 父节点 @param sequence 全切分中间结果 @param from 全切分中间结果数组下标索引 @param leaf 叶子节点集合 """ //递归退出条件:二维数组遍历完毕 if(from >= sequence.length){ //记住叶子节点 leaf.add(parent); return; } for(String item : sequence[from]){ Node child = new Node(item, parent); buildNode(child, sequence, from+item.length(), leaf); } }
java
private void buildNode(Node parent, List<String>[] sequence, int from, List<Node> leaf){ //递归退出条件:二维数组遍历完毕 if(from >= sequence.length){ //记住叶子节点 leaf.add(parent); return; } for(String item : sequence[from]){ Node child = new Node(item, parent); buildNode(child, sequence, from+item.length(), leaf); } }
[ "private", "void", "buildNode", "(", "Node", "parent", ",", "List", "<", "String", ">", "[", "]", "sequence", ",", "int", "from", ",", "List", "<", "Node", ">", "leaf", ")", "{", "//递归退出条件:二维数组遍历完毕", "if", "(", "from", ">=", "sequence", ".", "length", ")", "{", "//记住叶子节点", "leaf", ".", "add", "(", "parent", ")", ";", "return", ";", "}", "for", "(", "String", "item", ":", "sequence", "[", "from", "]", ")", "{", "Node", "child", "=", "new", "Node", "(", "item", ",", "parent", ")", ";", "buildNode", "(", "child", ",", "sequence", ",", "from", "+", "item", ".", "length", "(", ")", ",", "leaf", ")", ";", "}", "}" ]
根据全切分中间结果构造切分树 @param parent 父节点 @param sequence 全切分中间结果 @param from 全切分中间结果数组下标索引 @param leaf 叶子节点集合
[ "根据全切分中间结果构造切分树" ]
train
https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/segmentation/impl/FullSegmentation.java#L197-L208
virgo47/javasimon
core/src/main/java/org/javasimon/callback/calltree/CallTreeCallback.java
CallTreeCallback.initCallTree
private CallTree initCallTree() { """ Initializes the call tree for current thread. @return Created call tree """ final CallTree callTree = new CallTree(logThreshold) { @Override protected void onRootStopwatchStop(CallTreeNode rootNode, Split split) { CallTreeCallback.this.onRootStopwatchStop(this, split); } }; threadCallTree.set(callTree); return callTree; }
java
private CallTree initCallTree() { final CallTree callTree = new CallTree(logThreshold) { @Override protected void onRootStopwatchStop(CallTreeNode rootNode, Split split) { CallTreeCallback.this.onRootStopwatchStop(this, split); } }; threadCallTree.set(callTree); return callTree; }
[ "private", "CallTree", "initCallTree", "(", ")", "{", "final", "CallTree", "callTree", "=", "new", "CallTree", "(", "logThreshold", ")", "{", "@", "Override", "protected", "void", "onRootStopwatchStop", "(", "CallTreeNode", "rootNode", ",", "Split", "split", ")", "{", "CallTreeCallback", ".", "this", ".", "onRootStopwatchStop", "(", "this", ",", "split", ")", ";", "}", "}", ";", "threadCallTree", ".", "set", "(", "callTree", ")", ";", "return", "callTree", ";", "}" ]
Initializes the call tree for current thread. @return Created call tree
[ "Initializes", "the", "call", "tree", "for", "current", "thread", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/callback/calltree/CallTreeCallback.java#L107-L116
brutusin/commons
src/main/java/org/brutusin/commons/utils/Miscellaneous.java
Miscellaneous.isSymlink
public static boolean isSymlink(File file) throws IOException { """ Determines whether the specified file is a Symbolic Link rather than an actual file. <p> Will not return true if there is a Symbolic Link anywhere in the path, only if the specific file is. <p> <b>Note:</b> the current implementation always returns {@code false} if the system is detected as Windows. Copied from org.apache.commons.io.FileuUils @param file the file to check @return true if the file is a Symbolic Link @throws IOException if an IO error occurs while checking the file """ if (file == null) { throw new NullPointerException("File must not be null"); } if (File.separatorChar == '\\') { return false; } File fileInCanonicalDir; if (file.getParent() == null) { fileInCanonicalDir = file; } else { File canonicalDir = file.getParentFile().getCanonicalFile(); fileInCanonicalDir = new File(canonicalDir, file.getName()); } return !fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile()); }
java
public static boolean isSymlink(File file) throws IOException { if (file == null) { throw new NullPointerException("File must not be null"); } if (File.separatorChar == '\\') { return false; } File fileInCanonicalDir; if (file.getParent() == null) { fileInCanonicalDir = file; } else { File canonicalDir = file.getParentFile().getCanonicalFile(); fileInCanonicalDir = new File(canonicalDir, file.getName()); } return !fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile()); }
[ "public", "static", "boolean", "isSymlink", "(", "File", "file", ")", "throws", "IOException", "{", "if", "(", "file", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"File must not be null\"", ")", ";", "}", "if", "(", "File", ".", "separatorChar", "==", "'", "'", ")", "{", "return", "false", ";", "}", "File", "fileInCanonicalDir", ";", "if", "(", "file", ".", "getParent", "(", ")", "==", "null", ")", "{", "fileInCanonicalDir", "=", "file", ";", "}", "else", "{", "File", "canonicalDir", "=", "file", ".", "getParentFile", "(", ")", ".", "getCanonicalFile", "(", ")", ";", "fileInCanonicalDir", "=", "new", "File", "(", "canonicalDir", ",", "file", ".", "getName", "(", ")", ")", ";", "}", "return", "!", "fileInCanonicalDir", ".", "getCanonicalFile", "(", ")", ".", "equals", "(", "fileInCanonicalDir", ".", "getAbsoluteFile", "(", ")", ")", ";", "}" ]
Determines whether the specified file is a Symbolic Link rather than an actual file. <p> Will not return true if there is a Symbolic Link anywhere in the path, only if the specific file is. <p> <b>Note:</b> the current implementation always returns {@code false} if the system is detected as Windows. Copied from org.apache.commons.io.FileuUils @param file the file to check @return true if the file is a Symbolic Link @throws IOException if an IO error occurs while checking the file
[ "Determines", "whether", "the", "specified", "file", "is", "a", "Symbolic", "Link", "rather", "than", "an", "actual", "file", ".", "<p", ">", "Will", "not", "return", "true", "if", "there", "is", "a", "Symbolic", "Link", "anywhere", "in", "the", "path", "only", "if", "the", "specific", "file", "is", ".", "<p", ">", "<b", ">", "Note", ":", "<", "/", "b", ">", "the", "current", "implementation", "always", "returns", "{", "@code", "false", "}", "if", "the", "system", "is", "detected", "as", "Windows", "." ]
train
https://github.com/brutusin/commons/blob/70685df2b2456d0bf1e6a4754d72c87bba4949df/src/main/java/org/brutusin/commons/utils/Miscellaneous.java#L327-L343
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/ConfigurationCheck.java
ConfigurationCheck.checkVersionOnJoinedInheritance
private void checkVersionOnJoinedInheritance(List<String> errors, Config config) { """ In case of JOINED inheritance we may have added some columns that are in the table but that are not in the entityConfigs. We check here that we have not added a version column in a child. @param errors @param config """ for (Entity entity : config.getProject().getRootEntities().getList()) { if (entity.hasInheritance() && entity.getInheritance().is(JOINED)) { for (Entity child : entity.getAllChildrenRecursive()) { for (Attribute attribute : child.getAttributes().getList()) { if (attribute.isVersion()) { errors.add(attribute.getFullColumnName() + " is a version column, you should not have @Version in a child joined entity." + " Use ignore=true in columnConfig or remove it from your table."); } } } } } }
java
private void checkVersionOnJoinedInheritance(List<String> errors, Config config) { for (Entity entity : config.getProject().getRootEntities().getList()) { if (entity.hasInheritance() && entity.getInheritance().is(JOINED)) { for (Entity child : entity.getAllChildrenRecursive()) { for (Attribute attribute : child.getAttributes().getList()) { if (attribute.isVersion()) { errors.add(attribute.getFullColumnName() + " is a version column, you should not have @Version in a child joined entity." + " Use ignore=true in columnConfig or remove it from your table."); } } } } } }
[ "private", "void", "checkVersionOnJoinedInheritance", "(", "List", "<", "String", ">", "errors", ",", "Config", "config", ")", "{", "for", "(", "Entity", "entity", ":", "config", ".", "getProject", "(", ")", ".", "getRootEntities", "(", ")", ".", "getList", "(", ")", ")", "{", "if", "(", "entity", ".", "hasInheritance", "(", ")", "&&", "entity", ".", "getInheritance", "(", ")", ".", "is", "(", "JOINED", ")", ")", "{", "for", "(", "Entity", "child", ":", "entity", ".", "getAllChildrenRecursive", "(", ")", ")", "{", "for", "(", "Attribute", "attribute", ":", "child", ".", "getAttributes", "(", ")", ".", "getList", "(", ")", ")", "{", "if", "(", "attribute", ".", "isVersion", "(", ")", ")", "{", "errors", ".", "add", "(", "attribute", ".", "getFullColumnName", "(", ")", "+", "\" is a version column, you should not have @Version in a child joined entity.\"", "+", "\" Use ignore=true in columnConfig or remove it from your table.\"", ")", ";", "}", "}", "}", "}", "}", "}" ]
In case of JOINED inheritance we may have added some columns that are in the table but that are not in the entityConfigs. We check here that we have not added a version column in a child. @param errors @param config
[ "In", "case", "of", "JOINED", "inheritance", "we", "may", "have", "added", "some", "columns", "that", "are", "in", "the", "table", "but", "that", "are", "not", "in", "the", "entityConfigs", ".", "We", "check", "here", "that", "we", "have", "not", "added", "a", "version", "column", "in", "a", "child", "." ]
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/ConfigurationCheck.java#L123-L136
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/IFileInputStream.java
IFileInputStream.readWithChecksum
public int readWithChecksum(byte[] b, int off, int len) throws IOException { """ Read bytes from the stream. At EOF, checksum is validated and sent back as the last four bytes of the buffer. The caller should handle these bytes appropriately """ if (currentOffset == length) { return -1; } else if (currentOffset >= dataLength) { // If the previous read drained off all the data, then just return // the checksum now. Note that checksum validation would have // happened in the earlier read int lenToCopy = (int) (checksumSize - (currentOffset - dataLength)); if (len < lenToCopy) { lenToCopy = len; } System.arraycopy(csum, (int) (currentOffset - dataLength), b, off, lenToCopy); currentOffset += lenToCopy; return lenToCopy; } int bytesRead = doRead(b,off,len); if (currentOffset == dataLength) { if (len >= bytesRead + checksumSize) { System.arraycopy(csum, 0, b, off + bytesRead, checksumSize); bytesRead += checksumSize; currentOffset += checksumSize; } } return bytesRead; }
java
public int readWithChecksum(byte[] b, int off, int len) throws IOException { if (currentOffset == length) { return -1; } else if (currentOffset >= dataLength) { // If the previous read drained off all the data, then just return // the checksum now. Note that checksum validation would have // happened in the earlier read int lenToCopy = (int) (checksumSize - (currentOffset - dataLength)); if (len < lenToCopy) { lenToCopy = len; } System.arraycopy(csum, (int) (currentOffset - dataLength), b, off, lenToCopy); currentOffset += lenToCopy; return lenToCopy; } int bytesRead = doRead(b,off,len); if (currentOffset == dataLength) { if (len >= bytesRead + checksumSize) { System.arraycopy(csum, 0, b, off + bytesRead, checksumSize); bytesRead += checksumSize; currentOffset += checksumSize; } } return bytesRead; }
[ "public", "int", "readWithChecksum", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "if", "(", "currentOffset", "==", "length", ")", "{", "return", "-", "1", ";", "}", "else", "if", "(", "currentOffset", ">=", "dataLength", ")", "{", "// If the previous read drained off all the data, then just return", "// the checksum now. Note that checksum validation would have ", "// happened in the earlier read", "int", "lenToCopy", "=", "(", "int", ")", "(", "checksumSize", "-", "(", "currentOffset", "-", "dataLength", ")", ")", ";", "if", "(", "len", "<", "lenToCopy", ")", "{", "lenToCopy", "=", "len", ";", "}", "System", ".", "arraycopy", "(", "csum", ",", "(", "int", ")", "(", "currentOffset", "-", "dataLength", ")", ",", "b", ",", "off", ",", "lenToCopy", ")", ";", "currentOffset", "+=", "lenToCopy", ";", "return", "lenToCopy", ";", "}", "int", "bytesRead", "=", "doRead", "(", "b", ",", "off", ",", "len", ")", ";", "if", "(", "currentOffset", "==", "dataLength", ")", "{", "if", "(", "len", ">=", "bytesRead", "+", "checksumSize", ")", "{", "System", ".", "arraycopy", "(", "csum", ",", "0", ",", "b", ",", "off", "+", "bytesRead", ",", "checksumSize", ")", ";", "bytesRead", "+=", "checksumSize", ";", "currentOffset", "+=", "checksumSize", ";", "}", "}", "return", "bytesRead", ";", "}" ]
Read bytes from the stream. At EOF, checksum is validated and sent back as the last four bytes of the buffer. The caller should handle these bytes appropriately
[ "Read", "bytes", "from", "the", "stream", ".", "At", "EOF", "checksum", "is", "validated", "and", "sent", "back", "as", "the", "last", "four", "bytes", "of", "the", "buffer", ".", "The", "caller", "should", "handle", "these", "bytes", "appropriately" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/IFileInputStream.java#L111-L140
super-csv/super-csv
super-csv-joda/src/main/java/org/supercsv/cellprocessor/joda/FmtDateTimeZone.java
FmtDateTimeZone.execute
public Object execute(final Object value, final CsvContext context) { """ {@inheritDoc} @throws SuperCsvCellProcessorException if value is null or not a DateTimeZone """ validateInputNotNull(value, context); if (!(value instanceof DateTimeZone)) { throw new SuperCsvCellProcessorException(DateTimeZone.class, value, context, this); } final DateTimeZone dateTimeZone = (DateTimeZone) value; final String result = dateTimeZone.toString(); return next.execute(result, context); }
java
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if (!(value instanceof DateTimeZone)) { throw new SuperCsvCellProcessorException(DateTimeZone.class, value, context, this); } final DateTimeZone dateTimeZone = (DateTimeZone) value; final String result = dateTimeZone.toString(); return next.execute(result, context); }
[ "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "validateInputNotNull", "(", "value", ",", "context", ")", ";", "if", "(", "!", "(", "value", "instanceof", "DateTimeZone", ")", ")", "{", "throw", "new", "SuperCsvCellProcessorException", "(", "DateTimeZone", ".", "class", ",", "value", ",", "context", ",", "this", ")", ";", "}", "final", "DateTimeZone", "dateTimeZone", "=", "(", "DateTimeZone", ")", "value", ";", "final", "String", "result", "=", "dateTimeZone", ".", "toString", "(", ")", ";", "return", "next", ".", "execute", "(", "result", ",", "context", ")", ";", "}" ]
{@inheritDoc} @throws SuperCsvCellProcessorException if value is null or not a DateTimeZone
[ "{", "@inheritDoc", "}" ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv-joda/src/main/java/org/supercsv/cellprocessor/joda/FmtDateTimeZone.java#L59-L68
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java
CNDStreamWriter.listToString
private String listToString(String[] list, String quote, String beforeString, String afterString) { """ Converts String[] to String using given notation: "beforeString+quote+element+quote+', '+quote+element...+quote+afterString" @param list Array to print @param quote Quote string for each element of array @param beforeString starting string @param afterString ending string @return """ StringBuilder result = new StringBuilder(); if (list != null && list.length > 0) { result.append(beforeString); result.append(quote + list[0] + quote); for (int i = 1; i < list.length; i++) { result.append(", " + quote + list[i] + quote); } result.append(afterString); } return result.toString(); }
java
private String listToString(String[] list, String quote, String beforeString, String afterString) { StringBuilder result = new StringBuilder(); if (list != null && list.length > 0) { result.append(beforeString); result.append(quote + list[0] + quote); for (int i = 1; i < list.length; i++) { result.append(", " + quote + list[i] + quote); } result.append(afterString); } return result.toString(); }
[ "private", "String", "listToString", "(", "String", "[", "]", "list", ",", "String", "quote", ",", "String", "beforeString", ",", "String", "afterString", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "list", "!=", "null", "&&", "list", ".", "length", ">", "0", ")", "{", "result", ".", "append", "(", "beforeString", ")", ";", "result", ".", "append", "(", "quote", "+", "list", "[", "0", "]", "+", "quote", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "list", ".", "length", ";", "i", "++", ")", "{", "result", ".", "append", "(", "\", \"", "+", "quote", "+", "list", "[", "i", "]", "+", "quote", ")", ";", "}", "result", ".", "append", "(", "afterString", ")", ";", "}", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Converts String[] to String using given notation: "beforeString+quote+element+quote+', '+quote+element...+quote+afterString" @param list Array to print @param quote Quote string for each element of array @param beforeString starting string @param afterString ending string @return
[ "Converts", "String", "[]", "to", "String", "using", "given", "notation", ":", "beforeString", "+", "quote", "+", "element", "+", "quote", "+", "+", "quote", "+", "element", "...", "+", "quote", "+", "afterString" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/CNDStreamWriter.java#L408-L424
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/PartitionLevelWatermarker.java
PartitionLevelWatermarker.onTableProcessBegin
@Override public void onTableProcessBegin(Table table, long tableProcessTime) { """ Initializes the expected high watermarks for a {@link Table} {@inheritDoc} @see org.apache.gobblin.data.management.conversion.hive.watermarker.HiveSourceWatermarker#onTableProcessBegin(org.apache.hadoop.hive.ql.metadata.Table, long) """ Preconditions.checkNotNull(table); if (!this.expectedHighWatermarks.hasPartitionWatermarks(tableKey(table))) { this.expectedHighWatermarks.setPartitionWatermarks(tableKey(table), Maps.<String, Long> newHashMap()); } }
java
@Override public void onTableProcessBegin(Table table, long tableProcessTime) { Preconditions.checkNotNull(table); if (!this.expectedHighWatermarks.hasPartitionWatermarks(tableKey(table))) { this.expectedHighWatermarks.setPartitionWatermarks(tableKey(table), Maps.<String, Long> newHashMap()); } }
[ "@", "Override", "public", "void", "onTableProcessBegin", "(", "Table", "table", ",", "long", "tableProcessTime", ")", "{", "Preconditions", ".", "checkNotNull", "(", "table", ")", ";", "if", "(", "!", "this", ".", "expectedHighWatermarks", ".", "hasPartitionWatermarks", "(", "tableKey", "(", "table", ")", ")", ")", "{", "this", ".", "expectedHighWatermarks", ".", "setPartitionWatermarks", "(", "tableKey", "(", "table", ")", ",", "Maps", ".", "<", "String", ",", "Long", ">", "newHashMap", "(", ")", ")", ";", "}", "}" ]
Initializes the expected high watermarks for a {@link Table} {@inheritDoc} @see org.apache.gobblin.data.management.conversion.hive.watermarker.HiveSourceWatermarker#onTableProcessBegin(org.apache.hadoop.hive.ql.metadata.Table, long)
[ "Initializes", "the", "expected", "high", "watermarks", "for", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/watermarker/PartitionLevelWatermarker.java#L211-L219
albfernandez/itext2
src/main/java/com/lowagie/text/Image.java
Image.getInstance
public static Image getInstance(PRIndirectReference ref) throws BadElementException { """ Reuses an existing image. @param ref the reference to the image dictionary @throws BadElementException on error @return the image """ PdfDictionary dic = (PdfDictionary)PdfReader.getPdfObjectRelease(ref); int width = ((PdfNumber)PdfReader.getPdfObjectRelease(dic.get(PdfName.WIDTH))).intValue(); int height = ((PdfNumber)PdfReader.getPdfObjectRelease(dic.get(PdfName.HEIGHT))).intValue(); Image imask = null; PdfObject obj = dic.get(PdfName.SMASK); if (obj != null && obj.isIndirect()) { imask = getInstance((PRIndirectReference)obj); } else { obj = dic.get(PdfName.MASK); if (obj != null && obj.isIndirect()) { PdfObject obj2 = PdfReader.getPdfObjectRelease(obj); if (obj2 instanceof PdfDictionary) imask = getInstance((PRIndirectReference)obj); } } Image img = new ImgRaw(width, height, 1, 1, null); img.imageMask = imask; img.directReference = ref; return img; }
java
public static Image getInstance(PRIndirectReference ref) throws BadElementException { PdfDictionary dic = (PdfDictionary)PdfReader.getPdfObjectRelease(ref); int width = ((PdfNumber)PdfReader.getPdfObjectRelease(dic.get(PdfName.WIDTH))).intValue(); int height = ((PdfNumber)PdfReader.getPdfObjectRelease(dic.get(PdfName.HEIGHT))).intValue(); Image imask = null; PdfObject obj = dic.get(PdfName.SMASK); if (obj != null && obj.isIndirect()) { imask = getInstance((PRIndirectReference)obj); } else { obj = dic.get(PdfName.MASK); if (obj != null && obj.isIndirect()) { PdfObject obj2 = PdfReader.getPdfObjectRelease(obj); if (obj2 instanceof PdfDictionary) imask = getInstance((PRIndirectReference)obj); } } Image img = new ImgRaw(width, height, 1, 1, null); img.imageMask = imask; img.directReference = ref; return img; }
[ "public", "static", "Image", "getInstance", "(", "PRIndirectReference", "ref", ")", "throws", "BadElementException", "{", "PdfDictionary", "dic", "=", "(", "PdfDictionary", ")", "PdfReader", ".", "getPdfObjectRelease", "(", "ref", ")", ";", "int", "width", "=", "(", "(", "PdfNumber", ")", "PdfReader", ".", "getPdfObjectRelease", "(", "dic", ".", "get", "(", "PdfName", ".", "WIDTH", ")", ")", ")", ".", "intValue", "(", ")", ";", "int", "height", "=", "(", "(", "PdfNumber", ")", "PdfReader", ".", "getPdfObjectRelease", "(", "dic", ".", "get", "(", "PdfName", ".", "HEIGHT", ")", ")", ")", ".", "intValue", "(", ")", ";", "Image", "imask", "=", "null", ";", "PdfObject", "obj", "=", "dic", ".", "get", "(", "PdfName", ".", "SMASK", ")", ";", "if", "(", "obj", "!=", "null", "&&", "obj", ".", "isIndirect", "(", ")", ")", "{", "imask", "=", "getInstance", "(", "(", "PRIndirectReference", ")", "obj", ")", ";", "}", "else", "{", "obj", "=", "dic", ".", "get", "(", "PdfName", ".", "MASK", ")", ";", "if", "(", "obj", "!=", "null", "&&", "obj", ".", "isIndirect", "(", ")", ")", "{", "PdfObject", "obj2", "=", "PdfReader", ".", "getPdfObjectRelease", "(", "obj", ")", ";", "if", "(", "obj2", "instanceof", "PdfDictionary", ")", "imask", "=", "getInstance", "(", "(", "PRIndirectReference", ")", "obj", ")", ";", "}", "}", "Image", "img", "=", "new", "ImgRaw", "(", "width", ",", "height", ",", "1", ",", "1", ",", "null", ")", ";", "img", ".", "imageMask", "=", "imask", ";", "img", ".", "directReference", "=", "ref", ";", "return", "img", ";", "}" ]
Reuses an existing image. @param ref the reference to the image dictionary @throws BadElementException on error @return the image
[ "Reuses", "an", "existing", "image", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Image.java#L882-L903
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/couponsets/AssignedDiscountUrl.java
AssignedDiscountUrl.unAssignDiscountUrl
public static MozuUrl unAssignDiscountUrl(String couponSetCode, Integer discountId) { """ Get Resource Url for UnAssignDiscount @param couponSetCode The unique identifier of the coupon set. @param discountId discountId parameter description DOCUMENT_HERE @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/couponsets/{couponSetCode}/assigneddiscounts/{discountId}"); formatter.formatUrl("couponSetCode", couponSetCode); formatter.formatUrl("discountId", discountId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl unAssignDiscountUrl(String couponSetCode, Integer discountId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/couponsets/{couponSetCode}/assigneddiscounts/{discountId}"); formatter.formatUrl("couponSetCode", couponSetCode); formatter.formatUrl("discountId", discountId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "unAssignDiscountUrl", "(", "String", "couponSetCode", ",", "Integer", "discountId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/couponsets/{couponSetCode}/assigneddiscounts/{discountId}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"couponSetCode\"", ",", "couponSetCode", ")", ";", "formatter", ".", "formatUrl", "(", "\"discountId\"", ",", "discountId", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for UnAssignDiscount @param couponSetCode The unique identifier of the coupon set. @param discountId discountId parameter description DOCUMENT_HERE @return String Resource Url
[ "Get", "Resource", "Url", "for", "UnAssignDiscount" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/couponsets/AssignedDiscountUrl.java#L46-L52
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/version/internal/DefaultVersionConstraint.java
DefaultVersionConstraint.mergeRanges
private DefaultVersionConstraint mergeRanges(VersionConstraint otherConstraint) throws IncompatibleVersionConstraintException { """ Create a new {@link DefaultVersionConstraint} instance which is the combination of the provided version ranges and this version ranges. @param otherRanges the version ranges to merge with this version ranges @return the new {@link DefaultVersionConstraint} @throws IncompatibleVersionConstraintException the provided version and version ranges are not compatible with this version constraint """ Collection<VersionRangeCollection> resolvedRanges = resolveRanges(this); Collection<VersionRangeCollection> otherResolvedRanges = resolveRanges(otherConstraint); return mergeRanges(resolvedRanges, otherResolvedRanges); }
java
private DefaultVersionConstraint mergeRanges(VersionConstraint otherConstraint) throws IncompatibleVersionConstraintException { Collection<VersionRangeCollection> resolvedRanges = resolveRanges(this); Collection<VersionRangeCollection> otherResolvedRanges = resolveRanges(otherConstraint); return mergeRanges(resolvedRanges, otherResolvedRanges); }
[ "private", "DefaultVersionConstraint", "mergeRanges", "(", "VersionConstraint", "otherConstraint", ")", "throws", "IncompatibleVersionConstraintException", "{", "Collection", "<", "VersionRangeCollection", ">", "resolvedRanges", "=", "resolveRanges", "(", "this", ")", ";", "Collection", "<", "VersionRangeCollection", ">", "otherResolvedRanges", "=", "resolveRanges", "(", "otherConstraint", ")", ";", "return", "mergeRanges", "(", "resolvedRanges", ",", "otherResolvedRanges", ")", ";", "}" ]
Create a new {@link DefaultVersionConstraint} instance which is the combination of the provided version ranges and this version ranges. @param otherRanges the version ranges to merge with this version ranges @return the new {@link DefaultVersionConstraint} @throws IncompatibleVersionConstraintException the provided version and version ranges are not compatible with this version constraint
[ "Create", "a", "new", "{", "@link", "DefaultVersionConstraint", "}", "instance", "which", "is", "the", "combination", "of", "the", "provided", "version", "ranges", "and", "this", "version", "ranges", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/version/internal/DefaultVersionConstraint.java#L311-L318