repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getPvPGameInfo
public void getPvPGameInfo(String api, String[] ids, Callback<List<PvPGame>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, api), new ParamChecker(ids)); gw2API.getPvPGameInfo(api, processIds(ids)).enqueue(callback); }
java
public void getPvPGameInfo(String api, String[] ids, Callback<List<PvPGame>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, api), new ParamChecker(ids)); gw2API.getPvPGameInfo(api, processIds(ids)).enqueue(callback); }
[ "public", "void", "getPvPGameInfo", "(", "String", "api", ",", "String", "[", "]", "ids", ",", "Callback", "<", "List", "<", "PvPGame", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", ...
For more info on pvp games API go <a href="https://wiki.guildwars2.com/wiki/API:2/pvp/games">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param api Guild Wars 2 API key @param ids list of pvp game id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see PvPGame pvp game info
[ "For", "more", "info", "on", "pvp", "games", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "pvp", "/", "games", ">", "here<", "/", "a", ">", "<br", "/", ">", ...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2054-L2057
apache/incubator-druid
core/src/main/java/org/apache/druid/java/util/emitter/core/Batch.java
Batch.tryReserveEventSizeAndLock
private int tryReserveEventSizeAndLock(long state, int size) { Preconditions.checkArgument(size > 0); int bufferWatermark = bufferWatermark(state); while (true) { if (compareAndSetState(state, state + size + PARTY)) { return bufferWatermark; } state = getState(); if (isSealed(state)) { return -1; } bufferWatermark = bufferWatermark(state); int newBufferWatermark = bufferWatermark + size; Preconditions.checkState(newBufferWatermark > 0); if (newBufferWatermark > emitter.maxBufferWatermark) { return -1; } } }
java
private int tryReserveEventSizeAndLock(long state, int size) { Preconditions.checkArgument(size > 0); int bufferWatermark = bufferWatermark(state); while (true) { if (compareAndSetState(state, state + size + PARTY)) { return bufferWatermark; } state = getState(); if (isSealed(state)) { return -1; } bufferWatermark = bufferWatermark(state); int newBufferWatermark = bufferWatermark + size; Preconditions.checkState(newBufferWatermark > 0); if (newBufferWatermark > emitter.maxBufferWatermark) { return -1; } } }
[ "private", "int", "tryReserveEventSizeAndLock", "(", "long", "state", ",", "int", "size", ")", "{", "Preconditions", ".", "checkArgument", "(", "size", ">", "0", ")", ";", "int", "bufferWatermark", "=", "bufferWatermark", "(", "state", ")", ";", "while", "("...
Returns the buffer offset at which the caller has reserved the ability to write `size` bytes exclusively, or negative number, if the reservation attempt failed.
[ "Returns", "the", "buffer", "offset", "at", "which", "the", "caller", "has", "reserved", "the", "ability", "to", "write", "size", "bytes", "exclusively", "or", "negative", "number", "if", "the", "reservation", "attempt", "failed", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/emitter/core/Batch.java#L198-L217
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addErrorsCrudCouldNotFindCrudTable
public FessMessages addErrorsCrudCouldNotFindCrudTable(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_crud_could_not_find_crud_table, arg0)); return this; }
java
public FessMessages addErrorsCrudCouldNotFindCrudTable(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_crud_could_not_find_crud_table, arg0)); return this; }
[ "public", "FessMessages", "addErrorsCrudCouldNotFindCrudTable", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "ERRORS_crud_could_not_find_crud_table...
Add the created action message for the key 'errors.crud_could_not_find_crud_table' with parameters. <pre> message: Could not find the data({0}). </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "errors", ".", "crud_could_not_find_crud_table", "with", "parameters", ".", "<pre", ">", "message", ":", "Could", "not", "find", "the", "data", "(", "{", "0", "}", ")", ".", "<", "/", "pr...
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2170-L2174
liferay/com-liferay-commerce
commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java
CommerceWishListPersistenceImpl.findByUserId
@Override public List<CommerceWishList> findByUserId(long userId, int start, int end) { return findByUserId(userId, start, end, null); }
java
@Override public List<CommerceWishList> findByUserId(long userId, int start, int end) { return findByUserId(userId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceWishList", ">", "findByUserId", "(", "long", "userId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByUserId", "(", "userId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce wish lists where userId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceWishListModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param userId the user ID @param start the lower bound of the range of commerce wish lists @param end the upper bound of the range of commerce wish lists (not inclusive) @return the range of matching commerce wish lists
[ "Returns", "a", "range", "of", "all", "the", "commerce", "wish", "lists", "where", "userId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java#L2040-L2043
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getCentroid
public static final Atom getCentroid(Atom[] atomSet){ // if we don't catch this case, the centroid returned is (NaN,NaN,NaN), which can cause lots of problems down the line if (atomSet.length==0) throw new IllegalArgumentException("Atom array has length 0, can't calculate centroid!"); double[] coords = new double[3]; coords[0] = 0; coords[1] = 0; coords[2] = 0 ; for (Atom a : atomSet) { coords[0] += a.getX(); coords[1] += a.getY(); coords[2] += a.getZ(); } int n = atomSet.length; coords[0] = coords[0] / n; coords[1] = coords[1] / n; coords[2] = coords[2] / n; Atom vec = new AtomImpl(); vec.setCoords(coords); return vec; }
java
public static final Atom getCentroid(Atom[] atomSet){ // if we don't catch this case, the centroid returned is (NaN,NaN,NaN), which can cause lots of problems down the line if (atomSet.length==0) throw new IllegalArgumentException("Atom array has length 0, can't calculate centroid!"); double[] coords = new double[3]; coords[0] = 0; coords[1] = 0; coords[2] = 0 ; for (Atom a : atomSet) { coords[0] += a.getX(); coords[1] += a.getY(); coords[2] += a.getZ(); } int n = atomSet.length; coords[0] = coords[0] / n; coords[1] = coords[1] / n; coords[2] = coords[2] / n; Atom vec = new AtomImpl(); vec.setCoords(coords); return vec; }
[ "public", "static", "final", "Atom", "getCentroid", "(", "Atom", "[", "]", "atomSet", ")", "{", "// if we don't catch this case, the centroid returned is (NaN,NaN,NaN), which can cause lots of problems down the line", "if", "(", "atomSet", ".", "length", "==", "0", ")", "th...
Returns the centroid of the set of atoms. @param atomSet a set of Atoms @return an Atom representing the Centroid of the set of atoms
[ "Returns", "the", "centroid", "of", "the", "set", "of", "atoms", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L771-L799
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLFilterImpl.java
XMLFilterImpl.setFeature
public void setFeature (String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (parent != null) { parent.setFeature(name, value); } else { throw new SAXNotRecognizedException("Feature: " + name); } }
java
public void setFeature (String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (parent != null) { parent.setFeature(name, value); } else { throw new SAXNotRecognizedException("Feature: " + name); } }
[ "public", "void", "setFeature", "(", "String", "name", ",", "boolean", "value", ")", "throws", "SAXNotRecognizedException", ",", "SAXNotSupportedException", "{", "if", "(", "parent", "!=", "null", ")", "{", "parent", ".", "setFeature", "(", "name", ",", "value...
Set the value of a feature. <p>This will always fail if the parent is null.</p> @param name The feature name. @param value The requested feature value. @exception org.xml.sax.SAXNotRecognizedException If the feature value can't be assigned or retrieved from the parent. @exception org.xml.sax.SAXNotSupportedException When the parent recognizes the feature name but cannot set the requested value.
[ "Set", "the", "value", "of", "a", "feature", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLFilterImpl.java#L149-L157
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/function/Actions.java
Actions.toFunc
public static <T1, T2, T3, T4, T5, T6, T7, T8> Func8<T1, T2, T3, T4, T5, T6, T7, T8, Void> toFunc( final Action8<T1, T2, T3, T4, T5, T6, T7, T8> action) { return toFunc(action, (Void) null); }
java
public static <T1, T2, T3, T4, T5, T6, T7, T8> Func8<T1, T2, T3, T4, T5, T6, T7, T8, Void> toFunc( final Action8<T1, T2, T3, T4, T5, T6, T7, T8> action) { return toFunc(action, (Void) null); }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "T8", ">", "Func8", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "T8", ",", "Void", ">", "toFunc", ...
Converts an {@link Action8} to a function that calls the action and returns {@code null}. @param action the {@link Action8} to convert @return a {@link Func8} that calls {@code action} and returns {@code null}
[ "Converts", "an", "{", "@link", "Action8", "}", "to", "a", "function", "that", "calls", "the", "action", "and", "returns", "{", "@code", "null", "}", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L168-L171
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.getByResourceGroup
public VirtualNetworkGatewayConnectionInner getByResourceGroup(String resourceGroupName, String virtualNetworkGatewayConnectionName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName).toBlocking().single().body(); }
java
public VirtualNetworkGatewayConnectionInner getByResourceGroup(String resourceGroupName, String virtualNetworkGatewayConnectionName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName).toBlocking().single().body(); }
[ "public", "VirtualNetworkGatewayConnectionInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayCon...
Gets the specified virtual network gateway connection by resource group. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @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 VirtualNetworkGatewayConnectionInner object if successful.
[ "Gets", "the", "specified", "virtual", "network", "gateway", "connection", "by", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L306-L308
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/EncodingInfo.java
EncodingInfo.inEncoding
private static boolean inEncoding(char ch, String encoding) { boolean isInEncoding; try { char cArray[] = new char[1]; cArray[0] = ch; // Construct a String from the char String s = new String(cArray); // Encode the String into a sequence of bytes // using the given, named charset. byte[] bArray = s.getBytes(encoding); isInEncoding = inEncoding(ch, bArray); } catch (Exception e) { isInEncoding = false; // If for some reason the encoding is null, e.g. // for a temporary result tree, we should just // say that every character is in the encoding. if (encoding == null) isInEncoding = true; } return isInEncoding; }
java
private static boolean inEncoding(char ch, String encoding) { boolean isInEncoding; try { char cArray[] = new char[1]; cArray[0] = ch; // Construct a String from the char String s = new String(cArray); // Encode the String into a sequence of bytes // using the given, named charset. byte[] bArray = s.getBytes(encoding); isInEncoding = inEncoding(ch, bArray); } catch (Exception e) { isInEncoding = false; // If for some reason the encoding is null, e.g. // for a temporary result tree, we should just // say that every character is in the encoding. if (encoding == null) isInEncoding = true; } return isInEncoding; }
[ "private", "static", "boolean", "inEncoding", "(", "char", "ch", ",", "String", "encoding", ")", "{", "boolean", "isInEncoding", ";", "try", "{", "char", "cArray", "[", "]", "=", "new", "char", "[", "1", "]", ";", "cArray", "[", "0", "]", "=", "ch", ...
This is heart of the code that determines if a given character is in the given encoding. This method is probably expensive, and the answer should be cached. <p> This method is not a public API, and should only be used internally within the serializer. @param ch the char in question, that is not a high char of a high/low surrogate pair. @param encoding the Java name of the enocding. @xsl.usage internal
[ "This", "is", "heart", "of", "the", "code", "that", "determines", "if", "a", "given", "character", "is", "in", "the", "given", "encoding", ".", "This", "method", "is", "probably", "expensive", "and", "the", "answer", "should", "be", "cached", ".", "<p", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/EncodingInfo.java#L425-L447
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/jmx/JmxUtil.java
JmxUtil.buildJmxDomain
public static String buildJmxDomain(String domain, MBeanServer mBeanServer, String groupName) { return findJmxDomain(domain, mBeanServer, groupName); }
java
public static String buildJmxDomain(String domain, MBeanServer mBeanServer, String groupName) { return findJmxDomain(domain, mBeanServer, groupName); }
[ "public", "static", "String", "buildJmxDomain", "(", "String", "domain", ",", "MBeanServer", "mBeanServer", ",", "String", "groupName", ")", "{", "return", "findJmxDomain", "(", "domain", ",", "mBeanServer", ",", "groupName", ")", ";", "}" ]
Build the JMX domain name. @param domain The JMX domain name @param mBeanServer the {@link MBeanServer} where to check whether the JMX domain is allowed or not. @param groupName String containing the group name for the JMX MBean @return A string that combines the allowed JMX domain and the group name
[ "Build", "the", "JMX", "domain", "name", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/jmx/JmxUtil.java#L47-L49
landawn/AbacusUtil
src/com/landawn/abacus/util/Matth.java
Matth.multiplyExact
public static long multiplyExact(long a, long b) { // Hacker's Delight, Section 2-12 int leadingZeros = Long.numberOfLeadingZeros(a) + Long.numberOfLeadingZeros(~a) + Long.numberOfLeadingZeros(b) + Long.numberOfLeadingZeros(~b); /* * If leadingZeros > Long.SIZE + 1 it's definitely fine, if it's < Long.SIZE it's definitely * bad. We do the leadingZeros check to avoid the division below if at all possible. * * Otherwise, if b == Long.MIN_VALUE, then the only allowed values of a are 0 and 1. We take * care of all a < 0 with their own check, because in particular, the case a == -1 will * incorrectly pass the division check below. * * In all other cases, we check that either a is 0 or the result is consistent with division. */ if (leadingZeros > Long.SIZE + 1) { return a * b; } checkNoOverflow(leadingZeros >= Long.SIZE); checkNoOverflow(a >= 0 | b != Long.MIN_VALUE); long result = a * b; checkNoOverflow(a == 0 || result / a == b); return result; }
java
public static long multiplyExact(long a, long b) { // Hacker's Delight, Section 2-12 int leadingZeros = Long.numberOfLeadingZeros(a) + Long.numberOfLeadingZeros(~a) + Long.numberOfLeadingZeros(b) + Long.numberOfLeadingZeros(~b); /* * If leadingZeros > Long.SIZE + 1 it's definitely fine, if it's < Long.SIZE it's definitely * bad. We do the leadingZeros check to avoid the division below if at all possible. * * Otherwise, if b == Long.MIN_VALUE, then the only allowed values of a are 0 and 1. We take * care of all a < 0 with their own check, because in particular, the case a == -1 will * incorrectly pass the division check below. * * In all other cases, we check that either a is 0 or the result is consistent with division. */ if (leadingZeros > Long.SIZE + 1) { return a * b; } checkNoOverflow(leadingZeros >= Long.SIZE); checkNoOverflow(a >= 0 | b != Long.MIN_VALUE); long result = a * b; checkNoOverflow(a == 0 || result / a == b); return result; }
[ "public", "static", "long", "multiplyExact", "(", "long", "a", ",", "long", "b", ")", "{", "// Hacker's Delight, Section 2-12\r", "int", "leadingZeros", "=", "Long", ".", "numberOfLeadingZeros", "(", "a", ")", "+", "Long", ".", "numberOfLeadingZeros", "(", "~", ...
Returns the product of {@code a} and {@code b}, provided it does not overflow. @throws ArithmeticException if {@code a * b} overflows in signed {@code long} arithmetic
[ "Returns", "the", "product", "of", "{", "@code", "a", "}", "and", "{", "@code", "b", "}", "provided", "it", "does", "not", "overflow", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1426-L1447
ACRA/acra
acra-http/src/main/java/org/acra/sender/HttpSender.java
HttpSender.convertToString
@NonNull @SuppressWarnings("WeakerAccess") protected String convertToString(CrashReportData report, @NonNull StringFormat format) throws Exception { return format.toFormattedString(report, config.reportContent(), "&", "\n", true); }
java
@NonNull @SuppressWarnings("WeakerAccess") protected String convertToString(CrashReportData report, @NonNull StringFormat format) throws Exception { return format.toFormattedString(report, config.reportContent(), "&", "\n", true); }
[ "@", "NonNull", "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "protected", "String", "convertToString", "(", "CrashReportData", "report", ",", "@", "NonNull", "StringFormat", "format", ")", "throws", "Exception", "{", "return", "format", ".", "toFormattedSt...
Convert a report to string @param report the report to convert @param format the format to convert to @return a string representation of the report @throws Exception if conversion failed
[ "Convert", "a", "report", "to", "string" ]
train
https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-http/src/main/java/org/acra/sender/HttpSender.java#L196-L200
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaCodeGen.java
RaCodeGen.writeEndpointLifecycle
private void writeEndpointLifecycle(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This is called during the activation of a message endpoint.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param endpointFactory A message endpoint factory instance.\n"); writeWithIndent(out, indent, " * @param spec An activation spec JavaBean instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception \n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void endpointActivation(MessageEndpointFactory endpointFactory,\n"); writeWithIndent(out, indent + 1, "ActivationSpec spec) throws ResourceException"); writeLeftCurlyBracket(out, indent); if (def.isSupportInbound()) { writeIndent(out, indent + 1); out.write(def.getActivationClass() + " activation = new " + def.getActivationClass() + "(this, endpointFactory, (" + def.getAsClass() + ")spec);\n"); writeWithIndent(out, indent + 1, "activations.put((" + def.getAsClass() + ")spec, activation);\n"); writeWithIndent(out, indent + 1, "activation.start();\n\n"); } writeLogging(def, out, indent + 1, "trace", "endpointActivation", "endpointFactory", "spec"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This is called when a message endpoint is deactivated. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param endpointFactory A message endpoint factory instance.\n"); writeWithIndent(out, indent, " * @param spec An activation spec JavaBean instance.\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void endpointDeactivation(MessageEndpointFactory endpointFactory,\n"); writeWithIndent(out, indent + 1, "ActivationSpec spec)"); writeLeftCurlyBracket(out, indent); if (def.isSupportInbound()) { writeIndent(out, indent + 1); out.write(def.getActivationClass() + " activation = activations.remove(spec);\n"); writeWithIndent(out, indent + 1, "if (activation != null)\n"); writeWithIndent(out, indent + 2, "activation.stop();\n\n"); } writeLogging(def, out, indent + 1, "trace", "endpointDeactivation", "endpointFactory"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeEndpointLifecycle(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This is called during the activation of a message endpoint.\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param endpointFactory A message endpoint factory instance.\n"); writeWithIndent(out, indent, " * @param spec An activation spec JavaBean instance.\n"); writeWithIndent(out, indent, " * @throws ResourceException generic exception \n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void endpointActivation(MessageEndpointFactory endpointFactory,\n"); writeWithIndent(out, indent + 1, "ActivationSpec spec) throws ResourceException"); writeLeftCurlyBracket(out, indent); if (def.isSupportInbound()) { writeIndent(out, indent + 1); out.write(def.getActivationClass() + " activation = new " + def.getActivationClass() + "(this, endpointFactory, (" + def.getAsClass() + ")spec);\n"); writeWithIndent(out, indent + 1, "activations.put((" + def.getAsClass() + ")spec, activation);\n"); writeWithIndent(out, indent + 1, "activation.start();\n\n"); } writeLogging(def, out, indent + 1, "trace", "endpointActivation", "endpointFactory", "spec"); writeRightCurlyBracket(out, indent); writeEol(out); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * This is called when a message endpoint is deactivated. \n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @param endpointFactory A message endpoint factory instance.\n"); writeWithIndent(out, indent, " * @param spec An activation spec JavaBean instance.\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public void endpointDeactivation(MessageEndpointFactory endpointFactory,\n"); writeWithIndent(out, indent + 1, "ActivationSpec spec)"); writeLeftCurlyBracket(out, indent); if (def.isSupportInbound()) { writeIndent(out, indent + 1); out.write(def.getActivationClass() + " activation = activations.remove(spec);\n"); writeWithIndent(out, indent + 1, "if (activation != null)\n"); writeWithIndent(out, indent + 2, "activation.stop();\n\n"); } writeLogging(def, out, indent + 1, "trace", "endpointDeactivation", "endpointFactory"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeEndpointLifecycle", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/**\\n\"", ")", ";", "writeWithIndent", "(", "out", ",",...
Output EndpointLifecycle method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "EndpointLifecycle", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/RaCodeGen.java#L286-L334
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressPersistenceImpl.java
CommerceAddressPersistenceImpl.findByC_C
@Override public List<CommerceAddress> findByC_C(long classNameId, long classPK, int start, int end) { return findByC_C(classNameId, classPK, start, end, null); }
java
@Override public List<CommerceAddress> findByC_C(long classNameId, long classPK, int start, int end) { return findByC_C(classNameId, classPK, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceAddress", ">", "findByC_C", "(", "long", "classNameId", ",", "long", "classPK", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByC_C", "(", "classNameId", ",", "classPK", ",", "start", ",",...
Returns a range of all the commerce addresses where classNameId = &#63; and classPK = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceAddressModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param classNameId the class name ID @param classPK the class pk @param start the lower bound of the range of commerce addresses @param end the upper bound of the range of commerce addresses (not inclusive) @return the range of matching commerce addresses
[ "Returns", "a", "range", "of", "all", "the", "commerce", "addresses", "where", "classNameId", "=", "&#63", ";", "and", "classPK", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAddressPersistenceImpl.java#L1184-L1188
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/Branch.java
Branch.loadRewards
public void loadRewards(BranchReferralStateChangedListener callback) { ServerRequest req = new ServerRequestGetRewards(context_, callback); if (!req.constructError_ && !req.handleErrors(context_)) { handleNewRequest(req); } }
java
public void loadRewards(BranchReferralStateChangedListener callback) { ServerRequest req = new ServerRequestGetRewards(context_, callback); if (!req.constructError_ && !req.handleErrors(context_)) { handleNewRequest(req); } }
[ "public", "void", "loadRewards", "(", "BranchReferralStateChangedListener", "callback", ")", "{", "ServerRequest", "req", "=", "new", "ServerRequestGetRewards", "(", "context_", ",", "callback", ")", ";", "if", "(", "!", "req", ".", "constructError_", "&&", "!", ...
<p>Retrieves rewards for the current session, with a callback to perform a predefined action following successful report of state change. You'll then need to call getCredits in the callback to update the credit totals in your UX.</p> @param callback A {@link BranchReferralStateChangedListener} callback instance that will trigger actions defined therein upon a referral state change.
[ "<p", ">", "Retrieves", "rewards", "for", "the", "current", "session", "with", "a", "callback", "to", "perform", "a", "predefined", "action", "following", "successful", "report", "of", "state", "change", ".", "You", "ll", "then", "need", "to", "call", "getCr...
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1834-L1839
apache/reef
lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizInjectionPlanVisitor.java
GraphvizInjectionPlanVisitor.visit
@Override public boolean visit(final InjectionPlan<?> nodeFrom, final InjectionPlan<?> nodeTo) { this.graphStr .append(" \"") .append(nodeFrom.getClass()) .append('_') .append(nodeFrom.getNode().getName()) .append("\" -> \"") .append(nodeTo.getClass()) .append('_') .append(nodeTo.getNode().getName()) .append("\" [style=solid];\n"); return true; }
java
@Override public boolean visit(final InjectionPlan<?> nodeFrom, final InjectionPlan<?> nodeTo) { this.graphStr .append(" \"") .append(nodeFrom.getClass()) .append('_') .append(nodeFrom.getNode().getName()) .append("\" -> \"") .append(nodeTo.getClass()) .append('_') .append(nodeTo.getNode().getName()) .append("\" [style=solid];\n"); return true; }
[ "@", "Override", "public", "boolean", "visit", "(", "final", "InjectionPlan", "<", "?", ">", "nodeFrom", ",", "final", "InjectionPlan", "<", "?", ">", "nodeTo", ")", "{", "this", ".", "graphStr", ".", "append", "(", "\" \\\"\"", ")", ".", "append", "(",...
Process current edge of the injection plan. @param nodeFrom Current injection plan node. @param nodeTo Destination injection plan node. @return true to proceed with the next node, false to cancel.
[ "Process", "current", "edge", "of", "the", "injection", "plan", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizInjectionPlanVisitor.java#L146-L159
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/jvm/ClassReader.java
ClassReader.enterClass
public ClassSymbol enterClass(Name flatname) { ClassSymbol c = classes.get(flatname); if (c == null) return enterClass(flatname, (JavaFileObject)null); else return c; }
java
public ClassSymbol enterClass(Name flatname) { ClassSymbol c = classes.get(flatname); if (c == null) return enterClass(flatname, (JavaFileObject)null); else return c; }
[ "public", "ClassSymbol", "enterClass", "(", "Name", "flatname", ")", "{", "ClassSymbol", "c", "=", "classes", ".", "get", "(", "flatname", ")", ";", "if", "(", "c", "==", "null", ")", "return", "enterClass", "(", "flatname", ",", "(", "JavaFileObject", "...
Create a new member or toplevel class symbol with given flat name and enter in `classes' unless already there.
[ "Create", "a", "new", "member", "or", "toplevel", "class", "symbol", "with", "given", "flat", "name", "and", "enter", "in", "classes", "unless", "already", "there", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L2431-L2437
apache/groovy
subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java
DateTimeExtensions.rightShift
public static Period rightShift(final Year self, Year year) { return Period.between(self.atDay(1), year.atDay(1)); }
java
public static Period rightShift(final Year self, Year year) { return Period.between(self.atDay(1), year.atDay(1)); }
[ "public", "static", "Period", "rightShift", "(", "final", "Year", "self", ",", "Year", "year", ")", "{", "return", "Period", ".", "between", "(", "self", ".", "atDay", "(", "1", ")", ",", "year", ".", "atDay", "(", "1", ")", ")", ";", "}" ]
Returns a {@link java.time.Period} between the first day of this year (inclusive) and the first day of the provided {@link java.time.Year} (exclusive). @param self a Year @param year another Year @return a Period between the Years @since 2.5.0
[ "Returns", "a", "{", "@link", "java", ".", "time", ".", "Period", "}", "between", "the", "first", "day", "of", "this", "year", "(", "inclusive", ")", "and", "the", "first", "day", "of", "the", "provided", "{", "@link", "java", ".", "time", ".", "Year...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L1478-L1480
primefaces/primefaces
src/main/java/org/primefaces/expression/SearchExpressionFacade.java
SearchExpressionFacade.resolveClientId
public static String resolveClientId(FacesContext context, UIComponent source, String expression) { return resolveClientId(context, source, expression, SearchExpressionHint.NONE); }
java
public static String resolveClientId(FacesContext context, UIComponent source, String expression) { return resolveClientId(context, source, expression, SearchExpressionHint.NONE); }
[ "public", "static", "String", "resolveClientId", "(", "FacesContext", "context", ",", "UIComponent", "source", ",", "String", "expression", ")", "{", "return", "resolveClientId", "(", "context", ",", "source", ",", "expression", ",", "SearchExpressionHint", ".", "...
Resolves a {@link UIComponent} clientId and/or passtrough expression for the given expression. @param context The {@link FacesContext}. @param source The source component. E.g. a button. @param expression The search expression. @return A resolved clientId and/or passtrough expression (like PFS, widgetVar).
[ "Resolves", "a", "{", "@link", "UIComponent", "}", "clientId", "and", "/", "or", "passtrough", "expression", "for", "the", "given", "expression", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/expression/SearchExpressionFacade.java#L301-L303
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/MessageFormat.java
MessageFormat.parseArgs
private void parseArgs(MessageArgsParser parser) { while (tag.peek() != Chars.EOF) { tag.skip(COMMA_WS); // Look for the argument key if (!tag.seek(IDENTIFIER, choice)) { return; } // Parse the <key>(:<value>)? sequence String key = choice.toString(); tag.jump(choice); if (tag.seek(ARG_SEP, choice)) { tag.jump(choice); if (tag.seek(ARG_VAL, choice)) { tag.jump(choice); parser.set(key, choice.toString()); } else { parser.set(key, ""); } } else { parser.set(key, ""); if (!tag.seek(COMMA_WS, choice)) { return; } } } }
java
private void parseArgs(MessageArgsParser parser) { while (tag.peek() != Chars.EOF) { tag.skip(COMMA_WS); // Look for the argument key if (!tag.seek(IDENTIFIER, choice)) { return; } // Parse the <key>(:<value>)? sequence String key = choice.toString(); tag.jump(choice); if (tag.seek(ARG_SEP, choice)) { tag.jump(choice); if (tag.seek(ARG_VAL, choice)) { tag.jump(choice); parser.set(key, choice.toString()); } else { parser.set(key, ""); } } else { parser.set(key, ""); if (!tag.seek(COMMA_WS, choice)) { return; } } } }
[ "private", "void", "parseArgs", "(", "MessageArgsParser", "parser", ")", "{", "while", "(", "tag", ".", "peek", "(", ")", "!=", "Chars", ".", "EOF", ")", "{", "tag", ".", "skip", "(", "COMMA_WS", ")", ";", "// Look for the argument key", "if", "(", "!", ...
Parse a list of zero or more arguments of the form: <key>:<value>. The ":<value>" is optional and will set the key = null.
[ "Parse", "a", "list", "of", "zero", "or", "more", "arguments", "of", "the", "form", ":", "<key", ">", ":", "<value", ">", ".", "The", ":", "<value", ">", "is", "optional", "and", "will", "set", "the", "key", "=", "null", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/MessageFormat.java#L781-L808
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java
EJSHome.getBean
public EJBObject getBean(String type, Object primaryKey, Object data) throws FinderException, RemoteException { return ivEntityHelper.getBean(this, type, primaryKey, data); }
java
public EJBObject getBean(String type, Object primaryKey, Object data) throws FinderException, RemoteException { return ivEntityHelper.getBean(this, type, primaryKey, data); }
[ "public", "EJBObject", "getBean", "(", "String", "type", ",", "Object", "primaryKey", ",", "Object", "data", ")", "throws", "FinderException", ",", "RemoteException", "{", "return", "ivEntityHelper", ".", "getBean", "(", "this", ",", "type", ",", "primaryKey", ...
Return the <code>EJBObject</code> associated with the specified type, primary key and data. <p> If the bean defined by the (type, primaryKey) tuple is already active then return the active instance. <p> Otherwise, activate the bean and hydrate it with the given data. <p> @param type a <code>String</code> defining the most-specific type of the bean being activated <p> @param primaryKey the <code>Object</code> containing the primary key of the <code>EJBObject</code> to return <p> @param data an <code>Object</code> containing the data to use to hydrate bean if necessary <p> @return the <code>EJBObject</code> associated with the specified primary key <p> @exception FinderException thrown if a finder-specific error occurs (such as no object with corresponding primary key) <p> @exception RemoteException thrown if a system exception occurs while trying to activate the <code>BeanO</code> instance corresponding
[ "Return", "the", "<code", ">", "EJBObject<", "/", "code", ">", "associated", "with", "the", "specified", "type", "primary", "key", "and", "data", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSHome.java#L2310-L2315
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/voice.java
voice.getSpeechRecognitionFirstResult
public static String getSpeechRecognitionFirstResult(int requestCode, int resultCode, Intent data) { if (requestCode == 0 && resultCode == -1) { List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if (results != null && results.size() > 0) { return results.get(0); } } return null; }
java
public static String getSpeechRecognitionFirstResult(int requestCode, int resultCode, Intent data) { if (requestCode == 0 && resultCode == -1) { List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if (results != null && results.size() > 0) { return results.get(0); } } return null; }
[ "public", "static", "String", "getSpeechRecognitionFirstResult", "(", "int", "requestCode", ",", "int", "resultCode", ",", "Intent", "data", ")", "{", "if", "(", "requestCode", "==", "0", "&&", "resultCode", "==", "-", "1", ")", "{", "List", "<", "String", ...
Get first result from the Google Speech Recognition activity (DO NOT FORGET call this function on onActivityResult()) @param requestCode - onActivityResult request code @param resultCode - onActivityResult result code @param data - onActivityResult Intent data @return string containing the first result of what was recognized
[ "Get", "first", "result", "from", "the", "Google", "Speech", "Recognition", "activity", "(", "DO", "NOT", "FORGET", "call", "this", "function", "on", "onActivityResult", "()", ")" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/voice.java#L106-L114
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java
PersonGroupPersonsImpl.listAsync
public Observable<List<Person>> listAsync(String personGroupId, ListPersonGroupPersonsOptionalParameter listOptionalParameter) { return listWithServiceResponseAsync(personGroupId, listOptionalParameter).map(new Func1<ServiceResponse<List<Person>>, List<Person>>() { @Override public List<Person> call(ServiceResponse<List<Person>> response) { return response.body(); } }); }
java
public Observable<List<Person>> listAsync(String personGroupId, ListPersonGroupPersonsOptionalParameter listOptionalParameter) { return listWithServiceResponseAsync(personGroupId, listOptionalParameter).map(new Func1<ServiceResponse<List<Person>>, List<Person>>() { @Override public List<Person> call(ServiceResponse<List<Person>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "Person", ">", ">", "listAsync", "(", "String", "personGroupId", ",", "ListPersonGroupPersonsOptionalParameter", "listOptionalParameter", ")", "{", "return", "listWithServiceResponseAsync", "(", "personGroupId", ",", "listOptional...
List all persons in a person group, and retrieve person information (including personId, name, userData and persistedFaceIds of registered faces of the person). @param personGroupId Id referencing a particular person group. @param listOptionalParameter 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 List&lt;Person&gt; object
[ "List", "all", "persons", "in", "a", "person", "group", "and", "retrieve", "person", "information", "(", "including", "personId", "name", "userData", "and", "persistedFaceIds", "of", "registered", "faces", "of", "the", "person", ")", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java#L318-L325
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecValidator.java
ContentSpecValidator.preValidateTopic
public boolean preValidateTopic(final SpecTopic specTopic, final Map<String, SpecTopic> specTopics, final Set<String> processedFixedUrls, final BookType bookType, final ContentSpec contentSpec) { return preValidateTopic(specTopic, specTopics, processedFixedUrls, bookType, true, contentSpec); }
java
public boolean preValidateTopic(final SpecTopic specTopic, final Map<String, SpecTopic> specTopics, final Set<String> processedFixedUrls, final BookType bookType, final ContentSpec contentSpec) { return preValidateTopic(specTopic, specTopics, processedFixedUrls, bookType, true, contentSpec); }
[ "public", "boolean", "preValidateTopic", "(", "final", "SpecTopic", "specTopic", ",", "final", "Map", "<", "String", ",", "SpecTopic", ">", "specTopics", ",", "final", "Set", "<", "String", ">", "processedFixedUrls", ",", "final", "BookType", "bookType", ",", ...
Validates a topic against the database and for formatting issues. @param specTopic The topic to be validated. @param specTopics The list of topics that exist within the content specification. @param processedFixedUrls @param bookType The type of book the topic is to be validated against. @param contentSpec The content spec the topic belongs to. @return True if the topic is valid otherwise false.
[ "Validates", "a", "topic", "against", "the", "database", "and", "for", "formatting", "issues", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecValidator.java#L1371-L1374
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.getOptionsFromConfigFile
private Map<String, String> getOptionsFromConfigFile(String newConfigFile) throws MojoExecutionException { this.getLog().debug("Using search path at: " + this.basedir.getAbsolutePath()); this.resourceManager.addSearchPath(FileResourceLoader.ID, this.basedir.getAbsolutePath()); try (InputStream configInput = this.resourceManager.getResourceAsInputStream(newConfigFile)) { return new ConfigReader().read(configInput); } catch (ResourceNotFoundException e) { throw new MojoExecutionException("Cannot find config file [" + newConfigFile + "]"); } catch (IOException e) { throw new MojoExecutionException("Cannot read config file [" + newConfigFile + "]", e); } catch (SAXException e) { throw new MojoExecutionException("Cannot parse config file [" + newConfigFile + "]", e); } catch (ConfigReadException e) { throw new MojoExecutionException(e.getMessage(), e); } }
java
private Map<String, String> getOptionsFromConfigFile(String newConfigFile) throws MojoExecutionException { this.getLog().debug("Using search path at: " + this.basedir.getAbsolutePath()); this.resourceManager.addSearchPath(FileResourceLoader.ID, this.basedir.getAbsolutePath()); try (InputStream configInput = this.resourceManager.getResourceAsInputStream(newConfigFile)) { return new ConfigReader().read(configInput); } catch (ResourceNotFoundException e) { throw new MojoExecutionException("Cannot find config file [" + newConfigFile + "]"); } catch (IOException e) { throw new MojoExecutionException("Cannot read config file [" + newConfigFile + "]", e); } catch (SAXException e) { throw new MojoExecutionException("Cannot parse config file [" + newConfigFile + "]", e); } catch (ConfigReadException e) { throw new MojoExecutionException(e.getMessage(), e); } }
[ "private", "Map", "<", "String", ",", "String", ">", "getOptionsFromConfigFile", "(", "String", "newConfigFile", ")", "throws", "MojoExecutionException", "{", "this", ".", "getLog", "(", ")", ".", "debug", "(", "\"Using search path at: \"", "+", "this", ".", "ba...
Read config file and return the config as {@link Map}. @return the options from config file @throws MojoExecutionException the mojo execution exception
[ "Read", "config", "file", "and", "return", "the", "config", "as", "{", "@link", "Map", "}", "." ]
train
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L698-L714
alkacon/opencms-core
src/org/opencms/importexport/CmsExport.java
CmsExport.exportGroups
protected void exportGroups(Element parent, CmsOrganizationalUnit orgunit) throws CmsImportExportException, SAXException { try { I_CmsReport report = getReport(); List<CmsGroup> allGroups = OpenCms.getOrgUnitManager().getGroups(getCms(), orgunit.getName(), false); for (int i = 0, l = allGroups.size(); i < l; i++) { CmsGroup group = allGroups.get(i); report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_SUCCESSION_2, String.valueOf(i + 1), String.valueOf(l)), I_CmsReport.FORMAT_NOTE); report.print(Messages.get().container(Messages.RPT_EXPORT_GROUP_0), I_CmsReport.FORMAT_NOTE); report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, group.getName())); report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0)); exportGroup(parent, group); report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); } } catch (CmsImportExportException e) { throw e; } catch (CmsException e) { if (LOG.isDebugEnabled()) { LOG.debug(e.getLocalizedMessage(), e); } throw new CmsImportExportException(e.getMessageContainer(), e); } }
java
protected void exportGroups(Element parent, CmsOrganizationalUnit orgunit) throws CmsImportExportException, SAXException { try { I_CmsReport report = getReport(); List<CmsGroup> allGroups = OpenCms.getOrgUnitManager().getGroups(getCms(), orgunit.getName(), false); for (int i = 0, l = allGroups.size(); i < l; i++) { CmsGroup group = allGroups.get(i); report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_SUCCESSION_2, String.valueOf(i + 1), String.valueOf(l)), I_CmsReport.FORMAT_NOTE); report.print(Messages.get().container(Messages.RPT_EXPORT_GROUP_0), I_CmsReport.FORMAT_NOTE); report.print( org.opencms.report.Messages.get().container( org.opencms.report.Messages.RPT_ARGUMENT_1, group.getName())); report.print(org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0)); exportGroup(parent, group); report.println( org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0), I_CmsReport.FORMAT_OK); } } catch (CmsImportExportException e) { throw e; } catch (CmsException e) { if (LOG.isDebugEnabled()) { LOG.debug(e.getLocalizedMessage(), e); } throw new CmsImportExportException(e.getMessageContainer(), e); } }
[ "protected", "void", "exportGroups", "(", "Element", "parent", ",", "CmsOrganizationalUnit", "orgunit", ")", "throws", "CmsImportExportException", ",", "SAXException", "{", "try", "{", "I_CmsReport", "report", "=", "getReport", "(", ")", ";", "List", "<", "CmsGrou...
Exports all groups of the given organizational unit.<p> @param parent the parent node to add the groups to @param orgunit the organizational unit to write the groups for @throws CmsImportExportException if something goes wrong @throws SAXException if something goes wrong processing the manifest.xml
[ "Exports", "all", "groups", "of", "the", "given", "organizational", "unit", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsExport.java#L977-L1010
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.buildClickBoundingBox
public BoundingBox buildClickBoundingBox(LatLng latLng, BoundingBox mapBounds) { // Get the screen width and height a click occurs from a feature double width = TileBoundingBoxMapUtils.getLongitudeDistance(mapBounds) * screenClickPercentage; double height = TileBoundingBoxMapUtils.getLatitudeDistance(mapBounds) * screenClickPercentage; LatLng leftCoordinate = SphericalUtil.computeOffset(latLng, width, 270); LatLng upCoordinate = SphericalUtil.computeOffset(latLng, height, 0); LatLng rightCoordinate = SphericalUtil.computeOffset(latLng, width, 90); LatLng downCoordinate = SphericalUtil.computeOffset(latLng, height, 180); BoundingBox boundingBox = new BoundingBox(leftCoordinate.longitude, downCoordinate.latitude, rightCoordinate.longitude, upCoordinate.latitude); return boundingBox; }
java
public BoundingBox buildClickBoundingBox(LatLng latLng, BoundingBox mapBounds) { // Get the screen width and height a click occurs from a feature double width = TileBoundingBoxMapUtils.getLongitudeDistance(mapBounds) * screenClickPercentage; double height = TileBoundingBoxMapUtils.getLatitudeDistance(mapBounds) * screenClickPercentage; LatLng leftCoordinate = SphericalUtil.computeOffset(latLng, width, 270); LatLng upCoordinate = SphericalUtil.computeOffset(latLng, height, 0); LatLng rightCoordinate = SphericalUtil.computeOffset(latLng, width, 90); LatLng downCoordinate = SphericalUtil.computeOffset(latLng, height, 180); BoundingBox boundingBox = new BoundingBox(leftCoordinate.longitude, downCoordinate.latitude, rightCoordinate.longitude, upCoordinate.latitude); return boundingBox; }
[ "public", "BoundingBox", "buildClickBoundingBox", "(", "LatLng", "latLng", ",", "BoundingBox", "mapBounds", ")", "{", "// Get the screen width and height a click occurs from a feature", "double", "width", "=", "TileBoundingBoxMapUtils", ".", "getLongitudeDistance", "(", "mapBou...
Build a bounding box using the location coordinate click location and map view bounds @param latLng click location @param mapBounds map bounds @return bounding box @since 1.2.7
[ "Build", "a", "bounding", "box", "using", "the", "location", "coordinate", "click", "location", "and", "map", "view", "bounds" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L265-L279
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QRDecompositionHouseholderColumn_ZDRM.java
QRDecompositionHouseholderColumn_ZDRM.getR
@Override public ZMatrixRMaj getR(ZMatrixRMaj R, boolean compact) { if( compact ) R = UtilDecompositons_ZDRM.checkZerosLT(R,minLength,numCols); else R = UtilDecompositons_ZDRM.checkZerosLT(R,numRows,numCols); for( int j = 0; j < numCols; j++ ) { double colR[] = dataQR[j]; int l = Math.min(j,numRows-1); for( int i = 0; i <= l; i++ ) { R.set(i,j,colR[i*2],colR[i*2+1]); } } return R; }
java
@Override public ZMatrixRMaj getR(ZMatrixRMaj R, boolean compact) { if( compact ) R = UtilDecompositons_ZDRM.checkZerosLT(R,minLength,numCols); else R = UtilDecompositons_ZDRM.checkZerosLT(R,numRows,numCols); for( int j = 0; j < numCols; j++ ) { double colR[] = dataQR[j]; int l = Math.min(j,numRows-1); for( int i = 0; i <= l; i++ ) { R.set(i,j,colR[i*2],colR[i*2+1]); } } return R; }
[ "@", "Override", "public", "ZMatrixRMaj", "getR", "(", "ZMatrixRMaj", "R", ",", "boolean", "compact", ")", "{", "if", "(", "compact", ")", "R", "=", "UtilDecompositons_ZDRM", ".", "checkZerosLT", "(", "R", ",", "minLength", ",", "numCols", ")", ";", "else"...
Returns an upper triangular matrix which is the R in the QR decomposition. If compact then the input expected to be size = [min(rows,cols) , numCols] otherwise size = [numRows,numCols]. @param R Storage for upper triangular matrix. @param compact If true then a compact matrix is expected.
[ "Returns", "an", "upper", "triangular", "matrix", "which", "is", "the", "R", "in", "the", "QR", "decomposition", ".", "If", "compact", "then", "the", "input", "expected", "to", "be", "size", "=", "[", "min", "(", "rows", "cols", ")", "numCols", "]", "o...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QRDecompositionHouseholderColumn_ZDRM.java#L132-L148
apereo/cas
support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java
AbstractServiceValidateController.validateAssertion
private boolean validateAssertion(final HttpServletRequest request, final String serviceTicketId, final Assertion assertion, final Service service) { for (val spec : serviceValidateConfigurationContext.getValidationSpecifications()) { spec.reset(); val binder = new ServletRequestDataBinder(spec, "validationSpecification"); initBinder(request, binder); binder.bind(request); if (!spec.isSatisfiedBy(assertion, request)) { LOGGER.warn("Service ticket [{}] does not satisfy validation specification.", serviceTicketId); return false; } } enforceTicketValidationAuthorizationFor(request, service, assertion); return true; }
java
private boolean validateAssertion(final HttpServletRequest request, final String serviceTicketId, final Assertion assertion, final Service service) { for (val spec : serviceValidateConfigurationContext.getValidationSpecifications()) { spec.reset(); val binder = new ServletRequestDataBinder(spec, "validationSpecification"); initBinder(request, binder); binder.bind(request); if (!spec.isSatisfiedBy(assertion, request)) { LOGGER.warn("Service ticket [{}] does not satisfy validation specification.", serviceTicketId); return false; } } enforceTicketValidationAuthorizationFor(request, service, assertion); return true; }
[ "private", "boolean", "validateAssertion", "(", "final", "HttpServletRequest", "request", ",", "final", "String", "serviceTicketId", ",", "final", "Assertion", "assertion", ",", "final", "Service", "service", ")", "{", "for", "(", "val", "spec", ":", "serviceValid...
Validate assertion. @param request the request @param serviceTicketId the service ticket id @param assertion the assertion @param service the service @return true/false
[ "Validate", "assertion", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-validation/src/main/java/org/apereo/cas/web/AbstractServiceValidateController.java#L242-L255
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java
Boot.setProperty
public static void setProperty(String name, String value) { if (name != null && !name.isEmpty()) { if (value == null || value.isEmpty()) { System.getProperties().remove(name); } else { System.setProperty(name, value); } } }
java
public static void setProperty(String name, String value) { if (name != null && !name.isEmpty()) { if (value == null || value.isEmpty()) { System.getProperties().remove(name); } else { System.setProperty(name, value); } } }
[ "public", "static", "void", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "name", "!=", "null", "&&", "!", "name", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "value", "==", "null", "||", "value", ".", "isEmp...
Set the system property. This function is an helper for setting a system property usually accessible with {@link System}. <p>This function must be called before launching the Janus platform. @param name the name of the property. @param value the value of the property. If the value is <code>null</code> or empty, the property is removed. @since 2.0.2.0 @see System#setProperty(String, String) @see System#getProperties()
[ "Set", "the", "system", "property", ".", "This", "function", "is", "an", "helper", "for", "setting", "a", "system", "property", "usually", "accessible", "with", "{", "@link", "System", "}", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/Boot.java#L837-L845
PureWriter/ToastCompat
library/src/main/java/me/drakeet/support/toast/ToastCompat.java
ToastCompat.makeText
public static Toast makeText(Context context, @StringRes int resId, int duration) throws Resources.NotFoundException { return makeText(context, context.getResources().getText(resId), duration); }
java
public static Toast makeText(Context context, @StringRes int resId, int duration) throws Resources.NotFoundException { return makeText(context, context.getResources().getText(resId), duration); }
[ "public", "static", "Toast", "makeText", "(", "Context", "context", ",", "@", "StringRes", "int", "resId", ",", "int", "duration", ")", "throws", "Resources", ".", "NotFoundException", "{", "return", "makeText", "(", "context", ",", "context", ".", "getResourc...
Make a standard toast that just contains a text view with the text from a resource. @param context The context to use. Usually your {@link android.app.Application} or {@link android.app.Activity} object. @param resId The resource id of the string resource to use. Can be formatted text. @param duration How long to display the message. Either {@link #LENGTH_SHORT} or {@link #LENGTH_LONG} @throws Resources.NotFoundException if the resource can't be found.
[ "Make", "a", "standard", "toast", "that", "just", "contains", "a", "text", "view", "with", "the", "text", "from", "a", "resource", "." ]
train
https://github.com/PureWriter/ToastCompat/blob/79c629c2ca8b2d7803f6dc4a458971b5fa19e7f7/library/src/main/java/me/drakeet/support/toast/ToastCompat.java#L66-L69
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/mapreduce/MRJobLauncher.java
MRJobLauncher.addLocalFiles
@SuppressWarnings("deprecation") private void addLocalFiles(Path jobFileDir, String jobFileList, Configuration conf) throws IOException { DistributedCache.createSymlink(conf); for (String jobFile : SPLITTER.split(jobFileList)) { Path srcJobFile = new Path(jobFile); // DistributedCache requires absolute path, so we need to use makeQualified. Path destJobFile = new Path(this.fs.makeQualified(jobFileDir), srcJobFile.getName()); // Copy the file from local file system to HDFS this.fs.copyFromLocalFile(srcJobFile, destJobFile); // Create a URI that is in the form path#symlink URI destFileUri = URI.create(destJobFile.toUri().getPath() + "#" + destJobFile.getName()); LOG.info(String.format("Adding %s to DistributedCache", destFileUri)); // Finally add the file to DistributedCache with a symlink named after the file name DistributedCache.addCacheFile(destFileUri, conf); } }
java
@SuppressWarnings("deprecation") private void addLocalFiles(Path jobFileDir, String jobFileList, Configuration conf) throws IOException { DistributedCache.createSymlink(conf); for (String jobFile : SPLITTER.split(jobFileList)) { Path srcJobFile = new Path(jobFile); // DistributedCache requires absolute path, so we need to use makeQualified. Path destJobFile = new Path(this.fs.makeQualified(jobFileDir), srcJobFile.getName()); // Copy the file from local file system to HDFS this.fs.copyFromLocalFile(srcJobFile, destJobFile); // Create a URI that is in the form path#symlink URI destFileUri = URI.create(destJobFile.toUri().getPath() + "#" + destJobFile.getName()); LOG.info(String.format("Adding %s to DistributedCache", destFileUri)); // Finally add the file to DistributedCache with a symlink named after the file name DistributedCache.addCacheFile(destFileUri, conf); } }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "private", "void", "addLocalFiles", "(", "Path", "jobFileDir", ",", "String", "jobFileList", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "DistributedCache", ".", "createSymlink", "(", "conf",...
Add local non-jar files the job depends on to DistributedCache.
[ "Add", "local", "non", "-", "jar", "files", "the", "job", "depends", "on", "to", "DistributedCache", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/mapreduce/MRJobLauncher.java#L530-L545
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java
InMemoryLockMapImpl.getReaders
public Collection getReaders(Object obj) { checkTimedOutLocks(); Identity oid = new Identity(obj,getBroker()); return getReaders(oid); }
java
public Collection getReaders(Object obj) { checkTimedOutLocks(); Identity oid = new Identity(obj,getBroker()); return getReaders(oid); }
[ "public", "Collection", "getReaders", "(", "Object", "obj", ")", "{", "checkTimedOutLocks", "(", ")", ";", "Identity", "oid", "=", "new", "Identity", "(", "obj", ",", "getBroker", "(", ")", ")", ";", "return", "getReaders", "(", "oid", ")", ";", "}" ]
returns a collection of Reader LockEntries for object obj. If no LockEntries could be found an empty Vector is returned.
[ "returns", "a", "collection", "of", "Reader", "LockEntries", "for", "object", "obj", ".", "If", "no", "LockEntries", "could", "be", "found", "an", "empty", "Vector", "is", "returned", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/InMemoryLockMapImpl.java#L104-L109
Netflix/Hystrix
hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/main/java/com/netflix/hystrix/contrib/metrics/controller/AbstractHystrixStreamController.java
AbstractHystrixStreamController.handleRequest
protected Response handleRequest() { ResponseBuilder builder = null; /* ensure we aren't allowing more connections than we want */ int numberConnections = getCurrentConnections().get(); int maxNumberConnectionsAllowed = getMaxNumberConcurrentConnectionsAllowed(); // may change at runtime, so look this up for each request if (numberConnections >= maxNumberConnectionsAllowed) { builder = Response.status(Status.SERVICE_UNAVAILABLE).entity("MaxConcurrentConnections reached: " + maxNumberConnectionsAllowed); } else { /* initialize response */ builder = Response.status(Status.OK); builder.header(HttpHeaders.CONTENT_TYPE, "text/event-stream;charset=UTF-8"); builder.header(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, max-age=0, must-revalidate"); builder.header("Pragma", "no-cache"); getCurrentConnections().incrementAndGet(); builder.entity(new HystrixStream(sampleStream, pausePollerThreadDelayInMs, getCurrentConnections())); } return builder.build(); }
java
protected Response handleRequest() { ResponseBuilder builder = null; /* ensure we aren't allowing more connections than we want */ int numberConnections = getCurrentConnections().get(); int maxNumberConnectionsAllowed = getMaxNumberConcurrentConnectionsAllowed(); // may change at runtime, so look this up for each request if (numberConnections >= maxNumberConnectionsAllowed) { builder = Response.status(Status.SERVICE_UNAVAILABLE).entity("MaxConcurrentConnections reached: " + maxNumberConnectionsAllowed); } else { /* initialize response */ builder = Response.status(Status.OK); builder.header(HttpHeaders.CONTENT_TYPE, "text/event-stream;charset=UTF-8"); builder.header(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, max-age=0, must-revalidate"); builder.header("Pragma", "no-cache"); getCurrentConnections().incrementAndGet(); builder.entity(new HystrixStream(sampleStream, pausePollerThreadDelayInMs, getCurrentConnections())); } return builder.build(); }
[ "protected", "Response", "handleRequest", "(", ")", "{", "ResponseBuilder", "builder", "=", "null", ";", "/* ensure we aren't allowing more connections than we want */", "int", "numberConnections", "=", "getCurrentConnections", "(", ")", ".", "get", "(", ")", ";", "int"...
Maintain an open connection with the client. On initial connection send latest data of each requested event type and subsequently send all changes for each requested event type. @return JAX-RS Response - Serialization will be handled by {@link HystrixStreamingOutputProvider}
[ "Maintain", "an", "open", "connection", "with", "the", "client", ".", "On", "initial", "connection", "send", "latest", "data", "of", "each", "requested", "event", "type", "and", "subsequently", "send", "all", "changes", "for", "each", "requested", "event", "ty...
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-contrib/hystrix-metrics-event-stream-jaxrs/src/main/java/com/netflix/hystrix/contrib/metrics/controller/AbstractHystrixStreamController.java#L65-L83
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.newPrintWriter
public static PrintWriter newPrintWriter(File file, String charset) throws IOException { return new GroovyPrintWriter(newWriter(file, charset)); }
java
public static PrintWriter newPrintWriter(File file, String charset) throws IOException { return new GroovyPrintWriter(newWriter(file, charset)); }
[ "public", "static", "PrintWriter", "newPrintWriter", "(", "File", "file", ",", "String", "charset", ")", "throws", "IOException", "{", "return", "new", "GroovyPrintWriter", "(", "newWriter", "(", "file", ",", "charset", ")", ")", ";", "}" ]
Create a new PrintWriter for this file, using specified charset. If the given charset is "UTF-16BE" or "UTF-16LE" (or an equivalent alias), the requisite byte order mark is written to the stream before the writer is returned. @param file a File @param charset the charset @return a PrintWriter @throws IOException if an IOException occurs. @since 1.0
[ "Create", "a", "new", "PrintWriter", "for", "this", "file", "using", "specified", "charset", ".", "If", "the", "given", "charset", "is", "UTF", "-", "16BE", "or", "UTF", "-", "16LE", "(", "or", "an", "equivalent", "alias", ")", "the", "requisite", "byte"...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L2064-L2066
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/model/El.java
El.getMethod
public static ExecutableElement getMethod(TypeElement typeElement, String name, TypeMirror... parameters) { List<ExecutableElement> allMethods = getAllMethods(typeElement, name, parameters); if (allMethods.isEmpty()) { return null; } else { Collections.sort(allMethods, new SpecificMethodComparator()); return allMethods.get(0); } }
java
public static ExecutableElement getMethod(TypeElement typeElement, String name, TypeMirror... parameters) { List<ExecutableElement> allMethods = getAllMethods(typeElement, name, parameters); if (allMethods.isEmpty()) { return null; } else { Collections.sort(allMethods, new SpecificMethodComparator()); return allMethods.get(0); } }
[ "public", "static", "ExecutableElement", "getMethod", "(", "TypeElement", "typeElement", ",", "String", "name", ",", "TypeMirror", "...", "parameters", ")", "{", "List", "<", "ExecutableElement", ">", "allMethods", "=", "getAllMethods", "(", "typeElement", ",", "n...
Returns the most specific named method in typeElement, or null if such method was not found @param typeElement Class @param name Method name @param parameters Method parameters @return
[ "Returns", "the", "most", "specific", "named", "method", "in", "typeElement", "or", "null", "if", "such", "method", "was", "not", "found" ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/model/El.java#L286-L298
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsInner.java
ServerAdvisorsInner.listByServer
public AdvisorListResultInner listByServer(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); }
java
public AdvisorListResultInner listByServer(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).toBlocking().single().body(); }
[ "public", "AdvisorListResultInner", "listByServer", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "toBlocking", "(", ")", ".", "single",...
Gets a list of server advisors. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @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 AdvisorListResultInner object if successful.
[ "Gets", "a", "list", "of", "server", "advisors", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAdvisorsInner.java#L86-L88
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java
SessionFactory.createSession
SessionImpl createSession(ConversationState user) throws RepositoryException, LoginException { if (IdentityConstants.SYSTEM.equals(user.getIdentity().getUserId())) { // Need privileges to get system session. SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(JCRRuntimePermissions.CREATE_SYSTEM_SESSION_PERMISSION); } } else if (DynamicIdentity.DYNAMIC.equals(user.getIdentity().getUserId())) { // Need privileges to get Dynamic session. SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(JCRRuntimePermissions.CREATE_DYNAMIC_SESSION_PERMISSION); } } if (SessionReference.isStarted()) { return new TrackedSession(workspaceName, user, container); } else { return new SessionImpl(workspaceName, user, container); } }
java
SessionImpl createSession(ConversationState user) throws RepositoryException, LoginException { if (IdentityConstants.SYSTEM.equals(user.getIdentity().getUserId())) { // Need privileges to get system session. SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(JCRRuntimePermissions.CREATE_SYSTEM_SESSION_PERMISSION); } } else if (DynamicIdentity.DYNAMIC.equals(user.getIdentity().getUserId())) { // Need privileges to get Dynamic session. SecurityManager security = System.getSecurityManager(); if (security != null) { security.checkPermission(JCRRuntimePermissions.CREATE_DYNAMIC_SESSION_PERMISSION); } } if (SessionReference.isStarted()) { return new TrackedSession(workspaceName, user, container); } else { return new SessionImpl(workspaceName, user, container); } }
[ "SessionImpl", "createSession", "(", "ConversationState", "user", ")", "throws", "RepositoryException", ",", "LoginException", "{", "if", "(", "IdentityConstants", ".", "SYSTEM", ".", "equals", "(", "user", ".", "getIdentity", "(", ")", ".", "getUserId", "(", ")...
Creates Session object by given Credentials @param credentials @return the SessionImpl corresponding to the given {@link ConversationState} @throws RepositoryException
[ "Creates", "Session", "object", "by", "given", "Credentials" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java#L119-L147
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesUtil.java
DoublesUtil.checkDoublesSerVer
static void checkDoublesSerVer(final int serVer, final int minSupportedSerVer) { final int max = DoublesSketch.DOUBLES_SER_VER; if ((serVer > max) || (serVer < minSupportedSerVer)) { throw new SketchesArgumentException( "Possible corruption: Unsupported Serialization Version: " + serVer); } }
java
static void checkDoublesSerVer(final int serVer, final int minSupportedSerVer) { final int max = DoublesSketch.DOUBLES_SER_VER; if ((serVer > max) || (serVer < minSupportedSerVer)) { throw new SketchesArgumentException( "Possible corruption: Unsupported Serialization Version: " + serVer); } }
[ "static", "void", "checkDoublesSerVer", "(", "final", "int", "serVer", ",", "final", "int", "minSupportedSerVer", ")", "{", "final", "int", "max", "=", "DoublesSketch", ".", "DOUBLES_SER_VER", ";", "if", "(", "(", "serVer", ">", "max", ")", "||", "(", "ser...
Check the validity of the given serialization version @param serVer the given serialization version @param minSupportedSerVer the oldest serialization version supported
[ "Check", "the", "validity", "of", "the", "given", "serialization", "version" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesUtil.java#L73-L79
ops4j/org.ops4j.base
ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java
NullArgumentException.validateNotEmpty
public static void validateNotEmpty( String stringToCheck, boolean trim, String argumentName ) throws NullArgumentException { validateNotNull( stringToCheck, argumentName ); if( stringToCheck.length() == 0 || ( trim && stringToCheck.trim().length() == 0 ) ) { throw new NullArgumentException( argumentName + IS_EMPTY ); } }
java
public static void validateNotEmpty( String stringToCheck, boolean trim, String argumentName ) throws NullArgumentException { validateNotNull( stringToCheck, argumentName ); if( stringToCheck.length() == 0 || ( trim && stringToCheck.trim().length() == 0 ) ) { throw new NullArgumentException( argumentName + IS_EMPTY ); } }
[ "public", "static", "void", "validateNotEmpty", "(", "String", "stringToCheck", ",", "boolean", "trim", ",", "String", "argumentName", ")", "throws", "NullArgumentException", "{", "validateNotNull", "(", "stringToCheck", ",", "argumentName", ")", ";", "if", "(", "...
Validates that the string is not null and not an empty string. @param stringToCheck The object to be tested. @param trim If the elements should be trimmed before checking if empty @param argumentName The name of the object, which is used to construct the exception message. @throws NullArgumentException if the stringToCheck is either null or zero characters long.
[ "Validates", "that", "the", "string", "is", "not", "null", "and", "not", "an", "empty", "string", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java#L102-L111
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withObject
public Postcard withObject(@Nullable String key, @Nullable Object value) { serializationService = ARouter.getInstance().navigation(SerializationService.class); mBundle.putString(key, serializationService.object2Json(value)); return this; }
java
public Postcard withObject(@Nullable String key, @Nullable Object value) { serializationService = ARouter.getInstance().navigation(SerializationService.class); mBundle.putString(key, serializationService.object2Json(value)); return this; }
[ "public", "Postcard", "withObject", "(", "@", "Nullable", "String", "key", ",", "@", "Nullable", "Object", "value", ")", "{", "serializationService", "=", "ARouter", ".", "getInstance", "(", ")", ".", "navigation", "(", "SerializationService", ".", "class", ")...
Set object value, the value will be convert to string by 'Fastjson' @param key a String, or null @param value a Object, or null @return current
[ "Set", "object", "value", "the", "value", "will", "be", "convert", "to", "string", "by", "Fastjson" ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L228-L232
Alluxio/alluxio
underfs/kodo/src/main/java/alluxio/underfs/kodo/KodoClient.java
KodoClient.copyObject
public void copyObject(String src, String dst) throws QiniuException { mBucketManager.copy(mBucketName, src, mBucketName, dst); }
java
public void copyObject(String src, String dst) throws QiniuException { mBucketManager.copy(mBucketName, src, mBucketName, dst); }
[ "public", "void", "copyObject", "(", "String", "src", ",", "String", "dst", ")", "throws", "QiniuException", "{", "mBucketManager", ".", "copy", "(", "mBucketName", ",", "src", ",", "mBucketName", ",", "dst", ")", ";", "}" ]
Copys object in Qiniu kodo. @param src source Object key @param dst destination Object Key
[ "Copys", "object", "in", "Qiniu", "kodo", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/underfs/kodo/src/main/java/alluxio/underfs/kodo/KodoClient.java#L143-L145
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.deleteUnlabelledUtterance
public OperationStatus deleteUnlabelledUtterance(UUID appId, String versionId, String utterance) { return deleteUnlabelledUtteranceWithServiceResponseAsync(appId, versionId, utterance).toBlocking().single().body(); }
java
public OperationStatus deleteUnlabelledUtterance(UUID appId, String versionId, String utterance) { return deleteUnlabelledUtteranceWithServiceResponseAsync(appId, versionId, utterance).toBlocking().single().body(); }
[ "public", "OperationStatus", "deleteUnlabelledUtterance", "(", "UUID", "appId", ",", "String", "versionId", ",", "String", "utterance", ")", "{", "return", "deleteUnlabelledUtteranceWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "utterance", ")", ".", ...
Deleted an unlabelled utterance. @param appId The application ID. @param versionId The version ID. @param utterance The utterance text to delete. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Deleted", "an", "unlabelled", "utterance", "." ]
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#L1044-L1046
gallandarakhneorg/afc
core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java
MeasureUnitUtil.toMeters
@Pure @SuppressWarnings("checkstyle:returncount") public static double toMeters(double value, SpaceUnit inputUnit) { switch (inputUnit) { case TERAMETER: return value * 1e12; case GIGAMETER: return value * 1e9; case MEGAMETER: return value * 1e6; case KILOMETER: return value * 1e3; case HECTOMETER: return value * 1e2; case DECAMETER: return value * 1e1; case METER: break; case DECIMETER: return value * 1e-1; case CENTIMETER: return value * 1e-2; case MILLIMETER: return value * 1e-3; case MICROMETER: return value * 1e-6; case NANOMETER: return value * 1e-9; case PICOMETER: return value * 1e-12; case FEMTOMETER: return value * 1e-15; default: throw new IllegalArgumentException(); } return value; }
java
@Pure @SuppressWarnings("checkstyle:returncount") public static double toMeters(double value, SpaceUnit inputUnit) { switch (inputUnit) { case TERAMETER: return value * 1e12; case GIGAMETER: return value * 1e9; case MEGAMETER: return value * 1e6; case KILOMETER: return value * 1e3; case HECTOMETER: return value * 1e2; case DECAMETER: return value * 1e1; case METER: break; case DECIMETER: return value * 1e-1; case CENTIMETER: return value * 1e-2; case MILLIMETER: return value * 1e-3; case MICROMETER: return value * 1e-6; case NANOMETER: return value * 1e-9; case PICOMETER: return value * 1e-12; case FEMTOMETER: return value * 1e-15; default: throw new IllegalArgumentException(); } return value; }
[ "@", "Pure", "@", "SuppressWarnings", "(", "\"checkstyle:returncount\"", ")", "public", "static", "double", "toMeters", "(", "double", "value", ",", "SpaceUnit", "inputUnit", ")", "{", "switch", "(", "inputUnit", ")", "{", "case", "TERAMETER", ":", "return", "...
Convert the given value expressed in the given unit to meters. @param value is the value to convert @param inputUnit is the unit of the {@code value} @return the result of the convertion.
[ "Convert", "the", "given", "value", "expressed", "in", "the", "given", "unit", "to", "meters", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java#L422-L458
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java
SingularOps_DDRM.nullspaceQR
public static DMatrixRMaj nullspaceQR( DMatrixRMaj A , int totalSingular ) { SolveNullSpaceQR_DDRM solver = new SolveNullSpaceQR_DDRM(); DMatrixRMaj nullspace = new DMatrixRMaj(1,1); if( !solver.process(A,totalSingular,nullspace)) throw new RuntimeException("Solver failed. try SVD based method instead?"); return nullspace; }
java
public static DMatrixRMaj nullspaceQR( DMatrixRMaj A , int totalSingular ) { SolveNullSpaceQR_DDRM solver = new SolveNullSpaceQR_DDRM(); DMatrixRMaj nullspace = new DMatrixRMaj(1,1); if( !solver.process(A,totalSingular,nullspace)) throw new RuntimeException("Solver failed. try SVD based method instead?"); return nullspace; }
[ "public", "static", "DMatrixRMaj", "nullspaceQR", "(", "DMatrixRMaj", "A", ",", "int", "totalSingular", ")", "{", "SolveNullSpaceQR_DDRM", "solver", "=", "new", "SolveNullSpaceQR_DDRM", "(", ")", ";", "DMatrixRMaj", "nullspace", "=", "new", "DMatrixRMaj", "(", "1"...
Computes the null space using QR decomposition. This is much faster than using SVD @param A (Input) Matrix @param totalSingular Number of singular values @return Null space
[ "Computes", "the", "null", "space", "using", "QR", "decomposition", ".", "This", "is", "much", "faster", "than", "using", "SVD" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L434-L443
OpenTSDB/opentsdb
src/core/TSDB.java
TSDB.addHistogramPoint
public Deferred<Object> addHistogramPoint(final String metric, final long timestamp, final byte[] raw_data, final Map<String, String> tags) { if (raw_data == null || raw_data.length < MIN_HISTOGRAM_BYTES) { return Deferred.fromError(new IllegalArgumentException( "The histogram raw data is invalid: " + Bytes.pretty(raw_data))); } checkTimestampAndTags(metric, timestamp, raw_data, tags, (short) 0); final byte[] row = IncomingDataPoints.rowKeyTemplate(this, metric, tags); final byte[] qualifier = Internal.getQualifier(timestamp, HistogramDataPoint.PREFIX); return storeIntoDB(metric, timestamp, raw_data, tags, (short) 0, row, qualifier); }
java
public Deferred<Object> addHistogramPoint(final String metric, final long timestamp, final byte[] raw_data, final Map<String, String> tags) { if (raw_data == null || raw_data.length < MIN_HISTOGRAM_BYTES) { return Deferred.fromError(new IllegalArgumentException( "The histogram raw data is invalid: " + Bytes.pretty(raw_data))); } checkTimestampAndTags(metric, timestamp, raw_data, tags, (short) 0); final byte[] row = IncomingDataPoints.rowKeyTemplate(this, metric, tags); final byte[] qualifier = Internal.getQualifier(timestamp, HistogramDataPoint.PREFIX); return storeIntoDB(metric, timestamp, raw_data, tags, (short) 0, row, qualifier); }
[ "public", "Deferred", "<", "Object", ">", "addHistogramPoint", "(", "final", "String", "metric", ",", "final", "long", "timestamp", ",", "final", "byte", "[", "]", "raw_data", ",", "final", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "if"...
Adds an encoded Histogram data point in the TSDB. @param metric A non-empty string. @param timestamp The timestamp associated with the value. @param raw_data The encoded data blob of the Histogram point. @param tags The tags on this series. This map must be non-empty. @return A deferred object that indicates the completion of the request. The {@link Object} has not special meaning and can be {@code null} (think of it as {@code Deferred<Void>}). But you probably want to attach at least an errback to this {@code Deferred} to handle failures. @throws IllegalArgumentException if the timestamp is less than or equal to the previous timestamp added or 0 for the first timestamp, or if the difference with the previous timestamp is too large. @throws IllegalArgumentException if the metric name is empty or contains illegal characters. @throws IllegalArgumentException if the tags list is empty or one of the elements contains illegal characters. @throws HBaseException (deferred) if there was a problem while persisting data.
[ "Adds", "an", "encoded", "Histogram", "data", "point", "in", "the", "TSDB", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/TSDB.java#L1124-L1140
beanshell/beanshell
src/main/java/bsh/Reflect.java
Reflect.getObjectFieldValue
public static Object getObjectFieldValue( Object object, String fieldName ) throws UtilEvalError, ReflectError { if ( object instanceof This ) { return ((This) object).namespace.getVariable( fieldName ); } else if( object == Primitive.NULL ) { throw new UtilTargetError( new NullPointerException( "Attempt to access field '" +fieldName+"' on null value" ) ); } else { try { return getFieldValue( object.getClass(), object, fieldName, false/*onlystatic*/); } catch ( ReflectError e ) { // no field, try property access if ( hasObjectPropertyGetter( object.getClass(), fieldName ) ) return getObjectProperty( object, fieldName ); else throw e; } } }
java
public static Object getObjectFieldValue( Object object, String fieldName ) throws UtilEvalError, ReflectError { if ( object instanceof This ) { return ((This) object).namespace.getVariable( fieldName ); } else if( object == Primitive.NULL ) { throw new UtilTargetError( new NullPointerException( "Attempt to access field '" +fieldName+"' on null value" ) ); } else { try { return getFieldValue( object.getClass(), object, fieldName, false/*onlystatic*/); } catch ( ReflectError e ) { // no field, try property access if ( hasObjectPropertyGetter( object.getClass(), fieldName ) ) return getObjectProperty( object, fieldName ); else throw e; } } }
[ "public", "static", "Object", "getObjectFieldValue", "(", "Object", "object", ",", "String", "fieldName", ")", "throws", "UtilEvalError", ",", "ReflectError", "{", "if", "(", "object", "instanceof", "This", ")", "{", "return", "(", "(", "This", ")", "object", ...
Check for a field with the given name in a java object or scripted object if the field exists fetch the value, if not check for a property value. If neither is found return Primitive.VOID.
[ "Check", "for", "a", "field", "with", "the", "given", "name", "in", "a", "java", "object", "or", "scripted", "object", "if", "the", "field", "exists", "fetch", "the", "value", "if", "not", "check", "for", "a", "property", "value", ".", "If", "neither", ...
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Reflect.java#L139-L158
Wikidata/Wikidata-Toolkit
wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java
ClassPropertyUsageAnalyzer.countPropertyReference
private void countPropertyReference(PropertyIdValue property, int count) { PropertyRecord propertyRecord = getPropertyRecord(property); propertyRecord.referenceCount = propertyRecord.referenceCount + count; }
java
private void countPropertyReference(PropertyIdValue property, int count) { PropertyRecord propertyRecord = getPropertyRecord(property); propertyRecord.referenceCount = propertyRecord.referenceCount + count; }
[ "private", "void", "countPropertyReference", "(", "PropertyIdValue", "property", ",", "int", "count", ")", "{", "PropertyRecord", "propertyRecord", "=", "getPropertyRecord", "(", "property", ")", ";", "propertyRecord", ".", "referenceCount", "=", "propertyRecord", "."...
Counts additional occurrences of a property as property in references. @param property the property to count @param count the number of times to count the property
[ "Counts", "additional", "occurrences", "of", "a", "property", "as", "property", "in", "references", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java#L461-L464
derari/cthul
objects/src/main/java/org/cthul/objects/Boxing.java
Boxing.unboxAll
public static Object unboxAll(Class<?> type, Object src, int srcPos, int len) { switch (tId(type)) { case I_BOOLEAN: return unboxBooleans(src, srcPos, len); case I_BYTE: return unboxBytes(src, srcPos, len); case I_CHARACTER: return unboxCharacters(src, srcPos, len); case I_DOUBLE: return unboxDoubles(src, srcPos, len); case I_FLOAT: return unboxFloats(src, srcPos, len); case I_INTEGER: return unboxIntegers(src, srcPos, len); case I_LONG: return unboxLongs(src, srcPos, len); case I_SHORT: return unboxShorts(src, srcPos, len); } throw new IllegalArgumentException("No primitive/box: " + type); }
java
public static Object unboxAll(Class<?> type, Object src, int srcPos, int len) { switch (tId(type)) { case I_BOOLEAN: return unboxBooleans(src, srcPos, len); case I_BYTE: return unboxBytes(src, srcPos, len); case I_CHARACTER: return unboxCharacters(src, srcPos, len); case I_DOUBLE: return unboxDoubles(src, srcPos, len); case I_FLOAT: return unboxFloats(src, srcPos, len); case I_INTEGER: return unboxIntegers(src, srcPos, len); case I_LONG: return unboxLongs(src, srcPos, len); case I_SHORT: return unboxShorts(src, srcPos, len); } throw new IllegalArgumentException("No primitive/box: " + type); }
[ "public", "static", "Object", "unboxAll", "(", "Class", "<", "?", ">", "type", ",", "Object", "src", ",", "int", "srcPos", ",", "int", "len", ")", "{", "switch", "(", "tId", "(", "type", ")", ")", "{", "case", "I_BOOLEAN", ":", "return", "unboxBoolea...
Transforms any array into a primitive array. @param type target type @param src source array @param srcPos start position @param len length @return primitive array
[ "Transforms", "any", "array", "into", "a", "primitive", "array", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L183-L195
liferay/com-liferay-commerce
commerce-tax-service/src/main/java/com/liferay/commerce/tax/service/persistence/impl/CommerceTaxMethodPersistenceImpl.java
CommerceTaxMethodPersistenceImpl.findByGroupId
@Override public List<CommerceTaxMethod> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceTaxMethod> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceTaxMethod", ">", "findByGroupId", "(", "long", "groupId", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce tax methods where groupId = &#63;. @param groupId the group ID @return the matching commerce tax methods
[ "Returns", "all", "the", "commerce", "tax", "methods", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-service/src/main/java/com/liferay/commerce/tax/service/persistence/impl/CommerceTaxMethodPersistenceImpl.java#L125-L128
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.removeFrom
public boolean removeFrom(ST obj, PT pt) { return removeAfter(indexOf(obj, pt), true); }
java
public boolean removeFrom(ST obj, PT pt) { return removeAfter(indexOf(obj, pt), true); }
[ "public", "boolean", "removeFrom", "(", "ST", "obj", ",", "PT", "pt", ")", "{", "return", "removeAfter", "(", "indexOf", "(", "obj", ",", "pt", ")", ",", "true", ")", ";", "}" ]
Remove the path's elements after the specified one which is starting at the specified point. The specified element will be removed. <p>This function removes after the <i>first occurence</i> of the given object. @param obj is the segment to remove @param pt is the point on which the segment was connected as its first point. @return <code>true</code> on success, otherwise <code>false</code>
[ "Remove", "the", "path", "s", "elements", "after", "the", "specified", "one", "which", "is", "starting", "at", "the", "specified", "point", ".", "The", "specified", "element", "will", "be", "removed", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L871-L873
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/GameContainer.java
GameContainer.enableSharedContext
public static void enableSharedContext() throws SlickException { try { SHARED_DRAWABLE = new Pbuffer(64, 64, new PixelFormat(8, 0, 0), null); } catch (LWJGLException e) { throw new SlickException("Unable to create the pbuffer used for shard context, buffers not supported", e); } }
java
public static void enableSharedContext() throws SlickException { try { SHARED_DRAWABLE = new Pbuffer(64, 64, new PixelFormat(8, 0, 0), null); } catch (LWJGLException e) { throw new SlickException("Unable to create the pbuffer used for shard context, buffers not supported", e); } }
[ "public", "static", "void", "enableSharedContext", "(", ")", "throws", "SlickException", "{", "try", "{", "SHARED_DRAWABLE", "=", "new", "Pbuffer", "(", "64", ",", "64", ",", "new", "PixelFormat", "(", "8", ",", "0", ",", "0", ")", ",", "null", ")", ";...
Enable shared OpenGL context. After calling this all containers created will shared a single parent context @throws SlickException Indicates a failure to create the shared drawable
[ "Enable", "shared", "OpenGL", "context", ".", "After", "calling", "this", "all", "containers", "created", "will", "shared", "a", "single", "parent", "context" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/GameContainer.java#L207-L213
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java
Whitebox.getMethod
public static Method getMethod(Class<?> type, Class<?>... parameterTypes) { return WhiteboxImpl.getMethod(type, parameterTypes); }
java
public static Method getMethod(Class<?> type, Class<?>... parameterTypes) { return WhiteboxImpl.getMethod(type, parameterTypes); }
[ "public", "static", "Method", "getMethod", "(", "Class", "<", "?", ">", "type", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "return", "WhiteboxImpl", ".", "getMethod", "(", "type", ",", "parameterTypes", ")", ";", "}" ]
Convenience method to get a method from a class type without having to catch the checked exceptions otherwise required. These exceptions are wrapped as runtime exceptions. <p> The method will first try to look for a declared method in the same class. If the method is not declared in this class it will look for the method in the super class. This will continue throughout the whole class hierarchy. If the method is not found an {@link MethodNotFoundException} is thrown. Since the method name is not specified an {@link TooManyMethodsFoundException} is thrown if two or more methods matches the same parameter types in the same class. @param type The type of the class where the method is located. @param parameterTypes All parameter types of the method (may be {@code null}). @return A {@code java.lang.reflect.Method}. @throws MethodNotFoundException If a method cannot be found in the hierarchy. @throws TooManyMethodsFoundException If several methods were found.
[ "Convenience", "method", "to", "get", "a", "method", "from", "a", "class", "type", "without", "having", "to", "catch", "the", "checked", "exceptions", "otherwise", "required", ".", "These", "exceptions", "are", "wrapped", "as", "runtime", "exceptions", ".", "<...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L120-L122
kohsuke/args4j
args4j/src/org/kohsuke/args4j/CmdLineParser.java
CmdLineParser.addArgument
public void addArgument(Setter setter, Argument a) { checkNonNull(setter, "Setter"); checkNonNull(a, "Argument"); OptionHandler h = createOptionHandler(new OptionDef(a,setter.isMultiValued()),setter); int index = a.index(); // make sure the argument will fit in the list while (index >= arguments.size()) { arguments.add(null); } if(arguments.get(index)!=null) { throw new IllegalAnnotationError(Messages.MULTIPLE_USE_OF_ARGUMENT.format(index)); } arguments.set(index, h); }
java
public void addArgument(Setter setter, Argument a) { checkNonNull(setter, "Setter"); checkNonNull(a, "Argument"); OptionHandler h = createOptionHandler(new OptionDef(a,setter.isMultiValued()),setter); int index = a.index(); // make sure the argument will fit in the list while (index >= arguments.size()) { arguments.add(null); } if(arguments.get(index)!=null) { throw new IllegalAnnotationError(Messages.MULTIPLE_USE_OF_ARGUMENT.format(index)); } arguments.set(index, h); }
[ "public", "void", "addArgument", "(", "Setter", "setter", ",", "Argument", "a", ")", "{", "checkNonNull", "(", "setter", ",", "\"Setter\"", ")", ";", "checkNonNull", "(", "a", ",", "\"Argument\"", ")", ";", "OptionHandler", "h", "=", "createOptionHandler", "...
Programmatically defines an argument (instead of reading it from annotations as normal). @param setter the setter for the type @param a the Argument @throws NullPointerException if {@code setter} or {@code a} is {@code null}.
[ "Programmatically", "defines", "an", "argument", "(", "instead", "of", "reading", "it", "from", "annotations", "as", "normal", ")", "." ]
train
https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L114-L128
json-path/JsonPath
json-path/src/main/java/com/jayway/jsonpath/spi/json/AbstractJsonProvider.java
AbstractJsonProvider.setProperty
@SuppressWarnings("unchecked") public void setProperty(Object obj, Object key, Object value) { if (isMap(obj)) ((Map) obj).put(key.toString(), value); else { throw new JsonPathException("setProperty operation cannot be used with " + obj!=null?obj.getClass().getName():"null"); } }
java
@SuppressWarnings("unchecked") public void setProperty(Object obj, Object key, Object value) { if (isMap(obj)) ((Map) obj).put(key.toString(), value); else { throw new JsonPathException("setProperty operation cannot be used with " + obj!=null?obj.getClass().getName():"null"); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "setProperty", "(", "Object", "obj", ",", "Object", "key", ",", "Object", "value", ")", "{", "if", "(", "isMap", "(", "obj", ")", ")", "(", "(", "Map", ")", "obj", ")", ".", "put",...
Sets a value in an object @param obj an object @param key a String key @param value the value to set
[ "Sets", "a", "value", "in", "an", "object" ]
train
https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/spi/json/AbstractJsonProvider.java#L88-L95
mozilla/rhino
src/org/mozilla/javascript/SecurityController.java
SecurityController.callWithDomain
public Object callWithDomain(Object securityDomain, Context cx, final Callable callable, Scriptable scope, final Scriptable thisObj, final Object[] args) { return execWithDomain(cx, scope, new Script() { @Override public Object exec(Context cx, Scriptable scope) { return callable.call(cx, scope, thisObj, args); } }, securityDomain); }
java
public Object callWithDomain(Object securityDomain, Context cx, final Callable callable, Scriptable scope, final Scriptable thisObj, final Object[] args) { return execWithDomain(cx, scope, new Script() { @Override public Object exec(Context cx, Scriptable scope) { return callable.call(cx, scope, thisObj, args); } }, securityDomain); }
[ "public", "Object", "callWithDomain", "(", "Object", "securityDomain", ",", "Context", "cx", ",", "final", "Callable", "callable", ",", "Scriptable", "scope", ",", "final", "Scriptable", "thisObj", ",", "final", "Object", "[", "]", "args", ")", "{", "return", ...
Call {@link Callable#call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args)} of <i>callable</i> under restricted security domain where an action is allowed only if it is allowed according to the Java stack on the moment of the <i>execWithDomain</i> call and <i>securityDomain</i>. Any call to {@link #getDynamicSecurityDomain(Object)} during execution of <tt>callable.call(cx, scope, thisObj, args)</tt> should return a domain incorporate restrictions imposed by <i>securityDomain</i> and Java stack on the moment of callWithDomain invocation. <p> The method should always be overridden, it is not declared abstract for compatibility reasons.
[ "Call", "{" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/SecurityController.java#L152-L165
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/GuardedByChecker.java
GuardedByChecker.buildMessage
private String buildMessage(GuardedByExpression guard, HeldLockSet locks) { int heldLocks = locks.allLocks().size(); StringBuilder message = new StringBuilder(); Select enclosing = findOuterInstance(guard); if (enclosing != null && !enclosingInstance(guard)) { if (guard == enclosing) { message.append( String.format( "Access should be guarded by enclosing instance '%s' of '%s'," + " which is not accessible in this scope", enclosing.sym().owner, enclosing.base())); } else { message.append( String.format( "Access should be guarded by '%s' in enclosing instance '%s' of '%s'," + " which is not accessible in this scope", guard.sym(), enclosing.sym().owner, enclosing.base())); } if (heldLocks > 0) { message.append( String.format("; instead found: '%s'", Joiner.on("', '").join(locks.allLocks()))); } return message.toString(); } message.append(String.format("This access should be guarded by '%s'", guard)); if (guard.kind() == GuardedByExpression.Kind.ERROR) { message.append(", which could not be resolved"); return message.toString(); } if (heldLocks == 0) { message.append(", which is not currently held"); } else { message.append( String.format("; instead found: '%s'", Joiner.on("', '").join(locks.allLocks()))); } return message.toString(); }
java
private String buildMessage(GuardedByExpression guard, HeldLockSet locks) { int heldLocks = locks.allLocks().size(); StringBuilder message = new StringBuilder(); Select enclosing = findOuterInstance(guard); if (enclosing != null && !enclosingInstance(guard)) { if (guard == enclosing) { message.append( String.format( "Access should be guarded by enclosing instance '%s' of '%s'," + " which is not accessible in this scope", enclosing.sym().owner, enclosing.base())); } else { message.append( String.format( "Access should be guarded by '%s' in enclosing instance '%s' of '%s'," + " which is not accessible in this scope", guard.sym(), enclosing.sym().owner, enclosing.base())); } if (heldLocks > 0) { message.append( String.format("; instead found: '%s'", Joiner.on("', '").join(locks.allLocks()))); } return message.toString(); } message.append(String.format("This access should be guarded by '%s'", guard)); if (guard.kind() == GuardedByExpression.Kind.ERROR) { message.append(", which could not be resolved"); return message.toString(); } if (heldLocks == 0) { message.append(", which is not currently held"); } else { message.append( String.format("; instead found: '%s'", Joiner.on("', '").join(locks.allLocks()))); } return message.toString(); }
[ "private", "String", "buildMessage", "(", "GuardedByExpression", "guard", ",", "HeldLockSet", "locks", ")", "{", "int", "heldLocks", "=", "locks", ".", "allLocks", "(", ")", ".", "size", "(", ")", ";", "StringBuilder", "message", "=", "new", "StringBuilder", ...
Construct a diagnostic message, e.g.: <ul> <li>This access should be guarded by 'this', which is not currently held <li>This access should be guarded by 'this'; instead found 'mu' <li>This access should be guarded by 'this'; instead found: 'mu1', 'mu2' </ul>
[ "Construct", "a", "diagnostic", "message", "e", ".", "g", ".", ":" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/GuardedByChecker.java#L128-L164
spotify/apollo
apollo-api-impl/src/main/java/com/spotify/apollo/dispatch/EndpointInvocationHandler.java
EndpointInvocationHandler.handle
void handle(OngoingRequest ongoingRequest, RequestContext requestContext, Endpoint endpoint) { try { endpoint.invoke(requestContext) .whenComplete((message, throwable) -> { try { if (message != null) { ongoingRequest.reply(message); } else if (throwable != null) { // unwrap CompletionException if (throwable instanceof CompletionException) { throwable = throwable.getCause(); } handleException(throwable, ongoingRequest); } else { LOG.error( "Both message and throwable null in EndpointInvocationHandler for request " + ongoingRequest + " - this shouldn't happen!"); handleException(new IllegalStateException("Both message and throwable null"), ongoingRequest); } } catch (Throwable t) { // don't try to respond here; just log the fact that responding failed. LOG.error("Exception caught when replying", t); } }); } catch (Exception e) { handleException(e, ongoingRequest); } }
java
void handle(OngoingRequest ongoingRequest, RequestContext requestContext, Endpoint endpoint) { try { endpoint.invoke(requestContext) .whenComplete((message, throwable) -> { try { if (message != null) { ongoingRequest.reply(message); } else if (throwable != null) { // unwrap CompletionException if (throwable instanceof CompletionException) { throwable = throwable.getCause(); } handleException(throwable, ongoingRequest); } else { LOG.error( "Both message and throwable null in EndpointInvocationHandler for request " + ongoingRequest + " - this shouldn't happen!"); handleException(new IllegalStateException("Both message and throwable null"), ongoingRequest); } } catch (Throwable t) { // don't try to respond here; just log the fact that responding failed. LOG.error("Exception caught when replying", t); } }); } catch (Exception e) { handleException(e, ongoingRequest); } }
[ "void", "handle", "(", "OngoingRequest", "ongoingRequest", ",", "RequestContext", "requestContext", ",", "Endpoint", "endpoint", ")", "{", "try", "{", "endpoint", ".", "invoke", "(", "requestContext", ")", ".", "whenComplete", "(", "(", "message", ",", "throwabl...
Fires off the request processing asynchronously - that is, this method is likely to return before the request processing finishes.
[ "Fires", "off", "the", "request", "processing", "asynchronously", "-", "that", "is", "this", "method", "is", "likely", "to", "return", "before", "the", "request", "processing", "finishes", "." ]
train
https://github.com/spotify/apollo/blob/3aba09840538a2aff9cdac5be42cc114dd276c70/apollo-api-impl/src/main/java/com/spotify/apollo/dispatch/EndpointInvocationHandler.java#L54-L83
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.saveGridFSFile
private void saveGridFSFile(GridFSInputFile gfsInputFile, EntityMetadata m) { try { DBCollection coll = mongoDb.getCollection(m.getTableName() + MongoDBUtils.FILES); createUniqueIndexGFS(coll, ((AbstractAttribute) m.getIdAttribute()).getJPAColumnName()); gfsInputFile.save(); log.info("Input GridFS file: " + gfsInputFile.getFilename() + " is saved successfully in " + m.getTableName() + MongoDBUtils.CHUNKS + " and metadata in " + m.getTableName() + MongoDBUtils.FILES); } catch (MongoException e) { log.error("Error in saving GridFS file in " + m.getTableName() + MongoDBUtils.FILES + " or " + m.getTableName() + MongoDBUtils.CHUNKS + " collections."); throw new KunderaException("Error in saving GridFS file in " + m.getTableName() + MongoDBUtils.FILES + " or " + m.getTableName() + MongoDBUtils.CHUNKS + " collections. Caused By: ", e); } try { gfsInputFile.validate(); log.info("Input GridFS file: " + gfsInputFile.getFilename() + " is validated."); } catch (MongoException e) { log.error("Error in validating GridFS file in " + m.getTableName() + MongoDBUtils.FILES + " collection."); throw new KunderaException("Error in validating GridFS file in " + m.getTableName() + MongoDBUtils.FILES + " collection. Caused By: ", e); } }
java
private void saveGridFSFile(GridFSInputFile gfsInputFile, EntityMetadata m) { try { DBCollection coll = mongoDb.getCollection(m.getTableName() + MongoDBUtils.FILES); createUniqueIndexGFS(coll, ((AbstractAttribute) m.getIdAttribute()).getJPAColumnName()); gfsInputFile.save(); log.info("Input GridFS file: " + gfsInputFile.getFilename() + " is saved successfully in " + m.getTableName() + MongoDBUtils.CHUNKS + " and metadata in " + m.getTableName() + MongoDBUtils.FILES); } catch (MongoException e) { log.error("Error in saving GridFS file in " + m.getTableName() + MongoDBUtils.FILES + " or " + m.getTableName() + MongoDBUtils.CHUNKS + " collections."); throw new KunderaException("Error in saving GridFS file in " + m.getTableName() + MongoDBUtils.FILES + " or " + m.getTableName() + MongoDBUtils.CHUNKS + " collections. Caused By: ", e); } try { gfsInputFile.validate(); log.info("Input GridFS file: " + gfsInputFile.getFilename() + " is validated."); } catch (MongoException e) { log.error("Error in validating GridFS file in " + m.getTableName() + MongoDBUtils.FILES + " collection."); throw new KunderaException("Error in validating GridFS file in " + m.getTableName() + MongoDBUtils.FILES + " collection. Caused By: ", e); } }
[ "private", "void", "saveGridFSFile", "(", "GridFSInputFile", "gfsInputFile", ",", "EntityMetadata", "m", ")", "{", "try", "{", "DBCollection", "coll", "=", "mongoDb", ".", "getCollection", "(", "m", ".", "getTableName", "(", ")", "+", "MongoDBUtils", ".", "FIL...
Save GRID FS file. @param gfsInputFile the gfs input file @param m the m
[ "Save", "GRID", "FS", "file", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L1121-L1150
jfinal/jfinal
src/main/java/com/jfinal/plugin/activerecord/Model.java
Model.deleteByIds
public boolean deleteByIds(Object... idValues) { Table table = _getTable(); if (idValues == null || idValues.length != table.getPrimaryKey().length) throw new IllegalArgumentException("Primary key nubmer must equals id value number and can not be null"); return deleteById(table, idValues); }
java
public boolean deleteByIds(Object... idValues) { Table table = _getTable(); if (idValues == null || idValues.length != table.getPrimaryKey().length) throw new IllegalArgumentException("Primary key nubmer must equals id value number and can not be null"); return deleteById(table, idValues); }
[ "public", "boolean", "deleteByIds", "(", "Object", "...", "idValues", ")", "{", "Table", "table", "=", "_getTable", "(", ")", ";", "if", "(", "idValues", "==", "null", "||", "idValues", ".", "length", "!=", "table", ".", "getPrimaryKey", "(", ")", ".", ...
Delete model by composite id values. @param idValues the composite id values of the model @return true if delete succeed otherwise false
[ "Delete", "model", "by", "composite", "id", "values", "." ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L606-L612
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/JulianChronology.java
JulianChronology.dateYearDay
@Override public JulianDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
java
@Override public JulianDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
[ "@", "Override", "public", "JulianDate", "dateYearDay", "(", "Era", "era", ",", "int", "yearOfEra", ",", "int", "dayOfYear", ")", "{", "return", "dateYearDay", "(", "prolepticYear", "(", "era", ",", "yearOfEra", ")", ",", "dayOfYear", ")", ";", "}" ]
Obtains a local date in Julian calendar system from the era, year-of-era and day-of-year fields. @param era the Julian era, not null @param yearOfEra the year-of-era @param dayOfYear the day-of-year @return the Julian local date, not null @throws DateTimeException if unable to create the date @throws ClassCastException if the {@code era} is not a {@code JulianEra}
[ "Obtains", "a", "local", "date", "in", "Julian", "calendar", "system", "from", "the", "era", "year", "-", "of", "-", "era", "and", "day", "-", "of", "-", "year", "fields", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/JulianChronology.java#L201-L204
att/openstacksdk
openstack-java-sdk/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java
JerseyConnector.getSSLContext
private SSLContext getSSLContext() throws NoSuchAlgorithmException, KeyManagementException { SSLContext sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, new TrustManager[] { new X509TrustManager() { @Override public void checkClientTrusted(X509Certificate[] certs, String authType) { // nop } @Override public void checkServerTrusted(X509Certificate[] certs, String authType) { // nop } @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } } }, new java.security.SecureRandom()); return sslContext; }
java
private SSLContext getSSLContext() throws NoSuchAlgorithmException, KeyManagementException { SSLContext sslContext = SSLContext.getInstance("SSL"); sslContext.init(null, new TrustManager[] { new X509TrustManager() { @Override public void checkClientTrusted(X509Certificate[] certs, String authType) { // nop } @Override public void checkServerTrusted(X509Certificate[] certs, String authType) { // nop } @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } } }, new java.security.SecureRandom()); return sslContext; }
[ "private", "SSLContext", "getSSLContext", "(", ")", "throws", "NoSuchAlgorithmException", ",", "KeyManagementException", "{", "SSLContext", "sslContext", "=", "SSLContext", ".", "getInstance", "(", "\"SSL\"", ")", ";", "sslContext", ".", "init", "(", "null", ",", ...
This SSLContext is used only when the protocol is HTTPS AND a trusted hosts list has been provided. In that case, this SSLContext accepts all certificates, whether they are expired or not, and regardless of the CA that issued them. @return An SSL context that does not validate certificates @throws NoSuchAlgorithmException @throws KeyManagementException
[ "This", "SSLContext", "is", "used", "only", "when", "the", "protocol", "is", "HTTPS", "AND", "a", "trusted", "hosts", "list", "has", "been", "provided", ".", "In", "that", "case", "this", "SSLContext", "accepts", "all", "certificates", "whether", "they", "ar...
train
https://github.com/att/openstacksdk/blob/16a81c460a7186ebe1ea63b7682486ba147208b9/openstack-java-sdk/openstack-client-connectors/jersey-connector/src/main/java/com/woorea/openstack/connector/JerseyConnector.java#L335-L356
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java
AStar.solve
@Pure public GP solve(PT startPoint, PT endPoint) { return solve( node(startPoint, 0f, estimate(startPoint, endPoint), null), endPoint); }
java
@Pure public GP solve(PT startPoint, PT endPoint) { return solve( node(startPoint, 0f, estimate(startPoint, endPoint), null), endPoint); }
[ "@", "Pure", "public", "GP", "solve", "(", "PT", "startPoint", ",", "PT", "endPoint", ")", "{", "return", "solve", "(", "node", "(", "startPoint", ",", "0f", ",", "estimate", "(", "startPoint", ",", "endPoint", ")", ",", "null", ")", ",", "endPoint", ...
Run the A* algorithm assuming that the graph is oriented is an orientation tool was passed to the constructor. <p>The orientation of the graph may also be overridden by the implementations of the {@link AStarNode A* nodes}. @param startPoint is the starting point. @param endPoint is the point to reach. @return the found path, or <code>null</code> if none found.
[ "Run", "the", "A", "*", "algorithm", "assuming", "that", "the", "graph", "is", "oriented", "is", "an", "orientation", "tool", "was", "passed", "to", "the", "constructor", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L414-L421
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsTypesTab.java
CmsTypesTab.updateContent
public void updateContent(List<CmsResourceTypeBean> types, List<String> selectedTypes) { clearList(); fillContent(types, selectedTypes); }
java
public void updateContent(List<CmsResourceTypeBean> types, List<String> selectedTypes) { clearList(); fillContent(types, selectedTypes); }
[ "public", "void", "updateContent", "(", "List", "<", "CmsResourceTypeBean", ">", "types", ",", "List", "<", "String", ">", "selectedTypes", ")", "{", "clearList", "(", ")", ";", "fillContent", "(", "types", ",", "selectedTypes", ")", ";", "}" ]
Updates the types list.<p> @param types the new types list @param selectedTypes the list of types to select
[ "Updates", "the", "types", "list", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsTypesTab.java#L250-L254
casbin/jcasbin
src/main/java/org/casbin/jcasbin/main/Enforcer.java
Enforcer.hasRoleForUser
public boolean hasRoleForUser(String name, String role) { List<String> roles = getRolesForUser(name); boolean hasRole = false; for (String r : roles) { if (r.equals(role)) { hasRole = true; break; } } return hasRole; }
java
public boolean hasRoleForUser(String name, String role) { List<String> roles = getRolesForUser(name); boolean hasRole = false; for (String r : roles) { if (r.equals(role)) { hasRole = true; break; } } return hasRole; }
[ "public", "boolean", "hasRoleForUser", "(", "String", "name", ",", "String", "role", ")", "{", "List", "<", "String", ">", "roles", "=", "getRolesForUser", "(", "name", ")", ";", "boolean", "hasRole", "=", "false", ";", "for", "(", "String", "r", ":", ...
hasRoleForUser determines whether a user has a role. @param name the user. @param role the role. @return whether the user has the role.
[ "hasRoleForUser", "determines", "whether", "a", "user", "has", "a", "role", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L151-L163
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.createGridGeometryGeneralParameter
public static GeneralParameterValue[] createGridGeometryGeneralParameter( RegionMap regionMap, CoordinateReferenceSystem crs ) { GeneralParameterValue[] readParams = new GeneralParameterValue[1]; Parameter<GridGeometry2D> readGG = new Parameter<GridGeometry2D>(AbstractGridFormat.READ_GRIDGEOMETRY2D); GridEnvelope2D gridEnvelope = new GridEnvelope2D(0, 0, regionMap.getCols(), regionMap.getRows()); Envelope env; double north = regionMap.getNorth(); double south = regionMap.getSouth(); double east = regionMap.getEast(); double west = regionMap.getWest(); if (crs != null) { env = new ReferencedEnvelope(west, east, south, north, crs); } else { DirectPosition2D minDp = new DirectPosition2D(west, south); DirectPosition2D maxDp = new DirectPosition2D(east, north); env = new Envelope2D(minDp, maxDp); } readGG.setValue(new GridGeometry2D(gridEnvelope, env)); readParams[0] = readGG; return readParams; }
java
public static GeneralParameterValue[] createGridGeometryGeneralParameter( RegionMap regionMap, CoordinateReferenceSystem crs ) { GeneralParameterValue[] readParams = new GeneralParameterValue[1]; Parameter<GridGeometry2D> readGG = new Parameter<GridGeometry2D>(AbstractGridFormat.READ_GRIDGEOMETRY2D); GridEnvelope2D gridEnvelope = new GridEnvelope2D(0, 0, regionMap.getCols(), regionMap.getRows()); Envelope env; double north = regionMap.getNorth(); double south = regionMap.getSouth(); double east = regionMap.getEast(); double west = regionMap.getWest(); if (crs != null) { env = new ReferencedEnvelope(west, east, south, north, crs); } else { DirectPosition2D minDp = new DirectPosition2D(west, south); DirectPosition2D maxDp = new DirectPosition2D(east, north); env = new Envelope2D(minDp, maxDp); } readGG.setValue(new GridGeometry2D(gridEnvelope, env)); readParams[0] = readGG; return readParams; }
[ "public", "static", "GeneralParameterValue", "[", "]", "createGridGeometryGeneralParameter", "(", "RegionMap", "regionMap", ",", "CoordinateReferenceSystem", "crs", ")", "{", "GeneralParameterValue", "[", "]", "readParams", "=", "new", "GeneralParameterValue", "[", "1", ...
Utility method to create read parameters for {@link GridCoverageReader} @param regionMap the RegionMap. @param crs the {@link CoordinateReferenceSystem}. Can be null, even if it should not. @return the {@link GeneralParameterValue array of parameters}.
[ "Utility", "method", "to", "create", "read", "parameters", "for", "{", "@link", "GridCoverageReader", "}" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L650-L670
FudanNLP/fnlp
fnlp-core/src/main/java/org/fnlp/ml/classifier/LinkedPredict.java
LinkedPredict.add
public int add(T label,float score) { int j = 0; for(; j < labels.size(); j++) if(scores.get(j) < score){ labels.add(j, label); scores.add(j,score); break; } if(j == labels.size() && labels.size() < k){ labels.add(j, label); scores.add(j,score); } if(labels.size() > k){ labels.removeLast(); scores.removeLast(); } return j; }
java
public int add(T label,float score) { int j = 0; for(; j < labels.size(); j++) if(scores.get(j) < score){ labels.add(j, label); scores.add(j,score); break; } if(j == labels.size() && labels.size() < k){ labels.add(j, label); scores.add(j,score); } if(labels.size() > k){ labels.removeLast(); scores.removeLast(); } return j; }
[ "public", "int", "add", "(", "T", "label", ",", "float", "score", ")", "{", "int", "j", "=", "0", ";", "for", "(", ";", "j", "<", "labels", ".", "size", "(", ")", ";", "j", "++", ")", "if", "(", "scores", ".", "get", "(", "j", ")", "<", "...
增加新的标签和得分,并根据得分调整排序 * @param label 标签 @param score 得分 @return 插入位置
[ "增加新的标签和得分,并根据得分调整排序", "*" ]
train
https://github.com/FudanNLP/fnlp/blob/ce258f3e4a5add2ba0b5e4cbac7cab2190af6659/fnlp-core/src/main/java/org/fnlp/ml/classifier/LinkedPredict.java#L84-L104
netty/netty
common/src/main/java/io/netty/util/AsciiString.java
AsciiString.containsAllContentEqualsIgnoreCase
public static boolean containsAllContentEqualsIgnoreCase(Collection<CharSequence> a, Collection<CharSequence> b) { for (CharSequence v : b) { if (!containsContentEqualsIgnoreCase(a, v)) { return false; } } return true; }
java
public static boolean containsAllContentEqualsIgnoreCase(Collection<CharSequence> a, Collection<CharSequence> b) { for (CharSequence v : b) { if (!containsContentEqualsIgnoreCase(a, v)) { return false; } } return true; }
[ "public", "static", "boolean", "containsAllContentEqualsIgnoreCase", "(", "Collection", "<", "CharSequence", ">", "a", ",", "Collection", "<", "CharSequence", ">", "b", ")", "{", "for", "(", "CharSequence", "v", ":", "b", ")", "{", "if", "(", "!", "containsC...
Determine if {@code a} contains all of the values in {@code b} using {@link #contentEqualsIgnoreCase(CharSequence, CharSequence)} to compare values. @param a The collection under test. @param b The values to test for. @return {@code true} if {@code a} contains all of the values in {@code b} using {@link #contentEqualsIgnoreCase(CharSequence, CharSequence)} to compare values. {@code false} otherwise. @see #contentEqualsIgnoreCase(CharSequence, CharSequence)
[ "Determine", "if", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L1490-L1497
bazaarvoice/emodb
common/uuid/src/main/java/com/bazaarvoice/emodb/common/uuid/TimeUUIDs.java
TimeUUIDs.uuidForTimeMillis
public static UUID uuidForTimeMillis(long timeMillis, int sequence) { long time = getRawTimestamp(timeMillis); return new UUID(getMostSignificantBits(time), getLeastSignificantBits(sequence, 0)); }
java
public static UUID uuidForTimeMillis(long timeMillis, int sequence) { long time = getRawTimestamp(timeMillis); return new UUID(getMostSignificantBits(time), getLeastSignificantBits(sequence, 0)); }
[ "public", "static", "UUID", "uuidForTimeMillis", "(", "long", "timeMillis", ",", "int", "sequence", ")", "{", "long", "time", "=", "getRawTimestamp", "(", "timeMillis", ")", ";", "return", "new", "UUID", "(", "getMostSignificantBits", "(", "time", ")", ",", ...
Fabricates a non-unique UUID value for the specified timestamp that sorts relative to other similar UUIDs based on the value of {@code sequence}. Be very careful about using this as a unique identifier since the usual protections against conflicts do not apply. At most, only assume this is unique within a specific context where the sequence number is unique w/in that context.
[ "Fabricates", "a", "non", "-", "unique", "UUID", "value", "for", "the", "specified", "timestamp", "that", "sorts", "relative", "to", "other", "similar", "UUIDs", "based", "on", "the", "value", "of", "{" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/uuid/src/main/java/com/bazaarvoice/emodb/common/uuid/TimeUUIDs.java#L83-L86
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataPropertyRangeAxiomImpl_CustomFieldSerializer.java
OWLDataPropertyRangeAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDataPropertyRangeAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDataPropertyRangeAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLDataPropertyRangeAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataPropertyRangeAxiomImpl_CustomFieldSerializer.java#L99-L102
fuzzylite/jfuzzylite
jfuzzylite/src/main/java/com/fuzzylite/rule/Rule.java
Rule.activateWith
public double activateWith(TNorm conjunction, SNorm disjunction) { if (!isLoaded()) { throw new RuntimeException(String.format("[rule error] the following rule is not loaded: %s", text)); } activationDegree = weight * antecedent.activationDegree(conjunction, disjunction); return activationDegree; }
java
public double activateWith(TNorm conjunction, SNorm disjunction) { if (!isLoaded()) { throw new RuntimeException(String.format("[rule error] the following rule is not loaded: %s", text)); } activationDegree = weight * antecedent.activationDegree(conjunction, disjunction); return activationDegree; }
[ "public", "double", "activateWith", "(", "TNorm", "conjunction", ",", "SNorm", "disjunction", ")", "{", "if", "(", "!", "isLoaded", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "String", ".", "format", "(", "\"[rule error] the following rule is n...
Activates the rule by computing its activation degree using the given conjunction and disjunction operators @param conjunction is the conjunction operator @param disjunction is the disjunction operator @return the activation degree of the rule
[ "Activates", "the", "rule", "by", "computing", "its", "activation", "degree", "using", "the", "given", "conjunction", "and", "disjunction", "operators" ]
train
https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/rule/Rule.java#L238-L244
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Query.java
Query.newGqlQueryBuilder
public static <V> GqlQuery.Builder<V> newGqlQueryBuilder(ResultType<V> resultType, String gql) { return new GqlQuery.Builder<>(resultType, gql); }
java
public static <V> GqlQuery.Builder<V> newGqlQueryBuilder(ResultType<V> resultType, String gql) { return new GqlQuery.Builder<>(resultType, gql); }
[ "public", "static", "<", "V", ">", "GqlQuery", ".", "Builder", "<", "V", ">", "newGqlQueryBuilder", "(", "ResultType", "<", "V", ">", "resultType", ",", "String", "gql", ")", "{", "return", "new", "GqlQuery", ".", "Builder", "<>", "(", "resultType", ",",...
Returns a new {@link GqlQuery} builder. <p>Example of creating and running a typed GQL query. <pre>{@code String kind = "my_kind"; String gqlQuery = "select * from " + kind; Query<Entity> query = Query.newGqlQueryBuilder(Query.ResultType.ENTITY, gqlQuery).build(); QueryResults<Entity> results = datastore.run(query); // Use results }</pre> @see <a href="https://cloud.google.com/datastore/docs/apis/gql/gql_reference">GQL Reference</a>
[ "Returns", "a", "new", "{", "@link", "GqlQuery", "}", "builder", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Query.java#L214-L216
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.maxArrayLike
public LambdaDslObject maxArrayLike(String name, Integer size, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody maxArrayLike = object.maxArrayLike(name, size); final LambdaDslObject dslObject = new LambdaDslObject(maxArrayLike); nestedObject.accept(dslObject); maxArrayLike.closeArray(); return this; }
java
public LambdaDslObject maxArrayLike(String name, Integer size, Consumer<LambdaDslObject> nestedObject) { final PactDslJsonBody maxArrayLike = object.maxArrayLike(name, size); final LambdaDslObject dslObject = new LambdaDslObject(maxArrayLike); nestedObject.accept(dslObject); maxArrayLike.closeArray(); return this; }
[ "public", "LambdaDslObject", "maxArrayLike", "(", "String", "name", ",", "Integer", "size", ",", "Consumer", "<", "LambdaDslObject", ">", "nestedObject", ")", "{", "final", "PactDslJsonBody", "maxArrayLike", "=", "object", ".", "maxArrayLike", "(", "name", ",", ...
Attribute that is an array with a maximum size where each item must match the following example @param name field name @param size maximum size of the array
[ "Attribute", "that", "is", "an", "array", "with", "a", "maximum", "size", "where", "each", "item", "must", "match", "the", "following", "example" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L481-L487
looly/hutool
hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java
HashCodeBuilder.reflectionHashCode
public static int reflectionHashCode(final Object object, final boolean testTransients) { return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object, testTransients, null); }
java
public static int reflectionHashCode(final Object object, final boolean testTransients) { return reflectionHashCode(DEFAULT_INITIAL_VALUE, DEFAULT_MULTIPLIER_VALUE, object, testTransients, null); }
[ "public", "static", "int", "reflectionHashCode", "(", "final", "Object", "object", ",", "final", "boolean", "testTransients", ")", "{", "return", "reflectionHashCode", "(", "DEFAULT_INITIAL_VALUE", ",", "DEFAULT_MULTIPLIER_VALUE", ",", "object", ",", "testTransients", ...
<p> Uses reflection to build a valid hash code from the fields of {@code object}. </p> <p> This constructor uses two hard coded choices for the constants needed to build a hash code. </p> <p> It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will throw a security exception if run under a security manager, if the permissions are not set up correctly. It is also not as efficient as testing explicitly. </p> <P> If the TestTransients parameter is set to <code>true</code>, transient members will be tested, otherwise they are ignored, as they are likely derived fields, and not part of the value of the <code>Object</code>. </p> <p> Static fields will not be tested. Superclass fields will be included. If no fields are found to include in the hash code, the result of this method will be constant. </p> @param object the Object to create a <code>hashCode</code> for @param testTransients whether to include transient fields @return int hash code @throws IllegalArgumentException if the object is <code>null</code>
[ "<p", ">", "Uses", "reflection", "to", "build", "a", "valid", "hash", "code", "from", "the", "fields", "of", "{", "@code", "object", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/builder/HashCodeBuilder.java#L380-L383
phax/ph-commons
ph-tree/src/main/java/com/helger/tree/xml/TreeXMLConverter.java
TreeXMLConverter.getTreeWithStringIDAsXML
@Nonnull public static <DATATYPE, ITEMTYPE extends ITreeItemWithID <String, DATATYPE, ITEMTYPE>> IMicroElement getTreeWithStringIDAsXML (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree, @Nonnull final IConverterTreeItemToMicroNode <? super DATATYPE> aConverter) { return getTreeWithIDAsXML (aTree, IHasID.getComparatorID (), x -> x, aConverter); }
java
@Nonnull public static <DATATYPE, ITEMTYPE extends ITreeItemWithID <String, DATATYPE, ITEMTYPE>> IMicroElement getTreeWithStringIDAsXML (@Nonnull final IBasicTree <DATATYPE, ITEMTYPE> aTree, @Nonnull final IConverterTreeItemToMicroNode <? super DATATYPE> aConverter) { return getTreeWithIDAsXML (aTree, IHasID.getComparatorID (), x -> x, aConverter); }
[ "@", "Nonnull", "public", "static", "<", "DATATYPE", ",", "ITEMTYPE", "extends", "ITreeItemWithID", "<", "String", ",", "DATATYPE", ",", "ITEMTYPE", ">", ">", "IMicroElement", "getTreeWithStringIDAsXML", "(", "@", "Nonnull", "final", "IBasicTree", "<", "DATATYPE",...
Specialized conversion method for converting a tree with ID to a standardized XML tree. @param <DATATYPE> tree item value type @param <ITEMTYPE> tree item type @param aTree The tree to be converted @param aConverter The main data converter that converts the tree item values into XML @return The created document.
[ "Specialized", "conversion", "method", "for", "converting", "a", "tree", "with", "ID", "to", "a", "standardized", "XML", "tree", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-tree/src/main/java/com/helger/tree/xml/TreeXMLConverter.java#L77-L82
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java
DirectoryConnection.submitRequest
public Response submitRequest(ProtocolHeader h, Protocol request, WatcherRegistration wr){ Packet packet = queuePacket(h, request, null, null, null, wr); synchronized (packet) { while (!packet.finished) { try { packet.wait(); } catch (InterruptedException e) { ServiceDirectoryError sde = new ServiceDirectoryError(ErrorCode.REQUEST_INTERUPTED); throw new ServiceException(sde, e); } } } if(! packet.respHeader.getErr().equals(ErrorCode.OK)){ ServiceDirectoryError sde = new ServiceDirectoryError(packet.respHeader.getErr()); throw new ServiceException(sde); } return packet.response; }
java
public Response submitRequest(ProtocolHeader h, Protocol request, WatcherRegistration wr){ Packet packet = queuePacket(h, request, null, null, null, wr); synchronized (packet) { while (!packet.finished) { try { packet.wait(); } catch (InterruptedException e) { ServiceDirectoryError sde = new ServiceDirectoryError(ErrorCode.REQUEST_INTERUPTED); throw new ServiceException(sde, e); } } } if(! packet.respHeader.getErr().equals(ErrorCode.OK)){ ServiceDirectoryError sde = new ServiceDirectoryError(packet.respHeader.getErr()); throw new ServiceException(sde); } return packet.response; }
[ "public", "Response", "submitRequest", "(", "ProtocolHeader", "h", ",", "Protocol", "request", ",", "WatcherRegistration", "wr", ")", "{", "Packet", "packet", "=", "queuePacket", "(", "h", ",", "request", ",", "null", ",", "null", ",", "null", ",", "wr", "...
Submit a Request. @param h the ProtocolHeader. @param request the Protocol. @param wr the WatcherRegistration @return the Response of the Request.
[ "Submit", "a", "Request", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java#L349-L367
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java
StorageAccountCredentialsInner.createOrUpdate
public StorageAccountCredentialInner createOrUpdate(String deviceName, String name, String resourceGroupName, StorageAccountCredentialInner storageAccountCredential) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, storageAccountCredential).toBlocking().last().body(); }
java
public StorageAccountCredentialInner createOrUpdate(String deviceName, String name, String resourceGroupName, StorageAccountCredentialInner storageAccountCredential) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, storageAccountCredential).toBlocking().last().body(); }
[ "public", "StorageAccountCredentialInner", "createOrUpdate", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ",", "StorageAccountCredentialInner", "storageAccountCredential", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "...
Creates or updates the storage account credential. @param deviceName The device name. @param name The storage account credential name. @param resourceGroupName The resource group name. @param storageAccountCredential The storage account credential. @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 StorageAccountCredentialInner object if successful.
[ "Creates", "or", "updates", "the", "storage", "account", "credential", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java#L322-L324
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveDiamond
Symbol resolveDiamond(DiagnosticPosition pos, Env<AttrContext> env, Type site, List<Type> argtypes, List<Type> typeargtypes) { return lookupMethod(env, pos, site.tsym, resolveMethodCheck, new BasicLookupHelper(names.init, site, argtypes, typeargtypes) { @Override Symbol doLookup(Env<AttrContext> env, MethodResolutionPhase phase) { return findDiamond(env, site, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()); } @Override Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) { if (sym.kind >= AMBIGUOUS) { if (sym.kind != WRONG_MTH && sym.kind != WRONG_MTHS) { sym = super.access(env, pos, location, sym); } else { final JCDiagnostic details = sym.kind == WRONG_MTH ? ((InapplicableSymbolError)sym.baseSymbol()).errCandidate().snd : null; sym = new InapplicableSymbolError(sym.kind, "diamondError", currentResolutionContext) { @Override JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { String key = details == null ? "cant.apply.diamond" : "cant.apply.diamond.1"; return diags.create(dkind, log.currentSource(), pos, key, diags.fragment("diamond", site.tsym), details); } }; sym = accessMethod(sym, pos, site, names.init, true, argtypes, typeargtypes); env.info.pendingResolutionPhase = currentResolutionContext.step; } } return sym; }}); }
java
Symbol resolveDiamond(DiagnosticPosition pos, Env<AttrContext> env, Type site, List<Type> argtypes, List<Type> typeargtypes) { return lookupMethod(env, pos, site.tsym, resolveMethodCheck, new BasicLookupHelper(names.init, site, argtypes, typeargtypes) { @Override Symbol doLookup(Env<AttrContext> env, MethodResolutionPhase phase) { return findDiamond(env, site, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()); } @Override Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) { if (sym.kind >= AMBIGUOUS) { if (sym.kind != WRONG_MTH && sym.kind != WRONG_MTHS) { sym = super.access(env, pos, location, sym); } else { final JCDiagnostic details = sym.kind == WRONG_MTH ? ((InapplicableSymbolError)sym.baseSymbol()).errCandidate().snd : null; sym = new InapplicableSymbolError(sym.kind, "diamondError", currentResolutionContext) { @Override JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { String key = details == null ? "cant.apply.diamond" : "cant.apply.diamond.1"; return diags.create(dkind, log.currentSource(), pos, key, diags.fragment("diamond", site.tsym), details); } }; sym = accessMethod(sym, pos, site, names.init, true, argtypes, typeargtypes); env.info.pendingResolutionPhase = currentResolutionContext.step; } } return sym; }}); }
[ "Symbol", "resolveDiamond", "(", "DiagnosticPosition", "pos", ",", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", "typeargtypes", ")", "{", "return", "lookupMethod", "("...
Resolve constructor using diamond inference. @param pos The position to use for error reporting. @param env The environment current at the constructor invocation. @param site The type of class for which a constructor is searched. The scope of this class has been touched in attribution. @param argtypes The types of the constructor invocation's value arguments. @param typeargtypes The types of the constructor invocation's type arguments.
[ "Resolve", "constructor", "using", "diamond", "inference", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L2586-L2625
spotify/helios
helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java
ZooKeeperMasterModel.forceRollingUpdateUndeploy
private RollingUpdateOp forceRollingUpdateUndeploy(final ZooKeeperClient client, final RollingUpdateOpFactory opFactory, final DeploymentGroup deploymentGroup, final String host) { return rollingUpdateUndeploy(client, opFactory, deploymentGroup, host, false); }
java
private RollingUpdateOp forceRollingUpdateUndeploy(final ZooKeeperClient client, final RollingUpdateOpFactory opFactory, final DeploymentGroup deploymentGroup, final String host) { return rollingUpdateUndeploy(client, opFactory, deploymentGroup, host, false); }
[ "private", "RollingUpdateOp", "forceRollingUpdateUndeploy", "(", "final", "ZooKeeperClient", "client", ",", "final", "RollingUpdateOpFactory", "opFactory", ",", "final", "DeploymentGroup", "deploymentGroup", ",", "final", "String", "host", ")", "{", "return", "rollingUpda...
forceRollingUpdateUndeploy is used to undeploy jobs from hosts that have been removed from the deployment group. It disables the 'skipRedundantUndeploys' flag, which disables the redundantDeployment() check.
[ "forceRollingUpdateUndeploy", "is", "used", "to", "undeploy", "jobs", "from", "hosts", "that", "have", "been", "removed", "from", "the", "deployment", "group", ".", "It", "disables", "the", "skipRedundantUndeploys", "flag", "which", "disables", "the", "redundantDepl...
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1125-L1130
OpenHFT/Chronicle-Map
src/main/java/net/openhft/chronicle/hash/impl/stage/iter/IterationAlloc.java
IterationAlloc.alloc
@Override public long alloc(int chunks, long prevPos, int prevChunks) { long ret = s.allocReturnCode(chunks); if (prevPos >= 0) s.free(prevPos, prevChunks); if (ret >= 0) return ret; while (true) { s.nextTier(); ret = s.allocReturnCode(chunks); if (ret >= 0) return ret; } }
java
@Override public long alloc(int chunks, long prevPos, int prevChunks) { long ret = s.allocReturnCode(chunks); if (prevPos >= 0) s.free(prevPos, prevChunks); if (ret >= 0) return ret; while (true) { s.nextTier(); ret = s.allocReturnCode(chunks); if (ret >= 0) return ret; } }
[ "@", "Override", "public", "long", "alloc", "(", "int", "chunks", ",", "long", "prevPos", ",", "int", "prevChunks", ")", "{", "long", "ret", "=", "s", ".", "allocReturnCode", "(", "chunks", ")", ";", "if", "(", "prevPos", ">=", "0", ")", "s", ".", ...
Move only to next tiers, to avoid double visiting of relocated entries during iteration
[ "Move", "only", "to", "next", "tiers", "to", "avoid", "double", "visiting", "of", "relocated", "entries", "during", "iteration" ]
train
https://github.com/OpenHFT/Chronicle-Map/blob/0b09733cc96302f96be4394a261699eeb021fe37/src/main/java/net/openhft/chronicle/hash/impl/stage/iter/IterationAlloc.java#L33-L46
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/InputUtils.java
InputUtils.setClassName
public static void setClassName(Map<String, Object> map, String className) { String processedClassName = className; if (processedClassName != null) { // it is highly unlikely that class name would contain ".", but we are cleaning it just in case processedClassName = processedClassName.replaceAll("\\.", "_"); } map.put(MAP_CLASS_NAME, processedClassName); }
java
public static void setClassName(Map<String, Object> map, String className) { String processedClassName = className; if (processedClassName != null) { // it is highly unlikely that class name would contain ".", but we are cleaning it just in case processedClassName = processedClassName.replaceAll("\\.", "_"); } map.put(MAP_CLASS_NAME, processedClassName); }
[ "public", "static", "void", "setClassName", "(", "Map", "<", "String", ",", "Object", ">", "map", ",", "String", "className", ")", "{", "String", "processedClassName", "=", "className", ";", "if", "(", "processedClassName", "!=", "null", ")", "{", "// it is ...
InputHandler converts every object into Map. Sets Class name of object from which this Map was created. @param map Map which would store Class name @param className Class name
[ "InputHandler", "converts", "every", "object", "into", "Map", ".", "Sets", "Class", "name", "of", "object", "from", "which", "this", "Map", "was", "created", "." ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/InputUtils.java#L75-L85
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/TransactionUrl.java
TransactionUrl.removeTransactionUrl
public static MozuUrl removeTransactionUrl(Integer accountId, String transactionId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/transactions/{transactionId}"); formatter.formatUrl("accountId", accountId); formatter.formatUrl("transactionId", transactionId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl removeTransactionUrl(Integer accountId, String transactionId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/transactions/{transactionId}"); formatter.formatUrl("accountId", accountId); formatter.formatUrl("transactionId", transactionId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "removeTransactionUrl", "(", "Integer", "accountId", ",", "String", "transactionId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/customer/accounts/{accountId}/transactions/{transactionId}\"", ")", ";"...
Get Resource Url for RemoveTransaction @param accountId Unique identifier of the customer account. @param transactionId Unique identifier of the transaction to delete. @return String Resource Url
[ "Get", "Resource", "Url", "for", "RemoveTransaction" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/TransactionUrl.java#L48-L54
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/KeyAgent.java
KeyAgent.importKey
@Help(help = "Import a Key into the NFVO by providing name and public key") public Key importKey(String name, String publicKey) throws SDKException { Key key = new Key(); key.setName(name); key.setPublicKey(publicKey); return (Key) requestPost(key); }
java
@Help(help = "Import a Key into the NFVO by providing name and public key") public Key importKey(String name, String publicKey) throws SDKException { Key key = new Key(); key.setName(name); key.setPublicKey(publicKey); return (Key) requestPost(key); }
[ "@", "Help", "(", "help", "=", "\"Import a Key into the NFVO by providing name and public key\"", ")", "public", "Key", "importKey", "(", "String", "name", ",", "String", "publicKey", ")", "throws", "SDKException", "{", "Key", "key", "=", "new", "Key", "(", ")", ...
Import a Key into the NFVO by providing name and public key. @param name the name of the Key @param publicKey the public Key @return the imported Key @throws SDKException if the request fails
[ "Import", "a", "Key", "into", "the", "NFVO", "by", "providing", "name", "and", "public", "key", "." ]
train
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/KeyAgent.java#L105-L111
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/MergeSmallRegions.java
MergeSmallRegions.process
public void process( T image, GrayS32 pixelToRegion , GrowQueue_I32 regionMemberCount, FastQueue<float[]> regionColor ) { stopRequested = false; // iterate until no more regions need to be merged together while( !stopRequested ) { // Update the color of each region regionColor.resize(regionMemberCount.size); computeColor.process(image, pixelToRegion, regionMemberCount, regionColor); initializeMerge(regionMemberCount.size); // Create a list of regions which are to be pruned if( !setupPruneList(regionMemberCount) ) break; // Scan the image and create a list of regions which the pruned regions connect to findAdjacentRegions(pixelToRegion); // Select the closest match to merge into for( int i = 0; i < pruneGraph.size; i++ ) { selectMerge(i,regionColor); } // Do the usual merge stuff performMerge(pixelToRegion,regionMemberCount); } }
java
public void process( T image, GrayS32 pixelToRegion , GrowQueue_I32 regionMemberCount, FastQueue<float[]> regionColor ) { stopRequested = false; // iterate until no more regions need to be merged together while( !stopRequested ) { // Update the color of each region regionColor.resize(regionMemberCount.size); computeColor.process(image, pixelToRegion, regionMemberCount, regionColor); initializeMerge(regionMemberCount.size); // Create a list of regions which are to be pruned if( !setupPruneList(regionMemberCount) ) break; // Scan the image and create a list of regions which the pruned regions connect to findAdjacentRegions(pixelToRegion); // Select the closest match to merge into for( int i = 0; i < pruneGraph.size; i++ ) { selectMerge(i,regionColor); } // Do the usual merge stuff performMerge(pixelToRegion,regionMemberCount); } }
[ "public", "void", "process", "(", "T", "image", ",", "GrayS32", "pixelToRegion", ",", "GrowQueue_I32", "regionMemberCount", ",", "FastQueue", "<", "float", "[", "]", ">", "regionColor", ")", "{", "stopRequested", "=", "false", ";", "// iterate until no more region...
Merges together smaller regions. Segmented image, region member count, and region color are all updated. @param image Input image. Used to compute color of each region @param pixelToRegion (input/output) Segmented image with the ID of each region. Modified. @param regionMemberCount (input/output) Number of members in each region Modified. @param regionColor (Output) Storage for colors of each region. Will contains the color of each region on output.
[ "Merges", "together", "smaller", "regions", ".", "Segmented", "image", "region", "member", "count", "and", "region", "color", "are", "all", "updated", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/ms/MergeSmallRegions.java#L100-L130
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java
SVGPlot.saveAsPNG
public void saveAsPNG(File file, int width, int height) throws IOException, TranscoderException { PNGTranscoder t = new PNGTranscoder(); t.addTranscodingHint(PNGTranscoder.KEY_WIDTH, new Float(width)); t.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, new Float(height)); transcode(file, t); }
java
public void saveAsPNG(File file, int width, int height) throws IOException, TranscoderException { PNGTranscoder t = new PNGTranscoder(); t.addTranscodingHint(PNGTranscoder.KEY_WIDTH, new Float(width)); t.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, new Float(height)); transcode(file, t); }
[ "public", "void", "saveAsPNG", "(", "File", "file", ",", "int", "width", ",", "int", "height", ")", "throws", "IOException", ",", "TranscoderException", "{", "PNGTranscoder", "t", "=", "new", "PNGTranscoder", "(", ")", ";", "t", ".", "addTranscodingHint", "(...
Transcode file to PNG. @param file Output filename @param width Width @param height Height @throws IOException On write errors @throws TranscoderException On input/parsing errors.
[ "Transcode", "file", "to", "PNG", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java#L516-L521
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.parseSubProcess
public ActivityImpl parseSubProcess(Element subProcessElement, ScopeImpl scope) { ActivityImpl subProcessActivity = createActivityOnScope(subProcessElement, scope); subProcessActivity.setSubProcessScope(true); parseAsynchronousContinuationForActivity(subProcessElement, subProcessActivity); Boolean isTriggeredByEvent = parseBooleanAttribute(subProcessElement.attribute("triggeredByEvent"), false); subProcessActivity.getProperties().set(BpmnProperties.TRIGGERED_BY_EVENT, isTriggeredByEvent); subProcessActivity.setProperty(PROPERTYNAME_CONSUMES_COMPENSATION, !isTriggeredByEvent); subProcessActivity.setScope(true); if (isTriggeredByEvent) { subProcessActivity.setActivityBehavior(new EventSubProcessActivityBehavior()); subProcessActivity.setEventScope(scope); } else { subProcessActivity.setActivityBehavior(new SubProcessActivityBehavior()); } parseScope(subProcessElement, subProcessActivity); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseSubProcess(subProcessElement, scope, subProcessActivity); } return subProcessActivity; }
java
public ActivityImpl parseSubProcess(Element subProcessElement, ScopeImpl scope) { ActivityImpl subProcessActivity = createActivityOnScope(subProcessElement, scope); subProcessActivity.setSubProcessScope(true); parseAsynchronousContinuationForActivity(subProcessElement, subProcessActivity); Boolean isTriggeredByEvent = parseBooleanAttribute(subProcessElement.attribute("triggeredByEvent"), false); subProcessActivity.getProperties().set(BpmnProperties.TRIGGERED_BY_EVENT, isTriggeredByEvent); subProcessActivity.setProperty(PROPERTYNAME_CONSUMES_COMPENSATION, !isTriggeredByEvent); subProcessActivity.setScope(true); if (isTriggeredByEvent) { subProcessActivity.setActivityBehavior(new EventSubProcessActivityBehavior()); subProcessActivity.setEventScope(scope); } else { subProcessActivity.setActivityBehavior(new SubProcessActivityBehavior()); } parseScope(subProcessElement, subProcessActivity); for (BpmnParseListener parseListener : parseListeners) { parseListener.parseSubProcess(subProcessElement, scope, subProcessActivity); } return subProcessActivity; }
[ "public", "ActivityImpl", "parseSubProcess", "(", "Element", "subProcessElement", ",", "ScopeImpl", "scope", ")", "{", "ActivityImpl", "subProcessActivity", "=", "createActivityOnScope", "(", "subProcessElement", ",", "scope", ")", ";", "subProcessActivity", ".", "setSu...
Parses a subprocess (formally known as an embedded subprocess): a subprocess defined within another process definition. @param subProcessElement The XML element corresponding with the subprocess definition @param scope The current scope on which the subprocess is defined.
[ "Parses", "a", "subprocess", "(", "formally", "known", "as", "an", "embedded", "subprocess", ")", ":", "a", "subprocess", "defined", "within", "another", "process", "definition", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L3561-L3584
JavaMoney/jsr354-ri
moneta-core/src/main/java/org/javamoney/moneta/internal/loader/DefaultLoaderService.java
DefaultLoaderService.initialize
void initialize() { // Cancel any running tasks Timer oldTimer = timer; timer = new Timer(true); if (Objects.nonNull(oldTimer)) { oldTimer.cancel(); } // (re)initialize LoaderConfigurator configurator = new LoaderConfigurator(this); defaultLoaderServiceFacade = new DefaultLoaderServiceFacade(timer, listener, resources); configurator.load(); }
java
void initialize() { // Cancel any running tasks Timer oldTimer = timer; timer = new Timer(true); if (Objects.nonNull(oldTimer)) { oldTimer.cancel(); } // (re)initialize LoaderConfigurator configurator = new LoaderConfigurator(this); defaultLoaderServiceFacade = new DefaultLoaderServiceFacade(timer, listener, resources); configurator.load(); }
[ "void", "initialize", "(", ")", "{", "// Cancel any running tasks", "Timer", "oldTimer", "=", "timer", ";", "timer", "=", "new", "Timer", "(", "true", ")", ";", "if", "(", "Objects", ".", "nonNull", "(", "oldTimer", ")", ")", "{", "oldTimer", ".", "cance...
This method reads initial loads from the javamoney.properties and installs the according timers.
[ "This", "method", "reads", "initial", "loads", "from", "the", "javamoney", ".", "properties", "and", "installs", "the", "according", "timers", "." ]
train
https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/internal/loader/DefaultLoaderService.java#L91-L102
lightblueseas/swing-components
src/main/java/de/alpharogroup/layout/ScreenSizeExtensions.java
ScreenSizeExtensions.computeDialogPositions
public static List<Point> computeDialogPositions(final int dialogWidth, final int dialogHeight) { List<Point> dialogPosition = null; final int windowBesides = ScreenSizeExtensions.getScreenWidth() / dialogWidth; final int windowBelow = ScreenSizeExtensions.getScreenHeight() / dialogHeight; final int listSize = windowBesides * windowBelow; dialogPosition = new ArrayList<>(listSize); int dotWidth = 0; int dotHeight = 0; for (int y = 0; y < windowBelow; y++) { dotWidth = 0; for (int x = 0; x < windowBesides; x++) { final Point p = new Point(dotWidth, dotHeight); dialogPosition.add(p); dotWidth = dotWidth + dialogWidth; } dotHeight = dotHeight + dialogHeight; } return dialogPosition; }
java
public static List<Point> computeDialogPositions(final int dialogWidth, final int dialogHeight) { List<Point> dialogPosition = null; final int windowBesides = ScreenSizeExtensions.getScreenWidth() / dialogWidth; final int windowBelow = ScreenSizeExtensions.getScreenHeight() / dialogHeight; final int listSize = windowBesides * windowBelow; dialogPosition = new ArrayList<>(listSize); int dotWidth = 0; int dotHeight = 0; for (int y = 0; y < windowBelow; y++) { dotWidth = 0; for (int x = 0; x < windowBesides; x++) { final Point p = new Point(dotWidth, dotHeight); dialogPosition.add(p); dotWidth = dotWidth + dialogWidth; } dotHeight = dotHeight + dialogHeight; } return dialogPosition; }
[ "public", "static", "List", "<", "Point", ">", "computeDialogPositions", "(", "final", "int", "dialogWidth", ",", "final", "int", "dialogHeight", ")", "{", "List", "<", "Point", ">", "dialogPosition", "=", "null", ";", "final", "int", "windowBesides", "=", "...
Compute how much dialog can be put into the screen and returns a list with the coordinates from the dialog positions as Point objects. @param dialogWidth the dialog width @param dialogHeight the dialog height @return the list with the computed Point objects.
[ "Compute", "how", "much", "dialog", "can", "be", "put", "into", "the", "screen", "and", "returns", "a", "list", "with", "the", "coordinates", "from", "the", "dialog", "positions", "as", "Point", "objects", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/layout/ScreenSizeExtensions.java#L65-L86
NessComputing/components-ness-event
core/src/main/java/com/nesscomputing/event/NessEvent.java
NessEvent.createEvent
@JsonCreator static NessEvent createEvent(@Nullable @JsonProperty("user") final UUID user, @Nullable @JsonProperty("timestamp") final DateTime timestamp, @Nonnull @JsonProperty("id") final UUID id, @Nonnull @JsonProperty("type") final NessEventType type, @Nullable @JsonProperty("payload") final Map<String, ? extends Object> payload) { return new NessEvent(user, timestamp, type, payload, id); }
java
@JsonCreator static NessEvent createEvent(@Nullable @JsonProperty("user") final UUID user, @Nullable @JsonProperty("timestamp") final DateTime timestamp, @Nonnull @JsonProperty("id") final UUID id, @Nonnull @JsonProperty("type") final NessEventType type, @Nullable @JsonProperty("payload") final Map<String, ? extends Object> payload) { return new NessEvent(user, timestamp, type, payload, id); }
[ "@", "JsonCreator", "static", "NessEvent", "createEvent", "(", "@", "Nullable", "@", "JsonProperty", "(", "\"user\"", ")", "final", "UUID", "user", ",", "@", "Nullable", "@", "JsonProperty", "(", "\"timestamp\"", ")", "final", "DateTime", "timestamp", ",", "@"...
Create a new event from over-the-wire json. @param user User that the event happened for. Can be null for a system level event. @param timestamp The time when this event entered the system @param type The Event type. @param payload Arbitrary data describing the event. @param id UUID as event id.
[ "Create", "a", "new", "event", "from", "over", "-", "the", "-", "wire", "json", "." ]
train
https://github.com/NessComputing/components-ness-event/blob/6d41f9e7c810c3ffa6bb79e19bb8cfb1d1c12c33/core/src/main/java/com/nesscomputing/event/NessEvent.java#L63-L71
susom/database
src/main/java/com/github/susom/database/DatabaseProvider.java
DatabaseProvider.fromPropertyFile
public static Builder fromPropertyFile(String filename, String propertyPrefix, CharsetDecoder decoder) { Properties properties = new Properties(); if (filename != null && filename.length() > 0) { try { properties.load(new InputStreamReader(new FileInputStream(filename), decoder)); } catch (Exception e) { throw new DatabaseException("Unable to read properties file: " + filename, e); } } return fromProperties(properties, propertyPrefix, true); }
java
public static Builder fromPropertyFile(String filename, String propertyPrefix, CharsetDecoder decoder) { Properties properties = new Properties(); if (filename != null && filename.length() > 0) { try { properties.load(new InputStreamReader(new FileInputStream(filename), decoder)); } catch (Exception e) { throw new DatabaseException("Unable to read properties file: " + filename, e); } } return fromProperties(properties, propertyPrefix, true); }
[ "public", "static", "Builder", "fromPropertyFile", "(", "String", "filename", ",", "String", "propertyPrefix", ",", "CharsetDecoder", "decoder", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "if", "(", "filename", "!=", "null", ...
Configure the database from up to five properties read from a file: <br/> <pre> database.url=... Database connect string (required) database.user=... Authenticate as this user (optional if provided in url) database.password=... User password (optional if user and password provided in url; prompted on standard input if user is provided and password is not) database.flavor=... What kind of database it is (optional, will guess based on the url if this is not provided) database.driver=... The Java class of the JDBC driver to load (optional, will guess based on the flavor if this is not provided) </pre> @param filename path to the properties file we will attempt to read @param propertyPrefix if this is null or empty the properties above will be read; if a value is provided it will be prefixed to each property (exactly, so if you want to use "my.database.url" you must pass "my." as the prefix) @param decoder character encoding to use when reading the property file @throws DatabaseException if the property file could not be read for any reason
[ "Configure", "the", "database", "from", "up", "to", "five", "properties", "read", "from", "a", "file", ":", "<br", "/", ">", "<pre", ">", "database", ".", "url", "=", "...", "Database", "connect", "string", "(", "required", ")", "database", ".", "user", ...
train
https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProvider.java#L340-L350
VoltDB/voltdb
src/frontend/org/voltdb/exportclient/HttpExportClient.java
HttpExportClient.makeRequest
private HttpUriRequest makeRequest(final URI uri, final List<NameValuePair> nvpairs) { List<NameValuePair> params = nvpairs; if (m_secret != null) { params = sign(uri, nvpairs); } return makeRequest(uri, joinParameters(params)); }
java
private HttpUriRequest makeRequest(final URI uri, final List<NameValuePair> nvpairs) { List<NameValuePair> params = nvpairs; if (m_secret != null) { params = sign(uri, nvpairs); } return makeRequest(uri, joinParameters(params)); }
[ "private", "HttpUriRequest", "makeRequest", "(", "final", "URI", "uri", ",", "final", "List", "<", "NameValuePair", ">", "nvpairs", ")", "{", "List", "<", "NameValuePair", ">", "params", "=", "nvpairs", ";", "if", "(", "m_secret", "!=", "null", ")", "{", ...
Generate the HTTP request. @param uri The request URI @param nvpairs The list of name value pairs @return The HTTP request. @throws URISyntaxException
[ "Generate", "the", "HTTP", "request", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/exportclient/HttpExportClient.java#L775-L782
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java
RequiredParameters.checkChoices
private void checkChoices(Option o, Map<String, String> data) throws RequiredParametersException { if (o.getChoices().size() > 0 && !o.getChoices().contains(data.get(o.getName()))) { throw new RequiredParametersException("Value " + data.get(o.getName()) + " is not in the list of valid choices for key " + o.getName()); } }
java
private void checkChoices(Option o, Map<String, String> data) throws RequiredParametersException { if (o.getChoices().size() > 0 && !o.getChoices().contains(data.get(o.getName()))) { throw new RequiredParametersException("Value " + data.get(o.getName()) + " is not in the list of valid choices for key " + o.getName()); } }
[ "private", "void", "checkChoices", "(", "Option", "o", ",", "Map", "<", "String", ",", "String", ">", "data", ")", "throws", "RequiredParametersException", "{", "if", "(", "o", ".", "getChoices", "(", ")", ".", "size", "(", ")", ">", "0", "&&", "!", ...
adheres to the list of given choices for the param in the options (if any are defined)
[ "adheres", "to", "the", "list", "of", "given", "choices", "for", "the", "param", "in", "the", "options", "(", "if", "any", "are", "defined", ")" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java#L138-L143
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/GridLayoutOptionsExample.java
GridLayoutOptionsExample.getLayoutControls
private WFieldSet getLayoutControls(final WValidationErrors errors) { // Options Layout WFieldSet fieldSet = new WFieldSet("List configuration"); WFieldLayout layout = new ControlFieldLayout(); fieldSet.add(layout); // options. columnCount.setDecimalPlaces(0); columnCount.setMinValue(0); columnCount.setNumber(DEFAULT_COLUMN_COUNT); columnCount.setMandatory(true); layout.addField("Number of Columns", columnCount); rowCount.setDecimalPlaces(0); rowCount.setMinValue(0); rowCount.setNumber(DEFAULT_ROW_COUNT); rowCount.setMandatory(true); layout.addField("Number of Rows", rowCount); hGap.setDecimalPlaces(0); hGap.setMinValue(0); hGap.setNumber(0); hGap.setMandatory(true); layout.addField("Horizontal Gap", hGap); vGap.setDecimalPlaces(0); vGap.setMinValue(0); vGap.setNumber(0); vGap.setMandatory(true); layout.addField("Vertical Gap", vGap); boxCount.setDecimalPlaces(0); boxCount.setMinValue(0); boxCount.setNumber(DEFAULT_BOX_COUNT); boxCount.setMandatory(true); layout.addField("Number of Boxes", boxCount); layout.addField("Visible", cbVisible); layout.addField("Allow responsive design", cbResponsive); // Apply Button WButton apply = new WButton("Apply"); apply.setAction(new ValidatingAction(errors, this) { @Override public void executeOnValid(final ActionEvent event) { applySettings(); } }); layout.addField(apply); fieldSet.add(new WAjaxControl(apply, container)); fieldSet.setMargin(new Margin(null, null, Size.LARGE, null)); return fieldSet; }
java
private WFieldSet getLayoutControls(final WValidationErrors errors) { // Options Layout WFieldSet fieldSet = new WFieldSet("List configuration"); WFieldLayout layout = new ControlFieldLayout(); fieldSet.add(layout); // options. columnCount.setDecimalPlaces(0); columnCount.setMinValue(0); columnCount.setNumber(DEFAULT_COLUMN_COUNT); columnCount.setMandatory(true); layout.addField("Number of Columns", columnCount); rowCount.setDecimalPlaces(0); rowCount.setMinValue(0); rowCount.setNumber(DEFAULT_ROW_COUNT); rowCount.setMandatory(true); layout.addField("Number of Rows", rowCount); hGap.setDecimalPlaces(0); hGap.setMinValue(0); hGap.setNumber(0); hGap.setMandatory(true); layout.addField("Horizontal Gap", hGap); vGap.setDecimalPlaces(0); vGap.setMinValue(0); vGap.setNumber(0); vGap.setMandatory(true); layout.addField("Vertical Gap", vGap); boxCount.setDecimalPlaces(0); boxCount.setMinValue(0); boxCount.setNumber(DEFAULT_BOX_COUNT); boxCount.setMandatory(true); layout.addField("Number of Boxes", boxCount); layout.addField("Visible", cbVisible); layout.addField("Allow responsive design", cbResponsive); // Apply Button WButton apply = new WButton("Apply"); apply.setAction(new ValidatingAction(errors, this) { @Override public void executeOnValid(final ActionEvent event) { applySettings(); } }); layout.addField(apply); fieldSet.add(new WAjaxControl(apply, container)); fieldSet.setMargin(new Margin(null, null, Size.LARGE, null)); return fieldSet; }
[ "private", "WFieldSet", "getLayoutControls", "(", "final", "WValidationErrors", "errors", ")", "{", "// Options Layout", "WFieldSet", "fieldSet", "=", "new", "WFieldSet", "(", "\"List configuration\"", ")", ";", "WFieldLayout", "layout", "=", "new", "ControlFieldLayout"...
build the list controls field set. @param errors the error box to be linked to the apply button. @return a field set for the controls.
[ "build", "the", "list", "controls", "field", "set", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/GridLayoutOptionsExample.java#L105-L155
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/util/TempByteHolder.java
TempByteHolder.getString
public String getString(String character_encoding) throws java.io.UnsupportedEncodingException { if (_file_mode) throw new IllegalStateException("data too large"); return new String(_memory_buffer,0,_write_pos,character_encoding); }
java
public String getString(String character_encoding) throws java.io.UnsupportedEncodingException { if (_file_mode) throw new IllegalStateException("data too large"); return new String(_memory_buffer,0,_write_pos,character_encoding); }
[ "public", "String", "getString", "(", "String", "character_encoding", ")", "throws", "java", ".", "io", ".", "UnsupportedEncodingException", "{", "if", "(", "_file_mode", ")", "throw", "new", "IllegalStateException", "(", "\"data too large\"", ")", ";", "return", ...
Returns buffered data as String using given character encoding. @param character_encoding Name of character encoding to use for converting bytes to String. @return Buffered data as String. @throws IllegalStateException when data is too large to be read this way. @throws java.io.UnsupportedEncodingException when this encoding is not supported.
[ "Returns", "buffered", "data", "as", "String", "using", "given", "character", "encoding", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/TempByteHolder.java#L242-L245
msteiger/jxmapviewer2
jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java
JXMapKit.setTileFactory
public void setTileFactory(TileFactory fact) { mainMap.setTileFactory(fact); mainMap.setZoom(fact.getInfo().getDefaultZoomLevel()); mainMap.setCenterPosition(new GeoPosition(0, 0)); miniMap.setTileFactory(fact); miniMap.setZoom(fact.getInfo().getDefaultZoomLevel() + 3); miniMap.setCenterPosition(new GeoPosition(0, 0)); zoomSlider.setMinimum(fact.getInfo().getMinimumZoomLevel()); zoomSlider.setMaximum(fact.getInfo().getMaximumZoomLevel()); }
java
public void setTileFactory(TileFactory fact) { mainMap.setTileFactory(fact); mainMap.setZoom(fact.getInfo().getDefaultZoomLevel()); mainMap.setCenterPosition(new GeoPosition(0, 0)); miniMap.setTileFactory(fact); miniMap.setZoom(fact.getInfo().getDefaultZoomLevel() + 3); miniMap.setCenterPosition(new GeoPosition(0, 0)); zoomSlider.setMinimum(fact.getInfo().getMinimumZoomLevel()); zoomSlider.setMaximum(fact.getInfo().getMaximumZoomLevel()); }
[ "public", "void", "setTileFactory", "(", "TileFactory", "fact", ")", "{", "mainMap", ".", "setTileFactory", "(", "fact", ")", ";", "mainMap", ".", "setZoom", "(", "fact", ".", "getInfo", "(", ")", ".", "getDefaultZoomLevel", "(", ")", ")", ";", "mainMap", ...
Sets the tile factory for both embedded JXMapViewer components. Calling this method will also reset the center and zoom levels of both maps, as well as the bounds of the zoom slider. @param fact the new TileFactory
[ "Sets", "the", "tile", "factory", "for", "both", "embedded", "JXMapViewer", "components", ".", "Calling", "this", "method", "will", "also", "reset", "the", "center", "and", "zoom", "levels", "of", "both", "maps", "as", "well", "as", "the", "bounds", "of", ...
train
https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java#L505-L515
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.setNonStrokingColor
public void setNonStrokingColor (final double g) throws IOException { if (_isOutsideOneInterval (g)) { throw new IllegalArgumentException ("Parameter must be within 0..1, but is " + g); } writeOperand ((float) g); writeOperator ((byte) 'g'); }
java
public void setNonStrokingColor (final double g) throws IOException { if (_isOutsideOneInterval (g)) { throw new IllegalArgumentException ("Parameter must be within 0..1, but is " + g); } writeOperand ((float) g); writeOperator ((byte) 'g'); }
[ "public", "void", "setNonStrokingColor", "(", "final", "double", "g", ")", "throws", "IOException", "{", "if", "(", "_isOutsideOneInterval", "(", "g", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter must be within 0..1, but is \"", "+", ...
Set the non-stroking color in the DeviceGray color space. Range is 0..1. @param g The gray value. @throws IOException If an IO error occurs while writing to the stream. @throws IllegalArgumentException If the parameter is invalid.
[ "Set", "the", "non", "-", "stroking", "color", "in", "the", "DeviceGray", "color", "space", ".", "Range", "is", "0", "..", "1", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1067-L1075
aws/aws-sdk-java
aws-java-sdk-marketplacecommerceanalytics/src/main/java/com/amazonaws/services/marketplacecommerceanalytics/model/StartSupportDataExportRequest.java
StartSupportDataExportRequest.withCustomerDefinedValues
public StartSupportDataExportRequest withCustomerDefinedValues(java.util.Map<String, String> customerDefinedValues) { setCustomerDefinedValues(customerDefinedValues); return this; }
java
public StartSupportDataExportRequest withCustomerDefinedValues(java.util.Map<String, String> customerDefinedValues) { setCustomerDefinedValues(customerDefinedValues); return this; }
[ "public", "StartSupportDataExportRequest", "withCustomerDefinedValues", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "customerDefinedValues", ")", "{", "setCustomerDefinedValues", "(", "customerDefinedValues", ")", ";", "return", "this", ";...
(Optional) Key-value pairs which will be returned, unmodified, in the Amazon SNS notification message and the data set metadata file. @param customerDefinedValues (Optional) Key-value pairs which will be returned, unmodified, in the Amazon SNS notification message and the data set metadata file. @return Returns a reference to this object so that method calls can be chained together.
[ "(", "Optional", ")", "Key", "-", "value", "pairs", "which", "will", "be", "returned", "unmodified", "in", "the", "Amazon", "SNS", "notification", "message", "and", "the", "data", "set", "metadata", "file", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-marketplacecommerceanalytics/src/main/java/com/amazonaws/services/marketplacecommerceanalytics/model/StartSupportDataExportRequest.java#L524-L527
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getGroupsBatch
public OneLoginResponse<Group> getGroupsBatch(int batchSize) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getGroupsBatch(batchSize, null); }
java
public OneLoginResponse<Group> getGroupsBatch(int batchSize) throws OAuthSystemException, OAuthProblemException, URISyntaxException { return getGroupsBatch(batchSize, null); }
[ "public", "OneLoginResponse", "<", "Group", ">", "getGroupsBatch", "(", "int", "batchSize", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "return", "getGroupsBatch", "(", "batchSize", ",", "null", ")", ";", "}" ...
Get a batch of Groups. @param batchSize Size of the Batch @return OneLoginResponse of Group @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.Group @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/groups/get-groups">Get Groups documentation</a>
[ "Get", "a", "batch", "of", "Groups", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2253-L2255
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/Rule.java
Rule.addExamplePair
protected void addExamplePair(IncorrectExample incorrectSentence, CorrectExample correctSentence) { String correctExample = correctSentence.getExample(); int markerStart= correctExample.indexOf("<marker>"); int markerEnd = correctExample.indexOf("</marker>"); if (markerStart != -1 && markerEnd != -1) { List<String> correction = Collections.singletonList(correctExample.substring(markerStart + "<marker>".length(), markerEnd)); incorrectExamples.add(new IncorrectExample(incorrectSentence.getExample(), correction)); } else { incorrectExamples.add(incorrectSentence); } correctExamples.add(correctSentence); }
java
protected void addExamplePair(IncorrectExample incorrectSentence, CorrectExample correctSentence) { String correctExample = correctSentence.getExample(); int markerStart= correctExample.indexOf("<marker>"); int markerEnd = correctExample.indexOf("</marker>"); if (markerStart != -1 && markerEnd != -1) { List<String> correction = Collections.singletonList(correctExample.substring(markerStart + "<marker>".length(), markerEnd)); incorrectExamples.add(new IncorrectExample(incorrectSentence.getExample(), correction)); } else { incorrectExamples.add(incorrectSentence); } correctExamples.add(correctSentence); }
[ "protected", "void", "addExamplePair", "(", "IncorrectExample", "incorrectSentence", ",", "CorrectExample", "correctSentence", ")", "{", "String", "correctExample", "=", "correctSentence", ".", "getExample", "(", ")", ";", "int", "markerStart", "=", "correctExample", ...
Convenience method to add a pair of sentences: an incorrect sentence and the same sentence with the error corrected. @since 2.5
[ "Convenience", "method", "to", "add", "a", "pair", "of", "sentences", ":", "an", "incorrect", "sentence", "and", "the", "same", "sentence", "with", "the", "error", "corrected", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/Rule.java#L404-L415
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/json/JSONParser.java
JSONParser.getAndParseHexChar
private int getAndParseHexChar() throws ParseException { final char hexChar = getc(); if (hexChar >= '0' && hexChar <= '9') { return hexChar - '0'; } else if (hexChar >= 'a' && hexChar <= 'f') { return hexChar - 'a' + 10; } else if (hexChar >= 'A' && hexChar <= 'F') { return hexChar - 'A' + 10; } else { throw new ParseException(this, "Invalid character in Unicode escape sequence: " + hexChar); } }
java
private int getAndParseHexChar() throws ParseException { final char hexChar = getc(); if (hexChar >= '0' && hexChar <= '9') { return hexChar - '0'; } else if (hexChar >= 'a' && hexChar <= 'f') { return hexChar - 'a' + 10; } else if (hexChar >= 'A' && hexChar <= 'F') { return hexChar - 'A' + 10; } else { throw new ParseException(this, "Invalid character in Unicode escape sequence: " + hexChar); } }
[ "private", "int", "getAndParseHexChar", "(", ")", "throws", "ParseException", "{", "final", "char", "hexChar", "=", "getc", "(", ")", ";", "if", "(", "hexChar", ">=", "'", "'", "&&", "hexChar", "<=", "'", "'", ")", "{", "return", "hexChar", "-", "'", ...
Get and parse a hexadecimal digit character. @return the hex char @throws ParseException if the character was not hexadecimal
[ "Get", "and", "parse", "a", "hexadecimal", "digit", "character", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/json/JSONParser.java#L68-L79