repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java
HostControllerConnection.asyncReconnect
synchronized void asyncReconnect(final URI reconnectUri, String authKey, final ReconnectCallback callback) { if (getState() != State.OPEN) { return; } // Update the configuration with the new credentials final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration); config.setCallbackHandler(createClientCallbackHandler(userName, authKey)); config.setUri(reconnectUri); this.configuration = config; final ReconnectRunner reconnectTask = this.reconnectRunner; if (reconnectTask == null) { final ReconnectRunner task = new ReconnectRunner(); task.callback = callback; task.future = executorService.submit(task); } else { reconnectTask.callback = callback; } }
java
synchronized void asyncReconnect(final URI reconnectUri, String authKey, final ReconnectCallback callback) { if (getState() != State.OPEN) { return; } // Update the configuration with the new credentials final ProtocolConnectionConfiguration config = ProtocolConnectionConfiguration.copy(configuration); config.setCallbackHandler(createClientCallbackHandler(userName, authKey)); config.setUri(reconnectUri); this.configuration = config; final ReconnectRunner reconnectTask = this.reconnectRunner; if (reconnectTask == null) { final ReconnectRunner task = new ReconnectRunner(); task.callback = callback; task.future = executorService.submit(task); } else { reconnectTask.callback = callback; } }
[ "synchronized", "void", "asyncReconnect", "(", "final", "URI", "reconnectUri", ",", "String", "authKey", ",", "final", "ReconnectCallback", "callback", ")", "{", "if", "(", "getState", "(", ")", "!=", "State", ".", "OPEN", ")", "{", "return", ";", "}", "//...
This continuously tries to reconnect in a separate thread and will only stop if the connection was established successfully or the server gets shutdown. If there is currently a reconnect task active the connection paramaters and callback will get updated. @param reconnectUri the updated connection uri @param authKey the updated authentication key @param callback the current callback
[ "This", "continuously", "tries", "to", "reconnect", "in", "a", "separate", "thread", "and", "will", "only", "stop", "if", "the", "connection", "was", "established", "successfully", "or", "the", "server", "gets", "shutdown", ".", "If", "there", "is", "currently...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/mgmt/domain/HostControllerConnection.java#L152-L170
janus-project/guava.janusproject.io
guava/src/com/google/common/primitives/UnsignedInteger.java
UnsignedInteger.dividedBy
@CheckReturnValue public UnsignedInteger dividedBy(UnsignedInteger val) { return fromIntBits(UnsignedInts.divide(value, checkNotNull(val).value)); }
java
@CheckReturnValue public UnsignedInteger dividedBy(UnsignedInteger val) { return fromIntBits(UnsignedInts.divide(value, checkNotNull(val).value)); }
[ "@", "CheckReturnValue", "public", "UnsignedInteger", "dividedBy", "(", "UnsignedInteger", "val", ")", "{", "return", "fromIntBits", "(", "UnsignedInts", ".", "divide", "(", "value", ",", "checkNotNull", "(", "val", ")", ".", "value", ")", ")", ";", "}" ]
Returns the result of dividing this by {@code val}. @throws ArithmeticException if {@code val} is zero @since 14.0
[ "Returns", "the", "result", "of", "dividing", "this", "by", "{", "@code", "val", "}", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/primitives/UnsignedInteger.java#L159-L162
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/StoredServerChannel.java
StoredServerChannel.setConnectedHandler
synchronized PaymentChannelServer setConnectedHandler(PaymentChannelServer connectedHandler, boolean override) { if (this.connectedHandler != null && !override) return this.connectedHandler; this.connectedHandler = connectedHandler; return connectedHandler; }
java
synchronized PaymentChannelServer setConnectedHandler(PaymentChannelServer connectedHandler, boolean override) { if (this.connectedHandler != null && !override) return this.connectedHandler; this.connectedHandler = connectedHandler; return connectedHandler; }
[ "synchronized", "PaymentChannelServer", "setConnectedHandler", "(", "PaymentChannelServer", "connectedHandler", ",", "boolean", "override", ")", "{", "if", "(", "this", ".", "connectedHandler", "!=", "null", "&&", "!", "override", ")", "return", "this", ".", "connec...
Attempts to connect the given handler to this, returning true if it is the new handler, false if there was already one attached.
[ "Attempts", "to", "connect", "the", "given", "handler", "to", "this", "returning", "true", "if", "it", "is", "the", "new", "handler", "false", "if", "there", "was", "already", "one", "attached", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/StoredServerChannel.java#L78-L83
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.writeObjectToFile
public static File writeObjectToFile(Object o, String filename) throws IOException { return writeObjectToFile(o, new File(filename)); }
java
public static File writeObjectToFile(Object o, String filename) throws IOException { return writeObjectToFile(o, new File(filename)); }
[ "public", "static", "File", "writeObjectToFile", "(", "Object", "o", ",", "String", "filename", ")", "throws", "IOException", "{", "return", "writeObjectToFile", "(", "o", ",", "new", "File", "(", "filename", ")", ")", ";", "}" ]
Write object to a file with the specified name. @param o object to be written to file @param filename name of the temp file @throws IOException If can't write file. @return File containing the object
[ "Write", "object", "to", "a", "file", "with", "the", "specified", "name", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L44-L47
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/ApkParsers.java
ApkParsers.getMetaInfo
public static ApkMeta getMetaInfo(String apkFilePath, Locale locale) throws IOException { try (ApkFile apkFile = new ApkFile(apkFilePath)) { apkFile.setPreferredLocale(locale); return apkFile.getApkMeta(); } }
java
public static ApkMeta getMetaInfo(String apkFilePath, Locale locale) throws IOException { try (ApkFile apkFile = new ApkFile(apkFilePath)) { apkFile.setPreferredLocale(locale); return apkFile.getApkMeta(); } }
[ "public", "static", "ApkMeta", "getMetaInfo", "(", "String", "apkFilePath", ",", "Locale", "locale", ")", "throws", "IOException", "{", "try", "(", "ApkFile", "apkFile", "=", "new", "ApkFile", "(", "apkFilePath", ")", ")", "{", "apkFile", ".", "setPreferredLoc...
Get apk meta info for apk file, with locale @throws IOException
[ "Get", "apk", "meta", "info", "for", "apk", "file", "with", "locale" ]
train
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/ApkParsers.java#L68-L73
zaproxy/zaproxy
src/org/parosproxy/paros/core/scanner/VariantGWTQuery.java
VariantGWTQuery.getEscapedValue
@Override public String getEscapedValue(String value, boolean toQuote) { // Escape special characters StringBuilder buf = new StringBuilder(value.length()); int idx = 0; int ch; while (idx < value.length()) { ch = value.charAt(idx++); if (ch == 0) { buf.append("\\0"); } else if (ch == 92) { // backslash buf.append("\\\\"); } else if (ch == 124) { // vertical bar // 124 = "|" = AbstractSerializationStream.RPC_SEPARATOR_CHAR buf.append("\\!"); } else if ((ch >= 0xD800) && (ch < 0xFFFF)) { buf.append(String.format("\\u%04x", ch)); } else { buf.append((char) ch); } } return buf.toString(); }
java
@Override public String getEscapedValue(String value, boolean toQuote) { // Escape special characters StringBuilder buf = new StringBuilder(value.length()); int idx = 0; int ch; while (idx < value.length()) { ch = value.charAt(idx++); if (ch == 0) { buf.append("\\0"); } else if (ch == 92) { // backslash buf.append("\\\\"); } else if (ch == 124) { // vertical bar // 124 = "|" = AbstractSerializationStream.RPC_SEPARATOR_CHAR buf.append("\\!"); } else if ((ch >= 0xD800) && (ch < 0xFFFF)) { buf.append(String.format("\\u%04x", ch)); } else { buf.append((char) ch); } } return buf.toString(); }
[ "@", "Override", "public", "String", "getEscapedValue", "(", "String", "value", ",", "boolean", "toQuote", ")", "{", "// Escape special characters\r", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "value", ".", "length", "(", ")", ")", ";", "int", ...
Escape a GWT string according to the client implementation found on com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter http://www.gwtproject.org/ @param value the value that need to be escaped @param toQuote @return
[ "Escape", "a", "GWT", "string", "according", "to", "the", "client", "implementation", "found", "on", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "impl", ".", "ClientSerializationStreamWriter", "http", ":", "//", "www", "....
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/core/scanner/VariantGWTQuery.java#L129-L157
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getDistance
public static final double getDistance(Atom a, Atom b) { double x = a.getX() - b.getX(); double y = a.getY() - b.getY(); double z = a.getZ() - b.getZ(); double s = x * x + y * y + z * z; return Math.sqrt(s); }
java
public static final double getDistance(Atom a, Atom b) { double x = a.getX() - b.getX(); double y = a.getY() - b.getY(); double z = a.getZ() - b.getZ(); double s = x * x + y * y + z * z; return Math.sqrt(s); }
[ "public", "static", "final", "double", "getDistance", "(", "Atom", "a", ",", "Atom", "b", ")", "{", "double", "x", "=", "a", ".", "getX", "(", ")", "-", "b", ".", "getX", "(", ")", ";", "double", "y", "=", "a", ".", "getY", "(", ")", "-", "b"...
calculate distance between two atoms. @param a an Atom object @param b an Atom object @return a double
[ "calculate", "distance", "between", "two", "atoms", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L68-L76
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/report/BaseParserScreen.java
BaseParserScreen.printData
public boolean printData(PrintWriter out, int iPrintOptions) { if (this.getProperty(DBParams.XML) != null) return this.getScreenFieldView().printData(out, iPrintOptions); else return super.printData(out, iPrintOptions); }
java
public boolean printData(PrintWriter out, int iPrintOptions) { if (this.getProperty(DBParams.XML) != null) return this.getScreenFieldView().printData(out, iPrintOptions); else return super.printData(out, iPrintOptions); }
[ "public", "boolean", "printData", "(", "PrintWriter", "out", ",", "int", "iPrintOptions", ")", "{", "if", "(", "this", ".", "getProperty", "(", "DBParams", ".", "XML", ")", "!=", "null", ")", "return", "this", ".", "getScreenFieldView", "(", ")", ".", "p...
Display this screen in html input format. @return true if default params were found for this form. @param out The http output stream. @exception DBException File exception.
[ "Display", "this", "screen", "in", "html", "input", "format", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/report/BaseParserScreen.java#L131-L137
ModeShape/modeshape
web/modeshape-web-explorer/src/main/java/org/modeshape/web/client/Console.java
Console.changePathInURL
public void changePathInURL(String path, boolean changeHistory) { jcrURL.setPath(path); if (changeHistory) { htmlHistory.newItem(jcrURL.toString(), false); } }
java
public void changePathInURL(String path, boolean changeHistory) { jcrURL.setPath(path); if (changeHistory) { htmlHistory.newItem(jcrURL.toString(), false); } }
[ "public", "void", "changePathInURL", "(", "String", "path", ",", "boolean", "changeHistory", ")", "{", "jcrURL", ".", "setPath", "(", "path", ")", ";", "if", "(", "changeHistory", ")", "{", "htmlHistory", ".", "newItem", "(", "jcrURL", ".", "toString", "("...
Changes node path in the URL displayed by browser. @param path the path to the node. @param changeHistory if true store URL changes in browser's history.
[ "Changes", "node", "path", "in", "the", "URL", "displayed", "by", "browser", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/client/Console.java#L276-L281
perwendel/spark
src/main/java/spark/utils/urldecoding/TypeUtil.java
TypeUtil.parseInt
public static int parseInt(String s, int offset, int length, int base) throws NumberFormatException { int value = 0; if (length < 0) { length = s.length() - offset; } for (int i = 0; i < length; i++) { char c = s.charAt(offset + i); int digit = convertHexDigit((int) c); if (digit < 0 || digit >= base) { throw new NumberFormatException(s.substring(offset, offset + length)); } value = value * base + digit; } return value; }
java
public static int parseInt(String s, int offset, int length, int base) throws NumberFormatException { int value = 0; if (length < 0) { length = s.length() - offset; } for (int i = 0; i < length; i++) { char c = s.charAt(offset + i); int digit = convertHexDigit((int) c); if (digit < 0 || digit >= base) { throw new NumberFormatException(s.substring(offset, offset + length)); } value = value * base + digit; } return value; }
[ "public", "static", "int", "parseInt", "(", "String", "s", ",", "int", "offset", ",", "int", "length", ",", "int", "base", ")", "throws", "NumberFormatException", "{", "int", "value", "=", "0", ";", "if", "(", "length", "<", "0", ")", "{", "length", ...
Parse an int from a substring. Negative numbers are not handled. @param s String @param offset Offset within string @param length Length of integer or -1 for remainder of string @param base base of the integer @return the parsed integer @throws NumberFormatException if the string cannot be parsed
[ "Parse", "an", "int", "from", "a", "substring", ".", "Negative", "numbers", "are", "not", "handled", "." ]
train
https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/utils/urldecoding/TypeUtil.java#L161-L179
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/DefaultTokenServices.java
DefaultTokenServices.createRefreshedAuthentication
private OAuth2Authentication createRefreshedAuthentication(OAuth2Authentication authentication, TokenRequest request) { OAuth2Authentication narrowed = authentication; Set<String> scope = request.getScope(); OAuth2Request clientAuth = authentication.getOAuth2Request().refresh(request); if (scope != null && !scope.isEmpty()) { Set<String> originalScope = clientAuth.getScope(); if (originalScope == null || !originalScope.containsAll(scope)) { throw new InvalidScopeException("Unable to narrow the scope of the client authentication to " + scope + ".", originalScope); } else { clientAuth = clientAuth.narrowScope(scope); } } narrowed = new OAuth2Authentication(clientAuth, authentication.getUserAuthentication()); return narrowed; }
java
private OAuth2Authentication createRefreshedAuthentication(OAuth2Authentication authentication, TokenRequest request) { OAuth2Authentication narrowed = authentication; Set<String> scope = request.getScope(); OAuth2Request clientAuth = authentication.getOAuth2Request().refresh(request); if (scope != null && !scope.isEmpty()) { Set<String> originalScope = clientAuth.getScope(); if (originalScope == null || !originalScope.containsAll(scope)) { throw new InvalidScopeException("Unable to narrow the scope of the client authentication to " + scope + ".", originalScope); } else { clientAuth = clientAuth.narrowScope(scope); } } narrowed = new OAuth2Authentication(clientAuth, authentication.getUserAuthentication()); return narrowed; }
[ "private", "OAuth2Authentication", "createRefreshedAuthentication", "(", "OAuth2Authentication", "authentication", ",", "TokenRequest", "request", ")", "{", "OAuth2Authentication", "narrowed", "=", "authentication", ";", "Set", "<", "String", ">", "scope", "=", "request",...
Create a refreshed authentication. @param authentication The authentication. @param request The scope for the refreshed token. @return The refreshed authentication. @throws InvalidScopeException If the scope requested is invalid or wider than the original scope.
[ "Create", "a", "refreshed", "authentication", "." ]
train
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/DefaultTokenServices.java#L196-L212
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/Criteria.java
Criteria.is
public Criteria is(@Nullable Object o) { if (o == null) { return isNull(); } predicates.add(new Predicate(OperationKey.EQUALS, o)); return this; }
java
public Criteria is(@Nullable Object o) { if (o == null) { return isNull(); } predicates.add(new Predicate(OperationKey.EQUALS, o)); return this; }
[ "public", "Criteria", "is", "(", "@", "Nullable", "Object", "o", ")", "{", "if", "(", "o", "==", "null", ")", "{", "return", "isNull", "(", ")", ";", "}", "predicates", ".", "add", "(", "new", "Predicate", "(", "OperationKey", ".", "EQUALS", ",", "...
Crates new {@link Predicate} without any wildcards. Strings with blanks will be escaped {@code "string\ with\ blank"} @param o @return
[ "Crates", "new", "{", "@link", "Predicate", "}", "without", "any", "wildcards", ".", "Strings", "with", "blanks", "will", "be", "escaped", "{", "@code", "string", "\\", "with", "\\", "blank", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L121-L127
google/closure-templates
java/src/com/google/template/soy/internal/i18n/BidiFormatter.java
BidiFormatter.estimateDirection
@VisibleForTesting static Dir estimateDirection(String str, boolean isHtml) { return BidiUtils.estimateDirection(str, isHtml); }
java
@VisibleForTesting static Dir estimateDirection(String str, boolean isHtml) { return BidiUtils.estimateDirection(str, isHtml); }
[ "@", "VisibleForTesting", "static", "Dir", "estimateDirection", "(", "String", "str", ",", "boolean", "isHtml", ")", "{", "return", "BidiUtils", ".", "estimateDirection", "(", "str", ",", "isHtml", ")", ";", "}" ]
Estimates the directionality of a string using the best known general-purpose method, i.e. using relative word counts. Dir.NEUTRAL return value indicates completely neutral input. @param str String whose directionality is to be estimated @param isHtml Whether {@code str} is HTML / HTML-escaped @return {@code str}'s estimated overall directionality
[ "Estimates", "the", "directionality", "of", "a", "string", "using", "the", "best", "known", "general", "-", "purpose", "method", "i", ".", "e", ".", "using", "relative", "word", "counts", ".", "Dir", ".", "NEUTRAL", "return", "value", "indicates", "completel...
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/i18n/BidiFormatter.java#L245-L248
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java
GeometryDeserializer.asMultiPoint
private MultiPoint asMultiPoint(List<List> coords, CrsId crsId) throws IOException { if (coords == null || coords.isEmpty()) { throw new IOException("A multipoint contains at least one point"); } Point[] points = new Point[coords.size()]; for (int i = 0; i < coords.size(); i++) { points[i] = asPoint(coords.get(i), crsId); } return new MultiPoint(points); }
java
private MultiPoint asMultiPoint(List<List> coords, CrsId crsId) throws IOException { if (coords == null || coords.isEmpty()) { throw new IOException("A multipoint contains at least one point"); } Point[] points = new Point[coords.size()]; for (int i = 0; i < coords.size(); i++) { points[i] = asPoint(coords.get(i), crsId); } return new MultiPoint(points); }
[ "private", "MultiPoint", "asMultiPoint", "(", "List", "<", "List", ">", "coords", ",", "CrsId", "crsId", ")", "throws", "IOException", "{", "if", "(", "coords", "==", "null", "||", "coords", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IOExceptio...
Parses the JSON as a linestring geometry @param coords A list of coordinates of points. @param crsId @return An instance of linestring @throws IOException if the given json does not correspond to a linestring or can be parsed as such.
[ "Parses", "the", "JSON", "as", "a", "linestring", "geometry" ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java#L320-L329
mangstadt/biweekly
src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java
ICalPropertyScribe.parseJson
public final T parseJson(JCalValue value, ICalDataType dataType, ICalParameters parameters, ParseContext context) { T property = _parseJson(value, dataType, parameters, context); property.setParameters(parameters); return property; }
java
public final T parseJson(JCalValue value, ICalDataType dataType, ICalParameters parameters, ParseContext context) { T property = _parseJson(value, dataType, parameters, context); property.setParameters(parameters); return property; }
[ "public", "final", "T", "parseJson", "(", "JCalValue", "value", ",", "ICalDataType", "dataType", ",", "ICalParameters", "parameters", ",", "ParseContext", "context", ")", "{", "T", "property", "=", "_parseJson", "(", "value", ",", "dataType", ",", "parameters", ...
Unmarshals a property's value from a JSON data stream (jCal). @param value the property's JSON value @param dataType the data type @param parameters the parsed parameters @param context the context @return the unmarshalled property @throws CannotParseException if the scribe could not parse the property's value @throws SkipMeException if the property should not be added to the final {@link ICalendar} object
[ "Unmarshals", "a", "property", "s", "value", "from", "a", "JSON", "data", "stream", "(", "jCal", ")", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java#L279-L283
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitiveGroup.java
TransitiveGroup.checkTransitive
private boolean checkTransitive(String groupStart, String groupIn, String groupEnd, Collection<GroupTransition> localChecked, Deque<GroupTransition> found, boolean first) { boolean ok = false; for (final String groupOut : mapGroup.getGroups()) { final GroupTransition transitive = new GroupTransition(groupIn, groupOut); final boolean firstOrNext = first && groupIn.equals(groupStart) || !first && !groupIn.equals(groupOut); if (firstOrNext && !localChecked.contains(transitive)) { localChecked.add(transitive); final boolean nextFirst = countTransitions(groupStart, transitive, groupEnd, found, first); if (groupOut.equals(groupEnd)) { ok = true; } else { checkTransitive(groupStart, groupOut, groupEnd, localChecked, found, nextFirst); } } } return ok; }
java
private boolean checkTransitive(String groupStart, String groupIn, String groupEnd, Collection<GroupTransition> localChecked, Deque<GroupTransition> found, boolean first) { boolean ok = false; for (final String groupOut : mapGroup.getGroups()) { final GroupTransition transitive = new GroupTransition(groupIn, groupOut); final boolean firstOrNext = first && groupIn.equals(groupStart) || !first && !groupIn.equals(groupOut); if (firstOrNext && !localChecked.contains(transitive)) { localChecked.add(transitive); final boolean nextFirst = countTransitions(groupStart, transitive, groupEnd, found, first); if (groupOut.equals(groupEnd)) { ok = true; } else { checkTransitive(groupStart, groupOut, groupEnd, localChecked, found, nextFirst); } } } return ok; }
[ "private", "boolean", "checkTransitive", "(", "String", "groupStart", ",", "String", "groupIn", ",", "String", "groupEnd", ",", "Collection", "<", "GroupTransition", ">", "localChecked", ",", "Deque", "<", "GroupTransition", ">", "found", ",", "boolean", "first", ...
Check transitive groups. @param groupStart The first group. @param groupIn The local group in. @param groupEnd The last group. @param localChecked Current checked transitions. @param found Transitions found. @param first <code>true</code> if first pass, <code>false</code> else. @return <code>true</code> if transitive valid, <code>false</code> else.
[ "Check", "transitive", "groups", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/TransitiveGroup.java#L222-L250
autonomousapps/Cappuccino
cappuccino-sample/src/main/java/com/example/cappuccino/MainActivity.java
MainActivity.onClickSecondActivity
public void onClickSecondActivity(View view) { // Declare a new CappuccinoIdlingResource Cappuccino.newIdlingResourceWatcher(RESOURCE_MULTIPLE_ACTIVITIES); // Tell Cappuccino that the new resource is busy Cappuccino.markAsBusy(RESOURCE_MULTIPLE_ACTIVITIES); startActivity(new Intent(this, SecondActivity.class)); }
java
public void onClickSecondActivity(View view) { // Declare a new CappuccinoIdlingResource Cappuccino.newIdlingResourceWatcher(RESOURCE_MULTIPLE_ACTIVITIES); // Tell Cappuccino that the new resource is busy Cappuccino.markAsBusy(RESOURCE_MULTIPLE_ACTIVITIES); startActivity(new Intent(this, SecondActivity.class)); }
[ "public", "void", "onClickSecondActivity", "(", "View", "view", ")", "{", "// Declare a new CappuccinoIdlingResource", "Cappuccino", ".", "newIdlingResourceWatcher", "(", "RESOURCE_MULTIPLE_ACTIVITIES", ")", ";", "// Tell Cappuccino that the new resource is busy", "Cappuccino", "...
For some reason, we expect navigating to a new {@code Activity} to take a while (perhaps a network request is involved). Really what this is demonstrating is that a {@code CappuccinoIdlingResource} can be declared and used across multiple Activities.
[ "For", "some", "reason", "we", "expect", "navigating", "to", "a", "new", "{" ]
train
https://github.com/autonomousapps/Cappuccino/blob/9324d040b6e8cab4bf7dcf71dbd3c761ae043cd9/cappuccino-sample/src/main/java/com/example/cappuccino/MainActivity.java#L74-L82
Waikato/moa
moa/src/main/java/moa/clusterers/clustree/Node.java
Node.mergeEntries
protected void mergeEntries(int pos1, int pos2) { assert (this.numFreeEntries() == 0); assert (pos1 < pos2); this.entries[pos1].mergeWith(this.entries[pos2]); for (int i = pos2; i < entries.length - 1; i++) { entries[i] = entries[i + 1]; } entries[entries.length - 1].clear(); }
java
protected void mergeEntries(int pos1, int pos2) { assert (this.numFreeEntries() == 0); assert (pos1 < pos2); this.entries[pos1].mergeWith(this.entries[pos2]); for (int i = pos2; i < entries.length - 1; i++) { entries[i] = entries[i + 1]; } entries[entries.length - 1].clear(); }
[ "protected", "void", "mergeEntries", "(", "int", "pos1", ",", "int", "pos2", ")", "{", "assert", "(", "this", ".", "numFreeEntries", "(", ")", "==", "0", ")", ";", "assert", "(", "pos1", "<", "pos2", ")", ";", "this", ".", "entries", "[", "pos1", "...
Merge the two entries at the given position. The entries are reordered in the <code>entries</code> array so that the non-empty entries are still at the beginning. @param pos1 The position of the first entry to be merged. This position has to be smaller than the the second position. @param pos2 The position of the second entry to be merged. This position has to be greater than the the first position.
[ "Merge", "the", "two", "entries", "at", "the", "given", "position", ".", "The", "entries", "are", "reordered", "in", "the", "<code", ">", "entries<", "/", "code", ">", "array", "so", "that", "the", "non", "-", "empty", "entries", "are", "still", "at", ...
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/clustree/Node.java#L309-L319
NLPchina/elasticsearch-sql
src/main/java/org/nlpcn/es4sql/query/DefaultQueryAction.java
DefaultQueryAction.setLimit
private void setLimit(int from, int size) { request.setFrom(from); if (size > -1) { request.setSize(size); } }
java
private void setLimit(int from, int size) { request.setFrom(from); if (size > -1) { request.setSize(size); } }
[ "private", "void", "setLimit", "(", "int", "from", ",", "int", "size", ")", "{", "request", ".", "setFrom", "(", "from", ")", ";", "if", "(", "size", ">", "-", "1", ")", "{", "request", ".", "setSize", "(", "size", ")", ";", "}", "}" ]
Add from and size to the ES query based on the 'LIMIT' clause @param from starts from document at position from @param size number of documents to return.
[ "Add", "from", "and", "size", "to", "the", "ES", "query", "based", "on", "the", "LIMIT", "clause" ]
train
https://github.com/NLPchina/elasticsearch-sql/blob/eaab70b4bf1729978911b83eb96e816ebcfe6e7f/src/main/java/org/nlpcn/es4sql/query/DefaultQueryAction.java#L236-L242
brianwhu/xillium
base/src/main/java/org/xillium/base/text/Balanced.java
Balanced.indexOf
public static int indexOf(String text, int begin, int end, char target, Functor<Integer, Integer> extra) { return indexOf(text, begin, end, target, extra); }
java
public static int indexOf(String text, int begin, int end, char target, Functor<Integer, Integer> extra) { return indexOf(text, begin, end, target, extra); }
[ "public", "static", "int", "indexOf", "(", "String", "text", ",", "int", "begin", ",", "int", "end", ",", "char", "target", ",", "Functor", "<", "Integer", ",", "Integer", ">", "extra", ")", "{", "return", "indexOf", "(", "text", ",", "begin", ",", "...
Returns the index within a string of the first occurrence of the specified character, similar to String.indexOf(). However, any occurrence of the specified character enclosed between balanced parentheses/brackets/braces is ignored. @param text a String @param begin a begin offset @param end an end offset @param target the character to search for @param extra an optional functor to provide balancing symbols in addition to the standard ones @return the index of the character in the string, or -1 if the specified character is not found
[ "Returns", "the", "index", "within", "a", "string", "of", "the", "first", "occurrence", "of", "the", "specified", "character", "similar", "to", "String", ".", "indexOf", "()", ".", "However", "any", "occurrence", "of", "the", "specified", "character", "enclose...
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/text/Balanced.java#L68-L70
graphql-java/graphql-java
src/main/java/graphql/execution/FieldCollector.java
FieldCollector.collectFields
public MergedSelectionSet collectFields(FieldCollectorParameters parameters, SelectionSet selectionSet) { Map<String, MergedField> subFields = new LinkedHashMap<>(); List<String> visitedFragments = new ArrayList<>(); this.collectFields(parameters, selectionSet, visitedFragments, subFields); return newMergedSelectionSet().subFields(subFields).build(); }
java
public MergedSelectionSet collectFields(FieldCollectorParameters parameters, SelectionSet selectionSet) { Map<String, MergedField> subFields = new LinkedHashMap<>(); List<String> visitedFragments = new ArrayList<>(); this.collectFields(parameters, selectionSet, visitedFragments, subFields); return newMergedSelectionSet().subFields(subFields).build(); }
[ "public", "MergedSelectionSet", "collectFields", "(", "FieldCollectorParameters", "parameters", ",", "SelectionSet", "selectionSet", ")", "{", "Map", "<", "String", ",", "MergedField", ">", "subFields", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "List", "<"...
Given a selection set this will collect the sub-field selections and return it as a map @param parameters the parameters to this method @param selectionSet the selection set to collect on @return a map of the sub field selections
[ "Given", "a", "selection", "set", "this", "will", "collect", "the", "sub", "-", "field", "selections", "and", "return", "it", "as", "a", "map" ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/FieldCollector.java#L53-L58
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java
EmbedBuilder.setFooter
public EmbedBuilder setFooter(String text, Icon icon) { delegate.setFooter(text, icon); return this; }
java
public EmbedBuilder setFooter(String text, Icon icon) { delegate.setFooter(text, icon); return this; }
[ "public", "EmbedBuilder", "setFooter", "(", "String", "text", ",", "Icon", "icon", ")", "{", "delegate", ".", "setFooter", "(", "text", ",", "icon", ")", ";", "return", "this", ";", "}" ]
Sets the footer of the embed. @param text The text of the footer. @param icon The footer's icon. @return The current instance in order to chain call methods.
[ "Sets", "the", "footer", "of", "the", "embed", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/message/embed/EmbedBuilder.java#L131-L134
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageSaver.java
ImageSaver.saveImage
public static void saveImage(Image image, String filename, String imgFileFormat){ File f = new File(filename); if(!f.isDirectory()){ saveImage(image, f, imgFileFormat); } else { throw new ImageSaverException(new IOException(String.format("provided file name denotes a directory. %s", filename))); } }
java
public static void saveImage(Image image, String filename, String imgFileFormat){ File f = new File(filename); if(!f.isDirectory()){ saveImage(image, f, imgFileFormat); } else { throw new ImageSaverException(new IOException(String.format("provided file name denotes a directory. %s", filename))); } }
[ "public", "static", "void", "saveImage", "(", "Image", "image", ",", "String", "filename", ",", "String", "imgFileFormat", ")", "{", "File", "f", "=", "new", "File", "(", "filename", ")", ";", "if", "(", "!", "f", ".", "isDirectory", "(", ")", ")", "...
Saves image using {@link #saveImage(Image, File, String)}. @param image to be saved @param filename path to file @param imgFileFormat image file format. Consult {@link #getSaveableImageFileFormats()} @throws ImageSaverException if an IOException occured during the process, the provided filename path does refer to a directory or no appropriate writer could be found for specified format. @since 1.0
[ "Saves", "image", "using", "{" ]
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageSaver.java#L124-L131
google/closure-compiler
src/com/google/javascript/refactoring/ErrorToFixMapper.java
ErrorToFixMapper.getFixForJsError
public static SuggestedFix getFixForJsError(JSError error, AbstractCompiler compiler) { switch (error.getType().key) { case "JSC_REDECLARED_VARIABLE": return getFixForRedeclaration(error, compiler); case "JSC_REFERENCE_BEFORE_DECLARE": return getFixForEarlyReference(error, compiler); case "JSC_MISSING_SEMICOLON": return getFixForMissingSemicolon(error, compiler); case "JSC_REQUIRES_NOT_SORTED": return getFixForUnsortedRequires(error, compiler); case "JSC_PROVIDES_NOT_SORTED": return getFixForUnsortedProvides(error, compiler); case "JSC_DEBUGGER_STATEMENT_PRESENT": return removeNode(error, compiler); case "JSC_USELESS_EMPTY_STATEMENT": return removeEmptyStatement(error, compiler); case "JSC_INEXISTENT_PROPERTY": return getFixForInexistentProperty(error, compiler); case "JSC_MISSING_CALL_TO_SUPER": return getFixForMissingSuper(error, compiler); case "JSC_INVALID_SUPER_CALL_WITH_SUGGESTION": return getFixForInvalidSuper(error, compiler); case "JSC_MISSING_REQUIRE_WARNING": case "JSC_MISSING_REQUIRE_STRICT_WARNING": return getFixForMissingRequire(error, compiler); case "JSC_EXTRA_REQUIRE_WARNING": return getFixForExtraRequire(error, compiler); case "JSC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME": case "JSC_JSDOC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME": case "JSC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME": // TODO(tbreisacher): Apply this fix for JSC_JSDOC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME. return getFixForReferenceToShortImportByLongName(error, compiler); case "JSC_REDUNDANT_NULLABILITY_MODIFIER_JSDOC": return getFixForRedundantNullabilityModifierJsDoc(error, compiler); default: return null; } }
java
public static SuggestedFix getFixForJsError(JSError error, AbstractCompiler compiler) { switch (error.getType().key) { case "JSC_REDECLARED_VARIABLE": return getFixForRedeclaration(error, compiler); case "JSC_REFERENCE_BEFORE_DECLARE": return getFixForEarlyReference(error, compiler); case "JSC_MISSING_SEMICOLON": return getFixForMissingSemicolon(error, compiler); case "JSC_REQUIRES_NOT_SORTED": return getFixForUnsortedRequires(error, compiler); case "JSC_PROVIDES_NOT_SORTED": return getFixForUnsortedProvides(error, compiler); case "JSC_DEBUGGER_STATEMENT_PRESENT": return removeNode(error, compiler); case "JSC_USELESS_EMPTY_STATEMENT": return removeEmptyStatement(error, compiler); case "JSC_INEXISTENT_PROPERTY": return getFixForInexistentProperty(error, compiler); case "JSC_MISSING_CALL_TO_SUPER": return getFixForMissingSuper(error, compiler); case "JSC_INVALID_SUPER_CALL_WITH_SUGGESTION": return getFixForInvalidSuper(error, compiler); case "JSC_MISSING_REQUIRE_WARNING": case "JSC_MISSING_REQUIRE_STRICT_WARNING": return getFixForMissingRequire(error, compiler); case "JSC_EXTRA_REQUIRE_WARNING": return getFixForExtraRequire(error, compiler); case "JSC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME": case "JSC_JSDOC_REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME_INCLUDING_SHORT_NAME": case "JSC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME": // TODO(tbreisacher): Apply this fix for JSC_JSDOC_REFERENCE_TO_FULLY_QUALIFIED_IMPORT_NAME. return getFixForReferenceToShortImportByLongName(error, compiler); case "JSC_REDUNDANT_NULLABILITY_MODIFIER_JSDOC": return getFixForRedundantNullabilityModifierJsDoc(error, compiler); default: return null; } }
[ "public", "static", "SuggestedFix", "getFixForJsError", "(", "JSError", "error", ",", "AbstractCompiler", "compiler", ")", "{", "switch", "(", "error", ".", "getType", "(", ")", ".", "key", ")", "{", "case", "\"JSC_REDECLARED_VARIABLE\"", ":", "return", "getFixF...
Creates a SuggestedFix for the given error. Note that some errors have multiple fixes so getFixesForJsError should often be used instead of this.
[ "Creates", "a", "SuggestedFix", "for", "the", "given", "error", ".", "Note", "that", "some", "errors", "have", "multiple", "fixes", "so", "getFixesForJsError", "should", "often", "be", "used", "instead", "of", "this", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/ErrorToFixMapper.java#L74-L111
liyiorg/weixin-popular
src/main/java/weixin/popular/api/WxaAPI.java
WxaAPI.get_auditstatus
public static GetAuditstatusResult get_auditstatus(String access_token,String auditid){ String json = String.format("{\"auditid\":\"%s\"}",auditid); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/wxa/get_auditstatus") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(json,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,GetAuditstatusResult.class); }
java
public static GetAuditstatusResult get_auditstatus(String access_token,String auditid){ String json = String.format("{\"auditid\":\"%s\"}",auditid); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/wxa/get_auditstatus") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(json,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,GetAuditstatusResult.class); }
[ "public", "static", "GetAuditstatusResult", "get_auditstatus", "(", "String", "access_token", ",", "String", "auditid", ")", "{", "String", "json", "=", "String", ".", "format", "(", "\"{\\\"auditid\\\":\\\"%s\\\"}\"", ",", "auditid", ")", ";", "HttpUriRequest", "ht...
代码管理<br> 获取第三方提交的审核版本的审核状态(仅供第三方代小程序调用) @since 2.8.9 @param access_token access_token @param auditid 审核ID @return result
[ "代码管理<br", ">", "获取第三方提交的审核版本的审核状态(仅供第三方代小程序调用)" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/WxaAPI.java#L229-L238
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/common/Utils.java
Utils.extractReminder
public static String extractReminder(String publicURL, String accessURL) { return publicURL.substring(accessURL.length()); }
java
public static String extractReminder(String publicURL, String accessURL) { return publicURL.substring(accessURL.length()); }
[ "public", "static", "String", "extractReminder", "(", "String", "publicURL", ",", "String", "accessURL", ")", "{", "return", "publicURL", ".", "substring", "(", "accessURL", ".", "length", "(", ")", ")", ";", "}" ]
Extracts container/object from http://hostname/v1/auth_id/container/object @param publicURL pubic url @param accessURL access url @return reminder of the URI
[ "Extracts", "container", "/", "object", "from", "http", ":", "//", "hostname", "/", "v1", "/", "auth_id", "/", "container", "/", "object" ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/common/Utils.java#L458-L460
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.sqrtNewtonRaphson
private static BigDecimal sqrtNewtonRaphson(final BigDecimal c, final BigDecimal xn, final BigDecimal precision) { BigDecimal fx = xn.pow(2).add(c.negate()); BigDecimal fpx = xn.multiply(new BigDecimal(2)); BigDecimal xn1 = fx.divide(fpx, 2 * SQRT_DIG.intValue(), RoundingMode.HALF_DOWN); xn1 = xn.add(xn1.negate()); BigDecimal currentSquare = xn1.pow(2); BigDecimal currentPrecision = currentSquare.subtract(c); currentPrecision = currentPrecision.abs(); if (currentPrecision.compareTo(precision) <= -1) { return xn1; } return sqrtNewtonRaphson(c, xn1, precision); }
java
private static BigDecimal sqrtNewtonRaphson(final BigDecimal c, final BigDecimal xn, final BigDecimal precision) { BigDecimal fx = xn.pow(2).add(c.negate()); BigDecimal fpx = xn.multiply(new BigDecimal(2)); BigDecimal xn1 = fx.divide(fpx, 2 * SQRT_DIG.intValue(), RoundingMode.HALF_DOWN); xn1 = xn.add(xn1.negate()); BigDecimal currentSquare = xn1.pow(2); BigDecimal currentPrecision = currentSquare.subtract(c); currentPrecision = currentPrecision.abs(); if (currentPrecision.compareTo(precision) <= -1) { return xn1; } return sqrtNewtonRaphson(c, xn1, precision); }
[ "private", "static", "BigDecimal", "sqrtNewtonRaphson", "(", "final", "BigDecimal", "c", ",", "final", "BigDecimal", "xn", ",", "final", "BigDecimal", "precision", ")", "{", "BigDecimal", "fx", "=", "xn", ".", "pow", "(", "2", ")", ".", "add", "(", "c", ...
Private utility method used to compute the square root of a BigDecimal. @author Luciano Culacciatti @see <a href="http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal">http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal</a>
[ "Private", "utility", "method", "used", "to", "compute", "the", "square", "root", "of", "a", "BigDecimal", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L782-L794
hawkular/hawkular-commons
hawkular-command-gateway/hawkular-command-gateway-api/src/main/java/org/hawkular/cmdgw/api/ApiDeserializer.java
ApiDeserializer.toHawkularFormat
public static BinaryData toHawkularFormat(BasicMessage msg, InputStream extraData) { String msgJson = toHawkularFormat(msg); return new BinaryData(msgJson.getBytes(), extraData); }
java
public static BinaryData toHawkularFormat(BasicMessage msg, InputStream extraData) { String msgJson = toHawkularFormat(msg); return new BinaryData(msgJson.getBytes(), extraData); }
[ "public", "static", "BinaryData", "toHawkularFormat", "(", "BasicMessage", "msg", ",", "InputStream", "extraData", ")", "{", "String", "msgJson", "=", "toHawkularFormat", "(", "msg", ")", ";", "return", "new", "BinaryData", "(", "msgJson", ".", "getBytes", "(", ...
Returns a BinaryData object (which is a stream) that encodes the given message just like {@link #toHawkularFormat(BasicMessage)} does but also packages the given input stream as extra data with the JSON message. The returned object can be used to deserialize the msg and extra data via {@link #deserialize(InputStream)}. @param msg the message object that will be serialized into JSON @param extraData the extra data to be packages with the given message @return an object that can be used by other Hawkular endpoints to deserialize the message.
[ "Returns", "a", "BinaryData", "object", "(", "which", "is", "a", "stream", ")", "that", "encodes", "the", "given", "message", "just", "like", "{", "@link", "#toHawkularFormat", "(", "BasicMessage", ")", "}", "does", "but", "also", "packages", "the", "given",...
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-api/src/main/java/org/hawkular/cmdgw/api/ApiDeserializer.java#L60-L63
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSchemeManipulator.java
ReactionSchemeManipulator.extractPrecursorReaction
private static IReactionSet extractPrecursorReaction(IReaction reaction, IReactionSet reactionSet) { IReactionSet reactConSet = reaction.getBuilder().newInstance(IReactionSet.class); for (IAtomContainer reactant : reaction.getReactants().atomContainers()) { for (IReaction reactionInt : reactionSet.reactions()) { for (IAtomContainer precursor : reactionInt.getProducts().atomContainers()) { if (reactant.equals(precursor)) { reactConSet.addReaction(reactionInt); } } } } return reactConSet; }
java
private static IReactionSet extractPrecursorReaction(IReaction reaction, IReactionSet reactionSet) { IReactionSet reactConSet = reaction.getBuilder().newInstance(IReactionSet.class); for (IAtomContainer reactant : reaction.getReactants().atomContainers()) { for (IReaction reactionInt : reactionSet.reactions()) { for (IAtomContainer precursor : reactionInt.getProducts().atomContainers()) { if (reactant.equals(precursor)) { reactConSet.addReaction(reactionInt); } } } } return reactConSet; }
[ "private", "static", "IReactionSet", "extractPrecursorReaction", "(", "IReaction", "reaction", ",", "IReactionSet", "reactionSet", ")", "{", "IReactionSet", "reactConSet", "=", "reaction", ".", "getBuilder", "(", ")", ".", "newInstance", "(", "IReactionSet", ".", "c...
Extract reactions from a IReactionSet which at least one product is existing as reactant given a IReaction @param reaction The IReaction to analyze @param reactionSet The IReactionSet to inspect @return A IReactionSet containing the reactions
[ "Extract", "reactions", "from", "a", "IReactionSet", "which", "at", "least", "one", "product", "is", "existing", "as", "reactant", "given", "a", "IReaction" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSchemeManipulator.java#L210-L222
hankcs/HanLP
src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java
AbstractLexicalAnalyzer.pushPiece
private void pushPiece(String sentence, String normalized, int start, int end, byte preType, List<String> wordList) { if (preType == CharType.CT_CHINESE) { segmenter.segment(sentence.substring(start, end), normalized.substring(start, end), wordList); } else { wordList.add(sentence.substring(start, end)); } }
java
private void pushPiece(String sentence, String normalized, int start, int end, byte preType, List<String> wordList) { if (preType == CharType.CT_CHINESE) { segmenter.segment(sentence.substring(start, end), normalized.substring(start, end), wordList); } else { wordList.add(sentence.substring(start, end)); } }
[ "private", "void", "pushPiece", "(", "String", "sentence", ",", "String", "normalized", ",", "int", "start", ",", "int", "end", ",", "byte", "preType", ",", "List", "<", "String", ">", "wordList", ")", "{", "if", "(", "preType", "==", "CharType", ".", ...
CT_CHINESE区间交给统计分词,否则视作整个单位 @param sentence @param normalized @param start @param end @param preType @param wordList
[ "CT_CHINESE区间交给统计分词,否则视作整个单位" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/tokenizer/lexical/AbstractLexicalAnalyzer.java#L522-L532
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/searchindex/CmsFieldsList.java
CmsFieldsList.fillDetailField
private void fillDetailField(CmsListItem item, String detailId) { StringBuffer html = new StringBuffer(); // search for the corresponding A_CmsSearchIndex: String idxFieldName = (String)item.get(LIST_COLUMN_NAME); List<CmsSearchField> fields = OpenCms.getSearchManager().getFieldConfiguration( m_paramFieldconfiguration).getFields(); Iterator<CmsSearchField> itFields = fields.iterator(); CmsLuceneField idxField = null; while (itFields.hasNext()) { CmsLuceneField curField = (CmsLuceneField)itFields.next(); if (curField.getName().equals(idxFieldName)) { idxField = curField; } } if (idxField != null) { html.append("<ul>\n"); Iterator<I_CmsSearchFieldMapping> itMappings = idxField.getMappings().iterator(); while (itMappings.hasNext()) { CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)itMappings.next(); html.append(" <li>\n").append(" "); html.append(mapping.getType().toString()); if (CmsStringUtil.isNotEmpty(mapping.getParam())) { html.append("=").append(mapping.getParam()).append("\n"); } html.append(" </li>"); } html.append("</ul>\n"); } item.set(detailId, html.toString()); }
java
private void fillDetailField(CmsListItem item, String detailId) { StringBuffer html = new StringBuffer(); // search for the corresponding A_CmsSearchIndex: String idxFieldName = (String)item.get(LIST_COLUMN_NAME); List<CmsSearchField> fields = OpenCms.getSearchManager().getFieldConfiguration( m_paramFieldconfiguration).getFields(); Iterator<CmsSearchField> itFields = fields.iterator(); CmsLuceneField idxField = null; while (itFields.hasNext()) { CmsLuceneField curField = (CmsLuceneField)itFields.next(); if (curField.getName().equals(idxFieldName)) { idxField = curField; } } if (idxField != null) { html.append("<ul>\n"); Iterator<I_CmsSearchFieldMapping> itMappings = idxField.getMappings().iterator(); while (itMappings.hasNext()) { CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)itMappings.next(); html.append(" <li>\n").append(" "); html.append(mapping.getType().toString()); if (CmsStringUtil.isNotEmpty(mapping.getParam())) { html.append("=").append(mapping.getParam()).append("\n"); } html.append(" </li>"); } html.append("</ul>\n"); } item.set(detailId, html.toString()); }
[ "private", "void", "fillDetailField", "(", "CmsListItem", "item", ",", "String", "detailId", ")", "{", "StringBuffer", "html", "=", "new", "StringBuffer", "(", ")", ";", "// search for the corresponding A_CmsSearchIndex:", "String", "idxFieldName", "=", "(", "String",...
Fills details of the field into the given item. <p> @param item the list item to fill @param detailId the id for the detail to fill
[ "Fills", "details", "of", "the", "field", "into", "the", "given", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsFieldsList.java#L681-L713
samskivert/samskivert
src/main/java/com/samskivert/swing/util/RetryableTask.java
RetryableTask.invokeTask
public void invokeTask (Component parent, String retryMessage) throws Exception { while (true) { try { invoke(); return; } catch (Exception e) { Object[] options = new Object[] { "Retry operation", "Abort operation" }; int rv = JOptionPane.showOptionDialog( parent, retryMessage + "\n\n" + e.getMessage(), "Operation failure", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]); if (rv == 1) { throw e; } } } }
java
public void invokeTask (Component parent, String retryMessage) throws Exception { while (true) { try { invoke(); return; } catch (Exception e) { Object[] options = new Object[] { "Retry operation", "Abort operation" }; int rv = JOptionPane.showOptionDialog( parent, retryMessage + "\n\n" + e.getMessage(), "Operation failure", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[1]); if (rv == 1) { throw e; } } } }
[ "public", "void", "invokeTask", "(", "Component", "parent", ",", "String", "retryMessage", ")", "throws", "Exception", "{", "while", "(", "true", ")", "{", "try", "{", "invoke", "(", ")", ";", "return", ";", "}", "catch", "(", "Exception", "e", ")", "{...
Invokes the supplied task and catches any thrown exceptions. In the event of an exception, the provided message is displayed to the user and the are allowed to retry the task or allow it to fail.
[ "Invokes", "the", "supplied", "task", "and", "catches", "any", "thrown", "exceptions", ".", "In", "the", "event", "of", "an", "exception", "the", "provided", "message", "is", "displayed", "to", "the", "user", "and", "the", "are", "allowed", "to", "retry", ...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/RetryableTask.java#L33-L53
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java
TypeConverter.convertToBoolean
public static boolean convertToBoolean (@Nonnull final Object aSrcValue) { if (aSrcValue == null) throw new TypeConverterException (boolean.class, EReason.NULL_SOURCE_NOT_ALLOWED); final Boolean aValue = convert (aSrcValue, Boolean.class); return aValue.booleanValue (); }
java
public static boolean convertToBoolean (@Nonnull final Object aSrcValue) { if (aSrcValue == null) throw new TypeConverterException (boolean.class, EReason.NULL_SOURCE_NOT_ALLOWED); final Boolean aValue = convert (aSrcValue, Boolean.class); return aValue.booleanValue (); }
[ "public", "static", "boolean", "convertToBoolean", "(", "@", "Nonnull", "final", "Object", "aSrcValue", ")", "{", "if", "(", "aSrcValue", "==", "null", ")", "throw", "new", "TypeConverterException", "(", "boolean", ".", "class", ",", "EReason", ".", "NULL_SOUR...
Convert the passed source value to boolean @param aSrcValue The source value. May not be <code>null</code>. @return The converted value. @throws TypeConverterException if the source value is <code>null</code> or if no converter was found or if the converter returned a <code>null</code> object. @throws RuntimeException If the converter itself throws an exception @see TypeConverterProviderBestMatch
[ "Convert", "the", "passed", "source", "value", "to", "boolean" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L114-L120
Stratio/deep-spark
deep-mongodb/src/main/java/com/stratio/deep/mongodb/utils/UtilMongoDB.java
UtilMongoDB.subDocumentListCase
private static <T> Object subDocumentListCase(Type type, List<T> bsonOject) throws IllegalAccessException, InstantiationException, InvocationTargetException { ParameterizedType listType = (ParameterizedType) type; Class<?> listClass = (Class<?>) listType.getActualTypeArguments()[0]; List list = new ArrayList(); for (T t : bsonOject) { list.add(getObjectFromBson(listClass, (BSONObject) t)); } return list; }
java
private static <T> Object subDocumentListCase(Type type, List<T> bsonOject) throws IllegalAccessException, InstantiationException, InvocationTargetException { ParameterizedType listType = (ParameterizedType) type; Class<?> listClass = (Class<?>) listType.getActualTypeArguments()[0]; List list = new ArrayList(); for (T t : bsonOject) { list.add(getObjectFromBson(listClass, (BSONObject) t)); } return list; }
[ "private", "static", "<", "T", ">", "Object", "subDocumentListCase", "(", "Type", "type", ",", "List", "<", "T", ">", "bsonOject", ")", "throws", "IllegalAccessException", ",", "InstantiationException", ",", "InvocationTargetException", "{", "ParameterizedType", "li...
Sub document list case. @param <T> the type parameter @param type the type @param bsonOject the bson oject @return the object @throws IllegalAccessException the illegal access exception @throws InstantiationException the instantiation exception @throws InvocationTargetException the invocation target exception
[ "Sub", "document", "list", "case", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-mongodb/src/main/java/com/stratio/deep/mongodb/utils/UtilMongoDB.java#L133-L145
netty/netty
transport/src/main/java/io/netty/bootstrap/ServerBootstrap.java
ServerBootstrap.childOption
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value) { if (childOption == null) { throw new NullPointerException("childOption"); } if (value == null) { synchronized (childOptions) { childOptions.remove(childOption); } } else { synchronized (childOptions) { childOptions.put(childOption, value); } } return this; }
java
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value) { if (childOption == null) { throw new NullPointerException("childOption"); } if (value == null) { synchronized (childOptions) { childOptions.remove(childOption); } } else { synchronized (childOptions) { childOptions.put(childOption, value); } } return this; }
[ "public", "<", "T", ">", "ServerBootstrap", "childOption", "(", "ChannelOption", "<", "T", ">", "childOption", ",", "T", "value", ")", "{", "if", "(", "childOption", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"childOption\"", ")",...
Allow to specify a {@link ChannelOption} which is used for the {@link Channel} instances once they get created (after the acceptor accepted the {@link Channel}). Use a value of {@code null} to remove a previous set {@link ChannelOption}.
[ "Allow", "to", "specify", "a", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/bootstrap/ServerBootstrap.java#L97-L111
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/QueryByCriteria.java
QueryByCriteria.setPathClass
public void setPathClass(String aPath, Class aClass) { List pathClasses = new ArrayList(); pathClasses.add(aClass); m_pathClasses.put(aPath, pathClasses); }
java
public void setPathClass(String aPath, Class aClass) { List pathClasses = new ArrayList(); pathClasses.add(aClass); m_pathClasses.put(aPath, pathClasses); }
[ "public", "void", "setPathClass", "(", "String", "aPath", ",", "Class", "aClass", ")", "{", "List", "pathClasses", "=", "new", "ArrayList", "(", ")", ";", "pathClasses", ".", "add", "(", "aClass", ")", ";", "m_pathClasses", ".", "put", "(", "aPath", ",",...
Set the Class for a path. Used for relationships to extents.<br> SqlStatment will use this class when resolving the path. Without this hint SqlStatment will use the base class the relationship points to ie: Article instead of CdArticle. Using this method is the same as adding just one hint @param aPath the path segment ie: allArticlesInGroup @param aClass the Class ie: CdArticle @see org.apache.ojb.broker.QueryTest#testInversePathExpression() @see #addPathClass
[ "Set", "the", "Class", "for", "a", "path", ".", "Used", "for", "relationships", "to", "extents", ".", "<br", ">", "SqlStatment", "will", "use", "this", "class", "when", "resolving", "the", "path", ".", "Without", "this", "hint", "SqlStatment", "will", "use...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/QueryByCriteria.java#L216-L221
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listPrebuiltsWithServiceResponseAsync
public Observable<ServiceResponse<List<PrebuiltEntityExtractor>>> listPrebuiltsWithServiceResponseAsync(UUID appId, String versionId, ListPrebuiltsOptionalParameter listPrebuiltsOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } final Integer skip = listPrebuiltsOptionalParameter != null ? listPrebuiltsOptionalParameter.skip() : null; final Integer take = listPrebuiltsOptionalParameter != null ? listPrebuiltsOptionalParameter.take() : null; return listPrebuiltsWithServiceResponseAsync(appId, versionId, skip, take); }
java
public Observable<ServiceResponse<List<PrebuiltEntityExtractor>>> listPrebuiltsWithServiceResponseAsync(UUID appId, String versionId, ListPrebuiltsOptionalParameter listPrebuiltsOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } final Integer skip = listPrebuiltsOptionalParameter != null ? listPrebuiltsOptionalParameter.skip() : null; final Integer take = listPrebuiltsOptionalParameter != null ? listPrebuiltsOptionalParameter.take() : null; return listPrebuiltsWithServiceResponseAsync(appId, versionId, skip, take); }
[ "public", "Observable", "<", "ServiceResponse", "<", "List", "<", "PrebuiltEntityExtractor", ">", ">", ">", "listPrebuiltsWithServiceResponseAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "ListPrebuiltsOptionalParameter", "listPrebuiltsOptionalParameter", ")...
Gets information about the prebuilt entity models. @param appId The application ID. @param versionId The version ID. @param listPrebuiltsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;PrebuiltEntityExtractor&gt; object
[ "Gets", "information", "about", "the", "prebuilt", "entity", "models", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L2228-L2242
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.registerDeviceAsync
public void registerDeviceAsync(String deviceId, RegisterCallback callback) { final Device d = new Device.Builder(projectId).id(deviceId).build(); registerDeviceAsync(d, callback); }
java
public void registerDeviceAsync(String deviceId, RegisterCallback callback) { final Device d = new Device.Builder(projectId).id(deviceId).build(); registerDeviceAsync(d, callback); }
[ "public", "void", "registerDeviceAsync", "(", "String", "deviceId", ",", "RegisterCallback", "callback", ")", "{", "final", "Device", "d", "=", "new", "Device", ".", "Builder", "(", "projectId", ")", ".", "id", "(", "deviceId", ")", ".", "build", "(", ")",...
Registers a device asynchronously with the provided device ID. See {@link #registerDeviceAsync(Device, RegisterCallback)} for more details. @param deviceId Desired device ID. @param callback Callback for result of the registration. @throws ApiException Thrown if the iobeam client is not initialized.
[ "Registers", "a", "device", "asynchronously", "with", "the", "provided", "device", "ID", "." ]
train
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L572-L575
jenkinsci/email-ext-plugin
src/main/java/hudson/plugins/emailext/plugins/content/ScriptContent.java
ScriptContent.renderTemplate
private String renderTemplate(Run<?, ?> build, FilePath workspace, TaskListener listener, InputStream templateStream) throws IOException { String result; final Map<String, Object> binding = new HashMap<>(); ExtendedEmailPublisherDescriptor descriptor = Jenkins.getActiveInstance().getDescriptorByType(ExtendedEmailPublisherDescriptor.class); binding.put("build", build); binding.put("listener", listener); binding.put("it", new ScriptContentBuildWrapper(build)); binding.put("rooturl", descriptor.getHudsonUrl()); binding.put("project", build.getParent()); binding.put("workspace", workspace); try { String text = IOUtils.toString(templateStream); boolean approvedScript = false; if (templateStream instanceof UserProvidedContentInputStream && !AbstractEvalContent.isApprovedScript(text, GroovyLanguage.get())) { approvedScript = false; ScriptApproval.get().configuring(text, GroovyLanguage.get(), ApprovalContext.create().withItem(build.getParent())); } else { approvedScript = true; } // we add the binding to the SimpleTemplateEngine instead of the shell GroovyShell shell = createEngine(descriptor, Collections.<String, Object>emptyMap(), !approvedScript); SimpleTemplateEngine engine = new SimpleTemplateEngine(shell); Template tmpl; synchronized (templateCache) { Reference<Template> templateR = templateCache.get(text); tmpl = templateR == null ? null : templateR.get(); if (tmpl == null) { tmpl = engine.createTemplate(text); templateCache.put(text, new SoftReference<>(tmpl)); } } final Template tmplR = tmpl; if (approvedScript) { //The script has been approved by an admin, so run it as is result = tmplR.make(binding).toString(); } else { //unapproved script, so run in sandbox StaticProxyInstanceWhitelist whitelist = new StaticProxyInstanceWhitelist(build, "templates-instances.whitelist"); result = GroovySandbox.runInSandbox(new Callable<String>() { @Override public String call() throws Exception { return tmplR.make(binding).toString(); //TODO there is a PrintWriter instance created in make and bound to out } }, new ProxyWhitelist( Whitelist.all(), new TaskListenerInstanceWhitelist(listener), new PrintStreamInstanceWhitelist(listener.getLogger()), new EmailExtScriptTokenMacroWhitelist(), whitelist)); } } catch(Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); result = "Exception raised during template rendering: " + e.getMessage() + "\n\n" + sw.toString(); } return result; }
java
private String renderTemplate(Run<?, ?> build, FilePath workspace, TaskListener listener, InputStream templateStream) throws IOException { String result; final Map<String, Object> binding = new HashMap<>(); ExtendedEmailPublisherDescriptor descriptor = Jenkins.getActiveInstance().getDescriptorByType(ExtendedEmailPublisherDescriptor.class); binding.put("build", build); binding.put("listener", listener); binding.put("it", new ScriptContentBuildWrapper(build)); binding.put("rooturl", descriptor.getHudsonUrl()); binding.put("project", build.getParent()); binding.put("workspace", workspace); try { String text = IOUtils.toString(templateStream); boolean approvedScript = false; if (templateStream instanceof UserProvidedContentInputStream && !AbstractEvalContent.isApprovedScript(text, GroovyLanguage.get())) { approvedScript = false; ScriptApproval.get().configuring(text, GroovyLanguage.get(), ApprovalContext.create().withItem(build.getParent())); } else { approvedScript = true; } // we add the binding to the SimpleTemplateEngine instead of the shell GroovyShell shell = createEngine(descriptor, Collections.<String, Object>emptyMap(), !approvedScript); SimpleTemplateEngine engine = new SimpleTemplateEngine(shell); Template tmpl; synchronized (templateCache) { Reference<Template> templateR = templateCache.get(text); tmpl = templateR == null ? null : templateR.get(); if (tmpl == null) { tmpl = engine.createTemplate(text); templateCache.put(text, new SoftReference<>(tmpl)); } } final Template tmplR = tmpl; if (approvedScript) { //The script has been approved by an admin, so run it as is result = tmplR.make(binding).toString(); } else { //unapproved script, so run in sandbox StaticProxyInstanceWhitelist whitelist = new StaticProxyInstanceWhitelist(build, "templates-instances.whitelist"); result = GroovySandbox.runInSandbox(new Callable<String>() { @Override public String call() throws Exception { return tmplR.make(binding).toString(); //TODO there is a PrintWriter instance created in make and bound to out } }, new ProxyWhitelist( Whitelist.all(), new TaskListenerInstanceWhitelist(listener), new PrintStreamInstanceWhitelist(listener.getLogger()), new EmailExtScriptTokenMacroWhitelist(), whitelist)); } } catch(Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); result = "Exception raised during template rendering: " + e.getMessage() + "\n\n" + sw.toString(); } return result; }
[ "private", "String", "renderTemplate", "(", "Run", "<", "?", ",", "?", ">", "build", ",", "FilePath", "workspace", ",", "TaskListener", "listener", ",", "InputStream", "templateStream", ")", "throws", "IOException", "{", "String", "result", ";", "final", "Map"...
Renders the template using a SimpleTemplateEngine @param build the build to act on @param templateStream the template file stream @return the rendered template content @throws IOException
[ "Renders", "the", "template", "using", "a", "SimpleTemplateEngine" ]
train
https://github.com/jenkinsci/email-ext-plugin/blob/21fbd402665848a18205b26751424149e51e86e4/src/main/java/hudson/plugins/emailext/plugins/content/ScriptContent.java#L114-L176
libgdx/gdx-ai
gdx-ai/src/com/badlogic/gdx/ai/fsm/DefaultStateMachine.java
DefaultStateMachine.handleMessage
@Override public boolean handleMessage (Telegram telegram) { // First see if the current state is valid and that it can handle the message if (currentState != null && currentState.onMessage(owner, telegram)) { return true; } // If not, and if a global state has been implemented, send // the message to the global state if (globalState != null && globalState.onMessage(owner, telegram)) { return true; } return false; }
java
@Override public boolean handleMessage (Telegram telegram) { // First see if the current state is valid and that it can handle the message if (currentState != null && currentState.onMessage(owner, telegram)) { return true; } // If not, and if a global state has been implemented, send // the message to the global state if (globalState != null && globalState.onMessage(owner, telegram)) { return true; } return false; }
[ "@", "Override", "public", "boolean", "handleMessage", "(", "Telegram", "telegram", ")", "{", "// First see if the current state is valid and that it can handle the message", "if", "(", "currentState", "!=", "null", "&&", "currentState", ".", "onMessage", "(", "owner", ",...
Handles received telegrams. The telegram is first routed to the current state. If the current state does not deal with the message, it's routed to the global state's message handler. @param telegram the received telegram @return true if telegram has been successfully handled; false otherwise.
[ "Handles", "received", "telegrams", ".", "The", "telegram", "is", "first", "routed", "to", "the", "current", "state", ".", "If", "the", "current", "state", "does", "not", "deal", "with", "the", "message", "it", "s", "routed", "to", "the", "global", "state"...
train
https://github.com/libgdx/gdx-ai/blob/2d1523a97193a45e18e11a4837c6800d08f177c5/gdx-ai/src/com/badlogic/gdx/ai/fsm/DefaultStateMachine.java#L158-L173
JodaOrg/joda-time
src/main/java/org/joda/time/format/PeriodFormatter.java
PeriodFormatter.parseInto
public int parseInto(ReadWritablePeriod period, String text, int position) { checkParser(); checkPeriod(period); return getParser().parseInto(period, text, position, iLocale); }
java
public int parseInto(ReadWritablePeriod period, String text, int position) { checkParser(); checkPeriod(period); return getParser().parseInto(period, text, position, iLocale); }
[ "public", "int", "parseInto", "(", "ReadWritablePeriod", "period", ",", "String", "text", ",", "int", "position", ")", "{", "checkParser", "(", ")", ";", "checkPeriod", "(", "period", ")", ";", "return", "getParser", "(", ")", ".", "parseInto", "(", "perio...
Parses a period from the given text, at the given position, saving the result into the fields of the given ReadWritablePeriod. If the parse succeeds, the return value is the new text position. Note that the parse may succeed without fully reading the text. <p> The parse type of the formatter is not used by this method. <p> If it fails, the return value is negative, but the period may still be modified. To determine the position where the parse failed, apply the one's complement operator (~) on the return value. @param period a period that will be modified @param text text to parse @param position position to start parsing from @return new position, if negative, parse failed. Apply complement operator (~) to get position of failure @throws IllegalArgumentException if any field is out of range
[ "Parses", "a", "period", "from", "the", "given", "text", "at", "the", "given", "position", "saving", "the", "result", "into", "the", "fields", "of", "the", "given", "ReadWritablePeriod", ".", "If", "the", "parse", "succeeds", "the", "return", "value", "is", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatter.java#L291-L296
quattor/pan
panc/src/main/java/org/quattor/pan/dml/data/AbstractElement.java
AbstractElement.rput
public void rput(Term[] terms, int index, Element value) throws InvalidTermException { throw new EvaluationException(MessageUtils.format(MSG_CANNOT_ADD_CHILD, this.getTypeAsString())); }
java
public void rput(Term[] terms, int index, Element value) throws InvalidTermException { throw new EvaluationException(MessageUtils.format(MSG_CANNOT_ADD_CHILD, this.getTypeAsString())); }
[ "public", "void", "rput", "(", "Term", "[", "]", "terms", ",", "int", "index", ",", "Element", "value", ")", "throws", "InvalidTermException", "{", "throw", "new", "EvaluationException", "(", "MessageUtils", ".", "format", "(", "MSG_CANNOT_ADD_CHILD", ",", "th...
Add the given child to this resource, creating intermediate resources as necessary. If this Element is not a resource, then this will throw an InvalidTermException. The default implementation of this method throws such an exception. This resource must be a writable resource, otherwise an exception will be thrown. @throws org.quattor.pan.exceptions.InvalidTermException thrown if an trying to dereference a list with a key or a hash with an index
[ "Add", "the", "given", "child", "to", "this", "resource", "creating", "intermediate", "resources", "as", "necessary", ".", "If", "this", "Element", "is", "not", "a", "resource", "then", "this", "will", "throw", "an", "InvalidTermException", ".", "The", "defaul...
train
https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/dml/data/AbstractElement.java#L257-L261
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java
ReUtil.findAll
public static List<String> findAll(String regex, CharSequence content, int group) { return findAll(regex, content, group, new ArrayList<String>()); }
java
public static List<String> findAll(String regex, CharSequence content, int group) { return findAll(regex, content, group, new ArrayList<String>()); }
[ "public", "static", "List", "<", "String", ">", "findAll", "(", "String", "regex", ",", "CharSequence", "content", ",", "int", "group", ")", "{", "return", "findAll", "(", "regex", ",", "content", ",", "group", ",", "new", "ArrayList", "<", "String", ">"...
取得内容中匹配的所有结果 @param regex 正则 @param content 被查找的内容 @param group 正则的分组 @return 结果列表 @since 3.0.6
[ "取得内容中匹配的所有结果" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L388-L390
apache/incubator-gobblin
gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/http/ApacheHttpRequestBuilder.java
ApacheHttpRequestBuilder.addPayload
protected int addPayload(RequestBuilder builder, String payload) { if (payload == null || payload.length() == 0) { return 0; } builder.setHeader(HttpHeaders.CONTENT_TYPE, contentType.getMimeType()); builder.setEntity(new StringEntity(payload, contentType)); return payload.length(); }
java
protected int addPayload(RequestBuilder builder, String payload) { if (payload == null || payload.length() == 0) { return 0; } builder.setHeader(HttpHeaders.CONTENT_TYPE, contentType.getMimeType()); builder.setEntity(new StringEntity(payload, contentType)); return payload.length(); }
[ "protected", "int", "addPayload", "(", "RequestBuilder", "builder", ",", "String", "payload", ")", "{", "if", "(", "payload", "==", "null", "||", "payload", ".", "length", "(", ")", "==", "0", ")", "{", "return", "0", ";", "}", "builder", ".", "setHead...
Add payload to request. By default, payload is sent as application/json
[ "Add", "payload", "to", "request", ".", "By", "default", "payload", "is", "sent", "as", "application", "/", "json" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-http/src/main/java/org/apache/gobblin/http/ApacheHttpRequestBuilder.java#L107-L116
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java
Ssh2Session.setEnvironmentVariable
public boolean setEnvironmentVariable(String name, String value) throws SshException { ByteArrayWriter request = new ByteArrayWriter(); try { request.writeString(name); request.writeString(value); return sendRequest("env", true, request.toByteArray()); } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } finally { try { request.close(); } catch (IOException e) { } } }
java
public boolean setEnvironmentVariable(String name, String value) throws SshException { ByteArrayWriter request = new ByteArrayWriter(); try { request.writeString(name); request.writeString(value); return sendRequest("env", true, request.toByteArray()); } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } finally { try { request.close(); } catch (IOException e) { } } }
[ "public", "boolean", "setEnvironmentVariable", "(", "String", "name", ",", "String", "value", ")", "throws", "SshException", "{", "ByteArrayWriter", "request", "=", "new", "ByteArrayWriter", "(", ")", ";", "try", "{", "request", ".", "writeString", "(", "name", ...
The SSH2 session supports the setting of environments variables however in our experiance no server to date allows unconditional setting of variables. This method should be called before the command is started.
[ "The", "SSH2", "session", "supports", "the", "setting", "of", "environments", "variables", "however", "in", "our", "experiance", "no", "server", "to", "date", "allows", "unconditional", "setting", "of", "variables", ".", "This", "method", "should", "be", "called...
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Session.java#L301-L317
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/JoinableResourceBundleImpl.java
JoinableResourceBundleImpl.setVariants
@Override public void setVariants(Map<String, VariantSet> variantSets) { if (variantSets != null) { this.variants = new TreeMap<>(variantSets); variantKeys = VariantUtils.getAllVariantKeys(this.variants); } }
java
@Override public void setVariants(Map<String, VariantSet> variantSets) { if (variantSets != null) { this.variants = new TreeMap<>(variantSets); variantKeys = VariantUtils.getAllVariantKeys(this.variants); } }
[ "@", "Override", "public", "void", "setVariants", "(", "Map", "<", "String", ",", "VariantSet", ">", "variantSets", ")", "{", "if", "(", "variantSets", "!=", "null", ")", "{", "this", ".", "variants", "=", "new", "TreeMap", "<>", "(", "variantSets", ")",...
Set the list of variants for variant resources @param variantSets
[ "Set", "the", "list", "of", "variants", "for", "variant", "resources" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/JoinableResourceBundleImpl.java#L318-L325
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/ThinApplet.java
ThinApplet.addSubPanels
public boolean addSubPanels(Container parent, int options) { String strScreen = this.getProperty(Params.SCREEN); if ((strScreen == null) || (strScreen.length() == 0)) this.setProperty(Params.SCREEN, INITIAL_SCREEN); boolean success = super.addSubPanels(parent, options); if (success) if (strScreen == null) this.getProperties().remove(Params.SCREEN); return success; }
java
public boolean addSubPanels(Container parent, int options) { String strScreen = this.getProperty(Params.SCREEN); if ((strScreen == null) || (strScreen.length() == 0)) this.setProperty(Params.SCREEN, INITIAL_SCREEN); boolean success = super.addSubPanels(parent, options); if (success) if (strScreen == null) this.getProperties().remove(Params.SCREEN); return success; }
[ "public", "boolean", "addSubPanels", "(", "Container", "parent", ",", "int", "options", ")", "{", "String", "strScreen", "=", "this", ".", "getProperty", "(", "Params", ".", "SCREEN", ")", ";", "if", "(", "(", "strScreen", "==", "null", ")", "||", "(", ...
Add any applet sub-panel(s) now. Usually, you override this, although for a simple screen, just pass a screen=class param. @param parent The parent to add the new screen to.
[ "Add", "any", "applet", "sub", "-", "panel", "(", "s", ")", "now", ".", "Usually", "you", "override", "this", "although", "for", "a", "simple", "screen", "just", "pass", "a", "screen", "=", "class", "param", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/ThinApplet.java#L80-L90
VoltDB/voltdb
third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java
HelpFormatter.printWrapped
public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text) { StringBuffer sb = new StringBuffer(text.length()); renderWrappedTextBlock(sb, width, nextLineTabStop, text); pw.println(sb.toString()); }
java
public void printWrapped(PrintWriter pw, int width, int nextLineTabStop, String text) { StringBuffer sb = new StringBuffer(text.length()); renderWrappedTextBlock(sb, width, nextLineTabStop, text); pw.println(sb.toString()); }
[ "public", "void", "printWrapped", "(", "PrintWriter", "pw", ",", "int", "width", ",", "int", "nextLineTabStop", ",", "String", "text", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "text", ".", "length", "(", ")", ")", ";", "renderWrappe...
Print the specified text to the specified PrintWriter. @param pw The printWriter to write the help to @param width The number of characters to display per line @param nextLineTabStop The position on the next line for the first tab. @param text The text to be written to the PrintWriter
[ "Print", "the", "specified", "text", "to", "the", "specified", "PrintWriter", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java#L767-L773
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java
CPMeasurementUnitPersistenceImpl.countByG_P_T
@Override public int countByG_P_T(long groupId, boolean primary, int type) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_P_T; Object[] finderArgs = new Object[] { groupId, primary, type }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_CPMEASUREMENTUNIT_WHERE); query.append(_FINDER_COLUMN_G_P_T_GROUPID_2); query.append(_FINDER_COLUMN_G_P_T_PRIMARY_2); query.append(_FINDER_COLUMN_G_P_T_TYPE_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(primary); qPos.add(type); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByG_P_T(long groupId, boolean primary, int type) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_P_T; Object[] finderArgs = new Object[] { groupId, primary, type }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_CPMEASUREMENTUNIT_WHERE); query.append(_FINDER_COLUMN_G_P_T_GROUPID_2); query.append(_FINDER_COLUMN_G_P_T_PRIMARY_2); query.append(_FINDER_COLUMN_G_P_T_TYPE_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(primary); qPos.add(type); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByG_P_T", "(", "long", "groupId", ",", "boolean", "primary", ",", "int", "type", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_G_P_T", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", ...
Returns the number of cp measurement units where groupId = &#63; and primary = &#63; and type = &#63;. @param groupId the group ID @param primary the primary @param type the type @return the number of matching cp measurement units
[ "Returns", "the", "number", "of", "cp", "measurement", "units", "where", "groupId", "=", "&#63", ";", "and", "primary", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L3344-L3395
wuman/orientdb-android
commons/src/main/java/com/orientechnologies/common/collection/OMVRBTree.java
OMVRBTree.getEntry
public final OMVRBTreeEntry<K, V> getEntry(final Object key, final PartialSearchMode partialSearchMode) { return getEntry(key, false, partialSearchMode); }
java
public final OMVRBTreeEntry<K, V> getEntry(final Object key, final PartialSearchMode partialSearchMode) { return getEntry(key, false, partialSearchMode); }
[ "public", "final", "OMVRBTreeEntry", "<", "K", ",", "V", ">", "getEntry", "(", "final", "Object", "key", ",", "final", "PartialSearchMode", "partialSearchMode", ")", "{", "return", "getEntry", "(", "key", ",", "false", ",", "partialSearchMode", ")", ";", "}"...
Returns this map's entry for the given key, or <tt>null</tt> if the map does not contain an entry for the key. In case of {@link OCompositeKey} keys you can specify which key can be used: lowest, highest, any. @param key Key to search. @param partialSearchMode Which key can be used in case of {@link OCompositeKey} key is passed in. @return this map's entry for the given key, or <tt>null</tt> if the map does not contain an entry for the key @throws ClassCastException if the specified key cannot be compared with the keys currently in the map @throws NullPointerException if the specified key is null and this map uses natural ordering, or its comparator does not permit null keys
[ "Returns", "this", "map", "s", "entry", "for", "the", "given", "key", "or", "<tt", ">", "null<", "/", "tt", ">", "if", "the", "map", "does", "not", "contain", "an", "entry", "for", "the", "key", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/collection/OMVRBTree.java#L350-L352
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/NimbusServer.java
NimbusServer.initCleaner
@SuppressWarnings("rawtypes") private void initCleaner(Map conf) throws IOException { final ScheduledExecutorService scheduExec = data.getScheduExec(); if (!data.isLaunchedCleaner()) { // Schedule Nimbus inbox cleaner/nimbus/inbox jar String dir_location = StormConfig.masterInbox(conf); int inbox_jar_expiration_secs = JStormUtils.parseInt(conf.get(Config.NIMBUS_INBOX_JAR_EXPIRATION_SECS), 3600); CleanRunnable r2 = new CleanRunnable(dir_location, inbox_jar_expiration_secs); int cleanup_inbox_freq_secs = JStormUtils.parseInt(conf.get(Config.NIMBUS_CLEANUP_INBOX_FREQ_SECS), 600); scheduExec.scheduleAtFixedRate(r2, 0, cleanup_inbox_freq_secs, TimeUnit.SECONDS); data.setLaunchedCleaner(true); LOG.info("Successfully init " + dir_location + " cleaner"); } else { LOG.info("cleaner thread has been started already"); } }
java
@SuppressWarnings("rawtypes") private void initCleaner(Map conf) throws IOException { final ScheduledExecutorService scheduExec = data.getScheduExec(); if (!data.isLaunchedCleaner()) { // Schedule Nimbus inbox cleaner/nimbus/inbox jar String dir_location = StormConfig.masterInbox(conf); int inbox_jar_expiration_secs = JStormUtils.parseInt(conf.get(Config.NIMBUS_INBOX_JAR_EXPIRATION_SECS), 3600); CleanRunnable r2 = new CleanRunnable(dir_location, inbox_jar_expiration_secs); int cleanup_inbox_freq_secs = JStormUtils.parseInt(conf.get(Config.NIMBUS_CLEANUP_INBOX_FREQ_SECS), 600); scheduExec.scheduleAtFixedRate(r2, 0, cleanup_inbox_freq_secs, TimeUnit.SECONDS); data.setLaunchedCleaner(true); LOG.info("Successfully init " + dir_location + " cleaner"); } else { LOG.info("cleaner thread has been started already"); } }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "private", "void", "initCleaner", "(", "Map", "conf", ")", "throws", "IOException", "{", "final", "ScheduledExecutorService", "scheduExec", "=", "data", ".", "getScheduExec", "(", ")", ";", "if", "(", "!", "da...
Right now, every 600 seconds, nimbus will clean jar under /LOCAL-DIR/nimbus/inbox, which is the uploading topology directory
[ "Right", "now", "every", "600", "seconds", "nimbus", "will", "clean", "jar", "under", "/", "LOCAL", "-", "DIR", "/", "nimbus", "/", "inbox", "which", "is", "the", "uploading", "topology", "directory" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/daemon/nimbus/NimbusServer.java#L262-L280
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java
WithoutSpecification.replaceWithMethod
public MemberSubstitution replaceWithMethod(ElementMatcher<? super MethodDescription> matcher, MethodGraph.Compiler methodGraphCompiler) { return replaceWith(new Substitution.ForMethodInvocation.OfMatchedMethod(matcher, methodGraphCompiler)); }
java
public MemberSubstitution replaceWithMethod(ElementMatcher<? super MethodDescription> matcher, MethodGraph.Compiler methodGraphCompiler) { return replaceWith(new Substitution.ForMethodInvocation.OfMatchedMethod(matcher, methodGraphCompiler)); }
[ "public", "MemberSubstitution", "replaceWithMethod", "(", "ElementMatcher", "<", "?", "super", "MethodDescription", ">", "matcher", ",", "MethodGraph", ".", "Compiler", "methodGraphCompiler", ")", "{", "return", "replaceWith", "(", "new", "Substitution", ".", "ForMeth...
Replaces any interaction with a matched byte code element with a non-static method access on the first parameter of the matched element. When matching a non-static field access or method invocation, the substituted method is located on the same receiver type as the original access. For static access, the first argument is used as a receiver. @param matcher A matcher for locating a method on the original interaction's receiver type. @param methodGraphCompiler The method graph compiler to use for locating a method. @return A member substitution that replaces any matched byte code element with an access of the matched method.
[ "Replaces", "any", "interaction", "with", "a", "matched", "byte", "code", "element", "with", "a", "non", "-", "static", "method", "access", "on", "the", "first", "parameter", "of", "the", "matched", "element", ".", "When", "matching", "a", "non", "-", "sta...
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/asm/MemberSubstitution.java#L409-L411
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/utils/AnnotationProcessorUtilis.java
AnnotationProcessorUtilis.infoOnGeneratedFile
public static void infoOnGeneratedFile(Class<BindDataSource> annotation, File schemaCreateFile) { String msg = String.format("file '%s' in directory '%s' is generated by '@%s' annotation processor", schemaCreateFile.getName(), schemaCreateFile.getParentFile(), annotation.getSimpleName()); printMessage(msg); }
java
public static void infoOnGeneratedFile(Class<BindDataSource> annotation, File schemaCreateFile) { String msg = String.format("file '%s' in directory '%s' is generated by '@%s' annotation processor", schemaCreateFile.getName(), schemaCreateFile.getParentFile(), annotation.getSimpleName()); printMessage(msg); }
[ "public", "static", "void", "infoOnGeneratedFile", "(", "Class", "<", "BindDataSource", ">", "annotation", ",", "File", "schemaCreateFile", ")", "{", "String", "msg", "=", "String", ".", "format", "(", "\"file '%s' in directory '%s' is generated by '@%s' annotation proces...
Info on generated file. @param annotation the annotation @param schemaCreateFile the schema create file
[ "Info", "on", "generated", "file", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/utils/AnnotationProcessorUtilis.java#L72-L76
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.updateApiKey
public JSONObject updateApiKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, RequestOptions requestOptions) throws AlgoliaException { try { JSONObject jsonObject = generateUpdateUser(acls, validity, maxQueriesPerIPPerHour, maxHitsPerQuery); return updateApiKey(key, jsonObject, requestOptions); } catch (JSONException e) { throw new RuntimeException(e); } }
java
public JSONObject updateApiKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, RequestOptions requestOptions) throws AlgoliaException { try { JSONObject jsonObject = generateUpdateUser(acls, validity, maxQueriesPerIPPerHour, maxHitsPerQuery); return updateApiKey(key, jsonObject, requestOptions); } catch (JSONException e) { throw new RuntimeException(e); } }
[ "public", "JSONObject", "updateApiKey", "(", "String", "key", ",", "List", "<", "String", ">", "acls", ",", "int", "validity", ",", "int", "maxQueriesPerIPPerHour", ",", "int", "maxHitsPerQuery", ",", "RequestOptions", "requestOptions", ")", "throws", "AlgoliaExce...
Update an api key @param acls the list of ACL for this key. Defined by an array of strings that can contains the following values: - search: allow to search (https and http) - addObject: allows to add/update an object in the index (https only) - deleteObject : allows to delete an existing object (https only) - deleteIndex : allows to delete index content (https only) - settings : allows to get index settings (https only) - editSettings : allows to change index settings (https only) @param validity the number of seconds after which the key will be automatically removed (0 means no time limit for this key) @param maxQueriesPerIPPerHour Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit). @param maxHitsPerQuery Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited) @param requestOptions Options to pass to this request
[ "Update", "an", "api", "key" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1263-L1270
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java
BoxApiBookmark.getRenameRequest
public BoxRequestsBookmark.UpdateBookmark getRenameRequest(String id, String newName) { BoxRequestsBookmark.UpdateBookmark request = new BoxRequestsBookmark.UpdateBookmark(id, getBookmarkInfoUrl(id), mSession); request.setName(newName); return request; }
java
public BoxRequestsBookmark.UpdateBookmark getRenameRequest(String id, String newName) { BoxRequestsBookmark.UpdateBookmark request = new BoxRequestsBookmark.UpdateBookmark(id, getBookmarkInfoUrl(id), mSession); request.setName(newName); return request; }
[ "public", "BoxRequestsBookmark", ".", "UpdateBookmark", "getRenameRequest", "(", "String", "id", ",", "String", "newName", ")", "{", "BoxRequestsBookmark", ".", "UpdateBookmark", "request", "=", "new", "BoxRequestsBookmark", ".", "UpdateBookmark", "(", "id", ",", "g...
Gets a request that renames a bookmark @param id id of bookmark to rename @param newName id of bookmark to retrieve info on @return request to rename a bookmark
[ "Gets", "a", "request", "that", "renames", "a", "bookmark" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java#L120-L124
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java
PhotosInterface.setMeta
public void setMeta(String photoId, String title, String description) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_META); parameters.put("photo_id", photoId); parameters.put("title", title); parameters.put("description", description); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void setMeta(String photoId, String title, String description) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_META); parameters.put("photo_id", photoId); parameters.put("title", title); parameters.put("description", description); Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "setMeta", "(", "String", "photoId", ",", "String", "title", ",", "String", "description", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ...
Set the meta data for the photo. This method requires authentication with 'write' permission. @param photoId The photo ID @param title The new title @param description The new description @throws FlickrException
[ "Set", "the", "meta", "data", "for", "the", "photo", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1201-L1213
facebookarchive/hadoop-20
src/core/org/apache/hadoop/net/NetUtils.java
NetUtils.getInputStream
public static InputStream getInputStream(Socket socket, long timeout) throws IOException { return (socket.getChannel() == null) ? socket.getInputStream() : new SocketInputStream(socket, timeout); }
java
public static InputStream getInputStream(Socket socket, long timeout) throws IOException { return (socket.getChannel() == null) ? socket.getInputStream() : new SocketInputStream(socket, timeout); }
[ "public", "static", "InputStream", "getInputStream", "(", "Socket", "socket", ",", "long", "timeout", ")", "throws", "IOException", "{", "return", "(", "socket", ".", "getChannel", "(", ")", "==", "null", ")", "?", "socket", ".", "getInputStream", "(", ")", ...
Returns InputStream for the socket. If the socket has an associated SocketChannel then it returns a {@link SocketInputStream} with the given timeout. If the socket does not have a channel, {@link Socket#getInputStream()} is returned. In the later case, the timeout argument is ignored and the timeout set with {@link Socket#setSoTimeout(int)} applies for reads.<br><br> Any socket created using socket factories returned by {@link #NetUtils}, must use this interface instead of {@link Socket#getInputStream()}. @see Socket#getChannel() @param socket @param timeout timeout in milliseconds. This may not always apply. zero for waiting as long as necessary. @return InputStream for reading from the socket. @throws IOException
[ "Returns", "InputStream", "for", "the", "socket", ".", "If", "the", "socket", "has", "an", "associated", "SocketChannel", "then", "it", "returns", "a", "{", "@link", "SocketInputStream", "}", "with", "the", "given", "timeout", ".", "If", "the", "socket", "do...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetUtils.java#L339-L343
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java
SqlStatement.doBatchUpdate
private void doBatchUpdate(PreparedStatement ps, Object[] args, Calendar cal) throws SQLException { final int[] sqlTypes = new int[args.length]; final Object[] objArrays = new Object[args.length]; // build an array of type values and object arrays for (int i = 0; i < args.length; i++) { sqlTypes[i] = _tmf.getSqlType(args[i].getClass().getComponentType()); objArrays[i] = TypeMappingsFactory.toObjectArray(args[i]); } final int rowCount = ((Object[]) objArrays[0]).length; for (int i = 0; i < rowCount; i++) { for (int j = 0; j < args.length; j++) { setPreparedStatementParameter(ps, j + 1, ((Object[]) objArrays[j])[i], sqlTypes[j], cal); } ps.addBatch(); } }
java
private void doBatchUpdate(PreparedStatement ps, Object[] args, Calendar cal) throws SQLException { final int[] sqlTypes = new int[args.length]; final Object[] objArrays = new Object[args.length]; // build an array of type values and object arrays for (int i = 0; i < args.length; i++) { sqlTypes[i] = _tmf.getSqlType(args[i].getClass().getComponentType()); objArrays[i] = TypeMappingsFactory.toObjectArray(args[i]); } final int rowCount = ((Object[]) objArrays[0]).length; for (int i = 0; i < rowCount; i++) { for (int j = 0; j < args.length; j++) { setPreparedStatementParameter(ps, j + 1, ((Object[]) objArrays[j])[i], sqlTypes[j], cal); } ps.addBatch(); } }
[ "private", "void", "doBatchUpdate", "(", "PreparedStatement", "ps", ",", "Object", "[", "]", "args", ",", "Calendar", "cal", ")", "throws", "SQLException", "{", "final", "int", "[", "]", "sqlTypes", "=", "new", "int", "[", "args", ".", "length", "]", ";"...
Build a prepared statement for a batch update. @param ps The PreparedStatement object. @param args The parameter list of the jdbccontrol method. @param cal A Calendar instance used to resolve date/time values. @throws SQLException If a batch update cannot be performed.
[ "Build", "a", "prepared", "statement", "for", "a", "batch", "update", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java#L429-L447
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/FileIoUtil.java
FileIoUtil.getTextfileFromUrl
public static List<String> getTextfileFromUrl(String _url, Charset _charset) { return getTextfileFromUrl(_url, _charset, false); }
java
public static List<String> getTextfileFromUrl(String _url, Charset _charset) { return getTextfileFromUrl(_url, _charset, false); }
[ "public", "static", "List", "<", "String", ">", "getTextfileFromUrl", "(", "String", "_url", ",", "Charset", "_charset", ")", "{", "return", "getTextfileFromUrl", "(", "_url", ",", "_charset", ",", "false", ")", ";", "}" ]
Retrives a text file from an given URL and reads the content with the given charset. Url could be remote (like http://) or local (file://) If protocol is not specified by "protocol://" (like "http://" or "file://"), "file://" is assumed. @param _url @param _charset @return fileContent as List or null if file is empty or an error occurred.
[ "Retrives", "a", "text", "file", "from", "an", "given", "URL", "and", "reads", "the", "content", "with", "the", "given", "charset", ".", "Url", "could", "be", "remote", "(", "like", "http", ":", "//", ")", "or", "local", "(", "file", ":", "//", ")" ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/FileIoUtil.java#L161-L163
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listCustomPrebuiltModelsAsync
public Observable<List<CustomPrebuiltModel>> listCustomPrebuiltModelsAsync(UUID appId, String versionId) { return listCustomPrebuiltModelsWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<CustomPrebuiltModel>>, List<CustomPrebuiltModel>>() { @Override public List<CustomPrebuiltModel> call(ServiceResponse<List<CustomPrebuiltModel>> response) { return response.body(); } }); }
java
public Observable<List<CustomPrebuiltModel>> listCustomPrebuiltModelsAsync(UUID appId, String versionId) { return listCustomPrebuiltModelsWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<CustomPrebuiltModel>>, List<CustomPrebuiltModel>>() { @Override public List<CustomPrebuiltModel> call(ServiceResponse<List<CustomPrebuiltModel>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "CustomPrebuiltModel", ">", ">", "listCustomPrebuiltModelsAsync", "(", "UUID", "appId", ",", "String", "versionId", ")", "{", "return", "listCustomPrebuiltModelsWithServiceResponseAsync", "(", "appId", ",", "versionId", ")", "...
Gets all custom prebuilt models information of this application. @param appId The application ID. @param versionId The version ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;CustomPrebuiltModel&gt; object
[ "Gets", "all", "custom", "prebuilt", "models", "information", "of", "this", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6089-L6096
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropsFilePropertiesSource.java
PropsFilePropertiesSource.loadConfig
protected void loadConfig(Properties props, String path, InputStream is) { // load properties into a Properties object try { props.load(is); } catch (IOException e) { throw new BundlingProcessException("Unable to load jawr configuration at " + path + ".", e); } }
java
protected void loadConfig(Properties props, String path, InputStream is) { // load properties into a Properties object try { props.load(is); } catch (IOException e) { throw new BundlingProcessException("Unable to load jawr configuration at " + path + ".", e); } }
[ "protected", "void", "loadConfig", "(", "Properties", "props", ",", "String", "path", ",", "InputStream", "is", ")", "{", "// load properties into a Properties object", "try", "{", "props", ".", "load", "(", "is", ")", ";", "}", "catch", "(", "IOException", "e...
Loads the configuration from the stream @param props the properties to update @param path The configuration path @param is the input stream
[ "Loads", "the", "configuration", "from", "the", "stream" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropsFilePropertiesSource.java#L119-L126
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/SimpleTimeZone.java
SimpleTimeZone.setEndRule
public void setEndRule(int endMonth, int endDay, int endDayOfWeek, int endTime, boolean after) { if (after) { setEndRule(endMonth, endDay, -endDayOfWeek, endTime); } else { setEndRule(endMonth, -endDay, -endDayOfWeek, endTime); } }
java
public void setEndRule(int endMonth, int endDay, int endDayOfWeek, int endTime, boolean after) { if (after) { setEndRule(endMonth, endDay, -endDayOfWeek, endTime); } else { setEndRule(endMonth, -endDay, -endDayOfWeek, endTime); } }
[ "public", "void", "setEndRule", "(", "int", "endMonth", ",", "int", "endDay", ",", "int", "endDayOfWeek", ",", "int", "endTime", ",", "boolean", "after", ")", "{", "if", "(", "after", ")", "{", "setEndRule", "(", "endMonth", ",", "endDay", ",", "-", "e...
Sets the daylight saving time end rule to a weekday before or after the given date within a month, e.g., the first Monday on or after the 8th. @param endMonth The daylight saving time ending month. Month is a {@link Calendar#MONTH MONTH} field value (0-based. e.g., 9 for October). @param endDay The day of the month on which the daylight saving time ends. @param endDayOfWeek The daylight saving time ending day-of-week. @param endTime The daylight saving ending time in local wall clock time, (in milliseconds within the day) which is local daylight time in this case. @param after If true, this rule selects the first <code>endDayOfWeek</code> on or <em>after</em> <code>endDay</code>. If false, this rule selects the last <code>endDayOfWeek</code> on or before <code>endDay</code> of the month. @exception IllegalArgumentException the <code>endMonth</code>, <code>endDay</code>, <code>endDayOfWeek</code>, or <code>endTime</code> parameters are out of range @since 1.2
[ "Sets", "the", "daylight", "saving", "time", "end", "rule", "to", "a", "weekday", "before", "or", "after", "the", "given", "date", "within", "a", "month", "e", ".", "g", ".", "the", "first", "Monday", "on", "or", "after", "the", "8th", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/SimpleTimeZone.java#L518-L525
alkacon/opencms-core
src/org/opencms/workplace/CmsDialog.java
CmsDialog.htmlStartStyle
public String htmlStartStyle(String title, String stylesheet) { return pageHtmlStyle(HTML_START, title, stylesheet); }
java
public String htmlStartStyle(String title, String stylesheet) { return pageHtmlStyle(HTML_START, title, stylesheet); }
[ "public", "String", "htmlStartStyle", "(", "String", "title", ",", "String", "stylesheet", ")", "{", "return", "pageHtmlStyle", "(", "HTML_START", ",", "title", ",", "stylesheet", ")", ";", "}" ]
Builds the start html of the page, including setting of DOCTYPE, inserting a header with the content-type and choosing an individual style sheet.<p> @param title the title for the page @param stylesheet the style sheet to include @return the start html of the page
[ "Builds", "the", "start", "html", "of", "the", "page", "including", "setting", "of", "DOCTYPE", "inserting", "a", "header", "with", "the", "content", "-", "type", "and", "choosing", "an", "individual", "style", "sheet", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsDialog.java#L1406-L1409
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java
Indices.isScalar
public static boolean isScalar(INDArray indexOver, INDArrayIndex... indexes) { boolean allOneLength = true; for (int i = 0; i < indexes.length; i++) { allOneLength = allOneLength && indexes[i].length() == 1; } int numNewAxes = NDArrayIndex.numNewAxis(indexes); if (allOneLength && numNewAxes == 0 && indexes.length == indexOver.rank()) return true; else if (allOneLength && indexes.length == indexOver.rank() - numNewAxes) { return allOneLength; } return allOneLength; }
java
public static boolean isScalar(INDArray indexOver, INDArrayIndex... indexes) { boolean allOneLength = true; for (int i = 0; i < indexes.length; i++) { allOneLength = allOneLength && indexes[i].length() == 1; } int numNewAxes = NDArrayIndex.numNewAxis(indexes); if (allOneLength && numNewAxes == 0 && indexes.length == indexOver.rank()) return true; else if (allOneLength && indexes.length == indexOver.rank() - numNewAxes) { return allOneLength; } return allOneLength; }
[ "public", "static", "boolean", "isScalar", "(", "INDArray", "indexOver", ",", "INDArrayIndex", "...", "indexes", ")", "{", "boolean", "allOneLength", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "indexes", ".", "length", ";", "i", ...
Check if the given indexes over the specified array are searching for a scalar @param indexOver the array to index over @param indexes the index query @return true if the given indexes are searching for a scalar false otherwise
[ "Check", "if", "the", "given", "indexes", "over", "the", "specified", "array", "are", "searching", "for", "a", "scalar" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/Indices.java#L512-L526
codescape/bitvunit
bitvunit-core/src/main/java/de/codescape/bitvunit/util/html/HtmlPageUtil.java
HtmlPageUtil.toHtmlPage
public static HtmlPage toHtmlPage(String string) { try { URL url = new URL("http://bitvunit.codescape.de/some_page.html"); return HTMLParser.parseHtml(new StringWebResponse(string, url), new WebClient().getCurrentWindow()); } catch (IOException e) { throw new RuntimeException("Error creating HtmlPage from String.", e); } }
java
public static HtmlPage toHtmlPage(String string) { try { URL url = new URL("http://bitvunit.codescape.de/some_page.html"); return HTMLParser.parseHtml(new StringWebResponse(string, url), new WebClient().getCurrentWindow()); } catch (IOException e) { throw new RuntimeException("Error creating HtmlPage from String.", e); } }
[ "public", "static", "HtmlPage", "toHtmlPage", "(", "String", "string", ")", "{", "try", "{", "URL", "url", "=", "new", "URL", "(", "\"http://bitvunit.codescape.de/some_page.html\"", ")", ";", "return", "HTMLParser", ".", "parseHtml", "(", "new", "StringWebResponse...
Creates a {@link HtmlPage} from a given {@link String} that contains the HTML code for that page. @param string {@link String} that contains the HTML code @return {@link HtmlPage} for this {@link String}
[ "Creates", "a", "{", "@link", "HtmlPage", "}", "from", "a", "given", "{", "@link", "String", "}", "that", "contains", "the", "HTML", "code", "for", "that", "page", "." ]
train
https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/util/html/HtmlPageUtil.java#L32-L39
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/reader/JsonWriter.java
JsonWriter.remapField
@SuppressWarnings({ "rawtypes", "unchecked" }) public <T> void remapField(Class<T> type, String fromJava, String toJson) { JsonWriterI map = this.getWrite(type); if (!(map instanceof BeansWriterASMRemap)) { map = new BeansWriterASMRemap(); registerWriter(map, type); } ((BeansWriterASMRemap) map).renameField(fromJava, toJson); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public <T> void remapField(Class<T> type, String fromJava, String toJson) { JsonWriterI map = this.getWrite(type); if (!(map instanceof BeansWriterASMRemap)) { map = new BeansWriterASMRemap(); registerWriter(map, type); } ((BeansWriterASMRemap) map).renameField(fromJava, toJson); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "<", "T", ">", "void", "remapField", "(", "Class", "<", "T", ">", "type", ",", "String", "fromJava", ",", "String", "toJson", ")", "{", "JsonWriterI", "map", "="...
remap field name in custom classes @param fromJava field name in java @param toJson field name in json @since 2.1.1
[ "remap", "field", "name", "in", "custom", "classes" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/reader/JsonWriter.java#L36-L44
rubenlagus/TelegramBots
telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/DefaultBotCommand.java
DefaultBotCommand.execute
@Override public final void execute(AbsSender absSender, User user, Chat chat, String[] arguments) { }
java
@Override public final void execute(AbsSender absSender, User user, Chat chat, String[] arguments) { }
[ "@", "Override", "public", "final", "void", "execute", "(", "AbsSender", "absSender", ",", "User", "user", ",", "Chat", "chat", ",", "String", "[", "]", "arguments", ")", "{", "}" ]
We'll override this method here for not repeating it in DefaultBotCommand's children
[ "We", "ll", "override", "this", "method", "here", "for", "not", "repeating", "it", "in", "DefaultBotCommand", "s", "children" ]
train
https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/DefaultBotCommand.java#L39-L41
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java
SSLReadServiceContext.handleAsyncError
private void handleAsyncError(boolean forceQueue, IOException exception, TCPReadCompletedCallback inCallback) { boolean fireHere = true; if (forceQueue) { // Error must be returned on a separate thread. // Reuse queuedWork object (performance), but reset the error parameters. queuedWork.setErrorParameters(getConnLink().getVirtualConnection(), this, inCallback, exception); EventEngine events = SSLChannelProvider.getEventService(); if (null == events) { Exception e = new Exception("missing event service"); FFDCFilter.processException(e, getClass().getName(), "503", this); // fall-thru below and use callback here regardless } else { // fire an event to continue this queued work Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK); event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork); events.postEvent(event); fireHere = false; } } if (fireHere) { // Call the callback right here. inCallback.error(getConnLink().getVirtualConnection(), this, exception); } }
java
private void handleAsyncError(boolean forceQueue, IOException exception, TCPReadCompletedCallback inCallback) { boolean fireHere = true; if (forceQueue) { // Error must be returned on a separate thread. // Reuse queuedWork object (performance), but reset the error parameters. queuedWork.setErrorParameters(getConnLink().getVirtualConnection(), this, inCallback, exception); EventEngine events = SSLChannelProvider.getEventService(); if (null == events) { Exception e = new Exception("missing event service"); FFDCFilter.processException(e, getClass().getName(), "503", this); // fall-thru below and use callback here regardless } else { // fire an event to continue this queued work Event event = events.createEvent(SSLEventHandler.TOPIC_QUEUED_WORK); event.setProperty(SSLEventHandler.KEY_RUNNABLE, this.queuedWork); events.postEvent(event); fireHere = false; } } if (fireHere) { // Call the callback right here. inCallback.error(getConnLink().getVirtualConnection(), this, exception); } }
[ "private", "void", "handleAsyncError", "(", "boolean", "forceQueue", ",", "IOException", "exception", ",", "TCPReadCompletedCallback", "inCallback", ")", "{", "boolean", "fireHere", "=", "true", ";", "if", "(", "forceQueue", ")", "{", "// Error must be returned on a s...
This method handles errors when they occur during the code path of an async read. It takes appropriate action based on the setting of the forceQueue parameter. If it is true, the error callback is called on a separate thread. Otherwise it is called right here. @param forceQueue @param exception @param inCallback
[ "This", "method", "handles", "errors", "when", "they", "occur", "during", "the", "code", "path", "of", "an", "async", "read", ".", "It", "takes", "appropriate", "action", "based", "on", "the", "setting", "of", "the", "forceQueue", "parameter", ".", "If", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLReadServiceContext.java#L611-L636
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/Record.java
Record.formatTableNames
public static final String formatTableNames(String strTableNames, boolean bAddQuotes) { if (bAddQuotes) if (strTableNames.indexOf(' ') != -1) strTableNames = BaseField.addQuotes(strTableNames, DBConstants.SQL_START_QUOTE, DBConstants.SQL_END_QUOTE); // Spaces in name, quotes required return strTableNames; }
java
public static final String formatTableNames(String strTableNames, boolean bAddQuotes) { if (bAddQuotes) if (strTableNames.indexOf(' ') != -1) strTableNames = BaseField.addQuotes(strTableNames, DBConstants.SQL_START_QUOTE, DBConstants.SQL_END_QUOTE); // Spaces in name, quotes required return strTableNames; }
[ "public", "static", "final", "String", "formatTableNames", "(", "String", "strTableNames", ",", "boolean", "bAddQuotes", ")", "{", "if", "(", "bAddQuotes", ")", "if", "(", "strTableNames", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "strTableN...
Utility routine to add quotes to a string if the string contains a space. @param strTableNames The table name to add quotes to if there is a space in the name. @param bAddQuotes Add the quotes? @return The new quoted table name.
[ "Utility", "routine", "to", "add", "quotes", "to", "a", "string", "if", "the", "string", "contains", "a", "space", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L847-L853
nemerosa/ontrack
ontrack-extension-general/src/main/java/net/nemerosa/ontrack/extension/general/ReleasePropertyType.java
ReleasePropertyType.canEdit
@Override public boolean canEdit(ProjectEntity entity, SecurityService securityService) { return securityService.isProjectFunctionGranted(entity, PromotionRunCreate.class); }
java
@Override public boolean canEdit(ProjectEntity entity, SecurityService securityService) { return securityService.isProjectFunctionGranted(entity, PromotionRunCreate.class); }
[ "@", "Override", "public", "boolean", "canEdit", "(", "ProjectEntity", "entity", ",", "SecurityService", "securityService", ")", "{", "return", "securityService", ".", "isProjectFunctionGranted", "(", "entity", ",", "PromotionRunCreate", ".", "class", ")", ";", "}" ...
If one can promote a build, he can also attach a release label to a build.
[ "If", "one", "can", "promote", "a", "build", "he", "can", "also", "attach", "a", "release", "label", "to", "a", "build", "." ]
train
https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-extension-general/src/main/java/net/nemerosa/ontrack/extension/general/ReleasePropertyType.java#L48-L51
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.getTileGrid
public static TileGrid getTileGrid(Point point, int zoom, Projection projection) { ProjectionTransform toWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); Point webMercatorPoint = toWebMercator.transform(point); BoundingBox boundingBox = new BoundingBox(webMercatorPoint.getX(), webMercatorPoint.getY(), webMercatorPoint.getX(), webMercatorPoint.getY()); return getTileGrid(boundingBox, zoom); }
java
public static TileGrid getTileGrid(Point point, int zoom, Projection projection) { ProjectionTransform toWebMercator = projection .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); Point webMercatorPoint = toWebMercator.transform(point); BoundingBox boundingBox = new BoundingBox(webMercatorPoint.getX(), webMercatorPoint.getY(), webMercatorPoint.getX(), webMercatorPoint.getY()); return getTileGrid(boundingBox, zoom); }
[ "public", "static", "TileGrid", "getTileGrid", "(", "Point", "point", ",", "int", "zoom", ",", "Projection", "projection", ")", "{", "ProjectionTransform", "toWebMercator", "=", "projection", ".", "getTransformation", "(", "ProjectionConstants", ".", "EPSG_WEB_MERCATO...
Get the tile grid for the location specified as the projection @param point point @param zoom zoom level @param projection projection @return tile grid @since 1.1.0
[ "Get", "the", "tile", "grid", "for", "the", "location", "specified", "as", "the", "projection" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L574-L583
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClassUtility.java
ClassUtility.getLastClassAnnotation
public static <A extends Annotation> A getLastClassAnnotation(final Class<?> sourceClass, final Class<A> annotationClass) { A annotation = null; Class<?> currentClass = sourceClass; while (annotation == null && currentClass != null) { annotation = currentClass.getAnnotation(annotationClass); currentClass = currentClass.getSuperclass(); } return annotation; }
java
public static <A extends Annotation> A getLastClassAnnotation(final Class<?> sourceClass, final Class<A> annotationClass) { A annotation = null; Class<?> currentClass = sourceClass; while (annotation == null && currentClass != null) { annotation = currentClass.getAnnotation(annotationClass); currentClass = currentClass.getSuperclass(); } return annotation; }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "getLastClassAnnotation", "(", "final", "Class", "<", "?", ">", "sourceClass", ",", "final", "Class", "<", "A", ">", "annotationClass", ")", "{", "A", "annotation", "=", "null", ";", "Class",...
Extract the last annotation requested found into the class hierarchy.<br /> Interfaces are not yet supported. @param sourceClass the class (wit its parent classes) to inspect @param annotationClass the annotation to find @param <A> the type of the requested annotation @return the request annotation or null if none have been found into the class hierarchy
[ "Extract", "the", "last", "annotation", "requested", "found", "into", "the", "class", "hierarchy", ".", "<br", "/", ">", "Interfaces", "are", "not", "yet", "supported", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ClassUtility.java#L399-L407
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java
AbstractAsymmetricCrypto.encrypt
public byte[] encrypt(String data, KeyType keyType) { return encrypt(StrUtil.bytes(data, CharsetUtil.CHARSET_UTF_8), keyType); }
java
public byte[] encrypt(String data, KeyType keyType) { return encrypt(StrUtil.bytes(data, CharsetUtil.CHARSET_UTF_8), keyType); }
[ "public", "byte", "[", "]", "encrypt", "(", "String", "data", ",", "KeyType", "keyType", ")", "{", "return", "encrypt", "(", "StrUtil", ".", "bytes", "(", "data", ",", "CharsetUtil", ".", "CHARSET_UTF_8", ")", ",", "keyType", ")", ";", "}" ]
加密,使用UTF-8编码 @param data 被加密的字符串 @param keyType 私钥或公钥 {@link KeyType} @return 加密后的bytes
[ "加密,使用UTF", "-", "8编码" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L100-L102
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/text/inflector/RuleBasedPluralizer.java
RuleBasedPluralizer.postProcess
protected String postProcess(String trimmedWord, String pluralizedWord) { if (pluPattern1.matcher(trimmedWord).matches()) { return pluralizedWord.toUpperCase(locale); } else if (pluPattern2.matcher(trimmedWord).matches()) { return pluralizedWord.substring(0, 1) .toUpperCase(locale) + pluralizedWord.substring(1); } return pluralizedWord; }
java
protected String postProcess(String trimmedWord, String pluralizedWord) { if (pluPattern1.matcher(trimmedWord).matches()) { return pluralizedWord.toUpperCase(locale); } else if (pluPattern2.matcher(trimmedWord).matches()) { return pluralizedWord.substring(0, 1) .toUpperCase(locale) + pluralizedWord.substring(1); } return pluralizedWord; }
[ "protected", "String", "postProcess", "(", "String", "trimmedWord", ",", "String", "pluralizedWord", ")", "{", "if", "(", "pluPattern1", ".", "matcher", "(", "trimmedWord", ")", ".", "matches", "(", ")", ")", "{", "return", "pluralizedWord", ".", "toUpperCase"...
<p> Apply processing to <code>pluralizedWord</code>. This implementation ensures the case of the plural is consistent with the case of the input word. </p> <p> If <code>trimmedWord</code> is all uppercase, then <code>pluralizedWord</code> is uppercased. If <code>trimmedWord</code> is titlecase, then <code>pluralizedWord</code> is titlecased. </p> @param trimmedWord the input word, with leading and trailing whitespace removed @param pluralizedWord the pluralized word @return the <code>pluralizedWord</code> after processing
[ "<p", ">", "Apply", "processing", "to", "<code", ">", "pluralizedWord<", "/", "code", ">", ".", "This", "implementation", "ensures", "the", "case", "of", "the", "plural", "is", "consistent", "with", "the", "case", "of", "the", "input", "word", ".", "<", ...
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/text/inflector/RuleBasedPluralizer.java#L241-L247
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/MessageFormat.java
MessageFormat.setFormatByArgumentIndex
public void setFormatByArgumentIndex(int argumentIndex, Format newFormat) { for (int j = 0; j <= maxOffset; j++) { if (argumentNumbers[j] == argumentIndex) { formats[j] = newFormat; } } }
java
public void setFormatByArgumentIndex(int argumentIndex, Format newFormat) { for (int j = 0; j <= maxOffset; j++) { if (argumentNumbers[j] == argumentIndex) { formats[j] = newFormat; } } }
[ "public", "void", "setFormatByArgumentIndex", "(", "int", "argumentIndex", ",", "Format", "newFormat", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<=", "maxOffset", ";", "j", "++", ")", "{", "if", "(", "argumentNumbers", "[", "j", "]", "==",...
Sets the format to use for the format elements within the previously set pattern string that use the given argument index. The argument index is part of the format element definition and represents an index into the <code>arguments</code> array passed to the <code>format</code> methods or the result array returned by the <code>parse</code> methods. <p> If the argument index is used for more than one format element in the pattern string, then the new format is used for all such format elements. If the argument index is not used for any format element in the pattern string, then the new format is ignored. @param argumentIndex the argument index for which to use the new format @param newFormat the new format to use @since 1.4
[ "Sets", "the", "format", "to", "use", "for", "the", "format", "elements", "within", "the", "previously", "set", "pattern", "string", "that", "use", "the", "given", "argument", "index", ".", "The", "argument", "index", "is", "part", "of", "the", "format", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/MessageFormat.java#L667-L673
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/RangeDistributionBuilder.java
RangeDistributionBuilder.add
public RangeDistributionBuilder add(Number value, int count) { if (greaterOrEqualsThan(value, bottomLimits[0])) { addValue(value, count); isEmpty = false; } return this; }
java
public RangeDistributionBuilder add(Number value, int count) { if (greaterOrEqualsThan(value, bottomLimits[0])) { addValue(value, count); isEmpty = false; } return this; }
[ "public", "RangeDistributionBuilder", "add", "(", "Number", "value", ",", "int", "count", ")", "{", "if", "(", "greaterOrEqualsThan", "(", "value", ",", "bottomLimits", "[", "0", "]", ")", ")", "{", "addValue", "(", "value", ",", "count", ")", ";", "isEm...
Increments an entry @param value the value to use to pick the entry to increment @param count the number by which to increment
[ "Increments", "an", "entry" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/RangeDistributionBuilder.java#L77-L83
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java
MetricRegistryConfiguration.fromConfiguration
public static MetricRegistryConfiguration fromConfiguration(Configuration configuration) { ScopeFormats scopeFormats; try { scopeFormats = ScopeFormats.fromConfig(configuration); } catch (Exception e) { LOG.warn("Failed to parse scope format, using default scope formats", e); scopeFormats = ScopeFormats.fromConfig(new Configuration()); } char delim; try { delim = configuration.getString(MetricOptions.SCOPE_DELIMITER).charAt(0); } catch (Exception e) { LOG.warn("Failed to parse delimiter, using default delimiter.", e); delim = '.'; } final long maximumFrameSize = AkkaRpcServiceUtils.extractMaximumFramesize(configuration); // padding to account for serialization overhead final long messageSizeLimitPadding = 256; return new MetricRegistryConfiguration(scopeFormats, delim, maximumFrameSize - messageSizeLimitPadding); }
java
public static MetricRegistryConfiguration fromConfiguration(Configuration configuration) { ScopeFormats scopeFormats; try { scopeFormats = ScopeFormats.fromConfig(configuration); } catch (Exception e) { LOG.warn("Failed to parse scope format, using default scope formats", e); scopeFormats = ScopeFormats.fromConfig(new Configuration()); } char delim; try { delim = configuration.getString(MetricOptions.SCOPE_DELIMITER).charAt(0); } catch (Exception e) { LOG.warn("Failed to parse delimiter, using default delimiter.", e); delim = '.'; } final long maximumFrameSize = AkkaRpcServiceUtils.extractMaximumFramesize(configuration); // padding to account for serialization overhead final long messageSizeLimitPadding = 256; return new MetricRegistryConfiguration(scopeFormats, delim, maximumFrameSize - messageSizeLimitPadding); }
[ "public", "static", "MetricRegistryConfiguration", "fromConfiguration", "(", "Configuration", "configuration", ")", "{", "ScopeFormats", "scopeFormats", ";", "try", "{", "scopeFormats", "=", "ScopeFormats", ".", "fromConfig", "(", "configuration", ")", ";", "}", "catc...
Create a metric registry configuration object from the given {@link Configuration}. @param configuration to generate the metric registry configuration from @return Metric registry configuration generated from the configuration
[ "Create", "a", "metric", "registry", "configuration", "object", "from", "the", "given", "{", "@link", "Configuration", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/MetricRegistryConfiguration.java#L83-L106
openbase/jul
extension/type/storage/src/main/java/org/openbase/jul/extension/type/storage/registry/consistency/TransformationFrameConsistencyHandler.java
TransformationFrameConsistencyHandler.verifyAndUpdatePlacement
protected PlacementConfig verifyAndUpdatePlacement(final String alias, final PlacementConfig placementConfig) throws CouldNotPerformException, EntryModification { try { if (alias == null || alias.isEmpty()) { throw new NotAvailableException("label"); } if (placementConfig == null) { throw new NotAvailableException("placementconfig"); } String frameId = generateFrameId(alias, placementConfig); // verify and update frame id if (placementConfig.getTransformationFrameId().equals(frameId)) { return null; } return placementConfig.toBuilder().setTransformationFrameId(frameId).build(); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not verify and update placement!", ex); } }
java
protected PlacementConfig verifyAndUpdatePlacement(final String alias, final PlacementConfig placementConfig) throws CouldNotPerformException, EntryModification { try { if (alias == null || alias.isEmpty()) { throw new NotAvailableException("label"); } if (placementConfig == null) { throw new NotAvailableException("placementconfig"); } String frameId = generateFrameId(alias, placementConfig); // verify and update frame id if (placementConfig.getTransformationFrameId().equals(frameId)) { return null; } return placementConfig.toBuilder().setTransformationFrameId(frameId).build(); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not verify and update placement!", ex); } }
[ "protected", "PlacementConfig", "verifyAndUpdatePlacement", "(", "final", "String", "alias", ",", "final", "PlacementConfig", "placementConfig", ")", "throws", "CouldNotPerformException", ",", "EntryModification", "{", "try", "{", "if", "(", "alias", "==", "null", "||...
Methods verifies and updates the transformation frame id for the given placement configuration. If the given placement configuration is up to date this the method returns null. @param alias @param placementConfig @return @throws CouldNotPerformException @throws EntryModification
[ "Methods", "verifies", "and", "updates", "the", "transformation", "frame", "id", "for", "the", "given", "placement", "configuration", ".", "If", "the", "given", "placement", "configuration", "is", "up", "to", "date", "this", "the", "method", "returns", "null", ...
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/storage/src/main/java/org/openbase/jul/extension/type/storage/registry/consistency/TransformationFrameConsistencyHandler.java#L64-L85
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java
GlobalizationPreferences.guessDateFormat
protected DateFormat guessDateFormat(int dateStyle, int timeStyle) { DateFormat result; ULocale dfLocale = getAvailableLocale(TYPE_DATEFORMAT); if (dfLocale == null) { dfLocale = ULocale.ROOT; } if (timeStyle == DF_NONE) { result = DateFormat.getDateInstance(getCalendar(), dateStyle, dfLocale); } else if (dateStyle == DF_NONE) { result = DateFormat.getTimeInstance(getCalendar(), timeStyle, dfLocale); } else { result = DateFormat.getDateTimeInstance(getCalendar(), dateStyle, timeStyle, dfLocale); } return result; }
java
protected DateFormat guessDateFormat(int dateStyle, int timeStyle) { DateFormat result; ULocale dfLocale = getAvailableLocale(TYPE_DATEFORMAT); if (dfLocale == null) { dfLocale = ULocale.ROOT; } if (timeStyle == DF_NONE) { result = DateFormat.getDateInstance(getCalendar(), dateStyle, dfLocale); } else if (dateStyle == DF_NONE) { result = DateFormat.getTimeInstance(getCalendar(), timeStyle, dfLocale); } else { result = DateFormat.getDateTimeInstance(getCalendar(), dateStyle, timeStyle, dfLocale); } return result; }
[ "protected", "DateFormat", "guessDateFormat", "(", "int", "dateStyle", ",", "int", "timeStyle", ")", "{", "DateFormat", "result", ";", "ULocale", "dfLocale", "=", "getAvailableLocale", "(", "TYPE_DATEFORMAT", ")", ";", "if", "(", "dfLocale", "==", "null", ")", ...
This function can be overridden by subclasses to use different heuristics. <b>It MUST return a 'safe' value, one whose modification will not affect this object.</b> @param dateStyle @param timeStyle @hide draft / provisional / internal are hidden on Android
[ "This", "function", "can", "be", "overridden", "by", "subclasses", "to", "use", "different", "heuristics", ".", "<b", ">", "It", "MUST", "return", "a", "safe", "value", "one", "whose", "modification", "will", "not", "affect", "this", "object", ".", "<", "/...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L915-L929
google/j2objc
jre_emul/android/frameworks/base/core/java/android/util/Log.java
Log.println
public static int println(int priority, String tag, String msg) { return println_native(LOG_ID_MAIN, priority, tag, msg); }
java
public static int println(int priority, String tag, String msg) { return println_native(LOG_ID_MAIN, priority, tag, msg); }
[ "public", "static", "int", "println", "(", "int", "priority", ",", "String", "tag", ",", "String", "msg", ")", "{", "return", "println_native", "(", "LOG_ID_MAIN", ",", "priority", ",", "tag", ",", "msg", ")", ";", "}" ]
Low-level logging call. @param priority The priority/type of this log message @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 The number of bytes written.
[ "Low", "-", "level", "logging", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/Log.java#L395-L397
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/LoadBalancerBackendAddressPoolsInner.java
LoadBalancerBackendAddressPoolsInner.getAsync
public Observable<BackendAddressPoolInner> getAsync(String resourceGroupName, String loadBalancerName, String backendAddressPoolName) { return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, backendAddressPoolName).map(new Func1<ServiceResponse<BackendAddressPoolInner>, BackendAddressPoolInner>() { @Override public BackendAddressPoolInner call(ServiceResponse<BackendAddressPoolInner> response) { return response.body(); } }); }
java
public Observable<BackendAddressPoolInner> getAsync(String resourceGroupName, String loadBalancerName, String backendAddressPoolName) { return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, backendAddressPoolName).map(new Func1<ServiceResponse<BackendAddressPoolInner>, BackendAddressPoolInner>() { @Override public BackendAddressPoolInner call(ServiceResponse<BackendAddressPoolInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BackendAddressPoolInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "loadBalancerName", ",", "String", "backendAddressPoolName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "load...
Gets load balancer backend address pool. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @param backendAddressPoolName The name of the backend address pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackendAddressPoolInner object
[ "Gets", "load", "balancer", "backend", "address", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/LoadBalancerBackendAddressPoolsInner.java#L233-L240
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/Compound.java
Compound.field2inout
public void field2inout(Object o, String field, Object comp, String inout) { controller.mapInField(o, field, comp, inout); controller.mapOutField(comp, inout, o, field); }
java
public void field2inout(Object o, String field, Object comp, String inout) { controller.mapInField(o, field, comp, inout); controller.mapOutField(comp, inout, o, field); }
[ "public", "void", "field2inout", "(", "Object", "o", ",", "String", "field", ",", "Object", "comp", ",", "String", "inout", ")", "{", "controller", ".", "mapInField", "(", "o", ",", "field", ",", "comp", ",", "inout", ")", ";", "controller", ".", "mapO...
Maps a field to an In and Out field @param o the object @param field the field name @param comp the component @param inout the field tagged with In and Out
[ "Maps", "a", "field", "to", "an", "In", "and", "Out", "field" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Compound.java#L167-L170
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java
CoreRemoteMongoCollectionImpl.updateOne
public RemoteUpdateResult updateOne(final Bson filter, final Bson update) { return updateOne(filter, update, new RemoteUpdateOptions()); }
java
public RemoteUpdateResult updateOne(final Bson filter, final Bson update) { return updateOne(filter, update, new RemoteUpdateOptions()); }
[ "public", "RemoteUpdateResult", "updateOne", "(", "final", "Bson", "filter", ",", "final", "Bson", "update", ")", "{", "return", "updateOne", "(", "filter", ",", "update", ",", "new", "RemoteUpdateOptions", "(", ")", ")", ";", "}" ]
Update a single document in the collection according to the specified arguments. @param filter a document describing the query filter, which may not be null. @param update a document describing the update, which may not be null. The update to apply must include only update operators. @return the result of the update one operation
[ "Update", "a", "single", "document", "in", "the", "collection", "according", "to", "the", "specified", "arguments", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java#L396-L398
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
BaseMessageFilter.setMessageReceiver
public void setMessageReceiver(BaseMessageReceiver messageReceiver, Integer intID) { if ((messageReceiver != null) || (intID != null)) if ((m_intID != null) || (m_messageReceiver != null)) Util.getLogger().warning("BaseMessageFilter/setMessageReceiver()----Error - Filter added twice."); m_messageReceiver = messageReceiver; m_intID = intID; }
java
public void setMessageReceiver(BaseMessageReceiver messageReceiver, Integer intID) { if ((messageReceiver != null) || (intID != null)) if ((m_intID != null) || (m_messageReceiver != null)) Util.getLogger().warning("BaseMessageFilter/setMessageReceiver()----Error - Filter added twice."); m_messageReceiver = messageReceiver; m_intID = intID; }
[ "public", "void", "setMessageReceiver", "(", "BaseMessageReceiver", "messageReceiver", ",", "Integer", "intID", ")", "{", "if", "(", "(", "messageReceiver", "!=", "null", ")", "||", "(", "intID", "!=", "null", ")", ")", "if", "(", "(", "m_intID", "!=", "nu...
Set the message receiver for this filter. @param messageReceiver The message receiver.
[ "Set", "the", "message", "receiver", "for", "this", "filter", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L373-L380
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java
Text.isDescendant
public static boolean isDescendant(String path, String descendant) { return !path.equals(descendant) && descendant.startsWith(path) && descendant.charAt(path.length()) == '/'; }
java
public static boolean isDescendant(String path, String descendant) { return !path.equals(descendant) && descendant.startsWith(path) && descendant.charAt(path.length()) == '/'; }
[ "public", "static", "boolean", "isDescendant", "(", "String", "path", ",", "String", "descendant", ")", "{", "return", "!", "path", ".", "equals", "(", "descendant", ")", "&&", "descendant", ".", "startsWith", "(", "path", ")", "&&", "descendant", ".", "ch...
Determines if the <code>descendant</code> path is hierarchical a descendant of <code>path</code>. @param path the current path @param descendant the potential descendant @return <code>true</code> if the <code>descendant</code> is a descendant; <code>false</code> otherwise.
[ "Determines", "if", "the", "<code", ">", "descendant<", "/", "code", ">", "path", "is", "hierarchical", "a", "descendant", "of", "<code", ">", "path<", "/", "code", ">", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L717-L720
JOML-CI/JOML
src/org/joml/Intersectiond.java
Intersectiond.intersectLineSegmentAab
public static int intersectLineSegmentAab(Vector3dc p0, Vector3dc p1, Vector3dc min, Vector3dc max, Vector2d result) { return intersectLineSegmentAab(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), min.x(), min.y(), min.z(), max.x(), max.y(), max.z(), result); }
java
public static int intersectLineSegmentAab(Vector3dc p0, Vector3dc p1, Vector3dc min, Vector3dc max, Vector2d result) { return intersectLineSegmentAab(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), min.x(), min.y(), min.z(), max.x(), max.y(), max.z(), result); }
[ "public", "static", "int", "intersectLineSegmentAab", "(", "Vector3dc", "p0", ",", "Vector3dc", "p1", ",", "Vector3dc", "min", ",", "Vector3dc", "max", ",", "Vector2d", "result", ")", "{", "return", "intersectLineSegmentAab", "(", "p0", ".", "x", "(", ")", "...
Determine whether the undirected line segment with the end points <code>p0</code> and <code>p1</code> intersects the axis-aligned box given as its minimum corner <code>min</code> and maximum corner <code>max</code>, and return the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + p0 * (p1 - p0)</i> of the near and far point of intersection. <p> This method returns <code>true</code> for a line segment whose either end point lies inside the axis-aligned box. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a> @see #intersectLineSegmentAab(Vector3dc, Vector3dc, Vector3dc, Vector3dc, Vector2d) @param p0 the line segment's first end point @param p1 the line segment's second end point @param min the minimum corner of the axis-aligned box @param max the maximum corner of the axis-aligned box @param result a vector which will hold the resulting values of the parameter <i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection iff the line segment intersects the axis-aligned box @return {@link #INSIDE} if the line segment lies completely inside of the axis-aligned box; or {@link #OUTSIDE} if the line segment lies completely outside of the axis-aligned box; or {@link #ONE_INTERSECTION} if one of the end points of the line segment lies inside of the axis-aligned box; or {@link #TWO_INTERSECTION} if the line segment intersects two sides of the axis-aligned box or lies on an edge or a side of the box
[ "Determine", "whether", "the", "undirected", "line", "segment", "with", "the", "end", "points", "<code", ">", "p0<", "/", "code", ">", "and", "<code", ">", "p1<", "/", "code", ">", "intersects", "the", "axis", "-", "aligned", "box", "given", "as", "its",...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L2569-L2571
square/dagger
core/src/main/java/dagger/internal/Keys.java
Keys.get
private static String get(Type type, Annotation annotation) { type = boxIfPrimitive(type); if (annotation == null && type instanceof Class && !((Class<?>) type).isArray()) { return ((Class<?>) type).getName(); } StringBuilder result = new StringBuilder(); if (annotation != null) { result.append(annotation).append("/"); } typeToString(type, result, true); return result.toString(); }
java
private static String get(Type type, Annotation annotation) { type = boxIfPrimitive(type); if (annotation == null && type instanceof Class && !((Class<?>) type).isArray()) { return ((Class<?>) type).getName(); } StringBuilder result = new StringBuilder(); if (annotation != null) { result.append(annotation).append("/"); } typeToString(type, result, true); return result.toString(); }
[ "private", "static", "String", "get", "(", "Type", "type", ",", "Annotation", "annotation", ")", "{", "type", "=", "boxIfPrimitive", "(", "type", ")", ";", "if", "(", "annotation", "==", "null", "&&", "type", "instanceof", "Class", "&&", "!", "(", "(", ...
Returns a key for {@code type} annotated by {@code annotation}.
[ "Returns", "a", "key", "for", "{" ]
train
https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/core/src/main/java/dagger/internal/Keys.java#L71-L82
emfjson/emfjson-jackson
src/main/java/org/emfjson/jackson/annotations/JsonAnnotations.java
JsonAnnotations.getTypeProperty
public static EcoreTypeInfo getTypeProperty(final EClassifier classifier) { String property = getValue(classifier, "JsonType", "property"); String use = getValue(classifier, "JsonType", "use"); ValueReader<String, EClass> valueReader = EcoreTypeInfo.defaultValueReader; ValueWriter<EClass, String> valueWriter = EcoreTypeInfo.defaultValueWriter; if (use != null) { EcoreTypeInfo.USE useType = EcoreTypeInfo.USE.valueOf(use.toUpperCase()); if (useType == NAME) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getName(); } else if (useType == CLASS) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getInstanceClassName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByQualifiedName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getInstanceClassName(); } else { valueReader = EcoreTypeInfo.defaultValueReader; valueWriter = EcoreTypeInfo.defaultValueWriter; } } return property != null ? new EcoreTypeInfo(property, valueReader, valueWriter): null; }
java
public static EcoreTypeInfo getTypeProperty(final EClassifier classifier) { String property = getValue(classifier, "JsonType", "property"); String use = getValue(classifier, "JsonType", "use"); ValueReader<String, EClass> valueReader = EcoreTypeInfo.defaultValueReader; ValueWriter<EClass, String> valueWriter = EcoreTypeInfo.defaultValueWriter; if (use != null) { EcoreTypeInfo.USE useType = EcoreTypeInfo.USE.valueOf(use.toUpperCase()); if (useType == NAME) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getName(); } else if (useType == CLASS) { valueReader = (value, context) -> { EClass type = value != null && value.equalsIgnoreCase(classifier.getInstanceClassName()) ? (EClass) classifier: null; if (type == null) { type = EMFContext.findEClassByQualifiedName(value, classifier.getEPackage()); } return type; }; valueWriter = (value, context) -> value.getInstanceClassName(); } else { valueReader = EcoreTypeInfo.defaultValueReader; valueWriter = EcoreTypeInfo.defaultValueWriter; } } return property != null ? new EcoreTypeInfo(property, valueReader, valueWriter): null; }
[ "public", "static", "EcoreTypeInfo", "getTypeProperty", "(", "final", "EClassifier", "classifier", ")", "{", "String", "property", "=", "getValue", "(", "classifier", ",", "\"JsonType\"", ",", "\"property\"", ")", ";", "String", "use", "=", "getValue", "(", "cla...
Returns the property that should be use to store the type information of the classifier. @param classifier @return the type information property
[ "Returns", "the", "property", "that", "should", "be", "use", "to", "store", "the", "type", "information", "of", "the", "classifier", "." ]
train
https://github.com/emfjson/emfjson-jackson/blob/5f4488d1b07d499003351606cf76ee0c4ac39964/src/main/java/org/emfjson/jackson/annotations/JsonAnnotations.java#L71-L106
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_PUT
public void packName_PUT(String packName, OvhPackAdsl body) throws IOException { String qPath = "/pack/xdsl/{packName}"; StringBuilder sb = path(qPath, packName); exec(qPath, "PUT", sb.toString(), body); }
java
public void packName_PUT(String packName, OvhPackAdsl body) throws IOException { String qPath = "/pack/xdsl/{packName}"; StringBuilder sb = path(qPath, packName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "packName_PUT", "(", "String", "packName", ",", "OvhPackAdsl", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "packName", ")", ";", "...
Alter this object properties REST: PUT /pack/xdsl/{packName} @param body [required] New object properties @param packName [required] The internal name of your pack
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L486-L490
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.toLegacyType
public static String toLegacyType(String keyword, String value) { String legacyType = KeyTypeData.toLegacyType(keyword, value, null, null); if (legacyType == null) { // Checks if the specified locale type is well-formed with the legacy locale syntax. // // Note: // Neither ICU nor LDML/CLDR provides the definition of keyword syntax. // However, a type should not contain '=' obviously. For now, all existing // types are using ASCII alphabetic letters with a few symbol letters. We won't // add any new type that is not compatible with the BCP 47 syntax except timezone // IDs. For now, we assume a valid type start with [0-9a-zA-Z], but may contain // '-' '_' '/' in the middle. if (value.matches("[0-9a-zA-Z]+([_/\\-][0-9a-zA-Z]+)*")) { legacyType = AsciiUtil.toLowerString(value); } } return legacyType; }
java
public static String toLegacyType(String keyword, String value) { String legacyType = KeyTypeData.toLegacyType(keyword, value, null, null); if (legacyType == null) { // Checks if the specified locale type is well-formed with the legacy locale syntax. // // Note: // Neither ICU nor LDML/CLDR provides the definition of keyword syntax. // However, a type should not contain '=' obviously. For now, all existing // types are using ASCII alphabetic letters with a few symbol letters. We won't // add any new type that is not compatible with the BCP 47 syntax except timezone // IDs. For now, we assume a valid type start with [0-9a-zA-Z], but may contain // '-' '_' '/' in the middle. if (value.matches("[0-9a-zA-Z]+([_/\\-][0-9a-zA-Z]+)*")) { legacyType = AsciiUtil.toLowerString(value); } } return legacyType; }
[ "public", "static", "String", "toLegacyType", "(", "String", "keyword", ",", "String", "value", ")", "{", "String", "legacyType", "=", "KeyTypeData", ".", "toLegacyType", "(", "keyword", ",", "value", ",", "null", ",", "null", ")", ";", "if", "(", "legacyT...
<strong>[icu]</strong> Converts the specified keyword value (BCP 47 Unicode locale extension type, or legacy type or type alias) to the canonical legacy type. For example, the legacy type "phonebook" is returned for the input BCP 47 Unicode locale extension type "phonebk" with the keyword "collation" (or "co"). <p> When the specified keyword is not recognized, but the specified value satisfies the syntax of legacy key, or when the specified keyword allows 'variable' type and the specified value satisfies the syntax, the lower-case version of the input value will be returned. For example, <code>toLegacyType("Foo", "Bar")</code> returns "bar", <code>toLegacyType("vt", "00A4")</code> returns "00a4". @param keyword the locale keyword (either legacy keyword such as "collation" or BCP 47 Unicode locale extension key such as "co"). @param value the locale keyword value (either BCP 47 Unicode locale extension type such as "phonebk" or legacy keyword value such as "phonebook"). @return the well-formed legacy type, or null if the specified keyword value cannot be mapped to a well-formed legacy type. @see #toUnicodeLocaleType(String, String)
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Converts", "the", "specified", "keyword", "value", "(", "BCP", "47", "Unicode", "locale", "extension", "type", "or", "legacy", "type", "or", "type", "alias", ")", "to", "the", "canonical", "legac...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L3416-L3433
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.notEmpty
public static Validator<CharSequence> notEmpty(@NonNull final Context context) { return new NotEmptyValidator(context, R.string.default_error_message); }
java
public static Validator<CharSequence> notEmpty(@NonNull final Context context) { return new NotEmptyValidator(context, R.string.default_error_message); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "notEmpty", "(", "@", "NonNull", "final", "Context", "context", ")", "{", "return", "new", "NotEmptyValidator", "(", "context", ",", "R", ".", "string", ".", "default_error_message", ")", ";", "}" ]
Creates and returns a validator, which allows to validate texts to ensure, that they are not empty. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "are", "not", "empty", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L386-L388
javamelody/javamelody
javamelody-core/src/main/java/net/bull/javamelody/JdbcWrapper.java
JdbcWrapper.createDataSourceProxy
public DataSource createDataSourceProxy(String name, final DataSource dataSource) { assert dataSource != null; JdbcWrapperHelper.pullDataSourceProperties(name, dataSource); final InvocationHandler invocationHandler = new AbstractInvocationHandler<DataSource>( dataSource) { private static final long serialVersionUID = 1L; /** {@inheritDoc} */ @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = method.invoke(dataSource, args); if (result instanceof Connection) { result = createConnectionProxy((Connection) result); } return result; } }; return createProxy(dataSource, invocationHandler); }
java
public DataSource createDataSourceProxy(String name, final DataSource dataSource) { assert dataSource != null; JdbcWrapperHelper.pullDataSourceProperties(name, dataSource); final InvocationHandler invocationHandler = new AbstractInvocationHandler<DataSource>( dataSource) { private static final long serialVersionUID = 1L; /** {@inheritDoc} */ @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object result = method.invoke(dataSource, args); if (result instanceof Connection) { result = createConnectionProxy((Connection) result); } return result; } }; return createProxy(dataSource, invocationHandler); }
[ "public", "DataSource", "createDataSourceProxy", "(", "String", "name", ",", "final", "DataSource", "dataSource", ")", "{", "assert", "dataSource", "!=", "null", ";", "JdbcWrapperHelper", ".", "pullDataSourceProperties", "(", "name", ",", "dataSource", ")", ";", "...
Crée un proxy d'une {@link DataSource} jdbc. @param name String @param dataSource DataSource @return DataSource
[ "Crée", "un", "proxy", "d", "une", "{" ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/JdbcWrapper.java#L771-L789
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/GridLayout.java
GridLayout.createLayoutData
public static LayoutData createLayoutData( Alignment horizontalAlignment, Alignment verticalAlignment, boolean grabExtraHorizontalSpace, boolean grabExtraVerticalSpace) { return createLayoutData(horizontalAlignment, verticalAlignment, grabExtraHorizontalSpace, grabExtraVerticalSpace, 1, 1); }
java
public static LayoutData createLayoutData( Alignment horizontalAlignment, Alignment verticalAlignment, boolean grabExtraHorizontalSpace, boolean grabExtraVerticalSpace) { return createLayoutData(horizontalAlignment, verticalAlignment, grabExtraHorizontalSpace, grabExtraVerticalSpace, 1, 1); }
[ "public", "static", "LayoutData", "createLayoutData", "(", "Alignment", "horizontalAlignment", ",", "Alignment", "verticalAlignment", ",", "boolean", "grabExtraHorizontalSpace", ",", "boolean", "grabExtraVerticalSpace", ")", "{", "return", "createLayoutData", "(", "horizont...
Creates a layout data object for {@code GridLayout}:s that specify the horizontal and vertical alignment for the component in case the cell space is larger than the preferred size of the component. This method also has fields for indicating that the component would like to take more space if available to the container. For example, if the container is assigned is assigned an area of 50x15, but all the child components in the grid together only asks for 40x10, the remaining 10 columns and 5 rows will be empty. If just a single component asks for extra space horizontally and/or vertically, the grid will expand out to fill the entire area and the text space will be assigned to the component that asked for it. @param horizontalAlignment Horizontal alignment strategy @param verticalAlignment Vertical alignment strategy @param grabExtraHorizontalSpace If set to {@code true}, this component will ask to be assigned extra horizontal space if there is any to assign @param grabExtraVerticalSpace If set to {@code true}, this component will ask to be assigned extra vertical space if there is any to assign @return The layout data object containing the specified alignments and size requirements
[ "Creates", "a", "layout", "data", "object", "for", "{", "@code", "GridLayout", "}", ":", "s", "that", "specify", "the", "horizontal", "and", "vertical", "alignment", "for", "the", "component", "in", "case", "the", "cell", "space", "is", "larger", "than", "...
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/GridLayout.java#L131-L138
Stratio/stratio-cassandra
src/java/org/apache/cassandra/streaming/messages/StreamInitMessage.java
StreamInitMessage.createMessage
public ByteBuffer createMessage(boolean compress, int version) { int header = 0; // set compression bit. if (compress) header |= 4; // set streaming bit header |= 8; // Setting up the version bit header |= (version << 8); byte[] bytes; try { int size = (int)StreamInitMessage.serializer.serializedSize(this, version); DataOutputBuffer buffer = new DataOutputBuffer(size); StreamInitMessage.serializer.serialize(this, buffer, version); bytes = buffer.getData(); } catch (IOException e) { throw new RuntimeException(e); } assert bytes.length > 0; ByteBuffer buffer = ByteBuffer.allocate(4 + 4 + bytes.length); buffer.putInt(MessagingService.PROTOCOL_MAGIC); buffer.putInt(header); buffer.put(bytes); buffer.flip(); return buffer; }
java
public ByteBuffer createMessage(boolean compress, int version) { int header = 0; // set compression bit. if (compress) header |= 4; // set streaming bit header |= 8; // Setting up the version bit header |= (version << 8); byte[] bytes; try { int size = (int)StreamInitMessage.serializer.serializedSize(this, version); DataOutputBuffer buffer = new DataOutputBuffer(size); StreamInitMessage.serializer.serialize(this, buffer, version); bytes = buffer.getData(); } catch (IOException e) { throw new RuntimeException(e); } assert bytes.length > 0; ByteBuffer buffer = ByteBuffer.allocate(4 + 4 + bytes.length); buffer.putInt(MessagingService.PROTOCOL_MAGIC); buffer.putInt(header); buffer.put(bytes); buffer.flip(); return buffer; }
[ "public", "ByteBuffer", "createMessage", "(", "boolean", "compress", ",", "int", "version", ")", "{", "int", "header", "=", "0", ";", "// set compression bit.", "if", "(", "compress", ")", "header", "|=", "4", ";", "// set streaming bit", "header", "|=", "8", ...
Create serialized message. @param compress true if message is compressed @param version Streaming protocol version @return serialized message in ByteBuffer format
[ "Create", "serialized", "message", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/streaming/messages/StreamInitMessage.java#L66-L97
Impetus/Kundera
src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClientFactory.java
OracleNoSQLClientFactory.populateIndexer
private void populateIndexer(String indexerClass, Client client) { if (indexerClass != null && indexerClass.equals(OracleNoSQLInvertedIndexer.class.getName())) { ((OracleNoSQLInvertedIndexer) indexManager.getIndexer()).setKvStore(kvStore); ((OracleNoSQLInvertedIndexer) indexManager.getIndexer()).setHandler(((OracleNoSQLClient) client) .getHandler()); } }
java
private void populateIndexer(String indexerClass, Client client) { if (indexerClass != null && indexerClass.equals(OracleNoSQLInvertedIndexer.class.getName())) { ((OracleNoSQLInvertedIndexer) indexManager.getIndexer()).setKvStore(kvStore); ((OracleNoSQLInvertedIndexer) indexManager.getIndexer()).setHandler(((OracleNoSQLClient) client) .getHandler()); } }
[ "private", "void", "populateIndexer", "(", "String", "indexerClass", ",", "Client", "client", ")", "{", "if", "(", "indexerClass", "!=", "null", "&&", "indexerClass", ".", "equals", "(", "OracleNoSQLInvertedIndexer", ".", "class", ".", "getName", "(", ")", ")"...
Populates {@link Indexer} into {@link IndexManager} @param indexerClass @param client
[ "Populates", "{", "@link", "Indexer", "}", "into", "{", "@link", "IndexManager", "}" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClientFactory.java#L143-L151
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java
Collator.getDisplayName
static public String getDisplayName(Locale objectLocale, Locale displayLocale) { return getShim().getDisplayName(ULocale.forLocale(objectLocale), ULocale.forLocale(displayLocale)); }
java
static public String getDisplayName(Locale objectLocale, Locale displayLocale) { return getShim().getDisplayName(ULocale.forLocale(objectLocale), ULocale.forLocale(displayLocale)); }
[ "static", "public", "String", "getDisplayName", "(", "Locale", "objectLocale", ",", "Locale", "displayLocale", ")", "{", "return", "getShim", "(", ")", ".", "getDisplayName", "(", "ULocale", ".", "forLocale", "(", "objectLocale", ")", ",", "ULocale", ".", "for...
<strong>[icu]</strong> Returns the name of the collator for the objectLocale, localized for the displayLocale. @param objectLocale the locale of the collator @param displayLocale the locale for the collator's display name @return the display name
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "the", "name", "of", "the", "collator", "for", "the", "objectLocale", "localized", "for", "the", "displayLocale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java#L1060-L1063
google/closure-compiler
src/com/google/javascript/jscomp/CrossChunkCodeMotion.java
CrossChunkCodeMotion.isUndefinedTypeofGuardFor
private boolean isUndefinedTypeofGuardFor(Node expression, Node reference) { if (expression.isNE()) { Node undefinedString = expression.getFirstChild(); Node typeofNode = expression.getLastChild(); return undefinedString.isString() && undefinedString.getString().equals("undefined") && typeofNode.isTypeOf() && typeofNode.getFirstChild().isEquivalentTo(reference); } else { return false; } }
java
private boolean isUndefinedTypeofGuardFor(Node expression, Node reference) { if (expression.isNE()) { Node undefinedString = expression.getFirstChild(); Node typeofNode = expression.getLastChild(); return undefinedString.isString() && undefinedString.getString().equals("undefined") && typeofNode.isTypeOf() && typeofNode.getFirstChild().isEquivalentTo(reference); } else { return false; } }
[ "private", "boolean", "isUndefinedTypeofGuardFor", "(", "Node", "expression", ",", "Node", "reference", ")", "{", "if", "(", "expression", ".", "isNE", "(", ")", ")", "{", "Node", "undefinedString", "=", "expression", ".", "getFirstChild", "(", ")", ";", "No...
Is the expression of the form {@code 'undefined' != typeof Ref}? @param expression @param reference Ref node must be equivalent to this node
[ "Is", "the", "expression", "of", "the", "form", "{", "@code", "undefined", "!", "=", "typeof", "Ref", "}", "?" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CrossChunkCodeMotion.java#L711-L722
zaproxy/zaproxy
src/org/zaproxy/zap/spider/Spider.java
Spider.buildUri
private static String buildUri(String scheme, char[] host, int port, String path) { StringBuilder strBuilder = new StringBuilder(150); strBuilder.append(scheme).append("://").append(host); if (!isDefaultPort(scheme, port)) { strBuilder.append(':').append(port); } strBuilder.append(path); return strBuilder.toString(); }
java
private static String buildUri(String scheme, char[] host, int port, String path) { StringBuilder strBuilder = new StringBuilder(150); strBuilder.append(scheme).append("://").append(host); if (!isDefaultPort(scheme, port)) { strBuilder.append(':').append(port); } strBuilder.append(path); return strBuilder.toString(); }
[ "private", "static", "String", "buildUri", "(", "String", "scheme", ",", "char", "[", "]", "host", ",", "int", "port", ",", "String", "path", ")", "{", "StringBuilder", "strBuilder", "=", "new", "StringBuilder", "(", "150", ")", ";", "strBuilder", ".", "...
Creates a URI (string) with the given scheme, host, port and path. The port is only added if not the default for the given scheme. @param scheme the scheme, {@code http} or {@code https}. @param host the name of the host. @param port the port. @param path the path, should start with {@code /}. @return the URI with the provided components.
[ "Creates", "a", "URI", "(", "string", ")", "with", "the", "given", "scheme", "host", "port", "and", "path", ".", "The", "port", "is", "only", "added", "if", "not", "the", "default", "for", "the", "given", "scheme", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/Spider.java#L288-L296
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/AliasedDiscoveryConfigUtils.java
AliasedDiscoveryConfigUtils.newConfigFor
@SuppressWarnings("unchecked") public static AliasedDiscoveryConfig newConfigFor(String tag) { if ("aws".equals(tag)) { return new AwsConfig(); } else if ("gcp".equals(tag)) { return new GcpConfig(); } else if ("azure".equals(tag)) { return new AzureConfig(); } else if ("kubernetes".equals(tag)) { return new KubernetesConfig(); } else if ("eureka".equals(tag)) { return new EurekaConfig(); } else { throw new IllegalArgumentException(String.format("Invalid tag: '%s'", tag)); } }
java
@SuppressWarnings("unchecked") public static AliasedDiscoveryConfig newConfigFor(String tag) { if ("aws".equals(tag)) { return new AwsConfig(); } else if ("gcp".equals(tag)) { return new GcpConfig(); } else if ("azure".equals(tag)) { return new AzureConfig(); } else if ("kubernetes".equals(tag)) { return new KubernetesConfig(); } else if ("eureka".equals(tag)) { return new EurekaConfig(); } else { throw new IllegalArgumentException(String.format("Invalid tag: '%s'", tag)); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "AliasedDiscoveryConfig", "newConfigFor", "(", "String", "tag", ")", "{", "if", "(", "\"aws\"", ".", "equals", "(", "tag", ")", ")", "{", "return", "new", "AwsConfig", "(", ")", ";", "...
Creates new {@link AliasedDiscoveryConfig} by the given {@code tag}.
[ "Creates", "new", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/AliasedDiscoveryConfigUtils.java#L187-L202
cdk/cdk
base/silent/src/main/java/org/openscience/cdk/silent/AtomContainerSet.java
AtomContainerSet.setMultiplier
@Override public boolean setMultiplier(IAtomContainer container, Double multiplier) { for (int i = 0; i < atomContainers.length; i++) { if (atomContainers[i] == container) { multipliers[i] = multiplier; return true; } } return false; }
java
@Override public boolean setMultiplier(IAtomContainer container, Double multiplier) { for (int i = 0; i < atomContainers.length; i++) { if (atomContainers[i] == container) { multipliers[i] = multiplier; return true; } } return false; }
[ "@", "Override", "public", "boolean", "setMultiplier", "(", "IAtomContainer", "container", ",", "Double", "multiplier", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "atomContainers", ".", "length", ";", "i", "++", ")", "{", "if", "(", "at...
Sets the coefficient of a AtomContainer to a given value. @param container The AtomContainer for which the multiplier is set @param multiplier The new multiplier for the AtomContatiner @return true if multiplier has been set @see #getMultiplier(IAtomContainer)
[ "Sets", "the", "coefficient", "of", "a", "AtomContainer", "to", "a", "given", "value", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/AtomContainerSet.java#L146-L155