repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java
CommerceTierPriceEntryPersistenceImpl.findAll
@Override public List<CommerceTierPriceEntry> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceTierPriceEntry> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceTierPriceEntry", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce tier price entries. @return the commerce tier price entries
[ "Returns", "all", "the", "commerce", "tier", "price", "entries", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java#L4839-L4842
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.isInstanceOf
@GwtIncompatible("incompatible method") public static void isInstanceOf(final Class<?> type, final Object obj, final String message, final Object... values) { // TODO when breaking BC, consider returning obj if (!type.isInstance(obj)) { throw new IllegalArgumentException(StringUtils.simpleFormat(message, values)); } }
java
@GwtIncompatible("incompatible method") public static void isInstanceOf(final Class<?> type, final Object obj, final String message, final Object... values) { // TODO when breaking BC, consider returning obj if (!type.isInstance(obj)) { throw new IllegalArgumentException(StringUtils.simpleFormat(message, values)); } }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "void", "isInstanceOf", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Object", "obj", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ...
<p>Validate that the argument is an instance of the specified class; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary class</p> <pre>Validate.isInstanceOf(OkClass.class, object, "Wrong class, object is of class %s", object.getClass().getName());</pre> @param type the class the object must be validated against, not null @param obj the object to check, null throws an exception @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @throws IllegalArgumentException if argument is not of specified class @see #isInstanceOf(Class, Object) @since 3.0
[ "<p", ">", "Validate", "that", "the", "argument", "is", "an", "instance", "of", "the", "specified", "class", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", ".", "This", "method", "is", "useful", "when", "validating", ...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L1292-L1298
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.createOrUpdateById
public GenericResourceInner createOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { return createOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().last().body(); }
java
public GenericResourceInner createOrUpdateById(String resourceId, String apiVersion, GenericResourceInner parameters) { return createOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).toBlocking().last().body(); }
[ "public", "GenericResourceInner", "createOrUpdateById", "(", "String", "resourceId", ",", "String", "apiVersion", ",", "GenericResourceInner", "parameters", ")", "{", "return", "createOrUpdateByIdWithServiceResponseAsync", "(", "resourceId", ",", "apiVersion", ",", "paramet...
Create a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @param parameters Create or update resource parameters. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the GenericResourceInner object if successful.
[ "Create", "a", "resource", "by", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L2070-L2072
Netflix/servo
servo-graphite/src/main/java/com/netflix/servo/publish/graphite/GraphiteMetricObserver.java
GraphiteMetricObserver.checkNoReturnedData
private void checkNoReturnedData(Socket socket) throws IOException { BufferedInputStream reader = new BufferedInputStream(socket.getInputStream()); if (reader.available() > 0) { byte[] buffer = new byte[1000]; int toRead = Math.min(reader.available(), 1000); int read = reader.read(buffer, 0, toRead); if (read > 0) { LOGGER.warn("Data returned by graphite server when expecting no response! " + "Probably aimed at wrong socket or server. Make sure you " + "are publishing to the data port, not the dashboard port. " + "First {} bytes of response: {}", read, new String(buffer, 0, read, "UTF-8")); } } }
java
private void checkNoReturnedData(Socket socket) throws IOException { BufferedInputStream reader = new BufferedInputStream(socket.getInputStream()); if (reader.available() > 0) { byte[] buffer = new byte[1000]; int toRead = Math.min(reader.available(), 1000); int read = reader.read(buffer, 0, toRead); if (read > 0) { LOGGER.warn("Data returned by graphite server when expecting no response! " + "Probably aimed at wrong socket or server. Make sure you " + "are publishing to the data port, not the dashboard port. " + "First {} bytes of response: {}", read, new String(buffer, 0, read, "UTF-8")); } } }
[ "private", "void", "checkNoReturnedData", "(", "Socket", "socket", ")", "throws", "IOException", "{", "BufferedInputStream", "reader", "=", "new", "BufferedInputStream", "(", "socket", ".", "getInputStream", "(", ")", ")", ";", "if", "(", "reader", ".", "availab...
the graphite protocol is a "one-way" streaming protocol and as such there is no easy way to check that we are sending the output to the wrong place. We can aim the graphite writer at any listening socket and it will never care if the data is being correctly handled. By logging any returned bytes we can help make it obvious that it's talking to the wrong server/socket. In particular if its aimed at the web port of a graphite server this will make it print out the HTTP error message.
[ "the", "graphite", "protocol", "is", "a", "one", "-", "way", "streaming", "protocol", "and", "as", "such", "there", "is", "no", "easy", "way", "to", "check", "that", "we", "are", "sending", "the", "output", "to", "the", "wrong", "place", ".", "We", "ca...
train
https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-graphite/src/main/java/com/netflix/servo/publish/graphite/GraphiteMetricObserver.java#L167-L182
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java
Effects.fadeTo
public Effects fadeTo(double opacity, Function... f) { return fadeTo(Speed.DEFAULT, opacity, f); }
java
public Effects fadeTo(double opacity, Function... f) { return fadeTo(Speed.DEFAULT, opacity, f); }
[ "public", "Effects", "fadeTo", "(", "double", "opacity", ",", "Function", "...", "f", ")", "{", "return", "fadeTo", "(", "Speed", ".", "DEFAULT", ",", "opacity", ",", "f", ")", ";", "}" ]
Fade the opacity of all matched elements to a specified opacity and firing an optional callback after completion. Only the opacity is adjusted for this animation, meaning that all of the matched elements should already have some form of height and width associated with them.
[ "Fade", "the", "opacity", "of", "all", "matched", "elements", "to", "a", "specified", "opacity", "and", "firing", "an", "optional", "callback", "after", "completion", ".", "Only", "the", "opacity", "is", "adjusted", "for", "this", "animation", "meaning", "that...
train
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/Effects.java#L495-L497
google/closure-templates
java/src/com/google/template/soy/sharedpasses/render/RenderVisitor.java
RenderVisitor.renderTemplate
private void renderTemplate(TemplateNode template, Predicate<String> paramsToTypeCheck) { env = Environment.create(template, data, ijData); checkStrictParamTypes(template, paramsToTypeCheck); visitChildren(template); env = null; // unpin for gc }
java
private void renderTemplate(TemplateNode template, Predicate<String> paramsToTypeCheck) { env = Environment.create(template, data, ijData); checkStrictParamTypes(template, paramsToTypeCheck); visitChildren(template); env = null; // unpin for gc }
[ "private", "void", "renderTemplate", "(", "TemplateNode", "template", ",", "Predicate", "<", "String", ">", "paramsToTypeCheck", ")", "{", "env", "=", "Environment", ".", "create", "(", "template", ",", "data", ",", "ijData", ")", ";", "checkStrictParamTypes", ...
A private helper to render templates with optimized type checking.
[ "A", "private", "helper", "to", "render", "templates", "with", "optimized", "type", "checking", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/render/RenderVisitor.java#L264-L269
linkedin/dexmaker
dexmaker/src/main/java/com/android/dx/Code.java
Code.iput
public <D, V> void iput(FieldId<D, V> fieldId, Local<? extends D> instance, Local<? extends V> source) { addInstruction(new ThrowingCstInsn(Rops.opPutField(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec(), instance.spec()), catches, fieldId.constant)); }
java
public <D, V> void iput(FieldId<D, V> fieldId, Local<? extends D> instance, Local<? extends V> source) { addInstruction(new ThrowingCstInsn(Rops.opPutField(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec(), instance.spec()), catches, fieldId.constant)); }
[ "public", "<", "D", ",", "V", ">", "void", "iput", "(", "FieldId", "<", "D", ",", "V", ">", "fieldId", ",", "Local", "<", "?", "extends", "D", ">", "instance", ",", "Local", "<", "?", "extends", "V", ">", "source", ")", "{", "addInstruction", "("...
Copies the value in {@code source} to the instance field {@code fieldId} of {@code instance}.
[ "Copies", "the", "value", "in", "{" ]
train
https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L600-L603
apache/incubator-gobblin
gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java
State.appendToSetProp
public synchronized void appendToSetProp(String key, String value) { Set<String> set = value == null ? Sets.<String>newHashSet() : Sets.newHashSet(LIST_SPLITTER.splitToList(value)); if (contains(key)) { set.addAll(getPropAsSet(key)); } setProp(key, LIST_JOINER.join(set)); }
java
public synchronized void appendToSetProp(String key, String value) { Set<String> set = value == null ? Sets.<String>newHashSet() : Sets.newHashSet(LIST_SPLITTER.splitToList(value)); if (contains(key)) { set.addAll(getPropAsSet(key)); } setProp(key, LIST_JOINER.join(set)); }
[ "public", "synchronized", "void", "appendToSetProp", "(", "String", "key", ",", "String", "value", ")", "{", "Set", "<", "String", ">", "set", "=", "value", "==", "null", "?", "Sets", ".", "<", "String", ">", "newHashSet", "(", ")", ":", "Sets", ".", ...
Appends the input value to a set property that can be retrieved with {@link #getPropAsSet}. <p> Set properties are internally stored as comma separated strings. Adding a value that contains commas (for example "a,b,c") will essentially add multiple values to the property ("a", "b", and "c"). This is similar to the way that {@link org.apache.hadoop.conf.Configuration} works. </p> @param key property key @param value property value (if it includes commas, it will be split by the commas).
[ "Appends", "the", "input", "value", "to", "a", "set", "property", "that", "can", "be", "retrieved", "with", "{", "@link", "#getPropAsSet", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java#L248-L254
pravega/pravega
common/src/main/java/io/pravega/common/tracing/RequestTracker.java
RequestTracker.trackRequest
public void trackRequest(String requestDescriptor, long requestId) { Preconditions.checkNotNull(requestDescriptor, "Attempting to track a null request descriptor."); if (!tracingEnabled) { return; } synchronized (lock) { List<Long> requestIds = ongoingRequests.getIfPresent(requestDescriptor); if (requestIds == null) { requestIds = Collections.synchronizedList(new ArrayList<>()); } requestIds.add(requestId); ongoingRequests.put(requestDescriptor, requestIds); } log.debug("Tracking request {} with id {}.", requestDescriptor, requestId); }
java
public void trackRequest(String requestDescriptor, long requestId) { Preconditions.checkNotNull(requestDescriptor, "Attempting to track a null request descriptor."); if (!tracingEnabled) { return; } synchronized (lock) { List<Long> requestIds = ongoingRequests.getIfPresent(requestDescriptor); if (requestIds == null) { requestIds = Collections.synchronizedList(new ArrayList<>()); } requestIds.add(requestId); ongoingRequests.put(requestDescriptor, requestIds); } log.debug("Tracking request {} with id {}.", requestDescriptor, requestId); }
[ "public", "void", "trackRequest", "(", "String", "requestDescriptor", ",", "long", "requestId", ")", "{", "Preconditions", ".", "checkNotNull", "(", "requestDescriptor", ",", "\"Attempting to track a null request descriptor.\"", ")", ";", "if", "(", "!", "tracingEnabled...
Adds a request descriptor and request id pair in the cache if tracing is enabled. In the case of tracking a request with an existing descriptor, this method adds the request id to the list associated to the descriptor. @param requestDescriptor Request descriptor as a single string. @param requestId Request id associated to the given descriptor.
[ "Adds", "a", "request", "descriptor", "and", "request", "id", "pair", "in", "the", "cache", "if", "tracing", "is", "enabled", ".", "In", "the", "case", "of", "tracking", "a", "request", "with", "an", "existing", "descriptor", "this", "method", "adds", "the...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/tracing/RequestTracker.java#L154-L171
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java
BNFHeadersImpl.parseTokenExtract
protected TokenCodes parseTokenExtract(WsByteBuffer buff, byte bDelimiter, boolean bApproveCRLF, int log) throws MalformedMessageException { // if we're just starting, then skip leading white space characters // otherwise ignore them (i.e we might be in the middle of // "Mozilla/5.0 (Win" if (null == this.parsedToken) { if (!skipWhiteSpace(buff)) { return TokenCodes.TOKEN_RC_MOREDATA; } } int start = findCurrentBufferPosition(buff); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "parseTokenExtract: start:" + start + " lim:" + this.byteLimit + " pos:" + this.bytePosition); } TokenCodes rc = findTokenLength(buff, bDelimiter, bApproveCRLF); // 273923: need to account for stopping on the delimiter or stopping on // a CRLF when those are acceptable saveParsedToken(buff, start, !TokenCodes.TOKEN_RC_MOREDATA.equals(rc), log); return rc; }
java
protected TokenCodes parseTokenExtract(WsByteBuffer buff, byte bDelimiter, boolean bApproveCRLF, int log) throws MalformedMessageException { // if we're just starting, then skip leading white space characters // otherwise ignore them (i.e we might be in the middle of // "Mozilla/5.0 (Win" if (null == this.parsedToken) { if (!skipWhiteSpace(buff)) { return TokenCodes.TOKEN_RC_MOREDATA; } } int start = findCurrentBufferPosition(buff); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "parseTokenExtract: start:" + start + " lim:" + this.byteLimit + " pos:" + this.bytePosition); } TokenCodes rc = findTokenLength(buff, bDelimiter, bApproveCRLF); // 273923: need to account for stopping on the delimiter or stopping on // a CRLF when those are acceptable saveParsedToken(buff, start, !TokenCodes.TOKEN_RC_MOREDATA.equals(rc), log); return rc; }
[ "protected", "TokenCodes", "parseTokenExtract", "(", "WsByteBuffer", "buff", ",", "byte", "bDelimiter", ",", "boolean", "bApproveCRLF", ",", "int", "log", ")", "throws", "MalformedMessageException", "{", "// if we're just starting, then skip leading white space characters", "...
Method for parsing a token from a given WSBB. This will stop when the byte delimeter is reached, or when a CRLF is found. If it sees the CRLF, then it checks the boolean input on whether CRLF is valid and will throw an exception if it's not valid. <p> Returns a TOKEN_RC code as to whether a CRLF or delimiter was reached, or MOREDATA if no delimiter was found and more data needs to be read. @param buff @param bDelimiter @param bApproveCRLF @param log - control how much of the token to debug log @return TokenCodes @throws MalformedMessageException
[ "Method", "for", "parsing", "a", "token", "from", "a", "given", "WSBB", ".", "This", "will", "stop", "when", "the", "byte", "delimeter", "is", "reached", "or", "when", "a", "CRLF", "is", "found", ".", "If", "it", "sees", "the", "CRLF", "then", "it", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/BNFHeadersImpl.java#L3882-L3903
litsec/swedish-eid-shibboleth-base
shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/controller/AbstractExternalAuthenticationController.java
AbstractExternalAuthenticationController.getBinding
protected String getBinding(ProfileRequestContext<?, ?> context) { SAMLBindingContext samlBinding = this.samlBindingContextLookupStrategy.apply(context); return samlBinding != null ? samlBinding.getBindingUri() : null; }
java
protected String getBinding(ProfileRequestContext<?, ?> context) { SAMLBindingContext samlBinding = this.samlBindingContextLookupStrategy.apply(context); return samlBinding != null ? samlBinding.getBindingUri() : null; }
[ "protected", "String", "getBinding", "(", "ProfileRequestContext", "<", "?", ",", "?", ">", "context", ")", "{", "SAMLBindingContext", "samlBinding", "=", "this", ".", "samlBindingContextLookupStrategy", ".", "apply", "(", "context", ")", ";", "return", "samlBindi...
Utility method that may be used to obtain the binding that was used to pass the AuthnRequest message. @param context the profile context @return the binding URI @see #getBinding(HttpServletRequest)
[ "Utility", "method", "that", "may", "be", "used", "to", "obtain", "the", "binding", "that", "was", "used", "to", "pass", "the", "AuthnRequest", "message", "." ]
train
https://github.com/litsec/swedish-eid-shibboleth-base/blob/aaaa467ff61f07d7dfa31627fb36851a37da6804/shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/controller/AbstractExternalAuthenticationController.java#L617-L620
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_firewall_binary_link_GET
public OvhBinaryFirewallLink serviceName_firewall_binary_link_GET(String serviceName, String binaryName) throws IOException { String qPath = "/dedicated/server/{serviceName}/firewall/binary/link"; StringBuilder sb = path(qPath, serviceName); query(sb, "binaryName", binaryName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBinaryFirewallLink.class); }
java
public OvhBinaryFirewallLink serviceName_firewall_binary_link_GET(String serviceName, String binaryName) throws IOException { String qPath = "/dedicated/server/{serviceName}/firewall/binary/link"; StringBuilder sb = path(qPath, serviceName); query(sb, "binaryName", binaryName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBinaryFirewallLink.class); }
[ "public", "OvhBinaryFirewallLink", "serviceName_firewall_binary_link_GET", "(", "String", "serviceName", ",", "String", "binaryName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/firewall/binary/link\"", ";", "StringBuilder", "sb...
Get url of binary to update firewall asa REST: GET /dedicated/server/{serviceName}/firewall/binary/link @param binaryName [required] Binary name @param serviceName [required] The internal name of your dedicated server API beta
[ "Get", "url", "of", "binary", "to", "update", "firewall", "asa" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1905-L1911
kiswanij/jk-util
src/main/java/com/jk/util/JKHttpUtil.java
JKHttpUtil.downloadFileToTemp
public static File downloadFileToTemp(final String fileUrl, final String ext) throws IOException { final File file = File.createTempFile("jk-", ext); JKHttpUtil.downloadFile(fileUrl, file.getAbsolutePath()); return file; }
java
public static File downloadFileToTemp(final String fileUrl, final String ext) throws IOException { final File file = File.createTempFile("jk-", ext); JKHttpUtil.downloadFile(fileUrl, file.getAbsolutePath()); return file; }
[ "public", "static", "File", "downloadFileToTemp", "(", "final", "String", "fileUrl", ",", "final", "String", "ext", ")", "throws", "IOException", "{", "final", "File", "file", "=", "File", ".", "createTempFile", "(", "\"jk-\"", ",", "ext", ")", ";", "JKHttpU...
Download file to temp. @param fileUrl the file url @param ext the ext @return the file @throws IOException Signals that an I/O exception has occurred.
[ "Download", "file", "to", "temp", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKHttpUtil.java#L83-L87
jparsec/jparsec
jparsec/src/main/java/org/jparsec/pattern/Patterns.java
Patterns.stringCaseInsensitive
public static Pattern stringCaseInsensitive(final String string) { return new Pattern() { @Override public int match(CharSequence src, int begin, int end) { return matchStringCaseInsensitive(string, src, begin, end); } @Override public String toString() { return string.toUpperCase(); } }; }
java
public static Pattern stringCaseInsensitive(final String string) { return new Pattern() { @Override public int match(CharSequence src, int begin, int end) { return matchStringCaseInsensitive(string, src, begin, end); } @Override public String toString() { return string.toUpperCase(); } }; }
[ "public", "static", "Pattern", "stringCaseInsensitive", "(", "final", "String", "string", ")", "{", "return", "new", "Pattern", "(", ")", "{", "@", "Override", "public", "int", "match", "(", "CharSequence", "src", ",", "int", "begin", ",", "int", "end", ")...
Returns a {@link Pattern} object that matches {@code string} case insensitively.
[ "Returns", "a", "{" ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/pattern/Patterns.java#L226-L235
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Searcher.java
Searcher.searchFor
public <T extends TextView> T searchFor(final Class<T> viewClass, final String regex, int expectedMinimumNumberOfMatches, final long timeout, final boolean scroll, final boolean onlyVisible) { if(expectedMinimumNumberOfMatches < 1) { expectedMinimumNumberOfMatches = 1; } final Callable<Collection<T>> viewFetcherCallback = new Callable<Collection<T>>() { @SuppressWarnings("unchecked") public Collection<T> call() throws Exception { sleeper.sleep(); ArrayList<T> viewsToReturn = viewFetcher.getCurrentViews(viewClass, true); if(onlyVisible){ viewsToReturn = RobotiumUtils.removeInvisibleViews(viewsToReturn); } if(viewClass.isAssignableFrom(TextView.class)) { viewsToReturn.addAll((Collection<? extends T>) webUtils.getTextViewsFromWebView()); } return viewsToReturn; } }; try { return searchFor(viewFetcherCallback, regex, expectedMinimumNumberOfMatches, timeout, scroll); } catch (Exception e) { throw new RuntimeException(e); } }
java
public <T extends TextView> T searchFor(final Class<T> viewClass, final String regex, int expectedMinimumNumberOfMatches, final long timeout, final boolean scroll, final boolean onlyVisible) { if(expectedMinimumNumberOfMatches < 1) { expectedMinimumNumberOfMatches = 1; } final Callable<Collection<T>> viewFetcherCallback = new Callable<Collection<T>>() { @SuppressWarnings("unchecked") public Collection<T> call() throws Exception { sleeper.sleep(); ArrayList<T> viewsToReturn = viewFetcher.getCurrentViews(viewClass, true); if(onlyVisible){ viewsToReturn = RobotiumUtils.removeInvisibleViews(viewsToReturn); } if(viewClass.isAssignableFrom(TextView.class)) { viewsToReturn.addAll((Collection<? extends T>) webUtils.getTextViewsFromWebView()); } return viewsToReturn; } }; try { return searchFor(viewFetcherCallback, regex, expectedMinimumNumberOfMatches, timeout, scroll); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "<", "T", "extends", "TextView", ">", "T", "searchFor", "(", "final", "Class", "<", "T", ">", "viewClass", ",", "final", "String", "regex", ",", "int", "expectedMinimumNumberOfMatches", ",", "final", "long", "timeout", ",", "final", "boolean", "scr...
Searches for a {@code View} with the given regex string and returns {@code true} if the searched {@code View} is found a given number of times. @param viewClass what kind of {@code View} to search for, e.g. {@code Button.class} or {@code TextView.class} @param regex the text to search for. The parameter <strong>will</strong> be interpreted as a regular expression. @param expectedMinimumNumberOfMatches the minimum number of matches expected to be found. {@code 0} matches means that one or more matches are expected to be found. @param timeout the amount of time in milliseconds to wait @param scroll whether scrolling should be performed @param onlyVisible {@code true} if only texts visible on the screen should be searched @return {@code true} if a view of the specified class with the given text is found a given number of times. {@code false} if it is not found.
[ "Searches", "for", "a", "{", "@code", "View", "}", "with", "the", "given", "regex", "string", "and", "returns", "{", "@code", "true", "}", "if", "the", "searched", "{", "@code", "View", "}", "is", "found", "a", "given", "number", "of", "times", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Searcher.java#L102-L130
aerogear/aerogear-unifiedpush-server
push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/jms/AbstractJMSMessageProducer.java
AbstractJMSMessageProducer.sendTransacted
protected void sendTransacted(Destination destination, Serializable message) { send(destination, message, null, null, true); }
java
protected void sendTransacted(Destination destination, Serializable message) { send(destination, message, null, null, true); }
[ "protected", "void", "sendTransacted", "(", "Destination", "destination", ",", "Serializable", "message", ")", "{", "send", "(", "destination", ",", "message", ",", "null", ",", "null", ",", "true", ")", ";", "}" ]
Sends message to the destination in transactional manner. @param destination where to send @param message what to send Since transacted session is used, the message won't be committed until whole enclosing transaction ends
[ "Sends", "message", "to", "the", "destination", "in", "transactional", "manner", "." ]
train
https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/jms/AbstractJMSMessageProducer.java#L66-L68
aws/aws-sdk-java
aws-java-sdk-mediatailor/src/main/java/com/amazonaws/services/mediatailor/model/PutPlaybackConfigurationRequest.java
PutPlaybackConfigurationRequest.withTags
public PutPlaybackConfigurationRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public PutPlaybackConfigurationRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "PutPlaybackConfigurationRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags to assign to the playback configuration. </p> @param tags The tags to assign to the playback configuration. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "to", "assign", "to", "the", "playback", "configuration", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-mediatailor/src/main/java/com/amazonaws/services/mediatailor/model/PutPlaybackConfigurationRequest.java#L366-L369
aspectran/aspectran
shell/src/main/java/com/aspectran/shell/service/AspectranShellService.java
AspectranShellService.create
public static AspectranShellService create(AspectranConfig aspectranConfig, Console console) { ContextConfig contextConfig = aspectranConfig.touchContextConfig(); String rootFile = contextConfig.getRootFile(); if (!StringUtils.hasText(rootFile) && !contextConfig.hasAspectranParameters()) { contextConfig.setRootFile(DEFAULT_APP_CONFIG_ROOT_FILE); } AspectranShellService service = new AspectranShellService(console); ShellConfig shellConfig = aspectranConfig.getShellConfig(); if (shellConfig != null) { applyShellConfig(service, shellConfig); } service.prepare(aspectranConfig); setServiceStateListener(service); return service; }
java
public static AspectranShellService create(AspectranConfig aspectranConfig, Console console) { ContextConfig contextConfig = aspectranConfig.touchContextConfig(); String rootFile = contextConfig.getRootFile(); if (!StringUtils.hasText(rootFile) && !contextConfig.hasAspectranParameters()) { contextConfig.setRootFile(DEFAULT_APP_CONFIG_ROOT_FILE); } AspectranShellService service = new AspectranShellService(console); ShellConfig shellConfig = aspectranConfig.getShellConfig(); if (shellConfig != null) { applyShellConfig(service, shellConfig); } service.prepare(aspectranConfig); setServiceStateListener(service); return service; }
[ "public", "static", "AspectranShellService", "create", "(", "AspectranConfig", "aspectranConfig", ",", "Console", "console", ")", "{", "ContextConfig", "contextConfig", "=", "aspectranConfig", ".", "touchContextConfig", "(", ")", ";", "String", "rootFile", "=", "conte...
Returns a new instance of {@code AspectranShellService}. @param aspectranConfig the aspectran configuration @param console the {@code Console} instance @return the instance of {@code AspectranShellService}
[ "Returns", "a", "new", "instance", "of", "{", "@code", "AspectranShellService", "}", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/service/AspectranShellService.java#L159-L174
apache/groovy
subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java
NioGroovyMethods.newObjectInputStream
public static ObjectInputStream newObjectInputStream(Path self, final ClassLoader classLoader) throws IOException { return IOGroovyMethods.newObjectInputStream(Files.newInputStream(self), classLoader); }
java
public static ObjectInputStream newObjectInputStream(Path self, final ClassLoader classLoader) throws IOException { return IOGroovyMethods.newObjectInputStream(Files.newInputStream(self), classLoader); }
[ "public", "static", "ObjectInputStream", "newObjectInputStream", "(", "Path", "self", ",", "final", "ClassLoader", "classLoader", ")", "throws", "IOException", "{", "return", "IOGroovyMethods", ".", "newObjectInputStream", "(", "Files", ".", "newInputStream", "(", "se...
Create an object input stream for this path using the given class loader. @param self a {@code Path} object @param classLoader the class loader to use when loading the class @return an object input stream @throws java.io.IOException if an IOException occurs. @since 2.3.0
[ "Create", "an", "object", "input", "stream", "for", "this", "path", "using", "the", "given", "class", "loader", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L146-L148
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.backupSecret
public BackupSecretResult backupSecret(String vaultBaseUrl, String secretName) { return backupSecretWithServiceResponseAsync(vaultBaseUrl, secretName).toBlocking().single().body(); }
java
public BackupSecretResult backupSecret(String vaultBaseUrl, String secretName) { return backupSecretWithServiceResponseAsync(vaultBaseUrl, secretName).toBlocking().single().body(); }
[ "public", "BackupSecretResult", "backupSecret", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ")", "{", "return", "backupSecretWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "secretName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")",...
Backs up the specified secret. Requests that a backup of the specified secret be downloaded to the client. All versions of the secret will be downloaded. This operation requires the secrets/backup permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the BackupSecretResult object if successful.
[ "Backs", "up", "the", "specified", "secret", ".", "Requests", "that", "a", "backup", "of", "the", "specified", "secret", "be", "downloaded", "to", "the", "client", ".", "All", "versions", "of", "the", "secret", "will", "be", "downloaded", ".", "This", "ope...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L4906-L4908
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.addStringsFromRelationships
protected void addStringsFromRelationships(final BuildData buildData, final List<Relationship> relationships, final String roleName, final Map<String, TranslationDetails> translations) { final boolean useFixedUrls = buildData.isUseFixedUrls(); for (final Relationship relationship : relationships) { final SpecNode relatedNode; if (relationship instanceof TopicRelationship) { relatedNode = ((TopicRelationship) relationship).getSecondaryRelationship(); } else { relatedNode = ((TargetRelationship) relationship).getSecondaryRelationship(); } final String xrefString = DocBookUtilities.buildXRef(relatedNode.getUniqueLinkId(useFixedUrls), roleName); translations.put(xrefString, new TranslationDetails(xrefString, false, "para")); } }
java
protected void addStringsFromRelationships(final BuildData buildData, final List<Relationship> relationships, final String roleName, final Map<String, TranslationDetails> translations) { final boolean useFixedUrls = buildData.isUseFixedUrls(); for (final Relationship relationship : relationships) { final SpecNode relatedNode; if (relationship instanceof TopicRelationship) { relatedNode = ((TopicRelationship) relationship).getSecondaryRelationship(); } else { relatedNode = ((TargetRelationship) relationship).getSecondaryRelationship(); } final String xrefString = DocBookUtilities.buildXRef(relatedNode.getUniqueLinkId(useFixedUrls), roleName); translations.put(xrefString, new TranslationDetails(xrefString, false, "para")); } }
[ "protected", "void", "addStringsFromRelationships", "(", "final", "BuildData", "buildData", ",", "final", "List", "<", "Relationship", ">", "relationships", ",", "final", "String", "roleName", ",", "final", "Map", "<", "String", ",", "TranslationDetails", ">", "tr...
Add the translation strings from a list of relationships. @param buildData Information and data structures for the build. @param relationships The list of relationships to add strings for. @param roleName The role name to be used on the relationship xrefs. @param translations The mapping of original strings to translation strings, that will be used to build the po/pot files.
[ "Add", "the", "translation", "strings", "from", "a", "list", "of", "relationships", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L1225-L1240
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.bytesToShort
public static final short bytesToShort( byte[] data, int[] offset ) { /** * TODO: We use network-order within OceanStore, but temporarily * supporting intel-order to work with some JNI code until JNI code is * set to interoperate with network-order. */ short result = 0; for( int i = 0; i < SIZE_SHORT; ++i ) { result <<= 8; result |= (short) byteToUnsignedInt(data[offset[0]++]); } return result; }
java
public static final short bytesToShort( byte[] data, int[] offset ) { /** * TODO: We use network-order within OceanStore, but temporarily * supporting intel-order to work with some JNI code until JNI code is * set to interoperate with network-order. */ short result = 0; for( int i = 0; i < SIZE_SHORT; ++i ) { result <<= 8; result |= (short) byteToUnsignedInt(data[offset[0]++]); } return result; }
[ "public", "static", "final", "short", "bytesToShort", "(", "byte", "[", "]", "data", ",", "int", "[", "]", "offset", ")", "{", "/**\n * TODO: We use network-order within OceanStore, but temporarily\n * supporting intel-order to work with some JNI code until JNI code...
Return the <code>short</code> represented by the bytes in <code>data</code> staring at offset <code>offset[0]</code>. @param data the array from which to read @param offset A single element array whose first element is the index in data from which to begin reading on function entry, and which on function exit has been incremented by the number of bytes read. @return the value of the <code>short</code> decoded
[ "Return", "the", "<code", ">", "short<", "/", "code", ">", "represented", "by", "the", "bytes", "in", "<code", ">", "data<", "/", "code", ">", "staring", "at", "offset", "<code", ">", "offset", "[", "0", "]", "<", "/", "code", ">", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L106-L120
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/ByteArrayUtil.java
ByteArrayUtil.getLongBE
public static long getLongBE(final byte[] array, final int offset) { return ( array[offset + 7] & 0XFFL ) | ((array[offset + 6] & 0XFFL) << 8) | ((array[offset + 5] & 0XFFL) << 16) | ((array[offset + 4] & 0XFFL) << 24) | ((array[offset + 3] & 0XFFL) << 32) | ((array[offset + 2] & 0XFFL) << 40) | ((array[offset + 1] & 0XFFL) << 48) | ((array[offset ] & 0XFFL) << 56); }
java
public static long getLongBE(final byte[] array, final int offset) { return ( array[offset + 7] & 0XFFL ) | ((array[offset + 6] & 0XFFL) << 8) | ((array[offset + 5] & 0XFFL) << 16) | ((array[offset + 4] & 0XFFL) << 24) | ((array[offset + 3] & 0XFFL) << 32) | ((array[offset + 2] & 0XFFL) << 40) | ((array[offset + 1] & 0XFFL) << 48) | ((array[offset ] & 0XFFL) << 56); }
[ "public", "static", "long", "getLongBE", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ")", "{", "return", "(", "array", "[", "offset", "+", "7", "]", "&", "0XFF", "L", ")", "|", "(", "(", "array", "[", "offset", "+", "6...
Get a <i>long</i> from the source byte array starting at the given offset in big endian order. There is no bounds checking. @param array source byte array @param offset source starting point @return the <i>long</i>
[ "Get", "a", "<i", ">", "long<", "/", "i", ">", "from", "the", "source", "byte", "array", "starting", "at", "the", "given", "offset", "in", "big", "endian", "order", ".", "There", "is", "no", "bounds", "checking", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/ByteArrayUtil.java#L163-L172
Terracotta-OSS/offheap-store
src/main/java/org/terracotta/offheapstore/storage/allocator/IntegerBestFitAllocator.java
IntegerBestFitAllocator.checkMallocedChunk
private void checkMallocedChunk(int mem, int s) { if (VALIDATING) { int p = memToChunk(mem); int sz = head(p) & ~INUSE_BITS; checkInUseChunk(p); if (sz < MIN_CHUNK_SIZE) throw new AssertionError("Allocated chunk " + p + " is too small"); if ((sz & CHUNK_ALIGN_MASK) != 0) throw new AssertionError("Chunk size " + sz + " of " + p + " is not correctly aligned"); if (sz < s) throw new AssertionError("Allocated chunk " + p + " is smaller than requested [" + sz + "<" + s + "]"); if (sz > (s + MIN_CHUNK_SIZE)) { throw new AssertionError("Allocated chunk " + p + " is too large (should have been split off) [" + sz + ">>" + s + "]"); } } }
java
private void checkMallocedChunk(int mem, int s) { if (VALIDATING) { int p = memToChunk(mem); int sz = head(p) & ~INUSE_BITS; checkInUseChunk(p); if (sz < MIN_CHUNK_SIZE) throw new AssertionError("Allocated chunk " + p + " is too small"); if ((sz & CHUNK_ALIGN_MASK) != 0) throw new AssertionError("Chunk size " + sz + " of " + p + " is not correctly aligned"); if (sz < s) throw new AssertionError("Allocated chunk " + p + " is smaller than requested [" + sz + "<" + s + "]"); if (sz > (s + MIN_CHUNK_SIZE)) { throw new AssertionError("Allocated chunk " + p + " is too large (should have been split off) [" + sz + ">>" + s + "]"); } } }
[ "private", "void", "checkMallocedChunk", "(", "int", "mem", ",", "int", "s", ")", "{", "if", "(", "VALIDATING", ")", "{", "int", "p", "=", "memToChunk", "(", "mem", ")", ";", "int", "sz", "=", "head", "(", "p", ")", "&", "~", "INUSE_BITS", ";", "...
/* Check properties of malloced chunks at the point they are malloced
[ "/", "*", "Check", "properties", "of", "malloced", "chunks", "at", "the", "point", "they", "are", "malloced" ]
train
https://github.com/Terracotta-OSS/offheap-store/blob/600486cddb33c0247025c0cb69eff289eb6d7d93/src/main/java/org/terracotta/offheapstore/storage/allocator/IntegerBestFitAllocator.java#L1063-L1078
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/fdt/FdtSketch.java
FdtSketch.getLowerBound
public double getLowerBound(final int numStdDev, final int numSubsetEntries) { if (!isEstimationMode()) { return numSubsetEntries; } return BinomialBoundsN.getLowerBound(numSubsetEntries, getTheta(), numStdDev, isEmpty()); }
java
public double getLowerBound(final int numStdDev, final int numSubsetEntries) { if (!isEstimationMode()) { return numSubsetEntries; } return BinomialBoundsN.getLowerBound(numSubsetEntries, getTheta(), numStdDev, isEmpty()); }
[ "public", "double", "getLowerBound", "(", "final", "int", "numStdDev", ",", "final", "int", "numSubsetEntries", ")", "{", "if", "(", "!", "isEstimationMode", "(", ")", ")", "{", "return", "numSubsetEntries", ";", "}", "return", "BinomialBoundsN", ".", "getLowe...
Gets the estimate of the lower bound of the true distinct population represented by the count of entries in a group. @param numStdDev <a href="{@docRoot}/resources/dictionary.html#numStdDev">See Number of Standard Deviations</a> @param numSubsetEntries number of entries for a chosen subset of the sketch. @return the estimate of the lower bound of the true distinct population represented by the count of entries in a group.
[ "Gets", "the", "estimate", "of", "the", "lower", "bound", "of", "the", "true", "distinct", "population", "represented", "by", "the", "count", "of", "entries", "in", "a", "group", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/fdt/FdtSketch.java#L135-L138
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java
AbstractClassFileWriter.buildArgument
protected static void buildArgument(GeneratorAdapter generatorAdapter, String argumentName, Object objectType) { // 1st argument: the type generatorAdapter.push(getTypeReference(objectType)); // 2nd argument: the name generatorAdapter.push(argumentName); // Argument.create( .. ) invokeInterfaceStaticMethod( generatorAdapter, Argument.class, METHOD_CREATE_ARGUMENT_SIMPLE ); }
java
protected static void buildArgument(GeneratorAdapter generatorAdapter, String argumentName, Object objectType) { // 1st argument: the type generatorAdapter.push(getTypeReference(objectType)); // 2nd argument: the name generatorAdapter.push(argumentName); // Argument.create( .. ) invokeInterfaceStaticMethod( generatorAdapter, Argument.class, METHOD_CREATE_ARGUMENT_SIMPLE ); }
[ "protected", "static", "void", "buildArgument", "(", "GeneratorAdapter", "generatorAdapter", ",", "String", "argumentName", ",", "Object", "objectType", ")", "{", "// 1st argument: the type", "generatorAdapter", ".", "push", "(", "getTypeReference", "(", "objectType", "...
Builds an argument instance. @param generatorAdapter The generator adapter. @param argumentName The argument name @param objectType The object type
[ "Builds", "an", "argument", "instance", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/writer/AbstractClassFileWriter.java#L143-L155
alkacon/opencms-core
src/org/opencms/workflow/CmsExtendedWorkflowManager.java
CmsExtendedWorkflowManager.getPublishBrokenRelationsResponse
protected CmsWorkflowResponse getPublishBrokenRelationsResponse( CmsObject userCms, List<CmsPublishResource> publishResources) { List<CmsWorkflowAction> actions = new ArrayList<CmsWorkflowAction>(); String forcePublishLabel = Messages.get().getBundle(getLocale(userCms)).key( Messages.GUI_WORKFLOW_ACTION_FORCE_PUBLISH_0); CmsWorkflowAction forcePublish = new CmsWorkflowAction(ACTION_FORCE_PUBLISH, forcePublishLabel, true, true); actions.add(forcePublish); return new CmsWorkflowResponse( false, Messages.get().getBundle(getLocale(userCms)).key(Messages.GUI_BROKEN_LINKS_0), publishResources, actions, null); }
java
protected CmsWorkflowResponse getPublishBrokenRelationsResponse( CmsObject userCms, List<CmsPublishResource> publishResources) { List<CmsWorkflowAction> actions = new ArrayList<CmsWorkflowAction>(); String forcePublishLabel = Messages.get().getBundle(getLocale(userCms)).key( Messages.GUI_WORKFLOW_ACTION_FORCE_PUBLISH_0); CmsWorkflowAction forcePublish = new CmsWorkflowAction(ACTION_FORCE_PUBLISH, forcePublishLabel, true, true); actions.add(forcePublish); return new CmsWorkflowResponse( false, Messages.get().getBundle(getLocale(userCms)).key(Messages.GUI_BROKEN_LINKS_0), publishResources, actions, null); }
[ "protected", "CmsWorkflowResponse", "getPublishBrokenRelationsResponse", "(", "CmsObject", "userCms", ",", "List", "<", "CmsPublishResource", ">", "publishResources", ")", "{", "List", "<", "CmsWorkflowAction", ">", "actions", "=", "new", "ArrayList", "<", "CmsWorkflowA...
Helper method for generating the workflow response which should be sent when publishing the resources would break relations.<p> @param userCms the user's CMS context @param publishResources the resources whose links would be broken @return the workflow response
[ "Helper", "method", "for", "generating", "the", "workflow", "response", "which", "should", "be", "sent", "when", "publishing", "the", "resources", "would", "break", "relations", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/CmsExtendedWorkflowManager.java#L579-L595
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java
GenericHibernateDao.addCriterionsToCriteria
private void addCriterionsToCriteria(Criteria criteria, Criterion... criterion) { if (criteria != null) { for (Criterion c : criterion) { if (c != null) { criteria.add(c); } } } }
java
private void addCriterionsToCriteria(Criteria criteria, Criterion... criterion) { if (criteria != null) { for (Criterion c : criterion) { if (c != null) { criteria.add(c); } } } }
[ "private", "void", "addCriterionsToCriteria", "(", "Criteria", "criteria", ",", "Criterion", "...", "criterion", ")", "{", "if", "(", "criteria", "!=", "null", ")", "{", "for", "(", "Criterion", "c", ":", "criterion", ")", "{", "if", "(", "c", "!=", "nul...
Helper method: Adds all criterions to the criteria (if not null). @param criteria @param criterion
[ "Helper", "method", ":", "Adds", "all", "criterions", "to", "the", "criteria", "(", "if", "not", "null", ")", "." ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java#L489-L497
riversun/d6
src/main/java/org/riversun/d6/core/ModelClazzColumnNameAndFieldMapper.java
ModelClazzColumnNameAndFieldMapper.build
private void build(Map<String, D6ModelClassFieldInfo> refFieldMap) { refFieldMap.clear(); final Field[] fields = mModelClazz.getFields(); for (int i = 0; i < fields.length; i++) { final Field field = fields[i]; final DBColumn annoColumn = field.getAnnotation(DBColumn.class); if (annoColumn == null) { // there is no column annotation. continue; } final String columnName = annoColumn.columnName(); final String columnType = annoColumn.columnType(); if (columnName == null || columnType == null) { continue; } final D6ModelClassFieldInfo fieldInfo = new D6ModelClassFieldInfo(); // fieldInfo.field = field; fieldInfo.columnName = columnName; fieldInfo.columnType = columnType; fieldInfo.value = null; // fieldInfo.isAutoIncrement = annoColumn.isAutoIncrement(); fieldInfo.isNullable = annoColumn.isNullable(); fieldInfo.isPrimaryKey = annoColumn.isPrimaryKey(); fieldInfo.isUnique = annoColumn.isUnique(); refFieldMap.put(columnName, fieldInfo); } }
java
private void build(Map<String, D6ModelClassFieldInfo> refFieldMap) { refFieldMap.clear(); final Field[] fields = mModelClazz.getFields(); for (int i = 0; i < fields.length; i++) { final Field field = fields[i]; final DBColumn annoColumn = field.getAnnotation(DBColumn.class); if (annoColumn == null) { // there is no column annotation. continue; } final String columnName = annoColumn.columnName(); final String columnType = annoColumn.columnType(); if (columnName == null || columnType == null) { continue; } final D6ModelClassFieldInfo fieldInfo = new D6ModelClassFieldInfo(); // fieldInfo.field = field; fieldInfo.columnName = columnName; fieldInfo.columnType = columnType; fieldInfo.value = null; // fieldInfo.isAutoIncrement = annoColumn.isAutoIncrement(); fieldInfo.isNullable = annoColumn.isNullable(); fieldInfo.isPrimaryKey = annoColumn.isPrimaryKey(); fieldInfo.isUnique = annoColumn.isUnique(); refFieldMap.put(columnName, fieldInfo); } }
[ "private", "void", "build", "(", "Map", "<", "String", ",", "D6ModelClassFieldInfo", ">", "refFieldMap", ")", "{", "refFieldMap", ".", "clear", "(", ")", ";", "final", "Field", "[", "]", "fields", "=", "mModelClazz", ".", "getFields", "(", ")", ";", "for...
To populate FieldMap(key is columnName,value is fieldInfo) holding the column and fields @param refFieldMap reference of non-null field map @return
[ "To", "populate", "FieldMap", "(", "key", "is", "columnName", "value", "is", "fieldInfo", ")", "holding", "the", "column", "and", "fields" ]
train
https://github.com/riversun/d6/blob/2798bd876b9380dbfea8182d11ad306cb1b0e114/src/main/java/org/riversun/d6/core/ModelClazzColumnNameAndFieldMapper.java#L68-L106
ical4j/ical4j
src/main/java/net/fortuna/ical4j/transform/recurrence/AbstractDateExpansionRule.java
AbstractDateExpansionRule.getTime
protected static Date getTime(final Date referenceDate, final Calendar cal) { final Date zonedDate = new DateTime(referenceDate); zonedDate.setTime(cal.getTime().getTime()); return zonedDate; }
java
protected static Date getTime(final Date referenceDate, final Calendar cal) { final Date zonedDate = new DateTime(referenceDate); zonedDate.setTime(cal.getTime().getTime()); return zonedDate; }
[ "protected", "static", "Date", "getTime", "(", "final", "Date", "referenceDate", ",", "final", "Calendar", "cal", ")", "{", "final", "Date", "zonedDate", "=", "new", "DateTime", "(", "referenceDate", ")", ";", "zonedDate", ".", "setTime", "(", "cal", ".", ...
Get a DateTime from cal.getTime() with the timezone of the given reference date. @param referenceDate @param cal @return
[ "Get", "a", "DateTime", "from", "cal", ".", "getTime", "()", "with", "the", "timezone", "of", "the", "given", "reference", "date", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/transform/recurrence/AbstractDateExpansionRule.java#L128-L132
web3j/web3j
crypto/src/main/java/org/web3j/crypto/Sign.java
Sign.publicKeyFromPrivate
public static BigInteger publicKeyFromPrivate(BigInteger privKey) { ECPoint point = publicPointFromPrivate(privKey); byte[] encoded = point.getEncoded(false); return new BigInteger(1, Arrays.copyOfRange(encoded, 1, encoded.length)); // remove prefix }
java
public static BigInteger publicKeyFromPrivate(BigInteger privKey) { ECPoint point = publicPointFromPrivate(privKey); byte[] encoded = point.getEncoded(false); return new BigInteger(1, Arrays.copyOfRange(encoded, 1, encoded.length)); // remove prefix }
[ "public", "static", "BigInteger", "publicKeyFromPrivate", "(", "BigInteger", "privKey", ")", "{", "ECPoint", "point", "=", "publicPointFromPrivate", "(", "privKey", ")", ";", "byte", "[", "]", "encoded", "=", "point", ".", "getEncoded", "(", "false", ")", ";",...
Returns public key from the given private key. @param privKey the private key to derive the public key from @return BigInteger encoded public key
[ "Returns", "public", "key", "from", "the", "given", "private", "key", "." ]
train
https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/crypto/src/main/java/org/web3j/crypto/Sign.java#L245-L250
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
DynamicReportBuilder.setProperty
public DynamicReportBuilder setProperty(String name, String value) { this.report.setProperty(name, value); return this; }
java
public DynamicReportBuilder setProperty(String name, String value) { this.report.setProperty(name, value); return this; }
[ "public", "DynamicReportBuilder", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "this", ".", "report", ".", "setProperty", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a property to report design, this properties are mostly used by exporters to know if any specific configuration is needed @param name @param value @return A Dynamic Report Builder
[ "Adds", "a", "property", "to", "report", "design", "this", "properties", "are", "mostly", "used", "by", "exporters", "to", "know", "if", "any", "specific", "configuration", "is", "needed" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L1581-L1584
alexcojocaru/elasticsearch-maven-plugin
src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/util/FilesystemUtil.java
FilesystemUtil.setScriptPermission
public static void setScriptPermission(InstanceConfiguration config, String scriptName) { if (SystemUtils.IS_OS_WINDOWS) { // we do not have file permissions on windows return; } if (VersionUtil.isEqualOrGreater_7_0_0(config.getClusterConfiguration().getVersion())) { // ES7 and above is packaged as a .tar.gz, and as such the permissions are preserved return; } CommandLine command = new CommandLine("chmod") .addArgument("755") .addArgument(String.format("bin/%s", scriptName)); ProcessUtil.executeScript(config, command); command = new CommandLine("sed") .addArguments("-i''") .addArgument("-e") .addArgument("1s:.*:#!/usr/bin/env bash:", false) .addArgument(String.format("bin/%s", scriptName)); ProcessUtil.executeScript(config, command); }
java
public static void setScriptPermission(InstanceConfiguration config, String scriptName) { if (SystemUtils.IS_OS_WINDOWS) { // we do not have file permissions on windows return; } if (VersionUtil.isEqualOrGreater_7_0_0(config.getClusterConfiguration().getVersion())) { // ES7 and above is packaged as a .tar.gz, and as such the permissions are preserved return; } CommandLine command = new CommandLine("chmod") .addArgument("755") .addArgument(String.format("bin/%s", scriptName)); ProcessUtil.executeScript(config, command); command = new CommandLine("sed") .addArguments("-i''") .addArgument("-e") .addArgument("1s:.*:#!/usr/bin/env bash:", false) .addArgument(String.format("bin/%s", scriptName)); ProcessUtil.executeScript(config, command); }
[ "public", "static", "void", "setScriptPermission", "(", "InstanceConfiguration", "config", ",", "String", "scriptName", ")", "{", "if", "(", "SystemUtils", ".", "IS_OS_WINDOWS", ")", "{", "// we do not have file permissions on windows", "return", ";", "}", "if", "(", ...
Set the 755 permissions on the given script. @param config - the instance config @param scriptName - the name of the script (located in the bin directory) to make executable
[ "Set", "the", "755", "permissions", "on", "the", "given", "script", "." ]
train
https://github.com/alexcojocaru/elasticsearch-maven-plugin/blob/c283053cf99dc6b6d411b58629364b6aae62b7f8/src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/util/FilesystemUtil.java#L83-L106
redkale/redkale
src/org/redkale/net/http/HttpResponse.java
HttpResponse.finishJson
public void finishJson(final JsonConvert convert, final Object obj) { this.contentType = this.jsonContentType; if (this.recycleListener != null) this.output = obj; finish(convert.convertTo(getBodyBufferSupplier(), obj)); }
java
public void finishJson(final JsonConvert convert, final Object obj) { this.contentType = this.jsonContentType; if (this.recycleListener != null) this.output = obj; finish(convert.convertTo(getBodyBufferSupplier(), obj)); }
[ "public", "void", "finishJson", "(", "final", "JsonConvert", "convert", ",", "final", "Object", "obj", ")", "{", "this", ".", "contentType", "=", "this", ".", "jsonContentType", ";", "if", "(", "this", ".", "recycleListener", "!=", "null", ")", "this", "."...
将对象以JSON格式输出 @param convert 指定的JsonConvert @param obj 输出对象
[ "将对象以JSON格式输出" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpResponse.java#L321-L325
qiniu/java-sdk
src/main/java/com/qiniu/storage/BucketManager.java
BucketManager.listV1
public Response listV1(String bucket, String prefix, String marker, int limit, String delimiter) throws QiniuException { String url = String.format("%s/list?%s", configuration.rsfHost(auth.accessKey, bucket), listQuery(bucket, prefix, marker, limit, delimiter)); return get(url); }
java
public Response listV1(String bucket, String prefix, String marker, int limit, String delimiter) throws QiniuException { String url = String.format("%s/list?%s", configuration.rsfHost(auth.accessKey, bucket), listQuery(bucket, prefix, marker, limit, delimiter)); return get(url); }
[ "public", "Response", "listV1", "(", "String", "bucket", ",", "String", "prefix", ",", "String", "marker", ",", "int", "limit", ",", "String", "delimiter", ")", "throws", "QiniuException", "{", "String", "url", "=", "String", ".", "format", "(", "\"%s/list?%...
列举空间文件 v1 接口,返回一个 response 对象。 @param bucket 空间名 @param prefix 文件名前缀 @param marker 上一次获取文件列表时返回的 marker @param limit 每次迭代的长度限制,最大1000,推荐值 100 @param delimiter 指定目录分隔符,列出所有公共前缀(模拟列出目录效果)。缺省值为空字符串 @return @throws QiniuException
[ "列举空间文件", "v1", "接口,返回一个", "response", "对象。" ]
train
https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L170-L175
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static JToolBar leftShift(JToolBar self, Action action) { self.add(action); return self; }
java
public static JToolBar leftShift(JToolBar self, Action action) { self.add(action); return self; }
[ "public", "static", "JToolBar", "leftShift", "(", "JToolBar", "self", ",", "Action", "action", ")", "{", "self", ".", "add", "(", "action", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add components to a toolBar.<p> @param self a JToolBar @param action an Action to be added to the toolBar. @return same toolBar, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "components", "to", "a", "toolBar", ".", "<p", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L1035-L1038
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/I18nUtilities.java
I18nUtilities.asMessage
public static Serializable asMessage(final String text, final Serializable... args) { if (text == null) { return null; } else if (args == null || args.length == 0) { return text; } else { return new Message(text, args); } }
java
public static Serializable asMessage(final String text, final Serializable... args) { if (text == null) { return null; } else if (args == null || args.length == 0) { return text; } else { return new Message(text, args); } }
[ "public", "static", "Serializable", "asMessage", "(", "final", "String", "text", ",", "final", "Serializable", "...", "args", ")", "{", "if", "(", "text", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "args", "==", "null", "||"...
Converts a message String and optional message arguments to a an appropriate format for internationalisation. @param text the message text. @param args the message arguments. @return a message in an appropriate format for internationalisation, may be null.
[ "Converts", "a", "message", "String", "and", "optional", "message", "arguments", "to", "a", "an", "appropriate", "format", "for", "internationalisation", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/I18nUtilities.java#L56-L64
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java
HttpRequestFactory.buildPatchRequest
public HttpRequest buildPatchRequest(GenericUrl url, HttpContent content) throws IOException { return buildRequest(HttpMethods.PATCH, url, content); }
java
public HttpRequest buildPatchRequest(GenericUrl url, HttpContent content) throws IOException { return buildRequest(HttpMethods.PATCH, url, content); }
[ "public", "HttpRequest", "buildPatchRequest", "(", "GenericUrl", "url", ",", "HttpContent", "content", ")", "throws", "IOException", "{", "return", "buildRequest", "(", "HttpMethods", ".", "PATCH", ",", "url", ",", "content", ")", ";", "}" ]
Builds a {@code PATCH} request for the given URL and content. @param url HTTP request URL or {@code null} for none @param content HTTP request content or {@code null} for none @return new HTTP request
[ "Builds", "a", "{", "@code", "PATCH", "}", "request", "for", "the", "given", "URL", "and", "content", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java#L149-L151
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java
VersionsImpl.updateAsync
public Observable<OperationStatus> updateAsync(UUID appId, String versionId, UpdateVersionsOptionalParameter updateOptionalParameter) { return updateWithServiceResponseAsync(appId, versionId, updateOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updateAsync(UUID appId, String versionId, UpdateVersionsOptionalParameter updateOptionalParameter) { return updateWithServiceResponseAsync(appId, versionId, updateOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updateAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UpdateVersionsOptionalParameter", "updateOptionalParameter", ")", "{", "return", "updateWithServiceResponseAsync", "(", "appId", ",", "versionId", ...
Updates the name or description of the application version. @param appId The application ID. @param versionId The version ID. @param updateOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Updates", "the", "name", "or", "description", "of", "the", "application", "version", "." ]
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/VersionsImpl.java#L562-L569
EasyinnovaSL/Tiff-Library-4J
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
TiffITProfile.validateIfdFP
private void validateIfdFP(IFD ifd, int p) { IfdTags metadata = ifd.getMetadata(); checkRequiredTag(metadata, "ImageDescription", 1); checkRequiredTag(metadata, "StripOffsets", 1); if (p == 1 || p == 2) { checkRequiredTag(metadata, "StripOffsets", 1, new long[]{0}); } checkRequiredTag(metadata, "NewSubfileType", 1); checkRequiredTag(metadata, "ImageLength", 1); checkRequiredTag(metadata, "ImageWidth", 1); checkRequiredTag(metadata, "StripOffsets", 1); if (p == 0) { checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8}); } else { checkRequiredTag(metadata, "Orientation", 1, new long[]{1}); } checkRequiredTag(metadata, "StripBYTECount", 1); checkRequiredTag(metadata, "XResolution", 1); checkRequiredTag(metadata, "YResolution", 1); checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2}); if (p == 1 || p == 2) { checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3}); checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4}); } }
java
private void validateIfdFP(IFD ifd, int p) { IfdTags metadata = ifd.getMetadata(); checkRequiredTag(metadata, "ImageDescription", 1); checkRequiredTag(metadata, "StripOffsets", 1); if (p == 1 || p == 2) { checkRequiredTag(metadata, "StripOffsets", 1, new long[]{0}); } checkRequiredTag(metadata, "NewSubfileType", 1); checkRequiredTag(metadata, "ImageLength", 1); checkRequiredTag(metadata, "ImageWidth", 1); checkRequiredTag(metadata, "StripOffsets", 1); if (p == 0) { checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8}); } else { checkRequiredTag(metadata, "Orientation", 1, new long[]{1}); } checkRequiredTag(metadata, "StripBYTECount", 1); checkRequiredTag(metadata, "XResolution", 1); checkRequiredTag(metadata, "YResolution", 1); checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2}); if (p == 1 || p == 2) { checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3}); checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4}); } }
[ "private", "void", "validateIfdFP", "(", "IFD", "ifd", ",", "int", "p", ")", "{", "IfdTags", "metadata", "=", "ifd", ".", "getMetadata", "(", ")", ";", "checkRequiredTag", "(", "metadata", ",", "\"ImageDescription\"", ",", "1", ")", ";", "checkRequiredTag", ...
Validate Final Page. @param ifd the ifd @param p the profile (default = 0, P1 = 1, P2 = 2)
[ "Validate", "Final", "Page", "." ]
train
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L589-L614
landawn/AbacusUtil
src/com/landawn/abacus/util/Triple.java
Triple.setMiddleIf
public <E extends Exception> boolean setMiddleIf(final M newMiddle, Try.BiPredicate<? super Triple<L, M, R>, ? super M, E> predicate) throws E { if (predicate.test(this, newMiddle)) { this.middle = newMiddle; return true; } return false; }
java
public <E extends Exception> boolean setMiddleIf(final M newMiddle, Try.BiPredicate<? super Triple<L, M, R>, ? super M, E> predicate) throws E { if (predicate.test(this, newMiddle)) { this.middle = newMiddle; return true; } return false; }
[ "public", "<", "E", "extends", "Exception", ">", "boolean", "setMiddleIf", "(", "final", "M", "newMiddle", ",", "Try", ".", "BiPredicate", "<", "?", "super", "Triple", "<", "L", ",", "M", ",", "R", ">", ",", "?", "super", "M", ",", "E", ">", "predi...
Set to the specified <code>newMiddle</code> and returns <code>true</code> if <code>predicate</code> returns true. Otherwise returns <code>false</code> without setting the value to new value. @param newMiddle @param predicate - the first parameter is current pair, the second parameter is the <code>newMiddle</code> @return
[ "Set", "to", "the", "specified", "<code", ">", "newMiddle<", "/", "code", ">", "and", "returns", "<code", ">", "true<", "/", "code", ">", "if", "<code", ">", "predicate<", "/", "code", ">", "returns", "true", ".", "Otherwise", "returns", "<code", ">", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Triple.java#L156-L163
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java
GVRCameraRig.setVec2
public void setVec2(String key, float x, float y) { checkStringNotNullOrEmpty("key", key); NativeCameraRig.setVec2(getNative(), key, x, y); }
java
public void setVec2(String key, float x, float y) { checkStringNotNullOrEmpty("key", key); NativeCameraRig.setVec2(getNative(), key, x, y); }
[ "public", "void", "setVec2", "(", "String", "key", ",", "float", "x", ",", "float", "y", ")", "{", "checkStringNotNullOrEmpty", "(", "\"key\"", ",", "key", ")", ";", "NativeCameraRig", ".", "setVec2", "(", "getNative", "(", ")", ",", "key", ",", "x", "...
Map a two-component {@code float} vector to {@code key}. @param key Key to map the vector to. @param x 'X' component of vector. @param y 'Y' component of vector.
[ "Map", "a", "two", "-", "component", "{", "@code", "float", "}", "vector", "to", "{", "@code", "key", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java#L249-L252
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/AlertDto.java
AlertDto.transformToDto
public static AlertDto transformToDto(Alert alert) { if (alert == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } AlertDto result = createDtoObject(AlertDto.class, alert); result.setOwnerName(alert.getOwner().getUserName()); for (Trigger trigger : alert.getTriggers()) { result.addTriggersIds(trigger); } for (Notification notification : alert.getNotifications()) { result.addNotificationsIds(notification); } return result; }
java
public static AlertDto transformToDto(Alert alert) { if (alert == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } AlertDto result = createDtoObject(AlertDto.class, alert); result.setOwnerName(alert.getOwner().getUserName()); for (Trigger trigger : alert.getTriggers()) { result.addTriggersIds(trigger); } for (Notification notification : alert.getNotifications()) { result.addNotificationsIds(notification); } return result; }
[ "public", "static", "AlertDto", "transformToDto", "(", "Alert", "alert", ")", "{", "if", "(", "alert", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Null entity object cannot be converted to Dto object.\"", ",", "Status", ".", "INTERNAL_SE...
Converts alert entity to alertDto. @param alert The alert object. Cannot be null. @return AlertDto object. @throws WebApplicationException If an error occurs.
[ "Converts", "alert", "entity", "to", "alertDto", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/AlertDto.java#L77-L92
apiman/apiman
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/TransferQuotaPolicy.java
TransferQuotaPolicy.doFinalApply
protected void doFinalApply(IPolicyContext context, TransferQuotaConfig config, long downloadedBytes) { if (config.getDirection() == TransferDirectionType.download || config.getDirection() == TransferDirectionType.both) { final String bucketId = context.getAttribute(BUCKET_ID_ATTR, (String) null); final RateBucketPeriod period = context.getAttribute(PERIOD_ATTR, (RateBucketPeriod) null); IRateLimiterComponent rateLimiter = context.getComponent(IRateLimiterComponent.class); rateLimiter.accept(bucketId, period, config.getLimit(), downloadedBytes, new IAsyncResultHandler<RateLimitResponse>() { @Override public void handle(IAsyncResult<RateLimitResponse> result) { // No need to handle the response - it's too late to do anything meaningful with the result. // TODO log any error that might have ocurred } }); } }
java
protected void doFinalApply(IPolicyContext context, TransferQuotaConfig config, long downloadedBytes) { if (config.getDirection() == TransferDirectionType.download || config.getDirection() == TransferDirectionType.both) { final String bucketId = context.getAttribute(BUCKET_ID_ATTR, (String) null); final RateBucketPeriod period = context.getAttribute(PERIOD_ATTR, (RateBucketPeriod) null); IRateLimiterComponent rateLimiter = context.getComponent(IRateLimiterComponent.class); rateLimiter.accept(bucketId, period, config.getLimit(), downloadedBytes, new IAsyncResultHandler<RateLimitResponse>() { @Override public void handle(IAsyncResult<RateLimitResponse> result) { // No need to handle the response - it's too late to do anything meaningful with the result. // TODO log any error that might have ocurred } }); } }
[ "protected", "void", "doFinalApply", "(", "IPolicyContext", "context", ",", "TransferQuotaConfig", "config", ",", "long", "downloadedBytes", ")", "{", "if", "(", "config", ".", "getDirection", "(", ")", "==", "TransferDirectionType", ".", "download", "||", "config...
Called when everything is done (the last byte is written). This is used to record the # of bytes downloaded. @param context @param config @param downloadedBytes
[ "Called", "when", "everything", "is", "done", "(", "the", "last", "byte", "is", "written", ")", ".", "This", "is", "used", "to", "record", "the", "#", "of", "bytes", "downloaded", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/TransferQuotaPolicy.java#L245-L259
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.localSeo_directoriesList_GET
public OvhDirectoriesList localSeo_directoriesList_GET(OvhCountryEnum country, net.minidev.ovh.api.hosting.web.localseo.location.OvhOfferEnum offer) throws IOException { String qPath = "/hosting/web/localSeo/directoriesList"; StringBuilder sb = path(qPath); query(sb, "country", country); query(sb, "offer", offer); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDirectoriesList.class); }
java
public OvhDirectoriesList localSeo_directoriesList_GET(OvhCountryEnum country, net.minidev.ovh.api.hosting.web.localseo.location.OvhOfferEnum offer) throws IOException { String qPath = "/hosting/web/localSeo/directoriesList"; StringBuilder sb = path(qPath); query(sb, "country", country); query(sb, "offer", offer); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDirectoriesList.class); }
[ "public", "OvhDirectoriesList", "localSeo_directoriesList_GET", "(", "OvhCountryEnum", "country", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "hosting", ".", "web", ".", "localseo", ".", "location", ".", "OvhOfferEnum", "offer", ")", "throws", "IOEx...
Get list of directories associated to a local SEO offer and a country REST: GET /hosting/web/localSeo/directoriesList @param offer [required] Local SEO offer @param country [required] Country of the location
[ "Get", "list", "of", "directories", "associated", "to", "a", "local", "SEO", "offer", "and", "a", "country" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2230-L2237
cdk/cdk
base/silent/src/main/java/org/openscience/cdk/silent/Reaction.java
Reaction.setReactantCoefficient
@Override public boolean setReactantCoefficient(IAtomContainer reactant, Double coefficient) { boolean result = reactants.setMultiplier(reactant, coefficient); return result; }
java
@Override public boolean setReactantCoefficient(IAtomContainer reactant, Double coefficient) { boolean result = reactants.setMultiplier(reactant, coefficient); return result; }
[ "@", "Override", "public", "boolean", "setReactantCoefficient", "(", "IAtomContainer", "reactant", ",", "Double", "coefficient", ")", "{", "boolean", "result", "=", "reactants", ".", "setMultiplier", "(", "reactant", ",", "coefficient", ")", ";", "return", "result...
Sets the coefficient of a a reactant to a given value. @param reactant Reactant for which the coefficient is set @param coefficient The new coefficient for the given reactant @return true if Molecule has been found and stoichiometry has been set. @see #getReactantCoefficient
[ "Sets", "the", "coefficient", "of", "a", "a", "reactant", "to", "a", "given", "value", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/Reaction.java#L309-L313
amaembo/streamex
src/main/java/one/util/streamex/AbstractStreamEx.java
AbstractStreamEx.sortedBy
public <V extends Comparable<? super V>> S sortedBy(Function<? super T, ? extends V> keyExtractor) { return sorted(Comparator.comparing(keyExtractor)); }
java
public <V extends Comparable<? super V>> S sortedBy(Function<? super T, ? extends V> keyExtractor) { return sorted(Comparator.comparing(keyExtractor)); }
[ "public", "<", "V", "extends", "Comparable", "<", "?", "super", "V", ">", ">", "S", "sortedBy", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "V", ">", "keyExtractor", ")", "{", "return", "sorted", "(", "Comparator", ".", "comparing", ...
Returns a stream consisting of the elements of this stream, sorted according to the natural order of the keys extracted by provided function. <p> For ordered streams, the sort is stable. For unordered streams, no stability guarantees are made. <p> This is a <a href="package-summary.html#StreamOps">stateful intermediate operation</a>. @param <V> the type of the {@code Comparable} sort key @param keyExtractor a <a href="package-summary.html#NonInterference">non-interfering </a>, <a href="package-summary.html#Statelessness">stateless</a> function to be used to extract sorting keys @return the new stream
[ "Returns", "a", "stream", "consisting", "of", "the", "elements", "of", "this", "stream", "sorted", "according", "to", "the", "natural", "order", "of", "the", "keys", "extracted", "by", "provided", "function", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L751-L753
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java
JSONConverter.writeNotificationSettings
public void writeNotificationSettings(OutputStream out, NotificationSettings value) throws IOException { writeStartObject(out); writeIntField(out, OM_DELIVERYINTERVAL, value.deliveryInterval); writeIntField(out, OM_INBOXEXPIRTY, value.inboxExpiry); writeEndObject(out); }
java
public void writeNotificationSettings(OutputStream out, NotificationSettings value) throws IOException { writeStartObject(out); writeIntField(out, OM_DELIVERYINTERVAL, value.deliveryInterval); writeIntField(out, OM_INBOXEXPIRTY, value.inboxExpiry); writeEndObject(out); }
[ "public", "void", "writeNotificationSettings", "(", "OutputStream", "out", ",", "NotificationSettings", "value", ")", "throws", "IOException", "{", "writeStartObject", "(", "out", ")", ";", "writeIntField", "(", "out", ",", "OM_DELIVERYINTERVAL", ",", "value", ".", ...
Encode a NotificationSettings instance as JSON: { "deliveryInterval" : Integer } @param out The stream to write JSON to @param value The NotificationSettings instance to encode. Can't be null. @throws IOException If an I/O error occurs @see #readNotificationSettings(InputStream)
[ "Encode", "a", "NotificationSettings", "instance", "as", "JSON", ":", "{", "deliveryInterval", ":", "Integer", "}" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java#L1912-L1917
azkaban/azkaban
az-core/src/main/java/azkaban/utils/TimeUtils.java
TimeUtils.formatDuration
public static String formatDuration(final long startTime, final long endTime) { if (startTime == -1) { return "-"; } final long durationMS; if (endTime == -1) { durationMS = System.currentTimeMillis() - startTime; } else { durationMS = endTime - startTime; } long seconds = durationMS / 1000; if (seconds < 60) { return seconds + " sec"; } long minutes = seconds / 60; seconds %= 60; if (minutes < 60) { return minutes + "m " + seconds + "s"; } long hours = minutes / 60; minutes %= 60; if (hours < 24) { return hours + "h " + minutes + "m " + seconds + "s"; } final long days = hours / 24; hours %= 24; return days + "d " + hours + "h " + minutes + "m"; }
java
public static String formatDuration(final long startTime, final long endTime) { if (startTime == -1) { return "-"; } final long durationMS; if (endTime == -1) { durationMS = System.currentTimeMillis() - startTime; } else { durationMS = endTime - startTime; } long seconds = durationMS / 1000; if (seconds < 60) { return seconds + " sec"; } long minutes = seconds / 60; seconds %= 60; if (minutes < 60) { return minutes + "m " + seconds + "s"; } long hours = minutes / 60; minutes %= 60; if (hours < 24) { return hours + "h " + minutes + "m " + seconds + "s"; } final long days = hours / 24; hours %= 24; return days + "d " + hours + "h " + minutes + "m"; }
[ "public", "static", "String", "formatDuration", "(", "final", "long", "startTime", ",", "final", "long", "endTime", ")", "{", "if", "(", "startTime", "==", "-", "1", ")", "{", "return", "\"-\"", ";", "}", "final", "long", "durationMS", ";", "if", "(", ...
Format time period pair to Duration String @param startTime start time @param endTime end time @return Duration String
[ "Format", "time", "period", "pair", "to", "Duration", "String" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/TimeUtils.java#L72-L104
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/finder/DeepFetchNode.java
DeepFetchNode.getSimplifiedJoinOp
public Operation getSimplifiedJoinOp(Mapper mapper, List parentList) { int maxSimplifiedIn = DeepRelationshipUtility.MAX_SIMPLIFIED_IN; boolean differentPersisterThanParent = differentPersisterIdThanParent(mapper); if (differentPersisterThanParent) { maxSimplifiedIn = Integer.MAX_VALUE; } return mapper.getSimplifiedJoinOp(parentList, maxSimplifiedIn, this, differentPersisterThanParent); }
java
public Operation getSimplifiedJoinOp(Mapper mapper, List parentList) { int maxSimplifiedIn = DeepRelationshipUtility.MAX_SIMPLIFIED_IN; boolean differentPersisterThanParent = differentPersisterIdThanParent(mapper); if (differentPersisterThanParent) { maxSimplifiedIn = Integer.MAX_VALUE; } return mapper.getSimplifiedJoinOp(parentList, maxSimplifiedIn, this, differentPersisterThanParent); }
[ "public", "Operation", "getSimplifiedJoinOp", "(", "Mapper", "mapper", ",", "List", "parentList", ")", "{", "int", "maxSimplifiedIn", "=", "DeepRelationshipUtility", ".", "MAX_SIMPLIFIED_IN", ";", "boolean", "differentPersisterThanParent", "=", "differentPersisterIdThanPare...
mapper is not necessarily this.relatedFinder.mapper. chained mapper
[ "mapper", "is", "not", "necessarily", "this", ".", "relatedFinder", ".", "mapper", ".", "chained", "mapper" ]
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/finder/DeepFetchNode.java#L885-L894
davidmarquis/fluent-interface-proxy
src/main/java/com/fluentinterface/beans/ObjectWrapper.java
ObjectWrapper.setMappedValue
@SuppressWarnings("unchecked") private static void setMappedValue(Object obj, Property property, Object key, Object value, ObjectWrapper options) { if (property == null) { throw new IllegalArgumentException("Cannot set a new mapped value to a 'null' property."); } if (Map.class.isAssignableFrom(property.getType())) { Map map = (Map) property.get(obj); if (map == null) { if (options.isAutoInstancing) { map = new LinkedHashMap(); property.set(obj, map); } else { throw new NullPointerException("Invalid 'null' value found for the mapped '" + property + "' in " + obj.getClass().getName() + " object."); } } map.put(key, value); } else { throw new IllegalArgumentException("Cannot set a new mapped value to " + property + ". Only Map type is supported for mapped properties, but " + property.getType().getName() + " found."); } }
java
@SuppressWarnings("unchecked") private static void setMappedValue(Object obj, Property property, Object key, Object value, ObjectWrapper options) { if (property == null) { throw new IllegalArgumentException("Cannot set a new mapped value to a 'null' property."); } if (Map.class.isAssignableFrom(property.getType())) { Map map = (Map) property.get(obj); if (map == null) { if (options.isAutoInstancing) { map = new LinkedHashMap(); property.set(obj, map); } else { throw new NullPointerException("Invalid 'null' value found for the mapped '" + property + "' in " + obj.getClass().getName() + " object."); } } map.put(key, value); } else { throw new IllegalArgumentException("Cannot set a new mapped value to " + property + ". Only Map type is supported for mapped properties, but " + property.getType().getName() + " found."); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "void", "setMappedValue", "(", "Object", "obj", ",", "Property", "property", ",", "Object", "key", ",", "Object", "value", ",", "ObjectWrapper", "options", ")", "{", "if", "(", "property"...
/* Internal: Static version of {@link ObjectWrapper#setMappedValue(Property, Object, Object)}.
[ "/", "*", "Internal", ":", "Static", "version", "of", "{" ]
train
https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/beans/ObjectWrapper.java#L824-L849
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelUpdateHandler.java
ChannelUpdateHandler.handleServerVoiceChannel
private void handleServerVoiceChannel(JsonNode jsonChannel) { long channelId = jsonChannel.get("id").asLong(); api.getServerVoiceChannelById(channelId).map(ServerVoiceChannelImpl.class::cast).ifPresent(channel -> { int oldBitrate = channel.getBitrate(); int newBitrate = jsonChannel.get("bitrate").asInt(); if (oldBitrate != newBitrate) { channel.setBitrate(newBitrate); ServerVoiceChannelChangeBitrateEvent event = new ServerVoiceChannelChangeBitrateEventImpl(channel, newBitrate, oldBitrate); api.getEventDispatcher().dispatchServerVoiceChannelChangeBitrateEvent( (DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event); } int oldUserLimit = channel.getUserLimit().orElse(0); int newUserLimit = jsonChannel.get("user_limit").asInt(); if (oldUserLimit != newUserLimit) { channel.setUserLimit(newUserLimit); ServerVoiceChannelChangeUserLimitEvent event = new ServerVoiceChannelChangeUserLimitEventImpl(channel, newUserLimit, oldUserLimit); api.getEventDispatcher().dispatchServerVoiceChannelChangeUserLimitEvent( (DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event); } }); }
java
private void handleServerVoiceChannel(JsonNode jsonChannel) { long channelId = jsonChannel.get("id").asLong(); api.getServerVoiceChannelById(channelId).map(ServerVoiceChannelImpl.class::cast).ifPresent(channel -> { int oldBitrate = channel.getBitrate(); int newBitrate = jsonChannel.get("bitrate").asInt(); if (oldBitrate != newBitrate) { channel.setBitrate(newBitrate); ServerVoiceChannelChangeBitrateEvent event = new ServerVoiceChannelChangeBitrateEventImpl(channel, newBitrate, oldBitrate); api.getEventDispatcher().dispatchServerVoiceChannelChangeBitrateEvent( (DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event); } int oldUserLimit = channel.getUserLimit().orElse(0); int newUserLimit = jsonChannel.get("user_limit").asInt(); if (oldUserLimit != newUserLimit) { channel.setUserLimit(newUserLimit); ServerVoiceChannelChangeUserLimitEvent event = new ServerVoiceChannelChangeUserLimitEventImpl(channel, newUserLimit, oldUserLimit); api.getEventDispatcher().dispatchServerVoiceChannelChangeUserLimitEvent( (DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event); } }); }
[ "private", "void", "handleServerVoiceChannel", "(", "JsonNode", "jsonChannel", ")", "{", "long", "channelId", "=", "jsonChannel", ".", "get", "(", "\"id\"", ")", ".", "asLong", "(", ")", ";", "api", ".", "getServerVoiceChannelById", "(", "channelId", ")", ".",...
Handles a server voice channel update. @param jsonChannel The channel data.
[ "Handles", "a", "server", "voice", "channel", "update", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelUpdateHandler.java#L318-L343
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/AltsFraming.java
AltsFraming.toFrame
static ByteBuffer toFrame(ByteBuffer input, int dataSize) throws GeneralSecurityException { Preconditions.checkNotNull(input); if (dataSize > input.remaining()) { dataSize = input.remaining(); } Producer producer = new Producer(); ByteBuffer inputAlias = input.duplicate(); inputAlias.limit(input.position() + dataSize); producer.readBytes(inputAlias); producer.flush(); input.position(inputAlias.position()); ByteBuffer output = producer.getRawFrame(); return output; }
java
static ByteBuffer toFrame(ByteBuffer input, int dataSize) throws GeneralSecurityException { Preconditions.checkNotNull(input); if (dataSize > input.remaining()) { dataSize = input.remaining(); } Producer producer = new Producer(); ByteBuffer inputAlias = input.duplicate(); inputAlias.limit(input.position() + dataSize); producer.readBytes(inputAlias); producer.flush(); input.position(inputAlias.position()); ByteBuffer output = producer.getRawFrame(); return output; }
[ "static", "ByteBuffer", "toFrame", "(", "ByteBuffer", "input", ",", "int", "dataSize", ")", "throws", "GeneralSecurityException", "{", "Preconditions", ".", "checkNotNull", "(", "input", ")", ";", "if", "(", "dataSize", ">", "input", ".", "remaining", "(", ")"...
Creates a frame of length dataSize + FRAME_HEADER_SIZE using the input bytes, if dataSize <= input.remaining(). Otherwise, a frame of length input.remaining() + FRAME_HEADER_SIZE is created.
[ "Creates", "a", "frame", "of", "length", "dataSize", "+", "FRAME_HEADER_SIZE", "using", "the", "input", "bytes", "if", "dataSize", "<", "=", "input", ".", "remaining", "()", ".", "Otherwise", "a", "frame", "of", "length", "input", ".", "remaining", "()", "...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/AltsFraming.java#L59-L72
pmlopes/yoke
framework/src/main/java/com/jetdrone/vertx/yoke/Yoke.java
Yoke.set
public Yoke set(@NotNull String key, Object value) { if (value == null) { defaultContext.remove(key); } else { defaultContext.put(key, value); } return this; }
java
public Yoke set(@NotNull String key, Object value) { if (value == null) { defaultContext.remove(key); } else { defaultContext.put(key, value); } return this; }
[ "public", "Yoke", "set", "(", "@", "NotNull", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "defaultContext", ".", "remove", "(", "key", ")", ";", "}", "else", "{", "defaultContext", ".", "put", "(", ...
When you need to share global properties with your requests you can add them to Yoke and on every request they will be available as request.get(String) @param key unique identifier @param value Any non null value, nulls are not saved
[ "When", "you", "need", "to", "share", "global", "properties", "with", "your", "requests", "you", "can", "add", "them", "to", "Yoke", "and", "on", "every", "request", "they", "will", "be", "available", "as", "request", ".", "get", "(", "String", ")" ]
train
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/Yoke.java#L385-L393
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/slave/ModbusSlaveFactory.java
ModbusSlaveFactory.createTCPSlave
public static synchronized ModbusSlave createTCPSlave(InetAddress address, int port, int poolSize, boolean useRtuOverTcp) throws ModbusException { String key = ModbusSlaveType.TCP.getKey(port); if (slaves.containsKey(key)) { return slaves.get(key); } else { ModbusSlave slave = new ModbusSlave(address, port, poolSize, useRtuOverTcp); slaves.put(key, slave); return slave; } }
java
public static synchronized ModbusSlave createTCPSlave(InetAddress address, int port, int poolSize, boolean useRtuOverTcp) throws ModbusException { String key = ModbusSlaveType.TCP.getKey(port); if (slaves.containsKey(key)) { return slaves.get(key); } else { ModbusSlave slave = new ModbusSlave(address, port, poolSize, useRtuOverTcp); slaves.put(key, slave); return slave; } }
[ "public", "static", "synchronized", "ModbusSlave", "createTCPSlave", "(", "InetAddress", "address", ",", "int", "port", ",", "int", "poolSize", ",", "boolean", "useRtuOverTcp", ")", "throws", "ModbusException", "{", "String", "key", "=", "ModbusSlaveType", ".", "T...
Creates a TCP modbus slave or returns the one already allocated to this port @param address IP address to listen on @param port Port to listen on @param poolSize Pool size of listener threads @param useRtuOverTcp True if the RTU protocol should be used over TCP @return new or existing TCP modbus slave associated with the port @throws ModbusException If a problem occurs e.g. port already in use
[ "Creates", "a", "TCP", "modbus", "slave", "or", "returns", "the", "one", "already", "allocated", "to", "this", "port" ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/slave/ModbusSlaveFactory.java#L81-L91
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/MethodAnnotation.java
MethodAnnotation.fromForeignMethod
public static MethodAnnotation fromForeignMethod(String className, String methodName, String methodSig, boolean isStatic) { // FIXME: would be nice to do this without using BCEL className = ClassName.toDottedClassName(className); // Create MethodAnnotation. // It won't have source lines yet. MethodAnnotation methodAnnotation = new MethodAnnotation(className, methodName, methodSig, isStatic); if (AnalysisContext.currentAnalysisContext() != null) { SourceLineAnnotation sourceLines = SourceLineAnnotation .getSourceAnnotationForMethod(className, methodName, methodSig); methodAnnotation.setSourceLines(sourceLines); } return methodAnnotation; }
java
public static MethodAnnotation fromForeignMethod(String className, String methodName, String methodSig, boolean isStatic) { // FIXME: would be nice to do this without using BCEL className = ClassName.toDottedClassName(className); // Create MethodAnnotation. // It won't have source lines yet. MethodAnnotation methodAnnotation = new MethodAnnotation(className, methodName, methodSig, isStatic); if (AnalysisContext.currentAnalysisContext() != null) { SourceLineAnnotation sourceLines = SourceLineAnnotation .getSourceAnnotationForMethod(className, methodName, methodSig); methodAnnotation.setSourceLines(sourceLines); } return methodAnnotation; }
[ "public", "static", "MethodAnnotation", "fromForeignMethod", "(", "String", "className", ",", "String", "methodName", ",", "String", "methodSig", ",", "boolean", "isStatic", ")", "{", "// FIXME: would be nice to do this without using BCEL", "className", "=", "ClassName", ...
Factory method to create the MethodAnnotation from the classname, method name, signature, etc. The method tries to look up source line information for the method. @param className name of the class containing the method @param methodName name of the method @param methodSig signature of the method @param isStatic true if the method is static, false otherwise @return the MethodAnnotation
[ "Factory", "method", "to", "create", "the", "MethodAnnotation", "from", "the", "classname", "method", "name", "signature", "etc", ".", "The", "method", "tries", "to", "look", "up", "source", "line", "information", "for", "the", "method", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/MethodAnnotation.java#L212-L230
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsFormatterConfiguration.java
CmsFormatterConfiguration.create
public static CmsFormatterConfiguration create(CmsObject cms, List<I_CmsFormatterBean> formatters) { if ((formatters != null) && (formatters.size() > 0) && (cms != null)) { return new CmsFormatterConfiguration(cms, formatters); } else { return EMPTY_CONFIGURATION; } }
java
public static CmsFormatterConfiguration create(CmsObject cms, List<I_CmsFormatterBean> formatters) { if ((formatters != null) && (formatters.size() > 0) && (cms != null)) { return new CmsFormatterConfiguration(cms, formatters); } else { return EMPTY_CONFIGURATION; } }
[ "public", "static", "CmsFormatterConfiguration", "create", "(", "CmsObject", "cms", ",", "List", "<", "I_CmsFormatterBean", ">", "formatters", ")", "{", "if", "(", "(", "formatters", "!=", "null", ")", "&&", "(", "formatters", ".", "size", "(", ")", ">", "...
Returns the formatter configuration for the current project based on the given list of formatters.<p> @param cms the current users OpenCms context, required to know which project to read the JSP from @param formatters the list of configured formatters @return the formatter configuration for the current project based on the given list of formatters
[ "Returns", "the", "formatter", "configuration", "for", "the", "current", "project", "based", "on", "the", "given", "list", "of", "formatters", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsFormatterConfiguration.java#L212-L219
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDecoratedLabel.java
WDecoratedLabel.setText
public void setText(final String text, final Serializable... args) { WComponent body = getBody(); if (body instanceof WText) { ((WText) body).setText(text, args); } else if (body instanceof WLabel) { ((WLabel) body).setText(text, args); } else if (body instanceof WButton) { ((WButton) body).setText(text, args); } else if (body instanceof WLink) { ((WLink) body).setText(text, args); } else if (body == null) { setBody(new WText(text, args)); } }
java
public void setText(final String text, final Serializable... args) { WComponent body = getBody(); if (body instanceof WText) { ((WText) body).setText(text, args); } else if (body instanceof WLabel) { ((WLabel) body).setText(text, args); } else if (body instanceof WButton) { ((WButton) body).setText(text, args); } else if (body instanceof WLink) { ((WLink) body).setText(text, args); } else if (body == null) { setBody(new WText(text, args)); } }
[ "public", "void", "setText", "(", "final", "String", "text", ",", "final", "Serializable", "...", "args", ")", "{", "WComponent", "body", "=", "getBody", "(", ")", ";", "if", "(", "body", "instanceof", "WText", ")", "{", "(", "(", "WText", ")", "body",...
Attempts to set the text contained in the body component. This works only for simple components types: <ul> <li>{@link WButton}</li> <li>{@link WLink}</li> <li>{@link WLabel}</li> <li>{@link WText}</li> </ul> @param text the new body text, using {@link MessageFormat} syntax. @param args optional arguments for the message format string.
[ "Attempts", "to", "set", "the", "text", "contained", "in", "the", "body", "component", ".", "This", "works", "only", "for", "simple", "components", "types", ":", "<ul", ">", "<li", ">", "{", "@link", "WButton", "}", "<", "/", "li", ">", "<li", ">", "...
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDecoratedLabel.java#L154-L168
groupon/odo
client/src/main/java/com/groupon/odo/client/Client.java
Client.getNextOrdinalForMethodId
private Integer getNextOrdinalForMethodId(int methodId, String pathName) throws Exception { String pathInfo = doGet(BASE_PATH + uriEncode(pathName), new BasicNameValuePair[0]); JSONObject pathResponse = new JSONObject(pathInfo); JSONArray enabledEndpoints = pathResponse.getJSONArray("enabledEndpoints"); int lastOrdinal = 0; for (int x = 0; x < enabledEndpoints.length(); x++) { if (enabledEndpoints.getJSONObject(x).getInt("overrideId") == methodId) { lastOrdinal++; } } return lastOrdinal + 1; }
java
private Integer getNextOrdinalForMethodId(int methodId, String pathName) throws Exception { String pathInfo = doGet(BASE_PATH + uriEncode(pathName), new BasicNameValuePair[0]); JSONObject pathResponse = new JSONObject(pathInfo); JSONArray enabledEndpoints = pathResponse.getJSONArray("enabledEndpoints"); int lastOrdinal = 0; for (int x = 0; x < enabledEndpoints.length(); x++) { if (enabledEndpoints.getJSONObject(x).getInt("overrideId") == methodId) { lastOrdinal++; } } return lastOrdinal + 1; }
[ "private", "Integer", "getNextOrdinalForMethodId", "(", "int", "methodId", ",", "String", "pathName", ")", "throws", "Exception", "{", "String", "pathInfo", "=", "doGet", "(", "BASE_PATH", "+", "uriEncode", "(", "pathName", ")", ",", "new", "BasicNameValuePair", ...
Get the next available ordinal for a method ID @param methodId ID of method @return value of next ordinal @throws Exception exception
[ "Get", "the", "next", "available", "ordinal", "for", "a", "method", "ID" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L932-L944
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/network/NetworkUtil.java
NetworkUtil.toURI
public static URI toURI(InetAddress adr) { try { return new URI("tcp", adr.getHostAddress(), null, null); //$NON-NLS-1$ } catch (URISyntaxException e) { throw new IOError(e); } }
java
public static URI toURI(InetAddress adr) { try { return new URI("tcp", adr.getHostAddress(), null, null); //$NON-NLS-1$ } catch (URISyntaxException e) { throw new IOError(e); } }
[ "public", "static", "URI", "toURI", "(", "InetAddress", "adr", ")", "{", "try", "{", "return", "new", "URI", "(", "\"tcp\"", ",", "adr", ".", "getHostAddress", "(", ")", ",", "null", ",", "null", ")", ";", "//$NON-NLS-1$", "}", "catch", "(", "URISyntax...
Convert an inet address to an URI. @param adr address to convert to URI. @return the URI.
[ "Convert", "an", "inet", "address", "to", "an", "URI", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/network/NetworkUtil.java#L170-L176
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/model/Tile.java
Tile.getBoundaryAbsolute
public static Rectangle getBoundaryAbsolute(Tile upperLeft, Tile lowerRight) { return new Rectangle(upperLeft.getOrigin().x, upperLeft.getOrigin().y, lowerRight.getOrigin().x + upperLeft.tileSize, lowerRight.getOrigin().y + upperLeft.tileSize); }
java
public static Rectangle getBoundaryAbsolute(Tile upperLeft, Tile lowerRight) { return new Rectangle(upperLeft.getOrigin().x, upperLeft.getOrigin().y, lowerRight.getOrigin().x + upperLeft.tileSize, lowerRight.getOrigin().y + upperLeft.tileSize); }
[ "public", "static", "Rectangle", "getBoundaryAbsolute", "(", "Tile", "upperLeft", ",", "Tile", "lowerRight", ")", "{", "return", "new", "Rectangle", "(", "upperLeft", ".", "getOrigin", "(", ")", ".", "x", ",", "upperLeft", ".", "getOrigin", "(", ")", ".", ...
Extend of the area defined by the two tiles in absolute coordinates. @param upperLeft tile in upper left corner of area. @param lowerRight tile in lower right corner of area. @return rectangle with the absolute coordinates.
[ "Extend", "of", "the", "area", "defined", "by", "the", "two", "tiles", "in", "absolute", "coordinates", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/Tile.java#L51-L53
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/GraphicsUtil.java
GraphicsUtil.createGraphics
public static Graphics2D createGraphics(BufferedImage image, Color color) { final Graphics2D g = image.createGraphics(); // 填充背景 g.setColor(color); g.fillRect(0, 0, image.getWidth(), image.getHeight()); return g; }
java
public static Graphics2D createGraphics(BufferedImage image, Color color) { final Graphics2D g = image.createGraphics(); // 填充背景 g.setColor(color); g.fillRect(0, 0, image.getWidth(), image.getHeight()); return g; }
[ "public", "static", "Graphics2D", "createGraphics", "(", "BufferedImage", "image", ",", "Color", "color", ")", "{", "final", "Graphics2D", "g", "=", "image", ".", "createGraphics", "(", ")", ";", "// 填充背景\r", "g", ".", "setColor", "(", "color", ")", ";", "...
创建{@link Graphics2D} @param image {@link BufferedImage} @param color {@link Color}背景颜色以及当前画笔颜色 @return {@link Graphics2D} @since 4.5.2
[ "创建", "{", "@link", "Graphics2D", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/GraphicsUtil.java#L25-L32
sarxos/v4l4j
src/main/java/au/edu/jcu/v4l4j/VideoDevice.java
VideoDevice.getRawFrameGrabber
public RawFrameGrabber getRawFrameGrabber(int w, int h, int input, int std) throws V4L4JException{ if(deviceInfo==null) throw new ImageFormatException("No DeviceInfo could be obtained. " +"The device is probably used by another application"); return getRawFrameGrabber(w, h, input, std, deviceInfo.getFormatList().getNativeFormats().get(0)); }
java
public RawFrameGrabber getRawFrameGrabber(int w, int h, int input, int std) throws V4L4JException{ if(deviceInfo==null) throw new ImageFormatException("No DeviceInfo could be obtained. " +"The device is probably used by another application"); return getRawFrameGrabber(w, h, input, std, deviceInfo.getFormatList().getNativeFormats().get(0)); }
[ "public", "RawFrameGrabber", "getRawFrameGrabber", "(", "int", "w", ",", "int", "h", ",", "int", "input", ",", "int", "std", ")", "throws", "V4L4JException", "{", "if", "(", "deviceInfo", "==", "null", ")", "throw", "new", "ImageFormatException", "(", "\"No ...
This method returns a {@link RawFrameGrabber} associated with this video device. Captured frames will be handed out in the same format as received from the driver. The chosen format is the one returned by <code>getDeviceInfo().getFormatList().getNativeFormats().get(0)</code>. The {@link RawFrameGrabber} must be released when no longer used by calling {@link #releaseFrameGrabber()}. @param w the desired frame width. This value may be adjusted to the closest supported by hardware. @param h the desired frame height. This value may be adjusted to the closest supported by hardware. @param input the input index, as returned by {@link InputInfo#getIndex()}. @param std the video standard, as returned by {@link InputInfo#getSupportedStandards()} (see {@link V4L4JConstants}) @return a <code>RawFrameGrabber</code> associated with this video device. @throws VideoStandardException if the chosen video standard is not supported. @throws CaptureChannelException if the given channel number value is not valid. @throws ImageDimensionException if the given image dimensions are not supported. @throws InitialisationException if the video device file can not be initialised. @throws ImageFormatException if no image format could be found because the {@link DeviceInfo} object could not be obtained. Check if the device is not already used by another application. @throws V4L4JException if there is an error applying capture parameters @throws StateException if a <code>FrameGrabber</code> already exists or if the <code>VideoDevice</code> has been released.
[ "This", "method", "returns", "a", "{" ]
train
https://github.com/sarxos/v4l4j/blob/4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9/src/main/java/au/edu/jcu/v4l4j/VideoDevice.java#L1397-L1404
tweea/matrixjavalib-main-common
src/main/java/net/matrix/lang/Reflections.java
Reflections.invokeMethod
public static <T> T invokeMethod(final Object target, final String name, final Class<?>[] parameterTypes, final Object[] parameterValues) { Method method = getAccessibleMethod(target, name, parameterTypes); if (method == null) { throw new IllegalArgumentException("Could not find method [" + name + "] on target [" + target + ']'); } try { return (T) method.invoke(target, parameterValues); } catch (ReflectiveOperationException e) { throw new ReflectionRuntimeException(e); } }
java
public static <T> T invokeMethod(final Object target, final String name, final Class<?>[] parameterTypes, final Object[] parameterValues) { Method method = getAccessibleMethod(target, name, parameterTypes); if (method == null) { throw new IllegalArgumentException("Could not find method [" + name + "] on target [" + target + ']'); } try { return (T) method.invoke(target, parameterValues); } catch (ReflectiveOperationException e) { throw new ReflectionRuntimeException(e); } }
[ "public", "static", "<", "T", ">", "T", "invokeMethod", "(", "final", "Object", "target", ",", "final", "String", "name", ",", "final", "Class", "<", "?", ">", "[", "]", "parameterTypes", ",", "final", "Object", "[", "]", "parameterValues", ")", "{", "...
直接调用对象方法,无视 private/protected 修饰符。 用于一次性调用的情况,否则应使用 getAccessibleMethod() 函数获得 Method 后反复调用。 同时匹配方法名 + 参数类型。 @param target 目标对象 @param name 方法名 @param parameterTypes 参数类型 @param parameterValues 参数值 @param <T> 期待的返回值类型 @return 返回值
[ "直接调用对象方法,无视", "private", "/", "protected", "修饰符。", "用于一次性调用的情况,否则应使用", "getAccessibleMethod", "()", "函数获得", "Method", "后反复调用。", "同时匹配方法名", "+", "参数类型。" ]
train
https://github.com/tweea/matrixjavalib-main-common/blob/ac8f98322a422e3ef76c3e12d47b98268cec7006/src/main/java/net/matrix/lang/Reflections.java#L145-L156
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java
ContinuousDistributions.multinomialGaussianSample
public static double[] multinomialGaussianSample(double[] mean, double[][] covariance) { MultivariateNormalDistribution gaussian = new MultivariateNormalDistribution(mean, covariance); gaussian.reseedRandomGenerator(RandomGenerator.getThreadLocalRandom().nextLong()); return gaussian.sample(); }
java
public static double[] multinomialGaussianSample(double[] mean, double[][] covariance) { MultivariateNormalDistribution gaussian = new MultivariateNormalDistribution(mean, covariance); gaussian.reseedRandomGenerator(RandomGenerator.getThreadLocalRandom().nextLong()); return gaussian.sample(); }
[ "public", "static", "double", "[", "]", "multinomialGaussianSample", "(", "double", "[", "]", "mean", ",", "double", "[", "]", "[", "]", "covariance", ")", "{", "MultivariateNormalDistribution", "gaussian", "=", "new", "MultivariateNormalDistribution", "(", "mean"...
Samples from Multinomial Normal Distribution. @param mean @param covariance @return A multinomialGaussianSample from the Multinomial Normal Distribution
[ "Samples", "from", "Multinomial", "Normal", "Distribution", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java#L643-L648
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java
BaseSerializer.deserializeTransformList
public List<Transform> deserializeTransformList(String str) { return load(str, ListWrappers.TransformList.class).getList(); }
java
public List<Transform> deserializeTransformList(String str) { return load(str, ListWrappers.TransformList.class).getList(); }
[ "public", "List", "<", "Transform", ">", "deserializeTransformList", "(", "String", "str", ")", "{", "return", "load", "(", "str", ",", "ListWrappers", ".", "TransformList", ".", "class", ")", ".", "getList", "(", ")", ";", "}" ]
Deserialize a Transform List serialized using {@link #serializeTransformList(List)}, or an array serialized using {@link #serialize(Transform[])} @param str String representation (YAML/JSON) of the Transform list @return {@code List<Transform>}
[ "Deserialize", "a", "Transform", "List", "serialized", "using", "{", "@link", "#serializeTransformList", "(", "List", ")", "}", "or", "an", "array", "serialized", "using", "{", "@link", "#serialize", "(", "Transform", "[]", ")", "}" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java#L278-L280
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.setTimeDuration
public void setTimeDuration(String name, long value, TimeUnit unit) { set(name, value + ParsedTimeDuration.unitFor(unit).suffix()); }
java
public void setTimeDuration(String name, long value, TimeUnit unit) { set(name, value + ParsedTimeDuration.unitFor(unit).suffix()); }
[ "public", "void", "setTimeDuration", "(", "String", "name", ",", "long", "value", ",", "TimeUnit", "unit", ")", "{", "set", "(", "name", ",", "value", "+", "ParsedTimeDuration", ".", "unitFor", "(", "unit", ")", ".", "suffix", "(", ")", ")", ";", "}" ]
Set the value of <code>name</code> to the given time duration. This is equivalent to <code>set(&lt;name&gt;, value + &lt;time suffix&gt;)</code>. @param name Property name @param value Time duration @param unit Unit of time
[ "Set", "the", "value", "of", "<code", ">", "name<", "/", "code", ">", "to", "the", "given", "time", "duration", ".", "This", "is", "equivalent", "to", "<code", ">", "set", "(", "&lt", ";", "name&gt", ";", "value", "+", "&lt", ";", "time", "suffix&gt"...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1648-L1650
spotify/apollo
examples/spotify-api-example/src/main/java/com/spotify/apollo/example/AlbumResource.java
AlbumResource.parseResponseAlbumIds
private String parseResponseAlbumIds(String json) { StringJoiner sj = new StringJoiner(","); try { JsonNode jsonNode = this.objectMapper.readTree(json); for (JsonNode node : jsonNode.get("albums").get("items")) { sj.add(node.get("id").asText()); } } catch (IOException e) { throw new RuntimeException("Failed to parse JSON", e); } return sj.toString(); }
java
private String parseResponseAlbumIds(String json) { StringJoiner sj = new StringJoiner(","); try { JsonNode jsonNode = this.objectMapper.readTree(json); for (JsonNode node : jsonNode.get("albums").get("items")) { sj.add(node.get("id").asText()); } } catch (IOException e) { throw new RuntimeException("Failed to parse JSON", e); } return sj.toString(); }
[ "private", "String", "parseResponseAlbumIds", "(", "String", "json", ")", "{", "StringJoiner", "sj", "=", "new", "StringJoiner", "(", "\",\"", ")", ";", "try", "{", "JsonNode", "jsonNode", "=", "this", ".", "objectMapper", ".", "readTree", "(", "json", ")", ...
Parses the album ids from a JSON response from a <a href="https://developer.spotify.com/web-api/search-item/">Spotify API search query</a>. @param json The JSON response @return A comma-separated list of album ids from the response
[ "Parses", "the", "album", "ids", "from", "a", "JSON", "response", "from", "a", "<a", "href", "=", "https", ":", "//", "developer", ".", "spotify", ".", "com", "/", "web", "-", "api", "/", "search", "-", "item", "/", ">", "Spotify", "API", "search", ...
train
https://github.com/spotify/apollo/blob/3aba09840538a2aff9cdac5be42cc114dd276c70/examples/spotify-api-example/src/main/java/com/spotify/apollo/example/AlbumResource.java#L101-L112
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.writeUser
public void writeUser(CmsDbContext dbc, CmsUser user) throws CmsException { CmsUser oldUser = readUser(dbc, user.getId()); m_monitor.clearUserCache(oldUser); getUserDriver(dbc).writeUser(dbc, user); m_monitor.flushCache(CmsMemoryMonitor.CacheType.USERGROUPS, CmsMemoryMonitor.CacheType.USER_LIST); if (!dbc.getProjectId().isNullUUID()) { // user modified event is not needed return; } // fire user modified event Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put(I_CmsEventListener.KEY_USER_ID, user.getId().toString()); eventData.put(I_CmsEventListener.KEY_USER_NAME, oldUser.getName()); eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_USER_MODIFIED_ACTION_WRITE_USER); eventData.put(I_CmsEventListener.KEY_USER_CHANGES, Integer.valueOf(user.getChanges(oldUser))); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_USER_MODIFIED, eventData)); }
java
public void writeUser(CmsDbContext dbc, CmsUser user) throws CmsException { CmsUser oldUser = readUser(dbc, user.getId()); m_monitor.clearUserCache(oldUser); getUserDriver(dbc).writeUser(dbc, user); m_monitor.flushCache(CmsMemoryMonitor.CacheType.USERGROUPS, CmsMemoryMonitor.CacheType.USER_LIST); if (!dbc.getProjectId().isNullUUID()) { // user modified event is not needed return; } // fire user modified event Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put(I_CmsEventListener.KEY_USER_ID, user.getId().toString()); eventData.put(I_CmsEventListener.KEY_USER_NAME, oldUser.getName()); eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_USER_MODIFIED_ACTION_WRITE_USER); eventData.put(I_CmsEventListener.KEY_USER_CHANGES, Integer.valueOf(user.getChanges(oldUser))); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_USER_MODIFIED, eventData)); }
[ "public", "void", "writeUser", "(", "CmsDbContext", "dbc", ",", "CmsUser", "user", ")", "throws", "CmsException", "{", "CmsUser", "oldUser", "=", "readUser", "(", "dbc", ",", "user", ".", "getId", "(", ")", ")", ";", "m_monitor", ".", "clearUserCache", "("...
Updates the user information. <p> The user id has to be a valid OpenCms user id.<br> The user with the given id will be completely overridden by the given data.<p> @param dbc the current database context @param user the user to be updated @throws CmsException if operation was not successful
[ "Updates", "the", "user", "information", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10237-L10255
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/collection/ArrayUtils.java
ArrayUtils.copyWithoutNulls
public static <T> void copyWithoutNulls(T[] src, T[] dst) { int skipped = 0; for (int i = 0; i < src.length; i++) { T object = src[i]; if (object == null) { skipped++; } else { dst[i - skipped] = object; } } }
java
public static <T> void copyWithoutNulls(T[] src, T[] dst) { int skipped = 0; for (int i = 0; i < src.length; i++) { T object = src[i]; if (object == null) { skipped++; } else { dst[i - skipped] = object; } } }
[ "public", "static", "<", "T", ">", "void", "copyWithoutNulls", "(", "T", "[", "]", "src", ",", "T", "[", "]", "dst", ")", "{", "int", "skipped", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "src", ".", "length", ";", "i", ...
Copy src array into destination and skip null values. Warning: It does not do any validation. It expect the dst[] is created with right capacity. You can calculate required capacity as <code>src.length - getNoOfNullItems(src)</code> @param src source array @param dst destination. It has to have the right capacity @param <T>
[ "Copy", "src", "array", "into", "destination", "and", "skip", "null", "values", ".", "Warning", ":", "It", "does", "not", "do", "any", "validation", ".", "It", "expect", "the", "dst", "[]", "is", "created", "with", "right", "capacity", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/collection/ArrayUtils.java#L130-L140
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
TimestampUtils.toTimestampBin
public Timestamp toTimestampBin(TimeZone tz, byte[] bytes, boolean timestamptz) throws PSQLException { ParsedBinaryTimestamp parsedTimestamp = this.toParsedTimestampBin(tz, bytes, timestamptz); if (parsedTimestamp.infinity == Infinity.POSITIVE) { return new Timestamp(PGStatement.DATE_POSITIVE_INFINITY); } else if (parsedTimestamp.infinity == Infinity.NEGATIVE) { return new Timestamp(PGStatement.DATE_NEGATIVE_INFINITY); } Timestamp ts = new Timestamp(parsedTimestamp.millis); ts.setNanos(parsedTimestamp.nanos); return ts; }
java
public Timestamp toTimestampBin(TimeZone tz, byte[] bytes, boolean timestamptz) throws PSQLException { ParsedBinaryTimestamp parsedTimestamp = this.toParsedTimestampBin(tz, bytes, timestamptz); if (parsedTimestamp.infinity == Infinity.POSITIVE) { return new Timestamp(PGStatement.DATE_POSITIVE_INFINITY); } else if (parsedTimestamp.infinity == Infinity.NEGATIVE) { return new Timestamp(PGStatement.DATE_NEGATIVE_INFINITY); } Timestamp ts = new Timestamp(parsedTimestamp.millis); ts.setNanos(parsedTimestamp.nanos); return ts; }
[ "public", "Timestamp", "toTimestampBin", "(", "TimeZone", "tz", ",", "byte", "[", "]", "bytes", ",", "boolean", "timestamptz", ")", "throws", "PSQLException", "{", "ParsedBinaryTimestamp", "parsedTimestamp", "=", "this", ".", "toParsedTimestampBin", "(", "tz", ","...
Returns the SQL Timestamp object matching the given bytes with {@link Oid#TIMESTAMP} or {@link Oid#TIMESTAMPTZ}. @param tz The timezone used when received data is {@link Oid#TIMESTAMP}, ignored if data already contains {@link Oid#TIMESTAMPTZ}. @param bytes The binary encoded timestamp value. @param timestamptz True if the binary is in GMT. @return The parsed timestamp object. @throws PSQLException If binary format could not be parsed.
[ "Returns", "the", "SQL", "Timestamp", "object", "matching", "the", "given", "bytes", "with", "{", "@link", "Oid#TIMESTAMP", "}", "or", "{", "@link", "Oid#TIMESTAMPTZ", "}", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L1044-L1057
mikepenz/Materialize
library/src/main/java/com/mikepenz/materialize/util/UIUtils.java
UIUtils.getThemeColorFromAttrOrRes
public static int getThemeColorFromAttrOrRes(Context ctx, @AttrRes int attr, @ColorRes int res) { int color = getThemeColor(ctx, attr); if (color == 0) { color = ResourcesCompat.getColor(ctx.getResources(), res, ctx.getTheme()); } return color; }
java
public static int getThemeColorFromAttrOrRes(Context ctx, @AttrRes int attr, @ColorRes int res) { int color = getThemeColor(ctx, attr); if (color == 0) { color = ResourcesCompat.getColor(ctx.getResources(), res, ctx.getTheme()); } return color; }
[ "public", "static", "int", "getThemeColorFromAttrOrRes", "(", "Context", "ctx", ",", "@", "AttrRes", "int", "attr", ",", "@", "ColorRes", "int", "res", ")", "{", "int", "color", "=", "getThemeColor", "(", "ctx", ",", "attr", ")", ";", "if", "(", "color",...
helper method to get the color by attr (which is defined in the style) or by resource. @param ctx @param attr @param res @return
[ "helper", "method", "to", "get", "the", "color", "by", "attr", "(", "which", "is", "defined", "in", "the", "style", ")", "or", "by", "resource", "." ]
train
https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/util/UIUtils.java#L55-L61
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/describe/FactoryDescribeRegionPoint.java
FactoryDescribeRegionPoint.surfColorFast
public static <T extends ImageMultiBand<T>, II extends ImageGray<II>> DescribeRegionPoint<T,BrightFeature> surfColorFast(@Nullable ConfigSurfDescribe.Speed config , ImageType<T> imageType) { Class bandType = imageType.getImageClass(); Class<II> integralType = GIntegralImageOps.getIntegralType(bandType); DescribePointSurf<II> alg = FactoryDescribePointAlgs.surfSpeed( config, integralType); if( imageType.getFamily() == ImageType.Family.PLANAR) { DescribePointSurfPlanar<II> color = FactoryDescribePointAlgs.surfColor( alg,imageType.getNumBands()); return new SurfPlanar_to_DescribeRegionPoint(color,bandType,integralType); } else { throw new IllegalArgumentException("Unknown image type"); } }
java
public static <T extends ImageMultiBand<T>, II extends ImageGray<II>> DescribeRegionPoint<T,BrightFeature> surfColorFast(@Nullable ConfigSurfDescribe.Speed config , ImageType<T> imageType) { Class bandType = imageType.getImageClass(); Class<II> integralType = GIntegralImageOps.getIntegralType(bandType); DescribePointSurf<II> alg = FactoryDescribePointAlgs.surfSpeed( config, integralType); if( imageType.getFamily() == ImageType.Family.PLANAR) { DescribePointSurfPlanar<II> color = FactoryDescribePointAlgs.surfColor( alg,imageType.getNumBands()); return new SurfPlanar_to_DescribeRegionPoint(color,bandType,integralType); } else { throw new IllegalArgumentException("Unknown image type"); } }
[ "public", "static", "<", "T", "extends", "ImageMultiBand", "<", "T", ">", ",", "II", "extends", "ImageGray", "<", "II", ">", ">", "DescribeRegionPoint", "<", "T", ",", "BrightFeature", ">", "surfColorFast", "(", "@", "Nullable", "ConfigSurfDescribe", ".", "S...
Color variant of the SURF descriptor which has been designed for speed and sacrifices some stability. @see DescribePointSurfPlanar @param config SURF configuration. Pass in null for default options. @param imageType Type of input image. @return SURF color description extractor
[ "Color", "variant", "of", "the", "SURF", "descriptor", "which", "has", "been", "designed", "for", "speed", "and", "sacrifices", "some", "stability", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/describe/FactoryDescribeRegionPoint.java#L78-L93
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/misc/BoofMiscOps.java
BoofMiscOps.checkInside
public static boolean checkInside(ImageBase b, int x , int y , int radius ) { if( x-radius < 0 ) return false; if( x+radius >= b.width ) return false; if( y-radius < 0 ) return false; if( y+radius >= b.height ) return false; return true; }
java
public static boolean checkInside(ImageBase b, int x , int y , int radius ) { if( x-radius < 0 ) return false; if( x+radius >= b.width ) return false; if( y-radius < 0 ) return false; if( y+radius >= b.height ) return false; return true; }
[ "public", "static", "boolean", "checkInside", "(", "ImageBase", "b", ",", "int", "x", ",", "int", "y", ",", "int", "radius", ")", "{", "if", "(", "x", "-", "radius", "<", "0", ")", "return", "false", ";", "if", "(", "x", "+", "radius", ">=", "b",...
Returns true if the point is contained inside the image and 'radius' away from the image border. @param b Image @param x x-coordinate of point @param y y-coordinate of point @param radius How many pixels away from the border it needs to be to be considered inside @return true if the point is inside and false if it is outside
[ "Returns", "true", "if", "the", "point", "is", "contained", "inside", "the", "image", "and", "radius", "away", "from", "the", "image", "border", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/misc/BoofMiscOps.java#L184-L195
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.newInputStream
public static BufferedInputStream newInputStream(URL url, Map parameters) throws MalformedURLException, IOException { return new BufferedInputStream(configuredInputStream(parameters, url)); }
java
public static BufferedInputStream newInputStream(URL url, Map parameters) throws MalformedURLException, IOException { return new BufferedInputStream(configuredInputStream(parameters, url)); }
[ "public", "static", "BufferedInputStream", "newInputStream", "(", "URL", "url", ",", "Map", "parameters", ")", "throws", "MalformedURLException", ",", "IOException", "{", "return", "new", "BufferedInputStream", "(", "configuredInputStream", "(", "parameters", ",", "ur...
Creates a buffered input stream for this URL. The default connection parameters can be modified by adding keys to the <i>parameters map</i>: <ul> <li>connectTimeout : the connection timeout</li> <li>readTimeout : the read timeout</li> <li>useCaches : set the use cache property for the URL connection</li> <li>allowUserInteraction : set the user interaction flag for the URL connection</li> <li>requestProperties : a map of properties to be passed to the URL connection</li> </ul> @param url a URL @param parameters connection parameters @return a BufferedInputStream for the URL @throws MalformedURLException is thrown if the URL is not well formed @throws IOException if an I/O error occurs while creating the input stream @since 1.8.1
[ "Creates", "a", "buffered", "input", "stream", "for", "this", "URL", ".", "The", "default", "connection", "parameters", "can", "be", "modified", "by", "adding", "keys", "to", "the", "<i", ">", "parameters", "map<", "/", "i", ">", ":", "<ul", ">", "<li", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L2218-L2220
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java
AgentUtils.collectLogs
public static Map<String,byte[]> collectLogs( String karafData ) throws IOException { Map<String,byte[]> logFiles = new HashMap<>( 2 ); if( ! Utils.isEmptyOrWhitespaces( karafData )) { String[] names = { "karaf.log", "roboconf.log" }; for( String name : names ) { File log = new File( karafData, AgentConstants.KARAF_LOGS_DIRECTORY + "/" + name ); if( ! log.exists()) continue; String content = Utils.readFileContent( log ); logFiles.put( name, content.getBytes( StandardCharsets.UTF_8 )); } } return logFiles; }
java
public static Map<String,byte[]> collectLogs( String karafData ) throws IOException { Map<String,byte[]> logFiles = new HashMap<>( 2 ); if( ! Utils.isEmptyOrWhitespaces( karafData )) { String[] names = { "karaf.log", "roboconf.log" }; for( String name : names ) { File log = new File( karafData, AgentConstants.KARAF_LOGS_DIRECTORY + "/" + name ); if( ! log.exists()) continue; String content = Utils.readFileContent( log ); logFiles.put( name, content.getBytes( StandardCharsets.UTF_8 )); } } return logFiles; }
[ "public", "static", "Map", "<", "String", ",", "byte", "[", "]", ">", "collectLogs", "(", "String", "karafData", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "byte", "[", "]", ">", "logFiles", "=", "new", "HashMap", "<>", "(", "2", "...
Collect the main log files into a map. @param karafData the Karaf's data directory @return a non-null map
[ "Collect", "the", "main", "log", "files", "into", "a", "map", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/AgentUtils.java#L189-L206
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.setMaintenanceMode
public void setMaintenanceMode(String appName, boolean enable) { connection.execute(new AppUpdate(appName, enable), apiKey); }
java
public void setMaintenanceMode(String appName, boolean enable) { connection.execute(new AppUpdate(appName, enable), apiKey); }
[ "public", "void", "setMaintenanceMode", "(", "String", "appName", ",", "boolean", "enable", ")", "{", "connection", ".", "execute", "(", "new", "AppUpdate", "(", "appName", ",", "enable", ")", ",", "apiKey", ")", ";", "}" ]
Sets maintenance mode for the given app @param appName See {@link #listApps} for a list of apps that can be used. @param enable true to enable; false to disable
[ "Sets", "maintenance", "mode", "for", "the", "given", "app" ]
train
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L403-L405
kaazing/gateway
service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/HttpDirectoryServiceHandler.java
HttpDirectoryServiceHandler.addCacheControl
private void addCacheControl(HttpAcceptSession session, File requestFile, String requestPath) { CacheControlHandler cacheControlHandler = urlCacheControlMap.computeIfAbsent(requestPath, path -> patterns.stream() .filter(patternCacheControl -> PatternMatcherUtils.caseInsensitiveMatch(requestPath, patternCacheControl.getPattern())) .findFirst() .map(patternCacheControl -> new CacheControlHandler(requestFile, patternCacheControl)) .orElse(null) ); if (cacheControlHandler != null) { addCacheControlHeader(session, requestFile, cacheControlHandler); } }
java
private void addCacheControl(HttpAcceptSession session, File requestFile, String requestPath) { CacheControlHandler cacheControlHandler = urlCacheControlMap.computeIfAbsent(requestPath, path -> patterns.stream() .filter(patternCacheControl -> PatternMatcherUtils.caseInsensitiveMatch(requestPath, patternCacheControl.getPattern())) .findFirst() .map(patternCacheControl -> new CacheControlHandler(requestFile, patternCacheControl)) .orElse(null) ); if (cacheControlHandler != null) { addCacheControlHeader(session, requestFile, cacheControlHandler); } }
[ "private", "void", "addCacheControl", "(", "HttpAcceptSession", "session", ",", "File", "requestFile", ",", "String", "requestPath", ")", "{", "CacheControlHandler", "cacheControlHandler", "=", "urlCacheControlMap", ".", "computeIfAbsent", "(", "requestPath", ",", "path...
Matches the file URL with the most specific pattern and caches this information in a map Sets cache-control and expires headers @param session @param requestFile @param requestPath
[ "Matches", "the", "file", "URL", "with", "the", "most", "specific", "pattern", "and", "caches", "this", "information", "in", "a", "map", "Sets", "cache", "-", "control", "and", "expires", "headers" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/HttpDirectoryServiceHandler.java#L311-L323
siom79/japicmp
japicmp/src/main/java/japicmp/cmp/JarArchiveComparator.java
JarArchiveComparator.compareClassLists
List<JApiClass> compareClassLists(JarArchiveComparatorOptions options, List<CtClass> oldClasses, List<CtClass> newClasses) { List<CtClass> oldClassesFiltered = applyFilter(options, oldClasses); List<CtClass> newClassesFiltered = applyFilter(options, newClasses); ClassesComparator classesComparator = new ClassesComparator(this, options); classesComparator.compare(oldClassesFiltered, newClassesFiltered); List<JApiClass> classList = classesComparator.getClasses(); if (LOGGER.isLoggable(Level.FINE)) { for (JApiClass jApiClass : classList) { LOGGER.fine(jApiClass.toString()); } } checkBinaryCompatibility(classList); checkJavaObjectSerializationCompatibility(classList); OutputFilter.sortClassesAndMethods(classList); return classList; }
java
List<JApiClass> compareClassLists(JarArchiveComparatorOptions options, List<CtClass> oldClasses, List<CtClass> newClasses) { List<CtClass> oldClassesFiltered = applyFilter(options, oldClasses); List<CtClass> newClassesFiltered = applyFilter(options, newClasses); ClassesComparator classesComparator = new ClassesComparator(this, options); classesComparator.compare(oldClassesFiltered, newClassesFiltered); List<JApiClass> classList = classesComparator.getClasses(); if (LOGGER.isLoggable(Level.FINE)) { for (JApiClass jApiClass : classList) { LOGGER.fine(jApiClass.toString()); } } checkBinaryCompatibility(classList); checkJavaObjectSerializationCompatibility(classList); OutputFilter.sortClassesAndMethods(classList); return classList; }
[ "List", "<", "JApiClass", ">", "compareClassLists", "(", "JarArchiveComparatorOptions", "options", ",", "List", "<", "CtClass", ">", "oldClasses", ",", "List", "<", "CtClass", ">", "newClasses", ")", "{", "List", "<", "CtClass", ">", "oldClassesFiltered", "=", ...
Compares the two lists with CtClass objects using the provided options instance. @param options the options to use @param oldClasses a list of CtClasses that represent the old version @param newClasses a list of CtClasses that represent the new version @return a list of {@link japicmp.model.JApiClass} that represent the changes
[ "Compares", "the", "two", "lists", "with", "CtClass", "objects", "using", "the", "provided", "options", "instance", "." ]
train
https://github.com/siom79/japicmp/blob/f008ea588eec721c45f568bf1db5074fbcbcfced/japicmp/src/main/java/japicmp/cmp/JarArchiveComparator.java#L203-L218
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpRequestUtils.java
HttpRequestUtils.doesParameterExist
public static boolean doesParameterExist(final HttpServletRequest request, final String name) { val parameter = request.getParameter(name); if (StringUtils.isBlank(parameter)) { LOGGER.error("Missing request parameter: [{}]", name); return false; } LOGGER.debug("Found provided request parameter [{}]", name); return true; }
java
public static boolean doesParameterExist(final HttpServletRequest request, final String name) { val parameter = request.getParameter(name); if (StringUtils.isBlank(parameter)) { LOGGER.error("Missing request parameter: [{}]", name); return false; } LOGGER.debug("Found provided request parameter [{}]", name); return true; }
[ "public", "static", "boolean", "doesParameterExist", "(", "final", "HttpServletRequest", "request", ",", "final", "String", "name", ")", "{", "val", "parameter", "=", "request", ".", "getParameter", "(", "name", ")", ";", "if", "(", "StringUtils", ".", "isBlan...
Check if a parameter exists. @param request the HTTP request @param name the parameter name @return whether the parameter exists
[ "Check", "if", "a", "parameter", "exists", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpRequestUtils.java#L145-L153
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByPassword
public Iterable<DUser> queryByPassword(java.lang.String password) { return queryByField(null, DUserMapper.Field.PASSWORD.getFieldName(), password); }
java
public Iterable<DUser> queryByPassword(java.lang.String password) { return queryByField(null, DUserMapper.Field.PASSWORD.getFieldName(), password); }
[ "public", "Iterable", "<", "DUser", ">", "queryByPassword", "(", "java", ".", "lang", ".", "String", "password", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "PASSWORD", ".", "getFieldName", "(", ")", ",", "passwo...
query-by method for field password @param password the specified attribute @return an Iterable of DUsers for the specified password
[ "query", "-", "by", "method", "for", "field", "password" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L178-L180
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/record/RecordPage.java
RecordPage.insertIntoDeletedSlot
public RecordId insertIntoDeletedSlot() { RecordId nds = getNextDeletedSlotId(); // Important: Erase the free chain information. // If we didn't do this, it would crash when // a tx try to set a VARCHAR at this position // since the getVal would get negative size. setNextDeletedSlotId(new RecordId(new BlockId("", 0), 0)); Constant flag = INUSE_CONST; setVal(currentPos(), flag); return nds; }
java
public RecordId insertIntoDeletedSlot() { RecordId nds = getNextDeletedSlotId(); // Important: Erase the free chain information. // If we didn't do this, it would crash when // a tx try to set a VARCHAR at this position // since the getVal would get negative size. setNextDeletedSlotId(new RecordId(new BlockId("", 0), 0)); Constant flag = INUSE_CONST; setVal(currentPos(), flag); return nds; }
[ "public", "RecordId", "insertIntoDeletedSlot", "(", ")", "{", "RecordId", "nds", "=", "getNextDeletedSlotId", "(", ")", ";", "// Important: Erase the free chain information.\r", "// If we didn't do this, it would crash when\r", "// a tx try to set a VARCHAR at this position\r", "// s...
Inserts a new, blank record into this deleted slot and return the record id of the next one. @return the record id of the next deleted slot
[ "Inserts", "a", "new", "blank", "record", "into", "this", "deleted", "slot", "and", "return", "the", "record", "id", "of", "the", "next", "one", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/record/RecordPage.java#L254-L264
Whiley/WhileyCompiler
src/main/java/wyil/interpreter/Interpreter.java
Interpreter.executeBreak
private Status executeBreak(Stmt.Break stmt, CallStack frame, EnclosingScope scope) { // TODO: the break bytecode supports a non-nearest exit and eventually // this should be supported. return Status.BREAK; }
java
private Status executeBreak(Stmt.Break stmt, CallStack frame, EnclosingScope scope) { // TODO: the break bytecode supports a non-nearest exit and eventually // this should be supported. return Status.BREAK; }
[ "private", "Status", "executeBreak", "(", "Stmt", ".", "Break", "stmt", ",", "CallStack", "frame", ",", "EnclosingScope", "scope", ")", "{", "// TODO: the break bytecode supports a non-nearest exit and eventually", "// this should be supported.", "return", "Status", ".", "B...
Execute a break statement. This transfers to control out of the nearest enclosing loop. @param stmt --- Break statement. @param frame --- The current stack frame @return
[ "Execute", "a", "break", "statement", ".", "This", "transfers", "to", "control", "out", "of", "the", "nearest", "enclosing", "loop", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L282-L286
jparsec/jparsec
jparsec/src/main/java/org/jparsec/internal/util/Checks.java
Checks.checkNotNullState
public static void checkNotNullState(Object object, String message, Object... args) { checkState(object != null, message, args); }
java
public static void checkNotNullState(Object object, String message, Object... args) { checkState(object != null, message, args); }
[ "public", "static", "void", "checkNotNullState", "(", "Object", "object", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "checkState", "(", "object", "!=", "null", ",", "message", ",", "args", ")", ";", "}" ]
Checks that {@code object} is not null. @param object the object that cannot be null @param message the error message if {@code condition} is false @param args the arguments to the error message @throws IllegalStateException if {@code object} is null
[ "Checks", "that", "{", "@code", "object", "}", "is", "not", "null", "." ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/internal/util/Checks.java#L119-L121
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/ServerSocketEndpointConfig.java
ServerSocketEndpointConfig.setPort
public ServerSocketEndpointConfig setPort(int port) { if (port < 0 || port > PORT_MAX) { throw new IllegalArgumentException("Port out of range: " + port + ". Allowed range [0,65535]"); } this.port = port; return this; }
java
public ServerSocketEndpointConfig setPort(int port) { if (port < 0 || port > PORT_MAX) { throw new IllegalArgumentException("Port out of range: " + port + ". Allowed range [0,65535]"); } this.port = port; return this; }
[ "public", "ServerSocketEndpointConfig", "setPort", "(", "int", "port", ")", "{", "if", "(", "port", "<", "0", "||", "port", ">", "PORT_MAX", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Port out of range: \"", "+", "port", "+", "\". Allowed rang...
Sets the port the Hazelcast member will try to bind on. A valid port value is between 0 and 65535. A port number of 0 will let the system pick up an ephemeral port. @param port the port the Hazelcast member will try to bind on @return NetworkConfig the updated NetworkConfig @see #getPort() @see #setPortAutoIncrement(boolean) for more information
[ "Sets", "the", "port", "the", "Hazelcast", "member", "will", "try", "to", "bind", "on", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/ServerSocketEndpointConfig.java#L97-L103
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java
ClassPathBuilder.addWorkListItemsForClasspath
private void addWorkListItemsForClasspath(LinkedList<WorkListItem> workList, String path) { if (path == null) { return; } StringTokenizer st = new StringTokenizer(path, File.pathSeparator); while (st.hasMoreTokens()) { String entry = st.nextToken(); if (DEBUG) { System.out.println("System classpath entry: " + entry); } addToWorkList(workList, new WorkListItem(classFactory.createFilesystemCodeBaseLocator(entry), false, ICodeBase.Discovered.IN_SYSTEM_CLASSPATH)); } }
java
private void addWorkListItemsForClasspath(LinkedList<WorkListItem> workList, String path) { if (path == null) { return; } StringTokenizer st = new StringTokenizer(path, File.pathSeparator); while (st.hasMoreTokens()) { String entry = st.nextToken(); if (DEBUG) { System.out.println("System classpath entry: " + entry); } addToWorkList(workList, new WorkListItem(classFactory.createFilesystemCodeBaseLocator(entry), false, ICodeBase.Discovered.IN_SYSTEM_CLASSPATH)); } }
[ "private", "void", "addWorkListItemsForClasspath", "(", "LinkedList", "<", "WorkListItem", ">", "workList", ",", "String", "path", ")", "{", "if", "(", "path", "==", "null", ")", "{", "return", ";", "}", "StringTokenizer", "st", "=", "new", "StringTokenizer", ...
Add worklist items from given system classpath. @param workList the worklist @param path a system classpath
[ "Add", "worklist", "items", "from", "given", "system", "classpath", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L519-L533
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/internal/BcUtils.java
BcUtils.getAsymmetricKeyParameter
public static AsymmetricKeyParameter getAsymmetricKeyParameter(PublicKeyParameters publicKey) { if (publicKey instanceof BcAsymmetricKeyParameters) { return ((BcAsymmetricKeyParameters) publicKey).getParameters(); } else { try { return PublicKeyFactory.createKey(publicKey.getEncoded()); } catch (IOException e) { // Very unlikely throw new IllegalArgumentException("Invalid public key, unable to encode."); } } }
java
public static AsymmetricKeyParameter getAsymmetricKeyParameter(PublicKeyParameters publicKey) { if (publicKey instanceof BcAsymmetricKeyParameters) { return ((BcAsymmetricKeyParameters) publicKey).getParameters(); } else { try { return PublicKeyFactory.createKey(publicKey.getEncoded()); } catch (IOException e) { // Very unlikely throw new IllegalArgumentException("Invalid public key, unable to encode."); } } }
[ "public", "static", "AsymmetricKeyParameter", "getAsymmetricKeyParameter", "(", "PublicKeyParameters", "publicKey", ")", "{", "if", "(", "publicKey", "instanceof", "BcAsymmetricKeyParameters", ")", "{", "return", "(", "(", "BcAsymmetricKeyParameters", ")", "publicKey", ")...
Convert public key parameters to asymmetric key parameter. @param publicKey the public key parameter to convert. @return an asymmetric key parameter.
[ "Convert", "public", "key", "parameters", "to", "asymmetric", "key", "parameter", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/internal/BcUtils.java#L89-L102
lucee/Lucee
core/src/main/java/lucee/commons/io/res/util/ResourceSnippetsMap.java
ResourceSnippetsMap.getSnippet
public ResourceSnippet getSnippet(PageSource ps, int startPos, int endPos, String charset) { String keySnp = calcKey(ps, startPos, endPos); synchronized (sync) { ResourceSnippet snippet = snippets.get(keySnp); if (snippet == null) { Resource res = ps.getResource(); String keyRes = calcKey(res); String src = sources.get(keyRes); if (src == null) { src = ResourceSnippet.getContents(res, charset); sources.put(keyRes, src); } snippet = ResourceSnippet.createResourceSnippet(src, startPos, endPos); snippets.put(keySnp, snippet); } return snippet; } }
java
public ResourceSnippet getSnippet(PageSource ps, int startPos, int endPos, String charset) { String keySnp = calcKey(ps, startPos, endPos); synchronized (sync) { ResourceSnippet snippet = snippets.get(keySnp); if (snippet == null) { Resource res = ps.getResource(); String keyRes = calcKey(res); String src = sources.get(keyRes); if (src == null) { src = ResourceSnippet.getContents(res, charset); sources.put(keyRes, src); } snippet = ResourceSnippet.createResourceSnippet(src, startPos, endPos); snippets.put(keySnp, snippet); } return snippet; } }
[ "public", "ResourceSnippet", "getSnippet", "(", "PageSource", "ps", ",", "int", "startPos", ",", "int", "endPos", ",", "String", "charset", ")", "{", "String", "keySnp", "=", "calcKey", "(", "ps", ",", "startPos", ",", "endPos", ")", ";", "synchronized", "...
this method accesses the underlying Map(s) and is therefore synchronized @param ps @param startPos @param endPos @param charset @return
[ "this", "method", "accesses", "the", "underlying", "Map", "(", "s", ")", "and", "is", "therefore", "synchronized" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceSnippetsMap.java#L50-L67
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.registerUnmarshaller
public final <S, T> void registerUnmarshaller(ConverterKey<S,T> key, FromUnmarshaller<S, T> converter) { registerConverter(key.invert(), new FromUnmarshallerConverter<S,T>(converter)); }
java
public final <S, T> void registerUnmarshaller(ConverterKey<S,T> key, FromUnmarshaller<S, T> converter) { registerConverter(key.invert(), new FromUnmarshallerConverter<S,T>(converter)); }
[ "public", "final", "<", "S", ",", "T", ">", "void", "registerUnmarshaller", "(", "ConverterKey", "<", "S", ",", "T", ">", "key", ",", "FromUnmarshaller", "<", "S", ",", "T", ">", "converter", ")", "{", "registerConverter", "(", "key", ".", "invert", "(...
Register an UnMarshaller with the given source and target class. The unmarshaller is used as follows: Instances of the source can be marshalled into the target class. @param key Converter Key to use @param converter The FromUnmarshaller to be registered
[ "Register", "an", "UnMarshaller", "with", "the", "given", "source", "and", "target", "class", ".", "The", "unmarshaller", "is", "used", "as", "follows", ":", "Instances", "of", "the", "source", "can", "be", "marshalled", "into", "the", "target", "class", "."...
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L633-L635
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java
ImageLoader.loadImage
public void loadImage(String uri, ImageSize targetImageSize, ImageLoadingListener listener) { loadImage(uri, targetImageSize, null, listener, null); }
java
public void loadImage(String uri, ImageSize targetImageSize, ImageLoadingListener listener) { loadImage(uri, targetImageSize, null, listener, null); }
[ "public", "void", "loadImage", "(", "String", "uri", ",", "ImageSize", "targetImageSize", ",", "ImageLoadingListener", "listener", ")", "{", "loadImage", "(", "uri", ",", "targetImageSize", ",", "null", ",", "listener", ",", "null", ")", ";", "}" ]
Adds load image task to execution pool. Image will be returned with {@link ImageLoadingListener#onLoadingComplete(String, android.view.View, android.graphics.Bitmap)} callback}. <br /> <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") @param targetImageSize Minimal size for {@link Bitmap} which will be returned in {@linkplain ImageLoadingListener#onLoadingComplete(String, android.view.View, android.graphics.Bitmap)} callback}. Downloaded image will be decoded and scaled to {@link Bitmap} of the size which is <b>equal or larger</b> (usually a bit larger) than incoming targetImageSize. @param listener {@linkplain ImageLoadingListener Listener} for image loading process. Listener fires events on UI thread if this method is called on UI thread. @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before
[ "Adds", "load", "image", "task", "to", "execution", "pool", ".", "Image", "will", "be", "returned", "with", "{", "@link", "ImageLoadingListener#onLoadingComplete", "(", "String", "android", ".", "view", ".", "View", "android", ".", "graphics", ".", "Bitmap", "...
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java#L444-L446
drewnoakes/metadata-extractor
Source/com/drew/imaging/jpeg/JpegSegmentData.java
JpegSegmentData.removeSegmentOccurrence
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"}) public void removeSegmentOccurrence(@NotNull JpegSegmentType segmentType, int occurrence) { removeSegmentOccurrence(segmentType.byteValue, occurrence); }
java
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"}) public void removeSegmentOccurrence(@NotNull JpegSegmentType segmentType, int occurrence) { removeSegmentOccurrence(segmentType.byteValue, occurrence); }
[ "@", "SuppressWarnings", "(", "{", "\"MismatchedQueryAndUpdateOfCollection\"", "}", ")", "public", "void", "removeSegmentOccurrence", "(", "@", "NotNull", "JpegSegmentType", "segmentType", ",", "int", "occurrence", ")", "{", "removeSegmentOccurrence", "(", "segmentType", ...
Removes a specified instance of a segment's data from the collection. Use this method when more than one occurrence of segment data exists for a given type exists. @param segmentType identifies the required segment @param occurrence the zero-based index of the segment occurrence to remove.
[ "Removes", "a", "specified", "instance", "of", "a", "segment", "s", "data", "from", "the", "collection", ".", "Use", "this", "method", "when", "more", "than", "one", "occurrence", "of", "segment", "data", "exists", "for", "a", "given", "type", "exists", "....
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/imaging/jpeg/JpegSegmentData.java#L209-L213
JetBrains/xodus
vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java
VirtualFileSystem.deleteFile
@Nullable public File deleteFile(@NotNull final Transaction txn, @NotNull final String path) { final ArrayByteIterable key = StringBinding.stringToEntry(path); final ByteIterable fileMetadata; try (Cursor cursor = pathnames.openCursor(txn)) { fileMetadata = cursor.getSearchKey(key); if (fileMetadata != null) { cursor.deleteCurrent(); } } if (fileMetadata != null) { final File result = new File(path, fileMetadata); // at first delete contents try (ClusterIterator iterator = new ClusterIterator(this, txn, result)) { while (iterator.hasCluster()) { iterator.deleteCurrent(); iterator.moveToNext(); } } return result; } return null; }
java
@Nullable public File deleteFile(@NotNull final Transaction txn, @NotNull final String path) { final ArrayByteIterable key = StringBinding.stringToEntry(path); final ByteIterable fileMetadata; try (Cursor cursor = pathnames.openCursor(txn)) { fileMetadata = cursor.getSearchKey(key); if (fileMetadata != null) { cursor.deleteCurrent(); } } if (fileMetadata != null) { final File result = new File(path, fileMetadata); // at first delete contents try (ClusterIterator iterator = new ClusterIterator(this, txn, result)) { while (iterator.hasCluster()) { iterator.deleteCurrent(); iterator.moveToNext(); } } return result; } return null; }
[ "@", "Nullable", "public", "File", "deleteFile", "(", "@", "NotNull", "final", "Transaction", "txn", ",", "@", "NotNull", "final", "String", "path", ")", "{", "final", "ArrayByteIterable", "key", "=", "StringBinding", ".", "stringToEntry", "(", "path", ")", ...
Deletes existing file with the specified {@code path}. @param txn {@linkplain Transaction} instance @param path file path @return deleted {@linkplain File} or {@code null} if no file with specified {@code path}exists. @see File
[ "Deletes", "existing", "file", "with", "the", "specified", "{", "@code", "path", "}", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java#L309-L331
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java
CFMLExpressionInterpreter.orOp
private Ref orOp() throws PageException { Ref ref = andOp(); while (cfml.isValidIndex() && (cfml.forwardIfCurrent("||") || cfml.forwardIfCurrent("or"))) { cfml.removeSpace(); ref = new Or(ref, andOp(), limited); } return ref; }
java
private Ref orOp() throws PageException { Ref ref = andOp(); while (cfml.isValidIndex() && (cfml.forwardIfCurrent("||") || cfml.forwardIfCurrent("or"))) { cfml.removeSpace(); ref = new Or(ref, andOp(), limited); } return ref; }
[ "private", "Ref", "orOp", "(", ")", "throws", "PageException", "{", "Ref", "ref", "=", "andOp", "(", ")", ";", "while", "(", "cfml", ".", "isValidIndex", "(", ")", "&&", "(", "cfml", ".", "forwardIfCurrent", "(", "\"||\"", ")", "||", "cfml", ".", "fo...
Transfomiert eine Or (or) Operation. Im Gegensatz zu CFMX , werden "||" Zeichen auch als Or Operatoren anerkannt. <br /> EBNF:<br /> <code>andOp {("or" | "||") spaces andOp}; (* "||" Existiert in CFMX nicht *)</code> @return CFXD Element @throws PageException
[ "Transfomiert", "eine", "Or", "(", "or", ")", "Operation", ".", "Im", "Gegensatz", "zu", "CFMX", "werden", "||", "Zeichen", "auch", "als", "Or", "Operatoren", "anerkannt", ".", "<br", "/", ">", "EBNF", ":", "<br", "/", ">", "<code", ">", "andOp", "{", ...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java#L398-L405
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java
Hierarchy.findXMethod
@Deprecated public static @CheckForNull XMethod findXMethod(JavaClass javaClass, String methodName, String methodSig, JavaClassAndMethodChooser chooser) { JavaClassAndMethod result = findMethod(javaClass, methodName, methodSig, chooser); return result == null ? null : XFactory.createXMethod(result.getJavaClass(), result.getMethod()); }
java
@Deprecated public static @CheckForNull XMethod findXMethod(JavaClass javaClass, String methodName, String methodSig, JavaClassAndMethodChooser chooser) { JavaClassAndMethod result = findMethod(javaClass, methodName, methodSig, chooser); return result == null ? null : XFactory.createXMethod(result.getJavaClass(), result.getMethod()); }
[ "@", "Deprecated", "public", "static", "@", "CheckForNull", "XMethod", "findXMethod", "(", "JavaClass", "javaClass", ",", "String", "methodName", ",", "String", "methodSig", ",", "JavaClassAndMethodChooser", "chooser", ")", "{", "JavaClassAndMethod", "result", "=", ...
Find a method in given class. @param javaClass the class @param methodName the name of the method @param methodSig the signature of the method @param chooser the JavaClassAndMethodChooser to use to screen possible candidates @return the XMethod, or null if no such method exists in the class
[ "Find", "a", "method", "in", "given", "class", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L534-L539
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/LogQueryBean.java
LogQueryBean.setTime
public void setTime(Date minTime, Date maxTime) throws IllegalArgumentException { if (minTime != null && maxTime != null && minTime.after(maxTime)) { throw new IllegalArgumentException("Value of the minTime parameter should specify time before the time specified by the value of the maxTime parameter"); } this.minTime = minTime; this.maxTime = maxTime; }
java
public void setTime(Date minTime, Date maxTime) throws IllegalArgumentException { if (minTime != null && maxTime != null && minTime.after(maxTime)) { throw new IllegalArgumentException("Value of the minTime parameter should specify time before the time specified by the value of the maxTime parameter"); } this.minTime = minTime; this.maxTime = maxTime; }
[ "public", "void", "setTime", "(", "Date", "minTime", ",", "Date", "maxTime", ")", "throws", "IllegalArgumentException", "{", "if", "(", "minTime", "!=", "null", "&&", "maxTime", "!=", "null", "&&", "minTime", ".", "after", "(", "maxTime", ")", ")", "{", ...
sets the current value for the minimum and maximum time @param minTime minimum time @param maxTime maximum time @throws IllegalArgumentException if minTime is later than maxTime
[ "sets", "the", "current", "value", "for", "the", "minimum", "and", "maximum", "time" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/LogQueryBean.java#L70-L76
phax/ph-commons
ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java
JAXBMarshallerHelper.setFormattedOutput
public static void setFormattedOutput (@Nonnull final Marshaller aMarshaller, final boolean bFormattedOutput) { _setProperty (aMarshaller, Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.valueOf (bFormattedOutput)); }
java
public static void setFormattedOutput (@Nonnull final Marshaller aMarshaller, final boolean bFormattedOutput) { _setProperty (aMarshaller, Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.valueOf (bFormattedOutput)); }
[ "public", "static", "void", "setFormattedOutput", "(", "@", "Nonnull", "final", "Marshaller", "aMarshaller", ",", "final", "boolean", "bFormattedOutput", ")", "{", "_setProperty", "(", "aMarshaller", ",", "Marshaller", ".", "JAXB_FORMATTED_OUTPUT", ",", "Boolean", "...
Set the standard property for formatting the output or not. @param aMarshaller The marshaller to set the property. May not be <code>null</code>. @param bFormattedOutput the value to be set
[ "Set", "the", "standard", "property", "for", "formatting", "the", "output", "or", "not", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L130-L133
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/transport/netty/DcpMessageHandler.java
DcpMessageHandler.unsafeSendRequest
private void unsafeSendRequest(final ChannelHandlerContext ctx, final ByteBuf request, final Promise<DcpResponse> promise) { if (!ctx.executor().inEventLoop()) { throw new IllegalStateException("Must not be called outside event loop"); } try { final int opaque = nextOpaque++; MessageUtil.setOpaque(opaque, request); // Don't need to be notified if/when the bytes are written, // so use void promise to save an allocation. ctx.writeAndFlush(request, ctx.voidPromise()); outstandingRequests.add(new OutstandingRequest(opaque, promise)); } catch (Throwable t) { promise.setFailure(t); } }
java
private void unsafeSendRequest(final ChannelHandlerContext ctx, final ByteBuf request, final Promise<DcpResponse> promise) { if (!ctx.executor().inEventLoop()) { throw new IllegalStateException("Must not be called outside event loop"); } try { final int opaque = nextOpaque++; MessageUtil.setOpaque(opaque, request); // Don't need to be notified if/when the bytes are written, // so use void promise to save an allocation. ctx.writeAndFlush(request, ctx.voidPromise()); outstandingRequests.add(new OutstandingRequest(opaque, promise)); } catch (Throwable t) { promise.setFailure(t); } }
[ "private", "void", "unsafeSendRequest", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "ByteBuf", "request", ",", "final", "Promise", "<", "DcpResponse", ">", "promise", ")", "{", "if", "(", "!", "ctx", ".", "executor", "(", ")", ".", "inEventLo...
Writes the request to the channel and records the promise in the outstanding request queue. <p> "Unsafe" because this method must only be called in the event loop thread, to ensure it never runs concurrently with {@link #channelInactive}, and so that outstanding requests are enqueued in the same order they are written to the channel.
[ "Writes", "the", "request", "to", "the", "channel", "and", "records", "the", "promise", "in", "the", "outstanding", "request", "queue", ".", "<p", ">", "Unsafe", "because", "this", "method", "must", "only", "be", "called", "in", "the", "event", "loop", "th...
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/transport/netty/DcpMessageHandler.java#L256-L276
threerings/narya
core/src/main/java/com/threerings/presents/client/ClientDObjectMgr.java
ClientDObjectMgr.dispatchEvent
protected void dispatchEvent (DEvent event) { // Log.info("Dispatching event: " + evt); // look up the object on which we're dispatching this event int remoteOid = event.getTargetOid(); DObject target = _ocache.get(remoteOid); if (target == null) { if (!_dead.containsKey(remoteOid)) { log.warning("Unable to dispatch event on non-proxied object " + event + "."); } return; } // because we might be acting as a proxy for a remote server, we may need to fiddle with // this event before we dispatch it _client.convertFromRemote(target, event); // if this is a compound event, we need to process its contained events in order if (event instanceof CompoundEvent) { // notify our proxy subscribers in one fell swoop target.notifyProxies(event); // now break the event up and dispatch each event to listeners individually List<DEvent> events = ((CompoundEvent)event).getEvents(); int ecount = events.size(); for (int ii = 0; ii < ecount; ii++) { dispatchEvent(remoteOid, target, events.get(ii)); } } else { // forward to any proxies (or not if we're dispatching part of a compound event) target.notifyProxies(event); // and dispatch the event to regular listeners dispatchEvent(remoteOid, target, event); } }
java
protected void dispatchEvent (DEvent event) { // Log.info("Dispatching event: " + evt); // look up the object on which we're dispatching this event int remoteOid = event.getTargetOid(); DObject target = _ocache.get(remoteOid); if (target == null) { if (!_dead.containsKey(remoteOid)) { log.warning("Unable to dispatch event on non-proxied object " + event + "."); } return; } // because we might be acting as a proxy for a remote server, we may need to fiddle with // this event before we dispatch it _client.convertFromRemote(target, event); // if this is a compound event, we need to process its contained events in order if (event instanceof CompoundEvent) { // notify our proxy subscribers in one fell swoop target.notifyProxies(event); // now break the event up and dispatch each event to listeners individually List<DEvent> events = ((CompoundEvent)event).getEvents(); int ecount = events.size(); for (int ii = 0; ii < ecount; ii++) { dispatchEvent(remoteOid, target, events.get(ii)); } } else { // forward to any proxies (or not if we're dispatching part of a compound event) target.notifyProxies(event); // and dispatch the event to regular listeners dispatchEvent(remoteOid, target, event); } }
[ "protected", "void", "dispatchEvent", "(", "DEvent", "event", ")", "{", "// Log.info(\"Dispatching event: \" + evt);", "// look up the object on which we're dispatching this event", "int", "remoteOid", "=", "event", ".", "getTargetOid", "(", ")", ";", "DObject", "targ...
Called when a new event arrives from the server that should be dispatched to subscribers here on the client.
[ "Called", "when", "a", "new", "event", "arrives", "from", "the", "server", "that", "should", "be", "dispatched", "to", "subscribers", "here", "on", "the", "client", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/ClientDObjectMgr.java#L277-L314
morimekta/utils
io-util/src/main/java/net/morimekta/util/Base64.java
Base64.encodeToString
public static String encodeToString(final byte[] source, int off, int len) { byte[] encoded = encode(source, off, len); return new String(encoded, US_ASCII); }
java
public static String encodeToString(final byte[] source, int off, int len) { byte[] encoded = encode(source, off, len); return new String(encoded, US_ASCII); }
[ "public", "static", "String", "encodeToString", "(", "final", "byte", "[", "]", "source", ",", "int", "off", ",", "int", "len", ")", "{", "byte", "[", "]", "encoded", "=", "encode", "(", "source", ",", "off", ",", "len", ")", ";", "return", "new", ...
Encodes a byte array into Base64 string. @param source The data to convert @param off The data offset of what to encode. @param len The number of bytes to encode. @return The Base64-encoded data as a String @throws NullPointerException if source array is null @since 2.0
[ "Encodes", "a", "byte", "array", "into", "Base64", "string", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/Base64.java#L190-L193
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java
NNStorage.setFields
@Override // Storage protected void setFields(Properties props, StorageDirectory sd) throws IOException { super.setFields(props, sd); boolean uState = getDistributedUpgradeState(); int uVersion = getDistributedUpgradeVersion(); if (uState && uVersion != getLayoutVersion()) { props.setProperty("distributedUpgradeState", Boolean.toString(uState)); props .setProperty("distributedUpgradeVersion", Integer.toString(uVersion)); } }
java
@Override // Storage protected void setFields(Properties props, StorageDirectory sd) throws IOException { super.setFields(props, sd); boolean uState = getDistributedUpgradeState(); int uVersion = getDistributedUpgradeVersion(); if (uState && uVersion != getLayoutVersion()) { props.setProperty("distributedUpgradeState", Boolean.toString(uState)); props .setProperty("distributedUpgradeVersion", Integer.toString(uVersion)); } }
[ "@", "Override", "// Storage ", "protected", "void", "setFields", "(", "Properties", "props", ",", "StorageDirectory", "sd", ")", "throws", "IOException", "{", "super", ".", "setFields", "(", "props", ",", "sd", ")", ";", "boolean", "uState", "=", "getDistrib...
Write version file into the storage directory. The version file should always be written last. Missing or corrupted version file indicates that the checkpoint is not valid. @param sd storage directory @throws IOException
[ "Write", "version", "file", "into", "the", "storage", "directory", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/NNStorage.java#L675-L686