repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
spring-projects/spring-hateoas
src/main/java/org/springframework/hateoas/client/JsonPathLinkDiscoverer.java
JsonPathLinkDiscoverer.createLinksFrom
private Links createLinksFrom(Object parseResult, LinkRelation rel) { if (JSONArray.class.isInstance(parseResult)) { JSONArray jsonArray = (JSONArray) parseResult; return jsonArray.stream() // .flatMap(it -> JSONArray.class.isInstance(it) ? ((JSONArray) it).stream() : Stream.of(it)) // .map(it -> extractLink(it, rel)) // .collect(Collectors.collectingAndThen(Collectors.toList(), Links::of)); } return Links.of(Map.class.isInstance(parseResult) // ? extractLink(parseResult, rel) // : new Link(parseResult.toString(), rel)); }
java
private Links createLinksFrom(Object parseResult, LinkRelation rel) { if (JSONArray.class.isInstance(parseResult)) { JSONArray jsonArray = (JSONArray) parseResult; return jsonArray.stream() // .flatMap(it -> JSONArray.class.isInstance(it) ? ((JSONArray) it).stream() : Stream.of(it)) // .map(it -> extractLink(it, rel)) // .collect(Collectors.collectingAndThen(Collectors.toList(), Links::of)); } return Links.of(Map.class.isInstance(parseResult) // ? extractLink(parseResult, rel) // : new Link(parseResult.toString(), rel)); }
[ "private", "Links", "createLinksFrom", "(", "Object", "parseResult", ",", "LinkRelation", "rel", ")", "{", "if", "(", "JSONArray", ".", "class", ".", "isInstance", "(", "parseResult", ")", ")", "{", "JSONArray", "jsonArray", "=", "(", "JSONArray", ")", "pars...
Creates {@link Link} instances from the given parse result. @param parseResult the result originating from parsing the source content using the JSON path expression. @param rel the relation type that was parsed for. @return
[ "Creates", "{", "@link", "Link", "}", "instances", "from", "the", "given", "parse", "result", "." ]
train
https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/client/JsonPathLinkDiscoverer.java#L163-L178
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.deleteFromComputeNodeAsync
public Observable<Void> deleteFromComputeNodeAsync(String poolId, String nodeId, String filePath) { return deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).map(new Func1<ServiceResponseWithHeaders<Void, FileDeleteFromComputeNodeHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, FileDeleteFromComputeNodeHeaders> response) { return response.body(); } }); }
java
public Observable<Void> deleteFromComputeNodeAsync(String poolId, String nodeId, String filePath) { return deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).map(new Func1<ServiceResponseWithHeaders<Void, FileDeleteFromComputeNodeHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, FileDeleteFromComputeNodeHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deleteFromComputeNodeAsync", "(", "String", "poolId", ",", "String", "nodeId", ",", "String", "filePath", ")", "{", "return", "deleteFromComputeNodeWithServiceResponseAsync", "(", "poolId", ",", "nodeId", ",", "filePath", "...
Deletes the specified file from the compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node from which you want to delete the file. @param filePath The path to the file or directory that you want to delete. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Deletes", "the", "specified", "file", "from", "the", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L902-L909
dropwizard/dropwizard
dropwizard-core/src/main/java/io/dropwizard/cli/Command.java
Command.onError
public void onError(Cli cli, Namespace namespace, Throwable e) { e.printStackTrace(cli.getStdErr()); }
java
public void onError(Cli cli, Namespace namespace, Throwable e) { e.printStackTrace(cli.getStdErr()); }
[ "public", "void", "onError", "(", "Cli", "cli", ",", "Namespace", "namespace", ",", "Throwable", "e", ")", "{", "e", ".", "printStackTrace", "(", "cli", ".", "getStdErr", "(", ")", ")", ";", "}" ]
Method is called if there is an issue parsing configuration, setting up the environment, or running the command itself. The default is printing the stacktrace to facilitate debugging, but can be customized per command. @param cli contains the streams for stdout and stderr @param namespace the parsed arguments from the commandline @param e The exception that was thrown when setting up or running the command
[ "Method", "is", "called", "if", "there", "is", "an", "issue", "parsing", "configuration", "setting", "up", "the", "environment", "or", "running", "the", "command", "itself", ".", "The", "default", "is", "printing", "the", "stacktrace", "to", "facilitate", "deb...
train
https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-core/src/main/java/io/dropwizard/cli/Command.java#L68-L70
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toQuery
public static Query toQuery(Object o, boolean duplicate, Query defaultValue) { try { return toQuery(o, duplicate); } catch (PageException e) { return defaultValue; } }
java
public static Query toQuery(Object o, boolean duplicate, Query defaultValue) { try { return toQuery(o, duplicate); } catch (PageException e) { return defaultValue; } }
[ "public", "static", "Query", "toQuery", "(", "Object", "o", ",", "boolean", "duplicate", ",", "Query", "defaultValue", ")", "{", "try", "{", "return", "toQuery", "(", "o", ",", "duplicate", ")", ";", "}", "catch", "(", "PageException", "e", ")", "{", "...
cast a Object to a Query Object @param o Object to cast @param duplicate duplicate the object or not @param defaultValue @return casted Query Object
[ "cast", "a", "Object", "to", "a", "Query", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L3037-L3044
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.minRows
public static DMatrixRMaj minRows(DMatrixRMaj input , DMatrixRMaj output ) { if( output == null ) { output = new DMatrixRMaj(input.numRows,1); } else { output.reshape(input.numRows,1); } for( int row = 0; row < input.numRows; row++ ) { double min = Double.MAX_VALUE; int end = (row+1)*input.numCols; for( int index = row*input.numCols; index < end; index++ ) { double v = input.data[index]; if( v < min ) min = v; } output.set(row,min); } return output; }
java
public static DMatrixRMaj minRows(DMatrixRMaj input , DMatrixRMaj output ) { if( output == null ) { output = new DMatrixRMaj(input.numRows,1); } else { output.reshape(input.numRows,1); } for( int row = 0; row < input.numRows; row++ ) { double min = Double.MAX_VALUE; int end = (row+1)*input.numCols; for( int index = row*input.numCols; index < end; index++ ) { double v = input.data[index]; if( v < min ) min = v; } output.set(row,min); } return output; }
[ "public", "static", "DMatrixRMaj", "minRows", "(", "DMatrixRMaj", "input", ",", "DMatrixRMaj", "output", ")", "{", "if", "(", "output", "==", "null", ")", "{", "output", "=", "new", "DMatrixRMaj", "(", "input", ".", "numRows", ",", "1", ")", ";", "}", ...
<p> Finds the element with the minimum value along each row in the input matrix and returns the results in a vector:<br> <br> b<sub>j</sub> = min(i=1:n ; a<sub>ji</sub>) </p> @param input Input matrix @param output Optional storage for output. Reshaped into a column. Modified. @return Vector containing the sum of each row in the input.
[ "<p", ">", "Finds", "the", "element", "with", "the", "minimum", "value", "along", "each", "row", "in", "the", "input", "matrix", "and", "returns", "the", "results", "in", "a", "vector", ":", "<br", ">", "<br", ">", "b<sub", ">", "j<", "/", "sub", ">"...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L1893-L1913
jhy/jsoup
src/main/java/org/jsoup/nodes/Node.java
Node.setBaseUri
public void setBaseUri(final String baseUri) { Validate.notNull(baseUri); traverse(new NodeVisitor() { public void head(Node node, int depth) { node.doSetBaseUri(baseUri); } public void tail(Node node, int depth) { } }); }
java
public void setBaseUri(final String baseUri) { Validate.notNull(baseUri); traverse(new NodeVisitor() { public void head(Node node, int depth) { node.doSetBaseUri(baseUri); } public void tail(Node node, int depth) { } }); }
[ "public", "void", "setBaseUri", "(", "final", "String", "baseUri", ")", "{", "Validate", ".", "notNull", "(", "baseUri", ")", ";", "traverse", "(", "new", "NodeVisitor", "(", ")", "{", "public", "void", "head", "(", "Node", "node", ",", "int", "depth", ...
Update the base URI of this node and all of its descendants. @param baseUri base URI to set
[ "Update", "the", "base", "URI", "of", "this", "node", "and", "all", "of", "its", "descendants", "." ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Node.java#L146-L157
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
SearchIndex.createExecutableQuery
public ExecutableQuery createExecutableQuery(SessionImpl session, SessionDataManager itemMgr, String statement, String language) throws InvalidQueryException { QueryImpl query = new QueryImpl(session, itemMgr, this, getContext().getPropertyTypeRegistry(), statement, language, getQueryNodeFactory()); query.setRespectDocumentOrder(documentOrder); return query; }
java
public ExecutableQuery createExecutableQuery(SessionImpl session, SessionDataManager itemMgr, String statement, String language) throws InvalidQueryException { QueryImpl query = new QueryImpl(session, itemMgr, this, getContext().getPropertyTypeRegistry(), statement, language, getQueryNodeFactory()); query.setRespectDocumentOrder(documentOrder); return query; }
[ "public", "ExecutableQuery", "createExecutableQuery", "(", "SessionImpl", "session", ",", "SessionDataManager", "itemMgr", ",", "String", "statement", ",", "String", "language", ")", "throws", "InvalidQueryException", "{", "QueryImpl", "query", "=", "new", "QueryImpl", ...
Creates a new query by specifying the query statement itself and the language in which the query is stated. If the query statement is syntactically invalid, given the language specified, an InvalidQueryException is thrown. <code>language</code> must specify a query language string from among those returned by QueryManager.getSupportedQueryLanguages(); if it is not then an <code>InvalidQueryException</code> is thrown. @param session the session of the current user creating the query object. @param itemMgr the item manager of the current user. @param statement the query statement. @param language the syntax of the query statement. @throws InvalidQueryException if statement is invalid or language is unsupported. @return A <code>Query</code> object.
[ "Creates", "a", "new", "query", "by", "specifying", "the", "query", "statement", "itself", "and", "the", "language", "in", "which", "the", "query", "is", "stated", ".", "If", "the", "query", "statement", "is", "syntactically", "invalid", "given", "the", "lan...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L1424-L1432
msgpack/msgpack-java
msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java
MessageBuffer.copyTo
public void copyTo(int index, MessageBuffer dst, int offset, int length) { unsafe.copyMemory(base, address + index, dst.base, dst.address + offset, length); }
java
public void copyTo(int index, MessageBuffer dst, int offset, int length) { unsafe.copyMemory(base, address + index, dst.base, dst.address + offset, length); }
[ "public", "void", "copyTo", "(", "int", "index", ",", "MessageBuffer", "dst", ",", "int", "offset", ",", "int", "length", ")", "{", "unsafe", ".", "copyMemory", "(", "base", ",", "address", "+", "index", ",", "dst", ".", "base", ",", "dst", ".", "add...
Copy this buffer contents to another MessageBuffer @param index @param dst @param offset @param length
[ "Copy", "this", "buffer", "contents", "to", "another", "MessageBuffer" ]
train
https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L626-L629
Drivemode/TypefaceHelper
TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java
TypefaceHelper.setTypeface
public void setTypeface(Activity activity, @StringRes int strResId, int style) { setTypeface(activity, mApplication.getString(strResId), style); }
java
public void setTypeface(Activity activity, @StringRes int strResId, int style) { setTypeface(activity, mApplication.getString(strResId), style); }
[ "public", "void", "setTypeface", "(", "Activity", "activity", ",", "@", "StringRes", "int", "strResId", ",", "int", "style", ")", "{", "setTypeface", "(", "activity", ",", "mApplication", ".", "getString", "(", "strResId", ")", ",", "style", ")", ";", "}" ...
Set the typeface to the all text views belong to the activity. Note that we use decor view of the activity so that the typeface will also be applied to action bar. @param activity the activity. @param strResId string resource containing typeface name. @param style the typeface style.
[ "Set", "the", "typeface", "to", "the", "all", "text", "views", "belong", "to", "the", "activity", ".", "Note", "that", "we", "use", "decor", "view", "of", "the", "activity", "so", "that", "the", "typeface", "will", "also", "be", "applied", "to", "action"...
train
https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L347-L349
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.withMonths
public Period withMonths(int months) { int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.MONTH_INDEX, values, months); return new Period(values, getPeriodType()); }
java
public Period withMonths(int months) { int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.MONTH_INDEX, values, months); return new Period(values, getPeriodType()); }
[ "public", "Period", "withMonths", "(", "int", "months", ")", "{", "int", "[", "]", "values", "=", "getValues", "(", ")", ";", "// cloned", "getPeriodType", "(", ")", ".", "setIndexedField", "(", "this", ",", "PeriodType", ".", "MONTH_INDEX", ",", "values",...
Returns a new period with the specified number of months. <p> This period instance is immutable and unaffected by this method call. @param months the amount of months to add, may be negative @return the new period with the increased months @throws UnsupportedOperationException if the field is not supported
[ "Returns", "a", "new", "period", "with", "the", "specified", "number", "of", "months", ".", "<p", ">", "This", "period", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L929-L933
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/BaseNeo4jDialect.java
BaseNeo4jDialect.getEntityKey
protected EntityKey getEntityKey(Tuple tuple, AssociatedEntityKeyMetadata associatedEntityKeyMetadata) { Object[] columnValues = new Object[ associatedEntityKeyMetadata.getAssociationKeyColumns().length]; int i = 0; for ( String associationKeyColumn : associatedEntityKeyMetadata.getAssociationKeyColumns() ) { columnValues[i] = tuple.get( associationKeyColumn ); i++; } return new EntityKey( associatedEntityKeyMetadata.getEntityKeyMetadata(), columnValues ); }
java
protected EntityKey getEntityKey(Tuple tuple, AssociatedEntityKeyMetadata associatedEntityKeyMetadata) { Object[] columnValues = new Object[ associatedEntityKeyMetadata.getAssociationKeyColumns().length]; int i = 0; for ( String associationKeyColumn : associatedEntityKeyMetadata.getAssociationKeyColumns() ) { columnValues[i] = tuple.get( associationKeyColumn ); i++; } return new EntityKey( associatedEntityKeyMetadata.getEntityKeyMetadata(), columnValues ); }
[ "protected", "EntityKey", "getEntityKey", "(", "Tuple", "tuple", ",", "AssociatedEntityKeyMetadata", "associatedEntityKeyMetadata", ")", "{", "Object", "[", "]", "columnValues", "=", "new", "Object", "[", "associatedEntityKeyMetadata", ".", "getAssociationKeyColumns", "("...
Returns the key of the entity targeted by the represented association, retrieved from the given tuple. @param tuple the tuple from which to retrieve the referenced entity key @return the key of the entity targeted by the represented association
[ "Returns", "the", "key", "of", "the", "entity", "targeted", "by", "the", "represented", "association", "retrieved", "from", "the", "given", "tuple", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/BaseNeo4jDialect.java#L191-L201
mcxiaoke/Android-Next
recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java
HeaderFooterRecyclerAdapter.notifyContentItemRangeRemoved
public final void notifyContentItemRangeRemoved(int positionStart, int itemCount) { if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > contentItemCount) { throw new IndexOutOfBoundsException("The given range [" + positionStart + " - " + (positionStart + itemCount - 1) + "] is not within the position bounds for content items [0 - " + (contentItemCount - 1) + "]."); } notifyItemRangeRemoved(positionStart + headerItemCount, itemCount); }
java
public final void notifyContentItemRangeRemoved(int positionStart, int itemCount) { if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > contentItemCount) { throw new IndexOutOfBoundsException("The given range [" + positionStart + " - " + (positionStart + itemCount - 1) + "] is not within the position bounds for content items [0 - " + (contentItemCount - 1) + "]."); } notifyItemRangeRemoved(positionStart + headerItemCount, itemCount); }
[ "public", "final", "void", "notifyContentItemRangeRemoved", "(", "int", "positionStart", ",", "int", "itemCount", ")", "{", "if", "(", "positionStart", "<", "0", "||", "itemCount", "<", "0", "||", "positionStart", "+", "itemCount", ">", "contentItemCount", ")", ...
Notifies that multiple content items are removed. @param positionStart the position. @param itemCount the item count.
[ "Notifies", "that", "multiple", "content", "items", "are", "removed", "." ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L297-L304
apptik/jus
android/jus-android/src/main/java/io/apptik/comm/jus/ui/ImageLoader.java
ImageLoader.get
public ImageContainer get(String requestUrl, final ImageListener listener, final Object tag) { return get(requestUrl, listener, 0, 0, tag); }
java
public ImageContainer get(String requestUrl, final ImageListener listener, final Object tag) { return get(requestUrl, listener, 0, 0, tag); }
[ "public", "ImageContainer", "get", "(", "String", "requestUrl", ",", "final", "ImageListener", "listener", ",", "final", "Object", "tag", ")", "{", "return", "get", "(", "requestUrl", ",", "listener", ",", "0", ",", "0", ",", "tag", ")", ";", "}" ]
Returns an ImageContainer for the requested URL. The ImageContainer will contain either the specified default bitmap or the loaded bitmap. If the default was returned, the {@link ImageLoader} will be invoked when the request is fulfilled. @param requestUrl The URL of the image to be loaded.
[ "Returns", "an", "ImageContainer", "for", "the", "requested", "URL", "." ]
train
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/ui/ImageLoader.java#L238-L240
camunda/camunda-bpm-platform-osgi
camunda-bpm-osgi/src/main/java/org/camunda/bpm/extension/osgi/el/OSGiELResolver.java
OSGiELResolver.checkRegisteredOsgiServices
private <T> T checkRegisteredOsgiServices(Class<T> serviceClazz, String key) throws InvalidSyntaxException { Collection<ServiceReference<T>> references = getBundleContext().getServiceReferences(serviceClazz, null); if (references == null || references.isEmpty()) { return null; } Collection<T> matches = checkIfClassNamesMatchKey(references, key); if (matches.size() == 1) { return matches.iterator().next(); } else if (matches.size() > 1) { throw new RuntimeException("Too many " + serviceClazz + " registered with name: " + key); } // zero matches return null; }
java
private <T> T checkRegisteredOsgiServices(Class<T> serviceClazz, String key) throws InvalidSyntaxException { Collection<ServiceReference<T>> references = getBundleContext().getServiceReferences(serviceClazz, null); if (references == null || references.isEmpty()) { return null; } Collection<T> matches = checkIfClassNamesMatchKey(references, key); if (matches.size() == 1) { return matches.iterator().next(); } else if (matches.size() > 1) { throw new RuntimeException("Too many " + serviceClazz + " registered with name: " + key); } // zero matches return null; }
[ "private", "<", "T", ">", "T", "checkRegisteredOsgiServices", "(", "Class", "<", "T", ">", "serviceClazz", ",", "String", "key", ")", "throws", "InvalidSyntaxException", "{", "Collection", "<", "ServiceReference", "<", "T", ">>", "references", "=", "getBundleCon...
Checks the OSGi ServiceRegistry if a service matching the class and key are present. The class name has to match the key where the first letter has to be lower case. <p> For example:<br/> <code> public class MyServiceTask extends JavaDelegate</code> <br/> matches {@link JavaDelegate} with key "myServiceTask". @param serviceClazz @param key the name of the class @return null if no service could be found or the service object @throws RuntimeException if more than one service is found
[ "Checks", "the", "OSGi", "ServiceRegistry", "if", "a", "service", "matching", "the", "class", "and", "key", "are", "present", ".", "The", "class", "name", "has", "to", "match", "the", "key", "where", "the", "first", "letter", "has", "to", "be", "lower", ...
train
https://github.com/camunda/camunda-bpm-platform-osgi/blob/b91c6a68895947b320a7a5edf0db7158e945c4bb/camunda-bpm-osgi/src/main/java/org/camunda/bpm/extension/osgi/el/OSGiELResolver.java#L103-L116
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/DTMException.java
DTMException.initCause
public synchronized Throwable initCause(Throwable cause) { if ((this.containedException == null) && (cause != null)) { throw new IllegalStateException(XMLMessages.createXMLMessage(XMLErrorResources.ER_CANNOT_OVERWRITE_CAUSE, null)); //"Can't overwrite cause"); } if (cause == this) { throw new IllegalArgumentException( XMLMessages.createXMLMessage(XMLErrorResources.ER_SELF_CAUSATION_NOT_PERMITTED, null)); //"Self-causation not permitted"); } this.containedException = cause; return this; }
java
public synchronized Throwable initCause(Throwable cause) { if ((this.containedException == null) && (cause != null)) { throw new IllegalStateException(XMLMessages.createXMLMessage(XMLErrorResources.ER_CANNOT_OVERWRITE_CAUSE, null)); //"Can't overwrite cause"); } if (cause == this) { throw new IllegalArgumentException( XMLMessages.createXMLMessage(XMLErrorResources.ER_SELF_CAUSATION_NOT_PERMITTED, null)); //"Self-causation not permitted"); } this.containedException = cause; return this; }
[ "public", "synchronized", "Throwable", "initCause", "(", "Throwable", "cause", ")", "{", "if", "(", "(", "this", ".", "containedException", "==", "null", ")", "&&", "(", "cause", "!=", "null", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "X...
Initializes the <i>cause</i> of this throwable to the specified value. (The cause is the throwable that caused this throwable to get thrown.) <p>This method can be called at most once. It is generally called from within the constructor, or immediately after creating the throwable. If this throwable was created with {@link #DTMException(Throwable)} or {@link #DTMException(String,Throwable)}, this method cannot be called even once. @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). (A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or unknown.) @return a reference to this <code>Throwable</code> instance. @throws IllegalArgumentException if <code>cause</code> is this throwable. (A throwable cannot be its own cause.) @throws IllegalStateException if this throwable was created with {@link #DTMException(Throwable)} or {@link #DTMException(String,Throwable)}, or this method has already been called on this throwable.
[ "Initializes", "the", "<i", ">", "cause<", "/", "i", ">", "of", "this", "throwable", "to", "the", "specified", "value", ".", "(", "The", "cause", "is", "the", "throwable", "that", "caused", "this", "throwable", "to", "get", "thrown", ".", ")" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/DTMException.java#L114-L128
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java
AnalyzeSpark.sampleInvalidFromColumnSequence
public static List<Writable> sampleInvalidFromColumnSequence(int numToSample, String columnName, Schema schema, JavaRDD<List<List<Writable>>> data) { JavaRDD<List<Writable>> flattened = data.flatMap(new SequenceFlatMapFunction()); return sampleInvalidFromColumn(numToSample, columnName, schema, flattened); }
java
public static List<Writable> sampleInvalidFromColumnSequence(int numToSample, String columnName, Schema schema, JavaRDD<List<List<Writable>>> data) { JavaRDD<List<Writable>> flattened = data.flatMap(new SequenceFlatMapFunction()); return sampleInvalidFromColumn(numToSample, columnName, schema, flattened); }
[ "public", "static", "List", "<", "Writable", ">", "sampleInvalidFromColumnSequence", "(", "int", "numToSample", ",", "String", "columnName", ",", "Schema", "schema", ",", "JavaRDD", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "data", ")", "{", ...
Randomly sample a set of invalid values from a specified column, for a sequence data set. Values are considered invalid according to the Schema / ColumnMetaData @param numToSample Maximum number of invalid values to sample @param columnName Same of the column from which to sample invalid values @param schema Data schema @param data Data @return List of invalid examples
[ "Randomly", "sample", "a", "set", "of", "invalid", "values", "from", "a", "specified", "column", "for", "a", "sequence", "data", "set", ".", "Values", "are", "considered", "invalid", "according", "to", "the", "Schema", "/", "ColumnMetaData" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/AnalyzeSpark.java#L351-L355
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/NormalizableDistance.java
NormalizableDistance.inRanges
public boolean inRanges(Instance instance, double[][] ranges) { boolean isIn = true; // updateRangesFirst must have been called on ranges for (int j = 0; isIn && (j < ranges.length); j++) { if (!instance.isMissing(j)) { double value = instance.value(j); isIn = value <= ranges[j][R_MAX]; if (isIn) isIn = value >= ranges[j][R_MIN]; } } return isIn; }
java
public boolean inRanges(Instance instance, double[][] ranges) { boolean isIn = true; // updateRangesFirst must have been called on ranges for (int j = 0; isIn && (j < ranges.length); j++) { if (!instance.isMissing(j)) { double value = instance.value(j); isIn = value <= ranges[j][R_MAX]; if (isIn) isIn = value >= ranges[j][R_MIN]; } } return isIn; }
[ "public", "boolean", "inRanges", "(", "Instance", "instance", ",", "double", "[", "]", "[", "]", "ranges", ")", "{", "boolean", "isIn", "=", "true", ";", "// updateRangesFirst must have been called on ranges", "for", "(", "int", "j", "=", "0", ";", "isIn", "...
Test if an instance is within the given ranges. @param instance the instance @param ranges the ranges the instance is tested to be in @return true if instance is within the ranges
[ "Test", "if", "an", "instance", "is", "within", "the", "given", "ranges", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/NormalizableDistance.java#L665-L678
Alluxio/alluxio
core/base/src/main/java/alluxio/collections/IndexedSet.java
IndexedSet.getFirstByField
public <V> T getFirstByField(IndexDefinition<T, V> indexDefinition, V value) { FieldIndex<T, V> index = (FieldIndex<T, V>) mIndices.get(indexDefinition); if (index == null) { throw new IllegalStateException("the given index isn't defined for this IndexedSet"); } return index.getFirst(value); }
java
public <V> T getFirstByField(IndexDefinition<T, V> indexDefinition, V value) { FieldIndex<T, V> index = (FieldIndex<T, V>) mIndices.get(indexDefinition); if (index == null) { throw new IllegalStateException("the given index isn't defined for this IndexedSet"); } return index.getFirst(value); }
[ "public", "<", "V", ">", "T", "getFirstByField", "(", "IndexDefinition", "<", "T", ",", "V", ">", "indexDefinition", ",", "V", "value", ")", "{", "FieldIndex", "<", "T", ",", "V", ">", "index", "=", "(", "FieldIndex", "<", "T", ",", "V", ">", ")", ...
Gets the object from the set of objects with the specified field value. @param indexDefinition the field index definition @param value the field value @param <V> the field type @return the object or null if there is no such object
[ "Gets", "the", "object", "from", "the", "set", "of", "objects", "with", "the", "specified", "field", "value", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/collections/IndexedSet.java#L280-L286
playn/playn
html/src/playn/super/java/nio/ByteBuffer.java
ByteBuffer.put
public ByteBuffer put (byte[] src, int off, int len) { int length = src.length; if (off < 0 || len < 0 || off + len > length) { throw new IndexOutOfBoundsException(); } if (len > remaining()) { throw new BufferOverflowException(); } for (int i = 0; i < len; i++) { byteArray.set(i + position, src[off + i]); } position += len; return this; }
java
public ByteBuffer put (byte[] src, int off, int len) { int length = src.length; if (off < 0 || len < 0 || off + len > length) { throw new IndexOutOfBoundsException(); } if (len > remaining()) { throw new BufferOverflowException(); } for (int i = 0; i < len; i++) { byteArray.set(i + position, src[off + i]); } position += len; return this; }
[ "public", "ByteBuffer", "put", "(", "byte", "[", "]", "src", ",", "int", "off", ",", "int", "len", ")", "{", "int", "length", "=", "src", ".", "length", ";", "if", "(", "off", "<", "0", "||", "len", "<", "0", "||", "off", "+", "len", ">", "le...
Writes bytes in the given byte array, starting from the specified offset, to the current position and increases the position by the number of bytes written. @param src the source byte array. @param off the offset of byte array, must not be negative and not greater than {@code src.length}. @param len the number of bytes to write, must not be negative and not greater than {@code src.length - off}. @return this buffer. @exception BufferOverflowException if {@code remaining()} is less than {@code len}. @exception IndexOutOfBoundsException if either {@code off} or {@code len} is invalid. @exception ReadOnlyBufferException if no changes may be made to the contents of this buffer.
[ "Writes", "bytes", "in", "the", "given", "byte", "array", "starting", "from", "the", "specified", "offset", "to", "the", "current", "position", "and", "increases", "the", "position", "by", "the", "number", "of", "bytes", "written", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/ByteBuffer.java#L629-L643
cubedtear/aritzh
aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java
Configuration.loadConfig
public static Configuration loadConfig(File configFile, boolean compressSpaces) { if (!configFile.exists()) { return Configuration.newConfig(OneOrOther.<File, Path>ofOne(configFile)); } Configuration config = new Configuration(OneOrOther.<File, Path>ofOne(configFile), compressSpaces); try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile)))) { loadConfig(config, reader, compressSpaces); } catch (IOException e) { e.printStackTrace(); } return config; }
java
public static Configuration loadConfig(File configFile, boolean compressSpaces) { if (!configFile.exists()) { return Configuration.newConfig(OneOrOther.<File, Path>ofOne(configFile)); } Configuration config = new Configuration(OneOrOther.<File, Path>ofOne(configFile), compressSpaces); try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(configFile)))) { loadConfig(config, reader, compressSpaces); } catch (IOException e) { e.printStackTrace(); } return config; }
[ "public", "static", "Configuration", "loadConfig", "(", "File", "configFile", ",", "boolean", "compressSpaces", ")", "{", "if", "(", "!", "configFile", ".", "exists", "(", ")", ")", "{", "return", "Configuration", ".", "newConfig", "(", "OneOrOther", ".", "<...
Loads the configuration file, specifying if spaces should be compressed or not ({@code currentLine.replaceAll("\\s+", " ")}) If the config file did not exist, it will be created @param configFile File to read the configuration from @param compressSpaces If true subsequent whitespaces will be replaced with a single one (defaults to {@code false}) @return A new configuration object, already parsed, from {@code configFile}
[ "Loads", "the", "configuration", "file", "specifying", "if", "spaces", "should", "be", "compressed", "or", "not", "(", "{", "@code", "currentLine", ".", "replaceAll", "(", "\\\\", "s", "+", ")", "}", ")", "If", "the", "config", "file", "did", "not", "exi...
train
https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java#L80-L94
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/models/History.java
History.getJSONFromMap
private String getJSONFromMap(Map<String, Object> propMap) { try { return new JSONObject(propMap).toString(); } catch (Exception e) { return "{}"; } }
java
private String getJSONFromMap(Map<String, Object> propMap) { try { return new JSONObject(propMap).toString(); } catch (Exception e) { return "{}"; } }
[ "private", "String", "getJSONFromMap", "(", "Map", "<", "String", ",", "Object", ">", "propMap", ")", "{", "try", "{", "return", "new", "JSONObject", "(", "propMap", ")", ".", "toString", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", ...
Turn map into string @param propMap Map to be converted @return
[ "Turn", "map", "into", "string" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/models/History.java#L466-L472
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesInner.java
FirewallRulesInner.replaceAsync
public Observable<FirewallRuleInner> replaceAsync(String resourceGroupName, String serverName) { return replaceWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<FirewallRuleInner>, FirewallRuleInner>() { @Override public FirewallRuleInner call(ServiceResponse<FirewallRuleInner> response) { return response.body(); } }); }
java
public Observable<FirewallRuleInner> replaceAsync(String resourceGroupName, String serverName) { return replaceWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<FirewallRuleInner>, FirewallRuleInner>() { @Override public FirewallRuleInner call(ServiceResponse<FirewallRuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "FirewallRuleInner", ">", "replaceAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "replaceWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "new", "...
Replaces all firewall rules on the server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the FirewallRuleInner object
[ "Replaces", "all", "firewall", "rules", "on", "the", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FirewallRulesInner.java#L537-L544
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java
ExcelWriter.merge
public ExcelWriter merge(int lastColumn, Object content, boolean isSetHeaderStyle) { Assert.isFalse(this.isClosed, "ExcelWriter has been closed!"); final int rowIndex = this.currentRow.get(); merge(rowIndex, rowIndex, 0, lastColumn, content, isSetHeaderStyle); // 设置内容后跳到下一行 if (null != content) { this.currentRow.incrementAndGet(); } return this; }
java
public ExcelWriter merge(int lastColumn, Object content, boolean isSetHeaderStyle) { Assert.isFalse(this.isClosed, "ExcelWriter has been closed!"); final int rowIndex = this.currentRow.get(); merge(rowIndex, rowIndex, 0, lastColumn, content, isSetHeaderStyle); // 设置内容后跳到下一行 if (null != content) { this.currentRow.incrementAndGet(); } return this; }
[ "public", "ExcelWriter", "merge", "(", "int", "lastColumn", ",", "Object", "content", ",", "boolean", "isSetHeaderStyle", ")", "{", "Assert", ".", "isFalse", "(", "this", ".", "isClosed", ",", "\"ExcelWriter has been closed!\"", ")", ";", "final", "int", "rowInd...
合并某行的单元格,并写入对象到单元格<br> 如果写到单元格中的内容非null,行号自动+1,否则当前行号不变<br> 样式为默认标题样式,可使用{@link #getHeadCellStyle()}方法调用后自定义默认样式 @param lastColumn 合并到的最后一个列号 @param content 合并单元格后的内容 @param isSetHeaderStyle 是否为合并后的单元格设置默认标题样式 @return this @since 4.0.10
[ "合并某行的单元格,并写入对象到单元格<br", ">", "如果写到单元格中的内容非null,行号自动", "+", "1,否则当前行号不变<br", ">", "样式为默认标题样式,可使用", "{", "@link", "#getHeadCellStyle", "()", "}", "方法调用后自定义默认样式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelWriter.java#L518-L529
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java
BeanUtil.getProperty
public static Object getProperty(Object bean, String expression) { return BeanPath.create(expression).get(bean); }
java
public static Object getProperty(Object bean, String expression) { return BeanPath.create(expression).get(bean); }
[ "public", "static", "Object", "getProperty", "(", "Object", "bean", ",", "String", "expression", ")", "{", "return", "BeanPath", ".", "create", "(", "expression", ")", ".", "get", "(", "bean", ")", ";", "}" ]
解析Bean中的属性值 @param bean Bean对象,支持Map、List、Collection、Array @param expression 表达式,例如:person.friend[5].name @return Bean属性值 @see BeanPath#get(Object) @since 3.0.7
[ "解析Bean中的属性值" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L301-L303
rollbar/rollbar-java
rollbar-android/src/main/java/com/rollbar/android/Rollbar.java
Rollbar.log
public void log(String message, Map<String, Object> custom) { log(null, custom, message, null); }
java
public void log(String message, Map<String, Object> custom) { log(null, custom, message, null); }
[ "public", "void", "log", "(", "String", "message", ",", "Map", "<", "String", ",", "Object", ">", "custom", ")", "{", "log", "(", "null", ",", "custom", ",", "message", ",", "null", ")", ";", "}" ]
Record a message with extra information attached at the default level returned by {@link com.rollbar.notifier.Rollbar#level}, (WARNING unless level overridden). @param message the message. @param custom the extra information.
[ "Record", "a", "message", "with", "extra", "information", "attached", "at", "the", "default", "level", "returned", "by", "{", "@link", "com", ".", "rollbar", ".", "notifier", ".", "Rollbar#level", "}", "(", "WARNING", "unless", "level", "overridden", ")", "....
train
https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-android/src/main/java/com/rollbar/android/Rollbar.java#L755-L757
threerings/nenya
core/src/main/java/com/threerings/media/AbstractMediaManager.java
AbstractMediaManager.insertMedia
protected boolean insertMedia (AbstractMedia media) { if (_media.contains(media)) { log.warning("Attempt to insert media more than once [media=" + media + "].", new Exception()); return false; } media.init(this); int ipos = _media.insertSorted(media, RENDER_ORDER); // if we've started our tick but have not yet painted our media, we need to take care that // this newly added media will be ticked before our upcoming render if (_tickStamp > 0L) { if (_tickpos == -1) { // if we're done with our own call to tick(), we need to tick this new media tickMedia(media, _tickStamp); } else if (ipos <= _tickpos) { // otherwise, we're in the middle of our call to tick() and we only need to tick // this guy if he's being inserted before our current tick position (if he's // inserted after our current position, we'll get to him as part of this tick // iteration) _tickpos++; tickMedia(media, _tickStamp); } } return true; }
java
protected boolean insertMedia (AbstractMedia media) { if (_media.contains(media)) { log.warning("Attempt to insert media more than once [media=" + media + "].", new Exception()); return false; } media.init(this); int ipos = _media.insertSorted(media, RENDER_ORDER); // if we've started our tick but have not yet painted our media, we need to take care that // this newly added media will be ticked before our upcoming render if (_tickStamp > 0L) { if (_tickpos == -1) { // if we're done with our own call to tick(), we need to tick this new media tickMedia(media, _tickStamp); } else if (ipos <= _tickpos) { // otherwise, we're in the middle of our call to tick() and we only need to tick // this guy if he's being inserted before our current tick position (if he's // inserted after our current position, we'll get to him as part of this tick // iteration) _tickpos++; tickMedia(media, _tickStamp); } } return true; }
[ "protected", "boolean", "insertMedia", "(", "AbstractMedia", "media", ")", "{", "if", "(", "_media", ".", "contains", "(", "media", ")", ")", "{", "log", ".", "warning", "(", "\"Attempt to insert media more than once [media=\"", "+", "media", "+", "\"].\"", ",",...
Inserts the specified media into this manager, return true on success.
[ "Inserts", "the", "specified", "media", "into", "this", "manager", "return", "true", "on", "success", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/AbstractMediaManager.java#L189-L217
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java
ConstraintAdapter.search
private boolean search(LinkedList<Control> list, Interaction inter) { if (list.getLast().getControlled().contains(inter)) return true; for (Process process : list.getLast().getControlled()) { if (process instanceof Control) { // prevent searching in cycles if (list.contains(process)) continue; list.add((Control) process); if (search(list, inter)) return true; else list.removeLast(); } } return false; }
java
private boolean search(LinkedList<Control> list, Interaction inter) { if (list.getLast().getControlled().contains(inter)) return true; for (Process process : list.getLast().getControlled()) { if (process instanceof Control) { // prevent searching in cycles if (list.contains(process)) continue; list.add((Control) process); if (search(list, inter)) return true; else list.removeLast(); } } return false; }
[ "private", "boolean", "search", "(", "LinkedList", "<", "Control", ">", "list", ",", "Interaction", "inter", ")", "{", "if", "(", "list", ".", "getLast", "(", ")", ".", "getControlled", "(", ")", ".", "contains", "(", "inter", ")", ")", "return", "true...
Checks if the control chain is actually controlling the Interaction. @param list the Control chain @param inter target Interaction @return true if the chain controls the Interaction
[ "Checks", "if", "the", "control", "chain", "is", "actually", "controlling", "the", "Interaction", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java#L251-L268
logic-ng/LogicNG
src/main/java/org/logicng/backbones/BackboneGeneration.java
BackboneGeneration.computeNegative
public static Backbone computeNegative(final Collection<Formula> formulas) { return compute(formulas, allVariablesInFormulas(formulas), BackboneType.ONLY_NEGATIVE); }
java
public static Backbone computeNegative(final Collection<Formula> formulas) { return compute(formulas, allVariablesInFormulas(formulas), BackboneType.ONLY_NEGATIVE); }
[ "public", "static", "Backbone", "computeNegative", "(", "final", "Collection", "<", "Formula", ">", "formulas", ")", "{", "return", "compute", "(", "formulas", ",", "allVariablesInFormulas", "(", "formulas", ")", ",", "BackboneType", ".", "ONLY_NEGATIVE", ")", "...
Computes the negative backbone variables for a given collection of formulas. @param formulas the given collection of formulas @return the negative backbone or {@code null} if the formula is UNSAT
[ "Computes", "the", "negative", "backbone", "variables", "for", "a", "given", "collection", "of", "formulas", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/BackboneGeneration.java#L211-L213
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.randomMediaPath
@NonNull private static String randomMediaPath(File bucket, String extension) { if (bucket.exists() && bucket.isFile()) bucket.delete(); if (!bucket.exists()) bucket.mkdirs(); String outFilePath = AlbumUtils.getNowDateTime("yyyyMMdd_HHmmssSSS") + "_" + getMD5ForString(UUID.randomUUID().toString()) + extension; File file = new File(bucket, outFilePath); return file.getAbsolutePath(); }
java
@NonNull private static String randomMediaPath(File bucket, String extension) { if (bucket.exists() && bucket.isFile()) bucket.delete(); if (!bucket.exists()) bucket.mkdirs(); String outFilePath = AlbumUtils.getNowDateTime("yyyyMMdd_HHmmssSSS") + "_" + getMD5ForString(UUID.randomUUID().toString()) + extension; File file = new File(bucket, outFilePath); return file.getAbsolutePath(); }
[ "@", "NonNull", "private", "static", "String", "randomMediaPath", "(", "File", "bucket", ",", "String", "extension", ")", "{", "if", "(", "bucket", ".", "exists", "(", ")", "&&", "bucket", ".", "isFile", "(", ")", ")", "bucket", ".", "delete", "(", ")"...
Generates a random file path using the specified suffix name in the specified directory. @param bucket specify the directory. @param extension extension. @return file path.
[ "Generates", "a", "random", "file", "path", "using", "the", "specified", "suffix", "name", "in", "the", "specified", "directory", "." ]
train
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L252-L259
enioka/jqm
jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/tools/LibraryResolverFS.java
LibraryResolverFS.shouldLoad
private boolean shouldLoad(Node node, JobDef jd) { if (!cache.containsKey(jd.getApplicationName())) { return true; } // If here: cache exists. JobDefLibrary libs = cache.get(jd.getApplicationName()); // Is cache stale? Date lastLoaded = libs.loadTime; File jarFile = new File(FilenameUtils.concat(new File(node.getRepo()).getAbsolutePath(), jd.getJarPath())); File jarDir = jarFile.getParentFile(); File libDir = new File(FilenameUtils.concat(jarDir.getAbsolutePath(), "lib")); if (lastLoaded.before(new Date(jarFile.lastModified())) || lastLoaded.before(new Date(jarDir.lastModified())) || lastLoaded.before(new Date(libDir.lastModified()))) { jqmlogger.info("The cache for application " + jd.getApplicationName() + " will be reloaded"); return true; } // If here, the cache is OK return false; }
java
private boolean shouldLoad(Node node, JobDef jd) { if (!cache.containsKey(jd.getApplicationName())) { return true; } // If here: cache exists. JobDefLibrary libs = cache.get(jd.getApplicationName()); // Is cache stale? Date lastLoaded = libs.loadTime; File jarFile = new File(FilenameUtils.concat(new File(node.getRepo()).getAbsolutePath(), jd.getJarPath())); File jarDir = jarFile.getParentFile(); File libDir = new File(FilenameUtils.concat(jarDir.getAbsolutePath(), "lib")); if (lastLoaded.before(new Date(jarFile.lastModified())) || lastLoaded.before(new Date(jarDir.lastModified())) || lastLoaded.before(new Date(libDir.lastModified()))) { jqmlogger.info("The cache for application " + jd.getApplicationName() + " will be reloaded"); return true; } // If here, the cache is OK return false; }
[ "private", "boolean", "shouldLoad", "(", "Node", "node", ",", "JobDef", "jd", ")", "{", "if", "(", "!", "cache", ".", "containsKey", "(", "jd", ".", "getApplicationName", "(", ")", ")", ")", "{", "return", "true", ";", "}", "// If here: cache exists.", "...
Returns true if the libraries should be loaded in cache. Two cases: never loaded and should be reloaded (jar is more recent than cache)
[ "Returns", "true", "if", "the", "libraries", "should", "be", "loaded", "in", "cache", ".", "Two", "cases", ":", "never", "loaded", "and", "should", "be", "reloaded", "(", "jar", "is", "more", "recent", "than", "cache", ")" ]
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-runner/jqm-runner-java/src/main/java/com/enioka/jqm/tools/LibraryResolverFS.java#L91-L115
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java
GoogleCloudStorageFileSystem.validateObjectName
static String validateObjectName(String objectName, boolean allowEmptyObjectName) { logger.atFine().log("validateObjectName('%s', %s)", objectName, allowEmptyObjectName); if (isNullOrEmpty(objectName) || objectName.equals(PATH_DELIMITER)) { if (allowEmptyObjectName) { objectName = ""; } else { throw new IllegalArgumentException( "Google Cloud Storage path must include non-empty object name."); } } // We want objectName to look like a traditional file system path, // therefore, disallow objectName with consecutive '/' chars. for (int i = 0; i < (objectName.length() - 1); i++) { if (objectName.charAt(i) == '/' && objectName.charAt(i + 1) == '/') { throw new IllegalArgumentException( String.format( "Google Cloud Storage path must not have consecutive '/' characters, got '%s'", objectName)); } } // Remove leading '/' if it exists. if (objectName.startsWith(PATH_DELIMITER)) { objectName = objectName.substring(1); } logger.atFine().log("validateObjectName -> '%s'", objectName); return objectName; }
java
static String validateObjectName(String objectName, boolean allowEmptyObjectName) { logger.atFine().log("validateObjectName('%s', %s)", objectName, allowEmptyObjectName); if (isNullOrEmpty(objectName) || objectName.equals(PATH_DELIMITER)) { if (allowEmptyObjectName) { objectName = ""; } else { throw new IllegalArgumentException( "Google Cloud Storage path must include non-empty object name."); } } // We want objectName to look like a traditional file system path, // therefore, disallow objectName with consecutive '/' chars. for (int i = 0; i < (objectName.length() - 1); i++) { if (objectName.charAt(i) == '/' && objectName.charAt(i + 1) == '/') { throw new IllegalArgumentException( String.format( "Google Cloud Storage path must not have consecutive '/' characters, got '%s'", objectName)); } } // Remove leading '/' if it exists. if (objectName.startsWith(PATH_DELIMITER)) { objectName = objectName.substring(1); } logger.atFine().log("validateObjectName -> '%s'", objectName); return objectName; }
[ "static", "String", "validateObjectName", "(", "String", "objectName", ",", "boolean", "allowEmptyObjectName", ")", "{", "logger", ".", "atFine", "(", ")", ".", "log", "(", "\"validateObjectName('%s', %s)\"", ",", "objectName", ",", "allowEmptyObjectName", ")", ";",...
Validate the given object name to make sure that it can be used as a part of a file system path. Note: this is not designed to duplicate the exact checks that GCS would perform on the server side. We make some checks that are relevant to using GCS as a file system. @param objectName Object name to check. @param allowEmptyObjectName If true, a missing object name is not considered invalid.
[ "Validate", "the", "given", "object", "name", "to", "make", "sure", "that", "it", "can", "be", "used", "as", "a", "part", "of", "a", "file", "system", "path", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L1447-L1477
codeprimate-software/cp-elements
src/main/java/org/cp/elements/data/conversion/converters/IntegerConverter.java
IntegerConverter.canConvert
@Override public boolean canConvert(Class<?> fromType, Class<?> toType) { return isAssignableTo(fromType, Number.class, String.class) && Integer.class.equals(toType); }
java
@Override public boolean canConvert(Class<?> fromType, Class<?> toType) { return isAssignableTo(fromType, Number.class, String.class) && Integer.class.equals(toType); }
[ "@", "Override", "public", "boolean", "canConvert", "(", "Class", "<", "?", ">", "fromType", ",", "Class", "<", "?", ">", "toType", ")", "{", "return", "isAssignableTo", "(", "fromType", ",", "Number", ".", "class", ",", "String", ".", "class", ")", "&...
Determines whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @param fromType {@link Class type} to convert from. @param toType {@link Class type} to convert to. @return a boolean indicating whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @see org.cp.elements.data.conversion.ConversionService#canConvert(Class, Class) @see #canConvert(Object, Class)
[ "Determines", "whether", "this", "{", "@link", "Converter", "}", "can", "convert", "{", "@link", "Object", "Objects", "}", "{", "@link", "Class", "from", "type", "}", "{", "@link", "Class", "to", "type", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/conversion/converters/IntegerConverter.java#L49-L52
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java
UserAttrs.setShortAttribute
public static final void setShortAttribute(Path path, String attribute, short value, LinkOption... options) throws IOException { attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute; Files.setAttribute(path, attribute, Primitives.writeShort(value), options); }
java
public static final void setShortAttribute(Path path, String attribute, short value, LinkOption... options) throws IOException { attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute; Files.setAttribute(path, attribute, Primitives.writeShort(value), options); }
[ "public", "static", "final", "void", "setShortAttribute", "(", "Path", "path", ",", "String", "attribute", ",", "short", "value", ",", "LinkOption", "...", "options", ")", "throws", "IOException", "{", "attribute", "=", "attribute", ".", "startsWith", "(", "\"...
Set user-defined-attribute @param path @param attribute user:attribute name. user: can be omitted.. user: can be omitted. @param value @param options @throws IOException
[ "Set", "user", "-", "defined", "-", "attribute" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java#L40-L44
arnaudroger/SimpleFlatMapper
sfm-map/src/main/java/org/simpleflatmapper/map/mapper/MapperBuilder.java
MapperBuilder.addMapping
public final B addMapping(String column, int index, final Object... properties) { return addMapping(key(column, index), properties); }
java
public final B addMapping(String column, int index, final Object... properties) { return addMapping(key(column, index), properties); }
[ "public", "final", "B", "addMapping", "(", "String", "column", ",", "int", "index", ",", "final", "Object", "...", "properties", ")", "{", "return", "addMapping", "(", "key", "(", "column", ",", "index", ")", ",", "properties", ")", ";", "}" ]
add a new mapping to the specified property with the specified index, specified property definition and an undefined type. @param column the property name @param index the property index @param properties the property properties @return the current builder
[ "add", "a", "new", "mapping", "to", "the", "specified", "property", "with", "the", "specified", "index", "specified", "property", "definition", "and", "an", "undefined", "type", "." ]
train
https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-map/src/main/java/org/simpleflatmapper/map/mapper/MapperBuilder.java#L123-L125
OpenTSDB/opentsdb
src/tsd/HttpJsonSerializer.java
HttpJsonSerializer.parseTSMetaV1
public TSMeta parseTSMetaV1() { final String json = query.getContent(); if (json == null || json.isEmpty()) { throw new BadRequestException(HttpResponseStatus.BAD_REQUEST, "Missing message content", "Supply valid JSON formatted data in the body of your request"); } try { return JSON.parseToObject(json, TSMeta.class); } catch (IllegalArgumentException iae) { throw new BadRequestException("Unable to parse the given JSON", iae); } }
java
public TSMeta parseTSMetaV1() { final String json = query.getContent(); if (json == null || json.isEmpty()) { throw new BadRequestException(HttpResponseStatus.BAD_REQUEST, "Missing message content", "Supply valid JSON formatted data in the body of your request"); } try { return JSON.parseToObject(json, TSMeta.class); } catch (IllegalArgumentException iae) { throw new BadRequestException("Unable to parse the given JSON", iae); } }
[ "public", "TSMeta", "parseTSMetaV1", "(", ")", "{", "final", "String", "json", "=", "query", ".", "getContent", "(", ")", ";", "if", "(", "json", "==", "null", "||", "json", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "BadRequestException", "("...
Parses a single TSMeta object @throws JSONException if parsing failed @throws BadRequestException if the content was missing or parsing failed
[ "Parses", "a", "single", "TSMeta", "object" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpJsonSerializer.java#L327-L339
michael-rapp/AndroidMaterialPreferences
library/src/main/java/de/mrapp/android/preference/AbstractColorPickerPreference.java
AbstractColorPickerPreference.formatColor
private CharSequence formatColor(final ColorFormat colorFormat, @ColorInt final int color) { Condition.INSTANCE.ensureNotNull(colorFormat, "The color format may not be null"); if (colorFormat == ColorFormat.RGB) { return String.format(Locale.getDefault(), "R = %d, G = %d, B = %d", Color.red(color), Color.green(color), Color.blue(color)); } else if (colorFormat == ColorFormat.ARGB) { return String.format(Locale.getDefault(), "A = %d, R = %d, G = %d, B = %d", Color.alpha(color), Color.red(color), Color.green(color), Color.blue(color)); } else if (colorFormat == ColorFormat.HEX_3_BYTES) { return String.format("#%06X", (0xFFFFFF & color)); } else { return String.format("#%08X", (color)); } }
java
private CharSequence formatColor(final ColorFormat colorFormat, @ColorInt final int color) { Condition.INSTANCE.ensureNotNull(colorFormat, "The color format may not be null"); if (colorFormat == ColorFormat.RGB) { return String.format(Locale.getDefault(), "R = %d, G = %d, B = %d", Color.red(color), Color.green(color), Color.blue(color)); } else if (colorFormat == ColorFormat.ARGB) { return String.format(Locale.getDefault(), "A = %d, R = %d, G = %d, B = %d", Color.alpha(color), Color.red(color), Color.green(color), Color.blue(color)); } else if (colorFormat == ColorFormat.HEX_3_BYTES) { return String.format("#%06X", (0xFFFFFF & color)); } else { return String.format("#%08X", (color)); } }
[ "private", "CharSequence", "formatColor", "(", "final", "ColorFormat", "colorFormat", ",", "@", "ColorInt", "final", "int", "color", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "colorFormat", ",", "\"The color format may not be null\"", ")", "...
Creates and returns a textual representation of a color, according to a specific format. @param colorFormat The format, which should be used to format the color, as a value of the enum {@link ColorFormat}. The format may not be null @param color The color, which should be formatted, as an {@link Integer} value @return A textual representation of the given color as an instance of the type {@link CharSequence}
[ "Creates", "and", "returns", "a", "textual", "representation", "of", "a", "color", "according", "to", "a", "specific", "format", "." ]
train
https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/library/src/main/java/de/mrapp/android/preference/AbstractColorPickerPreference.java#L481-L495
real-logic/agrona
agrona/src/main/java/org/agrona/concurrent/RecordBuffer.java
RecordBuffer.withRecord
public boolean withRecord(final int key, final RecordWriter writer) { final int claimedOffset = claimRecord(key); if (claimedOffset == DID_NOT_CLAIM_RECORD) { return false; } try { writer.writeRecord(claimedOffset); } finally { commit(claimedOffset); } return true; }
java
public boolean withRecord(final int key, final RecordWriter writer) { final int claimedOffset = claimRecord(key); if (claimedOffset == DID_NOT_CLAIM_RECORD) { return false; } try { writer.writeRecord(claimedOffset); } finally { commit(claimedOffset); } return true; }
[ "public", "boolean", "withRecord", "(", "final", "int", "key", ",", "final", "RecordWriter", "writer", ")", "{", "final", "int", "claimedOffset", "=", "claimRecord", "(", "key", ")", ";", "if", "(", "claimedOffset", "==", "DID_NOT_CLAIM_RECORD", ")", "{", "r...
High level and safe way of writing a record to the buffer. @param key the key to associate the record with @param writer the callback which is passed the record to write. @return whether the write succeeded or not.
[ "High", "level", "and", "safe", "way", "of", "writing", "a", "record", "to", "the", "buffer", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/concurrent/RecordBuffer.java#L194-L212
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java
Resources.getPropertyFile
@Pure public static URL getPropertyFile(ClassLoader classLoader, Class<?> classname, Locale locale) { final StringBuilder name = new StringBuilder(); // Localized file if (locale != null) { final String country = locale.getCountry(); if (country != null && !country.isEmpty()) { name.append(classname.getSimpleName()); name.append("_"); //$NON-NLS-1$ name.append(country); name.append(".properties"); //$NON-NLS-1$ final URL url = getResource(classLoader, classname.getPackage(), name.toString()); if (url != null) { return url; } } } // Default property file name.setLength(0); name.append(classname.getSimpleName()); name.append(".properties"); //$NON-NLS-1$ return getResource(classLoader, classname.getPackage(), name.toString()); }
java
@Pure public static URL getPropertyFile(ClassLoader classLoader, Class<?> classname, Locale locale) { final StringBuilder name = new StringBuilder(); // Localized file if (locale != null) { final String country = locale.getCountry(); if (country != null && !country.isEmpty()) { name.append(classname.getSimpleName()); name.append("_"); //$NON-NLS-1$ name.append(country); name.append(".properties"); //$NON-NLS-1$ final URL url = getResource(classLoader, classname.getPackage(), name.toString()); if (url != null) { return url; } } } // Default property file name.setLength(0); name.append(classname.getSimpleName()); name.append(".properties"); //$NON-NLS-1$ return getResource(classLoader, classname.getPackage(), name.toString()); }
[ "@", "Pure", "public", "static", "URL", "getPropertyFile", "(", "ClassLoader", "classLoader", ",", "Class", "<", "?", ">", "classname", ",", "Locale", "locale", ")", "{", "final", "StringBuilder", "name", "=", "new", "StringBuilder", "(", ")", ";", "// Local...
Replies the URL of a property resource that is associated to the given class. @param classLoader is the research scope. If <code>null</code>, the class loader replied by {@link ClassLoaderFinder} is used. @param classname is the class for which the property resource should be replied. @param locale is the expected localization of the resource file; or <code>null</code> for the default. @return the url of the property resource or <code>null</code> if the resource was not found in class paths.
[ "Replies", "the", "URL", "of", "a", "property", "resource", "that", "is", "associated", "to", "the", "given", "class", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java#L350-L374
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.getChild
@SuppressWarnings("unchecked") public <T extends ElementBase> T getChild(Class<T> clazz, ElementBase last) { int i = last == null ? -1 : children.indexOf(last); for (i++; i < children.size(); i++) { if (clazz.isInstance(children.get(i))) { return (T) children.get(i); } } return null; }
java
@SuppressWarnings("unchecked") public <T extends ElementBase> T getChild(Class<T> clazz, ElementBase last) { int i = last == null ? -1 : children.indexOf(last); for (i++; i < children.size(); i++) { if (clazz.isInstance(children.get(i))) { return (T) children.get(i); } } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "ElementBase", ">", "T", "getChild", "(", "Class", "<", "T", ">", "clazz", ",", "ElementBase", "last", ")", "{", "int", "i", "=", "last", "==", "null", "?", "-", "1", ...
Locates and returns a child that is an instance of the specified class. If none is found, returns null. @param <T> The type of child being sought. @param clazz Class of the child being sought. @param last If specified, the search begins after this child. If null, the search begins with the first child. @return The requested child or null if none found.
[ "Locates", "and", "returns", "a", "child", "that", "is", "an", "instance", "of", "the", "specified", "class", ".", "If", "none", "is", "found", "returns", "null", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L437-L448
WiQuery/wiquery
wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/datepicker/DateOption.java
DateOption.setParam
private void setParam(Short shortParam, String literalParam, Date dateParam) { this.shortParam = shortParam; this.literalParam = literalParam; this.dateParam = dateParam; }
java
private void setParam(Short shortParam, String literalParam, Date dateParam) { this.shortParam = shortParam; this.literalParam = literalParam; this.dateParam = dateParam; }
[ "private", "void", "setParam", "(", "Short", "shortParam", ",", "String", "literalParam", ",", "Date", "dateParam", ")", "{", "this", ".", "shortParam", "=", "shortParam", ";", "this", ".", "literalParam", "=", "literalParam", ";", "this", ".", "dateParam", ...
Method setting the right parameter @param shortParam Short parameter @param literalParam literal parameter @param dateParam short parameter
[ "Method", "setting", "the", "right", "parameter" ]
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/datepicker/DateOption.java#L198-L203
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/utils/ReflectionUtils.java
ReflectionUtils.invokeMethod
public static Object invokeMethod(final Object obj, final String methodName, final boolean throwException) throws IllegalArgumentException { if (obj == null || methodName == null) { if (throwException) { throw new NullPointerException(); } else { return null; } } return invokeMethod(obj.getClass(), obj, methodName, false, null, null, throwException); }
java
public static Object invokeMethod(final Object obj, final String methodName, final boolean throwException) throws IllegalArgumentException { if (obj == null || methodName == null) { if (throwException) { throw new NullPointerException(); } else { return null; } } return invokeMethod(obj.getClass(), obj, methodName, false, null, null, throwException); }
[ "public", "static", "Object", "invokeMethod", "(", "final", "Object", "obj", ",", "final", "String", "methodName", ",", "final", "boolean", "throwException", ")", "throws", "IllegalArgumentException", "{", "if", "(", "obj", "==", "null", "||", "methodName", "=="...
Invoke the named method in the given object or its superclasses. If an exception is thrown while trying to call the method, and throwException is true, then IllegalArgumentException is thrown wrapping the cause, otherwise this will return null. If passed a null object, returns null unless throwException is true, then throws IllegalArgumentException. @param obj The object. @param methodName The method name. @param throwException If true, throw an exception if the field value could not be read. @return The field value. @throws IllegalArgumentException If the field value could not be read.
[ "Invoke", "the", "named", "method", "in", "the", "given", "object", "or", "its", "superclasses", ".", "If", "an", "exception", "is", "thrown", "while", "trying", "to", "call", "the", "method", "and", "throwException", "is", "true", "then", "IllegalArgumentExce...
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/ReflectionUtils.java#L292-L302
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java
URLRewriterService.getNamePrefix
public static String getNamePrefix( ServletContext servletContext, ServletRequest request, String name ) { ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request ); InternalStringBuilder prefix = new InternalStringBuilder(); if ( rewriters != null ) { for ( Iterator i = rewriters.iterator(); i.hasNext(); ) { URLRewriter rewriter = ( URLRewriter ) i.next(); String nextPrefix = rewriter.getNamePrefix( servletContext, request, name ); if ( nextPrefix != null ) { prefix.append( nextPrefix ); } } } return prefix.toString(); }
java
public static String getNamePrefix( ServletContext servletContext, ServletRequest request, String name ) { ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request ); InternalStringBuilder prefix = new InternalStringBuilder(); if ( rewriters != null ) { for ( Iterator i = rewriters.iterator(); i.hasNext(); ) { URLRewriter rewriter = ( URLRewriter ) i.next(); String nextPrefix = rewriter.getNamePrefix( servletContext, request, name ); if ( nextPrefix != null ) { prefix.append( nextPrefix ); } } } return prefix.toString(); }
[ "public", "static", "String", "getNamePrefix", "(", "ServletContext", "servletContext", ",", "ServletRequest", "request", ",", "String", "name", ")", "{", "ArrayList", "/*< URLRewriter >*/", "rewriters", "=", "getRewriters", "(", "request", ")", ";", "InternalStringBu...
Get the prefix to use when rewriting a query parameter name. Loops through the list of registered URLRewriters to build up a the prefix. @param servletContext the current ServletContext. @param request the current ServletRequest. @param name the name of the query parameter. @return a prefix to use to rewrite a query parameter name.
[ "Get", "the", "prefix", "to", "use", "when", "rewriting", "a", "query", "parameter", "name", ".", "Loops", "through", "the", "list", "of", "registered", "URLRewriters", "to", "build", "up", "a", "the", "prefix", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/URLRewriterService.java#L69-L86
HubSpot/jinjava
src/main/java/com/hubspot/jinjava/interpret/JinjavaInterpreter.java
JinjavaInterpreter.resolveELExpression
public Object resolveELExpression(String expression, int lineNumber) { this.lineNumber = lineNumber; return expressionResolver.resolveExpression(expression); }
java
public Object resolveELExpression(String expression, int lineNumber) { this.lineNumber = lineNumber; return expressionResolver.resolveExpression(expression); }
[ "public", "Object", "resolveELExpression", "(", "String", "expression", ",", "int", "lineNumber", ")", "{", "this", ".", "lineNumber", "=", "lineNumber", ";", "return", "expressionResolver", ".", "resolveExpression", "(", "expression", ")", ";", "}" ]
Resolve expression against current context. @param expression Jinja expression. @param lineNumber Line number of expression. @return Value of expression.
[ "Resolve", "expression", "against", "current", "context", "." ]
train
https://github.com/HubSpot/jinjava/blob/ce570935630f49c666170d2330b0b9ba4eddb955/src/main/java/com/hubspot/jinjava/interpret/JinjavaInterpreter.java#L419-L422
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java
FlatFileUtils.trim
public static String trim( String string, int pos ) { int len = string.length(); int leftPos = pos; int rightPos = len; for( ; rightPos > 0; --rightPos ) { char ch = string.charAt( rightPos - 1 ); if( ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' ) { break; } } for( ; leftPos < rightPos; ++leftPos ) { char ch = string.charAt( leftPos ); if( ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' ) { break; } } if( rightPos <= leftPos ) { return ""; } return ( leftPos == 0 && rightPos == string.length() )? string : string.substring( leftPos, rightPos ); }
java
public static String trim( String string, int pos ) { int len = string.length(); int leftPos = pos; int rightPos = len; for( ; rightPos > 0; --rightPos ) { char ch = string.charAt( rightPos - 1 ); if( ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' ) { break; } } for( ; leftPos < rightPos; ++leftPos ) { char ch = string.charAt( leftPos ); if( ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' ) { break; } } if( rightPos <= leftPos ) { return ""; } return ( leftPos == 0 && rightPos == string.length() )? string : string.substring( leftPos, rightPos ); }
[ "public", "static", "String", "trim", "(", "String", "string", ",", "int", "pos", ")", "{", "int", "len", "=", "string", ".", "length", "(", ")", ";", "int", "leftPos", "=", "pos", ";", "int", "rightPos", "=", "len", ";", "for", "(", ";", "rightPos...
Removes all whitespace characters from the beginning and end of the string starting from the given position.
[ "Removes", "all", "whitespace", "characters", "from", "the", "beginning", "and", "end", "of", "the", "string", "starting", "from", "the", "given", "position", "." ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L32-L71
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractLinear.java
AbstractLinear.create_TITLE_Image
protected BufferedImage create_TITLE_Image(final int WIDTH, final int HEIGHT, final boolean UNIT_STRING_VISIBLE) { return create_TITLE_Image(WIDTH, HEIGHT, UNIT_STRING_VISIBLE, null); }
java
protected BufferedImage create_TITLE_Image(final int WIDTH, final int HEIGHT, final boolean UNIT_STRING_VISIBLE) { return create_TITLE_Image(WIDTH, HEIGHT, UNIT_STRING_VISIBLE, null); }
[ "protected", "BufferedImage", "create_TITLE_Image", "(", "final", "int", "WIDTH", ",", "final", "int", "HEIGHT", ",", "final", "boolean", "UNIT_STRING_VISIBLE", ")", "{", "return", "create_TITLE_Image", "(", "WIDTH", ",", "HEIGHT", ",", "UNIT_STRING_VISIBLE", ",", ...
Returns the image of the title. @param WIDTH @param HEIGHT @param UNIT_STRING_VISIBLE @return a buffered image of the title and unit string
[ "Returns", "the", "image", "of", "the", "title", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractLinear.java#L1085-L1088
landawn/AbacusUtil
src/com/landawn/abacus/util/StringUtil.java
StringUtil.reverseDelimited
public static String reverseDelimited(final String str, final char delimiter) { if (N.isNullOrEmpty(str)) { return str; } // could implement manually, but simple way is to reuse other, // probably slower, methods. final String[] strs = split(str, delimiter); N.reverse(strs); return join(strs, delimiter); }
java
public static String reverseDelimited(final String str, final char delimiter) { if (N.isNullOrEmpty(str)) { return str; } // could implement manually, but simple way is to reuse other, // probably slower, methods. final String[] strs = split(str, delimiter); N.reverse(strs); return join(strs, delimiter); }
[ "public", "static", "String", "reverseDelimited", "(", "final", "String", "str", ",", "final", "char", "delimiter", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "str", ")", ")", "{", "return", "str", ";", "}", "// could implement manually, but simple w...
<p> Reverses a String that is delimited by a specific character. </p> <p> The Strings between the delimiters are not reversed. Thus java.lang.String becomes String.lang.java (if the delimiter is {@code '.'}). </p> <pre> N.reverseDelimited(null, *) = null N.reverseDelimited("", *) = "" N.reverseDelimited("a.b.c", 'x') = "a.b.c" N.reverseDelimited("a.b.c", ".") = "c.b.a" </pre> @param str the String to reverse, may be null @param delimiter the delimiter character to use @return the reversed String, {@code null} if null String input @since 2.0
[ "<p", ">", "Reverses", "a", "String", "that", "is", "delimited", "by", "a", "specific", "character", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L219-L231
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/datetime/PDTWebDateHelper.java
PDTWebDateHelper.extractDateTimeZone
@Nonnull public static WithZoneId extractDateTimeZone (@Nonnull final String sDate) { ValueEnforcer.notNull (sDate, "Date"); final int nDateLen = sDate.length (); for (final PDTZoneID aSupp : PDTZoneID.getDefaultZoneIDs ()) { final String sDTZ = aSupp.getZoneIDString (); if (sDate.endsWith (" " + sDTZ)) return new WithZoneId (sDate.substring (0, nDateLen - (1 + sDTZ.length ())), aSupp.getZoneID ()); if (sDate.endsWith (sDTZ)) return new WithZoneId (sDate.substring (0, nDateLen - sDTZ.length ()), aSupp.getZoneID ()); } return new WithZoneId (sDate, null); }
java
@Nonnull public static WithZoneId extractDateTimeZone (@Nonnull final String sDate) { ValueEnforcer.notNull (sDate, "Date"); final int nDateLen = sDate.length (); for (final PDTZoneID aSupp : PDTZoneID.getDefaultZoneIDs ()) { final String sDTZ = aSupp.getZoneIDString (); if (sDate.endsWith (" " + sDTZ)) return new WithZoneId (sDate.substring (0, nDateLen - (1 + sDTZ.length ())), aSupp.getZoneID ()); if (sDate.endsWith (sDTZ)) return new WithZoneId (sDate.substring (0, nDateLen - sDTZ.length ()), aSupp.getZoneID ()); } return new WithZoneId (sDate, null); }
[ "@", "Nonnull", "public", "static", "WithZoneId", "extractDateTimeZone", "(", "@", "Nonnull", "final", "String", "sDate", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sDate", ",", "\"Date\"", ")", ";", "final", "int", "nDateLen", "=", "sDate", ".", "leng...
Extract the time zone from the passed string. UTC and GMT are supported. @param sDate The date string. @return A non-<code>null</code> {@link WithZoneId}, where the remaining string to be parsed (never <code>null</code>) and and the extracted time zone (may be <code>null</code>) are contained.
[ "Extract", "the", "time", "zone", "from", "the", "passed", "string", ".", "UTC", "and", "GMT", "are", "supported", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTWebDateHelper.java#L239-L254
amaembo/streamex
src/main/java/one/util/streamex/DoubleStreamEx.java
DoubleStreamEx.foldLeft
public double foldLeft(double seed, DoubleBinaryOperator accumulator) { double[] box = new double[] { seed }; forEachOrdered(t -> box[0] = accumulator.applyAsDouble(box[0], t)); return box[0]; }
java
public double foldLeft(double seed, DoubleBinaryOperator accumulator) { double[] box = new double[] { seed }; forEachOrdered(t -> box[0] = accumulator.applyAsDouble(box[0], t)); return box[0]; }
[ "public", "double", "foldLeft", "(", "double", "seed", ",", "DoubleBinaryOperator", "accumulator", ")", "{", "double", "[", "]", "box", "=", "new", "double", "[", "]", "{", "seed", "}", ";", "forEachOrdered", "(", "t", "->", "box", "[", "0", "]", "=", ...
Folds the elements of this stream using the provided seed object and accumulation function, going left to right. This is equivalent to: <pre> {@code double result = identity; for (double element : this stream) result = accumulator.apply(result, element) return result; } </pre> <p> This is a terminal operation. <p> This method cannot take all the advantages of parallel streams as it must process elements strictly left to right. If your accumulator function is associative, consider using {@link #reduce(double, DoubleBinaryOperator)} method. <p> For parallel stream it's not guaranteed that accumulator will always be executed in the same thread. @param seed the starting value @param accumulator a <a href="package-summary.html#NonInterference">non-interfering </a>, <a href="package-summary.html#Statelessness">stateless</a> function for incorporating an additional element into a result @return the result of the folding @see #reduce(double, DoubleBinaryOperator) @see #foldLeft(DoubleBinaryOperator) @since 0.4.0
[ "Folds", "the", "elements", "of", "this", "stream", "using", "the", "provided", "seed", "object", "and", "accumulation", "function", "going", "left", "to", "right", ".", "This", "is", "equivalent", "to", ":" ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/DoubleStreamEx.java#L714-L718
jblas-project/jblas
src/main/java/org/jblas/MatrixFunctions.java
MatrixFunctions.powi
public static DoubleMatrix powi(DoubleMatrix x, double d) { if (d == 2.0) return x.muli(x); else { for (int i = 0; i < x.length; i++) x.put(i, (double) Math.pow(x.get(i), d)); return x; } }
java
public static DoubleMatrix powi(DoubleMatrix x, double d) { if (d == 2.0) return x.muli(x); else { for (int i = 0; i < x.length; i++) x.put(i, (double) Math.pow(x.get(i), d)); return x; } }
[ "public", "static", "DoubleMatrix", "powi", "(", "DoubleMatrix", "x", ",", "double", "d", ")", "{", "if", "(", "d", "==", "2.0", ")", "return", "x", ".", "muli", "(", "x", ")", ";", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", ...
Element-wise power function. Replaces each element with its power of <tt>d</tt>.Note that this is an in-place operation. @param d the exponent @see MatrixFunctions#pow(DoubleMatrix,double) @return this matrix
[ "Element", "-", "wise", "power", "function", ".", "Replaces", "each", "element", "with", "its", "power", "of", "<tt", ">", "d<", "/", "tt", ">", ".", "Note", "that", "this", "is", "an", "in", "-", "place", "operation", "." ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/MatrixFunctions.java#L259-L267
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/GroupedTypedHistogram.java
GroupedTypedHistogram.iterateGroupNodes
private void iterateGroupNodes(long groupdId, NodeReader nodeReader) { // while the index can be a long, the value is always an int int currentPointer = (int) headPointers.get(groupdId); checkArgument(currentPointer != NULL, "valid group must have non-null head pointer"); while (currentPointer != NULL) { checkState(currentPointer < nextNodePointer, "error, corrupt pointer; max valid %s, found %s", nextNodePointer, currentPointer); nodeReader.read(currentPointer); currentPointer = nextPointers.get(currentPointer); } }
java
private void iterateGroupNodes(long groupdId, NodeReader nodeReader) { // while the index can be a long, the value is always an int int currentPointer = (int) headPointers.get(groupdId); checkArgument(currentPointer != NULL, "valid group must have non-null head pointer"); while (currentPointer != NULL) { checkState(currentPointer < nextNodePointer, "error, corrupt pointer; max valid %s, found %s", nextNodePointer, currentPointer); nodeReader.read(currentPointer); currentPointer = nextPointers.get(currentPointer); } }
[ "private", "void", "iterateGroupNodes", "(", "long", "groupdId", ",", "NodeReader", "nodeReader", ")", "{", "// while the index can be a long, the value is always an int", "int", "currentPointer", "=", "(", "int", ")", "headPointers", ".", "get", "(", "groupdId", ")", ...
used to iterate over all non-null nodes in the data structure @param nodeReader - will be passed every non-null nodePointer
[ "used", "to", "iterate", "over", "all", "non", "-", "null", "nodes", "in", "the", "data", "structure" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/GroupedTypedHistogram.java#L268-L279
fuinorg/event-store-commons
eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java
ESHttpUtils.findContentText
@Nullable public static String findContentText(final Node rootNode, final XPath xPath, final String expression) { final Node node = findNode(rootNode, xPath, expression); if (node == null) { return null; } return node.getTextContent(); }
java
@Nullable public static String findContentText(final Node rootNode, final XPath xPath, final String expression) { final Node node = findNode(rootNode, xPath, expression); if (node == null) { return null; } return node.getTextContent(); }
[ "@", "Nullable", "public", "static", "String", "findContentText", "(", "final", "Node", "rootNode", ",", "final", "XPath", "xPath", ",", "final", "String", "expression", ")", "{", "final", "Node", "node", "=", "findNode", "(", "rootNode", ",", "xPath", ",", ...
Returns an string from a node's content. @param rootNode Node to search. @param xPath XPath to use. @param expression XPath expression. @return Node or <code>null</code> if no match was found.
[ "Returns", "an", "string", "from", "a", "node", "s", "content", "." ]
train
https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java#L61-L68
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/fonts/cmaps/CMap.java
CMap.addMapping
public void addMapping( byte[] src, String dest ) throws IOException { if( src.length == 1 ) { singleByteMappings.put( Integer.valueOf( src[0] & 0xff ), dest ); } else if( src.length == 2 ) { int intSrc = src[0]&0xFF; intSrc <<= 8; intSrc |= (src[1]&0xFF); doubleByteMappings.put( Integer.valueOf( intSrc ), dest ); } else { throw new IOException( "Mapping code should be 1 or two bytes and not " + src.length ); } }
java
public void addMapping( byte[] src, String dest ) throws IOException { if( src.length == 1 ) { singleByteMappings.put( Integer.valueOf( src[0] & 0xff ), dest ); } else if( src.length == 2 ) { int intSrc = src[0]&0xFF; intSrc <<= 8; intSrc |= (src[1]&0xFF); doubleByteMappings.put( Integer.valueOf( intSrc ), dest ); } else { throw new IOException( "Mapping code should be 1 or two bytes and not " + src.length ); } }
[ "public", "void", "addMapping", "(", "byte", "[", "]", "src", ",", "String", "dest", ")", "throws", "IOException", "{", "if", "(", "src", ".", "length", "==", "1", ")", "{", "singleByteMappings", ".", "put", "(", "Integer", ".", "valueOf", "(", "src", ...
This will add a mapping. @param src The src to the mapping. @param dest The dest to the mapping. @throws IOException if the src is invalid.
[ "This", "will", "add", "a", "mapping", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/fonts/cmaps/CMap.java#L120-L137
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/asm/ModifierAdjustment.java
ModifierAdjustment.withFieldModifiers
public ModifierAdjustment withFieldModifiers(ElementMatcher<? super FieldDescription.InDefinedShape> matcher, ModifierContributor.ForField... modifierContributor) { return withFieldModifiers(matcher, Arrays.asList(modifierContributor)); }
java
public ModifierAdjustment withFieldModifiers(ElementMatcher<? super FieldDescription.InDefinedShape> matcher, ModifierContributor.ForField... modifierContributor) { return withFieldModifiers(matcher, Arrays.asList(modifierContributor)); }
[ "public", "ModifierAdjustment", "withFieldModifiers", "(", "ElementMatcher", "<", "?", "super", "FieldDescription", ".", "InDefinedShape", ">", "matcher", ",", "ModifierContributor", ".", "ForField", "...", "modifierContributor", ")", "{", "return", "withFieldModifiers", ...
Adjusts a field's modifiers if it fulfills the supplied matcher. @param matcher The matcher that determines if a field's modifiers should be adjusted. @param modifierContributor The modifier contributors to enforce. @return A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
[ "Adjusts", "a", "field", "s", "modifiers", "if", "it", "fulfills", "the", "supplied", "matcher", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/asm/ModifierAdjustment.java#L164-L167
rey5137/material
material/src/main/java/com/rey/material/widget/EditText.java
EditText.setCompoundDrawablesWithIntrinsicBounds
public void setCompoundDrawablesWithIntrinsicBounds (int left, int top, int right, int bottom){ mInputView.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom); }
java
public void setCompoundDrawablesWithIntrinsicBounds (int left, int top, int right, int bottom){ mInputView.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom); }
[ "public", "void", "setCompoundDrawablesWithIntrinsicBounds", "(", "int", "left", ",", "int", "top", ",", "int", "right", ",", "int", "bottom", ")", "{", "mInputView", ".", "setCompoundDrawablesWithIntrinsicBounds", "(", "left", ",", "top", ",", "right", ",", "bo...
Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use 0 if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds. <p> Calling this method will overwrite any Drawables previously set using {@link #setCompoundDrawablesRelative} or related methods. @param left Resource identifier of the left Drawable. @param top Resource identifier of the top Drawable. @param right Resource identifier of the right Drawable. @param bottom Resource identifier of the bottom Drawable. @attr ref android.R.styleable#TextView_drawableLeft @attr ref android.R.styleable#TextView_drawableTop @attr ref android.R.styleable#TextView_drawableRight @attr ref android.R.styleable#TextView_drawableBottom
[ "Sets", "the", "Drawables", "(", "if", "any", ")", "to", "appear", "to", "the", "left", "of", "above", "to", "the", "right", "of", "and", "below", "the", "text", ".", "Use", "0", "if", "you", "do", "not", "want", "a", "Drawable", "there", ".", "The...
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L2809-L2811
OpenBEL/openbel-framework
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/rdf/RelationshipTypeProperty.java
RelationshipTypeProperty.propertyFor
public static final Property propertyFor(RelationshipType rtype) { if (rtype == null) { throw new InvalidArgument("rtype", rtype); } return TYPETOPROPERTY.get(rtype); }
java
public static final Property propertyFor(RelationshipType rtype) { if (rtype == null) { throw new InvalidArgument("rtype", rtype); } return TYPETOPROPERTY.get(rtype); }
[ "public", "static", "final", "Property", "propertyFor", "(", "RelationshipType", "rtype", ")", "{", "if", "(", "rtype", "==", "null", ")", "{", "throw", "new", "InvalidArgument", "(", "\"rtype\"", ",", "rtype", ")", ";", "}", "return", "TYPETOPROPERTY", ".",...
Retrieve the RDF {@link Property} for the BEL {@link RelationshipType}. @param rtype {@link RelationshipType}, the relationship type, which cannot be null @return {@link Property} the property for the {@link RelationshipType} @throws InvalidArgument Thrown if <tt>rtype</tt> is null
[ "Retrieve", "the", "RDF", "{", "@link", "Property", "}", "for", "the", "BEL", "{", "@link", "RelationshipType", "}", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/rdf/RelationshipTypeProperty.java#L84-L90
groovy/groovy-core
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.eachRow
public void eachRow(Map params, String sql, Closure closure) throws SQLException { eachRow(sql, singletonList(params), closure); }
java
public void eachRow(Map params, String sql, Closure closure) throws SQLException { eachRow(sql, singletonList(params), closure); }
[ "public", "void", "eachRow", "(", "Map", "params", ",", "String", "sql", ",", "Closure", "closure", ")", "throws", "SQLException", "{", "eachRow", "(", "sql", ",", "singletonList", "(", "params", ")", ",", "closure", ")", ";", "}" ]
A variant of {@link #eachRow(String, java.util.List, groovy.lang.Closure)} useful when providing the named parameters as named arguments. @param params a map of named parameters @param sql the sql statement @param closure called for each row with a GroovyResultSet @throws SQLException if a database access error occurs @since 1.8.7
[ "A", "variant", "of", "{", "@link", "#eachRow", "(", "String", "java", ".", "util", ".", "List", "groovy", ".", "lang", ".", "Closure", ")", "}", "useful", "when", "providing", "the", "named", "parameters", "as", "named", "arguments", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L1418-L1420
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.instanceView
public VirtualMachineInstanceViewInner instanceView(String resourceGroupName, String vmName) { return instanceViewWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().single().body(); }
java
public VirtualMachineInstanceViewInner instanceView(String resourceGroupName, String vmName) { return instanceViewWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().single().body(); }
[ "public", "VirtualMachineInstanceViewInner", "instanceView", "(", "String", "resourceGroupName", ",", "String", "vmName", ")", "{", "return", "instanceViewWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ")", ".", "toBlocking", "(", ")", ".", "single"...
Retrieves information about the run-time state of a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VirtualMachineInstanceViewInner object if successful.
[ "Retrieves", "information", "about", "the", "run", "-", "time", "state", "of", "a", "virtual", "machine", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L1048-L1050
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/ProviderList.java
ProviderList.getService
public Service getService(String type, String name) { for (int i = 0; i < configs.length; i++) { Provider p = getProvider(i); Service s = p.getService(type, name); if (s != null) { return s; } } return null; }
java
public Service getService(String type, String name) { for (int i = 0; i < configs.length; i++) { Provider p = getProvider(i); Service s = p.getService(type, name); if (s != null) { return s; } } return null; }
[ "public", "Service", "getService", "(", "String", "type", ",", "String", "name", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "configs", ".", "length", ";", "i", "++", ")", "{", "Provider", "p", "=", "getProvider", "(", "i", ")", ";...
Return a Service describing an implementation of the specified algorithm from the Provider with the highest precedence that supports that algorithm. Return null if no Provider supports this algorithm.
[ "Return", "a", "Service", "describing", "an", "implementation", "of", "the", "specified", "algorithm", "from", "the", "Provider", "with", "the", "highest", "precedence", "that", "supports", "that", "algorithm", ".", "Return", "null", "if", "no", "Provider", "sup...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/ProviderList.java#L335-L344
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_service_serviceName_repaymentConsumption_consumptionId_GET
public OvhRepaymentConsumption billingAccount_service_serviceName_repaymentConsumption_consumptionId_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/repaymentConsumption/{consumptionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRepaymentConsumption.class); }
java
public OvhRepaymentConsumption billingAccount_service_serviceName_repaymentConsumption_consumptionId_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/repaymentConsumption/{consumptionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRepaymentConsumption.class); }
[ "public", "OvhRepaymentConsumption", "billingAccount_service_serviceName_repaymentConsumption_consumptionId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "consumptionId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephon...
Get this object properties REST: GET /telephony/{billingAccount}/service/{serviceName}/repaymentConsumption/{consumptionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param consumptionId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4088-L4093
Azure/azure-sdk-for-java
dns/resource-manager/v2016_04_01/src/main/java/com/microsoft/azure/management/dns/v2016_04_01/implementation/RecordSetsInner.java
RecordSetsInner.listByDnsZoneWithServiceResponseAsync
public Observable<ServiceResponse<Page<RecordSetInner>>> listByDnsZoneWithServiceResponseAsync(final String resourceGroupName, final String zoneName, final Integer top, final String recordsetnamesuffix) { return listByDnsZoneSinglePageAsync(resourceGroupName, zoneName, top, recordsetnamesuffix) .concatMap(new Func1<ServiceResponse<Page<RecordSetInner>>, Observable<ServiceResponse<Page<RecordSetInner>>>>() { @Override public Observable<ServiceResponse<Page<RecordSetInner>>> call(ServiceResponse<Page<RecordSetInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByDnsZoneNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<RecordSetInner>>> listByDnsZoneWithServiceResponseAsync(final String resourceGroupName, final String zoneName, final Integer top, final String recordsetnamesuffix) { return listByDnsZoneSinglePageAsync(resourceGroupName, zoneName, top, recordsetnamesuffix) .concatMap(new Func1<ServiceResponse<Page<RecordSetInner>>, Observable<ServiceResponse<Page<RecordSetInner>>>>() { @Override public Observable<ServiceResponse<Page<RecordSetInner>>> call(ServiceResponse<Page<RecordSetInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByDnsZoneNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "RecordSetInner", ">", ">", ">", "listByDnsZoneWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "zoneName", ",", "final", "Integer", "top", ",", "final",...
Lists all record sets in a DNS zone. @param resourceGroupName The name of the resource group. @param zoneName The name of the DNS zone (without a terminating dot). @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets. @param recordsetnamesuffix The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with .&lt;recordSetNameSuffix&gt; @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;RecordSetInner&gt; object
[ "Lists", "all", "record", "sets", "in", "a", "DNS", "zone", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/dns/resource-manager/v2016_04_01/src/main/java/com/microsoft/azure/management/dns/v2016_04_01/implementation/RecordSetsInner.java#L1291-L1303
vanilladb/vanillacore
src/main/java/org/vanilladb/core/sql/Constant.java
Constant.newInstance
public static Constant newInstance(Type type, byte[] val) { switch (type.getSqlType()) { case (INTEGER): return new IntegerConstant(val); case (BIGINT): return new BigIntConstant(val); case (DOUBLE): return new DoubleConstant(val); case (VARCHAR): return new VarcharConstant(val, type); } throw new UnsupportedOperationException("Unspported SQL type: " + type.getSqlType()); }
java
public static Constant newInstance(Type type, byte[] val) { switch (type.getSqlType()) { case (INTEGER): return new IntegerConstant(val); case (BIGINT): return new BigIntConstant(val); case (DOUBLE): return new DoubleConstant(val); case (VARCHAR): return new VarcharConstant(val, type); } throw new UnsupportedOperationException("Unspported SQL type: " + type.getSqlType()); }
[ "public", "static", "Constant", "newInstance", "(", "Type", "type", ",", "byte", "[", "]", "val", ")", "{", "switch", "(", "type", ".", "getSqlType", "(", ")", ")", "{", "case", "(", "INTEGER", ")", ":", "return", "new", "IntegerConstant", "(", "val", ...
Constructs a new instance of the specified type with value converted from the input byte array. @param type the specified type @param val the byte array contains the value @return a constant of specified type with value converted from the byte array
[ "Constructs", "a", "new", "instance", "of", "the", "specified", "type", "with", "value", "converted", "from", "the", "input", "byte", "array", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/sql/Constant.java#L44-L56
dlemmermann/PreferencesFX
preferencesfx/src/main/java/com/dlsc/preferencesfx/view/NavigationPresenter.java
NavigationPresenter.setupCellValueFactory
public void setupCellValueFactory() { navigationView.treeView.setCellFactory(param -> new TreeCell<Category>() { @Override protected void updateItem(Category category, boolean empty) { super.updateItem(category, empty); textProperty().unbind(); if (empty || category == null) { setText(null); setGraphic(null); } else { textProperty().bind(category.descriptionProperty()); setGraphic(category.getItemIcon()); } } }); }
java
public void setupCellValueFactory() { navigationView.treeView.setCellFactory(param -> new TreeCell<Category>() { @Override protected void updateItem(Category category, boolean empty) { super.updateItem(category, empty); textProperty().unbind(); if (empty || category == null) { setText(null); setGraphic(null); } else { textProperty().bind(category.descriptionProperty()); setGraphic(category.getItemIcon()); } } }); }
[ "public", "void", "setupCellValueFactory", "(", ")", "{", "navigationView", ".", "treeView", ".", "setCellFactory", "(", "param", "->", "new", "TreeCell", "<", "Category", ">", "(", ")", "{", "@", "Override", "protected", "void", "updateItem", "(", "Category",...
Makes the TreeItems' text update when the description of a Category changes (due to i18n).
[ "Makes", "the", "TreeItems", "text", "update", "when", "the", "description", "of", "a", "Category", "changes", "(", "due", "to", "i18n", ")", "." ]
train
https://github.com/dlemmermann/PreferencesFX/blob/e06a49663ec949c2f7eb56e6b5952c030ed42d33/preferencesfx/src/main/java/com/dlsc/preferencesfx/view/NavigationPresenter.java#L147-L162
zxing/zxing
core/src/main/java/com/google/zxing/maxicode/MaxiCodeReader.java
MaxiCodeReader.extractPureBits
private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException { int[] enclosingRectangle = image.getEnclosingRectangle(); if (enclosingRectangle == null) { throw NotFoundException.getNotFoundInstance(); } int left = enclosingRectangle[0]; int top = enclosingRectangle[1]; int width = enclosingRectangle[2]; int height = enclosingRectangle[3]; // Now just read off the bits BitMatrix bits = new BitMatrix(MATRIX_WIDTH, MATRIX_HEIGHT); for (int y = 0; y < MATRIX_HEIGHT; y++) { int iy = top + (y * height + height / 2) / MATRIX_HEIGHT; for (int x = 0; x < MATRIX_WIDTH; x++) { int ix = left + (x * width + width / 2 + (y & 0x01) * width / 2) / MATRIX_WIDTH; if (image.get(ix, iy)) { bits.set(x, y); } } } return bits; }
java
private static BitMatrix extractPureBits(BitMatrix image) throws NotFoundException { int[] enclosingRectangle = image.getEnclosingRectangle(); if (enclosingRectangle == null) { throw NotFoundException.getNotFoundInstance(); } int left = enclosingRectangle[0]; int top = enclosingRectangle[1]; int width = enclosingRectangle[2]; int height = enclosingRectangle[3]; // Now just read off the bits BitMatrix bits = new BitMatrix(MATRIX_WIDTH, MATRIX_HEIGHT); for (int y = 0; y < MATRIX_HEIGHT; y++) { int iy = top + (y * height + height / 2) / MATRIX_HEIGHT; for (int x = 0; x < MATRIX_WIDTH; x++) { int ix = left + (x * width + width / 2 + (y & 0x01) * width / 2) / MATRIX_WIDTH; if (image.get(ix, iy)) { bits.set(x, y); } } } return bits; }
[ "private", "static", "BitMatrix", "extractPureBits", "(", "BitMatrix", "image", ")", "throws", "NotFoundException", "{", "int", "[", "]", "enclosingRectangle", "=", "image", ".", "getEnclosingRectangle", "(", ")", ";", "if", "(", "enclosingRectangle", "==", "null"...
This method detects a code in a "pure" image -- that is, pure monochrome image which contains only an unrotated, unskewed, image of a code, with some white border around it. This is a specialized method that works exceptionally fast in this special case.
[ "This", "method", "detects", "a", "code", "in", "a", "pure", "image", "--", "that", "is", "pure", "monochrome", "image", "which", "contains", "only", "an", "unrotated", "unskewed", "image", "of", "a", "code", "with", "some", "white", "border", "around", "i...
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/maxicode/MaxiCodeReader.java#L86-L110
mahjong4j/mahjong4j
src/main/java/org/mahjong4j/hands/Kantsu.java
Kantsu.check
public static boolean check(Tile tile1, Tile tile2, Tile tile3, Tile tile4) { return tile1 == tile2 && tile2 == tile3 && tile3 == tile4; }
java
public static boolean check(Tile tile1, Tile tile2, Tile tile3, Tile tile4) { return tile1 == tile2 && tile2 == tile3 && tile3 == tile4; }
[ "public", "static", "boolean", "check", "(", "Tile", "tile1", ",", "Tile", "tile2", ",", "Tile", "tile3", ",", "Tile", "tile4", ")", "{", "return", "tile1", "==", "tile2", "&&", "tile2", "==", "tile3", "&&", "tile3", "==", "tile4", ";", "}" ]
tile1~4が同一の牌かを調べます @param tile1 1枚目 @param tile2 2枚目 @param tile3 3枚目 @param tile4 4枚目 @return 槓子の場合true 槓子でない場合false
[ "tile1~4が同一の牌かを調べます" ]
train
https://github.com/mahjong4j/mahjong4j/blob/caa75963286b631ad51953d0d8c71cf6bf79b8f4/src/main/java/org/mahjong4j/hands/Kantsu.java#L52-L54
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/aggregate/CrossTab.java
CrossTab.rowPercents
public static Table rowPercents(Table table, String column1, String column2) { return rowPercents(table, table.categoricalColumn(column1), table.categoricalColumn(column2)); }
java
public static Table rowPercents(Table table, String column1, String column2) { return rowPercents(table, table.categoricalColumn(column1), table.categoricalColumn(column2)); }
[ "public", "static", "Table", "rowPercents", "(", "Table", "table", ",", "String", "column1", ",", "String", "column2", ")", "{", "return", "rowPercents", "(", "table", ",", "table", ".", "categoricalColumn", "(", "column1", ")", ",", "table", ".", "categoric...
Returns a table containing the row percents made from a source table, after first calculating the counts cross-tabulated from the given columns
[ "Returns", "a", "table", "containing", "the", "row", "percents", "made", "from", "a", "source", "table", "after", "first", "calculating", "the", "counts", "cross", "-", "tabulated", "from", "the", "given", "columns" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/aggregate/CrossTab.java#L270-L272
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsMatchingText
public Elements getElementsMatchingText(String regex) { Pattern pattern; try { pattern = Pattern.compile(regex); } catch (PatternSyntaxException e) { throw new IllegalArgumentException("Pattern syntax error: " + regex, e); } return getElementsMatchingText(pattern); }
java
public Elements getElementsMatchingText(String regex) { Pattern pattern; try { pattern = Pattern.compile(regex); } catch (PatternSyntaxException e) { throw new IllegalArgumentException("Pattern syntax error: " + regex, e); } return getElementsMatchingText(pattern); }
[ "public", "Elements", "getElementsMatchingText", "(", "String", "regex", ")", "{", "Pattern", "pattern", ";", "try", "{", "pattern", "=", "Pattern", ".", "compile", "(", "regex", ")", ";", "}", "catch", "(", "PatternSyntaxException", "e", ")", "{", "throw", ...
Find elements whose text matches the supplied regular expression. @param regex regular expression to match text against. You can use <a href="http://java.sun.com/docs/books/tutorial/essential/regex/pattern.html#embedded">embedded flags</a> (such as (?i) and (?m) to control regex options. @return elements matching the supplied regular expression. @see Element#text()
[ "Find", "elements", "whose", "text", "matches", "the", "supplied", "regular", "expression", "." ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L1003-L1011
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java
CmsXmlContentPropertyHelper.getPropValueIds
public static String getPropValueIds(CmsObject cms, String type, String value) { if (PropType.isVfsList(type)) { return convertPathsToIds(cms, value); } return value; }
java
public static String getPropValueIds(CmsObject cms, String type, String value) { if (PropType.isVfsList(type)) { return convertPathsToIds(cms, value); } return value; }
[ "public", "static", "String", "getPropValueIds", "(", "CmsObject", "cms", ",", "String", "type", ",", "String", "value", ")", "{", "if", "(", "PropType", ".", "isVfsList", "(", "type", ")", ")", "{", "return", "convertPathsToIds", "(", "cms", ",", "value",...
Returns a converted property value depending on the given type.<p> If the type is {@link CmsXmlContentProperty.PropType#vfslist}, the value is parsed as a list of paths and converted to a list of IDs.<p> @param cms the current CMS context @param type the property type @param value the raw property value @return a converted property value depending on the given type
[ "Returns", "a", "converted", "property", "value", "depending", "on", "the", "given", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L309-L315
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createRectangle
public Shape createRectangle(final int x, final int y, final int w, final int h) { return createRoundRectangleInternal(x, y, w, h, 0, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.SQUARE); }
java
public Shape createRectangle(final int x, final int y, final int w, final int h) { return createRoundRectangleInternal(x, y, w, h, 0, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.SQUARE); }
[ "public", "Shape", "createRectangle", "(", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ")", "{", "return", "createRoundRectangleInternal", "(", "x", ",", "y", ",", "w", ",", "h", ",", "0", ",", ...
Return a path for a rectangle with square corners. @param x the X coordinate of the upper-left corner of the rectangle @param y the Y coordinate of the upper-left corner of the rectangle @param w the width of the rectangle @param h the height of the rectangle @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "rectangle", "with", "square", "corners", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L194-L196
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java
BinarySearch.searchDescending
public static int searchDescending(byte[] byteArray, byte value) { int start = 0; int end = byteArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == byteArray[middle]) { return middle; } if(value > byteArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
java
public static int searchDescending(byte[] byteArray, byte value) { int start = 0; int end = byteArray.length - 1; int middle = 0; while(start <= end) { middle = (start + end) >> 1; if(value == byteArray[middle]) { return middle; } if(value > byteArray[middle]) { end = middle - 1 ; } else { start = middle + 1; } } return -1; }
[ "public", "static", "int", "searchDescending", "(", "byte", "[", "]", "byteArray", ",", "byte", "value", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "byteArray", ".", "length", "-", "1", ";", "int", "middle", "=", "0", ";", "while", ...
Search for the value in the reverse sorted byte array and return the index. @param byteArray array that we are searching in. @param value value that is being searched in the array. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "reverse", "sorted", "byte", "array", "and", "return", "the", "index", "." ]
train
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/logarithmic/BinarySearch.java#L473-L495
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java
ExtraLanguagePreferenceAccess.parseConverterPreferenceValue
public static boolean parseConverterPreferenceValue(String input, Procedure2<? super String, ? super String> output) { final StringTokenizer tokenizer = new StringTokenizer(input, PREFERENCE_SEPARATOR); String key = null; boolean foundValue = false; while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); if (key != null) { output.apply(key, token); foundValue = true; key = null; } else { key = token; } } return foundValue; }
java
public static boolean parseConverterPreferenceValue(String input, Procedure2<? super String, ? super String> output) { final StringTokenizer tokenizer = new StringTokenizer(input, PREFERENCE_SEPARATOR); String key = null; boolean foundValue = false; while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); if (key != null) { output.apply(key, token); foundValue = true; key = null; } else { key = token; } } return foundValue; }
[ "public", "static", "boolean", "parseConverterPreferenceValue", "(", "String", "input", ",", "Procedure2", "<", "?", "super", "String", ",", "?", "super", "String", ">", "output", ")", "{", "final", "StringTokenizer", "tokenizer", "=", "new", "StringTokenizer", ...
Parse the given input which is the preference string representation. @param input the string representation from the preferences. @param output the function to call for saving the parsed element. The first parameter is the element to be converted. The second parameter is the target string. @return {@code true} if a data was parsed. {@code false} if no value was parsed.
[ "Parse", "the", "given", "input", "which", "is", "the", "preference", "string", "representation", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L271-L286
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java
PAbstractObject.getLong
@Override public final long getLong(final String key) { Long result = optLong(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
@Override public final long getLong(final String key) { Long result = optLong(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
[ "@", "Override", "public", "final", "long", "getLong", "(", "final", "String", "key", ")", "{", "Long", "result", "=", "optLong", "(", "key", ")", ";", "if", "(", "result", "==", "null", ")", "{", "throw", "new", "ObjectMissingException", "(", "this", ...
Get a property as an long or throw an exception. @param key the property name
[ "Get", "a", "property", "as", "an", "long", "or", "throw", "an", "exception", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L76-L83
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/step/SqlgVertexStep.java
SqlgVertexStep.elements
private ListIterator<List<Emit<E>>> elements(SchemaTable schemaTable, SchemaTableTree rootSchemaTableTree) { this.sqlgGraph.tx().readWrite(); if (this.sqlgGraph.getSqlDialect().supportsBatchMode() && this.sqlgGraph.tx().getBatchManager().isStreaming()) { throw new IllegalStateException("streaming is in progress, first flush or commit before querying."); } this.replacedStepTree.maybeAddLabelToLeafNodes(); rootSchemaTableTree.setParentIdsAndIndexes(this.schemaTableParentIds.get(schemaTable)); Set<SchemaTableTree> rootSchemaTableTrees = new HashSet<>(); rootSchemaTableTrees.add(rootSchemaTableTree); return new SqlgCompiledResultListIterator<>(new SqlgCompiledResultIterator<>(this.sqlgGraph, rootSchemaTableTrees, true)); }
java
private ListIterator<List<Emit<E>>> elements(SchemaTable schemaTable, SchemaTableTree rootSchemaTableTree) { this.sqlgGraph.tx().readWrite(); if (this.sqlgGraph.getSqlDialect().supportsBatchMode() && this.sqlgGraph.tx().getBatchManager().isStreaming()) { throw new IllegalStateException("streaming is in progress, first flush or commit before querying."); } this.replacedStepTree.maybeAddLabelToLeafNodes(); rootSchemaTableTree.setParentIdsAndIndexes(this.schemaTableParentIds.get(schemaTable)); Set<SchemaTableTree> rootSchemaTableTrees = new HashSet<>(); rootSchemaTableTrees.add(rootSchemaTableTree); return new SqlgCompiledResultListIterator<>(new SqlgCompiledResultIterator<>(this.sqlgGraph, rootSchemaTableTrees, true)); }
[ "private", "ListIterator", "<", "List", "<", "Emit", "<", "E", ">", ">", ">", "elements", "(", "SchemaTable", "schemaTable", ",", "SchemaTableTree", "rootSchemaTableTree", ")", "{", "this", ".", "sqlgGraph", ".", "tx", "(", ")", ".", "readWrite", "(", ")",...
Called from SqlgVertexStepCompiler which compiled VertexStep and HasSteps. This is only called when not in BatchMode
[ "Called", "from", "SqlgVertexStepCompiler", "which", "compiled", "VertexStep", "and", "HasSteps", ".", "This", "is", "only", "called", "when", "not", "in", "BatchMode" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/step/SqlgVertexStep.java#L238-L248
haraldk/TwelveMonkeys
common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java
CollectionUtil.addAll
public static <E> void addAll(Collection<E> pCollection, Iterator<? extends E> pIterator) { while (pIterator.hasNext()) { pCollection.add(pIterator.next()); } }
java
public static <E> void addAll(Collection<E> pCollection, Iterator<? extends E> pIterator) { while (pIterator.hasNext()) { pCollection.add(pIterator.next()); } }
[ "public", "static", "<", "E", ">", "void", "addAll", "(", "Collection", "<", "E", ">", "pCollection", ",", "Iterator", "<", "?", "extends", "E", ">", "pIterator", ")", "{", "while", "(", "pIterator", ".", "hasNext", "(", ")", ")", "{", "pCollection", ...
Adds all elements of the iterator to the collection. @param pCollection the collection @param pIterator the elements to add @throws UnsupportedOperationException if {@code add} is not supported by the given collection. @throws ClassCastException class of the specified element prevents it from being added to this collection. @throws NullPointerException if the specified element is {@code null} and this collection does not support {@code null} elements. @throws IllegalArgumentException some aspect of this element prevents it from being added to this collection.
[ "Adds", "all", "elements", "of", "the", "iterator", "to", "the", "collection", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java#L414-L418
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java
JSONConverter.writeNotificationRegistration
public void writeNotificationRegistration(OutputStream out, NotificationRegistration value) throws IOException { writeStartObject(out); writeObjectNameField(out, OM_OBJECTNAME, value.objectName); writeNotificationFiltersField(out, OM_FILTERS, value.filters); writeEndObject(out); }
java
public void writeNotificationRegistration(OutputStream out, NotificationRegistration value) throws IOException { writeStartObject(out); writeObjectNameField(out, OM_OBJECTNAME, value.objectName); writeNotificationFiltersField(out, OM_FILTERS, value.filters); writeEndObject(out); }
[ "public", "void", "writeNotificationRegistration", "(", "OutputStream", "out", ",", "NotificationRegistration", "value", ")", "throws", "IOException", "{", "writeStartObject", "(", "out", ")", ";", "writeObjectNameField", "(", "out", ",", "OM_OBJECTNAME", ",", "value"...
Encode a NotificationRegistration instance as JSON: { "objectName" : ObjectName, "filters" : [ NotificationFilter* ] } @param out The stream to write JSON to @param value The NotificationRegistration instance to encode. Can't be null. See writeNotificationFilters() for requirements on the filters. @throws IOException If an I/O error occurs @see #readNotificationRegistration(InputStream) @see #writeNotificationFilters(OutputStream, NotificationFilter[])
[ "Encode", "a", "NotificationRegistration", "instance", "as", "JSON", ":", "{", "objectName", ":", "ObjectName", "filters", ":", "[", "NotificationFilter", "*", "]", "}" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java#L1483-L1488
jdereg/java-util
src/main/java/com/cedarsoftware/util/IOUtilities.java
IOUtilities.transfer
public static void transfer(InputStream in, byte[] bytes) throws IOException { // Read in the bytes int offset = 0; int numRead; while (offset < bytes.length && (numRead = in.read(bytes, offset, bytes.length - offset)) >= 0) { offset += numRead; } if (offset < bytes.length) { throw new IOException("Retry: Not all bytes were transferred correctly."); } }
java
public static void transfer(InputStream in, byte[] bytes) throws IOException { // Read in the bytes int offset = 0; int numRead; while (offset < bytes.length && (numRead = in.read(bytes, offset, bytes.length - offset)) >= 0) { offset += numRead; } if (offset < bytes.length) { throw new IOException("Retry: Not all bytes were transferred correctly."); } }
[ "public", "static", "void", "transfer", "(", "InputStream", "in", ",", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "// Read in the bytes", "int", "offset", "=", "0", ";", "int", "numRead", ";", "while", "(", "offset", "<", "bytes", ".", ...
Use this when you expect a byte[] length of bytes to be read from the InputStream
[ "Use", "this", "when", "you", "expect", "a", "byte", "[]", "length", "of", "bytes", "to", "be", "read", "from", "the", "InputStream" ]
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/IOUtilities.java#L132-L146
mangstadt/biweekly
src/main/java/biweekly/util/com/google/ical/iter/Util.java
Util.nextWeekStart
static DateValue nextWeekStart(DateValue date, DayOfWeek weekday) { DTBuilder builder = new DTBuilder(date); builder.day += (7 - ((7 + (TimeUtils.dayOfWeek(date).getCalendarConstant() - weekday.getCalendarConstant())) % 7)) % 7; return builder.toDate(); }
java
static DateValue nextWeekStart(DateValue date, DayOfWeek weekday) { DTBuilder builder = new DTBuilder(date); builder.day += (7 - ((7 + (TimeUtils.dayOfWeek(date).getCalendarConstant() - weekday.getCalendarConstant())) % 7)) % 7; return builder.toDate(); }
[ "static", "DateValue", "nextWeekStart", "(", "DateValue", "date", ",", "DayOfWeek", "weekday", ")", "{", "DTBuilder", "builder", "=", "new", "DTBuilder", "(", "date", ")", ";", "builder", ".", "day", "+=", "(", "7", "-", "(", "(", "7", "+", "(", "TimeU...
<p> Advances the given date to next date that falls on the given weekday. If the given date already falls on the given weekday, then the same date is returned. </p> <p> For example, if the date is a Thursday, and the week start is Monday, this method will return a date value that is set to the next Monday (4 days in the future). </p> @param date the date @param weekday the day of the week that the week starts on @return the resultant date
[ "<p", ">", "Advances", "the", "given", "date", "to", "next", "date", "that", "falls", "on", "the", "given", "weekday", ".", "If", "the", "given", "date", "already", "falls", "on", "the", "given", "weekday", "then", "the", "same", "date", "is", "returned"...
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/Util.java#L69-L73
icode/ameba-utils
src/main/java/ameba/util/Assert.java
Assert.isBlank
public static void isBlank(String text, String message) { if (StringUtils.isBlank(text)) { throw new IllegalArgumentException(message); } }
java
public static void isBlank(String text, String message) { if (StringUtils.isBlank(text)) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "isBlank", "(", "String", "text", ",", "String", "message", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "text", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Assert that the given String is not empty; that is, it must not be {@code null} and not the empty String. <pre class="code">Assert.hasLength(name, "Name must not be empty");</pre> @param text the String to check @param message the exception message to use if the assertion fails @see org.apache.commons.lang3.StringUtils#isBlank
[ "Assert", "that", "the", "given", "String", "is", "not", "empty", ";", "that", "is", "it", "must", "not", "be", "{", "@code", "null", "}", "and", "not", "the", "empty", "String", ".", "<pre", "class", "=", "code", ">", "Assert", ".", "hasLength", "("...
train
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/Assert.java#L128-L132
Stratio/deep-spark
deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java
Cells.getByte
public Byte getByte(String nameSpace, String cellName) { return getValue(nameSpace, cellName, Byte.class); }
java
public Byte getByte(String nameSpace, String cellName) { return getValue(nameSpace, cellName, Byte.class); }
[ "public", "Byte", "getByte", "(", "String", "nameSpace", ",", "String", "cellName", ")", "{", "return", "getValue", "(", "nameSpace", ",", "cellName", ",", "Byte", ".", "class", ")", ";", "}" ]
Returns the {@code Byte} value of the {@link Cell} (associated to {@code table}) whose name iscellName, or null if this Cells object contains no cell whose name is cellName. @param nameSpace the name of the owning table @param cellName the name of the Cell we want to retrieve from this Cells object. @return the {@code Byte} value of the {@link Cell} (associated to {@code table}) whose name is cellName, or null if this Cells object contains no cell whose name is cellName
[ "Returns", "the", "{", "@code", "Byte", "}", "value", "of", "the", "{", "@link", "Cell", "}", "(", "associated", "to", "{", "@code", "table", "}", ")", "whose", "name", "iscellName", "or", "null", "if", "this", "Cells", "object", "contains", "no", "cel...
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L835-L837
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java
DiscordApiImpl.getOrCreateMessage
public Message getOrCreateMessage(TextChannel channel, JsonNode data) { long id = Long.parseLong(data.get("id").asText()); synchronized (messages) { return getCachedMessageById(id).orElseGet(() -> new MessageImpl(this, channel, data)); } }
java
public Message getOrCreateMessage(TextChannel channel, JsonNode data) { long id = Long.parseLong(data.get("id").asText()); synchronized (messages) { return getCachedMessageById(id).orElseGet(() -> new MessageImpl(this, channel, data)); } }
[ "public", "Message", "getOrCreateMessage", "(", "TextChannel", "channel", ",", "JsonNode", "data", ")", "{", "long", "id", "=", "Long", ".", "parseLong", "(", "data", ".", "get", "(", "\"id\"", ")", ".", "asText", "(", ")", ")", ";", "synchronized", "(",...
Gets or creates a new message object. @param channel The channel of the message. @param data The data of the message. @return The message for the given json object.
[ "Gets", "or", "creates", "a", "new", "message", "object", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/DiscordApiImpl.java#L859-L864
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/GroupApi.java
GroupApi.createVariable
public Variable createVariable(Object groupIdOrPath, String key, String value, Boolean isProtected) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("key", key, true) .withParam("value", value, true) .withParam("protected", isProtected); Response response = post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "variables"); return (response.readEntity(Variable.class)); }
java
public Variable createVariable(Object groupIdOrPath, String key, String value, Boolean isProtected) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("key", key, true) .withParam("value", value, true) .withParam("protected", isProtected); Response response = post(Response.Status.CREATED, formData, "groups", getGroupIdOrPath(groupIdOrPath), "variables"); return (response.readEntity(Variable.class)); }
[ "public", "Variable", "createVariable", "(", "Object", "groupIdOrPath", ",", "String", "key", ",", "String", "value", ",", "Boolean", "isProtected", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", ...
Create a new group variable. <pre><code>GitLab Endpoint: POST /groups/:id/variables</code></pre> @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path, required @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required @param value the value for the variable, required @param isProtected whether the variable is protected, optional @return a Variable instance with the newly created variable @throws GitLabApiException if any exception occurs during execution
[ "Create", "a", "new", "group", "variable", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GroupApi.java#L1093-L1101
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/tabView/TabViewRenderer.java
TabViewRenderer.getTabs
private List<UIComponent> getTabs(TabView tabView) { List<UIComponent> children = tabView.getChildren(); List<UIComponent> filtered = new ArrayList<UIComponent>(children.size()); for (UIComponent c : children) { if (c instanceof Tab) filtered.add(c); } return filtered; }
java
private List<UIComponent> getTabs(TabView tabView) { List<UIComponent> children = tabView.getChildren(); List<UIComponent> filtered = new ArrayList<UIComponent>(children.size()); for (UIComponent c : children) { if (c instanceof Tab) filtered.add(c); } return filtered; }
[ "private", "List", "<", "UIComponent", ">", "getTabs", "(", "TabView", "tabView", ")", "{", "List", "<", "UIComponent", ">", "children", "=", "tabView", ".", "getChildren", "(", ")", ";", "List", "<", "UIComponent", ">", "filtered", "=", "new", "ArrayList"...
Essentially, getTabs() does the same as getChildren(), but it filters everything that's not a tab. In particular, comments are ignored. See issue 77 (https://github.com/TheCoder4eu/BootsFaces-OSP/issues/77). @return
[ "Essentially", "getTabs", "()", "does", "the", "same", "as", "getChildren", "()", "but", "it", "filters", "everything", "that", "s", "not", "a", "tab", ".", "In", "particular", "comments", "are", "ignored", ".", "See", "issue", "77", "(", "https", ":", "...
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/tabView/TabViewRenderer.java#L334-L342
sd4324530/fastweixin
src/main/java/com/github/sd4324530/fastweixin/util/JSONUtil.java
JSONUtil.getStringFromJSONObject
public static Object getStringFromJSONObject(final String json, final String key) { requireNonNull(json, "json is null"); return JSON.parseObject(json).getString(key); }
java
public static Object getStringFromJSONObject(final String json, final String key) { requireNonNull(json, "json is null"); return JSON.parseObject(json).getString(key); }
[ "public", "static", "Object", "getStringFromJSONObject", "(", "final", "String", "json", ",", "final", "String", "key", ")", "{", "requireNonNull", "(", "json", ",", "\"json is null\"", ")", ";", "return", "JSON", ".", "parseObject", "(", "json", ")", ".", "...
从json获取指定key的字符串 @param json json字符串 @param key 字符串的key @return 指定key的值
[ "从json获取指定key的字符串" ]
train
https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/util/JSONUtil.java#L36-L39
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java
ImagePipeline.isInDiskCacheSync
public boolean isInDiskCacheSync(final Uri uri) { return isInDiskCacheSync(uri, ImageRequest.CacheChoice.SMALL) || isInDiskCacheSync(uri, ImageRequest.CacheChoice.DEFAULT); }
java
public boolean isInDiskCacheSync(final Uri uri) { return isInDiskCacheSync(uri, ImageRequest.CacheChoice.SMALL) || isInDiskCacheSync(uri, ImageRequest.CacheChoice.DEFAULT); }
[ "public", "boolean", "isInDiskCacheSync", "(", "final", "Uri", "uri", ")", "{", "return", "isInDiskCacheSync", "(", "uri", ",", "ImageRequest", ".", "CacheChoice", ".", "SMALL", ")", "||", "isInDiskCacheSync", "(", "uri", ",", "ImageRequest", ".", "CacheChoice",...
Returns whether the image is stored in the disk cache. Performs disk cache check synchronously. It is not recommended to use this unless you know what exactly you are doing. Disk cache check is a costly operation, the call will block the caller thread until the cache check is completed. @param uri the uri for the image to be looked up. @return true if the image was found in the disk cache, false otherwise.
[ "Returns", "whether", "the", "image", "is", "stored", "in", "the", "disk", "cache", ".", "Performs", "disk", "cache", "check", "synchronously", ".", "It", "is", "not", "recommended", "to", "use", "this", "unless", "you", "know", "what", "exactly", "you", "...
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java#L559-L562
sculptor/sculptor
sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/event/annotation/SubscribeBeanPostProcessor.java
SubscribeBeanPostProcessor.postProcessBeforeInitialization
@Override public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException { if (bean instanceof EventSubscriber) { Subscribe annotation = getAnnotation(bean.getClass(), beanName); if (annotation != null) { subscribers.put(beanName, annotation); } } return bean; }
java
@Override public Object postProcessBeforeInitialization(final Object bean, final String beanName) throws BeansException { if (bean instanceof EventSubscriber) { Subscribe annotation = getAnnotation(bean.getClass(), beanName); if (annotation != null) { subscribers.put(beanName, annotation); } } return bean; }
[ "@", "Override", "public", "Object", "postProcessBeforeInitialization", "(", "final", "Object", "bean", ",", "final", "String", "beanName", ")", "throws", "BeansException", "{", "if", "(", "bean", "instanceof", "EventSubscriber", ")", "{", "Subscribe", "annotation",...
Creates a map of subscriber bean names with the corresponding {@link Subscribe} annotations which is retrived from the <b>unproxied</b> bean.
[ "Creates", "a", "map", "of", "subscriber", "bean", "names", "with", "the", "corresponding", "{" ]
train
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-framework/sculptor-framework-main/src/main/java/org/sculptor/framework/event/annotation/SubscribeBeanPostProcessor.java#L55-L64
OpenLiberty/open-liberty
dev/com.ibm.ws.session.store/src/com/ibm/ws/session/store/common/BackedHashMap.java
BackedHashMap.isValidCopy
boolean isValidCopy(BackedSession sess, long nowTime, int versionId) { synchronized (sess) { if (!sess.isValid()) return false; int maxTime = sess.getMaxInactiveInterval(); boolean accBeforeTO = (sess.getCurrentAccessTime() >= nowTime - (1000 * (long) maxTime));//PK90548 boolean cacheIdMatch = (sess.getVersion() >= versionId); return (cacheIdMatch && (accBeforeTO || maxTime == -1)); } }
java
boolean isValidCopy(BackedSession sess, long nowTime, int versionId) { synchronized (sess) { if (!sess.isValid()) return false; int maxTime = sess.getMaxInactiveInterval(); boolean accBeforeTO = (sess.getCurrentAccessTime() >= nowTime - (1000 * (long) maxTime));//PK90548 boolean cacheIdMatch = (sess.getVersion() >= versionId); return (cacheIdMatch && (accBeforeTO || maxTime == -1)); } }
[ "boolean", "isValidCopy", "(", "BackedSession", "sess", ",", "long", "nowTime", ",", "int", "versionId", ")", "{", "synchronized", "(", "sess", ")", "{", "if", "(", "!", "sess", ".", "isValid", "(", ")", ")", "return", "false", ";", "int", "maxTime", "...
/* isValidCopy - determines if the cached session is still valid
[ "/", "*", "isValidCopy", "-", "determines", "if", "the", "cached", "session", "is", "still", "valid" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.store/src/com/ibm/ws/session/store/common/BackedHashMap.java#L236-L247
alibaba/ARouter
arouter-annotation/src/main/java/com/alibaba/android/arouter/facade/model/RouteMeta.java
RouteMeta.build
public static RouteMeta build(RouteType type, Class<?> destination, String path, String group, int priority, int extra) { return new RouteMeta(type, null, destination, null, path, group, null, priority, extra); }
java
public static RouteMeta build(RouteType type, Class<?> destination, String path, String group, int priority, int extra) { return new RouteMeta(type, null, destination, null, path, group, null, priority, extra); }
[ "public", "static", "RouteMeta", "build", "(", "RouteType", "type", ",", "Class", "<", "?", ">", "destination", ",", "String", "path", ",", "String", "group", ",", "int", "priority", ",", "int", "extra", ")", "{", "return", "new", "RouteMeta", "(", "type...
For versions of 'compiler' less than 1.0.7, contain 1.0.7 @param type type @param destination destination @param path path @param group group @param priority priority @param extra extra @return this
[ "For", "versions", "of", "compiler", "less", "than", "1", ".", "0", ".", "7", "contain", "1", ".", "0", ".", "7" ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-annotation/src/main/java/com/alibaba/android/arouter/facade/model/RouteMeta.java#L45-L47
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java
BusItinerary.insertBusHaltBefore
public BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, String name, BusItineraryHaltType type) { return this.insertBusHaltBefore(beforeHalt, null, name, type); }
java
public BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, String name, BusItineraryHaltType type) { return this.insertBusHaltBefore(beforeHalt, null, name, type); }
[ "public", "BusItineraryHalt", "insertBusHaltBefore", "(", "BusItineraryHalt", "beforeHalt", ",", "String", "name", ",", "BusItineraryHaltType", "type", ")", "{", "return", "this", ".", "insertBusHaltBefore", "(", "beforeHalt", ",", "null", ",", "name", ",", "type", ...
Insert newHalt before beforeHalt in the ordered list of {@link BusItineraryHalt}. @param beforeHalt the halt where insert the new halt @param name name of the new halt @param type the type of bus halt @return the added bus halt, otherwise <code>null</code>
[ "Insert", "newHalt", "before", "beforeHalt", "in", "the", "ordered", "list", "of", "{", "@link", "BusItineraryHalt", "}", ".", "@param", "beforeHalt", "the", "halt", "where", "insert", "the", "new", "halt", "@param", "name", "name", "of", "the", "new", "halt...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1236-L1238
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
OjbTagsHandler.forAllIndexDescriptorColumns
public void forAllIndexDescriptorColumns(String template, Properties attributes) throws XDocletException { String fields = _curIndexDescriptorDef.getProperty(PropertyHelper.OJB_PROPERTY_FIELDS); FieldDescriptorDef fieldDef; String name; for (CommaListIterator it = new CommaListIterator(fields); it.hasNext();) { name = it.getNext(); fieldDef = _curClassDef.getField(name); if (fieldDef == null) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.INDEX_FIELD_MISSING, new String[]{name, _curIndexDescriptorDef.getName(), _curClassDef.getName()})); } _curIndexColumn = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN); generate(template); } _curIndexColumn = null; }
java
public void forAllIndexDescriptorColumns(String template, Properties attributes) throws XDocletException { String fields = _curIndexDescriptorDef.getProperty(PropertyHelper.OJB_PROPERTY_FIELDS); FieldDescriptorDef fieldDef; String name; for (CommaListIterator it = new CommaListIterator(fields); it.hasNext();) { name = it.getNext(); fieldDef = _curClassDef.getField(name); if (fieldDef == null) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.INDEX_FIELD_MISSING, new String[]{name, _curIndexDescriptorDef.getName(), _curClassDef.getName()})); } _curIndexColumn = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN); generate(template); } _curIndexColumn = null; }
[ "public", "void", "forAllIndexDescriptorColumns", "(", "String", "template", ",", "Properties", "attributes", ")", "throws", "XDocletException", "{", "String", "fields", "=", "_curIndexDescriptorDef", ".", "getProperty", "(", "PropertyHelper", ".", "OJB_PROPERTY_FIELDS", ...
Processes the template for all index columns for the current index descriptor. @param template The template @param attributes The attributes of the tag @exception XDocletException if an error occurs @doc.tag type="block"
[ "Processes", "the", "template", "for", "all", "index", "columns", "for", "the", "current", "index", "descriptor", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L437-L457
ltsopensource/light-task-scheduler
lts-core/src/main/java/com/github/ltsopensource/store/mongo/MongoTemplate.java
MongoTemplate.ensureIndex
public void ensureIndex(String collName, String name, String fields, boolean unique, boolean dropDupsOnCreate) { BasicDBObject dbFields = parseFieldsString(fields); final BasicDBObjectBuilder keyOpts = new BasicDBObjectBuilder(); if (name != null && name.length() != 0) { keyOpts.add("name", name); } if (unique) { keyOpts.add("unique", true); if (dropDupsOnCreate) { keyOpts.add("dropDups", true); } } final DBCollection dbColl = getCollection(getCollName(collName)); final BasicDBObject opts = (BasicDBObject) keyOpts.get(); if (opts.isEmpty()) { LOGGER.debug("Ensuring index for " + dbColl.getName() + " with keys:" + dbFields); dbColl.createIndex(dbFields); } else { LOGGER.debug("Ensuring index for " + dbColl.getName() + " with keys:" + fields + " and opts:" + opts); dbColl.createIndex(dbFields, opts); } }
java
public void ensureIndex(String collName, String name, String fields, boolean unique, boolean dropDupsOnCreate) { BasicDBObject dbFields = parseFieldsString(fields); final BasicDBObjectBuilder keyOpts = new BasicDBObjectBuilder(); if (name != null && name.length() != 0) { keyOpts.add("name", name); } if (unique) { keyOpts.add("unique", true); if (dropDupsOnCreate) { keyOpts.add("dropDups", true); } } final DBCollection dbColl = getCollection(getCollName(collName)); final BasicDBObject opts = (BasicDBObject) keyOpts.get(); if (opts.isEmpty()) { LOGGER.debug("Ensuring index for " + dbColl.getName() + " with keys:" + dbFields); dbColl.createIndex(dbFields); } else { LOGGER.debug("Ensuring index for " + dbColl.getName() + " with keys:" + fields + " and opts:" + opts); dbColl.createIndex(dbFields, opts); } }
[ "public", "void", "ensureIndex", "(", "String", "collName", ",", "String", "name", ",", "String", "fields", ",", "boolean", "unique", ",", "boolean", "dropDupsOnCreate", ")", "{", "BasicDBObject", "dbFields", "=", "parseFieldsString", "(", "fields", ")", ";", ...
Ensures (creating if necessary) the index including the field(s) + directions; eg fields = "field1, -field2" ({field1:1, field2:-1})
[ "Ensures", "(", "creating", "if", "necessary", ")", "the", "index", "including", "the", "field", "(", "s", ")", "+", "directions", ";", "eg", "fields", "=", "field1", "-", "field2", "(", "{", "field1", ":", "1", "field2", ":", "-", "1", "}", ")" ]
train
https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/store/mongo/MongoTemplate.java#L84-L109
JodaOrg/joda-time
src/main/java/org/joda/time/base/BaseDuration.java
BaseDuration.toPeriod
public Period toPeriod(PeriodType type, Chronology chrono) { return new Period(getMillis(), type, chrono); }
java
public Period toPeriod(PeriodType type, Chronology chrono) { return new Period(getMillis(), type, chrono); }
[ "public", "Period", "toPeriod", "(", "PeriodType", "type", ",", "Chronology", "chrono", ")", "{", "return", "new", "Period", "(", "getMillis", "(", ")", ",", "type", ",", "chrono", ")", ";", "}" ]
Converts this duration to a Period instance using the specified period type and chronology. <p> Only precise fields in the period type will be used. Exactly which fields are precise depends on the chronology. Only the time fields are precise for ISO chronology with a time zone. However, ISO UTC also has precise days and weeks. <p> For more control over the conversion process, you must pair the duration with an instant, see {@link #toPeriodFrom(ReadableInstant, PeriodType)} and {@link #toPeriodTo(ReadableInstant, PeriodType)} @param type the period type to use, null means standard @param chrono the chronology to use, null means ISO default @return a Period created using the millisecond duration from this instance
[ "Converts", "this", "duration", "to", "a", "Period", "instance", "using", "the", "specified", "period", "type", "and", "chronology", ".", "<p", ">", "Only", "precise", "fields", "in", "the", "period", "type", "will", "be", "used", ".", "Exactly", "which", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/base/BaseDuration.java#L184-L186
VoltDB/voltdb
src/frontend/org/voltdb/ProcedureStatsCollector.java
ProcedureStatsCollector.beginProcedure
public final SingleCallStatsToken beginProcedure() { long invocations = fuzzyInvocationCounter.getAndIncrement(); boolean samplingProcedure = (invocations % m_procSamplingInterval == 0) || m_isUAC; boolean samplingStmts = invocations % m_stmtSamplingInterval == 0; long startTimeNanos = samplingProcedure ? System.nanoTime() : 0; return new SingleCallStatsToken(startTimeNanos, samplingStmts); }
java
public final SingleCallStatsToken beginProcedure() { long invocations = fuzzyInvocationCounter.getAndIncrement(); boolean samplingProcedure = (invocations % m_procSamplingInterval == 0) || m_isUAC; boolean samplingStmts = invocations % m_stmtSamplingInterval == 0; long startTimeNanos = samplingProcedure ? System.nanoTime() : 0; return new SingleCallStatsToken(startTimeNanos, samplingStmts); }
[ "public", "final", "SingleCallStatsToken", "beginProcedure", "(", ")", "{", "long", "invocations", "=", "fuzzyInvocationCounter", ".", "getAndIncrement", "(", ")", ";", "boolean", "samplingProcedure", "=", "(", "invocations", "%", "m_procSamplingInterval", "==", "0", ...
Called when a procedure begins executing. Caches the time the procedure starts. Note: This does not touch internal mutable state besides fuzzyInvocationCounter.
[ "Called", "when", "a", "procedure", "begins", "executing", ".", "Caches", "the", "time", "the", "procedure", "starts", ".", "Note", ":", "This", "does", "not", "touch", "internal", "mutable", "state", "besides", "fuzzyInvocationCounter", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ProcedureStatsCollector.java#L120-L129
FasterXML/woodstox
src/main/java/com/ctc/wstx/sw/BaseNsStreamWriter.java
BaseNsStreamWriter.checkStartElement
protected void checkStartElement(String localName, String prefix) throws XMLStreamException { // Need to finish an open start element? if (mStartElementOpen) { closeStartElement(mEmptyElement); } else if (mState == STATE_PROLOG) { verifyRootElement(localName, prefix); } else if (mState == STATE_EPILOG) { if (mCheckStructure) { String name = (prefix == null || prefix.length() == 0) ? localName : (prefix + ":" + localName); reportNwfStructure(ErrorConsts.WERR_PROLOG_SECOND_ROOT, name); } /* When outputting a fragment, need to reset this to the * tree. No point in trying to verify the root element? */ mState = STATE_TREE; } }
java
protected void checkStartElement(String localName, String prefix) throws XMLStreamException { // Need to finish an open start element? if (mStartElementOpen) { closeStartElement(mEmptyElement); } else if (mState == STATE_PROLOG) { verifyRootElement(localName, prefix); } else if (mState == STATE_EPILOG) { if (mCheckStructure) { String name = (prefix == null || prefix.length() == 0) ? localName : (prefix + ":" + localName); reportNwfStructure(ErrorConsts.WERR_PROLOG_SECOND_ROOT, name); } /* When outputting a fragment, need to reset this to the * tree. No point in trying to verify the root element? */ mState = STATE_TREE; } }
[ "protected", "void", "checkStartElement", "(", "String", "localName", ",", "String", "prefix", ")", "throws", "XMLStreamException", "{", "// Need to finish an open start element?", "if", "(", "mStartElementOpen", ")", "{", "closeStartElement", "(", "mEmptyElement", ")", ...
Method that is called to ensure that we can start writing an element, both from structural point of view, and from syntactic (close previously open start element, if any).
[ "Method", "that", "is", "called", "to", "ensure", "that", "we", "can", "start", "writing", "an", "element", "both", "from", "structural", "point", "of", "view", "and", "from", "syntactic", "(", "close", "previously", "open", "start", "element", "if", "any", ...
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sw/BaseNsStreamWriter.java#L471-L490
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java
CompletionUtils.findAllTypes
public static Map<String,RoboconfTypeBean> findAllTypes( File appDirectory ) { List<File> graphFiles = new ArrayList<> (); File graphDirectory = appDirectory; if( graphDirectory != null && graphDirectory.exists()) graphFiles = Utils.listAllFiles( graphDirectory, Constants.FILE_EXT_GRAPH ); Map<String,RoboconfTypeBean> result = new HashMap<> (); for( File f : graphFiles ) { try { FromGraphDefinition converter = new FromGraphDefinition( appDirectory, true ); Graphs g = converter.buildGraphs( f ); Collection<AbstractType> types = new ArrayList<> (); types.addAll( ComponentHelpers.findAllComponents( g )); types.addAll( g.getFacetNameToFacet().values()); for( AbstractType type : types ) { RoboconfTypeBean bean = new RoboconfTypeBean( type.getName(), converter.getTypeAnnotations().get( type.getName()), type instanceof Facet ); result.put( type.getName(), bean ); for( Map.Entry<String,String> entry : ComponentHelpers.findAllExportedVariables( type ).entrySet()) { bean.exportedVariables.put( entry.getKey(), entry.getValue()); } } } catch( Exception e ) { Logger logger = Logger.getLogger( CompletionUtils.class.getName()); Utils.logException( logger, e ); } } return result; }
java
public static Map<String,RoboconfTypeBean> findAllTypes( File appDirectory ) { List<File> graphFiles = new ArrayList<> (); File graphDirectory = appDirectory; if( graphDirectory != null && graphDirectory.exists()) graphFiles = Utils.listAllFiles( graphDirectory, Constants.FILE_EXT_GRAPH ); Map<String,RoboconfTypeBean> result = new HashMap<> (); for( File f : graphFiles ) { try { FromGraphDefinition converter = new FromGraphDefinition( appDirectory, true ); Graphs g = converter.buildGraphs( f ); Collection<AbstractType> types = new ArrayList<> (); types.addAll( ComponentHelpers.findAllComponents( g )); types.addAll( g.getFacetNameToFacet().values()); for( AbstractType type : types ) { RoboconfTypeBean bean = new RoboconfTypeBean( type.getName(), converter.getTypeAnnotations().get( type.getName()), type instanceof Facet ); result.put( type.getName(), bean ); for( Map.Entry<String,String> entry : ComponentHelpers.findAllExportedVariables( type ).entrySet()) { bean.exportedVariables.put( entry.getKey(), entry.getValue()); } } } catch( Exception e ) { Logger logger = Logger.getLogger( CompletionUtils.class.getName()); Utils.logException( logger, e ); } } return result; }
[ "public", "static", "Map", "<", "String", ",", "RoboconfTypeBean", ">", "findAllTypes", "(", "File", "appDirectory", ")", "{", "List", "<", "File", ">", "graphFiles", "=", "new", "ArrayList", "<>", "(", ")", ";", "File", "graphDirectory", "=", "appDirectory"...
Finds all the Roboconf types. @param appDirectory the application's directory (can be null) @return a non-null map of types (key = type name, value = type)
[ "Finds", "all", "the", "Roboconf", "types", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/autocompletion/CompletionUtils.java#L181-L218
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.copyStream
public static void copyStream(InputStream is, OutputStream os, int bufferSize) throws IOException { if (is == null) { throw MESSAGES.nullArgument("input stream"); } if (os == null) { throw MESSAGES.nullArgument("output stream"); } byte[] buff = new byte[bufferSize]; int rc; while ((rc = is.read(buff)) != -1) { os.write(buff, 0, rc); } os.flush(); }
java
public static void copyStream(InputStream is, OutputStream os, int bufferSize) throws IOException { if (is == null) { throw MESSAGES.nullArgument("input stream"); } if (os == null) { throw MESSAGES.nullArgument("output stream"); } byte[] buff = new byte[bufferSize]; int rc; while ((rc = is.read(buff)) != -1) { os.write(buff, 0, rc); } os.flush(); }
[ "public", "static", "void", "copyStream", "(", "InputStream", "is", ",", "OutputStream", "os", ",", "int", "bufferSize", ")", "throws", "IOException", "{", "if", "(", "is", "==", "null", ")", "{", "throw", "MESSAGES", ".", "nullArgument", "(", "\"input strea...
Copy input stream to output stream without closing streams. Flushes output stream when done. @param is input stream @param os output stream @param bufferSize the buffer size to use @throws IOException for any error
[ "Copy", "input", "stream", "to", "output", "stream", "without", "closing", "streams", ".", "Flushes", "output", "stream", "when", "done", "." ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L429-L441
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SequenceHandler.java
SequenceHandler.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record (Move the header record data down) if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE)) { double dControlValue = m_fldSource.getValue(); double dFieldValue = m_fldDest.getValue(); if (dControlValue == dFieldValue) iErrorCode = m_fldSource.setValue(dFieldValue + this.getBumpValue(), bDisplayOption, DBConstants.SCREEN_MOVE); else if (dControlValue < dFieldValue) iErrorCode = m_fldSource.moveFieldToThis(m_fldDest, bDisplayOption, DBConstants.SCREEN_MOVE); } return iErrorCode; }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record (Move the header record data down) if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE)) { double dControlValue = m_fldSource.getValue(); double dFieldValue = m_fldDest.getValue(); if (dControlValue == dFieldValue) iErrorCode = m_fldSource.setValue(dFieldValue + this.getBumpValue(), bDisplayOption, DBConstants.SCREEN_MOVE); else if (dControlValue < dFieldValue) iErrorCode = m_fldSource.moveFieldToThis(m_fldDest, bDisplayOption, DBConstants.SCREEN_MOVE); } return iErrorCode; }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "// Read a valid record", "int", "iErrorCode", "=", "super", ".", "doRecordChange", "(", "field", ",", "iChangeType", ",", "bDispla...
Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param iChangeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SequenceHandler.java#L73-L88
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setBaselineWork
public void setBaselineWork(int baselineNumber, Duration value) { set(selectField(TaskFieldLists.BASELINE_WORKS, baselineNumber), value); }
java
public void setBaselineWork(int baselineNumber, Duration value) { set(selectField(TaskFieldLists.BASELINE_WORKS, baselineNumber), value); }
[ "public", "void", "setBaselineWork", "(", "int", "baselineNumber", ",", "Duration", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "BASELINE_WORKS", ",", "baselineNumber", ")", ",", "value", ")", ";", "}" ]
Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value
[ "Set", "a", "baseline", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4024-L4027
meltmedia/cadmium
servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java
AbstractSecureRedirectStrategy.changeProtocolAndPort
public static URI changeProtocolAndPort(String protocol, int port, HttpServletRequest request) throws URISyntaxException { return changeProtocolAndPort( protocol, port, URI.create( request.getRequestURL() .append((StringUtils.isEmpty(request.getQueryString()) ? "" : "?" + request.getQueryString())) .toString())); }
java
public static URI changeProtocolAndPort(String protocol, int port, HttpServletRequest request) throws URISyntaxException { return changeProtocolAndPort( protocol, port, URI.create( request.getRequestURL() .append((StringUtils.isEmpty(request.getQueryString()) ? "" : "?" + request.getQueryString())) .toString())); }
[ "public", "static", "URI", "changeProtocolAndPort", "(", "String", "protocol", ",", "int", "port", ",", "HttpServletRequest", "request", ")", "throws", "URISyntaxException", "{", "return", "changeProtocolAndPort", "(", "protocol", ",", "port", ",", "URI", ".", "cr...
Constructs a URI for request and calls changeProtocolAndPort(String, int, URI). @param protocol the new protocol (scheme) in the resulting URI. @param port the new port in the resulting URI, or the default port if -1 is provided. @param request the request to use as the URI template. @return a new URI object with the updated protocol and port. @throws URISyntaxException
[ "Constructs", "a", "URI", "for", "request", "and", "calls", "changeProtocolAndPort", "(", "String", "int", "URI", ")", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java#L187-L195
vkostyukov/la4j
src/main/java/org/la4j/matrix/SparseMatrix.java
SparseMatrix.from1DArray
public static SparseMatrix from1DArray(int rows, int columns, double[] array) { return CRSMatrix.from1DArray(rows, columns, array); }
java
public static SparseMatrix from1DArray(int rows, int columns, double[] array) { return CRSMatrix.from1DArray(rows, columns, array); }
[ "public", "static", "SparseMatrix", "from1DArray", "(", "int", "rows", ",", "int", "columns", ",", "double", "[", "]", "array", ")", "{", "return", "CRSMatrix", ".", "from1DArray", "(", "rows", ",", "columns", ",", "array", ")", ";", "}" ]
Creates a new {@link SparseMatrix} from the given 1D {@code array} with compressing (copying) the underlying array.
[ "Creates", "a", "new", "{" ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/SparseMatrix.java#L109-L111
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java
EncodingUtils.encryptValueAsJwtRsaOeap256Aes256Sha512
public static String encryptValueAsJwtRsaOeap256Aes256Sha512(final Key key, final Serializable value) { return encryptValueAsJwt(key, value, KeyManagementAlgorithmIdentifiers.RSA_OAEP_256, CipherExecutor.DEFAULT_CONTENT_ENCRYPTION_ALGORITHM); }
java
public static String encryptValueAsJwtRsaOeap256Aes256Sha512(final Key key, final Serializable value) { return encryptValueAsJwt(key, value, KeyManagementAlgorithmIdentifiers.RSA_OAEP_256, CipherExecutor.DEFAULT_CONTENT_ENCRYPTION_ALGORITHM); }
[ "public", "static", "String", "encryptValueAsJwtRsaOeap256Aes256Sha512", "(", "final", "Key", "key", ",", "final", "Serializable", "value", ")", "{", "return", "encryptValueAsJwt", "(", "key", ",", "value", ",", "KeyManagementAlgorithmIdentifiers", ".", "RSA_OAEP_256", ...
Encrypt value as jwt rsa oeap 256 aes 256 sha 512 string. @param key the key @param value the value @return the string
[ "Encrypt", "value", "as", "jwt", "rsa", "oeap", "256", "aes", "256", "sha", "512", "string", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java#L390-L393
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java
QPath.getCommonAncestorPath
public static QPath getCommonAncestorPath(QPath firstPath, QPath secondPath) throws PathNotFoundException { if (!firstPath.getEntries()[0].equals(secondPath.getEntries()[0])) { throw new PathNotFoundException("For the given ways there is no common ancestor."); } List<QPathEntry> caEntries = new ArrayList<QPathEntry>(); for (int i = 0; i < firstPath.getEntries().length; i++) { if (firstPath.getEntries()[i].equals(secondPath.getEntries()[i])) { caEntries.add(firstPath.getEntries()[i]); } else { break; } } return new QPath(caEntries.toArray(new QPathEntry[caEntries.size()])); }
java
public static QPath getCommonAncestorPath(QPath firstPath, QPath secondPath) throws PathNotFoundException { if (!firstPath.getEntries()[0].equals(secondPath.getEntries()[0])) { throw new PathNotFoundException("For the given ways there is no common ancestor."); } List<QPathEntry> caEntries = new ArrayList<QPathEntry>(); for (int i = 0; i < firstPath.getEntries().length; i++) { if (firstPath.getEntries()[i].equals(secondPath.getEntries()[i])) { caEntries.add(firstPath.getEntries()[i]); } else { break; } } return new QPath(caEntries.toArray(new QPathEntry[caEntries.size()])); }
[ "public", "static", "QPath", "getCommonAncestorPath", "(", "QPath", "firstPath", ",", "QPath", "secondPath", ")", "throws", "PathNotFoundException", "{", "if", "(", "!", "firstPath", ".", "getEntries", "(", ")", "[", "0", "]", ".", "equals", "(", "secondPath",...
Get common ancestor path. @param firstPath @param secondPath @return The common ancestor of two paths. @throws PathNotFoundException
[ "Get", "common", "ancestor", "path", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java#L211-L233