repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/SmartTable.java
SmartTable.setStyleNames
public void setStyleNames (int row, int column, String... styles) { int idx = 0; for (String style : styles) { if (idx++ == 0) { getFlexCellFormatter().setStyleName(row, column, style); } else { getFlexCellFormatter().addStyleName(row, column, style); } } }
java
public void setStyleNames (int row, int column, String... styles) { int idx = 0; for (String style : styles) { if (idx++ == 0) { getFlexCellFormatter().setStyleName(row, column, style); } else { getFlexCellFormatter().addStyleName(row, column, style); } } }
[ "public", "void", "setStyleNames", "(", "int", "row", ",", "int", "column", ",", "String", "...", "styles", ")", "{", "int", "idx", "=", "0", ";", "for", "(", "String", "style", ":", "styles", ")", "{", "if", "(", "idx", "++", "==", "0", ")", "{"...
Configures the specified style names on the specified row and column. The first style is set as the primary style and additional styles are added onto that.
[ "Configures", "the", "specified", "style", "names", "on", "the", "specified", "row", "and", "column", ".", "The", "first", "style", "is", "set", "as", "the", "primary", "style", "and", "additional", "styles", "are", "added", "onto", "that", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/SmartTable.java#L335-L345
TakahikoKawasaki/nv-websocket-client
src/main/java/com/neovisionaries/ws/client/HandshakeReader.java
HandshakeReader.validateConnection
private void validateConnection(StatusLine statusLine, Map<String, List<String>> headers) throws WebSocketException { // Get the values of Upgrade. List<String> values = headers.get("Connection"); if (values == null || values.size() == 0) { // The opening handshake response does not contain 'Connection' header. throw new OpeningHandshakeException( WebSocketError.NO_CONNECTION_HEADER, "The opening handshake response does not contain 'Connection' header.", statusLine, headers); } for (String value : values) { // Split the value of Connection header into elements. String[] elements = value.split("\\s*,\\s*"); for (String element : elements) { if ("Upgrade".equalsIgnoreCase(element)) { // Found 'Upgrade' in Connection header. return; } } } // 'Upgrade' was not found in 'Connection' header. throw new OpeningHandshakeException( WebSocketError.NO_UPGRADE_IN_CONNECTION_HEADER, "'Upgrade' was not found in 'Connection' header.", statusLine, headers); }
java
private void validateConnection(StatusLine statusLine, Map<String, List<String>> headers) throws WebSocketException { // Get the values of Upgrade. List<String> values = headers.get("Connection"); if (values == null || values.size() == 0) { // The opening handshake response does not contain 'Connection' header. throw new OpeningHandshakeException( WebSocketError.NO_CONNECTION_HEADER, "The opening handshake response does not contain 'Connection' header.", statusLine, headers); } for (String value : values) { // Split the value of Connection header into elements. String[] elements = value.split("\\s*,\\s*"); for (String element : elements) { if ("Upgrade".equalsIgnoreCase(element)) { // Found 'Upgrade' in Connection header. return; } } } // 'Upgrade' was not found in 'Connection' header. throw new OpeningHandshakeException( WebSocketError.NO_UPGRADE_IN_CONNECTION_HEADER, "'Upgrade' was not found in 'Connection' header.", statusLine, headers); }
[ "private", "void", "validateConnection", "(", "StatusLine", "statusLine", ",", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "headers", ")", "throws", "WebSocketException", "{", "// Get the values of Upgrade.", "List", "<", "String", ">", "values", ...
Validate the value of {@code Connection} header. <blockquote> <p>From RFC 6455, p19.</p> <p><i> If the response lacks a {@code Connection} header field or the {@code Connection} header field doesn't contain a token that is an ASCII case-insensitive match for the value "Upgrade", the client MUST Fail the WebSocket Connection. </i></p> </blockquote>
[ "Validate", "the", "value", "of", "{", "@code", "Connection", "}", "header", "." ]
train
https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/HandshakeReader.java#L349-L383
OpenLiberty/open-liberty
dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/AbstractRasMethodAdapter.java
AbstractRasMethodAdapter.visitLineNumber
@Override public void visitLineNumber(int line, Label start) { // If we haven't given a line number to the method entry, do so now. if (!methodEntryHasLineNumber) { methodEntryHasLineNumber = true; start = methodEntryLabel; } lineNumber = line; super.visitLineNumber(line, start); }
java
@Override public void visitLineNumber(int line, Label start) { // If we haven't given a line number to the method entry, do so now. if (!methodEntryHasLineNumber) { methodEntryHasLineNumber = true; start = methodEntryLabel; } lineNumber = line; super.visitLineNumber(line, start); }
[ "@", "Override", "public", "void", "visitLineNumber", "(", "int", "line", ",", "Label", "start", ")", "{", "// If we haven't given a line number to the method entry, do so now.", "if", "(", "!", "methodEntryHasLineNumber", ")", "{", "methodEntryHasLineNumber", "=", "true"...
Vist a line number block and its associated label. We will use this to keep track of (roughly) what line we're on.
[ "Vist", "a", "line", "number", "block", "and", "its", "associated", "label", ".", "We", "will", "use", "this", "to", "keep", "track", "of", "(", "roughly", ")", "what", "line", "we", "re", "on", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/AbstractRasMethodAdapter.java#L1074-L1084
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java
BackupLongTermRetentionPoliciesInner.getAsync
public Observable<BackupLongTermRetentionPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<BackupLongTermRetentionPolicyInner>, BackupLongTermRetentionPolicyInner>() { @Override public BackupLongTermRetentionPolicyInner call(ServiceResponse<BackupLongTermRetentionPolicyInner> response) { return response.body(); } }); }
java
public Observable<BackupLongTermRetentionPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<BackupLongTermRetentionPolicyInner>, BackupLongTermRetentionPolicyInner>() { @Override public BackupLongTermRetentionPolicyInner call(ServiceResponse<BackupLongTermRetentionPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BackupLongTermRetentionPolicyInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverNam...
Returns a database backup long term retention policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackupLongTermRetentionPolicyInner object
[ "Returns", "a", "database", "backup", "long", "term", "retention", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java#L114-L121
JOML-CI/JOML
src/org/joml/Quaterniond.java
Quaterniond.rotationTo
public Quaterniond rotationTo(Vector3dc fromDir, Vector3dc toDir) { return rotationTo(fromDir.x(), fromDir.y(), fromDir.z(), toDir.x(), toDir.y(), toDir.z()); }
java
public Quaterniond rotationTo(Vector3dc fromDir, Vector3dc toDir) { return rotationTo(fromDir.x(), fromDir.y(), fromDir.z(), toDir.x(), toDir.y(), toDir.z()); }
[ "public", "Quaterniond", "rotationTo", "(", "Vector3dc", "fromDir", ",", "Vector3dc", "toDir", ")", "{", "return", "rotationTo", "(", "fromDir", ".", "x", "(", ")", ",", "fromDir", ".", "y", "(", ")", ",", "fromDir", ".", "z", "(", ")", ",", "toDir", ...
Set <code>this</code> quaternion to a rotation that rotates the <code>fromDir</code> vector to point along <code>toDir</code>. <p> Because there can be multiple possible rotations, this method chooses the one with the shortest arc. @see #rotationTo(double, double, double, double, double, double) @param fromDir the starting direction @param toDir the destination direction @return this
[ "Set", "<code", ">", "this<", "/", "code", ">", "quaternion", "to", "a", "rotation", "that", "rotates", "the", "<code", ">", "fromDir<", "/", "code", ">", "vector", "to", "point", "along", "<code", ">", "toDir<", "/", "code", ">", ".", "<p", ">", "Be...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaterniond.java#L1943-L1945
netty/netty
common/src/main/java/io/netty/util/NetUtil.java
NetUtil.toSocketAddressString
public static String toSocketAddressString(String host, int port) { String portStr = String.valueOf(port); return newSocketAddressStringBuilder( host, portStr, !isValidIpV6Address(host)).append(':').append(portStr).toString(); }
java
public static String toSocketAddressString(String host, int port) { String portStr = String.valueOf(port); return newSocketAddressStringBuilder( host, portStr, !isValidIpV6Address(host)).append(':').append(portStr).toString(); }
[ "public", "static", "String", "toSocketAddressString", "(", "String", "host", ",", "int", "port", ")", "{", "String", "portStr", "=", "String", ".", "valueOf", "(", "port", ")", ";", "return", "newSocketAddressStringBuilder", "(", "host", ",", "portStr", ",", ...
Returns the {@link String} representation of a host port combo.
[ "Returns", "the", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/NetUtil.java#L957-L961
cloudant/java-cloudant
cloudant-client/src/main/java/com/cloudant/client/api/Database.java
Database.getShards
public List<Shard> getShards() { InputStream response = null; try { response = client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards") .build()); return getResponseList(response, client.getGson(), DeserializationTypes.SHARDS); } finally { close(response); } }
java
public List<Shard> getShards() { InputStream response = null; try { response = client.couchDbClient.get(new DatabaseURIHelper(db.getDBUri()).path("_shards") .build()); return getResponseList(response, client.getGson(), DeserializationTypes.SHARDS); } finally { close(response); } }
[ "public", "List", "<", "Shard", ">", "getShards", "(", ")", "{", "InputStream", "response", "=", "null", ";", "try", "{", "response", "=", "client", ".", "couchDbClient", ".", "get", "(", "new", "DatabaseURIHelper", "(", "db", ".", "getDBUri", "(", ")", ...
Get info about the shards in the database. @return List of shards @see <a href="https://console.bluemix.net/docs/services/Cloudant/api/advanced.html#-get-database-_shards-" target="_blank">_shards</a>
[ "Get", "info", "about", "the", "shards", "in", "the", "database", "." ]
train
https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L244-L253
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.openContext
protected final synchronized GenerationContext openContext(EObject sarlObject, JvmDeclaredType type, final Iterable<Class<? extends XtendMember>> supportedMemberTypes) { assert type != null; assert supportedMemberTypes != null; this.sarlSignatureProvider.clear(type); final GenerationContext context = new GenerationContext(sarlObject, type) { @Override public boolean isSupportedMember(XtendMember member) { for (final Class<? extends XtendMember> supportedMemberType : supportedMemberTypes) { if (supportedMemberType.isInstance(member)) { return true; } } return false; } }; this.contextInjector.injectMembers(context); this.bufferedContexes.push(context); return context; }
java
protected final synchronized GenerationContext openContext(EObject sarlObject, JvmDeclaredType type, final Iterable<Class<? extends XtendMember>> supportedMemberTypes) { assert type != null; assert supportedMemberTypes != null; this.sarlSignatureProvider.clear(type); final GenerationContext context = new GenerationContext(sarlObject, type) { @Override public boolean isSupportedMember(XtendMember member) { for (final Class<? extends XtendMember> supportedMemberType : supportedMemberTypes) { if (supportedMemberType.isInstance(member)) { return true; } } return false; } }; this.contextInjector.injectMembers(context); this.bufferedContexes.push(context); return context; }
[ "protected", "final", "synchronized", "GenerationContext", "openContext", "(", "EObject", "sarlObject", ",", "JvmDeclaredType", "type", ",", "final", "Iterable", "<", "Class", "<", "?", "extends", "XtendMember", ">", ">", "supportedMemberTypes", ")", "{", "assert", ...
Open the context for the generation of a SARL-specific element. @param sarlObject the SARL object that is the cause of the generation. @param type the generated type. @param supportedMemberTypes the types of the supported members. @return the created context.
[ "Open", "the", "context", "for", "the", "generation", "of", "a", "SARL", "-", "specific", "element", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L521-L540
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java
VirtualHubsInner.createOrUpdate
public VirtualHubInner createOrUpdate(String resourceGroupName, String virtualHubName, VirtualHubInner virtualHubParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualHubName, virtualHubParameters).toBlocking().last().body(); }
java
public VirtualHubInner createOrUpdate(String resourceGroupName, String virtualHubName, VirtualHubInner virtualHubParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualHubName, virtualHubParameters).toBlocking().last().body(); }
[ "public", "VirtualHubInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "virtualHubName", ",", "VirtualHubInner", "virtualHubParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualHubName", "...
Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. @param resourceGroupName The resource group name of the VirtualHub. @param virtualHubName The name of the VirtualHub. @param virtualHubParameters Parameters supplied to create or update VirtualHub. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualHubInner object if successful.
[ "Creates", "a", "VirtualHub", "resource", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "VirtualHub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/VirtualHubsInner.java#L211-L213
apache/incubator-druid
core/src/main/java/org/apache/druid/java/util/common/lifecycle/Lifecycle.java
Lifecycle.addMaybeStartStartCloseInstance
public <T> T addMaybeStartStartCloseInstance(T o, Stage stage) throws Exception { addMaybeStartHandler(new StartCloseHandler(o), stage); return o; }
java
public <T> T addMaybeStartStartCloseInstance(T o, Stage stage) throws Exception { addMaybeStartHandler(new StartCloseHandler(o), stage); return o; }
[ "public", "<", "T", ">", "T", "addMaybeStartStartCloseInstance", "(", "T", "o", ",", "Stage", "stage", ")", "throws", "Exception", "{", "addMaybeStartHandler", "(", "new", "StartCloseHandler", "(", "o", ")", ",", "stage", ")", ";", "return", "o", ";", "}" ...
Adds an instance with a start() and/or close() method to the Lifecycle and starts it if the lifecycle has already been started. @param o The object to add to the lifecycle @param stage The stage to add the lifecycle at @throws Exception {@link Lifecycle#addMaybeStartHandler(Handler, Stage)}
[ "Adds", "an", "instance", "with", "a", "start", "()", "and", "/", "or", "close", "()", "method", "to", "the", "Lifecycle", "and", "starts", "it", "if", "the", "lifecycle", "has", "already", "been", "started", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/lifecycle/Lifecycle.java#L263-L267
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java
JsonModelCoder.getList
public List<T> getList(String json) throws IOException, JsonFormatException { JsonPullParser parser = JsonPullParser.newParser(json); return getList(parser, null); }
java
public List<T> getList(String json) throws IOException, JsonFormatException { JsonPullParser parser = JsonPullParser.newParser(json); return getList(parser, null); }
[ "public", "List", "<", "T", ">", "getList", "(", "String", "json", ")", "throws", "IOException", ",", "JsonFormatException", "{", "JsonPullParser", "parser", "=", "JsonPullParser", ".", "newParser", "(", "json", ")", ";", "return", "getList", "(", "parser", ...
Attempts to parse the given data as {@link List} of objects. @param json JSON-formatted data @return {@link List} of objects @throws IOException @throws JsonFormatException The given data is malformed, or its type is unexpected
[ "Attempts", "to", "parse", "the", "given", "data", "as", "{", "@link", "List", "}", "of", "objects", "." ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L54-L57
Dempsy/dempsy
dempsy-framework.api/src/main/java/net/dempsy/lifecycle/simple/MessageProcessor.java
MessageProcessor.invokeOutput
@Override public List<KeyedMessageWithType> invokeOutput(final Mp instance) throws DempsyException { try { return Arrays.asList(Optional.ofNullable(instance.output()).orElse(EMPTY_KEYED_MESSAGE_WITH_TYPE)); } catch(final RuntimeException rte) { throw new DempsyException(rte, true); } }
java
@Override public List<KeyedMessageWithType> invokeOutput(final Mp instance) throws DempsyException { try { return Arrays.asList(Optional.ofNullable(instance.output()).orElse(EMPTY_KEYED_MESSAGE_WITH_TYPE)); } catch(final RuntimeException rte) { throw new DempsyException(rte, true); } }
[ "@", "Override", "public", "List", "<", "KeyedMessageWithType", ">", "invokeOutput", "(", "final", "Mp", "instance", ")", "throws", "DempsyException", "{", "try", "{", "return", "Arrays", ".", "asList", "(", "Optional", ".", "ofNullable", "(", "instance", ".",...
This lifecycle phase is implemented by invoking the {@link Mp#output()} method on the instance @see MessageProcessorLifecycle#invokeOutput(Object)
[ "This", "lifecycle", "phase", "is", "implemented", "by", "invoking", "the", "{", "@link", "Mp#output", "()", "}", "method", "on", "the", "instance" ]
train
https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.api/src/main/java/net/dempsy/lifecycle/simple/MessageProcessor.java#L127-L134
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseImportDeclaration
private Decl parseImportDeclaration() { int start = index; EnclosingScope scope = new EnclosingScope(); match(Import); Identifier fromName = parseOptionalFrom(scope); Tuple<Identifier >filterPath = parseFilterPath(scope); int end = index; matchEndLine(); Decl.Import imprt; if(fromName != null) { imprt = new Decl.Import(filterPath, fromName); } else { imprt = new Decl.Import(filterPath); } return annotateSourceLocation(imprt, start); }
java
private Decl parseImportDeclaration() { int start = index; EnclosingScope scope = new EnclosingScope(); match(Import); Identifier fromName = parseOptionalFrom(scope); Tuple<Identifier >filterPath = parseFilterPath(scope); int end = index; matchEndLine(); Decl.Import imprt; if(fromName != null) { imprt = new Decl.Import(filterPath, fromName); } else { imprt = new Decl.Import(filterPath); } return annotateSourceLocation(imprt, start); }
[ "private", "Decl", "parseImportDeclaration", "(", ")", "{", "int", "start", "=", "index", ";", "EnclosingScope", "scope", "=", "new", "EnclosingScope", "(", ")", ";", "match", "(", "Import", ")", ";", "Identifier", "fromName", "=", "parseOptionalFrom", "(", ...
Parse an import declaration, which is of the form: <pre> ImportDecl ::= Identifier ["from" ('*' | Identifier)] ( '::' ('*' | Identifier) )* </pre>
[ "Parse", "an", "import", "declaration", "which", "is", "of", "the", "form", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L148-L163
actorapp/droidkit-actors
actors/src/main/java/com/droidkit/actors/ActorSystem.java
ActorSystem.addDispatcher
public void addDispatcher(String dispatcherId, int threadsCount) { synchronized (dispatchers) { if (dispatchers.containsKey(dispatcherId)) { return; } dispatchers.put(dispatcherId, new ActorDispatcher(dispatcherId, this, threadsCount)); } }
java
public void addDispatcher(String dispatcherId, int threadsCount) { synchronized (dispatchers) { if (dispatchers.containsKey(dispatcherId)) { return; } dispatchers.put(dispatcherId, new ActorDispatcher(dispatcherId, this, threadsCount)); } }
[ "public", "void", "addDispatcher", "(", "String", "dispatcherId", ",", "int", "threadsCount", ")", "{", "synchronized", "(", "dispatchers", ")", "{", "if", "(", "dispatchers", ".", "containsKey", "(", "dispatcherId", ")", ")", "{", "return", ";", "}", "dispa...
Adding dispatcher with specific threads count @param dispatcherId dispatcher id @param threadsCount threads count
[ "Adding", "dispatcher", "with", "specific", "threads", "count" ]
train
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/ActorSystem.java#L59-L66
brettwooldridge/SansOrm
src/main/java/com/zaxxer/sansorm/OrmElf.java
OrmElf.objectById
public static <T> T objectById(Connection connection, Class<T> clazz, Object... args) throws SQLException { return OrmReader.objectById(connection, clazz, args); }
java
public static <T> T objectById(Connection connection, Class<T> clazz, Object... args) throws SQLException { return OrmReader.objectById(connection, clazz, args); }
[ "public", "static", "<", "T", ">", "T", "objectById", "(", "Connection", "connection", ",", "Class", "<", "T", ">", "clazz", ",", "Object", "...", "args", ")", "throws", "SQLException", "{", "return", "OrmReader", ".", "objectById", "(", "connection", ",",...
Load an object by it's ID. The @Id annotated field(s) of the object is used to set query parameters. @param connection a SQL Connection object @param clazz the class of the object to load @param args the query parameter used to find the object by it's ID @param <T> the type of the object to load @return the populated object @throws SQLException if a {@link SQLException} occurs
[ "Load", "an", "object", "by", "it", "s", "ID", ".", "The", "@Id", "annotated", "field", "(", "s", ")", "of", "the", "object", "is", "used", "to", "set", "query", "parameters", "." ]
train
https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L61-L64
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.getBoundingBox
public static BoundingBox getBoundingBox(BoundingBox totalBox, TileMatrix tileMatrix, long tileColumn, long tileRow) { return getBoundingBox(totalBox, tileMatrix.getMatrixWidth(), tileMatrix.getMatrixHeight(), tileColumn, tileRow); }
java
public static BoundingBox getBoundingBox(BoundingBox totalBox, TileMatrix tileMatrix, long tileColumn, long tileRow) { return getBoundingBox(totalBox, tileMatrix.getMatrixWidth(), tileMatrix.getMatrixHeight(), tileColumn, tileRow); }
[ "public", "static", "BoundingBox", "getBoundingBox", "(", "BoundingBox", "totalBox", ",", "TileMatrix", "tileMatrix", ",", "long", "tileColumn", ",", "long", "tileRow", ")", "{", "return", "getBoundingBox", "(", "totalBox", ",", "tileMatrix", ".", "getMatrixWidth", ...
Get the bounding box of the tile column and row in the tile matrix using the total bounding box with constant units @param totalBox total bounding box @param tileMatrix tile matrix @param tileColumn tile column @param tileRow tile row @return bounding box @since 1.2.0
[ "Get", "the", "bounding", "box", "of", "the", "tile", "column", "and", "row", "in", "the", "tile", "matrix", "using", "the", "total", "bounding", "box", "with", "constant", "units" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L915-L919
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataDecoder.java
DataDecoder.decodeBoolean
public static boolean decodeBoolean(byte[] src, int srcOffset) throws CorruptEncodingException { try { return src[srcOffset] == (byte)128; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static boolean decodeBoolean(byte[] src, int srcOffset) throws CorruptEncodingException { try { return src[srcOffset] == (byte)128; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "boolean", "decodeBoolean", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "return", "src", "[", "srcOffset", "]", "==", "(", "byte", ")", "128", ";", "}", "catch", "...
Decodes a boolean from exactly 1 byte. @param src source of encoded bytes @param srcOffset offset into source array @return boolean value
[ "Decodes", "a", "boolean", "from", "exactly", "1", "byte", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L252-L260
jMetal/jMetal
jmetal-core/src/main/java/org/uma/jmetal/operator/impl/mutation/BitFlipMutation.java
BitFlipMutation.doMutation
public void doMutation(double probability, BinarySolution solution) { for (int i = 0; i < solution.getNumberOfVariables(); i++) { for (int j = 0; j < solution.getVariableValue(i).getBinarySetLength(); j++) { if (randomGenerator.getRandomValue() <= probability) { solution.getVariableValue(i).flip(j); } } } }
java
public void doMutation(double probability, BinarySolution solution) { for (int i = 0; i < solution.getNumberOfVariables(); i++) { for (int j = 0; j < solution.getVariableValue(i).getBinarySetLength(); j++) { if (randomGenerator.getRandomValue() <= probability) { solution.getVariableValue(i).flip(j); } } } }
[ "public", "void", "doMutation", "(", "double", "probability", ",", "BinarySolution", "solution", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "solution", ".", "getNumberOfVariables", "(", ")", ";", "i", "++", ")", "{", "for", "(", "int", ...
Perform the mutation operation @param probability Mutation setProbability @param solution The solution to mutate
[ "Perform", "the", "mutation", "operation" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/operator/impl/mutation/BitFlipMutation.java#L61-L69
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java
RingPlacer.getRingCenterOfFirstRing
Vector2d getRingCenterOfFirstRing(IRing ring, Vector2d bondVector, double bondLength) { int size = ring.getAtomCount(); double radius = bondLength / (2 * Math.sin((Math.PI) / size)); double newRingPerpendicular = Math.sqrt(Math.pow(radius, 2) - Math.pow(bondLength / 2, 2)); /* get the angle between the x axis and the bond vector */ double rotangle = GeometryUtil.getAngle(bondVector.x, bondVector.y); /* * Add 90 Degrees to this angle, this is supposed to be the new * ringcenter vector */ rotangle += Math.PI / 2; return new Vector2d(Math.cos(rotangle) * newRingPerpendicular, Math.sin(rotangle) * newRingPerpendicular); }
java
Vector2d getRingCenterOfFirstRing(IRing ring, Vector2d bondVector, double bondLength) { int size = ring.getAtomCount(); double radius = bondLength / (2 * Math.sin((Math.PI) / size)); double newRingPerpendicular = Math.sqrt(Math.pow(radius, 2) - Math.pow(bondLength / 2, 2)); /* get the angle between the x axis and the bond vector */ double rotangle = GeometryUtil.getAngle(bondVector.x, bondVector.y); /* * Add 90 Degrees to this angle, this is supposed to be the new * ringcenter vector */ rotangle += Math.PI / 2; return new Vector2d(Math.cos(rotangle) * newRingPerpendicular, Math.sin(rotangle) * newRingPerpendicular); }
[ "Vector2d", "getRingCenterOfFirstRing", "(", "IRing", "ring", ",", "Vector2d", "bondVector", ",", "double", "bondLength", ")", "{", "int", "size", "=", "ring", ".", "getAtomCount", "(", ")", ";", "double", "radius", "=", "bondLength", "/", "(", "2", "*", "...
Calculated the center for the first ring so that it can layed out. Only then, all other rings can be assigned coordinates relative to it. @param ring The ring for which the center is to be calculated @return A Vector2d pointing to the new ringcenter
[ "Calculated", "the", "center", "for", "the", "first", "ring", "so", "that", "it", "can", "layed", "out", ".", "Only", "then", "all", "other", "rings", "can", "be", "assigned", "coordinates", "relative", "to", "it", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/RingPlacer.java#L700-L712
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendClose
public static void sendClose(final int code, String reason, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) { sendClose(new CloseMessage(code, reason), wsChannel, callback); }
java
public static void sendClose(final int code, String reason, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) { sendClose(new CloseMessage(code, reason), wsChannel, callback); }
[ "public", "static", "void", "sendClose", "(", "final", "int", "code", ",", "String", "reason", ",", "final", "WebSocketChannel", "wsChannel", ",", "final", "WebSocketCallback", "<", "Void", ">", "callback", ")", "{", "sendClose", "(", "new", "CloseMessage", "(...
Sends a complete close message, invoking the callback when complete @param code The close code @param wsChannel The web socket channel @param callback The callback to invoke on completion
[ "Sends", "a", "complete", "close", "message", "invoking", "the", "callback", "when", "complete" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L818-L820
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java
WebDriverHelper.assertCookie
public void assertCookie(final String cookieName, final String cookieValue) { Set<Cookie> cookies = driver.manage().getCookies(); for (Cookie cookie : cookies) { if (cookie.getName().equals(cookieName) && cookie.getValue().equals(cookieValue)) { LOG.info("Cookie: " + cookieName + " was found with value: " + cookie.getValue()); return; } } Assert.fail("Cookie: " + cookieName + " with value: " + cookieValue + " NOT found!"); }
java
public void assertCookie(final String cookieName, final String cookieValue) { Set<Cookie> cookies = driver.manage().getCookies(); for (Cookie cookie : cookies) { if (cookie.getName().equals(cookieName) && cookie.getValue().equals(cookieValue)) { LOG.info("Cookie: " + cookieName + " was found with value: " + cookie.getValue()); return; } } Assert.fail("Cookie: " + cookieName + " with value: " + cookieValue + " NOT found!"); }
[ "public", "void", "assertCookie", "(", "final", "String", "cookieName", ",", "final", "String", "cookieValue", ")", "{", "Set", "<", "Cookie", ">", "cookies", "=", "driver", ".", "manage", "(", ")", ".", "getCookies", "(", ")", ";", "for", "(", "Cookie",...
Verifies that the given cookie name has the given cookie value. This method is also add logging info. Please not that the method will do a JUNIT Assert causing the test to fail. @param cookieName the cookie name @param cookieValue the cookie value
[ "Verifies", "that", "the", "given", "cookie", "name", "has", "the", "given", "cookie", "value", ".", "This", "method", "is", "also", "add", "logging", "info", ".", "Please", "not", "that", "the", "method", "will", "do", "a", "JUNIT", "Assert", "causing", ...
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L376-L391
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/log/LogHelper.java
LogHelper.isEnabled
public static boolean isEnabled (@Nonnull final Logger aLogger, @Nonnull final IHasErrorLevel aErrorLevelProvider) { return isEnabled (aLogger, aErrorLevelProvider.getErrorLevel ()); }
java
public static boolean isEnabled (@Nonnull final Logger aLogger, @Nonnull final IHasErrorLevel aErrorLevelProvider) { return isEnabled (aLogger, aErrorLevelProvider.getErrorLevel ()); }
[ "public", "static", "boolean", "isEnabled", "(", "@", "Nonnull", "final", "Logger", "aLogger", ",", "@", "Nonnull", "final", "IHasErrorLevel", "aErrorLevelProvider", ")", "{", "return", "isEnabled", "(", "aLogger", ",", "aErrorLevelProvider", ".", "getErrorLevel", ...
Check if logging is enabled for the passed logger based on the error level provider by the passed object @param aLogger The logger. May not be <code>null</code>. @param aErrorLevelProvider The error level provider. May not be <code>null</code>. @return <code>true</code> if the respective log level is allowed, <code>false</code> if not
[ "Check", "if", "logging", "is", "enabled", "for", "the", "passed", "logger", "based", "on", "the", "error", "level", "provider", "by", "the", "passed", "object" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/log/LogHelper.java#L135-L138
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Parameters.java
Parameters.setBoolean
@NonNull public Parameters setBoolean(@NonNull String name, boolean value) { return setValue(name, value); }
java
@NonNull public Parameters setBoolean(@NonNull String name, boolean value) { return setValue(name, value); }
[ "@", "NonNull", "public", "Parameters", "setBoolean", "(", "@", "NonNull", "String", "name", ",", "boolean", "value", ")", "{", "return", "setValue", "(", "name", ",", "value", ")", ";", "}" ]
Set a boolean value to the query parameter referenced by the given name. A query parameter is defined by using the Expression's parameter(String name) function. @param name The parameter name. @param value The boolean value. @return The self object.
[ "Set", "a", "boolean", "value", "to", "the", "query", "parameter", "referenced", "by", "the", "given", "name", ".", "A", "query", "parameter", "is", "defined", "by", "using", "the", "Expression", "s", "parameter", "(", "String", "name", ")", "function", "....
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L157-L160
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/ParseLong.java
ParseLong.execute
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Long result; if( value instanceof Long ) { result = (Long) value; } else if( value instanceof String ) { try { result = Long.parseLong((String) value); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as an Long", value), context, this, e); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Long or String but is of type %s", actualClassName), context, this); } return next.execute(result, context); }
java
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); final Long result; if( value instanceof Long ) { result = (Long) value; } else if( value instanceof String ) { try { result = Long.parseLong((String) value); } catch(final NumberFormatException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as an Long", value), context, this, e); } } else { final String actualClassName = value.getClass().getName(); throw new SuperCsvCellProcessorException(String.format( "the input value should be of type Long or String but is of type %s", actualClassName), context, this); } return next.execute(result, context); }
[ "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "validateInputNotNull", "(", "value", ",", "context", ")", ";", "final", "Long", "result", ";", "if", "(", "value", "instanceof", "Long", ")", ...
{@inheritDoc} @throws SuperCsvCellProcessorException if value is null, isn't a Long or String, or can't be parsed as a Long
[ "{", "@inheritDoc", "}" ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/ParseLong.java#L56-L77
brettwooldridge/SansOrm
src/main/java/com/zaxxer/sansorm/OrmElf.java
OrmElf.statementToObject
public static <T> T statementToObject(PreparedStatement stmt, Class<T> clazz, Object... args) throws SQLException { return OrmReader.statementToObject(stmt, clazz, args); }
java
public static <T> T statementToObject(PreparedStatement stmt, Class<T> clazz, Object... args) throws SQLException { return OrmReader.statementToObject(stmt, clazz, args); }
[ "public", "static", "<", "T", ">", "T", "statementToObject", "(", "PreparedStatement", "stmt", ",", "Class", "<", "T", ">", "clazz", ",", "Object", "...", "args", ")", "throws", "SQLException", "{", "return", "OrmReader", ".", "statementToObject", "(", "stmt...
This method takes a PreparedStatement, a target class, and optional arguments to set as query parameters. It sets the parameters automatically, executes the query, and constructs and populates an instance of the target class. <b>The PreparedStatement will be closed.</b> @param stmt the PreparedStatement to execute to construct an object @param clazz the class of the object to instantiate and populate with state @param args optional arguments to set as query parameters in the PreparedStatement @param <T> the class template @return the populated object @throws SQLException if a {@link SQLException} occurs
[ "This", "method", "takes", "a", "PreparedStatement", "a", "target", "class", "and", "optional", "arguments", "to", "set", "as", "query", "parameters", ".", "It", "sets", "the", "parameters", "automatically", "executes", "the", "query", "and", "constructs", "and"...
train
https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L136-L139
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/style/RtfStylesheetList.java
RtfStylesheetList.registerParagraphStyle
public void registerParagraphStyle(RtfParagraphStyle rtfParagraphStyle) { RtfParagraphStyle tempStyle = new RtfParagraphStyle(this.document, rtfParagraphStyle); tempStyle.handleInheritance(); tempStyle.setStyleNumber(this.styleMap.size()); this.styleMap.put(tempStyle.getStyleName(), tempStyle); }
java
public void registerParagraphStyle(RtfParagraphStyle rtfParagraphStyle) { RtfParagraphStyle tempStyle = new RtfParagraphStyle(this.document, rtfParagraphStyle); tempStyle.handleInheritance(); tempStyle.setStyleNumber(this.styleMap.size()); this.styleMap.put(tempStyle.getStyleName(), tempStyle); }
[ "public", "void", "registerParagraphStyle", "(", "RtfParagraphStyle", "rtfParagraphStyle", ")", "{", "RtfParagraphStyle", "tempStyle", "=", "new", "RtfParagraphStyle", "(", "this", ".", "document", ",", "rtfParagraphStyle", ")", ";", "tempStyle", ".", "handleInheritance...
Register a RtfParagraphStyle with this RtfStylesheetList. @param rtfParagraphStyle The RtfParagraphStyle to add.
[ "Register", "a", "RtfParagraphStyle", "with", "this", "RtfStylesheetList", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/style/RtfStylesheetList.java#L103-L108
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/services/MethodServices.java
MethodServices.checkMethod
void checkMethod(Method method, List<Object> arguments, List<String> parameters, int nbparam) throws IllegalArgumentException, JsonUnmarshallingException, JsonMarshallerException { Type[] paramTypes = method.getGenericParameterTypes(); Annotation[][] parametersAnnotations = method.getParameterAnnotations(); int idx = 0; for (Type paramType : paramTypes) { logger.debug("Try to convert argument ({}) {} : {}.", new Object[]{idx, paramType, parameters.get(idx)}); arguments.add(argumentConvertor.convertJsonToJava(parameters.get(idx), paramType, parametersAnnotations[idx])); idx++; if (idx > nbparam) { throw new IllegalArgumentException(); } } }
java
void checkMethod(Method method, List<Object> arguments, List<String> parameters, int nbparam) throws IllegalArgumentException, JsonUnmarshallingException, JsonMarshallerException { Type[] paramTypes = method.getGenericParameterTypes(); Annotation[][] parametersAnnotations = method.getParameterAnnotations(); int idx = 0; for (Type paramType : paramTypes) { logger.debug("Try to convert argument ({}) {} : {}.", new Object[]{idx, paramType, parameters.get(idx)}); arguments.add(argumentConvertor.convertJsonToJava(parameters.get(idx), paramType, parametersAnnotations[idx])); idx++; if (idx > nbparam) { throw new IllegalArgumentException(); } } }
[ "void", "checkMethod", "(", "Method", "method", ",", "List", "<", "Object", ">", "arguments", ",", "List", "<", "String", ">", "parameters", ",", "int", "nbparam", ")", "throws", "IllegalArgumentException", ",", "JsonUnmarshallingException", ",", "JsonMarshallerEx...
Check if for nbparam in parameters the method is correct. If yes, store parameters String converted to Java in arguments list @param method @param arguments @param parameters @param nbparam @throws IllegalArgumentException @throws JsonUnmarshallingException
[ "Check", "if", "for", "nbparam", "in", "parameters", "the", "method", "is", "correct", ".", "If", "yes", "store", "parameters", "String", "converted", "to", "Java", "in", "arguments", "list" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/MethodServices.java#L112-L124
crnk-project/crnk-framework
crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PropertyUtils.java
PropertyUtils.getPropertyType
public static Type getPropertyType(Class<?> beanClass, String field) { return INSTANCE.findPropertyType(beanClass, field); }
java
public static Type getPropertyType(Class<?> beanClass, String field) { return INSTANCE.findPropertyType(beanClass, field); }
[ "public", "static", "Type", "getPropertyType", "(", "Class", "<", "?", ">", "beanClass", ",", "String", "field", ")", "{", "return", "INSTANCE", ".", "findPropertyType", "(", "beanClass", ",", "field", ")", ";", "}" ]
Similar to {@link PropertyUtils#getPropertyClass(Class, List)} but returns the property class. @param beanClass bean to be accessed @param field bean's fieldName @return bean's property class
[ "Similar", "to", "{", "@link", "PropertyUtils#getPropertyClass", "(", "Class", "List", ")", "}", "but", "returns", "the", "property", "class", "." ]
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PropertyUtils.java#L75-L77
haraldk/TwelveMonkeys
common/common-io/src/main/java/com/twelvemonkeys/xml/XMLSerializer.java
XMLSerializer.maybeEscapeElementValue
static String maybeEscapeElementValue(final String pValue) { int startEscape = needsEscapeElement(pValue); if (startEscape < 0) { // If no escaping is needed, simply return original return pValue; } else { // Otherwise, start replacing StringBuilder builder = new StringBuilder(pValue.substring(0, startEscape)); builder.ensureCapacity(pValue.length() + 30); int pos = startEscape; for (int i = pos; i < pValue.length(); i++) { switch (pValue.charAt(i)) { case '&': pos = appendAndEscape(pValue, pos, i, builder, "&amp;"); break; case '<': pos = appendAndEscape(pValue, pos, i, builder, "&lt;"); break; case '>': pos = appendAndEscape(pValue, pos, i, builder, "&gt;"); break; //case '\'': //case '"': default: break; } } builder.append(pValue.substring(pos)); return builder.toString(); } }
java
static String maybeEscapeElementValue(final String pValue) { int startEscape = needsEscapeElement(pValue); if (startEscape < 0) { // If no escaping is needed, simply return original return pValue; } else { // Otherwise, start replacing StringBuilder builder = new StringBuilder(pValue.substring(0, startEscape)); builder.ensureCapacity(pValue.length() + 30); int pos = startEscape; for (int i = pos; i < pValue.length(); i++) { switch (pValue.charAt(i)) { case '&': pos = appendAndEscape(pValue, pos, i, builder, "&amp;"); break; case '<': pos = appendAndEscape(pValue, pos, i, builder, "&lt;"); break; case '>': pos = appendAndEscape(pValue, pos, i, builder, "&gt;"); break; //case '\'': //case '"': default: break; } } builder.append(pValue.substring(pos)); return builder.toString(); } }
[ "static", "String", "maybeEscapeElementValue", "(", "final", "String", "pValue", ")", "{", "int", "startEscape", "=", "needsEscapeElement", "(", "pValue", ")", ";", "if", "(", "startEscape", "<", "0", ")", "{", "// If no escaping is needed, simply return original", ...
Returns an escaped version of the input string. The string is guaranteed to not contain illegal XML characters ({@code &<>}). If no escaping is needed, the input string is returned as is. @param pValue the input string that might need escaping. @return an escaped version of the input string.
[ "Returns", "an", "escaped", "version", "of", "the", "input", "string", ".", "The", "string", "is", "guaranteed", "to", "not", "contain", "illegal", "XML", "characters", "(", "{", "@code", "&<", ">", "}", ")", ".", "If", "no", "escaping", "is", "needed", ...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/xml/XMLSerializer.java#L256-L290
czyzby/gdx-lml
mvc/src/main/java/com/github/czyzby/autumn/mvc/component/asset/AssetService.java
AssetService.finishLoading
public <Type> Type finishLoading(final String assetPath, final Class<Type> assetClass) { return finishLoading(assetPath, assetClass, null); }
java
public <Type> Type finishLoading(final String assetPath, final Class<Type> assetClass) { return finishLoading(assetPath, assetClass, null); }
[ "public", "<", "Type", ">", "Type", "finishLoading", "(", "final", "String", "assetPath", ",", "final", "Class", "<", "Type", ">", "assetClass", ")", "{", "return", "finishLoading", "(", "assetPath", ",", "assetClass", ",", "null", ")", ";", "}" ]
Immediately loads the chosen asset. Schedules loading of the asset if it wasn't selected to be loaded already. @param assetPath internal path to the asset. @param assetClass class of the loaded asset. @return instance of the loaded asset. @param <Type> type of asset class to load.
[ "Immediately", "loads", "the", "chosen", "asset", ".", "Schedules", "loading", "of", "the", "asset", "if", "it", "wasn", "t", "selected", "to", "be", "loaded", "already", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/mvc/src/main/java/com/github/czyzby/autumn/mvc/component/asset/AssetService.java#L147-L149
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/expression/Uris.java
Uris.unescapePathSegment
public String unescapePathSegment(final String text, final String encoding) { return UriEscape.unescapeUriPathSegment(text, encoding); }
java
public String unescapePathSegment(final String text, final String encoding) { return UriEscape.unescapeUriPathSegment(text, encoding); }
[ "public", "String", "unescapePathSegment", "(", "final", "String", "text", ",", "final", "String", "encoding", ")", "{", "return", "UriEscape", ".", "unescapeUriPathSegment", "(", "text", ",", "encoding", ")", ";", "}" ]
<p> Perform am URI path segment <strong>unescape</strong> operation on a {@code String} input. </p> <p> This method simply calls the equivalent method in the {@code UriEscape} class from the <a href="http://www.unbescape.org">Unbescape</a> library. </p> <p> This method will unescape every percent-encoded ({@code %HH}) sequences present in input, even for those characters that do not need to be percent-encoded in this context (unreserved characters can be percent-encoded even if/when this is not required, though it is not generally considered a good practice). </p> <p> This method will use specified {@code encoding} in order to determine the characters specified in the percent-encoded byte sequences. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the {@code String} to be unescaped. @param encoding the encoding to be used for unescaping. @return The unescaped result {@code String}. As a memory-performance improvement, will return the exact same object as the {@code text} input argument if no unescaping modifications were required (and no additional {@code String} objects will be created during processing). Will return {@code null} if {@code text} is {@code null}.
[ "<p", ">", "Perform", "am", "URI", "path", "segment", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "{", "@code", "String", "}", "input", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "simply", "calls", "the", "equi...
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/expression/Uris.java#L331-L333
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/util/Geometry.java
Geometry.getCappedOffset
private static final double getCappedOffset(final Point2D p0, final Point2D p2, final Point2D p4, final double offset) { final double radius = Math.min(p2.sub(p0).getLength(), p2.sub(p4).getLength()) / 2;// it must be half, as there may be another radius on the other side, and they should not cross over. return ((offset > radius) ? radius : offset); }
java
private static final double getCappedOffset(final Point2D p0, final Point2D p2, final Point2D p4, final double offset) { final double radius = Math.min(p2.sub(p0).getLength(), p2.sub(p4).getLength()) / 2;// it must be half, as there may be another radius on the other side, and they should not cross over. return ((offset > radius) ? radius : offset); }
[ "private", "static", "final", "double", "getCappedOffset", "(", "final", "Point2D", "p0", ",", "final", "Point2D", "p2", ",", "final", "Point2D", "p4", ",", "final", "double", "offset", ")", "{", "final", "double", "radius", "=", "Math", ".", "min", "(", ...
this will check if the radius needs capping, and return a smaller value if it does
[ "this", "will", "check", "if", "the", "radius", "needs", "capping", "and", "return", "a", "smaller", "value", "if", "it", "does" ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/util/Geometry.java#L883-L888
netty/netty
common/src/main/java/io/netty/util/AsciiString.java
AsciiString.toUpperCase
public AsciiString toUpperCase() { boolean uppercased = true; int i, j; final int len = length() + arrayOffset(); for (i = arrayOffset(); i < len; ++i) { byte b = value[i]; if (b >= 'a' && b <= 'z') { uppercased = false; break; } } // Check if this string does not contain any lowercase characters. if (uppercased) { return this; } final byte[] newValue = PlatformDependent.allocateUninitializedArray(length()); for (i = 0, j = arrayOffset(); i < newValue.length; ++i, ++j) { newValue[i] = toUpperCase(value[j]); } return new AsciiString(newValue, false); }
java
public AsciiString toUpperCase() { boolean uppercased = true; int i, j; final int len = length() + arrayOffset(); for (i = arrayOffset(); i < len; ++i) { byte b = value[i]; if (b >= 'a' && b <= 'z') { uppercased = false; break; } } // Check if this string does not contain any lowercase characters. if (uppercased) { return this; } final byte[] newValue = PlatformDependent.allocateUninitializedArray(length()); for (i = 0, j = arrayOffset(); i < newValue.length; ++i, ++j) { newValue[i] = toUpperCase(value[j]); } return new AsciiString(newValue, false); }
[ "public", "AsciiString", "toUpperCase", "(", ")", "{", "boolean", "uppercased", "=", "true", ";", "int", "i", ",", "j", ";", "final", "int", "len", "=", "length", "(", ")", "+", "arrayOffset", "(", ")", ";", "for", "(", "i", "=", "arrayOffset", "(", ...
Converts the characters in this string to uppercase, using the default Locale. @return a new string containing the uppercase characters equivalent to the characters in this string.
[ "Converts", "the", "characters", "in", "this", "string", "to", "uppercase", "using", "the", "default", "Locale", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L958-L981
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/FullDTDReader.java
FullDTDReader.findSharedName
private PrefixedName findSharedName(String prefix, String localName) { HashMap<PrefixedName,PrefixedName> m = mSharedNames; if (mSharedNames == null) { mSharedNames = m = new HashMap<PrefixedName,PrefixedName>(); } else { // Maybe we already have a shared instance... ? PrefixedName key = mAccessKey; key.reset(prefix, localName); key = m.get(key); if (key != null) { // gotcha return key; } } // Not found; let's create, cache and return it: PrefixedName result = new PrefixedName(prefix, localName); m.put(result, result); return result; }
java
private PrefixedName findSharedName(String prefix, String localName) { HashMap<PrefixedName,PrefixedName> m = mSharedNames; if (mSharedNames == null) { mSharedNames = m = new HashMap<PrefixedName,PrefixedName>(); } else { // Maybe we already have a shared instance... ? PrefixedName key = mAccessKey; key.reset(prefix, localName); key = m.get(key); if (key != null) { // gotcha return key; } } // Not found; let's create, cache and return it: PrefixedName result = new PrefixedName(prefix, localName); m.put(result, result); return result; }
[ "private", "PrefixedName", "findSharedName", "(", "String", "prefix", ",", "String", "localName", ")", "{", "HashMap", "<", "PrefixedName", ",", "PrefixedName", ">", "m", "=", "mSharedNames", ";", "if", "(", "mSharedNames", "==", "null", ")", "{", "mSharedName...
Method used to 'intern()' qualified names; main benefit is reduced memory usage as the name objects are shared. May also slightly speed up Map access, as more often identity comparisons catch matches. <p> Note: it is assumed at this point that access is only from a single thread, and non-recursive -- generally valid assumption as readers are not shared. Restriction is needed since the method is not re-entrant: it uses mAccessKey during the method call.
[ "Method", "used", "to", "intern", "()", "qualified", "names", ";", "main", "benefit", "is", "reduced", "memory", "usage", "as", "the", "name", "objects", "are", "shared", ".", "May", "also", "slightly", "speed", "up", "Map", "access", "as", "more", "often"...
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/FullDTDReader.java#L3310-L3330
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateKey
public KeyBundle updateKey(String vaultBaseUrl, String keyName, String keyVersion) { return updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion).toBlocking().single().body(); }
java
public KeyBundle updateKey(String vaultBaseUrl, String keyName, String keyVersion) { return updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion).toBlocking().single().body(); }
[ "public", "KeyBundle", "updateKey", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "String", "keyVersion", ")", "{", "return", "updateKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "keyVersion", ")", ".", "toBlocking", "(", ...
The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a key itself cannot be changed. This operation requires the keys/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of key to update. @param keyVersion The version of the key to update. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the KeyBundle object if successful.
[ "The", "update", "key", "operation", "changes", "specified", "attributes", "of", "a", "stored", "key", "and", "can", "be", "applied", "to", "any", "key", "type", "and", "key", "version", "stored", "in", "Azure", "Key", "Vault", ".", "In", "order", "to", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L1176-L1178
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/Validation.java
Validation.checkAttachmentPoint
private static void checkAttachmentPoint(Monomer mon, String str) throws AttachmentException { if (!(mon.getAttachmentListString().contains(str))) { if (!(str.equals("?") || str.equals("pair")) && !mon.getAlternateId().equals("?")) { LOG.info("Attachment point for source is not there"); throw new AttachmentException("Attachment point for source is not there: " + str); } } }
java
private static void checkAttachmentPoint(Monomer mon, String str) throws AttachmentException { if (!(mon.getAttachmentListString().contains(str))) { if (!(str.equals("?") || str.equals("pair")) && !mon.getAlternateId().equals("?")) { LOG.info("Attachment point for source is not there"); throw new AttachmentException("Attachment point for source is not there: " + str); } } }
[ "private", "static", "void", "checkAttachmentPoint", "(", "Monomer", "mon", ",", "String", "str", ")", "throws", "AttachmentException", "{", "if", "(", "!", "(", "mon", ".", "getAttachmentListString", "(", ")", ".", "contains", "(", "str", ")", ")", ")", "...
method to check the attachment point's existence @param mon Monomer @param str Attachment point @throws AttachmentException if the Attachment point is not there
[ "method", "to", "check", "the", "attachment", "point", "s", "existence" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/Validation.java#L670-L677
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/viterbi/ViterbiBuilder.java
ViterbiBuilder.isLatticeBrokenAfter
private boolean isLatticeBrokenAfter(int endIndex, ViterbiLattice lattice) { ViterbiNode[][] nodeStartIndices = lattice.getStartIndexArr(); return nodeStartIndices[endIndex] == null; }
java
private boolean isLatticeBrokenAfter(int endIndex, ViterbiLattice lattice) { ViterbiNode[][] nodeStartIndices = lattice.getStartIndexArr(); return nodeStartIndices[endIndex] == null; }
[ "private", "boolean", "isLatticeBrokenAfter", "(", "int", "endIndex", ",", "ViterbiLattice", "lattice", ")", "{", "ViterbiNode", "[", "]", "[", "]", "nodeStartIndices", "=", "lattice", ".", "getStartIndexArr", "(", ")", ";", "return", "nodeStartIndices", "[", "e...
Checks whether there exists any node in the lattice that connects to the newly inserted entry on the right side (after the new entry). @param endIndex @param lattice @return whether the lattice has a node that starts at endIndex
[ "Checks", "whether", "there", "exists", "any", "node", "in", "the", "lattice", "that", "connects", "to", "the", "newly", "inserted", "entry", "on", "the", "right", "side", "(", "after", "the", "new", "entry", ")", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/viterbi/ViterbiBuilder.java#L224-L228
playn/playn
core/src/playn/core/Graphics.java
Graphics.createCanvas
public Canvas createCanvas (float width, float height) { return createCanvasImpl(scale, scale.scaledCeil(width), scale.scaledCeil(height)); }
java
public Canvas createCanvas (float width, float height) { return createCanvasImpl(scale, scale.scaledCeil(width), scale.scaledCeil(height)); }
[ "public", "Canvas", "createCanvas", "(", "float", "width", ",", "float", "height", ")", "{", "return", "createCanvasImpl", "(", "scale", ",", "scale", ".", "scaledCeil", "(", "width", ")", ",", "scale", ".", "scaledCeil", "(", "height", ")", ")", ";", "}...
Creates a {@link Canvas} with the specified display unit size.
[ "Creates", "a", "{" ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Graphics.java#L105-L107
apache/reef
lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/driver/REEFScheduler.java
REEFScheduler.resourceOffers
@Override @SuppressWarnings("checkstyle:hiddenfield") public void resourceOffers(final SchedulerDriver driver, final List<Protos.Offer> offers) { final Map<String, NodeDescriptorEventImpl.Builder> nodeDescriptorEvents = new HashMap<>(); for (final Offer offer : offers) { if (nodeDescriptorEvents.get(offer.getSlaveId().getValue()) == null) { nodeDescriptorEvents.put(offer.getSlaveId().getValue(), NodeDescriptorEventImpl.newBuilder() .setIdentifier(offer.getSlaveId().getValue()) .setHostName(offer.getHostname()) .setPort(this.mesosSlavePort) .setMemorySize(getMemory(offer))); } else { final NodeDescriptorEventImpl.Builder builder = nodeDescriptorEvents.get(offer.getSlaveId().getValue()); builder.setMemorySize(builder.build().getMemorySize() + getMemory(offer)); } this.offers.put(offer.getId().getValue(), offer); } for (final NodeDescriptorEventImpl.Builder ndpBuilder : nodeDescriptorEvents.values()) { this.reefEventHandlers.onNodeDescriptor(ndpBuilder.build()); } if (outstandingRequests.size() > 0) { doResourceRequest(outstandingRequests.remove()); } }
java
@Override @SuppressWarnings("checkstyle:hiddenfield") public void resourceOffers(final SchedulerDriver driver, final List<Protos.Offer> offers) { final Map<String, NodeDescriptorEventImpl.Builder> nodeDescriptorEvents = new HashMap<>(); for (final Offer offer : offers) { if (nodeDescriptorEvents.get(offer.getSlaveId().getValue()) == null) { nodeDescriptorEvents.put(offer.getSlaveId().getValue(), NodeDescriptorEventImpl.newBuilder() .setIdentifier(offer.getSlaveId().getValue()) .setHostName(offer.getHostname()) .setPort(this.mesosSlavePort) .setMemorySize(getMemory(offer))); } else { final NodeDescriptorEventImpl.Builder builder = nodeDescriptorEvents.get(offer.getSlaveId().getValue()); builder.setMemorySize(builder.build().getMemorySize() + getMemory(offer)); } this.offers.put(offer.getId().getValue(), offer); } for (final NodeDescriptorEventImpl.Builder ndpBuilder : nodeDescriptorEvents.values()) { this.reefEventHandlers.onNodeDescriptor(ndpBuilder.build()); } if (outstandingRequests.size() > 0) { doResourceRequest(outstandingRequests.remove()); } }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"checkstyle:hiddenfield\"", ")", "public", "void", "resourceOffers", "(", "final", "SchedulerDriver", "driver", ",", "final", "List", "<", "Protos", ".", "Offer", ">", "offers", ")", "{", "final", "Map", "<", "S...
All offers in each batch of offers will be either be launched or declined.
[ "All", "offers", "in", "each", "batch", "of", "offers", "will", "be", "either", "be", "launched", "or", "declined", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/driver/REEFScheduler.java#L160-L187
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.comparableTemplate
public static <T extends Comparable<?>> ComparableTemplate<T> comparableTemplate(Class<? extends T> cl, Template template, Object... args) { return comparableTemplate(cl, template, ImmutableList.copyOf(args)); }
java
public static <T extends Comparable<?>> ComparableTemplate<T> comparableTemplate(Class<? extends T> cl, Template template, Object... args) { return comparableTemplate(cl, template, ImmutableList.copyOf(args)); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", ">", ">", "ComparableTemplate", "<", "T", ">", "comparableTemplate", "(", "Class", "<", "?", "extends", "T", ">", "cl", ",", "Template", "template", ",", "Object", "...", "args", ")", "{", ...
Create a new Template expression @param cl type of expression @param template template @param args template parameters @return template expression
[ "Create", "a", "new", "Template", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L439-L442
andkulikov/Transitions-Everywhere
library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java
TransitionManager.setTransition
public void setTransition(@NonNull Scene scene, @Nullable Transition transition) { mSceneTransitions.put(scene, transition); }
java
public void setTransition(@NonNull Scene scene, @Nullable Transition transition) { mSceneTransitions.put(scene, transition); }
[ "public", "void", "setTransition", "(", "@", "NonNull", "Scene", "scene", ",", "@", "Nullable", "Transition", "transition", ")", "{", "mSceneTransitions", ".", "put", "(", "scene", ",", "transition", ")", ";", "}" ]
Sets a specific transition to occur when the given scene is entered. @param scene The scene which, when applied, will cause the given transition to run. @param transition The transition that will play when the given scene is entered. A value of null will result in the default behavior of using the default transition instead.
[ "Sets", "a", "specific", "transition", "to", "occur", "when", "the", "given", "scene", "is", "entered", "." ]
train
https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java#L121-L123
alkacon/opencms-core
src/org/opencms/db/CmsImportFolder.java
CmsImportFolder.importFolder
public void importFolder(String importFolderName, String importPath, CmsObject cms) throws CmsException { try { m_importedResources = new ArrayList<CmsResource>(); m_importFolderName = importFolderName; m_importPath = importPath; m_cms = cms; // open the import resource getImportResource(); // first lock the destination path m_cms.lockResource(m_importPath); // import the resources if (m_zipStreamIn == null) { importResources(m_importResource, m_importPath); } else { importZipResource(m_zipStreamIn, m_importPath, false); } // all is done, unlock the resources m_cms.unlockResource(m_importPath); } catch (Exception e) { throw new CmsVfsException( Messages.get().container(Messages.ERR_IMPORT_FOLDER_2, importFolderName, importPath), e); } }
java
public void importFolder(String importFolderName, String importPath, CmsObject cms) throws CmsException { try { m_importedResources = new ArrayList<CmsResource>(); m_importFolderName = importFolderName; m_importPath = importPath; m_cms = cms; // open the import resource getImportResource(); // first lock the destination path m_cms.lockResource(m_importPath); // import the resources if (m_zipStreamIn == null) { importResources(m_importResource, m_importPath); } else { importZipResource(m_zipStreamIn, m_importPath, false); } // all is done, unlock the resources m_cms.unlockResource(m_importPath); } catch (Exception e) { throw new CmsVfsException( Messages.get().container(Messages.ERR_IMPORT_FOLDER_2, importFolderName, importPath), e); } }
[ "public", "void", "importFolder", "(", "String", "importFolderName", ",", "String", "importPath", ",", "CmsObject", "cms", ")", "throws", "CmsException", "{", "try", "{", "m_importedResources", "=", "new", "ArrayList", "<", "CmsResource", ">", "(", ")", ";", "...
Import that will read from the real file system.<p> @param importFolderName the folder to import @param importPath the path to the OpenCms VFS to import to @param cms a OpenCms context to provide the permissions @throws CmsException if something goes wrong
[ "Import", "that", "will", "read", "from", "the", "real", "file", "system", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsImportFolder.java#L139-L164
simlife/simlife
simlife-framework/src/main/java/io/github/simlife/service/QueryService.java
QueryService.buildSpecification
protected <X> Specification<ENTITY> buildSpecification(Filter<X> filter, SingularAttribute<? super ENTITY, X> field) { if (filter.getEquals() != null) { return equalsSpecification(field, filter.getEquals()); } else if (filter.getIn() != null) { return valueIn(field, filter.getIn()); } else if (filter.getSpecified() != null) { return byFieldSpecified(field, filter.getSpecified()); } return null; }
java
protected <X> Specification<ENTITY> buildSpecification(Filter<X> filter, SingularAttribute<? super ENTITY, X> field) { if (filter.getEquals() != null) { return equalsSpecification(field, filter.getEquals()); } else if (filter.getIn() != null) { return valueIn(field, filter.getIn()); } else if (filter.getSpecified() != null) { return byFieldSpecified(field, filter.getSpecified()); } return null; }
[ "protected", "<", "X", ">", "Specification", "<", "ENTITY", ">", "buildSpecification", "(", "Filter", "<", "X", ">", "filter", ",", "SingularAttribute", "<", "?", "super", "ENTITY", ",", "X", ">", "field", ")", "{", "if", "(", "filter", ".", "getEquals",...
Helper function to return a specification for filtering on a single field, where equality, and null/non-null conditions are supported. @param filter the individual attribute filter coming from the frontend. @param field the JPA static metamodel representing the field. @param <X> The type of the attribute which is filtered. @return a Specification
[ "Helper", "function", "to", "return", "a", "specification", "for", "filtering", "on", "a", "single", "field", "where", "equality", "and", "null", "/", "non", "-", "null", "conditions", "are", "supported", "." ]
train
https://github.com/simlife/simlife/blob/357bb8f3fb39e085239b89bc7f9a19248ff3d0bb/simlife-framework/src/main/java/io/github/simlife/service/QueryService.java#L51-L61
cerner/beadledom
pagination/src/main/java/com/cerner/beadledom/pagination/OffsetPaginationLinks.java
OffsetPaginationLinks.lastLink
String lastLink() { if (totalResults == null || currentLimit == 0L) { return null; } Long lastOffset; if (totalResults % currentLimit == 0L) { lastOffset = totalResults - currentLimit; } else { // Truncation due to integral division gives floor-like behavior for free. lastOffset = totalResults / currentLimit * currentLimit; } return urlWithUpdatedPagination(lastOffset, currentLimit); }
java
String lastLink() { if (totalResults == null || currentLimit == 0L) { return null; } Long lastOffset; if (totalResults % currentLimit == 0L) { lastOffset = totalResults - currentLimit; } else { // Truncation due to integral division gives floor-like behavior for free. lastOffset = totalResults / currentLimit * currentLimit; } return urlWithUpdatedPagination(lastOffset, currentLimit); }
[ "String", "lastLink", "(", ")", "{", "if", "(", "totalResults", "==", "null", "||", "currentLimit", "==", "0L", ")", "{", "return", "null", ";", "}", "Long", "lastOffset", ";", "if", "(", "totalResults", "%", "currentLimit", "==", "0L", ")", "{", "last...
Returns the last page link; null if no last page link is available.
[ "Returns", "the", "last", "page", "link", ";", "null", "if", "no", "last", "page", "link", "is", "available", "." ]
train
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/pagination/src/main/java/com/cerner/beadledom/pagination/OffsetPaginationLinks.java#L80-L94
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecInfo.java
CodecInfo.getPrefixFilteredObjectsByPositions
public List<MtasTokenString> getPrefixFilteredObjectsByPositions(String field, int docId, List<String> prefixes, int startPosition, int endPosition) throws IOException { IndexDoc doc = getDoc(field, docId); IndexInput inIndexObjectPosition = indexInputList .get("indexObjectPosition"); if (doc != null) { ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree( startPosition, endPosition, inIndexObjectPosition, doc.fpIndexObjectPosition, doc.smallestObjectFilepointer); return getPrefixFilteredObjects(hits, prefixes); } else { return new ArrayList<>(); } }
java
public List<MtasTokenString> getPrefixFilteredObjectsByPositions(String field, int docId, List<String> prefixes, int startPosition, int endPosition) throws IOException { IndexDoc doc = getDoc(field, docId); IndexInput inIndexObjectPosition = indexInputList .get("indexObjectPosition"); if (doc != null) { ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree( startPosition, endPosition, inIndexObjectPosition, doc.fpIndexObjectPosition, doc.smallestObjectFilepointer); return getPrefixFilteredObjects(hits, prefixes); } else { return new ArrayList<>(); } }
[ "public", "List", "<", "MtasTokenString", ">", "getPrefixFilteredObjectsByPositions", "(", "String", "field", ",", "int", "docId", ",", "List", "<", "String", ">", "prefixes", ",", "int", "startPosition", ",", "int", "endPosition", ")", "throws", "IOException", ...
Gets the prefix filtered objects by positions. @param field the field @param docId the doc id @param prefixes the prefixes @param startPosition the start position @param endPosition the end position @return the prefix filtered objects by positions @throws IOException Signals that an I/O exception has occurred.
[ "Gets", "the", "prefix", "filtered", "objects", "by", "positions", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L260-L274
spring-projects/spring-android
spring-android-core/src/main/java/org/springframework/util/NumberUtils.java
NumberUtils.decodeBigInteger
private static BigInteger decodeBigInteger(String value) { int radix = 10; int index = 0; boolean negative = false; // Handle minus sign, if present. if (value.startsWith("-")) { negative = true; index++; } // Handle radix specifier, if present. if (value.startsWith("0x", index) || value.startsWith("0X", index)) { index += 2; radix = 16; } else if (value.startsWith("#", index)) { index++; radix = 16; } else if (value.startsWith("0", index) && value.length() > 1 + index) { index++; radix = 8; } BigInteger result = new BigInteger(value.substring(index), radix); return (negative ? result.negate() : result); }
java
private static BigInteger decodeBigInteger(String value) { int radix = 10; int index = 0; boolean negative = false; // Handle minus sign, if present. if (value.startsWith("-")) { negative = true; index++; } // Handle radix specifier, if present. if (value.startsWith("0x", index) || value.startsWith("0X", index)) { index += 2; radix = 16; } else if (value.startsWith("#", index)) { index++; radix = 16; } else if (value.startsWith("0", index) && value.length() > 1 + index) { index++; radix = 8; } BigInteger result = new BigInteger(value.substring(index), radix); return (negative ? result.negate() : result); }
[ "private", "static", "BigInteger", "decodeBigInteger", "(", "String", "value", ")", "{", "int", "radix", "=", "10", ";", "int", "index", "=", "0", ";", "boolean", "negative", "=", "false", ";", "// Handle minus sign, if present.", "if", "(", "value", ".", "s...
Decode a {@link java.math.BigInteger} from a {@link String} value. Supports decimal, hex and octal notation. @see BigInteger#BigInteger(String, int)
[ "Decode", "a", "{" ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-core/src/main/java/org/springframework/util/NumberUtils.java#L238-L265
alkacon/opencms-core
src/org/opencms/xml/CmsXmlContentTypeManager.java
CmsXmlContentTypeManager.addSchemaType
public void addSchemaType(String className, String defaultWidget) { Class<?> classClazz; // initialize class for schema type try { classClazz = Class.forName(className); } catch (ClassNotFoundException e) { LOG.error( Messages.get().getBundle().key(Messages.LOG_XML_CONTENT_SCHEMA_TYPE_CLASS_NOT_FOUND_1, className), e); return; } // create the schema type and add it to the internal list I_CmsXmlSchemaType type; try { type = addContentType(classClazz); } catch (Exception e) { LOG.error( Messages.get().getBundle().key( Messages.LOG_INIT_XML_CONTENT_SCHEMA_TYPE_CLASS_ERROR_1, classClazz.getName()), e); return; } // add the editor widget for the schema type I_CmsWidget widget = getWidget(defaultWidget); if (widget == null) { LOG.error( Messages.get().getBundle().key( Messages.LOG_INIT_DEFAULT_WIDGET_FOR_CONTENT_TYPE_2, defaultWidget, type.getTypeName())); return; } // store the registered default widget m_defaultWidgets.put(type.getTypeName(), widget); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key( Messages.INIT_ADD_ST_USING_WIDGET_2, type.getTypeName(), widget.getClass().getName())); } }
java
public void addSchemaType(String className, String defaultWidget) { Class<?> classClazz; // initialize class for schema type try { classClazz = Class.forName(className); } catch (ClassNotFoundException e) { LOG.error( Messages.get().getBundle().key(Messages.LOG_XML_CONTENT_SCHEMA_TYPE_CLASS_NOT_FOUND_1, className), e); return; } // create the schema type and add it to the internal list I_CmsXmlSchemaType type; try { type = addContentType(classClazz); } catch (Exception e) { LOG.error( Messages.get().getBundle().key( Messages.LOG_INIT_XML_CONTENT_SCHEMA_TYPE_CLASS_ERROR_1, classClazz.getName()), e); return; } // add the editor widget for the schema type I_CmsWidget widget = getWidget(defaultWidget); if (widget == null) { LOG.error( Messages.get().getBundle().key( Messages.LOG_INIT_DEFAULT_WIDGET_FOR_CONTENT_TYPE_2, defaultWidget, type.getTypeName())); return; } // store the registered default widget m_defaultWidgets.put(type.getTypeName(), widget); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info( Messages.get().getBundle().key( Messages.INIT_ADD_ST_USING_WIDGET_2, type.getTypeName(), widget.getClass().getName())); } }
[ "public", "void", "addSchemaType", "(", "String", "className", ",", "String", "defaultWidget", ")", "{", "Class", "<", "?", ">", "classClazz", ";", "// initialize class for schema type", "try", "{", "classClazz", "=", "Class", ".", "forName", "(", "className", "...
Adds a new XML content type schema class and XML widget to the manager by class names.<p> @param className class name of the XML content schema type class to add @param defaultWidget class name of the default XML widget class for the added XML content type
[ "Adds", "a", "new", "XML", "content", "type", "schema", "class", "and", "XML", "widget", "to", "the", "manager", "by", "class", "names", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlContentTypeManager.java#L171-L218
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/ddl/AlterTableStatement.java
AlterTableStatement.findColumnDefinitionFromMetaData
public Optional<ColumnDefinitionSegment> findColumnDefinitionFromMetaData(final String columnName, final ShardingTableMetaData shardingTableMetaData) { if (!shardingTableMetaData.containsTable(getTables().getSingleTableName())) { return Optional.absent(); } for (ColumnMetaData each : shardingTableMetaData.get(getTables().getSingleTableName()).getColumns().values()) { if (columnName.equalsIgnoreCase(each.getColumnName())) { return Optional.of(new ColumnDefinitionSegment(columnName, each.getDataType(), each.isPrimaryKey())); } } return Optional.absent(); }
java
public Optional<ColumnDefinitionSegment> findColumnDefinitionFromMetaData(final String columnName, final ShardingTableMetaData shardingTableMetaData) { if (!shardingTableMetaData.containsTable(getTables().getSingleTableName())) { return Optional.absent(); } for (ColumnMetaData each : shardingTableMetaData.get(getTables().getSingleTableName()).getColumns().values()) { if (columnName.equalsIgnoreCase(each.getColumnName())) { return Optional.of(new ColumnDefinitionSegment(columnName, each.getDataType(), each.isPrimaryKey())); } } return Optional.absent(); }
[ "public", "Optional", "<", "ColumnDefinitionSegment", ">", "findColumnDefinitionFromMetaData", "(", "final", "String", "columnName", ",", "final", "ShardingTableMetaData", "shardingTableMetaData", ")", "{", "if", "(", "!", "shardingTableMetaData", ".", "containsTable", "(...
Find column definition from meta data. @param columnName column name @param shardingTableMetaData sharding table meta data @return column definition
[ "Find", "column", "definition", "from", "meta", "data", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/ddl/AlterTableStatement.java#L83-L93
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java
CWF2XML.toDocument
public static Document toDocument(BaseComponent root, String... excludedProperties) { try { CWF2XML instance = new CWF2XML(excludedProperties); instance.toXML(root, instance.doc); return instance.doc; } catch (ParserConfigurationException e) { return null; } }
java
public static Document toDocument(BaseComponent root, String... excludedProperties) { try { CWF2XML instance = new CWF2XML(excludedProperties); instance.toXML(root, instance.doc); return instance.doc; } catch (ParserConfigurationException e) { return null; } }
[ "public", "static", "Document", "toDocument", "(", "BaseComponent", "root", ",", "String", "...", "excludedProperties", ")", "{", "try", "{", "CWF2XML", "instance", "=", "new", "CWF2XML", "(", "excludedProperties", ")", ";", "instance", ".", "toXML", "(", "roo...
Returns an XML document that mirrors the CWF component tree starting at the specified root. @param root BaseComponent whose subtree is to be traversed. @param excludedProperties An optional list of properties that should be excluded from the output. These may either be the property name (e.g., "uuid") or a property name qualified by a component name (e.g., "window.uuid"). Optionally, an entry may be followed by an "=" and a value to exclude matches with a specific value. Note that "innerAttrs" and "outerAttrs" are always excluded. @return An XML document that represents the component subtree.
[ "Returns", "an", "XML", "document", "that", "mirrors", "the", "CWF", "component", "tree", "starting", "at", "the", "specified", "root", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/xml/CWF2XML.java#L68-L76
alkacon/opencms-core
src/org/opencms/ade/sitemap/shared/CmsSitemapChange.java
CmsSitemapChange.addChangeTitle
public void addChangeTitle(String title) { CmsPropertyModification propChange = new CmsPropertyModification( m_entryId, CmsClientProperty.PROPERTY_NAVTEXT, title, true); m_propertyModifications.add(propChange); m_ownInternalProperties.put("NavText", new CmsClientProperty("NavText", title, null)); }
java
public void addChangeTitle(String title) { CmsPropertyModification propChange = new CmsPropertyModification( m_entryId, CmsClientProperty.PROPERTY_NAVTEXT, title, true); m_propertyModifications.add(propChange); m_ownInternalProperties.put("NavText", new CmsClientProperty("NavText", title, null)); }
[ "public", "void", "addChangeTitle", "(", "String", "title", ")", "{", "CmsPropertyModification", "propChange", "=", "new", "CmsPropertyModification", "(", "m_entryId", ",", "CmsClientProperty", ".", "PROPERTY_NAVTEXT", ",", "title", ",", "true", ")", ";", "m_propert...
Adds a property change for a changed title.<p> @param title the changed title
[ "Adds", "a", "property", "change", "for", "a", "changed", "title", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/shared/CmsSitemapChange.java#L180-L189
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java
GeneSequence.addExon
public ExonSequence addExon(AccessionID accession, int begin, int end) throws Exception { if (exonSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } ExonSequence exonSequence = new ExonSequence(this, begin, end); //sense should be the same as parent exonSequence.setAccession(accession); exonSequenceList.add(exonSequence); exonSequenceHashMap.put(accession.getID(), exonSequence); return exonSequence; }
java
public ExonSequence addExon(AccessionID accession, int begin, int end) throws Exception { if (exonSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } ExonSequence exonSequence = new ExonSequence(this, begin, end); //sense should be the same as parent exonSequence.setAccession(accession); exonSequenceList.add(exonSequence); exonSequenceHashMap.put(accession.getID(), exonSequence); return exonSequence; }
[ "public", "ExonSequence", "addExon", "(", "AccessionID", "accession", ",", "int", "begin", ",", "int", "end", ")", "throws", "Exception", "{", "if", "(", "exonSequenceHashMap", ".", "containsKey", "(", "accession", ".", "getID", "(", ")", ")", ")", "{", "t...
Add an ExonSequence mainly used to mark as a feature @param accession @param begin @param end @return exon sequence
[ "Add", "an", "ExonSequence", "mainly", "used", "to", "mark", "as", "a", "feature" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java#L261-L271
OpenLiberty/open-liberty
dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java
ELHelper.processString
@FFDCIgnore(ELException.class) @Trivial protected String processString(String name, String expression, boolean immediateOnly, boolean mask) { final String methodName = "processString"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { name, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, immediateOnly, mask }); } String result; boolean immediate = false; try { Object obj = evaluateElExpression(expression, mask); if (obj == null) { throw new IllegalArgumentException("EL expression '" + (mask ? OBFUSCATED_STRING : expression) + "' for '" + name + "'evaluated to null."); } else if (obj instanceof String) { result = (String) obj; immediate = isImmediateExpression(expression, mask); } else { throw new IllegalArgumentException("Expected '" + name + "' to evaluate to a String value."); } } catch (ELException e) { result = expression; immediate = true; } String finalResult = (immediateOnly && !immediate) ? null : result; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, (finalResult == null) ? null : mask ? OBFUSCATED_STRING : finalResult); } return finalResult; }
java
@FFDCIgnore(ELException.class) @Trivial protected String processString(String name, String expression, boolean immediateOnly, boolean mask) { final String methodName = "processString"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { name, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, immediateOnly, mask }); } String result; boolean immediate = false; try { Object obj = evaluateElExpression(expression, mask); if (obj == null) { throw new IllegalArgumentException("EL expression '" + (mask ? OBFUSCATED_STRING : expression) + "' for '" + name + "'evaluated to null."); } else if (obj instanceof String) { result = (String) obj; immediate = isImmediateExpression(expression, mask); } else { throw new IllegalArgumentException("Expected '" + name + "' to evaluate to a String value."); } } catch (ELException e) { result = expression; immediate = true; } String finalResult = (immediateOnly && !immediate) ? null : result; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, (finalResult == null) ? null : mask ? OBFUSCATED_STRING : finalResult); } return finalResult; }
[ "@", "FFDCIgnore", "(", "ELException", ".", "class", ")", "@", "Trivial", "protected", "String", "processString", "(", "String", "name", ",", "String", "expression", ",", "boolean", "immediateOnly", ",", "boolean", "mask", ")", "{", "final", "String", "methodN...
This method will process a configuration value for any configuration setting in {@link LdapIdentityStoreDefinition} or {@link DatabaseIdentityStoreDefinition} that is a string and whose name is NOT a "*Expression". It will first check to see if it is a EL expression. It it is, it will return the evaluated expression; otherwise, it will return the literal String. @param name The name of the property. Used for error messages. @param expression The value returned from from the identity store definition, which can either be a literal String or an EL expression. @param immediateOnly Return null if the value is a deferred EL expression. @param mask Set whether to mask the expression and result. Useful for when passwords might be contained in either the expression or the result. @return The String value.
[ "This", "method", "will", "process", "a", "configuration", "value", "for", "any", "configuration", "setting", "in", "{", "@link", "LdapIdentityStoreDefinition", "}", "or", "{", "@link", "DatabaseIdentityStoreDefinition", "}", "that", "is", "a", "string", "and", "w...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java#L252-L285
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/AbstractPrimitiveBindTransform.java
AbstractPrimitiveBindTransform.generateParseOnXml
@Override public void generateParseOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String parserName, TypeName beanClass, String beanName, BindProperty property) { XmlType xmlType = property.xmlInfo.xmlType; if (property.hasTypeAdapter()) { // there's an type adapter methodBuilder.addCode("// using type adapter $L\n", property.typeAdapter.adapterClazz); switch (xmlType) { case ATTRIBUTE: methodBuilder.addStatement(setter(beanClass, beanName, property, PRE_TYPE_ADAPTER_TO_JAVA + "$L$T.read$L($L.getAttributeValue(attributeIndex), $L)" + POST_TYPE_ADAPTER), TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, DEFAULT_VALUE); break; case TAG: methodBuilder.addStatement(setter(beanClass, beanName, property, PRE_TYPE_ADAPTER_TO_JAVA + "$L$T.read$L($L.getElementAs$L(), $L)" + POST_TYPE_ADAPTER), TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, XML_TYPE, DEFAULT_VALUE); break; case VALUE: case VALUE_CDATA: methodBuilder.addStatement(setter(beanClass, beanName, property, PRE_TYPE_ADAPTER_TO_JAVA + "$L$T.read$L($L.getText(), $L)" + POST_TYPE_ADAPTER), TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, DEFAULT_VALUE); break; } } else { // without type adapter switch (xmlType) { case ATTRIBUTE: methodBuilder.addStatement(setter(beanClass, beanName, property, "$L$T.read$L($L.getAttributeValue(attributeIndex), $L)"), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, DEFAULT_VALUE); break; case TAG: methodBuilder.addStatement(setter(beanClass, beanName, property, "$L$T.read$L($L.getElementAs$L(), $L)"), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, XML_TYPE, DEFAULT_VALUE); break; case VALUE: case VALUE_CDATA: methodBuilder.addStatement(setter(beanClass, beanName, property, "$L$T.read$L($L.getText(), $L)"), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, DEFAULT_VALUE); break; } } }
java
@Override public void generateParseOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String parserName, TypeName beanClass, String beanName, BindProperty property) { XmlType xmlType = property.xmlInfo.xmlType; if (property.hasTypeAdapter()) { // there's an type adapter methodBuilder.addCode("// using type adapter $L\n", property.typeAdapter.adapterClazz); switch (xmlType) { case ATTRIBUTE: methodBuilder.addStatement(setter(beanClass, beanName, property, PRE_TYPE_ADAPTER_TO_JAVA + "$L$T.read$L($L.getAttributeValue(attributeIndex), $L)" + POST_TYPE_ADAPTER), TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, DEFAULT_VALUE); break; case TAG: methodBuilder.addStatement(setter(beanClass, beanName, property, PRE_TYPE_ADAPTER_TO_JAVA + "$L$T.read$L($L.getElementAs$L(), $L)" + POST_TYPE_ADAPTER), TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, XML_TYPE, DEFAULT_VALUE); break; case VALUE: case VALUE_CDATA: methodBuilder.addStatement(setter(beanClass, beanName, property, PRE_TYPE_ADAPTER_TO_JAVA + "$L$T.read$L($L.getText(), $L)" + POST_TYPE_ADAPTER), TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, DEFAULT_VALUE); break; } } else { // without type adapter switch (xmlType) { case ATTRIBUTE: methodBuilder.addStatement(setter(beanClass, beanName, property, "$L$T.read$L($L.getAttributeValue(attributeIndex), $L)"), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, DEFAULT_VALUE); break; case TAG: methodBuilder.addStatement(setter(beanClass, beanName, property, "$L$T.read$L($L.getElementAs$L(), $L)"), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, XML_TYPE, DEFAULT_VALUE); break; case VALUE: case VALUE_CDATA: methodBuilder.addStatement(setter(beanClass, beanName, property, "$L$T.read$L($L.getText(), $L)"), XML_CAST_TYPE, PrimitiveUtils.class, PRIMITIVE_UTILITY_TYPE, parserName, DEFAULT_VALUE); break; } } }
[ "@", "Override", "public", "void", "generateParseOnXml", "(", "BindTypeContext", "context", ",", "MethodSpec", ".", "Builder", "methodBuilder", ",", "String", "parserName", ",", "TypeName", "beanClass", ",", "String", "beanName", ",", "BindProperty", "property", ")"...
/* (non-Javadoc) @see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateParseOnXml(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/AbstractPrimitiveBindTransform.java#L142-L183
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/metrics/dropwizard/CodahaleHealthChecker.java
CodahaleHealthChecker.registerHealthChecks
public static void registerHealthChecks(final HikariPool pool, final HikariConfig hikariConfig, final HealthCheckRegistry registry) { final Properties healthCheckProperties = hikariConfig.getHealthCheckProperties(); final MetricRegistry metricRegistry = (MetricRegistry) hikariConfig.getMetricRegistry(); final long checkTimeoutMs = Long.parseLong(healthCheckProperties.getProperty("connectivityCheckTimeoutMs", String.valueOf(hikariConfig.getConnectionTimeout()))); registry.register(MetricRegistry.name(hikariConfig.getPoolName(), "pool", "ConnectivityCheck"), new ConnectivityHealthCheck(pool, checkTimeoutMs)); final long expected99thPercentile = Long.parseLong(healthCheckProperties.getProperty("expected99thPercentileMs", "0")); if (metricRegistry != null && expected99thPercentile > 0) { SortedMap<String,Timer> timers = metricRegistry.getTimers((name, metric) -> name.equals(MetricRegistry.name(hikariConfig.getPoolName(), "pool", "Wait"))); if (!timers.isEmpty()) { final Timer timer = timers.entrySet().iterator().next().getValue(); registry.register(MetricRegistry.name(hikariConfig.getPoolName(), "pool", "Connection99Percent"), new Connection99Percent(timer, expected99thPercentile)); } } }
java
public static void registerHealthChecks(final HikariPool pool, final HikariConfig hikariConfig, final HealthCheckRegistry registry) { final Properties healthCheckProperties = hikariConfig.getHealthCheckProperties(); final MetricRegistry metricRegistry = (MetricRegistry) hikariConfig.getMetricRegistry(); final long checkTimeoutMs = Long.parseLong(healthCheckProperties.getProperty("connectivityCheckTimeoutMs", String.valueOf(hikariConfig.getConnectionTimeout()))); registry.register(MetricRegistry.name(hikariConfig.getPoolName(), "pool", "ConnectivityCheck"), new ConnectivityHealthCheck(pool, checkTimeoutMs)); final long expected99thPercentile = Long.parseLong(healthCheckProperties.getProperty("expected99thPercentileMs", "0")); if (metricRegistry != null && expected99thPercentile > 0) { SortedMap<String,Timer> timers = metricRegistry.getTimers((name, metric) -> name.equals(MetricRegistry.name(hikariConfig.getPoolName(), "pool", "Wait"))); if (!timers.isEmpty()) { final Timer timer = timers.entrySet().iterator().next().getValue(); registry.register(MetricRegistry.name(hikariConfig.getPoolName(), "pool", "Connection99Percent"), new Connection99Percent(timer, expected99thPercentile)); } } }
[ "public", "static", "void", "registerHealthChecks", "(", "final", "HikariPool", "pool", ",", "final", "HikariConfig", "hikariConfig", ",", "final", "HealthCheckRegistry", "registry", ")", "{", "final", "Properties", "healthCheckProperties", "=", "hikariConfig", ".", "...
Register Dropwizard health checks. @param pool the pool to register health checks for @param hikariConfig the pool configuration @param registry the HealthCheckRegistry into which checks will be registered
[ "Register", "Dropwizard", "health", "checks", "." ]
train
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/metrics/dropwizard/CodahaleHealthChecker.java#L58-L75
OpenBEL/openbel-framework
org.openbel.framework.api/src/main/java/org/openbel/framework/api/BasicPathFinder.java
BasicPathFinder.runDepthFirstSearch
private void runDepthFirstSearch(final Kam kam, final KamNode cnode, final KamNode source, final Set<KamNode> targets, int depth, final SetStack<KamNode> nodeStack, final SetStack<KamEdge> edgeStack, final List<SimplePath> pathResults) { depth += 1; if (depth > maxSearchDepth) { return; } // get adjacent edges final Set<KamEdge> edges = kam.getAdjacentEdges(cnode, BOTH); for (final KamEdge edge : edges) { if (pushEdge(edge, nodeStack, edgeStack)) { final KamNode edgeOppositeNode = nodeStack.peek(); // we have found a path from source to target if (targets.contains(edgeOppositeNode)) { final SimplePath newPath = new SimplePath(kam, source, nodeStack.peek(), edgeStack.toStack()); pathResults.add(newPath); } else { runDepthFirstSearch(kam, edgeOppositeNode, source, targets, depth, nodeStack, edgeStack, pathResults); } nodeStack.pop(); edgeStack.pop(); } } }
java
private void runDepthFirstSearch(final Kam kam, final KamNode cnode, final KamNode source, final Set<KamNode> targets, int depth, final SetStack<KamNode> nodeStack, final SetStack<KamEdge> edgeStack, final List<SimplePath> pathResults) { depth += 1; if (depth > maxSearchDepth) { return; } // get adjacent edges final Set<KamEdge> edges = kam.getAdjacentEdges(cnode, BOTH); for (final KamEdge edge : edges) { if (pushEdge(edge, nodeStack, edgeStack)) { final KamNode edgeOppositeNode = nodeStack.peek(); // we have found a path from source to target if (targets.contains(edgeOppositeNode)) { final SimplePath newPath = new SimplePath(kam, source, nodeStack.peek(), edgeStack.toStack()); pathResults.add(newPath); } else { runDepthFirstSearch(kam, edgeOppositeNode, source, targets, depth, nodeStack, edgeStack, pathResults); } nodeStack.pop(); edgeStack.pop(); } } }
[ "private", "void", "runDepthFirstSearch", "(", "final", "Kam", "kam", ",", "final", "KamNode", "cnode", ",", "final", "KamNode", "source", ",", "final", "Set", "<", "KamNode", ">", "targets", ",", "int", "depth", ",", "final", "SetStack", "<", "KamNode", "...
Runs a recursive depth-first search from a {@link KamNode} in search of the <tt>target</tt> node. When a {@link SimplePath} is found to the <tt>target</tt> the {@link Stack} of {@link KamEdge} is collected and the algorithm continues.<br/><br/> <p> This depth-first search exhaustively walks the entire {@link Kam} and finds all paths from <tt>source</tt> to <tt>target</tt>. </p> @param kam {@link Kam}, the kam to traverse @param cnode {@link KamNode} the current node to evaluate @param source {@link KamNode} the source to search from @param targets {@link Set} of {@link KamNode}, the targets to search to @param nodeStack {@link Stack} of {@link KamNode} that holds the nodes on the current path from the <tt>source</tt> @param edgeStack {@link Stack} of {@link KamEdge} that holds the edges on the current path from the <tt>source</tt> @param pathResults the resulting paths from source to targets
[ "Runs", "a", "recursive", "depth", "-", "first", "search", "from", "a", "{", "@link", "KamNode", "}", "in", "search", "of", "the", "<tt", ">", "target<", "/", "tt", ">", "node", ".", "When", "a", "{", "@link", "SimplePath", "}", "is", "found", "to", ...
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.api/src/main/java/org/openbel/framework/api/BasicPathFinder.java#L318-L356
nakamura5akihito/six-util
src/main/java/jp/go/aist/six/util/search/RelationalBinding.java
RelationalBinding.notEqualBinding
public static RelationalBinding notEqualBinding( final String property, final Object value ) { return (new RelationalBinding( property, Relation.NOT_EQUAL, value )); }
java
public static RelationalBinding notEqualBinding( final String property, final Object value ) { return (new RelationalBinding( property, Relation.NOT_EQUAL, value )); }
[ "public", "static", "RelationalBinding", "notEqualBinding", "(", "final", "String", "property", ",", "final", "Object", "value", ")", "{", "return", "(", "new", "RelationalBinding", "(", "property", ",", "Relation", ".", "NOT_EQUAL", ",", "value", ")", ")", ";...
Creates a 'NOT_EQUAL' binding. @param property the property. @param value the value to which the property should be related. @return a 'NOT_EQUAL' binding.
[ "Creates", "a", "NOT_EQUAL", "binding", "." ]
train
https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/search/RelationalBinding.java#L70-L76
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java
TorqueDBHandling.createInitScripts
public void createInitScripts() throws PlatformException { Project project = new Project(); TorqueSQLTask sqlTask = new TorqueSQLTask(); File schemaDir = null; File sqlDir = null; _initScripts.clear(); try { File tmpDir = getWorkDir(); schemaDir = new File(tmpDir, "schemas"); sqlDir = new File(tmpDir, "sql"); schemaDir.mkdir(); sqlDir.mkdir(); String includes = writeSchemata(schemaDir); File sqlDbMapFile = new File(sqlDir, SQL_DB_MAP_NAME); sqlDbMapFile.createNewFile(); project.setBasedir(sqlDir.getAbsolutePath()); // populating with defaults sqlTask.setProject(project); sqlTask.setUseClasspath(true); sqlTask.setBasePathToDbProps("sql/base/"); sqlTask.setControlTemplate("sql/base/Control.vm"); sqlTask.setOutputDirectory(sqlDir); // we put the report in the parent directory as we don't want // to read it in later on sqlTask.setOutputFile("../report.sql.generation"); sqlTask.setSqlDbMap(SQL_DB_MAP_NAME); sqlTask.setTargetDatabase(_targetDatabase); FileSet files = new FileSet(); files.setDir(schemaDir); files.setIncludes(includes); sqlTask.addFileset(files); sqlTask.execute(); readTextsCompressed(sqlDir, _initScripts); deleteDir(schemaDir); deleteDir(sqlDir); } catch (Exception ex) { // clean-up if ((schemaDir != null) && schemaDir.exists()) { deleteDir(schemaDir); } if ((sqlDir != null) && sqlDir.exists()) { deleteDir(sqlDir); } throw new PlatformException(ex); } }
java
public void createInitScripts() throws PlatformException { Project project = new Project(); TorqueSQLTask sqlTask = new TorqueSQLTask(); File schemaDir = null; File sqlDir = null; _initScripts.clear(); try { File tmpDir = getWorkDir(); schemaDir = new File(tmpDir, "schemas"); sqlDir = new File(tmpDir, "sql"); schemaDir.mkdir(); sqlDir.mkdir(); String includes = writeSchemata(schemaDir); File sqlDbMapFile = new File(sqlDir, SQL_DB_MAP_NAME); sqlDbMapFile.createNewFile(); project.setBasedir(sqlDir.getAbsolutePath()); // populating with defaults sqlTask.setProject(project); sqlTask.setUseClasspath(true); sqlTask.setBasePathToDbProps("sql/base/"); sqlTask.setControlTemplate("sql/base/Control.vm"); sqlTask.setOutputDirectory(sqlDir); // we put the report in the parent directory as we don't want // to read it in later on sqlTask.setOutputFile("../report.sql.generation"); sqlTask.setSqlDbMap(SQL_DB_MAP_NAME); sqlTask.setTargetDatabase(_targetDatabase); FileSet files = new FileSet(); files.setDir(schemaDir); files.setIncludes(includes); sqlTask.addFileset(files); sqlTask.execute(); readTextsCompressed(sqlDir, _initScripts); deleteDir(schemaDir); deleteDir(sqlDir); } catch (Exception ex) { // clean-up if ((schemaDir != null) && schemaDir.exists()) { deleteDir(schemaDir); } if ((sqlDir != null) && sqlDir.exists()) { deleteDir(sqlDir); } throw new PlatformException(ex); } }
[ "public", "void", "createInitScripts", "(", ")", "throws", "PlatformException", "{", "Project", "project", "=", "new", "Project", "(", ")", ";", "TorqueSQLTask", "sqlTask", "=", "new", "TorqueSQLTask", "(", ")", ";", "File", "schemaDir", "=", "null", ";", "F...
Creates the initialization scripts (creation of tables etc.) but does not perform them. @throws PlatformException If some error occurred
[ "Creates", "the", "initialization", "scripts", "(", "creation", "of", "tables", "etc", ".", ")", "but", "does", "not", "perform", "them", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/dbhandling/TorqueDBHandling.java#L322-L381
KyoriPowered/text
api/src/main/java/net/kyori/text/ScoreComponent.java
ScoreComponent.of
public static ScoreComponent of(final @NonNull String name, final @NonNull String objective, final @Nullable String value) { return builder() .name(name) .objective(objective) .value(value) .build(); }
java
public static ScoreComponent of(final @NonNull String name, final @NonNull String objective, final @Nullable String value) { return builder() .name(name) .objective(objective) .value(value) .build(); }
[ "public", "static", "ScoreComponent", "of", "(", "final", "@", "NonNull", "String", "name", ",", "final", "@", "NonNull", "String", "objective", ",", "final", "@", "Nullable", "String", "value", ")", "{", "return", "builder", "(", ")", ".", "name", "(", ...
Creates a score component with a name, objective, and optional value. @param name the score name @param objective the score objective @param value the value @return the score component
[ "Creates", "a", "score", "component", "with", "a", "name", "objective", "and", "optional", "value", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/ScoreComponent.java#L96-L102
Wadpam/guja
guja-gae/src/main/java/com/wadpam/guja/servlet/GAEBlobServlet.java
GAEBlobServlet.doGet
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (req.getRequestURI().endsWith("upload")) { getUploadUrl(req, resp); } else if (req.getRequestURI().endsWith("latest")) { getLatestByName(req, resp); } else if (null != req.getParameter(KEY_PARAM)) { serveBlob(req, resp); } else { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } }
java
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (req.getRequestURI().endsWith("upload")) { getUploadUrl(req, resp); } else if (req.getRequestURI().endsWith("latest")) { getLatestByName(req, resp); } else if (null != req.getParameter(KEY_PARAM)) { serveBlob(req, resp); } else { resp.setStatus(HttpServletResponse.SC_NOT_FOUND); } }
[ "@", "Override", "protected", "void", "doGet", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "throws", "ServletException", ",", "IOException", "{", "if", "(", "req", ".", "getRequestURI", "(", ")", ".", "endsWith", "(", "\"upload\"",...
Url paths supported /api/blob/upload (GET) Generate upload url /api/blob?key=<> (GET) Serve a blob
[ "Url", "paths", "supported", "/", "api", "/", "blob", "/", "upload", "(", "GET", ")", "Generate", "upload", "url", "/", "api", "/", "blob?key", "=", "<", ">", "(", "GET", ")", "Serve", "a", "blob" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-gae/src/main/java/com/wadpam/guja/servlet/GAEBlobServlet.java#L58-L69
Azure/azure-sdk-for-java
cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java
AccountsInner.listSkus
public CognitiveServicesAccountEnumerateSkusResultInner listSkus(String resourceGroupName, String accountName) { return listSkusWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
java
public CognitiveServicesAccountEnumerateSkusResultInner listSkus(String resourceGroupName, String accountName) { return listSkusWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
[ "public", "CognitiveServicesAccountEnumerateSkusResultInner", "listSkus", "(", "String", "resourceGroupName", ",", "String", "accountName", ")", "{", "return", "listSkusWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "toBlocking", "(", ")"...
List available SKUs for the requested Cognitive Services account. @param resourceGroupName The name of the resource group within the user's subscription. @param accountName The name of Cognitive Services account. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CognitiveServicesAccountEnumerateSkusResultInner object if successful.
[ "List", "available", "SKUs", "for", "the", "requested", "Cognitive", "Services", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/resource-manager/v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/implementation/AccountsInner.java#L988-L990
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.beginCreateOrUpdateByIdAsync
public Observable<GenericResourceInner> beginCreateOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { return beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1<ServiceResponse<GenericResourceInner>, GenericResourceInner>() { @Override public GenericResourceInner call(ServiceResponse<GenericResourceInner> response) { return response.body(); } }); }
java
public Observable<GenericResourceInner> beginCreateOrUpdateByIdAsync(String resourceId, String apiVersion, GenericResourceInner parameters) { return beginCreateOrUpdateByIdWithServiceResponseAsync(resourceId, apiVersion, parameters).map(new Func1<ServiceResponse<GenericResourceInner>, GenericResourceInner>() { @Override public GenericResourceInner call(ServiceResponse<GenericResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "GenericResourceInner", ">", "beginCreateOrUpdateByIdAsync", "(", "String", "resourceId", ",", "String", "apiVersion", ",", "GenericResourceInner", "parameters", ")", "{", "return", "beginCreateOrUpdateByIdWithServiceResponseAsync", "(", "resource...
Create a resource by ID. @param resourceId The fully qualified ID of the resource, including the resource name and resource type. Use the format, /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} @param apiVersion The API version to use for the operation. @param parameters Create or update resource parameters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the GenericResourceInner object
[ "Create", "a", "resource", "by", "ID", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L2168-L2175
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.MAIN
public static HtmlTree MAIN(Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.MAIN, nullCheck(body)); htmltree.setRole(Role.MAIN); return htmltree; }
java
public static HtmlTree MAIN(Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.MAIN, nullCheck(body)); htmltree.setRole(Role.MAIN); return htmltree; }
[ "public", "static", "HtmlTree", "MAIN", "(", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "MAIN", ",", "nullCheck", "(", "body", ")", ")", ";", "htmltree", ".", "setRole", "(", "Role", ".", "MAIN", "...
Generates a MAIN tag with role attribute and some content. @param body content of the MAIN tag @return an HtmlTree object for the MAIN tag
[ "Generates", "a", "MAIN", "tag", "with", "role", "attribute", "and", "some", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L547-L551
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/document/json/JsonObject.java
JsonObject.getAndDecryptInt
@InterfaceStability.Committed public Integer getAndDecryptInt(String name, String providerName) throws Exception { //let it fail in the more general case where it isn't actually a number Number number = (Number) getAndDecrypt(name, providerName); if (number == null) { return null; } else if (number instanceof Integer) { return (Integer) number; } else { return number.intValue(); //autoboxing to Integer } }
java
@InterfaceStability.Committed public Integer getAndDecryptInt(String name, String providerName) throws Exception { //let it fail in the more general case where it isn't actually a number Number number = (Number) getAndDecrypt(name, providerName); if (number == null) { return null; } else if (number instanceof Integer) { return (Integer) number; } else { return number.intValue(); //autoboxing to Integer } }
[ "@", "InterfaceStability", ".", "Committed", "public", "Integer", "getAndDecryptInt", "(", "String", "name", ",", "String", "providerName", ")", "throws", "Exception", "{", "//let it fail in the more general case where it isn't actually a number", "Number", "number", "=", "...
Retrieves the decrypted value from the field name and casts it to {@link Integer}. Note that if value was stored as another numerical type, some truncation or rounding may occur. @param name the name of the field. @param providerName crypto provider name for decryption. @return the result or null if it does not exist.
[ "Retrieves", "the", "decrypted", "value", "from", "the", "field", "name", "and", "casts", "it", "to", "{", "@link", "Integer", "}", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L444-L455
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FtpFileUtil.java
FtpFileUtil.deleteDirectoryFromFTPServer
public static boolean deleteDirectoryFromFTPServer(String hostName, Integer port, String userName, String password, String remotePath) { boolean deleted = false; FTPClient ftpClient = new FTPClient(); String errorMessage = "Could not delete the directory '%s' from FTP server '%s'. Cause: %s"; try { connectAndLoginOnFTPServer(ftpClient, hostName, port, userName, password); deleted = ftpClient.removeDirectory(remotePath); } catch (IOException ex) { throw new RuntimeException(String.format(errorMessage, remotePath, hostName), ex); } finally { disconnectAndLogoutFromFTPServer(ftpClient, hostName); } return deleted; }
java
public static boolean deleteDirectoryFromFTPServer(String hostName, Integer port, String userName, String password, String remotePath) { boolean deleted = false; FTPClient ftpClient = new FTPClient(); String errorMessage = "Could not delete the directory '%s' from FTP server '%s'. Cause: %s"; try { connectAndLoginOnFTPServer(ftpClient, hostName, port, userName, password); deleted = ftpClient.removeDirectory(remotePath); } catch (IOException ex) { throw new RuntimeException(String.format(errorMessage, remotePath, hostName), ex); } finally { disconnectAndLogoutFromFTPServer(ftpClient, hostName); } return deleted; }
[ "public", "static", "boolean", "deleteDirectoryFromFTPServer", "(", "String", "hostName", ",", "Integer", "port", ",", "String", "userName", ",", "String", "password", ",", "String", "remotePath", ")", "{", "boolean", "deleted", "=", "false", ";", "FTPClient", "...
Delete given directory from FTP server (directory must be empty). @param hostName the FTP server host name to connect @param port the port to connect @param userName the user name @param password the password @param remotePath the path to the directory on the FTP to be removed @return true if file has been removed and false otherwise. @throws RuntimeException in case any exception has been thrown.
[ "Delete", "given", "directory", "from", "FTP", "server", "(", "directory", "must", "be", "empty", ")", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FtpFileUtil.java#L142-L157
js-lib-com/template.xhtml
src/main/java/js/template/xhtml/OListOperator.java
OListOperator.doExec
@Override protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws IOException, TemplateException { if (!propertyPath.equals(".") && ConverterRegistry.hasType(scope.getClass())) { throw new TemplateException("Operand is property path but scope is not an object."); } Element itemTemplate = element.getFirstChild(); if (itemTemplate == null) { throw new TemplateException("Invalid list element |%s|. Missing item template.", element); } Stack<Index> indexes = serializer.getIndexes(); Index index = new Index(); indexes.push(index); for (Object item : content.getIterable(scope, propertyPath)) { index.increment(); serializer.writeItem(itemTemplate, item); } indexes.pop(); return null; }
java
@Override protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws IOException, TemplateException { if (!propertyPath.equals(".") && ConverterRegistry.hasType(scope.getClass())) { throw new TemplateException("Operand is property path but scope is not an object."); } Element itemTemplate = element.getFirstChild(); if (itemTemplate == null) { throw new TemplateException("Invalid list element |%s|. Missing item template.", element); } Stack<Index> indexes = serializer.getIndexes(); Index index = new Index(); indexes.push(index); for (Object item : content.getIterable(scope, propertyPath)) { index.increment(); serializer.writeItem(itemTemplate, item); } indexes.pop(); return null; }
[ "@", "Override", "protected", "Object", "doExec", "(", "Element", "element", ",", "Object", "scope", ",", "String", "propertyPath", ",", "Object", "...", "arguments", ")", "throws", "IOException", ",", "TemplateException", "{", "if", "(", "!", "propertyPath", ...
Execute OLIST operator. Behaves like {@link ListOperator#doExec(Element, Object, String, Object...)} counterpart but takes care to create index and increment it before every item processing. @param element context element, @param scope scope object, @param propertyPath property path, @param arguments optional arguments, not used. @return always returns null to signal full processing. @throws IOException if underlying writer fails to write. @throws TemplateException if element has no children or content list is undefined.
[ "Execute", "OLIST", "operator", ".", "Behaves", "like", "{", "@link", "ListOperator#doExec", "(", "Element", "Object", "String", "Object", "...", ")", "}", "counterpart", "but", "takes", "care", "to", "create", "index", "and", "increment", "it", "before", "eve...
train
https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/OListOperator.java#L59-L77
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.createPatternAnyEntityRole
public UUID createPatternAnyEntityRole(UUID appId, String versionId, UUID entityId, CreatePatternAnyEntityRoleOptionalParameter createPatternAnyEntityRoleOptionalParameter) { return createPatternAnyEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createPatternAnyEntityRoleOptionalParameter).toBlocking().single().body(); }
java
public UUID createPatternAnyEntityRole(UUID appId, String versionId, UUID entityId, CreatePatternAnyEntityRoleOptionalParameter createPatternAnyEntityRoleOptionalParameter) { return createPatternAnyEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createPatternAnyEntityRoleOptionalParameter).toBlocking().single().body(); }
[ "public", "UUID", "createPatternAnyEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "CreatePatternAnyEntityRoleOptionalParameter", "createPatternAnyEntityRoleOptionalParameter", ")", "{", "return", "createPatternAnyEntityRoleWithService...
Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param entityId The entity model ID. @param createPatternAnyEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the UUID object if successful.
[ "Create", "an", "entity", "role", "for", "an", "entity", "in", "the", "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#L9152-L9154
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.existsResourceId
public boolean existsResourceId(CmsDbContext dbc, CmsUUID resourceId) throws CmsException { return getVfsDriver(dbc).validateResourceIdExists(dbc, dbc.currentProject().getUuid(), resourceId); }
java
public boolean existsResourceId(CmsDbContext dbc, CmsUUID resourceId) throws CmsException { return getVfsDriver(dbc).validateResourceIdExists(dbc, dbc.currentProject().getUuid(), resourceId); }
[ "public", "boolean", "existsResourceId", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "resourceId", ")", "throws", "CmsException", "{", "return", "getVfsDriver", "(", "dbc", ")", ".", "validateResourceIdExists", "(", "dbc", ",", "dbc", ".", "currentProject", "(", ...
Tests if a resource with the given resourceId does already exist in the Database.<p> @param dbc the current database context @param resourceId the resource id to test for @return true if a resource with the given id was found, false otherweise @throws CmsException if something goes wrong
[ "Tests", "if", "a", "resource", "with", "the", "given", "resourceId", "does", "already", "exist", "in", "the", "Database", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L3246-L3249
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/ui/groupeditor/CmsGroupContainerEditor.java
CmsGroupContainerEditor.setGroupContainerData
protected void setGroupContainerData(Map<String, CmsContainerElementData> elementsData) { m_elementData = elementsData.get(getGroupContainerWidget().getId()); if (m_elementData != null) { setSaveEnabled(true, null); m_groupContainerBean = new CmsGroupContainer(); m_groupContainerBean.setClientId(m_elementData.getClientId()); m_groupContainerBean.setResourceType(getGroupContainerWidget().getNewType()); m_groupContainerBean.setNew(getGroupContainerWidget().isNew()); m_groupContainerBean.setSitePath(m_elementData.getSitePath()); if (m_elementData.getTypes().isEmpty()) { Set<String> types = new HashSet<String>(); types.add(((CmsContainerPageContainer)getGroupContainerWidget().getParentTarget()).getContainerType()); m_elementData.setTypes(types); m_groupContainerBean.setTypes(types); } else { m_groupContainerBean.setTypes(m_elementData.getTypes()); } m_inputDescription.setFormValueAsString(m_elementData.getDescription()); m_inputTitle.setFormValueAsString(m_elementData.getTitle()); m_groupContainerBean.setTitle(m_elementData.getTitle()); m_groupContainerBean.setDescription(m_elementData.getDescription()); } else { CmsDebugLog.getInstance().printLine("Loading groupcontainer error."); } }
java
protected void setGroupContainerData(Map<String, CmsContainerElementData> elementsData) { m_elementData = elementsData.get(getGroupContainerWidget().getId()); if (m_elementData != null) { setSaveEnabled(true, null); m_groupContainerBean = new CmsGroupContainer(); m_groupContainerBean.setClientId(m_elementData.getClientId()); m_groupContainerBean.setResourceType(getGroupContainerWidget().getNewType()); m_groupContainerBean.setNew(getGroupContainerWidget().isNew()); m_groupContainerBean.setSitePath(m_elementData.getSitePath()); if (m_elementData.getTypes().isEmpty()) { Set<String> types = new HashSet<String>(); types.add(((CmsContainerPageContainer)getGroupContainerWidget().getParentTarget()).getContainerType()); m_elementData.setTypes(types); m_groupContainerBean.setTypes(types); } else { m_groupContainerBean.setTypes(m_elementData.getTypes()); } m_inputDescription.setFormValueAsString(m_elementData.getDescription()); m_inputTitle.setFormValueAsString(m_elementData.getTitle()); m_groupContainerBean.setTitle(m_elementData.getTitle()); m_groupContainerBean.setDescription(m_elementData.getDescription()); } else { CmsDebugLog.getInstance().printLine("Loading groupcontainer error."); } }
[ "protected", "void", "setGroupContainerData", "(", "Map", "<", "String", ",", "CmsContainerElementData", ">", "elementsData", ")", "{", "m_elementData", "=", "elementsData", ".", "get", "(", "getGroupContainerWidget", "(", ")", ".", "getId", "(", ")", ")", ";", ...
Sets the data of the group-container to edit.<p> @param elementsData the data of all contained elements and the group-container itself
[ "Sets", "the", "data", "of", "the", "group", "-", "container", "to", "edit", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/groupeditor/CmsGroupContainerEditor.java#L316-L341
JadiraOrg/jadira
cloning/src/main/java/org/jadira/reflection/cloning/implementor/AbstractCloneStrategy.java
AbstractCloneStrategy.handleCloneField
protected <T> void handleCloneField(T obj, T copy, CloneDriver driver, FieldModel<T> f, IdentityHashMap<Object, Object> referencesToReuse, long stackDepth) { final Class<?> clazz = f.getFieldClass(); if (clazz.isPrimitive()) { handleClonePrimitiveField(obj, copy, driver, f, referencesToReuse); } else if (!driver.isCloneSyntheticFields() && f.isSynthetic()) { putFieldValue(copy, f, getFieldValue(obj, f)); } else { final Object fieldObject = getFieldValue(obj, f); final Object fieldObjectClone = clone(fieldObject, driver, referencesToReuse, stackDepth); putFieldValue(copy, f, fieldObjectClone); } }
java
protected <T> void handleCloneField(T obj, T copy, CloneDriver driver, FieldModel<T> f, IdentityHashMap<Object, Object> referencesToReuse, long stackDepth) { final Class<?> clazz = f.getFieldClass(); if (clazz.isPrimitive()) { handleClonePrimitiveField(obj, copy, driver, f, referencesToReuse); } else if (!driver.isCloneSyntheticFields() && f.isSynthetic()) { putFieldValue(copy, f, getFieldValue(obj, f)); } else { final Object fieldObject = getFieldValue(obj, f); final Object fieldObjectClone = clone(fieldObject, driver, referencesToReuse, stackDepth); putFieldValue(copy, f, fieldObjectClone); } }
[ "protected", "<", "T", ">", "void", "handleCloneField", "(", "T", "obj", ",", "T", "copy", ",", "CloneDriver", "driver", ",", "FieldModel", "<", "T", ">", "f", ",", "IdentityHashMap", "<", "Object", ",", "Object", ">", "referencesToReuse", ",", "long", "...
Clone a Field @param obj The original object @param copy The destination object @param driver The CloneDriver @param f The FieldModel for the target field @param referencesToReuse Used for tracking objects that have already been seen @param stackDepth The current depth of the stack - used to switch from recursion to iteration if the stack grows too deep. @param <T> The type containing the field being cloned
[ "Clone", "a", "Field" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/cloning/implementor/AbstractCloneStrategy.java#L375-L389
jenkinsci/github-plugin
src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java
WebhookManager.createHookSubscribedTo
protected Function<GitHubRepositoryName, GHHook> createHookSubscribedTo(final List<GHEvent> events) { return new NullSafeFunction<GitHubRepositoryName, GHHook>() { @Override protected GHHook applyNullSafe(@Nonnull GitHubRepositoryName name) { try { GHRepository repo = checkNotNull( from(name.resolve(allowedToManageHooks())).firstMatch(withAdminAccess()).orNull(), "There are no credentials with admin access to manage hooks on %s", name ); Validate.notEmpty(events, "Events list for hook can't be empty"); Set<GHHook> hooks = from(fetchHooks().apply(repo)) .filter(webhookFor(endpoint)) .toSet(); Set<GHEvent> alreadyRegistered = from(hooks) .transformAndConcat(eventsFromHook()).toSet(); if (hooks.size() == 1 && isEqualCollection(alreadyRegistered, events)) { LOGGER.debug("Hook already registered for events {}", events); return null; } Set<GHEvent> merged = from(alreadyRegistered).append(events).toSet(); from(hooks) .filter(deleteWebhook()) .filter(log("Replaced hook")).toList(); return createWebhook(endpoint, merged).apply(repo); } catch (Exception e) { LOGGER.warn("Failed to add GitHub webhook for {}", name, e); GitHubHookRegisterProblemMonitor.get().registerProblem(name, e); } return null; } }; }
java
protected Function<GitHubRepositoryName, GHHook> createHookSubscribedTo(final List<GHEvent> events) { return new NullSafeFunction<GitHubRepositoryName, GHHook>() { @Override protected GHHook applyNullSafe(@Nonnull GitHubRepositoryName name) { try { GHRepository repo = checkNotNull( from(name.resolve(allowedToManageHooks())).firstMatch(withAdminAccess()).orNull(), "There are no credentials with admin access to manage hooks on %s", name ); Validate.notEmpty(events, "Events list for hook can't be empty"); Set<GHHook> hooks = from(fetchHooks().apply(repo)) .filter(webhookFor(endpoint)) .toSet(); Set<GHEvent> alreadyRegistered = from(hooks) .transformAndConcat(eventsFromHook()).toSet(); if (hooks.size() == 1 && isEqualCollection(alreadyRegistered, events)) { LOGGER.debug("Hook already registered for events {}", events); return null; } Set<GHEvent> merged = from(alreadyRegistered).append(events).toSet(); from(hooks) .filter(deleteWebhook()) .filter(log("Replaced hook")).toList(); return createWebhook(endpoint, merged).apply(repo); } catch (Exception e) { LOGGER.warn("Failed to add GitHub webhook for {}", name, e); GitHubHookRegisterProblemMonitor.get().registerProblem(name, e); } return null; } }; }
[ "protected", "Function", "<", "GitHubRepositoryName", ",", "GHHook", ">", "createHookSubscribedTo", "(", "final", "List", "<", "GHEvent", ">", "events", ")", "{", "return", "new", "NullSafeFunction", "<", "GitHubRepositoryName", ",", "GHHook", ">", "(", ")", "{"...
Main logic of {@link #registerFor(Item)}. Updates hooks with replacing old ones with merged new ones @param events calculated events list to be registered in hook @return function to register hooks for given events
[ "Main", "logic", "of", "{", "@link", "#registerFor", "(", "Item", ")", "}", ".", "Updates", "hooks", "with", "replacing", "old", "ones", "with", "merged", "new", "ones" ]
train
https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java#L174-L212
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.generatePutRequest
protected HttpPut generatePutRequest(final String path, final Map<String, Object> paramMap) { final HttpPut put = new HttpPut(buildUri(path)); if (paramMap != null) { put.setEntity(new StringEntity(JSONObject.toJSONString(paramMap), ContentType.APPLICATION_JSON)); } return put; }
java
protected HttpPut generatePutRequest(final String path, final Map<String, Object> paramMap) { final HttpPut put = new HttpPut(buildUri(path)); if (paramMap != null) { put.setEntity(new StringEntity(JSONObject.toJSONString(paramMap), ContentType.APPLICATION_JSON)); } return put; }
[ "protected", "HttpPut", "generatePutRequest", "(", "final", "String", "path", ",", "final", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "final", "HttpPut", "put", "=", "new", "HttpPut", "(", "buildUri", "(", "path", ")", ")", ";", "if...
Helper method to build the PUT request for the server. @param path the path @param paramMap the parameters map. @return the put object.
[ "Helper", "method", "to", "build", "the", "PUT", "request", "for", "the", "server", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L652-L658
Whiley/WhileyCompiler
src/main/java/wyil/transform/VerificationConditionGenerator.java
VerificationConditionGenerator.implies
private WyalFile.Stmt implies(WyalFile.Stmt antecedent, WyalFile.Stmt consequent) { if (antecedent == null) { return consequent; } else { WyalFile.Stmt.Block antecedentBlock = new WyalFile.Stmt.Block(antecedent); WyalFile.Stmt.Block consequentBlock = new WyalFile.Stmt.Block(consequent); return new WyalFile.Stmt.IfThen(antecedentBlock, consequentBlock); } }
java
private WyalFile.Stmt implies(WyalFile.Stmt antecedent, WyalFile.Stmt consequent) { if (antecedent == null) { return consequent; } else { WyalFile.Stmt.Block antecedentBlock = new WyalFile.Stmt.Block(antecedent); WyalFile.Stmt.Block consequentBlock = new WyalFile.Stmt.Block(consequent); return new WyalFile.Stmt.IfThen(antecedentBlock, consequentBlock); } }
[ "private", "WyalFile", ".", "Stmt", "implies", "(", "WyalFile", ".", "Stmt", "antecedent", ",", "WyalFile", ".", "Stmt", "consequent", ")", "{", "if", "(", "antecedent", "==", "null", ")", "{", "return", "consequent", ";", "}", "else", "{", "WyalFile", "...
Construct an implication from one expression to another @param antecedent @param consequent @return
[ "Construct", "an", "implication", "from", "one", "expression", "to", "another" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1721-L1729
Azure/azure-sdk-for-java
datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java
FilesInner.getAsync
public Observable<ProjectFileInner> getAsync(String groupName, String serviceName, String projectName, String fileName) { return getWithServiceResponseAsync(groupName, serviceName, projectName, fileName).map(new Func1<ServiceResponse<ProjectFileInner>, ProjectFileInner>() { @Override public ProjectFileInner call(ServiceResponse<ProjectFileInner> response) { return response.body(); } }); }
java
public Observable<ProjectFileInner> getAsync(String groupName, String serviceName, String projectName, String fileName) { return getWithServiceResponseAsync(groupName, serviceName, projectName, fileName).map(new Func1<ServiceResponse<ProjectFileInner>, ProjectFileInner>() { @Override public ProjectFileInner call(ServiceResponse<ProjectFileInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ProjectFileInner", ">", "getAsync", "(", "String", "groupName", ",", "String", "serviceName", ",", "String", "projectName", ",", "String", "fileName", ")", "{", "return", "getWithServiceResponseAsync", "(", "groupName", ",", "serviceNam...
Get file information. The files resource is a nested, proxy-only resource representing a file stored under the project resource. This method retrieves information about a file. @param groupName Name of the resource group @param serviceName Name of the service @param projectName Name of the project @param fileName Name of the File @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ProjectFileInner object
[ "Get", "file", "information", ".", "The", "files", "resource", "is", "a", "nested", "proxy", "-", "only", "resource", "representing", "a", "file", "stored", "under", "the", "project", "resource", ".", "This", "method", "retrieves", "information", "about", "a",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java#L280-L287
matiascamiletti/MCDropdownMenu
app/src/main/java/com/mobileia/mcdropdownmenu/example/ViewHolder.java
ViewHolder.get
@SuppressWarnings("unchecked") public static <T extends View> T get(View view, int id) { SparseArray<View> viewHolder = (SparseArray<View>) view.getTag(); if (viewHolder == null) { viewHolder = new SparseArray<View>(); view.setTag(viewHolder); } View childView = viewHolder.get(id); if (childView == null) { childView = view.findViewById(id); viewHolder.put(id, childView); } return (T) childView; }
java
@SuppressWarnings("unchecked") public static <T extends View> T get(View view, int id) { SparseArray<View> viewHolder = (SparseArray<View>) view.getTag(); if (viewHolder == null) { viewHolder = new SparseArray<View>(); view.setTag(viewHolder); } View childView = viewHolder.get(id); if (childView == null) { childView = view.findViewById(id); viewHolder.put(id, childView); } return (T) childView; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "View", ">", "T", "get", "(", "View", "view", ",", "int", "id", ")", "{", "SparseArray", "<", "View", ">", "viewHolder", "=", "(", "SparseArray", "<", "View", ...
I added a generic return type to reduce the casting noise in client code
[ "I", "added", "a", "generic", "return", "type", "to", "reduce", "the", "casting", "noise", "in", "client", "code" ]
train
https://github.com/matiascamiletti/MCDropdownMenu/blob/eba3dac505c2b9945151430406aee82ed809ab15/app/src/main/java/com/mobileia/mcdropdownmenu/example/ViewHolder.java#L11-L24
banjocreek/java-builder
src/main/java/com/banjocreek/riverbed/builder/map/AbstractMutableMapBuilder.java
AbstractMutableMapBuilder.doDefaults
protected final void doDefaults(final Map<K, ? extends V> defaults) { apply(defaults.isEmpty() ? Nop.instance() : new Defaults<>(defaults)); }
java
protected final void doDefaults(final Map<K, ? extends V> defaults) { apply(defaults.isEmpty() ? Nop.instance() : new Defaults<>(defaults)); }
[ "protected", "final", "void", "doDefaults", "(", "final", "Map", "<", "K", ",", "?", "extends", "V", ">", "defaults", ")", "{", "apply", "(", "defaults", ".", "isEmpty", "(", ")", "?", "Nop", ".", "instance", "(", ")", ":", "new", "Defaults", "<>", ...
Post a delta consisting of defaults to register. @param defaults default entries.
[ "Post", "a", "delta", "consisting", "of", "defaults", "to", "register", "." ]
train
https://github.com/banjocreek/java-builder/blob/4cc6ce461e58a8a9eac988e8a51073ea6dc1cc81/src/main/java/com/banjocreek/riverbed/builder/map/AbstractMutableMapBuilder.java#L64-L68
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/util/SchedulerUtils.java
SchedulerUtils.loadGenericJobConfig
public static Properties loadGenericJobConfig(Properties sysProps, Path jobConfigPath, Path jobConfigPathDir) throws ConfigurationException, IOException { PullFileLoader loader = new PullFileLoader(jobConfigPathDir, jobConfigPathDir.getFileSystem(new Configuration()), getJobConfigurationFileExtensions(sysProps), PullFileLoader.DEFAULT_HOCON_PULL_FILE_EXTENSIONS); Config sysConfig = ConfigUtils.propertiesToConfig(sysProps); Config config = loader.loadPullFile(jobConfigPath, sysConfig, true); return resolveTemplate(ConfigUtils.configToProperties(config)); }
java
public static Properties loadGenericJobConfig(Properties sysProps, Path jobConfigPath, Path jobConfigPathDir) throws ConfigurationException, IOException { PullFileLoader loader = new PullFileLoader(jobConfigPathDir, jobConfigPathDir.getFileSystem(new Configuration()), getJobConfigurationFileExtensions(sysProps), PullFileLoader.DEFAULT_HOCON_PULL_FILE_EXTENSIONS); Config sysConfig = ConfigUtils.propertiesToConfig(sysProps); Config config = loader.loadPullFile(jobConfigPath, sysConfig, true); return resolveTemplate(ConfigUtils.configToProperties(config)); }
[ "public", "static", "Properties", "loadGenericJobConfig", "(", "Properties", "sysProps", ",", "Path", "jobConfigPath", ",", "Path", "jobConfigPathDir", ")", "throws", "ConfigurationException", ",", "IOException", "{", "PullFileLoader", "loader", "=", "new", "PullFileLoa...
Load a given job configuration file from a general file system. @param sysProps Gobblin framework configuration properties @param jobConfigPath job configuration file to be loaded @param jobConfigPathDir root job configuration file directory @return a job configuration in the form of {@link java.util.Properties}
[ "Load", "a", "given", "job", "configuration", "file", "from", "a", "general", "file", "system", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/util/SchedulerUtils.java#L129-L138
shekhargulati/strman-java
src/main/java/strman/Strman.java
Strman.indexOf
public static int indexOf(final String value, final String needle, int offset, boolean caseSensitive) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); if (caseSensitive) { return value.indexOf(needle, offset); } return value.toLowerCase().indexOf(needle.toLowerCase(), offset); }
java
public static int indexOf(final String value, final String needle, int offset, boolean caseSensitive) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); if (caseSensitive) { return value.indexOf(needle, offset); } return value.toLowerCase().indexOf(needle.toLowerCase(), offset); }
[ "public", "static", "int", "indexOf", "(", "final", "String", "value", ",", "final", "String", "needle", ",", "int", "offset", ",", "boolean", "caseSensitive", ")", "{", "validate", "(", "value", ",", "NULL_STRING_PREDICATE", ",", "NULL_STRING_MSG_SUPPLIER", ")"...
The indexOf() method returns the index within the calling String of the first occurrence of the specified value, starting the search at fromIndex. Returns -1 if the value is not found. @param value The input String @param needle The search String @param offset The offset to start searching from. @param caseSensitive boolean to indicate whether search should be case sensitive @return Returns position of first occurrence of needle.
[ "The", "indexOf", "()", "method", "returns", "the", "index", "within", "the", "calling", "String", "of", "the", "first", "occurrence", "of", "the", "specified", "value", "starting", "the", "search", "at", "fromIndex", ".", "Returns", "-", "1", "if", "the", ...
train
https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L481-L487
FXMisc/RichTextFX
richtextfx/src/main/java/org/fxmisc/richtext/model/Paragraph.java
Paragraph.getStyleRangeAtPosition
public IndexRange getStyleRangeAtPosition(int position) { Position pos = styles.offsetToPosition(position, Backward); int start = position - pos.getMinor(); int end = start + styles.getStyleSpan(pos.getMajor()).getLength(); return new IndexRange(start, end); }
java
public IndexRange getStyleRangeAtPosition(int position) { Position pos = styles.offsetToPosition(position, Backward); int start = position - pos.getMinor(); int end = start + styles.getStyleSpan(pos.getMajor()).getLength(); return new IndexRange(start, end); }
[ "public", "IndexRange", "getStyleRangeAtPosition", "(", "int", "position", ")", "{", "Position", "pos", "=", "styles", ".", "offsetToPosition", "(", "position", ",", "Backward", ")", ";", "int", "start", "=", "position", "-", "pos", ".", "getMinor", "(", ")"...
Returns the range of homogeneous style that includes the given position. If {@code position} points to a boundary between two styled ranges, then the range preceding {@code position} is returned.
[ "Returns", "the", "range", "of", "homogeneous", "style", "that", "includes", "the", "given", "position", ".", "If", "{" ]
train
https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/Paragraph.java#L391-L396
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/codec/TIFFDirectory.java
TIFFDirectory.getFieldAsLong
public long getFieldAsLong(int tag, int index) { Integer i = (Integer)fieldIndex.get(Integer.valueOf(tag)); return fields[i.intValue()].getAsLong(index); }
java
public long getFieldAsLong(int tag, int index) { Integer i = (Integer)fieldIndex.get(Integer.valueOf(tag)); return fields[i.intValue()].getAsLong(index); }
[ "public", "long", "getFieldAsLong", "(", "int", "tag", ",", "int", "index", ")", "{", "Integer", "i", "=", "(", "Integer", ")", "fieldIndex", ".", "get", "(", "Integer", ".", "valueOf", "(", "tag", ")", ")", ";", "return", "fields", "[", "i", ".", ...
Returns the value of a particular index of a given tag as a long. The caller is responsible for ensuring that the tag is present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED, TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG.
[ "Returns", "the", "value", "of", "a", "particular", "index", "of", "a", "given", "tag", "as", "a", "long", ".", "The", "caller", "is", "responsible", "for", "ensuring", "that", "the", "tag", "is", "present", "and", "has", "type", "TIFF_BYTE", "TIFF_SBYTE",...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/codec/TIFFDirectory.java#L468-L471
cycorp/api-suite
core-api/src/main/java/com/cyc/query/exception/ProofViewException.java
ProofViewException.fromThrowable
public static ProofViewException fromThrowable(String message, Throwable cause) { return (cause instanceof ProofViewException && Objects.equals(message, cause.getMessage())) ? (ProofViewException) cause : new ProofViewException(message, cause); }
java
public static ProofViewException fromThrowable(String message, Throwable cause) { return (cause instanceof ProofViewException && Objects.equals(message, cause.getMessage())) ? (ProofViewException) cause : new ProofViewException(message, cause); }
[ "public", "static", "ProofViewException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "ProofViewException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getMessage", ...
Converts a Throwable to a ProofViewException with the specified detail message. If the Throwable is a ProofViewException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new ProofViewException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a ProofViewException
[ "Converts", "a", "Throwable", "to", "a", "ProofViewException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "ProofViewException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "the", "on...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/query/exception/ProofViewException.java#L61-L65
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/MapServiceContextImpl.java
MapServiceContextImpl.removeAllRecordStoresOfAllMaps
protected void removeAllRecordStoresOfAllMaps(boolean onShutdown, boolean onRecordStoreDestroy) { for (PartitionContainer partitionContainer : partitionContainers) { if (partitionContainer != null) { removeRecordStoresFromPartitionMatchingWith(allRecordStores(), partitionContainer.getPartitionId(), onShutdown, onRecordStoreDestroy); } } }
java
protected void removeAllRecordStoresOfAllMaps(boolean onShutdown, boolean onRecordStoreDestroy) { for (PartitionContainer partitionContainer : partitionContainers) { if (partitionContainer != null) { removeRecordStoresFromPartitionMatchingWith(allRecordStores(), partitionContainer.getPartitionId(), onShutdown, onRecordStoreDestroy); } } }
[ "protected", "void", "removeAllRecordStoresOfAllMaps", "(", "boolean", "onShutdown", ",", "boolean", "onRecordStoreDestroy", ")", "{", "for", "(", "PartitionContainer", "partitionContainer", ":", "partitionContainers", ")", "{", "if", "(", "partitionContainer", "!=", "n...
Removes all record stores from all partitions. Calls {@link #removeRecordStoresFromPartitionMatchingWith} internally and @param onShutdown {@code true} if this method is called during map service shutdown, otherwise set {@code false} @param onRecordStoreDestroy {@code true} if this method is called during to destroy record store, otherwise set {@code false}
[ "Removes", "all", "record", "stores", "from", "all", "partitions", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapServiceContextImpl.java#L314-L321
phoenixnap/springmvc-raml-plugin
src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java
NamingHelper.getAllResourcesNames
public static String getAllResourcesNames(String url, boolean singularize) { StringBuilder stringBuilder = new StringBuilder(); if (StringUtils.hasText(url)) { String[] resources = SLASH.split(url); int lengthCounter = 0; for (int i = resources.length - 1; i >= Config.getResourceTopLevelInClassNames() + 1; --i) { if (StringUtils.hasText(resources[i])) { String resourceName = getResourceName(resources[i], singularize); if (Config.isReverseOrderInClassNames()) { stringBuilder.append(resourceName); } else { stringBuilder.insert(0, resourceName); } ++lengthCounter; } if (Config.getResourceDepthInClassNames() > 0 && lengthCounter >= Config.getResourceDepthInClassNames()) { break; } } } return stringBuilder.toString(); }
java
public static String getAllResourcesNames(String url, boolean singularize) { StringBuilder stringBuilder = new StringBuilder(); if (StringUtils.hasText(url)) { String[] resources = SLASH.split(url); int lengthCounter = 0; for (int i = resources.length - 1; i >= Config.getResourceTopLevelInClassNames() + 1; --i) { if (StringUtils.hasText(resources[i])) { String resourceName = getResourceName(resources[i], singularize); if (Config.isReverseOrderInClassNames()) { stringBuilder.append(resourceName); } else { stringBuilder.insert(0, resourceName); } ++lengthCounter; } if (Config.getResourceDepthInClassNames() > 0 && lengthCounter >= Config.getResourceDepthInClassNames()) { break; } } } return stringBuilder.toString(); }
[ "public", "static", "String", "getAllResourcesNames", "(", "String", "url", ",", "boolean", "singularize", ")", "{", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "StringUtils", ".", "hasText", "(", "url", ")", ")", ...
Attempts to infer the name of a resource from a resources's full URL. @param url The URL of the raml resource being parsed @param singularize Indicates if the resource name should be singularized or not @return name of a resource
[ "Attempts", "to", "infer", "the", "name", "of", "a", "resource", "from", "a", "resources", "s", "full", "URL", "." ]
train
https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/NamingHelper.java#L261-L284
Axway/Grapes
commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java
DataModelFactory.createDelivery
public static Delivery createDelivery(final String commercialName, final String commercialVersion, final String releaseDate, final List<String> dependencies) { final Delivery delivery = new Delivery(); delivery.setCommercialName(commercialName); delivery.setCommercialVersion(commercialVersion); delivery.setReleaseDate(releaseDate); delivery.setDependencies(dependencies); return delivery; }
java
public static Delivery createDelivery(final String commercialName, final String commercialVersion, final String releaseDate, final List<String> dependencies) { final Delivery delivery = new Delivery(); delivery.setCommercialName(commercialName); delivery.setCommercialVersion(commercialVersion); delivery.setReleaseDate(releaseDate); delivery.setDependencies(dependencies); return delivery; }
[ "public", "static", "Delivery", "createDelivery", "(", "final", "String", "commercialName", ",", "final", "String", "commercialVersion", ",", "final", "String", "releaseDate", ",", "final", "List", "<", "String", ">", "dependencies", ")", "{", "final", "Delivery",...
Generates a PromotionDetails regarding the parameters. @param commercialName String @param commercialVersion String @param releaseDate String @param dependencies List<String> @return Delivery
[ "Generates", "a", "PromotionDetails", "regarding", "the", "parameters", "." ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java#L204-L213
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Log.java
Log.logLong
public static void logLong(String TAG, String longString) { InputStream is = new ByteArrayInputStream( longString.getBytes() ); @SuppressWarnings("resource") Scanner scan = new Scanner(is); while (scan.hasNextLine()) { Log.v(TAG, scan.nextLine()); } }
java
public static void logLong(String TAG, String longString) { InputStream is = new ByteArrayInputStream( longString.getBytes() ); @SuppressWarnings("resource") Scanner scan = new Scanner(is); while (scan.hasNextLine()) { Log.v(TAG, scan.nextLine()); } }
[ "public", "static", "void", "logLong", "(", "String", "TAG", ",", "String", "longString", ")", "{", "InputStream", "is", "=", "new", "ByteArrayInputStream", "(", "longString", ".", "getBytes", "(", ")", ")", ";", "@", "SuppressWarnings", "(", "\"resource\"", ...
Log long string using verbose tag @param TAG The tag. @param longString The long string.
[ "Log", "long", "string", "using", "verbose", "tag" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Log.java#L116-L123
knowm/XChange
xchange-ripple/src/main/java/org/knowm/xchange/ripple/service/RippleMarketDataService.java
RippleMarketDataService.getOrderBook
@Override public OrderBook getOrderBook(final CurrencyPair currencyPair, final Object... args) throws IOException { if ((args != null && args.length > 0) && (args[0] instanceof RippleMarketDataParams)) { final RippleMarketDataParams params = (RippleMarketDataParams) args[0]; final RippleOrderBook orderBook = getRippleOrderBook(currencyPair, params); return RippleAdapters.adaptOrderBook(orderBook, params, currencyPair); } else { throw new ExchangeException("RippleMarketDataParams is missing"); } }
java
@Override public OrderBook getOrderBook(final CurrencyPair currencyPair, final Object... args) throws IOException { if ((args != null && args.length > 0) && (args[0] instanceof RippleMarketDataParams)) { final RippleMarketDataParams params = (RippleMarketDataParams) args[0]; final RippleOrderBook orderBook = getRippleOrderBook(currencyPair, params); return RippleAdapters.adaptOrderBook(orderBook, params, currencyPair); } else { throw new ExchangeException("RippleMarketDataParams is missing"); } }
[ "@", "Override", "public", "OrderBook", "getOrderBook", "(", "final", "CurrencyPair", "currencyPair", ",", "final", "Object", "...", "args", ")", "throws", "IOException", "{", "if", "(", "(", "args", "!=", "null", "&&", "args", ".", "length", ">", "0", ")"...
If the base currency is not XRP then the returned orders' additional data map contains a value for {@link RippleExchange.DATA_BASE_COUNTERPARTY}, similarly if the counter currency is not XRP then {@link RippleExchange.DATA_COUNTER_COUNTERPARTY} is populated. @param currencyPair the base/counter currency pair @param args a RippleMarketDataParams object needs to be supplied
[ "If", "the", "base", "currency", "is", "not", "XRP", "then", "the", "returned", "orders", "additional", "data", "map", "contains", "a", "value", "for", "{", "@link", "RippleExchange", ".", "DATA_BASE_COUNTERPARTY", "}", "similarly", "if", "the", "counter", "cu...
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-ripple/src/main/java/org/knowm/xchange/ripple/service/RippleMarketDataService.java#L29-L39
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java
Settings.getFloat
@CheckForNull public Float getFloat(String key) { String value = getString(key); if (StringUtils.isNotEmpty(value)) { try { return Float.valueOf(value); } catch (NumberFormatException e) { throw new IllegalStateException(String.format("The property '%s' is not a float value", key)); } } return null; }
java
@CheckForNull public Float getFloat(String key) { String value = getString(key); if (StringUtils.isNotEmpty(value)) { try { return Float.valueOf(value); } catch (NumberFormatException e) { throw new IllegalStateException(String.format("The property '%s' is not a float value", key)); } } return null; }
[ "@", "CheckForNull", "public", "Float", "getFloat", "(", "String", "key", ")", "{", "String", "value", "=", "getString", "(", "key", ")", ";", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "value", ")", ")", "{", "try", "{", "return", "Float", ".",...
Effective value as {@code Float}. @return the value as {@code Float}. If the property does not have value nor default value, then {@code null} is returned. @throws NumberFormatException if value is not empty and is not a parsable number
[ "Effective", "value", "as", "{" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java#L231-L242
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/AuthFilterConfig.java
AuthFilterConfig.getElementProperties
private Properties getElementProperties(Map<String, Object> configProps, String elementName, String... attrKeys) { Properties properties = new Properties(); for (String attrKey : attrKeys) { String value = (String) configProps.get(attrKey); if (value != null && value.length() > 0) { value = (String) getValue(value); properties.put(attrKey, value); } } if (properties.isEmpty() || properties.size() != attrKeys.length) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { //TODO: NLS warning msg Tr.debug(tc, "The authFilter element " + elementName + " specified in the server.xml file is missing one or more of these attributes " + printAttrKeys(attrKeys)); } return null; } else return properties; }
java
private Properties getElementProperties(Map<String, Object> configProps, String elementName, String... attrKeys) { Properties properties = new Properties(); for (String attrKey : attrKeys) { String value = (String) configProps.get(attrKey); if (value != null && value.length() > 0) { value = (String) getValue(value); properties.put(attrKey, value); } } if (properties.isEmpty() || properties.size() != attrKeys.length) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { //TODO: NLS warning msg Tr.debug(tc, "The authFilter element " + elementName + " specified in the server.xml file is missing one or more of these attributes " + printAttrKeys(attrKeys)); } return null; } else return properties; }
[ "private", "Properties", "getElementProperties", "(", "Map", "<", "String", ",", "Object", ">", "configProps", ",", "String", "elementName", ",", "String", "...", "attrKeys", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "for",...
Get properties from the given element and/or it's subElements. Ignore system generated props, add the user props to the given Properties object @param configProps props from the config @param elementName the element being processed
[ "Get", "properties", "from", "the", "given", "element", "and", "/", "or", "it", "s", "subElements", ".", "Ignore", "system", "generated", "props", "add", "the", "user", "props", "to", "the", "given", "Properties", "object" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/AuthFilterConfig.java#L133-L152
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolClient.java
TargetPoolClient.insertTargetPool
@BetaApi public final Operation insertTargetPool(String region, TargetPool targetPoolResource) { InsertTargetPoolHttpRequest request = InsertTargetPoolHttpRequest.newBuilder() .setRegion(region) .setTargetPoolResource(targetPoolResource) .build(); return insertTargetPool(request); }
java
@BetaApi public final Operation insertTargetPool(String region, TargetPool targetPoolResource) { InsertTargetPoolHttpRequest request = InsertTargetPoolHttpRequest.newBuilder() .setRegion(region) .setTargetPoolResource(targetPoolResource) .build(); return insertTargetPool(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertTargetPool", "(", "String", "region", ",", "TargetPool", "targetPoolResource", ")", "{", "InsertTargetPoolHttpRequest", "request", "=", "InsertTargetPoolHttpRequest", ".", "newBuilder", "(", ")", ".", "setRegion", ...
Creates a target pool in the specified project and region using the data included in the request. <p>Sample code: <pre><code> try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) { ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); TargetPool targetPoolResource = TargetPool.newBuilder().build(); Operation response = targetPoolClient.insertTargetPool(region.toString(), targetPoolResource); } </code></pre> @param region Name of the region scoping this request. @param targetPoolResource A TargetPool resource. This resource defines a pool of instances, an associated HttpHealthCheck resource, and the fallback target pool. (== resource_for beta.targetPools ==) (== resource_for v1.targetPools ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "target", "pool", "in", "the", "specified", "project", "and", "region", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetPoolClient.java#L890-L899
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/SelectListUtil.java
SelectListUtil.isOptionCodeMatch
private static boolean isOptionCodeMatch(final Object option, final Object data) { // If the option is an instance of Option, check if the data value is the "CODE" value on the option if (option instanceof Option) { String optionCode = ((Option) option).getCode(); String matchAsString = String.valueOf(data); boolean equal = Util.equals(optionCode, matchAsString); return equal; } return false; }
java
private static boolean isOptionCodeMatch(final Object option, final Object data) { // If the option is an instance of Option, check if the data value is the "CODE" value on the option if (option instanceof Option) { String optionCode = ((Option) option).getCode(); String matchAsString = String.valueOf(data); boolean equal = Util.equals(optionCode, matchAsString); return equal; } return false; }
[ "private", "static", "boolean", "isOptionCodeMatch", "(", "final", "Object", "option", ",", "final", "Object", "data", ")", "{", "// If the option is an instance of Option, check if the data value is the \"CODE\" value on the option", "if", "(", "option", "instanceof", "Option"...
If the option is an instance of {@link Option}, check if the data value matches the Code value of the option. @param option the option to test for a match @param data the test data value @return true if the option and code are a match
[ "If", "the", "option", "is", "an", "instance", "of", "{", "@link", "Option", "}", "check", "if", "the", "data", "value", "matches", "the", "Code", "value", "of", "the", "option", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/SelectListUtil.java#L191-L200
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_storage_GET
public ArrayList<OvhContainer> project_serviceName_storage_GET(String serviceName) throws IOException { String qPath = "/cloud/project/{serviceName}/storage"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
java
public ArrayList<OvhContainer> project_serviceName_storage_GET(String serviceName) throws IOException { String qPath = "/cloud/project/{serviceName}/storage"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
[ "public", "ArrayList", "<", "OvhContainer", ">", "project_serviceName_storage_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/storage\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath"...
Get storage containers REST: GET /cloud/project/{serviceName}/storage @param serviceName [required] Service name
[ "Get", "storage", "containers" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L552-L557
casmi/casmi
src/main/java/casmi/graphics/element/Element.java
Element.setPosition
public void setPosition(double x, double y, double z) { this.x = x; this.y = y; this.z = z; }
java
public void setPosition(double x, double y, double z) { this.x = x; this.y = y; this.z = z; }
[ "public", "void", "setPosition", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "this", ".", "x", "=", "x", ";", "this", ".", "y", "=", "y", ";", "this", ".", "z", "=", "z", ";", "}" ]
Sets the position of the Element in 3D. @param x x-coordinate @param y y-coordinate @param z z-coordinate
[ "Sets", "the", "position", "of", "the", "Element", "in", "3D", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Element.java#L436-L440
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpRequestUtils.java
HttpRequestUtils.getService
public static WebApplicationService getService(final List<ArgumentExtractor> argumentExtractors, final HttpServletRequest request) { return argumentExtractors .stream() .map(argumentExtractor -> argumentExtractor.extractService(request)) .filter(Objects::nonNull) .findFirst() .orElse(null); }
java
public static WebApplicationService getService(final List<ArgumentExtractor> argumentExtractors, final HttpServletRequest request) { return argumentExtractors .stream() .map(argumentExtractor -> argumentExtractor.extractService(request)) .filter(Objects::nonNull) .findFirst() .orElse(null); }
[ "public", "static", "WebApplicationService", "getService", "(", "final", "List", "<", "ArgumentExtractor", ">", "argumentExtractors", ",", "final", "HttpServletRequest", "request", ")", "{", "return", "argumentExtractors", ".", "stream", "(", ")", ".", "map", "(", ...
Gets the service from the request based on given extractors. @param argumentExtractors the argument extractors @param request the request @return the service, or null.
[ "Gets", "the", "service", "from", "the", "request", "based", "on", "given", "extractors", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/HttpRequestUtils.java#L129-L136
knowm/XChart
xchart/src/main/java/org/knowm/xchart/internal/chartpart/ToolTips.java
ToolTips.addData
public void addData(double xOffset, double yOffset, String label) { DataPoint dp = new DataPoint(xOffset, yOffset, label); dataPointList.add(dp); }
java
public void addData(double xOffset, double yOffset, String label) { DataPoint dp = new DataPoint(xOffset, yOffset, label); dataPointList.add(dp); }
[ "public", "void", "addData", "(", "double", "xOffset", ",", "double", "yOffset", ",", "String", "label", ")", "{", "DataPoint", "dp", "=", "new", "DataPoint", "(", "xOffset", ",", "yOffset", ",", "label", ")", ";", "dataPointList", ".", "add", "(", "dp",...
Adds a data with label with coordinates (xOffset, yOffset). This point will be highlighted with a circle centering (xOffset, yOffset)
[ "Adds", "a", "data", "with", "label", "with", "coordinates", "(", "xOffset", "yOffset", ")", ".", "This", "point", "will", "be", "highlighted", "with", "a", "circle", "centering", "(", "xOffset", "yOffset", ")" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/ToolTips.java#L132-L136
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
FieldUtils.writeDeclaredField
public static void writeDeclaredField(final Object target, final String fieldName, final Object value) throws IllegalAccessException { writeDeclaredField(target, fieldName, value, false); }
java
public static void writeDeclaredField(final Object target, final String fieldName, final Object value) throws IllegalAccessException { writeDeclaredField(target, fieldName, value, false); }
[ "public", "static", "void", "writeDeclaredField", "(", "final", "Object", "target", ",", "final", "String", "fieldName", ",", "final", "Object", "value", ")", "throws", "IllegalAccessException", "{", "writeDeclaredField", "(", "target", ",", "fieldName", ",", "val...
Writes a {@code public} {@link Field}. Only the specified class will be considered. @param target the object to reflect, must not be {@code null} @param fieldName the field name to obtain @param value to set @throws IllegalArgumentException if {@code target} is {@code null}, {@code fieldName} is blank or empty or could not be found, or {@code value} is not assignable @throws IllegalAccessException if the field is not made accessible
[ "Writes", "a", "{", "@code", "public", "}", "{", "@link", "Field", "}", ".", "Only", "the", "specified", "class", "will", "be", "considered", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java#L809-L811
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java
WebApp.invokeAnnotTypeOnObjectAndHierarchy
public Throwable invokeAnnotTypeOnObjectAndHierarchy(Object obj, ANNOT_TYPE type) { String methodName = "invokeAnnotTypeOnObjectAndHierarchy"; if (obj == null) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "Unable to invoke [ {0} ] methods: Null object", type); } return null; } if (type == ANNOT_TYPE.POST_CONSTRUCT) { //need to validate the preDestroy methods as well Throwable t = validateAndRun(false, obj, ANNOT_TYPE.PRE_DESTROY); if (t!=null) { return t; //only return here if a throwable was thrown } } //validate and run the methods return validateAndRun(true, obj, type); }
java
public Throwable invokeAnnotTypeOnObjectAndHierarchy(Object obj, ANNOT_TYPE type) { String methodName = "invokeAnnotTypeOnObjectAndHierarchy"; if (obj == null) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) { logger.logp(Level.FINE, CLASS_NAME, methodName, "Unable to invoke [ {0} ] methods: Null object", type); } return null; } if (type == ANNOT_TYPE.POST_CONSTRUCT) { //need to validate the preDestroy methods as well Throwable t = validateAndRun(false, obj, ANNOT_TYPE.PRE_DESTROY); if (t!=null) { return t; //only return here if a throwable was thrown } } //validate and run the methods return validateAndRun(true, obj, type); }
[ "public", "Throwable", "invokeAnnotTypeOnObjectAndHierarchy", "(", "Object", "obj", ",", "ANNOT_TYPE", "type", ")", "{", "String", "methodName", "=", "\"invokeAnnotTypeOnObjectAndHierarchy\"", ";", "if", "(", "obj", "==", "null", ")", "{", "if", "(", "com", ".", ...
<p>Invoke post-construct and pre-destroy methods on the target object.</p> <p>Method are selected on the super class chain of the target object, including the class of the target object. Invocations are performed starting with the method from the top-most class. All invocations are performed on the target object.</p> <p>This implementation does not handle cases where a method has been overridden between classes, and does not handle cases where a method has a method protection which is not valid to allow invocation.</p> <p>The selected methods must have zero parameters and a void return type. Methods with one or more parameters are ignored. Methods with zero parameters and with a non-null return type cause an exception to be returned.</p> <p>Failure to invoke a method, either because a method has a non-null return type, or because an exception thrown by the method, cause invocation to halt, with a return value of an <code>InjectionException</code>.</p> <p>See the extensive comments on {@link javax.annotation.PostConstruct} and {@link javax.annotation.PreDestroy} for an initial discussion of the rules for post-construct and pre-destroy methods.</p> @param obj The object for which to invoke post-construct or pre-destroy methods. @param type The type of methods (post-construct or pre-destroy) which are to be invoked. @return The result of invoking the methods. Null if all invocations are successful. A throwable in case of an error during the invocation.
[ "<p", ">", "Invoke", "post", "-", "construct", "and", "pre", "-", "destroy", "methods", "on", "the", "target", "object", ".", "<", "/", "p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java#L812-L832
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.readUtf8Lines
public static <T extends Collection<String>> T readUtf8Lines(File file, T collection) throws IORuntimeException { return readLines(file, CharsetUtil.CHARSET_UTF_8, collection); }
java
public static <T extends Collection<String>> T readUtf8Lines(File file, T collection) throws IORuntimeException { return readLines(file, CharsetUtil.CHARSET_UTF_8, collection); }
[ "public", "static", "<", "T", "extends", "Collection", "<", "String", ">", ">", "T", "readUtf8Lines", "(", "File", "file", ",", "T", "collection", ")", "throws", "IORuntimeException", "{", "return", "readLines", "(", "file", ",", "CharsetUtil", ".", "CHARSET...
从文件中读取每一行数据,数据编码为UTF-8 @param <T> 集合类型 @param file 文件路径 @param collection 集合 @return 文件中的每行内容的集合 @throws IORuntimeException IO异常 @since 3.1.1
[ "从文件中读取每一行数据,数据编码为UTF", "-", "8" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2206-L2208
BioPAX/Paxtools
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java
L3ToSBGNPDConverter.getGlyphToLink
private Glyph getGlyphToLink(Entity e, String linkID) { if (ubiqueDet == null || !ubiqueDet.isUbique(e)) { return glyphMap.get(convertID(e.getUri())); } else { // Create a new glyph for each use of ubique Glyph g = createGlyphBasics(e, false); g.setId(convertID(e.getUri()) + "_" + ModelUtils.md5hex(linkID)); Set<String> uris = new HashSet<String>(); uris.add(e.getUri()); sbgn2BPMap.put(g.getId(), uris); if(e instanceof PhysicalEntity && ((PhysicalEntity)e).getCellularLocation() != null) { assignLocation((PhysicalEntity) e, g); } ubiqueSet.add(g); return g; } }
java
private Glyph getGlyphToLink(Entity e, String linkID) { if (ubiqueDet == null || !ubiqueDet.isUbique(e)) { return glyphMap.get(convertID(e.getUri())); } else { // Create a new glyph for each use of ubique Glyph g = createGlyphBasics(e, false); g.setId(convertID(e.getUri()) + "_" + ModelUtils.md5hex(linkID)); Set<String> uris = new HashSet<String>(); uris.add(e.getUri()); sbgn2BPMap.put(g.getId(), uris); if(e instanceof PhysicalEntity && ((PhysicalEntity)e).getCellularLocation() != null) { assignLocation((PhysicalEntity) e, g); } ubiqueSet.add(g); return g; } }
[ "private", "Glyph", "getGlyphToLink", "(", "Entity", "e", ",", "String", "linkID", ")", "{", "if", "(", "ubiqueDet", "==", "null", "||", "!", "ubiqueDet", ".", "isUbique", "(", "e", ")", ")", "{", "return", "glyphMap", ".", "get", "(", "convertID", "("...
/* Gets the representing glyph of the PhysicalEntity or Gene. @param e PhysicalEntity or Gene to get its glyph @param linkID Edge id, used if the Entity is ubique @return Representing glyph
[ "/", "*", "Gets", "the", "representing", "glyph", "of", "the", "PhysicalEntity", "or", "Gene", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L510-L529
ykrasik/jaci
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java
StringUtils.join
public static <T> String join(List<T> list, String delimiter) { if (list.isEmpty()) { return ""; } final StringBuilder sb = new StringBuilder(); for (T element : list) { sb.append(element); sb.append(delimiter); } sb.delete(sb.length() - delimiter.length(), sb.length()); return sb.toString(); }
java
public static <T> String join(List<T> list, String delimiter) { if (list.isEmpty()) { return ""; } final StringBuilder sb = new StringBuilder(); for (T element : list) { sb.append(element); sb.append(delimiter); } sb.delete(sb.length() - delimiter.length(), sb.length()); return sb.toString(); }
[ "public", "static", "<", "T", ">", "String", "join", "(", "List", "<", "T", ">", "list", ",", "String", "delimiter", ")", "{", "if", "(", "list", ".", "isEmpty", "(", ")", ")", "{", "return", "\"\"", ";", "}", "final", "StringBuilder", "sb", "=", ...
Create a string out of the list's elements using the given delimiter. @param list List to create a string from. @param delimiter Delimiter to use between elements. @param <T> Type of elements in the list. @return A string created from the given list's elements, delimited by the given delimiter.
[ "Create", "a", "string", "out", "of", "the", "list", "s", "elements", "using", "the", "given", "delimiter", "." ]
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java#L112-L124
alkacon/opencms-core
src/org/opencms/ade/containerpage/CmsContainerpageService.java
CmsContainerpageService.isEditingModelGroups
public static boolean isEditingModelGroups(CmsObject cms, CmsResource containerPage) { return (OpenCms.getResourceManager().getResourceType(containerPage).getTypeName().equals( CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME) && OpenCms.getRoleManager().hasRole(cms, CmsRole.DEVELOPER)); }
java
public static boolean isEditingModelGroups(CmsObject cms, CmsResource containerPage) { return (OpenCms.getResourceManager().getResourceType(containerPage).getTypeName().equals( CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME) && OpenCms.getRoleManager().hasRole(cms, CmsRole.DEVELOPER)); }
[ "public", "static", "boolean", "isEditingModelGroups", "(", "CmsObject", "cms", ",", "CmsResource", "containerPage", ")", "{", "return", "(", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "containerPage", ")", ".", "getTypeName", "("...
Checks whether the current page is a model group page.<p> @param cms the CMS context @param containerPage the current page @return <code>true</code> if the current page is a model group page
[ "Checks", "whether", "the", "current", "page", "is", "a", "model", "group", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsContainerpageService.java#L410-L415
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendPong
public static <T> void sendPong(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) { sendInternal(mergeBuffers(data), WebSocketFrameType.PONG, wsChannel, callback, context, -1); }
java
public static <T> void sendPong(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context) { sendInternal(mergeBuffers(data), WebSocketFrameType.PONG, wsChannel, callback, context, -1); }
[ "public", "static", "<", "T", ">", "void", "sendPong", "(", "final", "ByteBuffer", "[", "]", "data", ",", "final", "WebSocketChannel", "wsChannel", ",", "final", "WebSocketCallback", "<", "T", ">", "callback", ",", "T", "context", ")", "{", "sendInternal", ...
Sends a complete pong message, invoking the callback when complete @param data The data to send @param wsChannel The web socket channel @param callback The callback to invoke on completion @param context The context object that will be passed to the callback on completion
[ "Sends", "a", "complete", "pong", "message", "invoking", "the", "callback", "when", "complete" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L470-L472