repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/PROCLUS.java
PROCLUS.findDimensions
private long[][] findDimensions(ArrayDBIDs medoids, Relation<V> database, DistanceQuery<V> distFunc, RangeQuery<V> rangeQuery) { """ Determines the set of correlated dimensions for each medoid in the specified medoid set. @param medoids the set of medoids @param database the database containing the objects @param distFunc the distance function @return the set of correlated dimensions for each medoid in the specified medoid set """ // get localities DataStore<DBIDs> localities = getLocalities(medoids, distFunc, rangeQuery); // compute x_ij = avg distance from points in l_i to medoid m_i final int dim = RelationUtil.dimensionality(database); final int numc = medoids.size(); double[][] averageDistances = new double[numc][]; for(DBIDArrayIter iter = medoids.iter(); iter.valid(); iter.advance()) { V medoid_i = database.get(iter); DBIDs l_i = localities.get(iter); double[] x_i = new double[dim]; for(DBIDIter qr = l_i.iter(); qr.valid(); qr.advance()) { V o = database.get(qr); for(int d = 0; d < dim; d++) { x_i[d] += Math.abs(medoid_i.doubleValue(d) - o.doubleValue(d)); } } for(int d = 0; d < dim; d++) { x_i[d] /= l_i.size(); } averageDistances[iter.getOffset()] = x_i; } List<DoubleIntInt> z_ijs = computeZijs(averageDistances, dim); return computeDimensionMap(z_ijs, dim, numc); }
java
private long[][] findDimensions(ArrayDBIDs medoids, Relation<V> database, DistanceQuery<V> distFunc, RangeQuery<V> rangeQuery) { // get localities DataStore<DBIDs> localities = getLocalities(medoids, distFunc, rangeQuery); // compute x_ij = avg distance from points in l_i to medoid m_i final int dim = RelationUtil.dimensionality(database); final int numc = medoids.size(); double[][] averageDistances = new double[numc][]; for(DBIDArrayIter iter = medoids.iter(); iter.valid(); iter.advance()) { V medoid_i = database.get(iter); DBIDs l_i = localities.get(iter); double[] x_i = new double[dim]; for(DBIDIter qr = l_i.iter(); qr.valid(); qr.advance()) { V o = database.get(qr); for(int d = 0; d < dim; d++) { x_i[d] += Math.abs(medoid_i.doubleValue(d) - o.doubleValue(d)); } } for(int d = 0; d < dim; d++) { x_i[d] /= l_i.size(); } averageDistances[iter.getOffset()] = x_i; } List<DoubleIntInt> z_ijs = computeZijs(averageDistances, dim); return computeDimensionMap(z_ijs, dim, numc); }
[ "private", "long", "[", "]", "[", "]", "findDimensions", "(", "ArrayDBIDs", "medoids", ",", "Relation", "<", "V", ">", "database", ",", "DistanceQuery", "<", "V", ">", "distFunc", ",", "RangeQuery", "<", "V", ">", "rangeQuery", ")", "{", "// get localities", "DataStore", "<", "DBIDs", ">", "localities", "=", "getLocalities", "(", "medoids", ",", "distFunc", ",", "rangeQuery", ")", ";", "// compute x_ij = avg distance from points in l_i to medoid m_i", "final", "int", "dim", "=", "RelationUtil", ".", "dimensionality", "(", "database", ")", ";", "final", "int", "numc", "=", "medoids", ".", "size", "(", ")", ";", "double", "[", "]", "[", "]", "averageDistances", "=", "new", "double", "[", "numc", "]", "[", "", "]", ";", "for", "(", "DBIDArrayIter", "iter", "=", "medoids", ".", "iter", "(", ")", ";", "iter", ".", "valid", "(", ")", ";", "iter", ".", "advance", "(", ")", ")", "{", "V", "medoid_i", "=", "database", ".", "get", "(", "iter", ")", ";", "DBIDs", "l_i", "=", "localities", ".", "get", "(", "iter", ")", ";", "double", "[", "]", "x_i", "=", "new", "double", "[", "dim", "]", ";", "for", "(", "DBIDIter", "qr", "=", "l_i", ".", "iter", "(", ")", ";", "qr", ".", "valid", "(", ")", ";", "qr", ".", "advance", "(", ")", ")", "{", "V", "o", "=", "database", ".", "get", "(", "qr", ")", ";", "for", "(", "int", "d", "=", "0", ";", "d", "<", "dim", ";", "d", "++", ")", "{", "x_i", "[", "d", "]", "+=", "Math", ".", "abs", "(", "medoid_i", ".", "doubleValue", "(", "d", ")", "-", "o", ".", "doubleValue", "(", "d", ")", ")", ";", "}", "}", "for", "(", "int", "d", "=", "0", ";", "d", "<", "dim", ";", "d", "++", ")", "{", "x_i", "[", "d", "]", "/=", "l_i", ".", "size", "(", ")", ";", "}", "averageDistances", "[", "iter", ".", "getOffset", "(", ")", "]", "=", "x_i", ";", "}", "List", "<", "DoubleIntInt", ">", "z_ijs", "=", "computeZijs", "(", "averageDistances", ",", "dim", ")", ";", "return", "computeDimensionMap", "(", "z_ijs", ",", "dim", ",", "numc", ")", ";", "}" ]
Determines the set of correlated dimensions for each medoid in the specified medoid set. @param medoids the set of medoids @param database the database containing the objects @param distFunc the distance function @return the set of correlated dimensions for each medoid in the specified medoid set
[ "Determines", "the", "set", "of", "correlated", "dimensions", "for", "each", "medoid", "in", "the", "specified", "medoid", "set", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/PROCLUS.java#L378-L405
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.verifyFactor
public Boolean verifyFactor(long userId, long deviceId, String otpToken, String stateToken) throws OAuthSystemException, OAuthProblemException, URISyntaxException { """ Authenticates a one-time password (OTP) code provided by a multifactor authentication (MFA) device. @param userId The id of the user. @param deviceId The id of the MFA device. @param otpToken OTP code provided by the device or SMS message sent to user. When a device like OneLogin Protect that supports Push has been used you do not need to provide the otp_token. @param stateToken The state_token is returned after a successful request to Enroll a Factor or Activate a Factor. MUST be provided if the needs_trigger attribute from the proceeding calls is set to true. @return Boolean True if Factor is verified @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 <a target="_blank" href="https://developers.onelogin.com/api-docs/1/multi-factor-authentication/verify-factor">Verify an Authentication Factor documentation</a> """ cleanError(); prepareToken(); URIBuilder url = new URIBuilder(settings.getURL(Constants.VERIFY_FACTOR_URL, userId, deviceId)); url = new URIBuilder("http://pitbulk.no-ip.org/newonelogin/demo1/data.json"); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); HashMap<String, Object> params = new HashMap<String, Object>(); if (otpToken!= null && !otpToken.isEmpty()) { params.put("otp_token", otpToken); } if (stateToken!= null && !stateToken.isEmpty()) { params.put("state_token", stateToken); } if (!params.isEmpty()) { String body = JSONUtils.buildJSON(params); bearerRequest.setBody(body); } Boolean success = true; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() != 200) { success = false; error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return success; }
java
public Boolean verifyFactor(long userId, long deviceId, String otpToken, String stateToken) throws OAuthSystemException, OAuthProblemException, URISyntaxException { cleanError(); prepareToken(); URIBuilder url = new URIBuilder(settings.getURL(Constants.VERIFY_FACTOR_URL, userId, deviceId)); url = new URIBuilder("http://pitbulk.no-ip.org/newonelogin/demo1/data.json"); OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient(); OAuthClient oAuthClient = new OAuthClient(httpClient); OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString()) .buildHeaderMessage(); Map<String, String> headers = getAuthorizedHeader(); bearerRequest.setHeaders(headers); HashMap<String, Object> params = new HashMap<String, Object>(); if (otpToken!= null && !otpToken.isEmpty()) { params.put("otp_token", otpToken); } if (stateToken!= null && !stateToken.isEmpty()) { params.put("state_token", stateToken); } if (!params.isEmpty()) { String body = JSONUtils.buildJSON(params); bearerRequest.setBody(body); } Boolean success = true; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class); if (oAuthResponse.getResponseCode() != 200) { success = false; error = oAuthResponse.getError(); errorDescription = oAuthResponse.getErrorDescription(); } return success; }
[ "public", "Boolean", "verifyFactor", "(", "long", "userId", ",", "long", "deviceId", ",", "String", "otpToken", ",", "String", "stateToken", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", "URISyntaxException", "{", "cleanError", "(", ")", ";", "prepareToken", "(", ")", ";", "URIBuilder", "url", "=", "new", "URIBuilder", "(", "settings", ".", "getURL", "(", "Constants", ".", "VERIFY_FACTOR_URL", ",", "userId", ",", "deviceId", ")", ")", ";", "url", "=", "new", "URIBuilder", "(", "\"http://pitbulk.no-ip.org/newonelogin/demo1/data.json\"", ")", ";", "OneloginURLConnectionClient", "httpClient", "=", "new", "OneloginURLConnectionClient", "(", ")", ";", "OAuthClient", "oAuthClient", "=", "new", "OAuthClient", "(", "httpClient", ")", ";", "OAuthClientRequest", "bearerRequest", "=", "new", "OAuthBearerClientRequest", "(", "url", ".", "toString", "(", ")", ")", ".", "buildHeaderMessage", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "headers", "=", "getAuthorizedHeader", "(", ")", ";", "bearerRequest", ".", "setHeaders", "(", "headers", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "if", "(", "otpToken", "!=", "null", "&&", "!", "otpToken", ".", "isEmpty", "(", ")", ")", "{", "params", ".", "put", "(", "\"otp_token\"", ",", "otpToken", ")", ";", "}", "if", "(", "stateToken", "!=", "null", "&&", "!", "stateToken", ".", "isEmpty", "(", ")", ")", "{", "params", ".", "put", "(", "\"state_token\"", ",", "stateToken", ")", ";", "}", "if", "(", "!", "params", ".", "isEmpty", "(", ")", ")", "{", "String", "body", "=", "JSONUtils", ".", "buildJSON", "(", "params", ")", ";", "bearerRequest", ".", "setBody", "(", "body", ")", ";", "}", "Boolean", "success", "=", "true", ";", "OneloginOAuthJSONResourceResponse", "oAuthResponse", "=", "oAuthClient", ".", "resource", "(", "bearerRequest", ",", "OAuth", ".", "HttpMethod", ".", "POST", ",", "OneloginOAuthJSONResourceResponse", ".", "class", ")", ";", "if", "(", "oAuthResponse", ".", "getResponseCode", "(", ")", "!=", "200", ")", "{", "success", "=", "false", ";", "error", "=", "oAuthResponse", ".", "getError", "(", ")", ";", "errorDescription", "=", "oAuthResponse", ".", "getErrorDescription", "(", ")", ";", "}", "return", "success", ";", "}" ]
Authenticates a one-time password (OTP) code provided by a multifactor authentication (MFA) device. @param userId The id of the user. @param deviceId The id of the MFA device. @param otpToken OTP code provided by the device or SMS message sent to user. When a device like OneLogin Protect that supports Push has been used you do not need to provide the otp_token. @param stateToken The state_token is returned after a successful request to Enroll a Factor or Activate a Factor. MUST be provided if the needs_trigger attribute from the proceeding calls is set to true. @return Boolean True if Factor is verified @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 <a target="_blank" href="https://developers.onelogin.com/api-docs/1/multi-factor-authentication/verify-factor">Verify an Authentication Factor documentation</a>
[ "Authenticates", "a", "one", "-", "time", "password", "(", "OTP", ")", "code", "provided", "by", "a", "multifactor", "authentication", "(", "MFA", ")", "device", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2838-L2875
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/EthiopicDate.java
EthiopicDate.ofYearDay
static EthiopicDate ofYearDay(int prolepticYear, int dayOfYear) { """ Obtains a {@code EthiopicDate} representing a date in the Ethiopic calendar system from the proleptic-year and day-of-year fields. <p> This returns a {@code EthiopicDate} with the specified fields. The day must be valid for the year, otherwise an exception will be thrown. @param prolepticYear the Ethiopic proleptic-year @param dayOfYear the Ethiopic day-of-year, from 1 to 366 @return the date in Ethiopic calendar system, not null @throws DateTimeException if the value of any field is out of range, or if the day-of-year is invalid for the year """ EthiopicChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR); DAY_OF_YEAR.range().checkValidValue(dayOfYear, DAY_OF_YEAR); if (dayOfYear == 366 && EthiopicChronology.INSTANCE.isLeapYear(prolepticYear) == false) { throw new DateTimeException("Invalid date 'Pagumen 6' as '" + prolepticYear + "' is not a leap year"); } return new EthiopicDate(prolepticYear, (dayOfYear - 1) / 30 + 1, (dayOfYear - 1) % 30 + 1); }
java
static EthiopicDate ofYearDay(int prolepticYear, int dayOfYear) { EthiopicChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR); DAY_OF_YEAR.range().checkValidValue(dayOfYear, DAY_OF_YEAR); if (dayOfYear == 366 && EthiopicChronology.INSTANCE.isLeapYear(prolepticYear) == false) { throw new DateTimeException("Invalid date 'Pagumen 6' as '" + prolepticYear + "' is not a leap year"); } return new EthiopicDate(prolepticYear, (dayOfYear - 1) / 30 + 1, (dayOfYear - 1) % 30 + 1); }
[ "static", "EthiopicDate", "ofYearDay", "(", "int", "prolepticYear", ",", "int", "dayOfYear", ")", "{", "EthiopicChronology", ".", "YEAR_RANGE", ".", "checkValidValue", "(", "prolepticYear", ",", "YEAR", ")", ";", "DAY_OF_YEAR", ".", "range", "(", ")", ".", "checkValidValue", "(", "dayOfYear", ",", "DAY_OF_YEAR", ")", ";", "if", "(", "dayOfYear", "==", "366", "&&", "EthiopicChronology", ".", "INSTANCE", ".", "isLeapYear", "(", "prolepticYear", ")", "==", "false", ")", "{", "throw", "new", "DateTimeException", "(", "\"Invalid date 'Pagumen 6' as '\"", "+", "prolepticYear", "+", "\"' is not a leap year\"", ")", ";", "}", "return", "new", "EthiopicDate", "(", "prolepticYear", ",", "(", "dayOfYear", "-", "1", ")", "/", "30", "+", "1", ",", "(", "dayOfYear", "-", "1", ")", "%", "30", "+", "1", ")", ";", "}" ]
Obtains a {@code EthiopicDate} representing a date in the Ethiopic calendar system from the proleptic-year and day-of-year fields. <p> This returns a {@code EthiopicDate} with the specified fields. The day must be valid for the year, otherwise an exception will be thrown. @param prolepticYear the Ethiopic proleptic-year @param dayOfYear the Ethiopic day-of-year, from 1 to 366 @return the date in Ethiopic calendar system, not null @throws DateTimeException if the value of any field is out of range, or if the day-of-year is invalid for the year
[ "Obtains", "a", "{", "@code", "EthiopicDate", "}", "representing", "a", "date", "in", "the", "Ethiopic", "calendar", "system", "from", "the", "proleptic", "-", "year", "and", "day", "-", "of", "-", "year", "fields", ".", "<p", ">", "This", "returns", "a", "{", "@code", "EthiopicDate", "}", "with", "the", "specified", "fields", ".", "The", "day", "must", "be", "valid", "for", "the", "year", "otherwise", "an", "exception", "will", "be", "thrown", "." ]
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/EthiopicDate.java#L203-L210
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java
Encoder.encodePB
public void encodePB(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs, int rhs) { """ Encodes a pseudo-Boolean constraint. @param s the solver @param lits the literals of the constraint @param coeffs the coefficients of the constraints @param rhs the right hand side of the constraint @throws IllegalStateException if the pseudo-Boolean encoding is unknown """ switch (this.pbEncoding) { case SWC: this.swc.encode(s, lits, coeffs, rhs); break; default: throw new IllegalStateException("Unknown pseudo-Boolean encoding: " + this.pbEncoding); } }
java
public void encodePB(final MiniSatStyleSolver s, final LNGIntVector lits, final LNGIntVector coeffs, int rhs) { switch (this.pbEncoding) { case SWC: this.swc.encode(s, lits, coeffs, rhs); break; default: throw new IllegalStateException("Unknown pseudo-Boolean encoding: " + this.pbEncoding); } }
[ "public", "void", "encodePB", "(", "final", "MiniSatStyleSolver", "s", ",", "final", "LNGIntVector", "lits", ",", "final", "LNGIntVector", "coeffs", ",", "int", "rhs", ")", "{", "switch", "(", "this", ".", "pbEncoding", ")", "{", "case", "SWC", ":", "this", ".", "swc", ".", "encode", "(", "s", ",", "lits", ",", "coeffs", ",", "rhs", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Unknown pseudo-Boolean encoding: \"", "+", "this", ".", "pbEncoding", ")", ";", "}", "}" ]
Encodes a pseudo-Boolean constraint. @param s the solver @param lits the literals of the constraint @param coeffs the coefficients of the constraints @param rhs the right hand side of the constraint @throws IllegalStateException if the pseudo-Boolean encoding is unknown
[ "Encodes", "a", "pseudo", "-", "Boolean", "constraint", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L252-L260
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrieBuilder.java
CharsTrieBuilder.writeDeltaTo
@Deprecated @Override protected int writeDeltaTo(int jumpTarget) { """ {@inheritDoc} @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android """ int i=charsLength-jumpTarget; assert(i>=0); if(i<=CharsTrie.kMaxOneUnitDelta) { return write(i); } int length; if(i<=CharsTrie.kMaxTwoUnitDelta) { intUnits[0]=(char)(CharsTrie.kMinTwoUnitDeltaLead+(i>>16)); length=1; } else { intUnits[0]=(char)(CharsTrie.kThreeUnitDeltaLead); intUnits[1]=(char)(i>>16); length=2; } intUnits[length++]=(char)i; return write(intUnits, length); }
java
@Deprecated @Override protected int writeDeltaTo(int jumpTarget) { int i=charsLength-jumpTarget; assert(i>=0); if(i<=CharsTrie.kMaxOneUnitDelta) { return write(i); } int length; if(i<=CharsTrie.kMaxTwoUnitDelta) { intUnits[0]=(char)(CharsTrie.kMinTwoUnitDeltaLead+(i>>16)); length=1; } else { intUnits[0]=(char)(CharsTrie.kThreeUnitDeltaLead); intUnits[1]=(char)(i>>16); length=2; } intUnits[length++]=(char)i; return write(intUnits, length); }
[ "@", "Deprecated", "@", "Override", "protected", "int", "writeDeltaTo", "(", "int", "jumpTarget", ")", "{", "int", "i", "=", "charsLength", "-", "jumpTarget", ";", "assert", "(", "i", ">=", "0", ")", ";", "if", "(", "i", "<=", "CharsTrie", ".", "kMaxOneUnitDelta", ")", "{", "return", "write", "(", "i", ")", ";", "}", "int", "length", ";", "if", "(", "i", "<=", "CharsTrie", ".", "kMaxTwoUnitDelta", ")", "{", "intUnits", "[", "0", "]", "=", "(", "char", ")", "(", "CharsTrie", ".", "kMinTwoUnitDeltaLead", "+", "(", "i", ">>", "16", ")", ")", ";", "length", "=", "1", ";", "}", "else", "{", "intUnits", "[", "0", "]", "=", "(", "char", ")", "(", "CharsTrie", ".", "kThreeUnitDeltaLead", ")", ";", "intUnits", "[", "1", "]", "=", "(", "char", ")", "(", "i", ">>", "16", ")", ";", "length", "=", "2", ";", "}", "intUnits", "[", "length", "++", "]", "=", "(", "char", ")", "i", ";", "return", "write", "(", "intUnits", ",", "length", ")", ";", "}" ]
{@inheritDoc} @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrieBuilder.java#L251-L270
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java
JDBC4PreparedStatement.setURL
@Override public void setURL(int parameterIndex, URL x) throws SQLException { """ Sets the designated parameter to the given java.net.URL value. """ checkParameterBounds(parameterIndex); this.parameters[parameterIndex-1] = x == null ? VoltType.NULL_STRING_OR_VARBINARY : x.toString(); }
java
@Override public void setURL(int parameterIndex, URL x) throws SQLException { checkParameterBounds(parameterIndex); this.parameters[parameterIndex-1] = x == null ? VoltType.NULL_STRING_OR_VARBINARY : x.toString(); }
[ "@", "Override", "public", "void", "setURL", "(", "int", "parameterIndex", ",", "URL", "x", ")", "throws", "SQLException", "{", "checkParameterBounds", "(", "parameterIndex", ")", ";", "this", ".", "parameters", "[", "parameterIndex", "-", "1", "]", "=", "x", "==", "null", "?", "VoltType", ".", "NULL_STRING_OR_VARBINARY", ":", "x", ".", "toString", "(", ")", ";", "}" ]
Sets the designated parameter to the given java.net.URL value.
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "java", ".", "net", ".", "URL", "value", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L599-L604
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.getStaticFieldValue
public static Object getStaticFieldValue(Class<?> clazz, String name) { """ <p>Get a static field value.</p> @param clazz The class to check for static property @param name The field name @return The value if there is one, or null if unset OR there is no such field """ Field field = ReflectionUtils.findField(clazz, name); if (field != null) { ReflectionUtils.makeAccessible(field); try { return field.get(clazz); } catch (IllegalAccessException ignored) {} } return null; }
java
public static Object getStaticFieldValue(Class<?> clazz, String name) { Field field = ReflectionUtils.findField(clazz, name); if (field != null) { ReflectionUtils.makeAccessible(field); try { return field.get(clazz); } catch (IllegalAccessException ignored) {} } return null; }
[ "public", "static", "Object", "getStaticFieldValue", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ")", "{", "Field", "field", "=", "ReflectionUtils", ".", "findField", "(", "clazz", ",", "name", ")", ";", "if", "(", "field", "!=", "null", ")", "{", "ReflectionUtils", ".", "makeAccessible", "(", "field", ")", ";", "try", "{", "return", "field", ".", "get", "(", "clazz", ")", ";", "}", "catch", "(", "IllegalAccessException", "ignored", ")", "{", "}", "}", "return", "null", ";", "}" ]
<p>Get a static field value.</p> @param clazz The class to check for static property @param name The field name @return The value if there is one, or null if unset OR there is no such field
[ "<p", ">", "Get", "a", "static", "field", "value", ".", "<", "/", "p", ">" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L580-L589
webmetrics/browsermob-proxy
src/main/java/org/xbill/DNS/spi/DNSJavaNameService.java
DNSJavaNameService.getHostByAddr
public String getHostByAddr(byte [] addr) throws UnknownHostException { """ Performs a reverse DNS lookup. @param addr The ip address to lookup. @return The host name found for the ip address. """ Name name = ReverseMap.fromAddress(InetAddress.getByAddress(addr)); Record [] records = new Lookup(name, Type.PTR).run(); if (records == null) throw new UnknownHostException(); return ((PTRRecord) records[0]).getTarget().toString(); }
java
public String getHostByAddr(byte [] addr) throws UnknownHostException { Name name = ReverseMap.fromAddress(InetAddress.getByAddress(addr)); Record [] records = new Lookup(name, Type.PTR).run(); if (records == null) throw new UnknownHostException(); return ((PTRRecord) records[0]).getTarget().toString(); }
[ "public", "String", "getHostByAddr", "(", "byte", "[", "]", "addr", ")", "throws", "UnknownHostException", "{", "Name", "name", "=", "ReverseMap", ".", "fromAddress", "(", "InetAddress", ".", "getByAddress", "(", "addr", ")", ")", ";", "Record", "[", "]", "records", "=", "new", "Lookup", "(", "name", ",", "Type", ".", "PTR", ")", ".", "run", "(", ")", ";", "if", "(", "records", "==", "null", ")", "throw", "new", "UnknownHostException", "(", ")", ";", "return", "(", "(", "PTRRecord", ")", "records", "[", "0", "]", ")", ".", "getTarget", "(", ")", ".", "toString", "(", ")", ";", "}" ]
Performs a reverse DNS lookup. @param addr The ip address to lookup. @return The host name found for the ip address.
[ "Performs", "a", "reverse", "DNS", "lookup", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/xbill/DNS/spi/DNSJavaNameService.java#L150-L156
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateKeyAsync
public ServiceFuture<KeyBundle> updateKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags, final ServiceCallback<KeyBundle> serviceCallback) { """ The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a key itself cannot be changed. This operation requires the keys/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of key to update. @param keyVersion The version of the key to update. @param keyOps Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. @param keyAttributes the KeyAttributes value @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, keyOps, keyAttributes, tags), serviceCallback); }
java
public ServiceFuture<KeyBundle> updateKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags, final ServiceCallback<KeyBundle> serviceCallback) { return ServiceFuture.fromResponse(updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, keyOps, keyAttributes, tags), serviceCallback); }
[ "public", "ServiceFuture", "<", "KeyBundle", ">", "updateKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "String", "keyVersion", ",", "List", "<", "JsonWebKeyOperation", ">", "keyOps", ",", "KeyAttributes", "keyAttributes", ",", "Map", "<", "String", ",", "String", ">", "tags", ",", "final", "ServiceCallback", "<", "KeyBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "updateKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "keyVersion", ",", "keyOps", ",", "keyAttributes", ",", "tags", ")", ",", "serviceCallback", ")", ";", "}" ]
The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a key itself cannot be changed. This operation requires the keys/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of key to update. @param keyVersion The version of the key to update. @param keyOps Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. @param keyAttributes the KeyAttributes value @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "The", "update", "key", "operation", "changes", "specified", "attributes", "of", "a", "stored", "key", "and", "can", "be", "applied", "to", "any", "key", "type", "and", "key", "version", "stored", "in", "Azure", "Key", "Vault", ".", "In", "order", "to", "perform", "this", "operation", "the", "key", "must", "already", "exist", "in", "the", "Key", "Vault", ".", "Note", ":", "The", "cryptographic", "material", "of", "a", "key", "itself", "cannot", "be", "changed", ".", "This", "operation", "requires", "the", "keys", "/", "update", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1292-L1294
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/features/ExampleLineDetection.java
ExampleLineDetection.detectLines
public static<T extends ImageGray<T>, D extends ImageGray<D>> void detectLines( BufferedImage image , Class<T> imageType , Class<D> derivType ) { """ Detects lines inside the image using different types of Hough detectors @param image Input image. @param imageType Type of image processed by line detector. @param derivType Type of image derivative. """ // convert the line into a single band image T input = ConvertBufferedImage.convertFromSingle(image, null, imageType ); // Comment/uncomment to try a different type of line detector DetectLineHoughPolar<T,D> detector = FactoryDetectLineAlgs.houghPolar( new ConfigHoughPolar(3, 30, 2, Math.PI / 180,edgeThreshold, maxLines), imageType, derivType); // DetectLineHoughFoot<T,D> detector = FactoryDetectLineAlgs.houghFoot( // new ConfigHoughFoot(3, 8, 5, edgeThreshold,maxLines), imageType, derivType); // DetectLineHoughFootSubimage<T,D> detector = FactoryDetectLineAlgs.houghFootSub( // new ConfigHoughFootSubimage(3, 8, 5, edgeThreshold,maxLines, 2, 2), imageType, derivType); List<LineParametric2D_F32> found = detector.detect(input); // display the results ImageLinePanel gui = new ImageLinePanel(); gui.setImage(image); gui.setLines(found); gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight())); listPanel.addItem(gui, "Found Lines"); }
java
public static<T extends ImageGray<T>, D extends ImageGray<D>> void detectLines( BufferedImage image , Class<T> imageType , Class<D> derivType ) { // convert the line into a single band image T input = ConvertBufferedImage.convertFromSingle(image, null, imageType ); // Comment/uncomment to try a different type of line detector DetectLineHoughPolar<T,D> detector = FactoryDetectLineAlgs.houghPolar( new ConfigHoughPolar(3, 30, 2, Math.PI / 180,edgeThreshold, maxLines), imageType, derivType); // DetectLineHoughFoot<T,D> detector = FactoryDetectLineAlgs.houghFoot( // new ConfigHoughFoot(3, 8, 5, edgeThreshold,maxLines), imageType, derivType); // DetectLineHoughFootSubimage<T,D> detector = FactoryDetectLineAlgs.houghFootSub( // new ConfigHoughFootSubimage(3, 8, 5, edgeThreshold,maxLines, 2, 2), imageType, derivType); List<LineParametric2D_F32> found = detector.detect(input); // display the results ImageLinePanel gui = new ImageLinePanel(); gui.setImage(image); gui.setLines(found); gui.setPreferredSize(new Dimension(image.getWidth(),image.getHeight())); listPanel.addItem(gui, "Found Lines"); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ",", "D", "extends", "ImageGray", "<", "D", ">", ">", "void", "detectLines", "(", "BufferedImage", "image", ",", "Class", "<", "T", ">", "imageType", ",", "Class", "<", "D", ">", "derivType", ")", "{", "// convert the line into a single band image", "T", "input", "=", "ConvertBufferedImage", ".", "convertFromSingle", "(", "image", ",", "null", ",", "imageType", ")", ";", "// Comment/uncomment to try a different type of line detector", "DetectLineHoughPolar", "<", "T", ",", "D", ">", "detector", "=", "FactoryDetectLineAlgs", ".", "houghPolar", "(", "new", "ConfigHoughPolar", "(", "3", ",", "30", ",", "2", ",", "Math", ".", "PI", "/", "180", ",", "edgeThreshold", ",", "maxLines", ")", ",", "imageType", ",", "derivType", ")", ";", "//\t\tDetectLineHoughFoot<T,D> detector = FactoryDetectLineAlgs.houghFoot(", "//\t\t\t\tnew ConfigHoughFoot(3, 8, 5, edgeThreshold,maxLines), imageType, derivType);", "//\t\tDetectLineHoughFootSubimage<T,D> detector = FactoryDetectLineAlgs.houghFootSub(", "//\t\t\t\tnew ConfigHoughFootSubimage(3, 8, 5, edgeThreshold,maxLines, 2, 2), imageType, derivType);", "List", "<", "LineParametric2D_F32", ">", "found", "=", "detector", ".", "detect", "(", "input", ")", ";", "// display the results", "ImageLinePanel", "gui", "=", "new", "ImageLinePanel", "(", ")", ";", "gui", ".", "setImage", "(", "image", ")", ";", "gui", ".", "setLines", "(", "found", ")", ";", "gui", ".", "setPreferredSize", "(", "new", "Dimension", "(", "image", ".", "getWidth", "(", ")", ",", "image", ".", "getHeight", "(", ")", ")", ")", ";", "listPanel", ".", "addItem", "(", "gui", ",", "\"Found Lines\"", ")", ";", "}" ]
Detects lines inside the image using different types of Hough detectors @param image Input image. @param imageType Type of image processed by line detector. @param derivType Type of image derivative.
[ "Detects", "lines", "inside", "the", "image", "using", "different", "types", "of", "Hough", "detectors" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/features/ExampleLineDetection.java#L63-L88
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonWriter.java
JsonWriter.writeJson
private String writeJson(Object data, Map<String, Object> meta) throws IOException, NoSuchFieldException, IllegalAccessException, ODataEdmException, ODataRenderException { """ Write the given data to the JSON stream. The data to write will be either a single entity or a feed depending on whether it is a single object or list. @param data The given data. @param meta Additional values to write. @return The written JSON stream. @throws ODataRenderException if unable to render """ ByteArrayOutputStream stream = new ByteArrayOutputStream(); jsonGenerator = JSON_FACTORY.createGenerator(stream, JsonEncoding.UTF8); jsonGenerator.writeStartObject(); // Write @odata constants entitySet = (data instanceof List) ? getEntitySet((List<?>) data) : getEntitySet(data); jsonGenerator.writeStringField(CONTEXT, contextURL); // Write @odata.count if requested and provided. if (hasCountOption(odataUri) && data instanceof List && meta != null && meta.containsKey("count")) { long count; Object countObj = meta.get("count"); if (countObj instanceof Integer) { count = ((Integer) countObj).longValue(); } else { count = (long) countObj; } jsonGenerator.writeNumberField(COUNT, count); } if (!(data instanceof List)) { if (entitySet != null) { jsonGenerator.writeStringField(ID, String.format("%s(%s)", getEntityName(entityDataModel, data), formatEntityKey(entityDataModel, data))); } else { jsonGenerator.writeStringField(ID, String.format("%s", getEntityName(entityDataModel, data))); } } // Write feed if (data instanceof List) { marshallEntities((List<?>) data); } else { marshall(data, this.entityDataModel.getType(data.getClass())); } jsonGenerator.writeEndObject(); jsonGenerator.close(); return stream.toString(StandardCharsets.UTF_8.name()); }
java
private String writeJson(Object data, Map<String, Object> meta) throws IOException, NoSuchFieldException, IllegalAccessException, ODataEdmException, ODataRenderException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); jsonGenerator = JSON_FACTORY.createGenerator(stream, JsonEncoding.UTF8); jsonGenerator.writeStartObject(); // Write @odata constants entitySet = (data instanceof List) ? getEntitySet((List<?>) data) : getEntitySet(data); jsonGenerator.writeStringField(CONTEXT, contextURL); // Write @odata.count if requested and provided. if (hasCountOption(odataUri) && data instanceof List && meta != null && meta.containsKey("count")) { long count; Object countObj = meta.get("count"); if (countObj instanceof Integer) { count = ((Integer) countObj).longValue(); } else { count = (long) countObj; } jsonGenerator.writeNumberField(COUNT, count); } if (!(data instanceof List)) { if (entitySet != null) { jsonGenerator.writeStringField(ID, String.format("%s(%s)", getEntityName(entityDataModel, data), formatEntityKey(entityDataModel, data))); } else { jsonGenerator.writeStringField(ID, String.format("%s", getEntityName(entityDataModel, data))); } } // Write feed if (data instanceof List) { marshallEntities((List<?>) data); } else { marshall(data, this.entityDataModel.getType(data.getClass())); } jsonGenerator.writeEndObject(); jsonGenerator.close(); return stream.toString(StandardCharsets.UTF_8.name()); }
[ "private", "String", "writeJson", "(", "Object", "data", ",", "Map", "<", "String", ",", "Object", ">", "meta", ")", "throws", "IOException", ",", "NoSuchFieldException", ",", "IllegalAccessException", ",", "ODataEdmException", ",", "ODataRenderException", "{", "ByteArrayOutputStream", "stream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "jsonGenerator", "=", "JSON_FACTORY", ".", "createGenerator", "(", "stream", ",", "JsonEncoding", ".", "UTF8", ")", ";", "jsonGenerator", ".", "writeStartObject", "(", ")", ";", "// Write @odata constants", "entitySet", "=", "(", "data", "instanceof", "List", ")", "?", "getEntitySet", "(", "(", "List", "<", "?", ">", ")", "data", ")", ":", "getEntitySet", "(", "data", ")", ";", "jsonGenerator", ".", "writeStringField", "(", "CONTEXT", ",", "contextURL", ")", ";", "// Write @odata.count if requested and provided.", "if", "(", "hasCountOption", "(", "odataUri", ")", "&&", "data", "instanceof", "List", "&&", "meta", "!=", "null", "&&", "meta", ".", "containsKey", "(", "\"count\"", ")", ")", "{", "long", "count", ";", "Object", "countObj", "=", "meta", ".", "get", "(", "\"count\"", ")", ";", "if", "(", "countObj", "instanceof", "Integer", ")", "{", "count", "=", "(", "(", "Integer", ")", "countObj", ")", ".", "longValue", "(", ")", ";", "}", "else", "{", "count", "=", "(", "long", ")", "countObj", ";", "}", "jsonGenerator", ".", "writeNumberField", "(", "COUNT", ",", "count", ")", ";", "}", "if", "(", "!", "(", "data", "instanceof", "List", ")", ")", "{", "if", "(", "entitySet", "!=", "null", ")", "{", "jsonGenerator", ".", "writeStringField", "(", "ID", ",", "String", ".", "format", "(", "\"%s(%s)\"", ",", "getEntityName", "(", "entityDataModel", ",", "data", ")", ",", "formatEntityKey", "(", "entityDataModel", ",", "data", ")", ")", ")", ";", "}", "else", "{", "jsonGenerator", ".", "writeStringField", "(", "ID", ",", "String", ".", "format", "(", "\"%s\"", ",", "getEntityName", "(", "entityDataModel", ",", "data", ")", ")", ")", ";", "}", "}", "// Write feed", "if", "(", "data", "instanceof", "List", ")", "{", "marshallEntities", "(", "(", "List", "<", "?", ">", ")", "data", ")", ";", "}", "else", "{", "marshall", "(", "data", ",", "this", ".", "entityDataModel", ".", "getType", "(", "data", ".", "getClass", "(", ")", ")", ")", ";", "}", "jsonGenerator", ".", "writeEndObject", "(", ")", ";", "jsonGenerator", ".", "close", "(", ")", ";", "return", "stream", ".", "toString", "(", "StandardCharsets", ".", "UTF_8", ".", "name", "(", ")", ")", ";", "}" ]
Write the given data to the JSON stream. The data to write will be either a single entity or a feed depending on whether it is a single object or list. @param data The given data. @param meta Additional values to write. @return The written JSON stream. @throws ODataRenderException if unable to render
[ "Write", "the", "given", "data", "to", "the", "JSON", "stream", ".", "The", "data", "to", "write", "will", "be", "either", "a", "single", "entity", "or", "a", "feed", "depending", "on", "whether", "it", "is", "a", "single", "object", "or", "list", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonWriter.java#L168-L215
geomajas/geomajas-project-geometry
core/src/main/java/org/geomajas/geometry/service/GeometryService.java
GeometryService.toPolygon
public static Geometry toPolygon(Bbox bounds) { """ Transform the given bounding box into a polygon geometry. @param bounds The bounding box to transform. @return Returns the polygon equivalent of the given bounding box. """ double minX = bounds.getX(); double minY = bounds.getY(); double maxX = bounds.getMaxX(); double maxY = bounds.getMaxY(); Geometry polygon = new Geometry(Geometry.POLYGON, 0, -1); Geometry linearRing = new Geometry(Geometry.LINEAR_RING, 0, -1); linearRing.setCoordinates(new Coordinate[] { new Coordinate(minX, minY), new Coordinate(maxX, minY), new Coordinate(maxX, maxY), new Coordinate(minX, maxY), new Coordinate(minX, minY) }); polygon.setGeometries(new Geometry[] { linearRing }); return polygon; }
java
public static Geometry toPolygon(Bbox bounds) { double minX = bounds.getX(); double minY = bounds.getY(); double maxX = bounds.getMaxX(); double maxY = bounds.getMaxY(); Geometry polygon = new Geometry(Geometry.POLYGON, 0, -1); Geometry linearRing = new Geometry(Geometry.LINEAR_RING, 0, -1); linearRing.setCoordinates(new Coordinate[] { new Coordinate(minX, minY), new Coordinate(maxX, minY), new Coordinate(maxX, maxY), new Coordinate(minX, maxY), new Coordinate(minX, minY) }); polygon.setGeometries(new Geometry[] { linearRing }); return polygon; }
[ "public", "static", "Geometry", "toPolygon", "(", "Bbox", "bounds", ")", "{", "double", "minX", "=", "bounds", ".", "getX", "(", ")", ";", "double", "minY", "=", "bounds", ".", "getY", "(", ")", ";", "double", "maxX", "=", "bounds", ".", "getMaxX", "(", ")", ";", "double", "maxY", "=", "bounds", ".", "getMaxY", "(", ")", ";", "Geometry", "polygon", "=", "new", "Geometry", "(", "Geometry", ".", "POLYGON", ",", "0", ",", "-", "1", ")", ";", "Geometry", "linearRing", "=", "new", "Geometry", "(", "Geometry", ".", "LINEAR_RING", ",", "0", ",", "-", "1", ")", ";", "linearRing", ".", "setCoordinates", "(", "new", "Coordinate", "[", "]", "{", "new", "Coordinate", "(", "minX", ",", "minY", ")", ",", "new", "Coordinate", "(", "maxX", ",", "minY", ")", ",", "new", "Coordinate", "(", "maxX", ",", "maxY", ")", ",", "new", "Coordinate", "(", "minX", ",", "maxY", ")", ",", "new", "Coordinate", "(", "minX", ",", "minY", ")", "}", ")", ";", "polygon", ".", "setGeometries", "(", "new", "Geometry", "[", "]", "{", "linearRing", "}", ")", ";", "return", "polygon", ";", "}" ]
Transform the given bounding box into a polygon geometry. @param bounds The bounding box to transform. @return Returns the polygon equivalent of the given bounding box.
[ "Transform", "the", "given", "bounding", "box", "into", "a", "polygon", "geometry", "." ]
train
https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L140-L153
adobe/htl-tck
src/main/java/io/sightly/tck/html/HTMLExtractor.java
HTMLExtractor.innerHTML
public static String innerHTML(String url, String markup, String selector) { """ Retrieves the content of the matched elements, without their own markup tags, identified by the {@code selector} from the given {@code markup}. The {@code url} is used only for caching purposes, to avoid parsing multiple times the markup returned for the same resource. @param url the url that identifies the markup @param markup the markup @param selector the selector used for retrieval @return the contents of the selected element """ ensureMarkup(url, markup); Document document = documents.get(url); Elements elements = document.select(selector); return elements.html(); }
java
public static String innerHTML(String url, String markup, String selector) { ensureMarkup(url, markup); Document document = documents.get(url); Elements elements = document.select(selector); return elements.html(); }
[ "public", "static", "String", "innerHTML", "(", "String", "url", ",", "String", "markup", ",", "String", "selector", ")", "{", "ensureMarkup", "(", "url", ",", "markup", ")", ";", "Document", "document", "=", "documents", ".", "get", "(", "url", ")", ";", "Elements", "elements", "=", "document", ".", "select", "(", "selector", ")", ";", "return", "elements", ".", "html", "(", ")", ";", "}" ]
Retrieves the content of the matched elements, without their own markup tags, identified by the {@code selector} from the given {@code markup}. The {@code url} is used only for caching purposes, to avoid parsing multiple times the markup returned for the same resource. @param url the url that identifies the markup @param markup the markup @param selector the selector used for retrieval @return the contents of the selected element
[ "Retrieves", "the", "content", "of", "the", "matched", "elements", "without", "their", "own", "markup", "tags", "identified", "by", "the", "{", "@code", "selector", "}", "from", "the", "given", "{", "@code", "markup", "}", ".", "The", "{", "@code", "url", "}", "is", "used", "only", "for", "caching", "purposes", "to", "avoid", "parsing", "multiple", "times", "the", "markup", "returned", "for", "the", "same", "resource", "." ]
train
https://github.com/adobe/htl-tck/blob/2043a9616083c06cefbd685798c9a2b2ac2ea98e/src/main/java/io/sightly/tck/html/HTMLExtractor.java#L40-L45
samskivert/samskivert
src/main/java/com/samskivert/swing/LabelSausage.java
LabelSausage.drawBase
protected void drawBase (Graphics2D gfx, int x, int y) { """ Draws the base sausage within which all the other decorations are added. """ gfx.fillRoundRect( x, y, _size.width - 1, _size.height - 1, _dia, _dia); }
java
protected void drawBase (Graphics2D gfx, int x, int y) { gfx.fillRoundRect( x, y, _size.width - 1, _size.height - 1, _dia, _dia); }
[ "protected", "void", "drawBase", "(", "Graphics2D", "gfx", ",", "int", "x", ",", "int", "y", ")", "{", "gfx", ".", "fillRoundRect", "(", "x", ",", "y", ",", "_size", ".", "width", "-", "1", ",", "_size", ".", "height", "-", "1", ",", "_dia", ",", "_dia", ")", ";", "}" ]
Draws the base sausage within which all the other decorations are added.
[ "Draws", "the", "base", "sausage", "within", "which", "all", "the", "other", "decorations", "are", "added", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/LabelSausage.java#L127-L131
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBMapperFieldModel.java
DynamoDBMapperFieldModel.betweenAny
public final Condition betweenAny(final V lo, final V hi) { """ Creates a condition which filters on any non-null argument; if {@code lo} is null a {@code LE} condition is applied on {@code hi}, if {@code hi} is null a {@code GE} condition is applied on {@code lo}. @param lo The start of the range (inclusive). @param hi The end of the range (inclusive). @return The condition or null if both arguments are null. @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#BETWEEN @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#EQ @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#GE @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#LE @see com.amazonaws.services.dynamodbv2.model.Condition """ return lo == null ? (hi == null ? null : le(hi)) : (hi == null ? ge(lo) : (lo.equals(hi) ? eq(lo) : between(lo,hi))); }
java
public final Condition betweenAny(final V lo, final V hi) { return lo == null ? (hi == null ? null : le(hi)) : (hi == null ? ge(lo) : (lo.equals(hi) ? eq(lo) : between(lo,hi))); }
[ "public", "final", "Condition", "betweenAny", "(", "final", "V", "lo", ",", "final", "V", "hi", ")", "{", "return", "lo", "==", "null", "?", "(", "hi", "==", "null", "?", "null", ":", "le", "(", "hi", ")", ")", ":", "(", "hi", "==", "null", "?", "ge", "(", "lo", ")", ":", "(", "lo", ".", "equals", "(", "hi", ")", "?", "eq", "(", "lo", ")", ":", "between", "(", "lo", ",", "hi", ")", ")", ")", ";", "}" ]
Creates a condition which filters on any non-null argument; if {@code lo} is null a {@code LE} condition is applied on {@code hi}, if {@code hi} is null a {@code GE} condition is applied on {@code lo}. @param lo The start of the range (inclusive). @param hi The end of the range (inclusive). @return The condition or null if both arguments are null. @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#BETWEEN @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#EQ @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#GE @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#LE @see com.amazonaws.services.dynamodbv2.model.Condition
[ "Creates", "a", "condition", "which", "filters", "on", "any", "non", "-", "null", "argument", ";", "if", "{" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBMapperFieldModel.java#L385-L387
amaembo/streamex
src/main/java/one/util/streamex/StreamEx.java
StreamEx.zipWith
public <V, R> StreamEx<R> zipWith(Stream<V> other, BiFunction<? super T, ? super V, ? extends R> mapper) { """ Creates a new {@link StreamEx} which is the result of applying of the mapper {@code BiFunction} to the corresponding elements of this stream and the supplied other stream. The resulting stream is ordered if both of the input streams are ordered, and parallel if either of the input streams is parallel. When the resulting stream is closed, the close handlers for both input streams are invoked. <p> This is a <a href="package-summary.html#StreamOps">quasi-intermediate operation</a>. <p> The resulting stream finishes when either of the input streams finish: the rest of the longer stream is discarded. It's unspecified whether the rest elements of the longer stream are actually consumed. <p> The stream created by this operation may have poor characteristics and parallelize badly, so it should be used only when there's no other choice. If both input streams are random-access lists or arrays, consider using {@link #zip(List, List, BiFunction)} or {@link #zip(Object[], Object[], BiFunction)} respectively. If you want to zip the stream with the stream of indices, consider using {@link EntryStream#of(List)} instead. @param <V> the type of the other stream elements @param <R> the type of the resulting stream elements @param other the stream to zip this stream with @param mapper a non-interfering, stateless function to apply to the corresponding pairs of this stream and other stream elements @return the new stream @since 0.5.5 @see #zipWith(Stream) """ return zipWith((BaseStream<V, ?>) other, mapper); }
java
public <V, R> StreamEx<R> zipWith(Stream<V> other, BiFunction<? super T, ? super V, ? extends R> mapper) { return zipWith((BaseStream<V, ?>) other, mapper); }
[ "public", "<", "V", ",", "R", ">", "StreamEx", "<", "R", ">", "zipWith", "(", "Stream", "<", "V", ">", "other", ",", "BiFunction", "<", "?", "super", "T", ",", "?", "super", "V", ",", "?", "extends", "R", ">", "mapper", ")", "{", "return", "zipWith", "(", "(", "BaseStream", "<", "V", ",", "?", ">", ")", "other", ",", "mapper", ")", ";", "}" ]
Creates a new {@link StreamEx} which is the result of applying of the mapper {@code BiFunction} to the corresponding elements of this stream and the supplied other stream. The resulting stream is ordered if both of the input streams are ordered, and parallel if either of the input streams is parallel. When the resulting stream is closed, the close handlers for both input streams are invoked. <p> This is a <a href="package-summary.html#StreamOps">quasi-intermediate operation</a>. <p> The resulting stream finishes when either of the input streams finish: the rest of the longer stream is discarded. It's unspecified whether the rest elements of the longer stream are actually consumed. <p> The stream created by this operation may have poor characteristics and parallelize badly, so it should be used only when there's no other choice. If both input streams are random-access lists or arrays, consider using {@link #zip(List, List, BiFunction)} or {@link #zip(Object[], Object[], BiFunction)} respectively. If you want to zip the stream with the stream of indices, consider using {@link EntryStream#of(List)} instead. @param <V> the type of the other stream elements @param <R> the type of the resulting stream elements @param other the stream to zip this stream with @param mapper a non-interfering, stateless function to apply to the corresponding pairs of this stream and other stream elements @return the new stream @since 0.5.5 @see #zipWith(Stream)
[ "Creates", "a", "new", "{", "@link", "StreamEx", "}", "which", "is", "the", "result", "of", "applying", "of", "the", "mapper", "{", "@code", "BiFunction", "}", "to", "the", "corresponding", "elements", "of", "this", "stream", "and", "the", "supplied", "other", "stream", ".", "The", "resulting", "stream", "is", "ordered", "if", "both", "of", "the", "input", "streams", "are", "ordered", "and", "parallel", "if", "either", "of", "the", "input", "streams", "is", "parallel", ".", "When", "the", "resulting", "stream", "is", "closed", "the", "close", "handlers", "for", "both", "input", "streams", "are", "invoked", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1838-L1840
jcustenborder/connect-utils
connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java
ConfigUtils.passwordBytes
public static byte[] passwordBytes(AbstractConfig config, String key) { """ Method is used to return an array of bytes representing the password stored in the config. @param config Config to read from @param key Key to read from @return byte array containing the password """ return passwordBytes(config, key, Charsets.UTF_8); }
java
public static byte[] passwordBytes(AbstractConfig config, String key) { return passwordBytes(config, key, Charsets.UTF_8); }
[ "public", "static", "byte", "[", "]", "passwordBytes", "(", "AbstractConfig", "config", ",", "String", "key", ")", "{", "return", "passwordBytes", "(", "config", ",", "key", ",", "Charsets", ".", "UTF_8", ")", ";", "}" ]
Method is used to return an array of bytes representing the password stored in the config. @param config Config to read from @param key Key to read from @return byte array containing the password
[ "Method", "is", "used", "to", "return", "an", "array", "of", "bytes", "representing", "the", "password", "stored", "in", "the", "config", "." ]
train
https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java#L329-L331
Omertron/api-omdb
src/main/java/com/omertron/omdbapi/tools/OmdbBuilder.java
OmdbBuilder.setTitle
public OmdbBuilder setTitle(final String title) throws OMDBException { """ The title to search for @param title @return @throws OMDBException """ if (StringUtils.isBlank(title)) { throw new OMDBException(ApiExceptionType.UNKNOWN_CAUSE, "Must provide a title!"); } params.add(Param.TITLE, title); return this; }
java
public OmdbBuilder setTitle(final String title) throws OMDBException { if (StringUtils.isBlank(title)) { throw new OMDBException(ApiExceptionType.UNKNOWN_CAUSE, "Must provide a title!"); } params.add(Param.TITLE, title); return this; }
[ "public", "OmdbBuilder", "setTitle", "(", "final", "String", "title", ")", "throws", "OMDBException", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "title", ")", ")", "{", "throw", "new", "OMDBException", "(", "ApiExceptionType", ".", "UNKNOWN_CAUSE", ",", "\"Must provide a title!\"", ")", ";", "}", "params", ".", "add", "(", "Param", ".", "TITLE", ",", "title", ")", ";", "return", "this", ";", "}" ]
The title to search for @param title @return @throws OMDBException
[ "The", "title", "to", "search", "for" ]
train
https://github.com/Omertron/api-omdb/blob/acb506ded2d7b8a4159b48161ffab8cb5b7bad44/src/main/java/com/omertron/omdbapi/tools/OmdbBuilder.java#L89-L95
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java
MercatorProjection.calculateGroundResolutionWithScaleFactor
public static double calculateGroundResolutionWithScaleFactor(double latitude, double scaleFactor, int tileSize) { """ Calculates the distance on the ground that is represented by a single pixel on the map. @param latitude the latitude coordinate at which the resolution should be calculated. @param scaleFactor the scale at which the resolution should be calculated. @return the ground resolution at the given latitude and scale. """ long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize); return Math.cos(latitude * (Math.PI / 180)) * EARTH_CIRCUMFERENCE / mapSize; }
java
public static double calculateGroundResolutionWithScaleFactor(double latitude, double scaleFactor, int tileSize) { long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize); return Math.cos(latitude * (Math.PI / 180)) * EARTH_CIRCUMFERENCE / mapSize; }
[ "public", "static", "double", "calculateGroundResolutionWithScaleFactor", "(", "double", "latitude", ",", "double", "scaleFactor", ",", "int", "tileSize", ")", "{", "long", "mapSize", "=", "getMapSizeWithScaleFactor", "(", "scaleFactor", ",", "tileSize", ")", ";", "return", "Math", ".", "cos", "(", "latitude", "*", "(", "Math", ".", "PI", "/", "180", ")", ")", "*", "EARTH_CIRCUMFERENCE", "/", "mapSize", ";", "}" ]
Calculates the distance on the ground that is represented by a single pixel on the map. @param latitude the latitude coordinate at which the resolution should be calculated. @param scaleFactor the scale at which the resolution should be calculated. @return the ground resolution at the given latitude and scale.
[ "Calculates", "the", "distance", "on", "the", "ground", "that", "is", "represented", "by", "a", "single", "pixel", "on", "the", "map", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L62-L65
craftercms/deployer
src/main/java/org/craftercms/deployer/utils/ConfigUtils.java
ConfigUtils.loadYamlConfiguration
public static YamlConfiguration loadYamlConfiguration(Resource resource) throws DeployerConfigurationException { """ Loads the specified resource as {@link YamlConfiguration}. @param resource the YAML configuration resource to load @return the YAML configuration @throws DeployerConfigurationException if an error occurred """ try { try (Reader reader = new BufferedReader(new InputStreamReader(resource.getInputStream(), "UTF-8"))) { return doLoadYamlConfiguration(reader); } } catch (Exception e) { throw new DeployerConfigurationException("Failed to load YAML configuration at " + resource, e); } }
java
public static YamlConfiguration loadYamlConfiguration(Resource resource) throws DeployerConfigurationException { try { try (Reader reader = new BufferedReader(new InputStreamReader(resource.getInputStream(), "UTF-8"))) { return doLoadYamlConfiguration(reader); } } catch (Exception e) { throw new DeployerConfigurationException("Failed to load YAML configuration at " + resource, e); } }
[ "public", "static", "YamlConfiguration", "loadYamlConfiguration", "(", "Resource", "resource", ")", "throws", "DeployerConfigurationException", "{", "try", "{", "try", "(", "Reader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "resource", ".", "getInputStream", "(", ")", ",", "\"UTF-8\"", ")", ")", ")", "{", "return", "doLoadYamlConfiguration", "(", "reader", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "DeployerConfigurationException", "(", "\"Failed to load YAML configuration at \"", "+", "resource", ",", "e", ")", ";", "}", "}" ]
Loads the specified resource as {@link YamlConfiguration}. @param resource the YAML configuration resource to load @return the YAML configuration @throws DeployerConfigurationException if an error occurred
[ "Loads", "the", "specified", "resource", "as", "{", "@link", "YamlConfiguration", "}", "." ]
train
https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L72-L80
liferay/com-liferay-commerce
commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java
CommerceUserSegmentEntryPersistenceImpl.removeByG_K
@Override public CommerceUserSegmentEntry removeByG_K(long groupId, String key) throws NoSuchUserSegmentEntryException { """ Removes the commerce user segment entry where groupId = &#63; and key = &#63; from the database. @param groupId the group ID @param key the key @return the commerce user segment entry that was removed """ CommerceUserSegmentEntry commerceUserSegmentEntry = findByG_K(groupId, key); return remove(commerceUserSegmentEntry); }
java
@Override public CommerceUserSegmentEntry removeByG_K(long groupId, String key) throws NoSuchUserSegmentEntryException { CommerceUserSegmentEntry commerceUserSegmentEntry = findByG_K(groupId, key); return remove(commerceUserSegmentEntry); }
[ "@", "Override", "public", "CommerceUserSegmentEntry", "removeByG_K", "(", "long", "groupId", ",", "String", "key", ")", "throws", "NoSuchUserSegmentEntryException", "{", "CommerceUserSegmentEntry", "commerceUserSegmentEntry", "=", "findByG_K", "(", "groupId", ",", "key", ")", ";", "return", "remove", "(", "commerceUserSegmentEntry", ")", ";", "}" ]
Removes the commerce user segment entry where groupId = &#63; and key = &#63; from the database. @param groupId the group ID @param key the key @return the commerce user segment entry that was removed
[ "Removes", "the", "commerce", "user", "segment", "entry", "where", "groupId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java#L1142-L1149
code4everything/util
src/main/java/com/zhazhapan/util/NetUtils.java
NetUtils.removeCookie
public static boolean removeCookie(String name, Cookie[] cookies, HttpServletResponse response) { """ 删除指定Cookie @param name Cookie名 @param cookies {@link Cookie} @param response {@link HttpServletResponse} @return {@link Boolean} @since 1.0.8 """ if (Checker.isNotEmpty(name) && Checker.isNotEmpty(cookies)) { for (Cookie cookie : cookies) { if (name.equals(cookie.getName())) { return removeCookie(cookie, response); } } } return false; }
java
public static boolean removeCookie(String name, Cookie[] cookies, HttpServletResponse response) { if (Checker.isNotEmpty(name) && Checker.isNotEmpty(cookies)) { for (Cookie cookie : cookies) { if (name.equals(cookie.getName())) { return removeCookie(cookie, response); } } } return false; }
[ "public", "static", "boolean", "removeCookie", "(", "String", "name", ",", "Cookie", "[", "]", "cookies", ",", "HttpServletResponse", "response", ")", "{", "if", "(", "Checker", ".", "isNotEmpty", "(", "name", ")", "&&", "Checker", ".", "isNotEmpty", "(", "cookies", ")", ")", "{", "for", "(", "Cookie", "cookie", ":", "cookies", ")", "{", "if", "(", "name", ".", "equals", "(", "cookie", ".", "getName", "(", ")", ")", ")", "{", "return", "removeCookie", "(", "cookie", ",", "response", ")", ";", "}", "}", "}", "return", "false", ";", "}" ]
删除指定Cookie @param name Cookie名 @param cookies {@link Cookie} @param response {@link HttpServletResponse} @return {@link Boolean} @since 1.0.8
[ "删除指定Cookie" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/NetUtils.java#L533-L542
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/util/Config.java
Config.getProperty
public static String getProperty(String key, String aDefault) { """ Retrieves a configuration property as a String object. Loads the file if not already initialized. @param key Key Name of the property to be returned. @param aDefault the default value @return Value of the property as a string or null if no property found. """ return getSettings().getProperty(key, aDefault); }
java
public static String getProperty(String key, String aDefault) { return getSettings().getProperty(key, aDefault); }
[ "public", "static", "String", "getProperty", "(", "String", "key", ",", "String", "aDefault", ")", "{", "return", "getSettings", "(", ")", ".", "getProperty", "(", "key", ",", "aDefault", ")", ";", "}" ]
Retrieves a configuration property as a String object. Loads the file if not already initialized. @param key Key Name of the property to be returned. @param aDefault the default value @return Value of the property as a string or null if no property found.
[ "Retrieves", "a", "configuration", "property", "as", "a", "String", "object", "." ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Config.java#L251-L255
ops4j/org.ops4j.pax.exam2
containers/pax-exam-container-eclipse/src/main/java/org/ops4j/pax/exam/container/eclipse/impl/parser/AbstractParser.java
AbstractParser.getAttribute
protected static String getAttribute(Node node, String name, boolean required) { """ Get an Attribute from the given node and throwing an exception in the case it is required but not present @param node @param name @param required @return """ NamedNodeMap attributes = node.getAttributes(); Node idNode = attributes.getNamedItem(name); if (idNode == null) { if (required) { throw new IllegalArgumentException(toPath(node) + " has no " + name + " attribute"); } else { return ""; } } else { String value = idNode.getNodeValue(); if (value == null) { return ""; } return value; } }
java
protected static String getAttribute(Node node, String name, boolean required) { NamedNodeMap attributes = node.getAttributes(); Node idNode = attributes.getNamedItem(name); if (idNode == null) { if (required) { throw new IllegalArgumentException(toPath(node) + " has no " + name + " attribute"); } else { return ""; } } else { String value = idNode.getNodeValue(); if (value == null) { return ""; } return value; } }
[ "protected", "static", "String", "getAttribute", "(", "Node", "node", ",", "String", "name", ",", "boolean", "required", ")", "{", "NamedNodeMap", "attributes", "=", "node", ".", "getAttributes", "(", ")", ";", "Node", "idNode", "=", "attributes", ".", "getNamedItem", "(", "name", ")", ";", "if", "(", "idNode", "==", "null", ")", "{", "if", "(", "required", ")", "{", "throw", "new", "IllegalArgumentException", "(", "toPath", "(", "node", ")", "+", "\" has no \"", "+", "name", "+", "\" attribute\"", ")", ";", "}", "else", "{", "return", "\"\"", ";", "}", "}", "else", "{", "String", "value", "=", "idNode", ".", "getNodeValue", "(", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "\"\"", ";", "}", "return", "value", ";", "}", "}" ]
Get an Attribute from the given node and throwing an exception in the case it is required but not present @param node @param name @param required @return
[ "Get", "an", "Attribute", "from", "the", "given", "node", "and", "throwing", "an", "exception", "in", "the", "case", "it", "is", "required", "but", "not", "present" ]
train
https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/containers/pax-exam-container-eclipse/src/main/java/org/ops4j/pax/exam/container/eclipse/impl/parser/AbstractParser.java#L109-L127
elastic/elasticsearch-hadoop
mr/src/main/java/org/elasticsearch/hadoop/rest/pooling/PooledHttpTransportFactory.java
PooledHttpTransportFactory.borrowFrom
private Transport borrowFrom(TransportPool pool, String hostInfo) { """ Creates a Transport using the given TransportPool. @param pool Transport is borrowed from @param hostInfo For logging purposes @return A Transport backed by a pooled resource """ if (!pool.getJobPoolingKey().equals(jobKey)) { throw new EsHadoopIllegalArgumentException("PooledTransportFactory found a pool with a different owner than this job. " + "This could be a different job incorrectly polluting the TransportPool. Bailing out..."); } try { return pool.borrowTransport(); } catch (Exception ex) { throw new EsHadoopException( String.format("Could not get a Transport from the Transport Pool for host [%s]", hostInfo), ex ); } }
java
private Transport borrowFrom(TransportPool pool, String hostInfo) { if (!pool.getJobPoolingKey().equals(jobKey)) { throw new EsHadoopIllegalArgumentException("PooledTransportFactory found a pool with a different owner than this job. " + "This could be a different job incorrectly polluting the TransportPool. Bailing out..."); } try { return pool.borrowTransport(); } catch (Exception ex) { throw new EsHadoopException( String.format("Could not get a Transport from the Transport Pool for host [%s]", hostInfo), ex ); } }
[ "private", "Transport", "borrowFrom", "(", "TransportPool", "pool", ",", "String", "hostInfo", ")", "{", "if", "(", "!", "pool", ".", "getJobPoolingKey", "(", ")", ".", "equals", "(", "jobKey", ")", ")", "{", "throw", "new", "EsHadoopIllegalArgumentException", "(", "\"PooledTransportFactory found a pool with a different owner than this job. \"", "+", "\"This could be a different job incorrectly polluting the TransportPool. Bailing out...\"", ")", ";", "}", "try", "{", "return", "pool", ".", "borrowTransport", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "EsHadoopException", "(", "String", ".", "format", "(", "\"Could not get a Transport from the Transport Pool for host [%s]\"", ",", "hostInfo", ")", ",", "ex", ")", ";", "}", "}" ]
Creates a Transport using the given TransportPool. @param pool Transport is borrowed from @param hostInfo For logging purposes @return A Transport backed by a pooled resource
[ "Creates", "a", "Transport", "using", "the", "given", "TransportPool", "." ]
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/rest/pooling/PooledHttpTransportFactory.java#L101-L114
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/IIntFIFO.java
IIntFIFO.enQueue
public boolean enQueue( int data ) { """ add a new item to the queue @param data @return boolean """ Entry o = new Entry(data, head.next); head.next = o; size++; return true; }
java
public boolean enQueue( int data ) { Entry o = new Entry(data, head.next); head.next = o; size++; return true; }
[ "public", "boolean", "enQueue", "(", "int", "data", ")", "{", "Entry", "o", "=", "new", "Entry", "(", "data", ",", "head", ".", "next", ")", ";", "head", ".", "next", "=", "o", ";", "size", "++", ";", "return", "true", ";", "}" ]
add a new item to the queue @param data @return boolean
[ "add", "a", "new", "item", "to", "the", "queue" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/IIntFIFO.java#L28-L35
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/events/CacheEventDispatcherImpl.java
CacheEventDispatcherImpl.registerCacheEventListener
private synchronized void registerCacheEventListener(EventListenerWrapper<K, V> wrapper) { """ Synchronized to make sure listener addition is atomic in order to prevent having the same listener registered under multiple configurations @param wrapper the listener wrapper to register """ if(aSyncListenersList.contains(wrapper) || syncListenersList.contains(wrapper)) { throw new IllegalStateException("Cache Event Listener already registered: " + wrapper.getListener()); } if (wrapper.isOrdered() && orderedListenerCount++ == 0) { storeEventSource.setEventOrdering(true); } switch (wrapper.getFiringMode()) { case ASYNCHRONOUS: aSyncListenersList.add(wrapper); break; case SYNCHRONOUS: syncListenersList.add(wrapper); break; default: throw new AssertionError("Unhandled EventFiring value: " + wrapper.getFiringMode()); } if (listenersCount++ == 0) { storeEventSource.addEventListener(eventListener); } }
java
private synchronized void registerCacheEventListener(EventListenerWrapper<K, V> wrapper) { if(aSyncListenersList.contains(wrapper) || syncListenersList.contains(wrapper)) { throw new IllegalStateException("Cache Event Listener already registered: " + wrapper.getListener()); } if (wrapper.isOrdered() && orderedListenerCount++ == 0) { storeEventSource.setEventOrdering(true); } switch (wrapper.getFiringMode()) { case ASYNCHRONOUS: aSyncListenersList.add(wrapper); break; case SYNCHRONOUS: syncListenersList.add(wrapper); break; default: throw new AssertionError("Unhandled EventFiring value: " + wrapper.getFiringMode()); } if (listenersCount++ == 0) { storeEventSource.addEventListener(eventListener); } }
[ "private", "synchronized", "void", "registerCacheEventListener", "(", "EventListenerWrapper", "<", "K", ",", "V", ">", "wrapper", ")", "{", "if", "(", "aSyncListenersList", ".", "contains", "(", "wrapper", ")", "||", "syncListenersList", ".", "contains", "(", "wrapper", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cache Event Listener already registered: \"", "+", "wrapper", ".", "getListener", "(", ")", ")", ";", "}", "if", "(", "wrapper", ".", "isOrdered", "(", ")", "&&", "orderedListenerCount", "++", "==", "0", ")", "{", "storeEventSource", ".", "setEventOrdering", "(", "true", ")", ";", "}", "switch", "(", "wrapper", ".", "getFiringMode", "(", ")", ")", "{", "case", "ASYNCHRONOUS", ":", "aSyncListenersList", ".", "add", "(", "wrapper", ")", ";", "break", ";", "case", "SYNCHRONOUS", ":", "syncListenersList", ".", "add", "(", "wrapper", ")", ";", "break", ";", "default", ":", "throw", "new", "AssertionError", "(", "\"Unhandled EventFiring value: \"", "+", "wrapper", ".", "getFiringMode", "(", ")", ")", ";", "}", "if", "(", "listenersCount", "++", "==", "0", ")", "{", "storeEventSource", ".", "addEventListener", "(", "eventListener", ")", ";", "}", "}" ]
Synchronized to make sure listener addition is atomic in order to prevent having the same listener registered under multiple configurations @param wrapper the listener wrapper to register
[ "Synchronized", "to", "make", "sure", "listener", "addition", "is", "atomic", "in", "order", "to", "prevent", "having", "the", "same", "listener", "registered", "under", "multiple", "configurations" ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/events/CacheEventDispatcherImpl.java#L96-L119
jboss/jboss-el-api_spec
src/main/java/javax/el/ELUtil.java
ELUtil.getExceptionMessageString
public static String getExceptionMessageString(ELContext context, String messageId) { """ /* <p>Convenience method, calls through to {@link #getExceptionMessageString(javax.el.ELContext,java.lang.String,Object []). </p> @param context the ELContext from which the Locale for this message is extracted. @param messageId the messageId String in the ResourceBundle @return a localized String for the argument messageId """ return getExceptionMessageString(context, messageId, null); }
java
public static String getExceptionMessageString(ELContext context, String messageId) { return getExceptionMessageString(context, messageId, null); }
[ "public", "static", "String", "getExceptionMessageString", "(", "ELContext", "context", ",", "String", "messageId", ")", "{", "return", "getExceptionMessageString", "(", "context", ",", "messageId", ",", "null", ")", ";", "}" ]
/* <p>Convenience method, calls through to {@link #getExceptionMessageString(javax.el.ELContext,java.lang.String,Object []). </p> @param context the ELContext from which the Locale for this message is extracted. @param messageId the messageId String in the ResourceBundle @return a localized String for the argument messageId
[ "/", "*", "<p", ">", "Convenience", "method", "calls", "through", "to", "{", "@link", "#getExceptionMessageString", "(", "javax", ".", "el", ".", "ELContext", "java", ".", "lang", ".", "String", "Object", "[]", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ELUtil.java#L164-L166
foundation-runtime/configuration
configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamValidators.java
ParamValidators.getValidator
public static<T extends ParamValidator> T getValidator(Class<T> clazz, boolean required) { """ return the relevant Validator by the given class type and required indication """ List<ParamValidator> validators = validatorsMap.get(clazz); if (validators != null) { if (required) { return (T)validators.get(0); } return (T)validators.get(1); } return null; }
java
public static<T extends ParamValidator> T getValidator(Class<T> clazz, boolean required) { List<ParamValidator> validators = validatorsMap.get(clazz); if (validators != null) { if (required) { return (T)validators.get(0); } return (T)validators.get(1); } return null; }
[ "public", "static", "<", "T", "extends", "ParamValidator", ">", "T", "getValidator", "(", "Class", "<", "T", ">", "clazz", ",", "boolean", "required", ")", "{", "List", "<", "ParamValidator", ">", "validators", "=", "validatorsMap", ".", "get", "(", "clazz", ")", ";", "if", "(", "validators", "!=", "null", ")", "{", "if", "(", "required", ")", "{", "return", "(", "T", ")", "validators", ".", "get", "(", "0", ")", ";", "}", "return", "(", "T", ")", "validators", ".", "get", "(", "1", ")", ";", "}", "return", "null", ";", "}" ]
return the relevant Validator by the given class type and required indication
[ "return", "the", "relevant", "Validator", "by", "the", "given", "class", "type", "and", "required", "indication" ]
train
https://github.com/foundation-runtime/configuration/blob/c5bd171a2cca0dc1c8d568f987843ca47c6d1eed/configuration-api/src/main/java/com/cisco/oss/foundation/configuration/validation/params/ParamValidators.java#L458-L471
EdwardRaff/JSAT
JSAT/src/jsat/math/decayrates/ExponetialDecay.java
ExponetialDecay.setMinRate
public void setMinRate(double min) { """ Sets the minimum learning rate to return @param min the minimum learning rate to return """ if(min <= 0 || Double.isNaN(min) || Double.isInfinite(min)) throw new RuntimeException("minRate should be positive, not " + min); this.min = min; }
java
public void setMinRate(double min) { if(min <= 0 || Double.isNaN(min) || Double.isInfinite(min)) throw new RuntimeException("minRate should be positive, not " + min); this.min = min; }
[ "public", "void", "setMinRate", "(", "double", "min", ")", "{", "if", "(", "min", "<=", "0", "||", "Double", ".", "isNaN", "(", "min", ")", "||", "Double", ".", "isInfinite", "(", "min", ")", ")", "throw", "new", "RuntimeException", "(", "\"minRate should be positive, not \"", "+", "min", ")", ";", "this", ".", "min", "=", "min", ";", "}" ]
Sets the minimum learning rate to return @param min the minimum learning rate to return
[ "Sets", "the", "minimum", "learning", "rate", "to", "return" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/decayrates/ExponetialDecay.java#L65-L70
kikinteractive/ice
ice/src/main/java/com/kik/config/ice/internal/MethodIdProxyFactory.java
MethodIdProxyFactory.getProxy
public static <C> C getProxy(final Class<C> configInterface, final Optional<String> scopeNameOpt) { """ Produces a proxy impl of a configuration interface to identify methods called on it """ final ClassAndScope key = new ClassAndScope(configInterface, scopeNameOpt); final C methodIdProxy; if (proxyMap.containsKey(key)) { methodIdProxy = (C) proxyMap.get(key); } else { methodIdProxy = createMethodIdProxy(configInterface, scopeNameOpt); proxyMap.put(key, methodIdProxy); } return methodIdProxy; }
java
public static <C> C getProxy(final Class<C> configInterface, final Optional<String> scopeNameOpt) { final ClassAndScope key = new ClassAndScope(configInterface, scopeNameOpt); final C methodIdProxy; if (proxyMap.containsKey(key)) { methodIdProxy = (C) proxyMap.get(key); } else { methodIdProxy = createMethodIdProxy(configInterface, scopeNameOpt); proxyMap.put(key, methodIdProxy); } return methodIdProxy; }
[ "public", "static", "<", "C", ">", "C", "getProxy", "(", "final", "Class", "<", "C", ">", "configInterface", ",", "final", "Optional", "<", "String", ">", "scopeNameOpt", ")", "{", "final", "ClassAndScope", "key", "=", "new", "ClassAndScope", "(", "configInterface", ",", "scopeNameOpt", ")", ";", "final", "C", "methodIdProxy", ";", "if", "(", "proxyMap", ".", "containsKey", "(", "key", ")", ")", "{", "methodIdProxy", "=", "(", "C", ")", "proxyMap", ".", "get", "(", "key", ")", ";", "}", "else", "{", "methodIdProxy", "=", "createMethodIdProxy", "(", "configInterface", ",", "scopeNameOpt", ")", ";", "proxyMap", ".", "put", "(", "key", ",", "methodIdProxy", ")", ";", "}", "return", "methodIdProxy", ";", "}" ]
Produces a proxy impl of a configuration interface to identify methods called on it
[ "Produces", "a", "proxy", "impl", "of", "a", "configuration", "interface", "to", "identify", "methods", "called", "on", "it" ]
train
https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/internal/MethodIdProxyFactory.java#L50-L63
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/olap/ParsedQuery.java
ParsedQuery.getInt
public int getInt(String key, int defaultValue) { """ Returns an integer value by the key specified or defaultValue if the key was not provided """ String value = get(key); if(value == null) return defaultValue; try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new IllegalArgumentException(key + " parameter should be a number"); } }
java
public int getInt(String key, int defaultValue) { String value = get(key); if(value == null) return defaultValue; try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new IllegalArgumentException(key + " parameter should be a number"); } }
[ "public", "int", "getInt", "(", "String", "key", ",", "int", "defaultValue", ")", "{", "String", "value", "=", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "return", "defaultValue", ";", "try", "{", "return", "Integer", ".", "parseInt", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "key", "+", "\" parameter should be a number\"", ")", ";", "}", "}" ]
Returns an integer value by the key specified or defaultValue if the key was not provided
[ "Returns", "an", "integer", "value", "by", "the", "key", "specified", "or", "defaultValue", "if", "the", "key", "was", "not", "provided" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/olap/ParsedQuery.java#L123-L131
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java
RecommendedElasticPoolsInner.listByServerAsync
public Observable<List<RecommendedElasticPoolInner>> listByServerAsync(String resourceGroupName, String serverName) { """ Returns recommended elastic pools. @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 @return the observable to the List&lt;RecommendedElasticPoolInner&gt; object """ return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<RecommendedElasticPoolInner>>, List<RecommendedElasticPoolInner>>() { @Override public List<RecommendedElasticPoolInner> call(ServiceResponse<List<RecommendedElasticPoolInner>> response) { return response.body(); } }); }
java
public Observable<List<RecommendedElasticPoolInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<RecommendedElasticPoolInner>>, List<RecommendedElasticPoolInner>>() { @Override public List<RecommendedElasticPoolInner> call(ServiceResponse<List<RecommendedElasticPoolInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "RecommendedElasticPoolInner", ">", ">", "listByServerAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "RecommendedElasticPoolInner", ">", ">", ",", "List", "<", "RecommendedElasticPoolInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "RecommendedElasticPoolInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "RecommendedElasticPoolInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Returns recommended elastic pools. @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 @return the observable to the List&lt;RecommendedElasticPoolInner&gt; object
[ "Returns", "recommended", "elastic", "pools", "." ]
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/RecommendedElasticPoolsInner.java#L197-L204
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
BaseFilterQueryBuilder.addNotEqualsCondition
protected void addNotEqualsCondition(final String propertyName, final String value) { """ Add a Field Search Condition that will search a field for a specified value using the following SQL logic: {@code field != 'value'} @param propertyName The name of the field as defined in the Entity mapping class. @param value The value to search against. """ fieldConditions.add(getCriteriaBuilder().notEqual(getRootPath().get(propertyName).as(String.class), value)); }
java
protected void addNotEqualsCondition(final String propertyName, final String value) { fieldConditions.add(getCriteriaBuilder().notEqual(getRootPath().get(propertyName).as(String.class), value)); }
[ "protected", "void", "addNotEqualsCondition", "(", "final", "String", "propertyName", ",", "final", "String", "value", ")", "{", "fieldConditions", ".", "add", "(", "getCriteriaBuilder", "(", ")", ".", "notEqual", "(", "getRootPath", "(", ")", ".", "get", "(", "propertyName", ")", ".", "as", "(", "String", ".", "class", ")", ",", "value", ")", ")", ";", "}" ]
Add a Field Search Condition that will search a field for a specified value using the following SQL logic: {@code field != 'value'} @param propertyName The name of the field as defined in the Entity mapping class. @param value The value to search against.
[ "Add", "a", "Field", "Search", "Condition", "that", "will", "search", "a", "field", "for", "a", "specified", "value", "using", "the", "following", "SQL", "logic", ":", "{", "@code", "field", "!", "=", "value", "}" ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L463-L465
super-csv/super-csv
super-csv/src/main/java/org/supercsv/util/MethodCache.java
MethodCache.getGetMethod
public Method getGetMethod(final Object object, final String fieldName) { """ Returns the getter method for field on an object. @param object the object @param fieldName the field name @return the getter associated with the field on the object @throws NullPointerException if object or fieldName is null @throws SuperCsvReflectionException if the getter doesn't exist or is not visible """ if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } Method method = getCache.get(object.getClass().getName(), fieldName); if( method == null ) { method = ReflectionUtils.findGetter(object, fieldName); getCache.set(object.getClass().getName(), fieldName, method); } return method; }
java
public Method getGetMethod(final Object object, final String fieldName) { if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } Method method = getCache.get(object.getClass().getName(), fieldName); if( method == null ) { method = ReflectionUtils.findGetter(object, fieldName); getCache.set(object.getClass().getName(), fieldName, method); } return method; }
[ "public", "Method", "getGetMethod", "(", "final", "Object", "object", ",", "final", "String", "fieldName", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"object should not be null\"", ")", ";", "}", "else", "if", "(", "fieldName", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"fieldName should not be null\"", ")", ";", "}", "Method", "method", "=", "getCache", ".", "get", "(", "object", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "fieldName", ")", ";", "if", "(", "method", "==", "null", ")", "{", "method", "=", "ReflectionUtils", ".", "findGetter", "(", "object", ",", "fieldName", ")", ";", "getCache", ".", "set", "(", "object", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "fieldName", ",", "method", ")", ";", "}", "return", "method", ";", "}" ]
Returns the getter method for field on an object. @param object the object @param fieldName the field name @return the getter associated with the field on the object @throws NullPointerException if object or fieldName is null @throws SuperCsvReflectionException if the getter doesn't exist or is not visible
[ "Returns", "the", "getter", "method", "for", "field", "on", "an", "object", "." ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/MethodCache.java#L53-L66
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java
ReplicationsInner.createAsync
public Observable<ReplicationInner> createAsync(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { """ Creates a replication for a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param replicationName The name of the replication. @param replication The parameters for creating a replication. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).map(new Func1<ServiceResponse<ReplicationInner>, ReplicationInner>() { @Override public ReplicationInner call(ServiceResponse<ReplicationInner> response) { return response.body(); } }); }
java
public Observable<ReplicationInner> createAsync(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) { return createWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).map(new Func1<ServiceResponse<ReplicationInner>, ReplicationInner>() { @Override public ReplicationInner call(ServiceResponse<ReplicationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ReplicationInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "replicationName", ",", "ReplicationInner", "replication", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "replicationName", ",", "replication", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ReplicationInner", ">", ",", "ReplicationInner", ">", "(", ")", "{", "@", "Override", "public", "ReplicationInner", "call", "(", "ServiceResponse", "<", "ReplicationInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a replication for a container registry with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param replicationName The name of the replication. @param replication The parameters for creating a replication. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "replication", "for", "a", "container", "registry", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java#L239-L246
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/SecureAction.java
SecureAction.getFileOutputStream
public FileOutputStream getFileOutputStream(final File file, final boolean append) throws FileNotFoundException { """ Creates a FileInputStream from a File. Same as calling new FileOutputStream(File,boolean). @param file the File to create a FileOutputStream from. @param append indicates if the OutputStream should append content. @return The FileOutputStream. @throws FileNotFoundException if the File does not exist. """ if (System.getSecurityManager() == null) return new FileOutputStream(file.getAbsolutePath(), append); try { return AccessController.doPrivileged(new PrivilegedExceptionAction<FileOutputStream>() { @Override public FileOutputStream run() throws FileNotFoundException { return new FileOutputStream(file.getAbsolutePath(), append); } }, controlContext); } catch (PrivilegedActionException e) { if (e.getException() instanceof FileNotFoundException) throw (FileNotFoundException) e.getException(); throw (RuntimeException) e.getException(); } }
java
public FileOutputStream getFileOutputStream(final File file, final boolean append) throws FileNotFoundException { if (System.getSecurityManager() == null) return new FileOutputStream(file.getAbsolutePath(), append); try { return AccessController.doPrivileged(new PrivilegedExceptionAction<FileOutputStream>() { @Override public FileOutputStream run() throws FileNotFoundException { return new FileOutputStream(file.getAbsolutePath(), append); } }, controlContext); } catch (PrivilegedActionException e) { if (e.getException() instanceof FileNotFoundException) throw (FileNotFoundException) e.getException(); throw (RuntimeException) e.getException(); } }
[ "public", "FileOutputStream", "getFileOutputStream", "(", "final", "File", "file", ",", "final", "boolean", "append", ")", "throws", "FileNotFoundException", "{", "if", "(", "System", ".", "getSecurityManager", "(", ")", "==", "null", ")", "return", "new", "FileOutputStream", "(", "file", ".", "getAbsolutePath", "(", ")", ",", "append", ")", ";", "try", "{", "return", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExceptionAction", "<", "FileOutputStream", ">", "(", ")", "{", "@", "Override", "public", "FileOutputStream", "run", "(", ")", "throws", "FileNotFoundException", "{", "return", "new", "FileOutputStream", "(", "file", ".", "getAbsolutePath", "(", ")", ",", "append", ")", ";", "}", "}", ",", "controlContext", ")", ";", "}", "catch", "(", "PrivilegedActionException", "e", ")", "{", "if", "(", "e", ".", "getException", "(", ")", "instanceof", "FileNotFoundException", ")", "throw", "(", "FileNotFoundException", ")", "e", ".", "getException", "(", ")", ";", "throw", "(", "RuntimeException", ")", "e", ".", "getException", "(", ")", ";", "}", "}" ]
Creates a FileInputStream from a File. Same as calling new FileOutputStream(File,boolean). @param file the File to create a FileOutputStream from. @param append indicates if the OutputStream should append content. @return The FileOutputStream. @throws FileNotFoundException if the File does not exist.
[ "Creates", "a", "FileInputStream", "from", "a", "File", ".", "Same", "as", "calling", "new", "FileOutputStream", "(", "File", "boolean", ")", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/util/SecureAction.java#L171-L186
Cosium/spring-data-jpa-entity-graph
src/main/java/com/cosium/spring/data/jpa/entity/graph/repository/support/QueryHintsUtils.java
QueryHintsUtils.removeEntityGraphs
static void removeEntityGraphs(Map<String, Object> queryHints) { """ Remove all EntityGraph pre existing in the QueryHints @param queryHints """ if (queryHints == null) { return; } queryHints.remove(EntityGraph.EntityGraphType.FETCH.getKey()); queryHints.remove(EntityGraph.EntityGraphType.LOAD.getKey()); }
java
static void removeEntityGraphs(Map<String, Object> queryHints) { if (queryHints == null) { return; } queryHints.remove(EntityGraph.EntityGraphType.FETCH.getKey()); queryHints.remove(EntityGraph.EntityGraphType.LOAD.getKey()); }
[ "static", "void", "removeEntityGraphs", "(", "Map", "<", "String", ",", "Object", ">", "queryHints", ")", "{", "if", "(", "queryHints", "==", "null", ")", "{", "return", ";", "}", "queryHints", ".", "remove", "(", "EntityGraph", ".", "EntityGraphType", ".", "FETCH", ".", "getKey", "(", ")", ")", ";", "queryHints", ".", "remove", "(", "EntityGraph", ".", "EntityGraphType", ".", "LOAD", ".", "getKey", "(", ")", ")", ";", "}" ]
Remove all EntityGraph pre existing in the QueryHints @param queryHints
[ "Remove", "all", "EntityGraph", "pre", "existing", "in", "the", "QueryHints" ]
train
https://github.com/Cosium/spring-data-jpa-entity-graph/blob/b5f2f6acfcbac535d3cac90bd88fefd1b8cd6a7f/src/main/java/com/cosium/spring/data/jpa/entity/graph/repository/support/QueryHintsUtils.java#L30-L36
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.tileFeatureCount
public long tileFeatureCount(LatLng latLng, double zoom) { """ Get the count of features in the tile at the lat lng coordinate and zoom level @param latLng lat lng location @param zoom zoom level @return count """ int zoomValue = (int) zoom; long tileFeaturesCount = tileFeatureCount(latLng, zoomValue); return tileFeaturesCount; }
java
public long tileFeatureCount(LatLng latLng, double zoom) { int zoomValue = (int) zoom; long tileFeaturesCount = tileFeatureCount(latLng, zoomValue); return tileFeaturesCount; }
[ "public", "long", "tileFeatureCount", "(", "LatLng", "latLng", ",", "double", "zoom", ")", "{", "int", "zoomValue", "=", "(", "int", ")", "zoom", ";", "long", "tileFeaturesCount", "=", "tileFeatureCount", "(", "latLng", ",", "zoomValue", ")", ";", "return", "tileFeaturesCount", ";", "}" ]
Get the count of features in the tile at the lat lng coordinate and zoom level @param latLng lat lng location @param zoom zoom level @return count
[ "Get", "the", "count", "of", "features", "in", "the", "tile", "at", "the", "lat", "lng", "coordinate", "and", "zoom", "level" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L203-L207
stagemonitor/stagemonitor
stagemonitor-core/src/main/java/org/stagemonitor/core/util/MBeanUtils.java
MBeanUtils.registerMBean
public static void registerMBean(final ObjectInstance objectInstance, final String mBeanAttributeName, MetricName metricName, Metric2Registry metricRegistry) { """ Registers a MBean into the MetricRegistry @param objectInstance The ObjectInstance @param mBeanAttributeName The attribute name of the MBean that should be collected @param metricName The name of the metric in the MetricRegistry @param metricRegistry The metric registry the values of the mbean should be registered at """ metricRegistry.register(metricName, new Gauge<Object>() { @Override public Object getValue() { return getValueFromMBean(objectInstance, mBeanAttributeName); } }); }
java
public static void registerMBean(final ObjectInstance objectInstance, final String mBeanAttributeName, MetricName metricName, Metric2Registry metricRegistry) { metricRegistry.register(metricName, new Gauge<Object>() { @Override public Object getValue() { return getValueFromMBean(objectInstance, mBeanAttributeName); } }); }
[ "public", "static", "void", "registerMBean", "(", "final", "ObjectInstance", "objectInstance", ",", "final", "String", "mBeanAttributeName", ",", "MetricName", "metricName", ",", "Metric2Registry", "metricRegistry", ")", "{", "metricRegistry", ".", "register", "(", "metricName", ",", "new", "Gauge", "<", "Object", ">", "(", ")", "{", "@", "Override", "public", "Object", "getValue", "(", ")", "{", "return", "getValueFromMBean", "(", "objectInstance", ",", "mBeanAttributeName", ")", ";", "}", "}", ")", ";", "}" ]
Registers a MBean into the MetricRegistry @param objectInstance The ObjectInstance @param mBeanAttributeName The attribute name of the MBean that should be collected @param metricName The name of the metric in the MetricRegistry @param metricRegistry The metric registry the values of the mbean should be registered at
[ "Registers", "a", "MBean", "into", "the", "MetricRegistry" ]
train
https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-core/src/main/java/org/stagemonitor/core/util/MBeanUtils.java#L84-L91
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingEndpointsInner.java
StreamingEndpointsInner.beginScale
public void beginScale(String resourceGroupName, String accountName, String streamingEndpointName) { """ Scale StreamingEndpoint. Scales an existing StreamingEndpoint. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingEndpointName The name of the StreamingEndpoint. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ beginScaleWithServiceResponseAsync(resourceGroupName, accountName, streamingEndpointName).toBlocking().single().body(); }
java
public void beginScale(String resourceGroupName, String accountName, String streamingEndpointName) { beginScaleWithServiceResponseAsync(resourceGroupName, accountName, streamingEndpointName).toBlocking().single().body(); }
[ "public", "void", "beginScale", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "streamingEndpointName", ")", "{", "beginScaleWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "streamingEndpointName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Scale StreamingEndpoint. Scales an existing StreamingEndpoint. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param streamingEndpointName The name of the StreamingEndpoint. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Scale", "StreamingEndpoint", ".", "Scales", "an", "existing", "StreamingEndpoint", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingEndpointsInner.java#L1644-L1646
Alluxio/alluxio
shell/src/main/java/alluxio/cli/fs/command/DuCommand.java
DuCommand.getFormattedValues
private String getFormattedValues(boolean readable, long size, long totalSize) { """ Gets the size and its percentage information, if readable option is provided, get the size in human readable format. @param readable whether to print info of human readable format @param size the size to get information from @param totalSize the total size to calculate percentage information @return the formatted value and percentage information """ // If size is 1, total size is 5, and readable is true, it will // return a string as "1B (20%)" int percent = totalSize == 0 ? 0 : (int) (size * 100 / totalSize); String subSizeMessage = readable ? FormatUtils.getSizeFromBytes(size) : String.valueOf(size); return String.format(VALUE_AND_PERCENT_FORMAT, subSizeMessage, percent); }
java
private String getFormattedValues(boolean readable, long size, long totalSize) { // If size is 1, total size is 5, and readable is true, it will // return a string as "1B (20%)" int percent = totalSize == 0 ? 0 : (int) (size * 100 / totalSize); String subSizeMessage = readable ? FormatUtils.getSizeFromBytes(size) : String.valueOf(size); return String.format(VALUE_AND_PERCENT_FORMAT, subSizeMessage, percent); }
[ "private", "String", "getFormattedValues", "(", "boolean", "readable", ",", "long", "size", ",", "long", "totalSize", ")", "{", "// If size is 1, total size is 5, and readable is true, it will", "// return a string as \"1B (20%)\"", "int", "percent", "=", "totalSize", "==", "0", "?", "0", ":", "(", "int", ")", "(", "size", "*", "100", "/", "totalSize", ")", ";", "String", "subSizeMessage", "=", "readable", "?", "FormatUtils", ".", "getSizeFromBytes", "(", "size", ")", ":", "String", ".", "valueOf", "(", "size", ")", ";", "return", "String", ".", "format", "(", "VALUE_AND_PERCENT_FORMAT", ",", "subSizeMessage", ",", "percent", ")", ";", "}" ]
Gets the size and its percentage information, if readable option is provided, get the size in human readable format. @param readable whether to print info of human readable format @param size the size to get information from @param totalSize the total size to calculate percentage information @return the formatted value and percentage information
[ "Gets", "the", "size", "and", "its", "percentage", "information", "if", "readable", "option", "is", "provided", "get", "the", "size", "in", "human", "readable", "format", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/command/DuCommand.java#L156-L163
jfinal/jfinal
src/main/java/com/jfinal/plugin/activerecord/Model.java
Model.findByIdLoadColumns
public M findByIdLoadColumns(Object idValue, String columns) { """ Find model by id and load specific columns only. <pre> Example: User user = User.dao.findByIdLoadColumns(123, "name, age"); </pre> @param idValue the id value of the model @param columns the specific columns to load """ return findByIdLoadColumns(new Object[]{idValue}, columns); }
java
public M findByIdLoadColumns(Object idValue, String columns) { return findByIdLoadColumns(new Object[]{idValue}, columns); }
[ "public", "M", "findByIdLoadColumns", "(", "Object", "idValue", ",", "String", "columns", ")", "{", "return", "findByIdLoadColumns", "(", "new", "Object", "[", "]", "{", "idValue", "}", ",", "columns", ")", ";", "}" ]
Find model by id and load specific columns only. <pre> Example: User user = User.dao.findByIdLoadColumns(123, "name, age"); </pre> @param idValue the id value of the model @param columns the specific columns to load
[ "Find", "model", "by", "id", "and", "load", "specific", "columns", "only", ".", "<pre", ">", "Example", ":", "User", "user", "=", "User", ".", "dao", ".", "findByIdLoadColumns", "(", "123", "name", "age", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L771-L773
elki-project/elki
elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/invertedlist/InMemoryInvertedIndex.java
InMemoryInvertedIndex.naiveQueryDense
private double naiveQueryDense(NumberVector obj, WritableDoubleDataStore scores, HashSetModifiableDBIDs cands) { """ Query the most similar objects, dense version. @param obj Query object @param scores Score storage @param cands Non-zero objects set @return Result """ double len = 0.; // Length of query object, for final normalization for(int dim = 0, max = obj.getDimensionality(); dim < max; dim++) { final double val = obj.doubleValue(dim); if(val == 0. || val != val) { continue; } len += val * val; // No matching documents in index: if(dim >= index.size()) { continue; } ModifiableDoubleDBIDList column = index.get(dim); for(DoubleDBIDListIter n = column.iter(); n.valid(); n.advance()) { scores.increment(n, n.doubleValue() * val); cands.add(n); } } return FastMath.sqrt(len); }
java
private double naiveQueryDense(NumberVector obj, WritableDoubleDataStore scores, HashSetModifiableDBIDs cands) { double len = 0.; // Length of query object, for final normalization for(int dim = 0, max = obj.getDimensionality(); dim < max; dim++) { final double val = obj.doubleValue(dim); if(val == 0. || val != val) { continue; } len += val * val; // No matching documents in index: if(dim >= index.size()) { continue; } ModifiableDoubleDBIDList column = index.get(dim); for(DoubleDBIDListIter n = column.iter(); n.valid(); n.advance()) { scores.increment(n, n.doubleValue() * val); cands.add(n); } } return FastMath.sqrt(len); }
[ "private", "double", "naiveQueryDense", "(", "NumberVector", "obj", ",", "WritableDoubleDataStore", "scores", ",", "HashSetModifiableDBIDs", "cands", ")", "{", "double", "len", "=", "0.", ";", "// Length of query object, for final normalization", "for", "(", "int", "dim", "=", "0", ",", "max", "=", "obj", ".", "getDimensionality", "(", ")", ";", "dim", "<", "max", ";", "dim", "++", ")", "{", "final", "double", "val", "=", "obj", ".", "doubleValue", "(", "dim", ")", ";", "if", "(", "val", "==", "0.", "||", "val", "!=", "val", ")", "{", "continue", ";", "}", "len", "+=", "val", "*", "val", ";", "// No matching documents in index:", "if", "(", "dim", ">=", "index", ".", "size", "(", ")", ")", "{", "continue", ";", "}", "ModifiableDoubleDBIDList", "column", "=", "index", ".", "get", "(", "dim", ")", ";", "for", "(", "DoubleDBIDListIter", "n", "=", "column", ".", "iter", "(", ")", ";", "n", ".", "valid", "(", ")", ";", "n", ".", "advance", "(", ")", ")", "{", "scores", ".", "increment", "(", "n", ",", "n", ".", "doubleValue", "(", ")", "*", "val", ")", ";", "cands", ".", "add", "(", "n", ")", ";", "}", "}", "return", "FastMath", ".", "sqrt", "(", "len", ")", ";", "}" ]
Query the most similar objects, dense version. @param obj Query object @param scores Score storage @param cands Non-zero objects set @return Result
[ "Query", "the", "most", "similar", "objects", "dense", "version", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-various/src/main/java/de/lmu/ifi/dbs/elki/index/invertedlist/InMemoryInvertedIndex.java#L210-L229
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AuditResources.java
AuditResources.findByEntityId
@GET @Path("/entity/ { """ Returns the audit record for the given id. @param entityid The entity Id. Cannot be null. @param limit max no of records @return The audit object. @throws WebApplicationException Throws the exception for invalid input data. """entityid}") @Description("Returns the audit trail for an entity.") @Produces(MediaType.APPLICATION_JSON) public List<AuditDto> findByEntityId(@PathParam("entityid") BigInteger entityid, @QueryParam("limit") BigInteger limit) { if (entityid == null || entityid.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Entity ID cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (limit != null && limit.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Limit must be a positive non-zero number.", Status.BAD_REQUEST); } List<Audit> auditList = limit == null ? _auditService.findByEntity(entityid) : _auditService.findByEntity(entityid, limit); if (auditList != null && auditList.size() > 0) { return AuditDto.transformToDto(auditList); } else { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } }
java
@GET @Path("/entity/{entityid}") @Description("Returns the audit trail for an entity.") @Produces(MediaType.APPLICATION_JSON) public List<AuditDto> findByEntityId(@PathParam("entityid") BigInteger entityid, @QueryParam("limit") BigInteger limit) { if (entityid == null || entityid.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Entity ID cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (limit != null && limit.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Limit must be a positive non-zero number.", Status.BAD_REQUEST); } List<Audit> auditList = limit == null ? _auditService.findByEntity(entityid) : _auditService.findByEntity(entityid, limit); if (auditList != null && auditList.size() > 0) { return AuditDto.transformToDto(auditList); } else { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } }
[ "@", "GET", "@", "Path", "(", "\"/entity/{entityid}\"", ")", "@", "Description", "(", "\"Returns the audit trail for an entity.\"", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "public", "List", "<", "AuditDto", ">", "findByEntityId", "(", "@", "PathParam", "(", "\"entityid\"", ")", "BigInteger", "entityid", ",", "@", "QueryParam", "(", "\"limit\"", ")", "BigInteger", "limit", ")", "{", "if", "(", "entityid", "==", "null", "||", "entityid", ".", "compareTo", "(", "BigInteger", ".", "ZERO", ")", "<", "1", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Entity ID cannot be null and must be a positive non-zero number.\"", ",", "Status", ".", "BAD_REQUEST", ")", ";", "}", "if", "(", "limit", "!=", "null", "&&", "limit", ".", "compareTo", "(", "BigInteger", ".", "ZERO", ")", "<", "1", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Limit must be a positive non-zero number.\"", ",", "Status", ".", "BAD_REQUEST", ")", ";", "}", "List", "<", "Audit", ">", "auditList", "=", "limit", "==", "null", "?", "_auditService", ".", "findByEntity", "(", "entityid", ")", ":", "_auditService", ".", "findByEntity", "(", "entityid", ",", "limit", ")", ";", "if", "(", "auditList", "!=", "null", "&&", "auditList", ".", "size", "(", ")", ">", "0", ")", "{", "return", "AuditDto", ".", "transformToDto", "(", "auditList", ")", ";", "}", "else", "{", "throw", "new", "WebApplicationException", "(", "Response", ".", "Status", ".", "NOT_FOUND", ".", "getReasonPhrase", "(", ")", ",", "Response", ".", "Status", ".", "NOT_FOUND", ")", ";", "}", "}" ]
Returns the audit record for the given id. @param entityid The entity Id. Cannot be null. @param limit max no of records @return The audit object. @throws WebApplicationException Throws the exception for invalid input data.
[ "Returns", "the", "audit", "record", "for", "the", "given", "id", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AuditResources.java#L75-L95
algolia/instantsearch-android
ui/src/main/java/com/algolia/instantsearch/ui/databinding/BindingHelper.java
BindingHelper.setVariantForView
@Nullable public static String setVariantForView(@NonNull View view, @NonNull AttributeSet attrs) { """ Associates programmatically a view with its variant, taking it from its `variant` layout attribute. @param view any existing view. @param attrs the view's AttributeSet. @return the previous variant for this view, if any. """ String previousVariant; final TypedArray styledAttributes = view.getContext().getTheme() .obtainStyledAttributes(attrs, R.styleable.View, 0, 0); try { previousVariant = setVariantForView(view, styledAttributes .getString(R.styleable.View_variant)); } finally { styledAttributes.recycle(); } return previousVariant; }
java
@Nullable public static String setVariantForView(@NonNull View view, @NonNull AttributeSet attrs) { String previousVariant; final TypedArray styledAttributes = view.getContext().getTheme() .obtainStyledAttributes(attrs, R.styleable.View, 0, 0); try { previousVariant = setVariantForView(view, styledAttributes .getString(R.styleable.View_variant)); } finally { styledAttributes.recycle(); } return previousVariant; }
[ "@", "Nullable", "public", "static", "String", "setVariantForView", "(", "@", "NonNull", "View", "view", ",", "@", "NonNull", "AttributeSet", "attrs", ")", "{", "String", "previousVariant", ";", "final", "TypedArray", "styledAttributes", "=", "view", ".", "getContext", "(", ")", ".", "getTheme", "(", ")", ".", "obtainStyledAttributes", "(", "attrs", ",", "R", ".", "styleable", ".", "View", ",", "0", ",", "0", ")", ";", "try", "{", "previousVariant", "=", "setVariantForView", "(", "view", ",", "styledAttributes", ".", "getString", "(", "R", ".", "styleable", ".", "View_variant", ")", ")", ";", "}", "finally", "{", "styledAttributes", ".", "recycle", "(", ")", ";", "}", "return", "previousVariant", ";", "}" ]
Associates programmatically a view with its variant, taking it from its `variant` layout attribute. @param view any existing view. @param attrs the view's AttributeSet. @return the previous variant for this view, if any.
[ "Associates", "programmatically", "a", "view", "with", "its", "variant", "taking", "it", "from", "its", "variant", "layout", "attribute", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/databinding/BindingHelper.java#L98-L111
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/helper/AuthenticateUserHelper.java
AuthenticateUserHelper.validateInput
private void validateInput(AuthenticationService authenticationService, String username) throws AuthenticationException { """ Validate that the input parameters are not null. @param authenticationService the service to authenticate a user @param username the user to authenticate @throws AuthenticationException when either input is null """ if (authenticationService == null) { throw new AuthenticationException("authenticationService cannot be null."); } else if (username == null) { throw new AuthenticationException("username cannot be null."); } }
java
private void validateInput(AuthenticationService authenticationService, String username) throws AuthenticationException { if (authenticationService == null) { throw new AuthenticationException("authenticationService cannot be null."); } else if (username == null) { throw new AuthenticationException("username cannot be null."); } }
[ "private", "void", "validateInput", "(", "AuthenticationService", "authenticationService", ",", "String", "username", ")", "throws", "AuthenticationException", "{", "if", "(", "authenticationService", "==", "null", ")", "{", "throw", "new", "AuthenticationException", "(", "\"authenticationService cannot be null.\"", ")", ";", "}", "else", "if", "(", "username", "==", "null", ")", "{", "throw", "new", "AuthenticationException", "(", "\"username cannot be null.\"", ")", ";", "}", "}" ]
Validate that the input parameters are not null. @param authenticationService the service to authenticate a user @param username the user to authenticate @throws AuthenticationException when either input is null
[ "Validate", "that", "the", "input", "parameters", "are", "not", "null", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.builtin/src/com/ibm/ws/security/authentication/helper/AuthenticateUserHelper.java#L94-L100
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.writeJpg
public static void writeJpg(Image image, ImageOutputStream destImageStream) throws IORuntimeException { """ 写出图像为JPG格式 @param image {@link Image} @param destImageStream 写出到的目标流 @throws IORuntimeException IO异常 """ write(image, IMAGE_TYPE_JPG, destImageStream); }
java
public static void writeJpg(Image image, ImageOutputStream destImageStream) throws IORuntimeException { write(image, IMAGE_TYPE_JPG, destImageStream); }
[ "public", "static", "void", "writeJpg", "(", "Image", "image", ",", "ImageOutputStream", "destImageStream", ")", "throws", "IORuntimeException", "{", "write", "(", "image", ",", "IMAGE_TYPE_JPG", ",", "destImageStream", ")", ";", "}" ]
写出图像为JPG格式 @param image {@link Image} @param destImageStream 写出到的目标流 @throws IORuntimeException IO异常
[ "写出图像为JPG格式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1354-L1356
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsDefaultPageEditor.java
CmsDefaultPageEditor.buildSelectFonts
public String buildSelectFonts(String attributes) { """ Builds the html for the font face select box of a WYSIWYG editor.<p> @param attributes optional attributes for the &lt;select&gt; tag @return the html for the font face select box """ List<String> names = new ArrayList<String>(); for (int i = 0; i < CmsDefaultPageEditor.SELECTBOX_FONTS.length; i++) { String value = CmsDefaultPageEditor.SELECTBOX_FONTS[i]; names.add(value); } return buildSelect(attributes, names, names, -1, false); }
java
public String buildSelectFonts(String attributes) { List<String> names = new ArrayList<String>(); for (int i = 0; i < CmsDefaultPageEditor.SELECTBOX_FONTS.length; i++) { String value = CmsDefaultPageEditor.SELECTBOX_FONTS[i]; names.add(value); } return buildSelect(attributes, names, names, -1, false); }
[ "public", "String", "buildSelectFonts", "(", "String", "attributes", ")", "{", "List", "<", "String", ">", "names", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "CmsDefaultPageEditor", ".", "SELECTBOX_FONTS", ".", "length", ";", "i", "++", ")", "{", "String", "value", "=", "CmsDefaultPageEditor", ".", "SELECTBOX_FONTS", "[", "i", "]", ";", "names", ".", "add", "(", "value", ")", ";", "}", "return", "buildSelect", "(", "attributes", ",", "names", ",", "names", ",", "-", "1", ",", "false", ")", ";", "}" ]
Builds the html for the font face select box of a WYSIWYG editor.<p> @param attributes optional attributes for the &lt;select&gt; tag @return the html for the font face select box
[ "Builds", "the", "html", "for", "the", "font", "face", "select", "box", "of", "a", "WYSIWYG", "editor", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsDefaultPageEditor.java#L367-L375
zaproxy/zaproxy
src/org/parosproxy/paros/view/AbstractParamContainerPanel.java
AbstractParamContainerPanel.showParamPanel
public void showParamPanel(AbstractParamPanel panel, String name) { """ Shows the panel with the given name. <p> The previously shown panel (if any) is notified that it will be hidden. @param panel the panel that will be notified that is now shown, must not be {@code null}. @param name the name of the panel that will be shown, must not be {@code null}. @see AbstractParamPanel#onHide() @see AbstractParamPanel#onShow() """ if (currentShownPanel == panel) { return; } // ZAP: Notify previously shown panel that it was hidden if (currentShownPanel != null) { currentShownPanel.onHide(); } nameLastSelectedPanel = name; currentShownPanel = panel; TreePath nodePath = new TreePath(getTreeNodeFromPanelName(name).getPath()); getTreeParam().setSelectionPath(nodePath); ensureNodeVisible(nodePath); getPanelHeadline(); getTxtHeadline().setText(name); getHelpButton().setVisible(panel.getHelpIndex() != null); getShowHelpAction().setHelpIndex(panel.getHelpIndex()); CardLayout card = (CardLayout) getPanelParam().getLayout(); card.show(getPanelParam(), name); // ZAP: Notify the new panel that it is now shown panel.onShow(); }
java
public void showParamPanel(AbstractParamPanel panel, String name) { if (currentShownPanel == panel) { return; } // ZAP: Notify previously shown panel that it was hidden if (currentShownPanel != null) { currentShownPanel.onHide(); } nameLastSelectedPanel = name; currentShownPanel = panel; TreePath nodePath = new TreePath(getTreeNodeFromPanelName(name).getPath()); getTreeParam().setSelectionPath(nodePath); ensureNodeVisible(nodePath); getPanelHeadline(); getTxtHeadline().setText(name); getHelpButton().setVisible(panel.getHelpIndex() != null); getShowHelpAction().setHelpIndex(panel.getHelpIndex()); CardLayout card = (CardLayout) getPanelParam().getLayout(); card.show(getPanelParam(), name); // ZAP: Notify the new panel that it is now shown panel.onShow(); }
[ "public", "void", "showParamPanel", "(", "AbstractParamPanel", "panel", ",", "String", "name", ")", "{", "if", "(", "currentShownPanel", "==", "panel", ")", "{", "return", ";", "}", "// ZAP: Notify previously shown panel that it was hidden\r", "if", "(", "currentShownPanel", "!=", "null", ")", "{", "currentShownPanel", ".", "onHide", "(", ")", ";", "}", "nameLastSelectedPanel", "=", "name", ";", "currentShownPanel", "=", "panel", ";", "TreePath", "nodePath", "=", "new", "TreePath", "(", "getTreeNodeFromPanelName", "(", "name", ")", ".", "getPath", "(", ")", ")", ";", "getTreeParam", "(", ")", ".", "setSelectionPath", "(", "nodePath", ")", ";", "ensureNodeVisible", "(", "nodePath", ")", ";", "getPanelHeadline", "(", ")", ";", "getTxtHeadline", "(", ")", ".", "setText", "(", "name", ")", ";", "getHelpButton", "(", ")", ".", "setVisible", "(", "panel", ".", "getHelpIndex", "(", ")", "!=", "null", ")", ";", "getShowHelpAction", "(", ")", ".", "setHelpIndex", "(", "panel", ".", "getHelpIndex", "(", ")", ")", ";", "CardLayout", "card", "=", "(", "CardLayout", ")", "getPanelParam", "(", ")", ".", "getLayout", "(", ")", ";", "card", ".", "show", "(", "getPanelParam", "(", ")", ",", "name", ")", ";", "// ZAP: Notify the new panel that it is now shown\r", "panel", ".", "onShow", "(", ")", ";", "}" ]
Shows the panel with the given name. <p> The previously shown panel (if any) is notified that it will be hidden. @param panel the panel that will be notified that is now shown, must not be {@code null}. @param name the name of the panel that will be shown, must not be {@code null}. @see AbstractParamPanel#onHide() @see AbstractParamPanel#onShow()
[ "Shows", "the", "panel", "with", "the", "given", "name", ".", "<p", ">", "The", "previously", "shown", "panel", "(", "if", "any", ")", "is", "notified", "that", "it", "will", "be", "hidden", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/AbstractParamContainerPanel.java#L494-L520
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetColumnResourcesImpl.java
SheetColumnResourcesImpl.updateColumn
public Column updateColumn(long sheetId, Column column) throws SmartsheetException { """ Update a column. It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/columns/{columnId} Exceptions: IllegalArgumentException : if any argument is null InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param sheetId the sheetId @param column the column to update limited to the following attributes: index (column's new index in the sheet), title, sheetId, type, options (optional), symbol (optional), systemColumnType (optional), autoNumberFormat (optional) @return the updated sheet (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception """ Util.throwIfNull(column); return this.updateResource("sheets/" + sheetId + "/columns/" + column.getId(), Column.class, column); }
java
public Column updateColumn(long sheetId, Column column) throws SmartsheetException { Util.throwIfNull(column); return this.updateResource("sheets/" + sheetId + "/columns/" + column.getId(), Column.class, column); }
[ "public", "Column", "updateColumn", "(", "long", "sheetId", ",", "Column", "column", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "column", ")", ";", "return", "this", ".", "updateResource", "(", "\"sheets/\"", "+", "sheetId", "+", "\"/columns/\"", "+", "column", ".", "getId", "(", ")", ",", "Column", ".", "class", ",", "column", ")", ";", "}" ]
Update a column. It mirrors to the following Smartsheet REST API method: PUT /sheets/{sheetId}/columns/{columnId} Exceptions: IllegalArgumentException : if any argument is null InvalidRequestException : if there is any problem with the REST API request AuthorizationException : if there is any problem with the REST API authorization(access token) ResourceNotFoundException : if the resource can not be found ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) SmartsheetRestException : if there is any other REST API related error occurred during the operation SmartsheetException : if there is any other error occurred during the operation @param sheetId the sheetId @param column the column to update limited to the following attributes: index (column's new index in the sheet), title, sheetId, type, options (optional), symbol (optional), systemColumnType (optional), autoNumberFormat (optional) @return the updated sheet (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Update", "a", "column", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetColumnResourcesImpl.java#L152-L155
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/parser/RtfParser.java
RtfParser.convertRtfDocument
public void convertRtfDocument(InputStream readerIn, Document doc) throws IOException { """ Converts an RTF document to an iText document. Usage: Create a parser object and call this method with the input stream and the iText Document object @param readerIn The Reader to read the RTF file from. @param doc The iText document that the RTF file is to be added to. @throws IOException On I/O errors. @since 2.1.3 """ if(readerIn == null || doc == null) return; this.init(TYPE_CONVERT, null, readerIn, doc, null); this.setCurrentDestination(RtfDestinationMgr.DESTINATION_DOCUMENT); this.groupLevel = 0; this.tokenise(); }
java
public void convertRtfDocument(InputStream readerIn, Document doc) throws IOException { if(readerIn == null || doc == null) return; this.init(TYPE_CONVERT, null, readerIn, doc, null); this.setCurrentDestination(RtfDestinationMgr.DESTINATION_DOCUMENT); this.groupLevel = 0; this.tokenise(); }
[ "public", "void", "convertRtfDocument", "(", "InputStream", "readerIn", ",", "Document", "doc", ")", "throws", "IOException", "{", "if", "(", "readerIn", "==", "null", "||", "doc", "==", "null", ")", "return", ";", "this", ".", "init", "(", "TYPE_CONVERT", ",", "null", ",", "readerIn", ",", "doc", ",", "null", ")", ";", "this", ".", "setCurrentDestination", "(", "RtfDestinationMgr", ".", "DESTINATION_DOCUMENT", ")", ";", "this", ".", "groupLevel", "=", "0", ";", "this", ".", "tokenise", "(", ")", ";", "}" ]
Converts an RTF document to an iText document. Usage: Create a parser object and call this method with the input stream and the iText Document object @param readerIn The Reader to read the RTF file from. @param doc The iText document that the RTF file is to be added to. @throws IOException On I/O errors. @since 2.1.3
[ "Converts", "an", "RTF", "document", "to", "an", "iText", "document", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/parser/RtfParser.java#L538-L544
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java
ImageMath.bilinearInterpolate
public static int bilinearInterpolate(float x, float y, int nw, int ne, int sw, int se) { """ Bilinear interpolation of ARGB values. @param x the X interpolation parameter 0..1 @param y the y interpolation parameter 0..1 @param rgb array of four ARGB values in the order NW, NE, SW, SE @return the interpolated value """ float m0, m1; int a0 = (nw >> 24) & 0xff; int r0 = (nw >> 16) & 0xff; int g0 = (nw >> 8) & 0xff; int b0 = nw & 0xff; int a1 = (ne >> 24) & 0xff; int r1 = (ne >> 16) & 0xff; int g1 = (ne >> 8) & 0xff; int b1 = ne & 0xff; int a2 = (sw >> 24) & 0xff; int r2 = (sw >> 16) & 0xff; int g2 = (sw >> 8) & 0xff; int b2 = sw & 0xff; int a3 = (se >> 24) & 0xff; int r3 = (se >> 16) & 0xff; int g3 = (se >> 8) & 0xff; int b3 = se & 0xff; float cx = 1.0f-x; float cy = 1.0f-y; m0 = cx * a0 + x * a1; m1 = cx * a2 + x * a3; int a = (int)(cy * m0 + y * m1); m0 = cx * r0 + x * r1; m1 = cx * r2 + x * r3; int r = (int)(cy * m0 + y * m1); m0 = cx * g0 + x * g1; m1 = cx * g2 + x * g3; int g = (int)(cy * m0 + y * m1); m0 = cx * b0 + x * b1; m1 = cx * b2 + x * b3; int b = (int)(cy * m0 + y * m1); return (a << 24) | (r << 16) | (g << 8) | b; }
java
public static int bilinearInterpolate(float x, float y, int nw, int ne, int sw, int se) { float m0, m1; int a0 = (nw >> 24) & 0xff; int r0 = (nw >> 16) & 0xff; int g0 = (nw >> 8) & 0xff; int b0 = nw & 0xff; int a1 = (ne >> 24) & 0xff; int r1 = (ne >> 16) & 0xff; int g1 = (ne >> 8) & 0xff; int b1 = ne & 0xff; int a2 = (sw >> 24) & 0xff; int r2 = (sw >> 16) & 0xff; int g2 = (sw >> 8) & 0xff; int b2 = sw & 0xff; int a3 = (se >> 24) & 0xff; int r3 = (se >> 16) & 0xff; int g3 = (se >> 8) & 0xff; int b3 = se & 0xff; float cx = 1.0f-x; float cy = 1.0f-y; m0 = cx * a0 + x * a1; m1 = cx * a2 + x * a3; int a = (int)(cy * m0 + y * m1); m0 = cx * r0 + x * r1; m1 = cx * r2 + x * r3; int r = (int)(cy * m0 + y * m1); m0 = cx * g0 + x * g1; m1 = cx * g2 + x * g3; int g = (int)(cy * m0 + y * m1); m0 = cx * b0 + x * b1; m1 = cx * b2 + x * b3; int b = (int)(cy * m0 + y * m1); return (a << 24) | (r << 16) | (g << 8) | b; }
[ "public", "static", "int", "bilinearInterpolate", "(", "float", "x", ",", "float", "y", ",", "int", "nw", ",", "int", "ne", ",", "int", "sw", ",", "int", "se", ")", "{", "float", "m0", ",", "m1", ";", "int", "a0", "=", "(", "nw", ">>", "24", ")", "&", "0xff", ";", "int", "r0", "=", "(", "nw", ">>", "16", ")", "&", "0xff", ";", "int", "g0", "=", "(", "nw", ">>", "8", ")", "&", "0xff", ";", "int", "b0", "=", "nw", "&", "0xff", ";", "int", "a1", "=", "(", "ne", ">>", "24", ")", "&", "0xff", ";", "int", "r1", "=", "(", "ne", ">>", "16", ")", "&", "0xff", ";", "int", "g1", "=", "(", "ne", ">>", "8", ")", "&", "0xff", ";", "int", "b1", "=", "ne", "&", "0xff", ";", "int", "a2", "=", "(", "sw", ">>", "24", ")", "&", "0xff", ";", "int", "r2", "=", "(", "sw", ">>", "16", ")", "&", "0xff", ";", "int", "g2", "=", "(", "sw", ">>", "8", ")", "&", "0xff", ";", "int", "b2", "=", "sw", "&", "0xff", ";", "int", "a3", "=", "(", "se", ">>", "24", ")", "&", "0xff", ";", "int", "r3", "=", "(", "se", ">>", "16", ")", "&", "0xff", ";", "int", "g3", "=", "(", "se", ">>", "8", ")", "&", "0xff", ";", "int", "b3", "=", "se", "&", "0xff", ";", "float", "cx", "=", "1.0f", "-", "x", ";", "float", "cy", "=", "1.0f", "-", "y", ";", "m0", "=", "cx", "*", "a0", "+", "x", "*", "a1", ";", "m1", "=", "cx", "*", "a2", "+", "x", "*", "a3", ";", "int", "a", "=", "(", "int", ")", "(", "cy", "*", "m0", "+", "y", "*", "m1", ")", ";", "m0", "=", "cx", "*", "r0", "+", "x", "*", "r1", ";", "m1", "=", "cx", "*", "r2", "+", "x", "*", "r3", ";", "int", "r", "=", "(", "int", ")", "(", "cy", "*", "m0", "+", "y", "*", "m1", ")", ";", "m0", "=", "cx", "*", "g0", "+", "x", "*", "g1", ";", "m1", "=", "cx", "*", "g2", "+", "x", "*", "g3", ";", "int", "g", "=", "(", "int", ")", "(", "cy", "*", "m0", "+", "y", "*", "m1", ")", ";", "m0", "=", "cx", "*", "b0", "+", "x", "*", "b1", ";", "m1", "=", "cx", "*", "b2", "+", "x", "*", "b3", ";", "int", "b", "=", "(", "int", ")", "(", "cy", "*", "m0", "+", "y", "*", "m1", ")", ";", "return", "(", "a", "<<", "24", ")", "|", "(", "r", "<<", "16", ")", "|", "(", "g", "<<", "8", ")", "|", "b", ";", "}" ]
Bilinear interpolation of ARGB values. @param x the X interpolation parameter 0..1 @param y the y interpolation parameter 0..1 @param rgb array of four ARGB values in the order NW, NE, SW, SE @return the interpolated value
[ "Bilinear", "interpolation", "of", "ARGB", "values", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L289-L328
zerodhatech/javakiteconnect
kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java
KiteConnect.placeMFSIP
public MFSIP placeMFSIP(String tradingsymbol, String frequency, int installmentDay, int instalments, int initialAmount, double amount) throws KiteException, IOException, JSONException { """ Place a mutualfunds sip. @param tradingsymbol Tradingsymbol (ISIN) of the fund. @param frequency weekly, monthly, or quarterly. @param amount Amount worth of units to purchase. It should be equal to or greated than minimum_additional_purchase_amount and in multiple of purchase_amount_multiplier in the instrument master. @param installmentDay If Frequency is monthly, the day of the month (1, 5, 10, 15, 20, 25) to trigger the order on. @param instalments Number of instalments to trigger. If set to -1, instalments are triggered at fixed intervals until the SIP is cancelled. @param initialAmount Amount worth of units to purchase before the SIP starts. Should be equal to or greater than minimum_purchase_amount and in multiple of purchase_amount_multiplier. This is only considered if there have been no prior investments in the target fund. @return MFSIP object which contains sip id and order id. @throws KiteException is thrown for all Kite trade related errors. @throws IOException is thrown when there is connection related error. """ Map<String, Object> params = new HashMap<String, Object>(); params.put("tradingsymbol", tradingsymbol); params.put("frequency", frequency); params.put("instalment_day", installmentDay); params.put("instalments", instalments); params.put("initial_amount", initialAmount); params.put("amount", amount); MFSIP MFSIP = new MFSIP(); JSONObject response = new KiteRequestHandler(proxy).postRequest(routes.get("mutualfunds.sips.place"),params, apiKey, accessToken); MFSIP.orderId = response.getJSONObject("data").getString("order_id"); MFSIP.sipId = response.getJSONObject("data").getString("sip_id"); return MFSIP; }
java
public MFSIP placeMFSIP(String tradingsymbol, String frequency, int installmentDay, int instalments, int initialAmount, double amount) throws KiteException, IOException, JSONException { Map<String, Object> params = new HashMap<String, Object>(); params.put("tradingsymbol", tradingsymbol); params.put("frequency", frequency); params.put("instalment_day", installmentDay); params.put("instalments", instalments); params.put("initial_amount", initialAmount); params.put("amount", amount); MFSIP MFSIP = new MFSIP(); JSONObject response = new KiteRequestHandler(proxy).postRequest(routes.get("mutualfunds.sips.place"),params, apiKey, accessToken); MFSIP.orderId = response.getJSONObject("data").getString("order_id"); MFSIP.sipId = response.getJSONObject("data").getString("sip_id"); return MFSIP; }
[ "public", "MFSIP", "placeMFSIP", "(", "String", "tradingsymbol", ",", "String", "frequency", ",", "int", "installmentDay", ",", "int", "instalments", ",", "int", "initialAmount", ",", "double", "amount", ")", "throws", "KiteException", ",", "IOException", ",", "JSONException", "{", "Map", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "\"tradingsymbol\"", ",", "tradingsymbol", ")", ";", "params", ".", "put", "(", "\"frequency\"", ",", "frequency", ")", ";", "params", ".", "put", "(", "\"instalment_day\"", ",", "installmentDay", ")", ";", "params", ".", "put", "(", "\"instalments\"", ",", "instalments", ")", ";", "params", ".", "put", "(", "\"initial_amount\"", ",", "initialAmount", ")", ";", "params", ".", "put", "(", "\"amount\"", ",", "amount", ")", ";", "MFSIP", "MFSIP", "=", "new", "MFSIP", "(", ")", ";", "JSONObject", "response", "=", "new", "KiteRequestHandler", "(", "proxy", ")", ".", "postRequest", "(", "routes", ".", "get", "(", "\"mutualfunds.sips.place\"", ")", ",", "params", ",", "apiKey", ",", "accessToken", ")", ";", "MFSIP", ".", "orderId", "=", "response", ".", "getJSONObject", "(", "\"data\"", ")", ".", "getString", "(", "\"order_id\"", ")", ";", "MFSIP", ".", "sipId", "=", "response", ".", "getJSONObject", "(", "\"data\"", ")", ".", "getString", "(", "\"sip_id\"", ")", ";", "return", "MFSIP", ";", "}" ]
Place a mutualfunds sip. @param tradingsymbol Tradingsymbol (ISIN) of the fund. @param frequency weekly, monthly, or quarterly. @param amount Amount worth of units to purchase. It should be equal to or greated than minimum_additional_purchase_amount and in multiple of purchase_amount_multiplier in the instrument master. @param installmentDay If Frequency is monthly, the day of the month (1, 5, 10, 15, 20, 25) to trigger the order on. @param instalments Number of instalments to trigger. If set to -1, instalments are triggered at fixed intervals until the SIP is cancelled. @param initialAmount Amount worth of units to purchase before the SIP starts. Should be equal to or greater than minimum_purchase_amount and in multiple of purchase_amount_multiplier. This is only considered if there have been no prior investments in the target fund. @return MFSIP object which contains sip id and order id. @throws KiteException is thrown for all Kite trade related errors. @throws IOException is thrown when there is connection related error.
[ "Place", "a", "mutualfunds", "sip", "." ]
train
https://github.com/zerodhatech/javakiteconnect/blob/4a3f15ff2c8a1b3b6ec61799f8bb047e4dfeb92d/kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java#L686-L700
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/objdetect/Yolo2OutputLayer.java
Yolo2OutputLayer.getConfidenceMatrix
public INDArray getConfidenceMatrix(INDArray networkOutput, int example, int bbNumber) { """ Get the confidence matrix (confidence for all x/y positions) for the specified bounding box, from the network output activations array @param networkOutput Network output activations @param example Example number, in minibatch @param bbNumber Bounding box number @return Confidence matrix """ //Input format: [minibatch, 5B+C, H, W], with order [x,y,w,h,c] //Therefore: confidences are at depths 4 + bbNumber * 5 INDArray conf = networkOutput.get(point(example), point(4+bbNumber*5), all(), all()); return conf; }
java
public INDArray getConfidenceMatrix(INDArray networkOutput, int example, int bbNumber){ //Input format: [minibatch, 5B+C, H, W], with order [x,y,w,h,c] //Therefore: confidences are at depths 4 + bbNumber * 5 INDArray conf = networkOutput.get(point(example), point(4+bbNumber*5), all(), all()); return conf; }
[ "public", "INDArray", "getConfidenceMatrix", "(", "INDArray", "networkOutput", ",", "int", "example", ",", "int", "bbNumber", ")", "{", "//Input format: [minibatch, 5B+C, H, W], with order [x,y,w,h,c]", "//Therefore: confidences are at depths 4 + bbNumber * 5", "INDArray", "conf", "=", "networkOutput", ".", "get", "(", "point", "(", "example", ")", ",", "point", "(", "4", "+", "bbNumber", "*", "5", ")", ",", "all", "(", ")", ",", "all", "(", ")", ")", ";", "return", "conf", ";", "}" ]
Get the confidence matrix (confidence for all x/y positions) for the specified bounding box, from the network output activations array @param networkOutput Network output activations @param example Example number, in minibatch @param bbNumber Bounding box number @return Confidence matrix
[ "Get", "the", "confidence", "matrix", "(", "confidence", "for", "all", "x", "/", "y", "positions", ")", "for", "the", "specified", "bounding", "box", "from", "the", "network", "output", "activations", "array" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/objdetect/Yolo2OutputLayer.java#L648-L655
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java
GerritQueryHandler.queryJson
public List<String> queryJson(String queryString) throws SshException, IOException { """ Runs the query and returns the result as a list of JSON formatted strings. This is the equivalent of calling queryJava(queryString, true, true, false, false). @param queryString the query. @return a List of JSON formatted strings. @throws SshException if there is an error in the SSH Connection. @throws IOException for some other IO problem. """ return queryJson(queryString, true, true, false, false); }
java
public List<String> queryJson(String queryString) throws SshException, IOException { return queryJson(queryString, true, true, false, false); }
[ "public", "List", "<", "String", ">", "queryJson", "(", "String", "queryString", ")", "throws", "SshException", ",", "IOException", "{", "return", "queryJson", "(", "queryString", ",", "true", ",", "true", ",", "false", ",", "false", ")", ";", "}" ]
Runs the query and returns the result as a list of JSON formatted strings. This is the equivalent of calling queryJava(queryString, true, true, false, false). @param queryString the query. @return a List of JSON formatted strings. @throws SshException if there is an error in the SSH Connection. @throws IOException for some other IO problem.
[ "Runs", "the", "query", "and", "returns", "the", "result", "as", "a", "list", "of", "JSON", "formatted", "strings", ".", "This", "is", "the", "equivalent", "of", "calling", "queryJava", "(", "queryString", "true", "true", "false", "false", ")", "." ]
train
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java#L271-L273
openengsb/openengsb
api/edb/src/main/java/org/openengsb/core/edb/api/EDBObject.java
EDBObject.getObject
@SuppressWarnings("unchecked") public <T> T getObject(String key, Class<T> clazz) { """ Returns the value of the EDBObjectEntry for the given key, casted as the given class. Returns null if there is no element for the given key, or the value for the given key is null. """ EDBObjectEntry entry = get(key); return entry == null ? null : (T) entry.getValue(); }
java
@SuppressWarnings("unchecked") public <T> T getObject(String key, Class<T> clazz) { EDBObjectEntry entry = get(key); return entry == null ? null : (T) entry.getValue(); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "getObject", "(", "String", "key", ",", "Class", "<", "T", ">", "clazz", ")", "{", "EDBObjectEntry", "entry", "=", "get", "(", "key", ")", ";", "return", "entry", "==", "null", "?", "null", ":", "(", "T", ")", "entry", ".", "getValue", "(", ")", ";", "}" ]
Returns the value of the EDBObjectEntry for the given key, casted as the given class. Returns null if there is no element for the given key, or the value for the given key is null.
[ "Returns", "the", "value", "of", "the", "EDBObjectEntry", "for", "the", "given", "key", "casted", "as", "the", "given", "class", ".", "Returns", "null", "if", "there", "is", "no", "element", "for", "the", "given", "key", "or", "the", "value", "for", "the", "given", "key", "is", "null", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/api/edb/src/main/java/org/openengsb/core/edb/api/EDBObject.java#L154-L158
mikepenz/MaterialDrawer
library/src/main/java/com/mikepenz/materialdrawer/Drawer.java
Drawer.updateName
public void updateName(long identifier, StringHolder name) { """ update the name for a specific drawerItem identified by its id @param identifier @param name """ IDrawerItem drawerItem = getDrawerItem(identifier); if (drawerItem instanceof Nameable) { Nameable pdi = (Nameable) drawerItem; pdi.withName(name); updateItem((IDrawerItem) pdi); } }
java
public void updateName(long identifier, StringHolder name) { IDrawerItem drawerItem = getDrawerItem(identifier); if (drawerItem instanceof Nameable) { Nameable pdi = (Nameable) drawerItem; pdi.withName(name); updateItem((IDrawerItem) pdi); } }
[ "public", "void", "updateName", "(", "long", "identifier", ",", "StringHolder", "name", ")", "{", "IDrawerItem", "drawerItem", "=", "getDrawerItem", "(", "identifier", ")", ";", "if", "(", "drawerItem", "instanceof", "Nameable", ")", "{", "Nameable", "pdi", "=", "(", "Nameable", ")", "drawerItem", ";", "pdi", ".", "withName", "(", "name", ")", ";", "updateItem", "(", "(", "IDrawerItem", ")", "pdi", ")", ";", "}", "}" ]
update the name for a specific drawerItem identified by its id @param identifier @param name
[ "update", "the", "name", "for", "a", "specific", "drawerItem", "identified", "by", "its", "id" ]
train
https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/Drawer.java#L681-L688
grpc/grpc-java
core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
ServiceConfigUtil.getTimeoutFromMethodConfig
@Nullable static Long getTimeoutFromMethodConfig(Map<String, ?> methodConfig) { """ Returns the number of nanoseconds of timeout for the given method config. @return duration nanoseconds, or {@code null} if it isn't present. """ if (!methodConfig.containsKey(METHOD_CONFIG_TIMEOUT_KEY)) { return null; } String rawTimeout = getString(methodConfig, METHOD_CONFIG_TIMEOUT_KEY); try { return parseDuration(rawTimeout); } catch (ParseException e) { throw new RuntimeException(e); } }
java
@Nullable static Long getTimeoutFromMethodConfig(Map<String, ?> methodConfig) { if (!methodConfig.containsKey(METHOD_CONFIG_TIMEOUT_KEY)) { return null; } String rawTimeout = getString(methodConfig, METHOD_CONFIG_TIMEOUT_KEY); try { return parseDuration(rawTimeout); } catch (ParseException e) { throw new RuntimeException(e); } }
[ "@", "Nullable", "static", "Long", "getTimeoutFromMethodConfig", "(", "Map", "<", "String", ",", "?", ">", "methodConfig", ")", "{", "if", "(", "!", "methodConfig", ".", "containsKey", "(", "METHOD_CONFIG_TIMEOUT_KEY", ")", ")", "{", "return", "null", ";", "}", "String", "rawTimeout", "=", "getString", "(", "methodConfig", ",", "METHOD_CONFIG_TIMEOUT_KEY", ")", ";", "try", "{", "return", "parseDuration", "(", "rawTimeout", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Returns the number of nanoseconds of timeout for the given method config. @return duration nanoseconds, or {@code null} if it isn't present.
[ "Returns", "the", "number", "of", "nanoseconds", "of", "timeout", "for", "the", "given", "method", "config", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L262-L273
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/MutableDictionary.java
MutableDictionary.setLong
@NonNull @Override public MutableDictionary setLong(@NonNull String key, long value) { """ Set a long value for the given key. @param key The key @param value The long value. @return The self object. """ return setValue(key, value); }
java
@NonNull @Override public MutableDictionary setLong(@NonNull String key, long value) { return setValue(key, value); }
[ "@", "NonNull", "@", "Override", "public", "MutableDictionary", "setLong", "(", "@", "NonNull", "String", "key", ",", "long", "value", ")", "{", "return", "setValue", "(", "key", ",", "value", ")", ";", "}" ]
Set a long value for the given key. @param key The key @param value The long value. @return The self object.
[ "Set", "a", "long", "value", "for", "the", "given", "key", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDictionary.java#L156-L160
spring-projects/spring-hateoas
src/main/java/org/springframework/hateoas/client/Hop.java
Hop.withParameter
public Hop withParameter(String name, Object value) { """ Add one parameter to the map of parameters. @param name must not be {@literal null} or empty. @param value can be {@literal null}. @return """ Assert.hasText(name, "Name must not be null or empty!"); HashMap<String, Object> parameters = new HashMap<>(this.parameters); parameters.put(name, value); return new Hop(this.rel, parameters, this.headers); }
java
public Hop withParameter(String name, Object value) { Assert.hasText(name, "Name must not be null or empty!"); HashMap<String, Object> parameters = new HashMap<>(this.parameters); parameters.put(name, value); return new Hop(this.rel, parameters, this.headers); }
[ "public", "Hop", "withParameter", "(", "String", "name", ",", "Object", "value", ")", "{", "Assert", ".", "hasText", "(", "name", ",", "\"Name must not be null or empty!\"", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<>", "(", "this", ".", "parameters", ")", ";", "parameters", ".", "put", "(", "name", ",", "value", ")", ";", "return", "new", "Hop", "(", "this", ".", "rel", ",", "parameters", ",", "this", ".", "headers", ")", ";", "}" ]
Add one parameter to the map of parameters. @param name must not be {@literal null} or empty. @param value can be {@literal null}. @return
[ "Add", "one", "parameter", "to", "the", "map", "of", "parameters", "." ]
train
https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/client/Hop.java#L79-L87
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.simpleSheet2Excel
public void simpleSheet2Excel(List<SimpleSheetWrapper> sheets, String targetPath) throws IOException { """ 无模板、无注解、多sheet数据 @param sheets 待导出sheet数据 @param targetPath 生成的Excel输出全路径 @throws IOException 异常 """ try (OutputStream fos = new FileOutputStream(targetPath); Workbook workbook = exportExcelBySimpleHandler(sheets, true)) { workbook.write(fos); } }
java
public void simpleSheet2Excel(List<SimpleSheetWrapper> sheets, String targetPath) throws IOException { try (OutputStream fos = new FileOutputStream(targetPath); Workbook workbook = exportExcelBySimpleHandler(sheets, true)) { workbook.write(fos); } }
[ "public", "void", "simpleSheet2Excel", "(", "List", "<", "SimpleSheetWrapper", ">", "sheets", ",", "String", "targetPath", ")", "throws", "IOException", "{", "try", "(", "OutputStream", "fos", "=", "new", "FileOutputStream", "(", "targetPath", ")", ";", "Workbook", "workbook", "=", "exportExcelBySimpleHandler", "(", "sheets", ",", "true", ")", ")", "{", "workbook", ".", "write", "(", "fos", ")", ";", "}", "}" ]
无模板、无注解、多sheet数据 @param sheets 待导出sheet数据 @param targetPath 生成的Excel输出全路径 @throws IOException 异常
[ "无模板、无注解、多sheet数据" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L1386-L1393
leancloud/java-sdk-all
realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java
AVIMConversation.updateMemberRole
public void updateMemberRole(final String memberId, final ConversationMemberRole role, final AVIMConversationCallback callback) { """ 更新成员的角色信息 @param memberId 成员的 client id @param role 角色 @param callback 结果回调函数 """ AVIMConversationMemberInfo info = new AVIMConversationMemberInfo(this.conversationId, memberId, role); Map<String, Object> params = new HashMap<String, Object>(); params.put(Conversation.PARAM_CONVERSATION_MEMBER_DETAILS, info.getUpdateAttrs()); boolean ret = InternalConfiguration.getOperationTube().processMembers(this.client.getClientId(), this.conversationId, getType(), JSON.toJSONString(params), Conversation.AVIMOperation.CONVERSATION_PROMOTE_MEMBER, callback); if (!ret && null != callback) { callback.internalDone(new AVException(AVException.OPERATION_FORBIDDEN, "couldn't start service in background.")); } }
java
public void updateMemberRole(final String memberId, final ConversationMemberRole role, final AVIMConversationCallback callback) { AVIMConversationMemberInfo info = new AVIMConversationMemberInfo(this.conversationId, memberId, role); Map<String, Object> params = new HashMap<String, Object>(); params.put(Conversation.PARAM_CONVERSATION_MEMBER_DETAILS, info.getUpdateAttrs()); boolean ret = InternalConfiguration.getOperationTube().processMembers(this.client.getClientId(), this.conversationId, getType(), JSON.toJSONString(params), Conversation.AVIMOperation.CONVERSATION_PROMOTE_MEMBER, callback); if (!ret && null != callback) { callback.internalDone(new AVException(AVException.OPERATION_FORBIDDEN, "couldn't start service in background.")); } }
[ "public", "void", "updateMemberRole", "(", "final", "String", "memberId", ",", "final", "ConversationMemberRole", "role", ",", "final", "AVIMConversationCallback", "callback", ")", "{", "AVIMConversationMemberInfo", "info", "=", "new", "AVIMConversationMemberInfo", "(", "this", ".", "conversationId", ",", "memberId", ",", "role", ")", ";", "Map", "<", "String", ",", "Object", ">", "params", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "params", ".", "put", "(", "Conversation", ".", "PARAM_CONVERSATION_MEMBER_DETAILS", ",", "info", ".", "getUpdateAttrs", "(", ")", ")", ";", "boolean", "ret", "=", "InternalConfiguration", ".", "getOperationTube", "(", ")", ".", "processMembers", "(", "this", ".", "client", ".", "getClientId", "(", ")", ",", "this", ".", "conversationId", ",", "getType", "(", ")", ",", "JSON", ".", "toJSONString", "(", "params", ")", ",", "Conversation", ".", "AVIMOperation", ".", "CONVERSATION_PROMOTE_MEMBER", ",", "callback", ")", ";", "if", "(", "!", "ret", "&&", "null", "!=", "callback", ")", "{", "callback", ".", "internalDone", "(", "new", "AVException", "(", "AVException", ".", "OPERATION_FORBIDDEN", ",", "\"couldn't start service in background.\"", ")", ")", ";", "}", "}" ]
更新成员的角色信息 @param memberId 成员的 client id @param role 角色 @param callback 结果回调函数
[ "更新成员的角色信息" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java#L1210-L1219
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.withReader
public static <T> T withReader(InputStream in, @ClosureParams(value=SimpleType.class, options="java.io.Reader") Closure<T> closure) throws IOException { """ Helper method to create a new Reader for a stream and then passes it into the closure. The reader (and this stream) is closed after the closure returns. @param in a stream @param closure the closure to invoke with the InputStream @return the value returned by the closure @throws IOException if an IOException occurs. @see java.io.InputStreamReader @since 1.5.2 """ return withReader(new InputStreamReader(in), closure); }
java
public static <T> T withReader(InputStream in, @ClosureParams(value=SimpleType.class, options="java.io.Reader") Closure<T> closure) throws IOException { return withReader(new InputStreamReader(in), closure); }
[ "public", "static", "<", "T", ">", "T", "withReader", "(", "InputStream", "in", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.Reader\"", ")", "Closure", "<", "T", ">", "closure", ")", "throws", "IOException", "{", "return", "withReader", "(", "new", "InputStreamReader", "(", "in", ")", ",", "closure", ")", ";", "}" ]
Helper method to create a new Reader for a stream and then passes it into the closure. The reader (and this stream) is closed after the closure returns. @param in a stream @param closure the closure to invoke with the InputStream @return the value returned by the closure @throws IOException if an IOException occurs. @see java.io.InputStreamReader @since 1.5.2
[ "Helper", "method", "to", "create", "a", "new", "Reader", "for", "a", "stream", "and", "then", "passes", "it", "into", "the", "closure", ".", "The", "reader", "(", "and", "this", "stream", ")", "is", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1209-L1211
scireum/server-sass
src/main/java/org/serversass/Functions.java
Functions.rgba
public static Expression rgba(Generator generator, FunctionCall input) { """ Creates a color from given RGB and alpha values. @param generator the surrounding generator @param input the function call to evaluate @return the result of the evaluation """ if (input.getParameters().size() == 4) { return new Color(input.getExpectedIntParam(0), input.getExpectedIntParam(1), input.getExpectedIntParam(2), input.getExpectedFloatParam(3)); } if (input.getParameters().size() == 2) { Color color = input.getExpectedColorParam(0); float newA = input.getExpectedFloatParam(1); return new Color(color.getR(), color.getG(), color.getB(), newA); } throw new IllegalArgumentException("rgba must be called with either 2 or 4 parameters. Function call: " + input); }
java
public static Expression rgba(Generator generator, FunctionCall input) { if (input.getParameters().size() == 4) { return new Color(input.getExpectedIntParam(0), input.getExpectedIntParam(1), input.getExpectedIntParam(2), input.getExpectedFloatParam(3)); } if (input.getParameters().size() == 2) { Color color = input.getExpectedColorParam(0); float newA = input.getExpectedFloatParam(1); return new Color(color.getR(), color.getG(), color.getB(), newA); } throw new IllegalArgumentException("rgba must be called with either 2 or 4 parameters. Function call: " + input); }
[ "public", "static", "Expression", "rgba", "(", "Generator", "generator", ",", "FunctionCall", "input", ")", "{", "if", "(", "input", ".", "getParameters", "(", ")", ".", "size", "(", ")", "==", "4", ")", "{", "return", "new", "Color", "(", "input", ".", "getExpectedIntParam", "(", "0", ")", ",", "input", ".", "getExpectedIntParam", "(", "1", ")", ",", "input", ".", "getExpectedIntParam", "(", "2", ")", ",", "input", ".", "getExpectedFloatParam", "(", "3", ")", ")", ";", "}", "if", "(", "input", ".", "getParameters", "(", ")", ".", "size", "(", ")", "==", "2", ")", "{", "Color", "color", "=", "input", ".", "getExpectedColorParam", "(", "0", ")", ";", "float", "newA", "=", "input", ".", "getExpectedFloatParam", "(", "1", ")", ";", "return", "new", "Color", "(", "color", ".", "getR", "(", ")", ",", "color", ".", "getG", "(", ")", ",", "color", ".", "getB", "(", ")", ",", "newA", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"rgba must be called with either 2 or 4 parameters. Function call: \"", "+", "input", ")", ";", "}" ]
Creates a color from given RGB and alpha values. @param generator the surrounding generator @param input the function call to evaluate @return the result of the evaluation
[ "Creates", "a", "color", "from", "given", "RGB", "and", "alpha", "values", "." ]
train
https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L55-L69
ineunetOS/knife-commons
knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java
StringUtils.endsWithAny
public static boolean endsWithAny(String string, String[] searchStrings) { """ <p>Check if a String ends with any of an array of specified strings.</p> <pre> StringUtils.endsWithAny(null, null) = false StringUtils.endsWithAny(null, new String[] {"abc"}) = false StringUtils.endsWithAny("abcxyz", null) = false StringUtils.endsWithAny("abcxyz", new String[] {""}) = true StringUtils.endsWithAny("abcxyz", new String[] {"xyz"}) = true StringUtils.endsWithAny("abcxyz", new String[] {null, "xyz", "abc"}) = true </pre> @param string the String to check, may be null @param searchStrings the Strings to find, may be null or empty @return <code>true</code> if the String ends with any of the the prefixes, case insensitive, or both <code>null</code> @since 2.6 """ if (isEmpty(string) || ArrayUtils.isEmpty(searchStrings)) { return false; } for (int i = 0; i < searchStrings.length; i++) { String searchString = searchStrings[i]; if (StringUtils.endsWith(string, searchString)) { return true; } } return false; }
java
public static boolean endsWithAny(String string, String[] searchStrings) { if (isEmpty(string) || ArrayUtils.isEmpty(searchStrings)) { return false; } for (int i = 0; i < searchStrings.length; i++) { String searchString = searchStrings[i]; if (StringUtils.endsWith(string, searchString)) { return true; } } return false; }
[ "public", "static", "boolean", "endsWithAny", "(", "String", "string", ",", "String", "[", "]", "searchStrings", ")", "{", "if", "(", "isEmpty", "(", "string", ")", "||", "ArrayUtils", ".", "isEmpty", "(", "searchStrings", ")", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "searchStrings", ".", "length", ";", "i", "++", ")", "{", "String", "searchString", "=", "searchStrings", "[", "i", "]", ";", "if", "(", "StringUtils", ".", "endsWith", "(", "string", ",", "searchString", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
<p>Check if a String ends with any of an array of specified strings.</p> <pre> StringUtils.endsWithAny(null, null) = false StringUtils.endsWithAny(null, new String[] {"abc"}) = false StringUtils.endsWithAny("abcxyz", null) = false StringUtils.endsWithAny("abcxyz", new String[] {""}) = true StringUtils.endsWithAny("abcxyz", new String[] {"xyz"}) = true StringUtils.endsWithAny("abcxyz", new String[] {null, "xyz", "abc"}) = true </pre> @param string the String to check, may be null @param searchStrings the Strings to find, may be null or empty @return <code>true</code> if the String ends with any of the the prefixes, case insensitive, or both <code>null</code> @since 2.6
[ "<p", ">", "Check", "if", "a", "String", "ends", "with", "any", "of", "an", "array", "of", "specified", "strings", ".", "<", "/", "p", ">" ]
train
https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java#L6442-L6453
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readStaticExportPublishedResourceParameters
public String readStaticExportPublishedResourceParameters(CmsRequestContext context, String rfsName) throws CmsException { """ Returns the parameters of a resource in the table of all published template resources.<p> @param context the current request context @param rfsName the rfs name of the resource @return the parameter string of the requested resource @throws CmsException if something goes wrong """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); String result = null; try { result = m_driverManager.readStaticExportPublishedResourceParameters(dbc, rfsName); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_READ_STATEXP_PUBLISHED_RESOURCE_PARAMS_1, rfsName), e); } finally { dbc.clear(); } return result; }
java
public String readStaticExportPublishedResourceParameters(CmsRequestContext context, String rfsName) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); String result = null; try { result = m_driverManager.readStaticExportPublishedResourceParameters(dbc, rfsName); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_READ_STATEXP_PUBLISHED_RESOURCE_PARAMS_1, rfsName), e); } finally { dbc.clear(); } return result; }
[ "public", "String", "readStaticExportPublishedResourceParameters", "(", "CmsRequestContext", "context", ",", "String", "rfsName", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "String", "result", "=", "null", ";", "try", "{", "result", "=", "m_driverManager", ".", "readStaticExportPublishedResourceParameters", "(", "dbc", ",", "rfsName", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_READ_STATEXP_PUBLISHED_RESOURCE_PARAMS_1", ",", "rfsName", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "return", "result", ";", "}" ]
Returns the parameters of a resource in the table of all published template resources.<p> @param context the current request context @param rfsName the rfs name of the resource @return the parameter string of the requested resource @throws CmsException if something goes wrong
[ "Returns", "the", "parameters", "of", "a", "resource", "in", "the", "table", "of", "all", "published", "template", "resources", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L5290-L5306
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Settings.java
Http2Settings.put
@Override public Long put(char key, Long value) { """ Adds the given setting key/value pair. For standard settings defined by the HTTP/2 spec, performs validation on the values. @throws IllegalArgumentException if verification for a standard HTTP/2 setting fails. """ verifyStandardSetting(key, value); return super.put(key, value); }
java
@Override public Long put(char key, Long value) { verifyStandardSetting(key, value); return super.put(key, value); }
[ "@", "Override", "public", "Long", "put", "(", "char", "key", ",", "Long", "value", ")", "{", "verifyStandardSetting", "(", "key", ",", "value", ")", ";", "return", "super", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Adds the given setting key/value pair. For standard settings defined by the HTTP/2 spec, performs validation on the values. @throws IllegalArgumentException if verification for a standard HTTP/2 setting fails.
[ "Adds", "the", "given", "setting", "key", "/", "value", "pair", ".", "For", "standard", "settings", "defined", "by", "the", "HTTP", "/", "2", "spec", "performs", "validation", "on", "the", "values", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Settings.java#L73-L77
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/AbstractCalendarAndExceptionFactory.java
AbstractCalendarAndExceptionFactory.processWorkWeekDay
private void processWorkWeekDay(byte[] data, int offset, ProjectCalendarWeek week, Day day) { """ Process an individual work week day. @param data calendar data @param offset current offset into data @param week parent week @param day current day """ //System.out.println(ByteArrayHelper.hexdump(data, offset, 60, false)); int dayType = MPPUtility.getShort(data, offset + 0); if (dayType == 1) { week.setWorkingDay(day, DayType.DEFAULT); } else { ProjectCalendarHours hours = week.addCalendarHours(day); int rangeCount = MPPUtility.getShort(data, offset + 2); if (rangeCount == 0) { week.setWorkingDay(day, DayType.NON_WORKING); } else { week.setWorkingDay(day, DayType.WORKING); Calendar cal = DateHelper.popCalendar(); for (int index = 0; index < rangeCount; index++) { Date startTime = DateHelper.getCanonicalTime(MPPUtility.getTime(data, offset + 8 + (index * 2))); int durationInSeconds = MPPUtility.getInt(data, offset + 20 + (index * 4)) * 6; cal.setTime(startTime); cal.add(Calendar.SECOND, durationInSeconds); Date finishTime = DateHelper.getCanonicalTime(cal.getTime()); hours.addRange(new DateRange(startTime, finishTime)); } DateHelper.pushCalendar(cal); } } }
java
private void processWorkWeekDay(byte[] data, int offset, ProjectCalendarWeek week, Day day) { //System.out.println(ByteArrayHelper.hexdump(data, offset, 60, false)); int dayType = MPPUtility.getShort(data, offset + 0); if (dayType == 1) { week.setWorkingDay(day, DayType.DEFAULT); } else { ProjectCalendarHours hours = week.addCalendarHours(day); int rangeCount = MPPUtility.getShort(data, offset + 2); if (rangeCount == 0) { week.setWorkingDay(day, DayType.NON_WORKING); } else { week.setWorkingDay(day, DayType.WORKING); Calendar cal = DateHelper.popCalendar(); for (int index = 0; index < rangeCount; index++) { Date startTime = DateHelper.getCanonicalTime(MPPUtility.getTime(data, offset + 8 + (index * 2))); int durationInSeconds = MPPUtility.getInt(data, offset + 20 + (index * 4)) * 6; cal.setTime(startTime); cal.add(Calendar.SECOND, durationInSeconds); Date finishTime = DateHelper.getCanonicalTime(cal.getTime()); hours.addRange(new DateRange(startTime, finishTime)); } DateHelper.pushCalendar(cal); } } }
[ "private", "void", "processWorkWeekDay", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "ProjectCalendarWeek", "week", ",", "Day", "day", ")", "{", "//System.out.println(ByteArrayHelper.hexdump(data, offset, 60, false));", "int", "dayType", "=", "MPPUtility", ".", "getShort", "(", "data", ",", "offset", "+", "0", ")", ";", "if", "(", "dayType", "==", "1", ")", "{", "week", ".", "setWorkingDay", "(", "day", ",", "DayType", ".", "DEFAULT", ")", ";", "}", "else", "{", "ProjectCalendarHours", "hours", "=", "week", ".", "addCalendarHours", "(", "day", ")", ";", "int", "rangeCount", "=", "MPPUtility", ".", "getShort", "(", "data", ",", "offset", "+", "2", ")", ";", "if", "(", "rangeCount", "==", "0", ")", "{", "week", ".", "setWorkingDay", "(", "day", ",", "DayType", ".", "NON_WORKING", ")", ";", "}", "else", "{", "week", ".", "setWorkingDay", "(", "day", ",", "DayType", ".", "WORKING", ")", ";", "Calendar", "cal", "=", "DateHelper", ".", "popCalendar", "(", ")", ";", "for", "(", "int", "index", "=", "0", ";", "index", "<", "rangeCount", ";", "index", "++", ")", "{", "Date", "startTime", "=", "DateHelper", ".", "getCanonicalTime", "(", "MPPUtility", ".", "getTime", "(", "data", ",", "offset", "+", "8", "+", "(", "index", "*", "2", ")", ")", ")", ";", "int", "durationInSeconds", "=", "MPPUtility", ".", "getInt", "(", "data", ",", "offset", "+", "20", "+", "(", "index", "*", "4", ")", ")", "*", "6", ";", "cal", ".", "setTime", "(", "startTime", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "SECOND", ",", "durationInSeconds", ")", ";", "Date", "finishTime", "=", "DateHelper", ".", "getCanonicalTime", "(", "cal", ".", "getTime", "(", ")", ")", ";", "hours", ".", "addRange", "(", "new", "DateRange", "(", "startTime", ",", "finishTime", ")", ")", ";", "}", "DateHelper", ".", "pushCalendar", "(", "cal", ")", ";", "}", "}", "}" ]
Process an individual work week day. @param data calendar data @param offset current offset into data @param week parent week @param day current day
[ "Process", "an", "individual", "work", "week", "day", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/AbstractCalendarAndExceptionFactory.java#L281-L314
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/favorite/FavoriteUpdater.java
FavoriteUpdater.add
public void add(DbSession dbSession, ComponentDto componentDto, @Nullable Integer userId, boolean failIfTooManyFavorites) { """ Set favorite to the logged in user. If no user, no action is done """ if (userId == null) { return; } List<PropertyDto> existingFavoriteOnComponent = dbClient.propertiesDao().selectByQuery(PropertyQuery.builder() .setKey(PROP_FAVORITE_KEY) .setUserId(userId) .setComponentId(componentDto.getId()) .build(), dbSession); checkArgument(existingFavoriteOnComponent.isEmpty(), "Component '%s' is already a favorite", componentDto.getDbKey()); List<PropertyDto> existingFavorites = dbClient.propertiesDao().selectByKeyAndUserIdAndComponentQualifier(dbSession, PROP_FAVORITE_KEY, userId, componentDto.qualifier()); if (existingFavorites.size() >= 100) { checkArgument(!failIfTooManyFavorites, "You cannot have more than 100 favorites on components with qualifier '%s'", componentDto.qualifier()); return; } dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto() .setKey(PROP_FAVORITE_KEY) .setResourceId(componentDto.getId()) .setUserId(userId)); }
java
public void add(DbSession dbSession, ComponentDto componentDto, @Nullable Integer userId, boolean failIfTooManyFavorites) { if (userId == null) { return; } List<PropertyDto> existingFavoriteOnComponent = dbClient.propertiesDao().selectByQuery(PropertyQuery.builder() .setKey(PROP_FAVORITE_KEY) .setUserId(userId) .setComponentId(componentDto.getId()) .build(), dbSession); checkArgument(existingFavoriteOnComponent.isEmpty(), "Component '%s' is already a favorite", componentDto.getDbKey()); List<PropertyDto> existingFavorites = dbClient.propertiesDao().selectByKeyAndUserIdAndComponentQualifier(dbSession, PROP_FAVORITE_KEY, userId, componentDto.qualifier()); if (existingFavorites.size() >= 100) { checkArgument(!failIfTooManyFavorites, "You cannot have more than 100 favorites on components with qualifier '%s'", componentDto.qualifier()); return; } dbClient.propertiesDao().saveProperty(dbSession, new PropertyDto() .setKey(PROP_FAVORITE_KEY) .setResourceId(componentDto.getId()) .setUserId(userId)); }
[ "public", "void", "add", "(", "DbSession", "dbSession", ",", "ComponentDto", "componentDto", ",", "@", "Nullable", "Integer", "userId", ",", "boolean", "failIfTooManyFavorites", ")", "{", "if", "(", "userId", "==", "null", ")", "{", "return", ";", "}", "List", "<", "PropertyDto", ">", "existingFavoriteOnComponent", "=", "dbClient", ".", "propertiesDao", "(", ")", ".", "selectByQuery", "(", "PropertyQuery", ".", "builder", "(", ")", ".", "setKey", "(", "PROP_FAVORITE_KEY", ")", ".", "setUserId", "(", "userId", ")", ".", "setComponentId", "(", "componentDto", ".", "getId", "(", ")", ")", ".", "build", "(", ")", ",", "dbSession", ")", ";", "checkArgument", "(", "existingFavoriteOnComponent", ".", "isEmpty", "(", ")", ",", "\"Component '%s' is already a favorite\"", ",", "componentDto", ".", "getDbKey", "(", ")", ")", ";", "List", "<", "PropertyDto", ">", "existingFavorites", "=", "dbClient", ".", "propertiesDao", "(", ")", ".", "selectByKeyAndUserIdAndComponentQualifier", "(", "dbSession", ",", "PROP_FAVORITE_KEY", ",", "userId", ",", "componentDto", ".", "qualifier", "(", ")", ")", ";", "if", "(", "existingFavorites", ".", "size", "(", ")", ">=", "100", ")", "{", "checkArgument", "(", "!", "failIfTooManyFavorites", ",", "\"You cannot have more than 100 favorites on components with qualifier '%s'\"", ",", "componentDto", ".", "qualifier", "(", ")", ")", ";", "return", ";", "}", "dbClient", ".", "propertiesDao", "(", ")", ".", "saveProperty", "(", "dbSession", ",", "new", "PropertyDto", "(", ")", ".", "setKey", "(", "PROP_FAVORITE_KEY", ")", ".", "setResourceId", "(", "componentDto", ".", "getId", "(", ")", ")", ".", "setUserId", "(", "userId", ")", ")", ";", "}" ]
Set favorite to the logged in user. If no user, no action is done
[ "Set", "favorite", "to", "the", "logged", "in", "user", ".", "If", "no", "user", "no", "action", "is", "done" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/favorite/FavoriteUpdater.java#L44-L65
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java
Log.wtf
public static int wtf(String tag, String msg) { """ What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level ASSERT with the call stack and with {@link SUBSYSTEM#MAIN} as default one. @param tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. @param msg The message you would like logged. @return """ return wtf(SUBSYSTEM.MAIN, tag, msg); }
java
public static int wtf(String tag, String msg) { return wtf(SUBSYSTEM.MAIN, tag, msg); }
[ "public", "static", "int", "wtf", "(", "String", "tag", ",", "String", "msg", ")", "{", "return", "wtf", "(", "SUBSYSTEM", ".", "MAIN", ",", "tag", ",", "msg", ")", ";", "}" ]
What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level ASSERT with the call stack and with {@link SUBSYSTEM#MAIN} as default one. @param tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. @param msg The message you would like logged. @return
[ "What", "a", "Terrible", "Failure", ":", "Report", "a", "condition", "that", "should", "never", "happen", ".", "The", "error", "will", "always", "be", "logged", "at", "level", "ASSERT", "with", "the", "call", "stack", "and", "with", "{" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java#L353-L355
alipay/sofa-rpc
extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/AloneBoltClientConnectionManager.java
AloneBoltClientConnectionManager.getConnection
public Connection getConnection(RpcClient rpcClient, ClientTransportConfig transportConfig, Url url) { """ 通过配置获取长连接 @param rpcClient bolt客户端 @param transportConfig 传输层配置 @param url 传输层地址 @return 长连接 """ if (rpcClient == null || transportConfig == null || url == null) { return null; } Connection connection; try { connection = rpcClient.getConnection(url, url.getConnectTimeout()); } catch (InterruptedException e) { throw new SofaRpcRuntimeException(e); } catch (RemotingException e) { throw new SofaRpcRuntimeException(e); } if (connection == null) { return null; } return connection; }
java
public Connection getConnection(RpcClient rpcClient, ClientTransportConfig transportConfig, Url url) { if (rpcClient == null || transportConfig == null || url == null) { return null; } Connection connection; try { connection = rpcClient.getConnection(url, url.getConnectTimeout()); } catch (InterruptedException e) { throw new SofaRpcRuntimeException(e); } catch (RemotingException e) { throw new SofaRpcRuntimeException(e); } if (connection == null) { return null; } return connection; }
[ "public", "Connection", "getConnection", "(", "RpcClient", "rpcClient", ",", "ClientTransportConfig", "transportConfig", ",", "Url", "url", ")", "{", "if", "(", "rpcClient", "==", "null", "||", "transportConfig", "==", "null", "||", "url", "==", "null", ")", "{", "return", "null", ";", "}", "Connection", "connection", ";", "try", "{", "connection", "=", "rpcClient", ".", "getConnection", "(", "url", ",", "url", ".", "getConnectTimeout", "(", ")", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "SofaRpcRuntimeException", "(", "e", ")", ";", "}", "catch", "(", "RemotingException", "e", ")", "{", "throw", "new", "SofaRpcRuntimeException", "(", "e", ")", ";", "}", "if", "(", "connection", "==", "null", ")", "{", "return", "null", ";", "}", "return", "connection", ";", "}" ]
通过配置获取长连接 @param rpcClient bolt客户端 @param transportConfig 传输层配置 @param url 传输层地址 @return 长连接
[ "通过配置获取长连接" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/AloneBoltClientConnectionManager.java#L48-L65
aws/aws-sdk-java
aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/UpdateIdentityPoolRequest.java
UpdateIdentityPoolRequest.withSupportedLoginProviders
public UpdateIdentityPoolRequest withSupportedLoginProviders(java.util.Map<String, String> supportedLoginProviders) { """ <p> Optional key:value pairs mapping provider names to provider app IDs. </p> @param supportedLoginProviders Optional key:value pairs mapping provider names to provider app IDs. @return Returns a reference to this object so that method calls can be chained together. """ setSupportedLoginProviders(supportedLoginProviders); return this; }
java
public UpdateIdentityPoolRequest withSupportedLoginProviders(java.util.Map<String, String> supportedLoginProviders) { setSupportedLoginProviders(supportedLoginProviders); return this; }
[ "public", "UpdateIdentityPoolRequest", "withSupportedLoginProviders", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "supportedLoginProviders", ")", "{", "setSupportedLoginProviders", "(", "supportedLoginProviders", ")", ";", "return", "this", ";", "}" ]
<p> Optional key:value pairs mapping provider names to provider app IDs. </p> @param supportedLoginProviders Optional key:value pairs mapping provider names to provider app IDs. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Optional", "key", ":", "value", "pairs", "mapping", "provider", "names", "to", "provider", "app", "IDs", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/UpdateIdentityPoolRequest.java#L254-L257
cogroo/cogroo4
lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/WizardDialog.java
WizardDialog.insertRoadmapItem
public void insertRoadmapItem(int Index, boolean _bEnabled, String _sLabel, int _ID) { """ To fully understand the example one has to be aware that the passed ???Index??? parameter refers to the position of the roadmap item in the roadmapmodel container whereas the variable ???_ID??? directyl references to a certain step of dialog. """ try { // a roadmap is a SingleServiceFactory that can only create roadmapitems that are the only possible // element types of the container Object oRoadmapItem = m_xSSFRoadmap.createInstance(); XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); xRMItemPSet.setPropertyValue("Label", _sLabel); // sometimes steps are supposed to be set disabled depending on the program logic... xRMItemPSet.setPropertyValue("Enabled", new Boolean(_bEnabled)); // in this context the "ID" is meant to refer to a step of the dialog xRMItemPSet.setPropertyValue("ID", new Integer(_ID)); m_xRMIndexCont.insertByIndex(Index, oRoadmapItem); } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); } }
java
public void insertRoadmapItem(int Index, boolean _bEnabled, String _sLabel, int _ID) { try { // a roadmap is a SingleServiceFactory that can only create roadmapitems that are the only possible // element types of the container Object oRoadmapItem = m_xSSFRoadmap.createInstance(); XPropertySet xRMItemPSet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oRoadmapItem); xRMItemPSet.setPropertyValue("Label", _sLabel); // sometimes steps are supposed to be set disabled depending on the program logic... xRMItemPSet.setPropertyValue("Enabled", new Boolean(_bEnabled)); // in this context the "ID" is meant to refer to a step of the dialog xRMItemPSet.setPropertyValue("ID", new Integer(_ID)); m_xRMIndexCont.insertByIndex(Index, oRoadmapItem); } catch (com.sun.star.uno.Exception exception) { exception.printStackTrace(System.out); } }
[ "public", "void", "insertRoadmapItem", "(", "int", "Index", ",", "boolean", "_bEnabled", ",", "String", "_sLabel", ",", "int", "_ID", ")", "{", "try", "{", "// a roadmap is a SingleServiceFactory that can only create roadmapitems that are the only possible", "// element types of the container", "Object", "oRoadmapItem", "=", "m_xSSFRoadmap", ".", "createInstance", "(", ")", ";", "XPropertySet", "xRMItemPSet", "=", "(", "XPropertySet", ")", "UnoRuntime", ".", "queryInterface", "(", "XPropertySet", ".", "class", ",", "oRoadmapItem", ")", ";", "xRMItemPSet", ".", "setPropertyValue", "(", "\"Label\"", ",", "_sLabel", ")", ";", "// sometimes steps are supposed to be set disabled depending on the program logic...", "xRMItemPSet", ".", "setPropertyValue", "(", "\"Enabled\"", ",", "new", "Boolean", "(", "_bEnabled", ")", ")", ";", "// in this context the \"ID\" is meant to refer to a step of the dialog", "xRMItemPSet", ".", "setPropertyValue", "(", "\"ID\"", ",", "new", "Integer", "(", "_ID", ")", ")", ";", "m_xRMIndexCont", ".", "insertByIndex", "(", "Index", ",", "oRoadmapItem", ")", ";", "}", "catch", "(", "com", ".", "sun", ".", "star", ".", "uno", ".", "Exception", "exception", ")", "{", "exception", ".", "printStackTrace", "(", "System", ".", "out", ")", ";", "}", "}" ]
To fully understand the example one has to be aware that the passed ???Index??? parameter refers to the position of the roadmap item in the roadmapmodel container whereas the variable ???_ID??? directyl references to a certain step of dialog.
[ "To", "fully", "understand", "the", "example", "one", "has", "to", "be", "aware", "that", "the", "passed", "???Index???", "parameter", "refers", "to", "the", "position", "of", "the", "roadmap", "item", "in", "the", "roadmapmodel", "container", "whereas", "the", "variable", "???_ID???", "directyl", "references", "to", "a", "certain", "step", "of", "dialog", "." ]
train
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/WizardDialog.java#L1489-L1504
CleverTap/clevertap-android-sdk
clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java
CleverTapAPI.pushGcmRegistrationId
@SuppressWarnings("WeakerAccess") public void pushGcmRegistrationId(String gcmId, boolean register) { """ Sends the GCM registration ID to CleverTap. @param gcmId The GCM registration ID @param register Boolean indicating whether to register or not for receiving push messages from CleverTap. Set this to true to receive push messages from CleverTap, and false to not receive any messages from CleverTap. """ pushDeviceToken(gcmId, register, PushType.GCM); }
java
@SuppressWarnings("WeakerAccess") public void pushGcmRegistrationId(String gcmId, boolean register) { pushDeviceToken(gcmId, register, PushType.GCM); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "void", "pushGcmRegistrationId", "(", "String", "gcmId", ",", "boolean", "register", ")", "{", "pushDeviceToken", "(", "gcmId", ",", "register", ",", "PushType", ".", "GCM", ")", ";", "}" ]
Sends the GCM registration ID to CleverTap. @param gcmId The GCM registration ID @param register Boolean indicating whether to register or not for receiving push messages from CleverTap. Set this to true to receive push messages from CleverTap, and false to not receive any messages from CleverTap.
[ "Sends", "the", "GCM", "registration", "ID", "to", "CleverTap", "." ]
train
https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java#L4807-L4810
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/handlers/LogRepositoryConfiguration.java
LogRepositoryConfiguration.setTraceMemory
public void setTraceMemory(String dataDirectory, long memoryBufferSize) { """ Modify the trace to use a memory buffer @param dataDirectory directory where buffer will be dumped if requested @param memoryBufferSize amount of memory (in Mb) to be used for this circular buffer """ TraceState state = (TraceState)ivTrace.clone(); state.ivStorageType = MEMORYBUFFER_TYPE; state.ivDataDirectory = dataDirectory; state.ivMemoryBufferSize = memoryBufferSize; updateTraceConfiguration(state); state.copyTo(ivTrace); }
java
public void setTraceMemory(String dataDirectory, long memoryBufferSize) { TraceState state = (TraceState)ivTrace.clone(); state.ivStorageType = MEMORYBUFFER_TYPE; state.ivDataDirectory = dataDirectory; state.ivMemoryBufferSize = memoryBufferSize; updateTraceConfiguration(state); state.copyTo(ivTrace); }
[ "public", "void", "setTraceMemory", "(", "String", "dataDirectory", ",", "long", "memoryBufferSize", ")", "{", "TraceState", "state", "=", "(", "TraceState", ")", "ivTrace", ".", "clone", "(", ")", ";", "state", ".", "ivStorageType", "=", "MEMORYBUFFER_TYPE", ";", "state", ".", "ivDataDirectory", "=", "dataDirectory", ";", "state", ".", "ivMemoryBufferSize", "=", "memoryBufferSize", ";", "updateTraceConfiguration", "(", "state", ")", ";", "state", ".", "copyTo", "(", "ivTrace", ")", ";", "}" ]
Modify the trace to use a memory buffer @param dataDirectory directory where buffer will be dumped if requested @param memoryBufferSize amount of memory (in Mb) to be used for this circular buffer
[ "Modify", "the", "trace", "to", "use", "a", "memory", "buffer" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/handlers/LogRepositoryConfiguration.java#L436-L445
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java
DiscreteFourierTransformOps.realToComplex
public static void realToComplex(GrayF32 real , InterleavedF32 complex ) { """ Converts a regular image into a complex interleaved image with the imaginary component set to zero. @param real (Input) Regular image. @param complex (Output) Equivalent complex image. """ checkImageArguments(real,complex); for( int y = 0; y < complex.height; y++ ) { int indexReal = real.startIndex + y*real.stride; int indexComplex = complex.startIndex + y*complex.stride; for( int x = 0; x < real.width; x++, indexReal++ , indexComplex += 2 ) { complex.data[indexComplex] = real.data[indexReal]; complex.data[indexComplex+1] = 0; } } }
java
public static void realToComplex(GrayF32 real , InterleavedF32 complex ) { checkImageArguments(real,complex); for( int y = 0; y < complex.height; y++ ) { int indexReal = real.startIndex + y*real.stride; int indexComplex = complex.startIndex + y*complex.stride; for( int x = 0; x < real.width; x++, indexReal++ , indexComplex += 2 ) { complex.data[indexComplex] = real.data[indexReal]; complex.data[indexComplex+1] = 0; } } }
[ "public", "static", "void", "realToComplex", "(", "GrayF32", "real", ",", "InterleavedF32", "complex", ")", "{", "checkImageArguments", "(", "real", ",", "complex", ")", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "complex", ".", "height", ";", "y", "++", ")", "{", "int", "indexReal", "=", "real", ".", "startIndex", "+", "y", "*", "real", ".", "stride", ";", "int", "indexComplex", "=", "complex", ".", "startIndex", "+", "y", "*", "complex", ".", "stride", ";", "for", "(", "int", "x", "=", "0", ";", "x", "<", "real", ".", "width", ";", "x", "++", ",", "indexReal", "++", ",", "indexComplex", "+=", "2", ")", "{", "complex", ".", "data", "[", "indexComplex", "]", "=", "real", ".", "data", "[", "indexReal", "]", ";", "complex", ".", "data", "[", "indexComplex", "+", "1", "]", "=", "0", ";", "}", "}", "}" ]
Converts a regular image into a complex interleaved image with the imaginary component set to zero. @param real (Input) Regular image. @param complex (Output) Equivalent complex image.
[ "Converts", "a", "regular", "image", "into", "a", "complex", "interleaved", "image", "with", "the", "imaginary", "component", "set", "to", "zero", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java#L354-L366
tvesalainen/util
util/src/main/java/org/vesalainen/util/ArrayHelp.java
ArrayHelp.containsOnly
public static final <T> boolean containsOnly(short[] array, T... items) { """ Throws UnsupportedOperationException if one of array members is not one of items @param <T> @param array @param items @return """ for (short b : array) { if (!contains(items, b)) { return false; } } return true; }
java
public static final <T> boolean containsOnly(short[] array, T... items) { for (short b : array) { if (!contains(items, b)) { return false; } } return true; }
[ "public", "static", "final", "<", "T", ">", "boolean", "containsOnly", "(", "short", "[", "]", "array", ",", "T", "...", "items", ")", "{", "for", "(", "short", "b", ":", "array", ")", "{", "if", "(", "!", "contains", "(", "items", ",", "b", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Throws UnsupportedOperationException if one of array members is not one of items @param <T> @param array @param items @return
[ "Throws", "UnsupportedOperationException", "if", "one", "of", "array", "members", "is", "not", "one", "of", "items" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/ArrayHelp.java#L450-L460
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannel.java
SSLChannel.getSSLContextForInboundLink
public SSLContext getSSLContextForInboundLink(SSLConnectionLink link, VirtualConnection vc) throws ChannelException { """ This method is overloaded from the base class in order to determine the host and port of the connection required by the calls to the core security code which will eventually return an SSLContext to use. This is only used by inbound connections. @param link @param vc @return SSLContext @throws ChannelException """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "getSSLContextForInboundLink"); } SSLContext context = getSSLContextForLink(vc, this.inboundHost, this.inboundPort, this.endPointName, false, link); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getSSLContextForInboundLink"); } return context; }
java
public SSLContext getSSLContextForInboundLink(SSLConnectionLink link, VirtualConnection vc) throws ChannelException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "getSSLContextForInboundLink"); } SSLContext context = getSSLContextForLink(vc, this.inboundHost, this.inboundPort, this.endPointName, false, link); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getSSLContextForInboundLink"); } return context; }
[ "public", "SSLContext", "getSSLContextForInboundLink", "(", "SSLConnectionLink", "link", ",", "VirtualConnection", "vc", ")", "throws", "ChannelException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"getSSLContextForInboundLink\"", ")", ";", "}", "SSLContext", "context", "=", "getSSLContextForLink", "(", "vc", ",", "this", ".", "inboundHost", ",", "this", ".", "inboundPort", ",", "this", ".", "endPointName", ",", "false", ",", "link", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"getSSLContextForInboundLink\"", ")", ";", "}", "return", "context", ";", "}" ]
This method is overloaded from the base class in order to determine the host and port of the connection required by the calls to the core security code which will eventually return an SSLContext to use. This is only used by inbound connections. @param link @param vc @return SSLContext @throws ChannelException
[ "This", "method", "is", "overloaded", "from", "the", "base", "class", "in", "order", "to", "determine", "the", "host", "and", "port", "of", "the", "connection", "required", "by", "the", "calls", "to", "the", "core", "security", "code", "which", "will", "eventually", "return", "an", "SSLContext", "to", "use", ".", "This", "is", "only", "used", "by", "inbound", "connections", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannel.java#L270-L282
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java
BoofConcurrency.loopFor
public static void loopFor(int start , int endExclusive , IntConsumer consumer ) { """ Concurrent for loop. Each loop with spawn as a thread up to the maximum number of threads. @param start starting value, inclusive @param endExclusive ending value, exclusive @param consumer The consumer """ try { pool.submit(() ->IntStream.range(start, endExclusive).parallel().forEach(consumer)).get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } }
java
public static void loopFor(int start , int endExclusive , IntConsumer consumer ) { try { pool.submit(() ->IntStream.range(start, endExclusive).parallel().forEach(consumer)).get(); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } }
[ "public", "static", "void", "loopFor", "(", "int", "start", ",", "int", "endExclusive", ",", "IntConsumer", "consumer", ")", "{", "try", "{", "pool", ".", "submit", "(", "(", ")", "->", "IntStream", ".", "range", "(", "start", ",", "endExclusive", ")", ".", "parallel", "(", ")", ".", "forEach", "(", "consumer", ")", ")", ".", "get", "(", ")", ";", "}", "catch", "(", "InterruptedException", "|", "ExecutionException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Concurrent for loop. Each loop with spawn as a thread up to the maximum number of threads. @param start starting value, inclusive @param endExclusive ending value, exclusive @param consumer The consumer
[ "Concurrent", "for", "loop", ".", "Each", "loop", "with", "spawn", "as", "a", "thread", "up", "to", "the", "maximum", "number", "of", "threads", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java#L60-L66
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java
CPDefinitionPersistenceImpl.fetchByC_ERC
@Override public CPDefinition fetchByC_ERC(long companyId, String externalReferenceCode) { """ Returns the cp definition where companyId = &#63; and externalReferenceCode = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param companyId the company ID @param externalReferenceCode the external reference code @return the matching cp definition, or <code>null</code> if a matching cp definition could not be found """ return fetchByC_ERC(companyId, externalReferenceCode, true); }
java
@Override public CPDefinition fetchByC_ERC(long companyId, String externalReferenceCode) { return fetchByC_ERC(companyId, externalReferenceCode, true); }
[ "@", "Override", "public", "CPDefinition", "fetchByC_ERC", "(", "long", "companyId", ",", "String", "externalReferenceCode", ")", "{", "return", "fetchByC_ERC", "(", "companyId", ",", "externalReferenceCode", ",", "true", ")", ";", "}" ]
Returns the cp definition where companyId = &#63; and externalReferenceCode = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param companyId the company ID @param externalReferenceCode the external reference code @return the matching cp definition, or <code>null</code> if a matching cp definition could not be found
[ "Returns", "the", "cp", "definition", "where", "companyId", "=", "&#63", ";", "and", "externalReferenceCode", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "cache", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L5232-L5236
blackfizz/EazeGraph
EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java
Utils.vectorToScalarScroll
public static float vectorToScalarScroll(float _Dx, float _Dy, float _X, float _Y) { """ Helper method for translating (_X,_Y) scroll vectors into scalar rotation of a circle. @param _Dx The _X component of the current scroll vector. @param _Dy The _Y component of the current scroll vector. @param _X The _X position of the current touch, relative to the circle center. @param _Y The _Y position of the current touch, relative to the circle center. @return The scalar representing the change in angular position for this scroll. """ // get the length of the vector float l = (float) Math.sqrt(_Dx * _Dx + _Dy * _Dy); // decide if the scalar should be negative or positive by finding // the dot product of the vector perpendicular to (_X,_Y). float crossX = -_Y; float crossY = _X; float dot = (crossX * _Dx + crossY * _Dy); float sign = Math.signum(dot); return l * sign; }
java
public static float vectorToScalarScroll(float _Dx, float _Dy, float _X, float _Y) { // get the length of the vector float l = (float) Math.sqrt(_Dx * _Dx + _Dy * _Dy); // decide if the scalar should be negative or positive by finding // the dot product of the vector perpendicular to (_X,_Y). float crossX = -_Y; float crossY = _X; float dot = (crossX * _Dx + crossY * _Dy); float sign = Math.signum(dot); return l * sign; }
[ "public", "static", "float", "vectorToScalarScroll", "(", "float", "_Dx", ",", "float", "_Dy", ",", "float", "_X", ",", "float", "_Y", ")", "{", "// get the length of the vector", "float", "l", "=", "(", "float", ")", "Math", ".", "sqrt", "(", "_Dx", "*", "_Dx", "+", "_Dy", "*", "_Dy", ")", ";", "// decide if the scalar should be negative or positive by finding", "// the dot product of the vector perpendicular to (_X,_Y).", "float", "crossX", "=", "-", "_Y", ";", "float", "crossY", "=", "_X", ";", "float", "dot", "=", "(", "crossX", "*", "_Dx", "+", "crossY", "*", "_Dy", ")", ";", "float", "sign", "=", "Math", ".", "signum", "(", "dot", ")", ";", "return", "l", "*", "sign", ";", "}" ]
Helper method for translating (_X,_Y) scroll vectors into scalar rotation of a circle. @param _Dx The _X component of the current scroll vector. @param _Dy The _Y component of the current scroll vector. @param _X The _X position of the current touch, relative to the circle center. @param _Y The _Y position of the current touch, relative to the circle center. @return The scalar representing the change in angular position for this scroll.
[ "Helper", "method", "for", "translating", "(", "_X", "_Y", ")", "scroll", "vectors", "into", "scalar", "rotation", "of", "a", "circle", "." ]
train
https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java#L74-L87
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/topology/TopologyBuilder.java
TopologyBuilder.setSpout
public SpoutDeclarer setSpout(String id, IRichSpout spout, Number parallelism_hint) throws IllegalArgumentException { """ Define a new spout in this topology with the specified parallelism. If the spout declares itself as non-distributed, the parallelism_hint will be ignored and only one task will be allocated to this component. @param id the id of this component. This id is referenced by other components that want to consume this spout's outputs. @param parallelism_hint the number of tasks that should be assigned to execute this spout. Each task will run on a thread in a process somewhere around the cluster. @param spout the spout @throws IllegalArgumentException if {@code parallelism_hint} is not positive """ validateUnusedId(id); initCommon(id, spout, parallelism_hint); _spouts.put(id, spout); return new SpoutGetter(id); }
java
public SpoutDeclarer setSpout(String id, IRichSpout spout, Number parallelism_hint) throws IllegalArgumentException { validateUnusedId(id); initCommon(id, spout, parallelism_hint); _spouts.put(id, spout); return new SpoutGetter(id); }
[ "public", "SpoutDeclarer", "setSpout", "(", "String", "id", ",", "IRichSpout", "spout", ",", "Number", "parallelism_hint", ")", "throws", "IllegalArgumentException", "{", "validateUnusedId", "(", "id", ")", ";", "initCommon", "(", "id", ",", "spout", ",", "parallelism_hint", ")", ";", "_spouts", ".", "put", "(", "id", ",", "spout", ")", ";", "return", "new", "SpoutGetter", "(", "id", ")", ";", "}" ]
Define a new spout in this topology with the specified parallelism. If the spout declares itself as non-distributed, the parallelism_hint will be ignored and only one task will be allocated to this component. @param id the id of this component. This id is referenced by other components that want to consume this spout's outputs. @param parallelism_hint the number of tasks that should be assigned to execute this spout. Each task will run on a thread in a process somewhere around the cluster. @param spout the spout @throws IllegalArgumentException if {@code parallelism_hint} is not positive
[ "Define", "a", "new", "spout", "in", "this", "topology", "with", "the", "specified", "parallelism", ".", "If", "the", "spout", "declares", "itself", "as", "non", "-", "distributed", "the", "parallelism_hint", "will", "be", "ignored", "and", "only", "one", "task", "will", "be", "allocated", "to", "this", "component", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/topology/TopologyBuilder.java#L321-L326
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/IssuesApi.java
IssuesApi.closeIssue
public Issue closeIssue(Object projectIdOrPath, Integer issueIid) throws GitLabApiException { """ Closes an existing project issue. <pre><code>GitLab Endpoint: PUT /projects/:id/issues/:issue_iid</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param issueIid the issue IID to update, required @return an instance of the updated Issue @throws GitLabApiException if any exception occurs """ if (issueIid == null) { throw new RuntimeException("issue IID cannot be null"); } GitLabApiForm formData = new GitLabApiForm().withParam("state_event", StateEvent.CLOSE); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid); return (response.readEntity(Issue.class)); }
java
public Issue closeIssue(Object projectIdOrPath, Integer issueIid) throws GitLabApiException { if (issueIid == null) { throw new RuntimeException("issue IID cannot be null"); } GitLabApiForm formData = new GitLabApiForm().withParam("state_event", StateEvent.CLOSE); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid); return (response.readEntity(Issue.class)); }
[ "public", "Issue", "closeIssue", "(", "Object", "projectIdOrPath", ",", "Integer", "issueIid", ")", "throws", "GitLabApiException", "{", "if", "(", "issueIid", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"issue IID cannot be null\"", ")", ";", "}", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"state_event\"", ",", "StateEvent", ".", "CLOSE", ")", ";", "Response", "response", "=", "put", "(", "Response", ".", "Status", ".", "OK", ",", "formData", ".", "asMap", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"issues\"", ",", "issueIid", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Issue", ".", "class", ")", ")", ";", "}" ]
Closes an existing project issue. <pre><code>GitLab Endpoint: PUT /projects/:id/issues/:issue_iid</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param issueIid the issue IID to update, required @return an instance of the updated Issue @throws GitLabApiException if any exception occurs
[ "Closes", "an", "existing", "project", "issue", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/IssuesApi.java#L380-L389
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java
DependencyBundlingAnalyzer.hashesMatch
private boolean hashesMatch(Dependency dependency1, Dependency dependency2) { """ Compares the SHA1 hashes of two dependencies to determine if they are equal. @param dependency1 a dependency object to compare @param dependency2 a dependency object to compare @return true if the sha1 hashes of the two dependencies match; otherwise false """ if (dependency1 == null || dependency2 == null || dependency1.getSha1sum() == null || dependency2.getSha1sum() == null) { return false; } return dependency1.getSha1sum().equals(dependency2.getSha1sum()); }
java
private boolean hashesMatch(Dependency dependency1, Dependency dependency2) { if (dependency1 == null || dependency2 == null || dependency1.getSha1sum() == null || dependency2.getSha1sum() == null) { return false; } return dependency1.getSha1sum().equals(dependency2.getSha1sum()); }
[ "private", "boolean", "hashesMatch", "(", "Dependency", "dependency1", ",", "Dependency", "dependency2", ")", "{", "if", "(", "dependency1", "==", "null", "||", "dependency2", "==", "null", "||", "dependency1", ".", "getSha1sum", "(", ")", "==", "null", "||", "dependency2", ".", "getSha1sum", "(", ")", "==", "null", ")", "{", "return", "false", ";", "}", "return", "dependency1", ".", "getSha1sum", "(", ")", ".", "equals", "(", "dependency2", ".", "getSha1sum", "(", ")", ")", ";", "}" ]
Compares the SHA1 hashes of two dependencies to determine if they are equal. @param dependency1 a dependency object to compare @param dependency2 a dependency object to compare @return true if the sha1 hashes of the two dependencies match; otherwise false
[ "Compares", "the", "SHA1", "hashes", "of", "two", "dependencies", "to", "determine", "if", "they", "are", "equal", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java#L390-L395
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java
AtomPositionMap.getLength
public int getLength(int positionA, int positionB, String startingChain) { """ Calculates the number of residues of the specified chain in a given range, inclusive. @param positionA index of the first atom to count @param positionB index of the last atom to count @param startingChain Case-sensitive chain @return The number of atoms between A and B inclusive belonging to the given chain """ int positionStart, positionEnd; if (positionA <= positionB) { positionStart = positionA; positionEnd = positionB; } else { positionStart = positionB; positionEnd = positionA; } int count = 0; // Inefficient search for (Map.Entry<ResidueNumber, Integer> entry : treeMap.entrySet()) { if (entry.getKey().getChainName().equals(startingChain) && positionStart <= entry.getValue() && entry.getValue() <= positionEnd) { count++; } } return count; }
java
public int getLength(int positionA, int positionB, String startingChain) { int positionStart, positionEnd; if (positionA <= positionB) { positionStart = positionA; positionEnd = positionB; } else { positionStart = positionB; positionEnd = positionA; } int count = 0; // Inefficient search for (Map.Entry<ResidueNumber, Integer> entry : treeMap.entrySet()) { if (entry.getKey().getChainName().equals(startingChain) && positionStart <= entry.getValue() && entry.getValue() <= positionEnd) { count++; } } return count; }
[ "public", "int", "getLength", "(", "int", "positionA", ",", "int", "positionB", ",", "String", "startingChain", ")", "{", "int", "positionStart", ",", "positionEnd", ";", "if", "(", "positionA", "<=", "positionB", ")", "{", "positionStart", "=", "positionA", ";", "positionEnd", "=", "positionB", ";", "}", "else", "{", "positionStart", "=", "positionB", ";", "positionEnd", "=", "positionA", ";", "}", "int", "count", "=", "0", ";", "// Inefficient search", "for", "(", "Map", ".", "Entry", "<", "ResidueNumber", ",", "Integer", ">", "entry", ":", "treeMap", ".", "entrySet", "(", ")", ")", "{", "if", "(", "entry", ".", "getKey", "(", ")", ".", "getChainName", "(", ")", ".", "equals", "(", "startingChain", ")", "&&", "positionStart", "<=", "entry", ".", "getValue", "(", ")", "&&", "entry", ".", "getValue", "(", ")", "<=", "positionEnd", ")", "{", "count", "++", ";", "}", "}", "return", "count", ";", "}" ]
Calculates the number of residues of the specified chain in a given range, inclusive. @param positionA index of the first atom to count @param positionB index of the last atom to count @param startingChain Case-sensitive chain @return The number of atoms between A and B inclusive belonging to the given chain
[ "Calculates", "the", "number", "of", "residues", "of", "the", "specified", "chain", "in", "a", "given", "range", "inclusive", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java#L187-L209
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parsePersistTimeout
private void parsePersistTimeout(Map<Object, Object> props) { """ Check the input configuration for the timeout to use in between persistent requests. @param props """ Object value = props.get(HttpConfigConstants.PROPNAME_PERSIST_TIMEOUT); if (null != value) { try { this.persistTimeout = TIMEOUT_MODIFIER * minLimit(convertInteger(value), HttpConfigConstants.MIN_TIMEOUT); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Persist timeout is " + getPersistTimeout()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parsePersistTimeout", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid persist timeout; " + value); } } } }
java
private void parsePersistTimeout(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_PERSIST_TIMEOUT); if (null != value) { try { this.persistTimeout = TIMEOUT_MODIFIER * minLimit(convertInteger(value), HttpConfigConstants.MIN_TIMEOUT); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Persist timeout is " + getPersistTimeout()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parsePersistTimeout", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid persist timeout; " + value); } } } }
[ "private", "void", "parsePersistTimeout", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_PERSIST_TIMEOUT", ")", ";", "if", "(", "null", "!=", "value", ")", "{", "try", "{", "this", ".", "persistTimeout", "=", "TIMEOUT_MODIFIER", "*", "minLimit", "(", "convertInteger", "(", "value", ")", ",", "HttpConfigConstants", ".", "MIN_TIMEOUT", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Config: Persist timeout is \"", "+", "getPersistTimeout", "(", ")", ")", ";", "}", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "FFDCFilter", ".", "processException", "(", "nfe", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".parsePersistTimeout\"", ",", "\"1\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Config: Invalid persist timeout; \"", "+", "value", ")", ";", "}", "}", "}", "}" ]
Check the input configuration for the timeout to use in between persistent requests. @param props
[ "Check", "the", "input", "configuration", "for", "the", "timeout", "to", "use", "in", "between", "persistent", "requests", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L635-L650
tzaeschke/zoodb
src/org/zoodb/internal/server/index/LLIndexPage.java
LLIndexPage.binarySearch
int binarySearch(int fromIndex, int toIndex, long key, long value) { """ Binary search. @param toIndex Exclusive, search stops at (toIndex-1). @param value For non-unique trees, the value is taken into account as well. """ if (ind.isUnique()) { return binarySearchUnique(fromIndex, toIndex, key); } return binarySearchNonUnique(fromIndex, toIndex, key, value); }
java
int binarySearch(int fromIndex, int toIndex, long key, long value) { if (ind.isUnique()) { return binarySearchUnique(fromIndex, toIndex, key); } return binarySearchNonUnique(fromIndex, toIndex, key, value); }
[ "int", "binarySearch", "(", "int", "fromIndex", ",", "int", "toIndex", ",", "long", "key", ",", "long", "value", ")", "{", "if", "(", "ind", ".", "isUnique", "(", ")", ")", "{", "return", "binarySearchUnique", "(", "fromIndex", ",", "toIndex", ",", "key", ")", ";", "}", "return", "binarySearchNonUnique", "(", "fromIndex", ",", "toIndex", ",", "key", ",", "value", ")", ";", "}" ]
Binary search. @param toIndex Exclusive, search stops at (toIndex-1). @param value For non-unique trees, the value is taken into account as well.
[ "Binary", "search", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/LLIndexPage.java#L227-L232
rzwitserloot/lombok.ast
src/ast/lombok/ast/Ast.java
Ast.setAllPositions
public static Node setAllPositions(Node node, Position position) { """ Sets the position of {@code node} to {@code position}, and then does the same for all of {@code node}'s children, recursively. """ node.setPosition(position); for (Node child : node.getChildren()) setAllPositions(child, position); return node; } /** * Get the current lombok.ast version. */ public static String getVersion() { return Version.getVersion(); } public static CompilationUnit upToTop(Node node) { while (node != null && !(node instanceof CompilationUnit)) node = node.getParent(); return (CompilationUnit) node; } }
java
public static Node setAllPositions(Node node, Position position) { node.setPosition(position); for (Node child : node.getChildren()) setAllPositions(child, position); return node; } /** * Get the current lombok.ast version. */ public static String getVersion() { return Version.getVersion(); } public static CompilationUnit upToTop(Node node) { while (node != null && !(node instanceof CompilationUnit)) node = node.getParent(); return (CompilationUnit) node; } }
[ "public", "static", "Node", "setAllPositions", "(", "Node", "node", ",", "Position", "position", ")", "{", "node", ".", "setPosition", "(", "position", ")", ";", "for", "(", "Node", "child", ":", "node", ".", "getChildren", "(", ")", ")", "setAllPositions", "(", "child", ",", "position", ")", ";", "return", "node", ";", "}", "/**\n\t * Get the current lombok.ast version.\n\t */", "public", "static", "String", "getVersion", "(", ")", "{", "return", "Version", ".", "getVersion", "(", ")", ";", "}", "public", "static", "CompilationUnit", "upToTop", "", "(", "Node", "node", ")", "{", "while", "(", "node", "!=", "null", "&&", "!", "(", "node", "instanceof", "CompilationUnit", ")", ")", "node", "=", "node", ".", "getParent", "(", ")", ";", "return", "(", "CompilationUnit", ")", "node", ";", "}", "}" ]
Sets the position of {@code node} to {@code position}, and then does the same for all of {@code node}'s children, recursively.
[ "Sets", "the", "position", "of", "{" ]
train
https://github.com/rzwitserloot/lombok.ast/blob/ed83541c1a5a08952a5d4d7e316a6be9a05311fb/src/ast/lombok/ast/Ast.java#L31-L48
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_backup_enable_POST
public OvhTask serviceName_datacenter_datacenterId_backup_enable_POST(String serviceName, Long datacenterId, OvhOfferTypeEnum backupOffer) throws IOException { """ Enable backup solution on a Private Cloud REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/enable @param backupOffer [required] Backup offer type @param serviceName [required] Domain of the service @param datacenterId [required] """ String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/enable"; StringBuilder sb = path(qPath, serviceName, datacenterId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "backupOffer", backupOffer); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_datacenter_datacenterId_backup_enable_POST(String serviceName, Long datacenterId, OvhOfferTypeEnum backupOffer) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/enable"; StringBuilder sb = path(qPath, serviceName, datacenterId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "backupOffer", backupOffer); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_datacenter_datacenterId_backup_enable_POST", "(", "String", "serviceName", ",", "Long", "datacenterId", ",", "OvhOfferTypeEnum", "backupOffer", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/enable\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "datacenterId", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"backupOffer\"", ",", "backupOffer", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Enable backup solution on a Private Cloud REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/backup/enable @param backupOffer [required] Backup offer type @param serviceName [required] Domain of the service @param datacenterId [required]
[ "Enable", "backup", "solution", "on", "a", "Private", "Cloud" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L2430-L2437
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java
BaseNDArrayFactory.randn
@Override public INDArray randn(long rows, long columns, long seed) { """ Random normal using the specified seed @param rows the number of rows in the matrix @param columns the number of columns in the matrix @return """ Nd4j.getRandom().setSeed(seed); return randn(new long[] {rows, columns}, Nd4j.getRandom()); }
java
@Override public INDArray randn(long rows, long columns, long seed) { Nd4j.getRandom().setSeed(seed); return randn(new long[] {rows, columns}, Nd4j.getRandom()); }
[ "@", "Override", "public", "INDArray", "randn", "(", "long", "rows", ",", "long", "columns", ",", "long", "seed", ")", "{", "Nd4j", ".", "getRandom", "(", ")", ".", "setSeed", "(", "seed", ")", ";", "return", "randn", "(", "new", "long", "[", "]", "{", "rows", ",", "columns", "}", ",", "Nd4j", ".", "getRandom", "(", ")", ")", ";", "}" ]
Random normal using the specified seed @param rows the number of rows in the matrix @param columns the number of columns in the matrix @return
[ "Random", "normal", "using", "the", "specified", "seed" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/BaseNDArrayFactory.java#L536-L540
Wikidata/Wikidata-Toolkit
wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java
ClassPropertyUsageAnalyzer.printRelatedProperties
private void printRelatedProperties(PrintStream out, UsageRecord usageRecord) { """ Prints a list of related properties to the output. The list is encoded as a single CSV value, using "@" as a separator. Miga can decode this. Standard CSV processors do not support lists of entries as values, however. @param out the output to write to @param usageRecord the data to write """ List<ImmutablePair<PropertyIdValue, Double>> list = new ArrayList<ImmutablePair<PropertyIdValue, Double>>( usageRecord.propertyCoCounts.size()); for (Entry<PropertyIdValue, Integer> coCountEntry : usageRecord.propertyCoCounts .entrySet()) { double otherThisItemRate = (double) coCountEntry.getValue() / usageRecord.itemCount; double otherGlobalItemRate = (double) this.propertyRecords .get(coCountEntry.getKey()).itemCount / this.countPropertyItems; double otherThisItemRateStep = 1 / (1 + Math.exp(6 * (-2 * otherThisItemRate + 0.5))); double otherInvGlobalItemRateStep = 1 / (1 + Math.exp(6 * (-2 * (1 - otherGlobalItemRate) + 0.5))); list.add(new ImmutablePair<PropertyIdValue, Double>(coCountEntry .getKey(), otherThisItemRateStep * otherInvGlobalItemRateStep * otherThisItemRate / otherGlobalItemRate)); } Collections.sort(list, new Comparator<ImmutablePair<PropertyIdValue, Double>>() { @Override public int compare( ImmutablePair<PropertyIdValue, Double> o1, ImmutablePair<PropertyIdValue, Double> o2) { return o2.getValue().compareTo(o1.getValue()); } }); out.print(",\""); int count = 0; for (ImmutablePair<PropertyIdValue, Double> relatedProperty : list) { if (relatedProperty.right < 1.5) { break; } if (count > 0) { out.print("@"); } // makeshift escaping for Miga: out.print(getPropertyLabel(relatedProperty.left).replace("@", "@")); count++; } out.print("\""); }
java
private void printRelatedProperties(PrintStream out, UsageRecord usageRecord) { List<ImmutablePair<PropertyIdValue, Double>> list = new ArrayList<ImmutablePair<PropertyIdValue, Double>>( usageRecord.propertyCoCounts.size()); for (Entry<PropertyIdValue, Integer> coCountEntry : usageRecord.propertyCoCounts .entrySet()) { double otherThisItemRate = (double) coCountEntry.getValue() / usageRecord.itemCount; double otherGlobalItemRate = (double) this.propertyRecords .get(coCountEntry.getKey()).itemCount / this.countPropertyItems; double otherThisItemRateStep = 1 / (1 + Math.exp(6 * (-2 * otherThisItemRate + 0.5))); double otherInvGlobalItemRateStep = 1 / (1 + Math.exp(6 * (-2 * (1 - otherGlobalItemRate) + 0.5))); list.add(new ImmutablePair<PropertyIdValue, Double>(coCountEntry .getKey(), otherThisItemRateStep * otherInvGlobalItemRateStep * otherThisItemRate / otherGlobalItemRate)); } Collections.sort(list, new Comparator<ImmutablePair<PropertyIdValue, Double>>() { @Override public int compare( ImmutablePair<PropertyIdValue, Double> o1, ImmutablePair<PropertyIdValue, Double> o2) { return o2.getValue().compareTo(o1.getValue()); } }); out.print(",\""); int count = 0; for (ImmutablePair<PropertyIdValue, Double> relatedProperty : list) { if (relatedProperty.right < 1.5) { break; } if (count > 0) { out.print("@"); } // makeshift escaping for Miga: out.print(getPropertyLabel(relatedProperty.left).replace("@", "@")); count++; } out.print("\""); }
[ "private", "void", "printRelatedProperties", "(", "PrintStream", "out", ",", "UsageRecord", "usageRecord", ")", "{", "List", "<", "ImmutablePair", "<", "PropertyIdValue", ",", "Double", ">", ">", "list", "=", "new", "ArrayList", "<", "ImmutablePair", "<", "PropertyIdValue", ",", "Double", ">", ">", "(", "usageRecord", ".", "propertyCoCounts", ".", "size", "(", ")", ")", ";", "for", "(", "Entry", "<", "PropertyIdValue", ",", "Integer", ">", "coCountEntry", ":", "usageRecord", ".", "propertyCoCounts", ".", "entrySet", "(", ")", ")", "{", "double", "otherThisItemRate", "=", "(", "double", ")", "coCountEntry", ".", "getValue", "(", ")", "/", "usageRecord", ".", "itemCount", ";", "double", "otherGlobalItemRate", "=", "(", "double", ")", "this", ".", "propertyRecords", ".", "get", "(", "coCountEntry", ".", "getKey", "(", ")", ")", ".", "itemCount", "/", "this", ".", "countPropertyItems", ";", "double", "otherThisItemRateStep", "=", "1", "/", "(", "1", "+", "Math", ".", "exp", "(", "6", "*", "(", "-", "2", "*", "otherThisItemRate", "+", "0.5", ")", ")", ")", ";", "double", "otherInvGlobalItemRateStep", "=", "1", "/", "(", "1", "+", "Math", ".", "exp", "(", "6", "*", "(", "-", "2", "*", "(", "1", "-", "otherGlobalItemRate", ")", "+", "0.5", ")", ")", ")", ";", "list", ".", "add", "(", "new", "ImmutablePair", "<", "PropertyIdValue", ",", "Double", ">", "(", "coCountEntry", ".", "getKey", "(", ")", ",", "otherThisItemRateStep", "*", "otherInvGlobalItemRateStep", "*", "otherThisItemRate", "/", "otherGlobalItemRate", ")", ")", ";", "}", "Collections", ".", "sort", "(", "list", ",", "new", "Comparator", "<", "ImmutablePair", "<", "PropertyIdValue", ",", "Double", ">", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "ImmutablePair", "<", "PropertyIdValue", ",", "Double", ">", "o1", ",", "ImmutablePair", "<", "PropertyIdValue", ",", "Double", ">", "o2", ")", "{", "return", "o2", ".", "getValue", "(", ")", ".", "compareTo", "(", "o1", ".", "getValue", "(", ")", ")", ";", "}", "}", ")", ";", "out", ".", "print", "(", "\",\\\"\"", ")", ";", "int", "count", "=", "0", ";", "for", "(", "ImmutablePair", "<", "PropertyIdValue", ",", "Double", ">", "relatedProperty", ":", "list", ")", "{", "if", "(", "relatedProperty", ".", "right", "<", "1.5", ")", "{", "break", ";", "}", "if", "(", "count", ">", "0", ")", "{", "out", ".", "print", "(", "\"@\"", ")", ";", "}", "// makeshift escaping for Miga:", "out", ".", "print", "(", "getPropertyLabel", "(", "relatedProperty", ".", "left", ")", ".", "replace", "(", "\"@\"", ",", "\"@\"))", ";", "", "", "count", "++", ";", "}", "out", ".", "print", "(", "\"\\\"\"", ")", ";", "}" ]
Prints a list of related properties to the output. The list is encoded as a single CSV value, using "@" as a separator. Miga can decode this. Standard CSV processors do not support lists of entries as values, however. @param out the output to write to @param usageRecord the data to write
[ "Prints", "a", "list", "of", "related", "properties", "to", "the", "output", ".", "The", "list", "is", "encoded", "as", "a", "single", "CSV", "value", "using", "@", "as", "a", "separator", ".", "Miga", "can", "decode", "this", ".", "Standard", "CSV", "processors", "do", "not", "support", "lists", "of", "entries", "as", "values", "however", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java#L798-L844
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.createXMethod
public static XMethod createXMethod(InvokeInstruction invokeInstruction, ConstantPoolGen cpg) { """ Create an XMethod object from an InvokeInstruction. @param invokeInstruction the InvokeInstruction @param cpg ConstantPoolGen from the class containing the instruction @return XMethod representing the method called by the InvokeInstruction """ String className = invokeInstruction.getClassName(cpg); String methodName = invokeInstruction.getName(cpg); String methodSig = invokeInstruction.getSignature(cpg); if (invokeInstruction instanceof INVOKEDYNAMIC) { // XXX the lambda representation makes no sense for XMethod // "classical" instruction attributes are filled with garbage, causing // the code later to produce crazy errors (looking for non existing types etc) // We should NOT be called here from our code, but 3rd party code still may // use this method. So *at least* provide a valid class name, which is // (don't ask me why) is encoded in the first argument type of the lambda // className = invokeInstruction.getArgumentTypes(cpg)[0].toString(); className = Values.DOTTED_JAVA_LANG_OBJECT; } return createXMethod(className, methodName, methodSig, invokeInstruction.getOpcode() == Const.INVOKESTATIC); }
java
public static XMethod createXMethod(InvokeInstruction invokeInstruction, ConstantPoolGen cpg) { String className = invokeInstruction.getClassName(cpg); String methodName = invokeInstruction.getName(cpg); String methodSig = invokeInstruction.getSignature(cpg); if (invokeInstruction instanceof INVOKEDYNAMIC) { // XXX the lambda representation makes no sense for XMethod // "classical" instruction attributes are filled with garbage, causing // the code later to produce crazy errors (looking for non existing types etc) // We should NOT be called here from our code, but 3rd party code still may // use this method. So *at least* provide a valid class name, which is // (don't ask me why) is encoded in the first argument type of the lambda // className = invokeInstruction.getArgumentTypes(cpg)[0].toString(); className = Values.DOTTED_JAVA_LANG_OBJECT; } return createXMethod(className, methodName, methodSig, invokeInstruction.getOpcode() == Const.INVOKESTATIC); }
[ "public", "static", "XMethod", "createXMethod", "(", "InvokeInstruction", "invokeInstruction", ",", "ConstantPoolGen", "cpg", ")", "{", "String", "className", "=", "invokeInstruction", ".", "getClassName", "(", "cpg", ")", ";", "String", "methodName", "=", "invokeInstruction", ".", "getName", "(", "cpg", ")", ";", "String", "methodSig", "=", "invokeInstruction", ".", "getSignature", "(", "cpg", ")", ";", "if", "(", "invokeInstruction", "instanceof", "INVOKEDYNAMIC", ")", "{", "// XXX the lambda representation makes no sense for XMethod", "// \"classical\" instruction attributes are filled with garbage, causing", "// the code later to produce crazy errors (looking for non existing types etc)", "// We should NOT be called here from our code, but 3rd party code still may", "// use this method. So *at least* provide a valid class name, which is", "// (don't ask me why) is encoded in the first argument type of the lambda", "// className = invokeInstruction.getArgumentTypes(cpg)[0].toString();", "className", "=", "Values", ".", "DOTTED_JAVA_LANG_OBJECT", ";", "}", "return", "createXMethod", "(", "className", ",", "methodName", ",", "methodSig", ",", "invokeInstruction", ".", "getOpcode", "(", ")", "==", "Const", ".", "INVOKESTATIC", ")", ";", "}" ]
Create an XMethod object from an InvokeInstruction. @param invokeInstruction the InvokeInstruction @param cpg ConstantPoolGen from the class containing the instruction @return XMethod representing the method called by the InvokeInstruction
[ "Create", "an", "XMethod", "object", "from", "an", "InvokeInstruction", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L616-L631
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java
JdbcControlImpl.onRelease
@EventHandler(field = "_resourceContext", eventSet = ResourceContext.ResourceEvents.class, eventName = "onRelease") public void onRelease() { """ Invoked by the controls runtime when an instance of this class is released by the runtime """ if (LOGGER.isDebugEnabled()) { LOGGER.debug("Enter: onRelease()"); } for (PreparedStatement ps : getResources()) { try { ps.close(); } catch (SQLException sqe) { } } getResources().clear(); if (_connection != null) { try { _connection.close(); } catch (SQLException e) { throw new ControlException("SQL Exception while attempting to close database connection.", e); } } _connection = null; _connectionDataSource = null; _connectionDriver = null; }
java
@EventHandler(field = "_resourceContext", eventSet = ResourceContext.ResourceEvents.class, eventName = "onRelease") public void onRelease() { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Enter: onRelease()"); } for (PreparedStatement ps : getResources()) { try { ps.close(); } catch (SQLException sqe) { } } getResources().clear(); if (_connection != null) { try { _connection.close(); } catch (SQLException e) { throw new ControlException("SQL Exception while attempting to close database connection.", e); } } _connection = null; _connectionDataSource = null; _connectionDriver = null; }
[ "@", "EventHandler", "(", "field", "=", "\"_resourceContext\"", ",", "eventSet", "=", "ResourceContext", ".", "ResourceEvents", ".", "class", ",", "eventName", "=", "\"onRelease\"", ")", "public", "void", "onRelease", "(", ")", "{", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"Enter: onRelease()\"", ")", ";", "}", "for", "(", "PreparedStatement", "ps", ":", "getResources", "(", ")", ")", "{", "try", "{", "ps", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "sqe", ")", "{", "}", "}", "getResources", "(", ")", ".", "clear", "(", ")", ";", "if", "(", "_connection", "!=", "null", ")", "{", "try", "{", "_connection", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "ControlException", "(", "\"SQL Exception while attempting to close database connection.\"", ",", "e", ")", ";", "}", "}", "_connection", "=", "null", ";", "_connectionDataSource", "=", "null", ";", "_connectionDriver", "=", "null", ";", "}" ]
Invoked by the controls runtime when an instance of this class is released by the runtime
[ "Invoked", "by", "the", "controls", "runtime", "when", "an", "instance", "of", "this", "class", "is", "released", "by", "the", "runtime" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/JdbcControlImpl.java#L120-L146
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaGraphicsUnmapResources
public static int cudaGraphicsUnmapResources(int count, cudaGraphicsResource resources[], cudaStream_t stream) { """ Unmap graphics resources. <pre> cudaError_t cudaGraphicsUnmapResources ( int count, cudaGraphicsResource_t* resources, cudaStream_t stream = 0 ) </pre> <div> <p>Unmap graphics resources. Unmaps the <tt>count</tt> graphics resources in <tt>resources</tt>. </p> <p>Once unmapped, the resources in <tt>resources</tt> may not be accessed by CUDA until they are mapped again. </p> <p>This function provides the synchronization guarantee that any CUDA work issued in <tt>stream</tt> before cudaGraphicsUnmapResources() will complete before any subsequently issued graphics work begins. </p> <p>If <tt>resources</tt> contains any duplicate entries then cudaErrorInvalidResourceHandle is returned. If any of <tt>resources</tt> are not presently mapped for access by CUDA then cudaErrorUnknown is returned. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param count Number of resources to unmap @param resources Resources to unmap @param stream Stream for synchronization @return cudaSuccess, cudaErrorInvalidResourceHandle, cudaErrorUnknown @see JCuda#cudaGraphicsMapResources """ return checkResult(cudaGraphicsUnmapResourcesNative(count, resources, stream)); }
java
public static int cudaGraphicsUnmapResources(int count, cudaGraphicsResource resources[], cudaStream_t stream) { return checkResult(cudaGraphicsUnmapResourcesNative(count, resources, stream)); }
[ "public", "static", "int", "cudaGraphicsUnmapResources", "(", "int", "count", ",", "cudaGraphicsResource", "resources", "[", "]", ",", "cudaStream_t", "stream", ")", "{", "return", "checkResult", "(", "cudaGraphicsUnmapResourcesNative", "(", "count", ",", "resources", ",", "stream", ")", ")", ";", "}" ]
Unmap graphics resources. <pre> cudaError_t cudaGraphicsUnmapResources ( int count, cudaGraphicsResource_t* resources, cudaStream_t stream = 0 ) </pre> <div> <p>Unmap graphics resources. Unmaps the <tt>count</tt> graphics resources in <tt>resources</tt>. </p> <p>Once unmapped, the resources in <tt>resources</tt> may not be accessed by CUDA until they are mapped again. </p> <p>This function provides the synchronization guarantee that any CUDA work issued in <tt>stream</tt> before cudaGraphicsUnmapResources() will complete before any subsequently issued graphics work begins. </p> <p>If <tt>resources</tt> contains any duplicate entries then cudaErrorInvalidResourceHandle is returned. If any of <tt>resources</tt> are not presently mapped for access by CUDA then cudaErrorUnknown is returned. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param count Number of resources to unmap @param resources Resources to unmap @param stream Stream for synchronization @return cudaSuccess, cudaErrorInvalidResourceHandle, cudaErrorUnknown @see JCuda#cudaGraphicsMapResources
[ "Unmap", "graphics", "resources", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L11559-L11562
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java
CommonOps_DDF2.multTransAB
public static void multTransAB( double alpha , DMatrix2x2 a , DMatrix2x2 b , DMatrix2x2 c) { """ <p> Performs the following operation:<br> <br> c = &alpha;*a<sup>T</sup> * b<sup>T</sup><br> c<sub>ij</sub> = &alpha;*&sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>jk</sub>} </p> @param alpha Scaling factor. @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified. """ c.a11 = alpha*(a.a11*b.a11 + a.a21*b.a12); c.a12 = alpha*(a.a11*b.a21 + a.a21*b.a22); c.a21 = alpha*(a.a12*b.a11 + a.a22*b.a12); c.a22 = alpha*(a.a12*b.a21 + a.a22*b.a22); }
java
public static void multTransAB( double alpha , DMatrix2x2 a , DMatrix2x2 b , DMatrix2x2 c) { c.a11 = alpha*(a.a11*b.a11 + a.a21*b.a12); c.a12 = alpha*(a.a11*b.a21 + a.a21*b.a22); c.a21 = alpha*(a.a12*b.a11 + a.a22*b.a12); c.a22 = alpha*(a.a12*b.a21 + a.a22*b.a22); }
[ "public", "static", "void", "multTransAB", "(", "double", "alpha", ",", "DMatrix2x2", "a", ",", "DMatrix2x2", "b", ",", "DMatrix2x2", "c", ")", "{", "c", ".", "a11", "=", "alpha", "*", "(", "a", ".", "a11", "*", "b", ".", "a11", "+", "a", ".", "a21", "*", "b", ".", "a12", ")", ";", "c", ".", "a12", "=", "alpha", "*", "(", "a", ".", "a11", "*", "b", ".", "a21", "+", "a", ".", "a21", "*", "b", ".", "a22", ")", ";", "c", ".", "a21", "=", "alpha", "*", "(", "a", ".", "a12", "*", "b", ".", "a11", "+", "a", ".", "a22", "*", "b", ".", "a12", ")", ";", "c", ".", "a22", "=", "alpha", "*", "(", "a", ".", "a12", "*", "b", ".", "a21", "+", "a", ".", "a22", "*", "b", ".", "a22", ")", ";", "}" ]
<p> Performs the following operation:<br> <br> c = &alpha;*a<sup>T</sup> * b<sup>T</sup><br> c<sub>ij</sub> = &alpha;*&sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>jk</sub>} </p> @param alpha Scaling factor. @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "&alpha", ";", "*", "a<sup", ">", "T<", "/", "sup", ">", "*", "b<sup", ">", "T<", "/", "sup", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&alpha", ";", "*", "&sum", ";", "<sub", ">", "k", "=", "1", ":", "n<", "/", "sub", ">", "{", "a<sub", ">", "ki<", "/", "sub", ">", "*", "b<sub", ">", "jk<", "/", "sub", ">", "}", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L325-L330
micronaut-projects/micronaut-core
inject-java/src/main/java/io/micronaut/annotation/processing/AnnotationUtils.java
AnnotationUtils.getAnnotationMetadata
public AnnotationMetadata getAnnotationMetadata(Element parent, Element element) { """ Get the annotation metadata for the given element. @param parent The parent @param element The element @return The {@link AnnotationMetadata} """ return newAnnotationBuilder().buildForParent(parent, element); }
java
public AnnotationMetadata getAnnotationMetadata(Element parent, Element element) { return newAnnotationBuilder().buildForParent(parent, element); }
[ "public", "AnnotationMetadata", "getAnnotationMetadata", "(", "Element", "parent", ",", "Element", "element", ")", "{", "return", "newAnnotationBuilder", "(", ")", ".", "buildForParent", "(", "parent", ",", "element", ")", ";", "}" ]
Get the annotation metadata for the given element. @param parent The parent @param element The element @return The {@link AnnotationMetadata}
[ "Get", "the", "annotation", "metadata", "for", "the", "given", "element", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/AnnotationUtils.java#L210-L212
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/UriUtils.java
UriUtils.urlToUri
public static URI urlToUri( String urlAsString ) throws URISyntaxException { """ Builds an URI from an URL string (with an handle for URLs not compliant with RFC 2396). @param urlAsString an URL as a string @return an URI @throws URISyntaxException if the URI is invalid and could not be repaired """ URL url; try { url = new URL( urlAsString ); } catch( Exception e ) { throw new URISyntaxException( urlAsString, "Invalid URL." ); } return urlToUri( url ); }
java
public static URI urlToUri( String urlAsString ) throws URISyntaxException { URL url; try { url = new URL( urlAsString ); } catch( Exception e ) { throw new URISyntaxException( urlAsString, "Invalid URL." ); } return urlToUri( url ); }
[ "public", "static", "URI", "urlToUri", "(", "String", "urlAsString", ")", "throws", "URISyntaxException", "{", "URL", "url", ";", "try", "{", "url", "=", "new", "URL", "(", "urlAsString", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "URISyntaxException", "(", "urlAsString", ",", "\"Invalid URL.\"", ")", ";", "}", "return", "urlToUri", "(", "url", ")", ";", "}" ]
Builds an URI from an URL string (with an handle for URLs not compliant with RFC 2396). @param urlAsString an URL as a string @return an URI @throws URISyntaxException if the URI is invalid and could not be repaired
[ "Builds", "an", "URI", "from", "an", "URL", "string", "(", "with", "an", "handle", "for", "URLs", "not", "compliant", "with", "RFC", "2396", ")", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/UriUtils.java#L87-L98
korpling/ANNIS
annis-visualizers/src/main/java/annis/visualizers/iframe/partitur/TimeHelper.java
TimeHelper.getTimePosition
private String getTimePosition(String time, boolean first) { """ Split a time annotation s.ms-(s.ms)? Whether the flag first is set to true, we return the first value, otherwise we did try to return the second. The end time don't have to be annotated, in this case it returns "undefined". Without a defined start time the result is an empty String "undefined". If there is no time anno, it returns undefined @return "undefined", when time parameter is undefined """ if (time == null) { return "undefined"; } String[] splittedTimeAnno = time.split("-"); if (splittedTimeAnno.length > 1) { if (first) { return splittedTimeAnno[0].equals("") ? "undefined" : splittedTimeAnno[0]; } else { return splittedTimeAnno[1].equals("") ? "undefined" : splittedTimeAnno[1]; } } if (first) { return splittedTimeAnno[0].equals("") ? "undefined" : splittedTimeAnno[0]; } // if we want the end time, return undefined. return "undefined"; }
java
private String getTimePosition(String time, boolean first) { if (time == null) { return "undefined"; } String[] splittedTimeAnno = time.split("-"); if (splittedTimeAnno.length > 1) { if (first) { return splittedTimeAnno[0].equals("") ? "undefined" : splittedTimeAnno[0]; } else { return splittedTimeAnno[1].equals("") ? "undefined" : splittedTimeAnno[1]; } } if (first) { return splittedTimeAnno[0].equals("") ? "undefined" : splittedTimeAnno[0]; } // if we want the end time, return undefined. return "undefined"; }
[ "private", "String", "getTimePosition", "(", "String", "time", ",", "boolean", "first", ")", "{", "if", "(", "time", "==", "null", ")", "{", "return", "\"undefined\"", ";", "}", "String", "[", "]", "splittedTimeAnno", "=", "time", ".", "split", "(", "\"-\"", ")", ";", "if", "(", "splittedTimeAnno", ".", "length", ">", "1", ")", "{", "if", "(", "first", ")", "{", "return", "splittedTimeAnno", "[", "0", "]", ".", "equals", "(", "\"\"", ")", "?", "\"undefined\"", ":", "splittedTimeAnno", "[", "0", "]", ";", "}", "else", "{", "return", "splittedTimeAnno", "[", "1", "]", ".", "equals", "(", "\"\"", ")", "?", "\"undefined\"", ":", "splittedTimeAnno", "[", "1", "]", ";", "}", "}", "if", "(", "first", ")", "{", "return", "splittedTimeAnno", "[", "0", "]", ".", "equals", "(", "\"\"", ")", "?", "\"undefined\"", ":", "splittedTimeAnno", "[", "0", "]", ";", "}", "// if we want the end time, return undefined.", "return", "\"undefined\"", ";", "}" ]
Split a time annotation s.ms-(s.ms)? Whether the flag first is set to true, we return the first value, otherwise we did try to return the second. The end time don't have to be annotated, in this case it returns "undefined". Without a defined start time the result is an empty String "undefined". If there is no time anno, it returns undefined @return "undefined", when time parameter is undefined
[ "Split", "a", "time", "annotation", "s", ".", "ms", "-", "(", "s", ".", "ms", ")", "?", "Whether", "the", "flag", "first", "is", "set", "to", "true", "we", "return", "the", "first", "value", "otherwise", "we", "did", "try", "to", "return", "the", "second", ".", "The", "end", "time", "don", "t", "have", "to", "be", "annotated", "in", "this", "case", "it", "returns", "undefined", ".", "Without", "a", "defined", "start", "time", "the", "result", "is", "an", "empty", "String", "undefined", ".", "If", "there", "is", "no", "time", "anno", "it", "returns", "undefined" ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-visualizers/src/main/java/annis/visualizers/iframe/partitur/TimeHelper.java#L60-L90
signalapp/libsignal-service-java
java/src/main/java/org/whispersystems/signalservice/api/SignalServiceAccountManager.java
SignalServiceAccountManager.requestVoiceVerificationCode
public void requestVoiceVerificationCode(Locale locale, Optional<String> captchaToken) throws IOException { """ Request a Voice verification code. On success, the server will make a voice call to this Signal user. @throws IOException """ this.pushServiceSocket.requestVoiceVerificationCode(locale, captchaToken); }
java
public void requestVoiceVerificationCode(Locale locale, Optional<String> captchaToken) throws IOException { this.pushServiceSocket.requestVoiceVerificationCode(locale, captchaToken); }
[ "public", "void", "requestVoiceVerificationCode", "(", "Locale", "locale", ",", "Optional", "<", "String", ">", "captchaToken", ")", "throws", "IOException", "{", "this", ".", "pushServiceSocket", ".", "requestVoiceVerificationCode", "(", "locale", ",", "captchaToken", ")", ";", "}" ]
Request a Voice verification code. On success, the server will make a voice call to this Signal user. @throws IOException
[ "Request", "a", "Voice", "verification", "code", ".", "On", "success", "the", "server", "will", "make", "a", "voice", "call", "to", "this", "Signal", "user", "." ]
train
https://github.com/signalapp/libsignal-service-java/blob/64f1150c5e4062d67d31c9a2a9c3a0237d022902/java/src/main/java/org/whispersystems/signalservice/api/SignalServiceAccountManager.java#L147-L149