repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java
DataService.addAsync
public <T extends IEntity> void addAsync(T entity, CallbackHandler callbackHandler) throws FMSException { """ Method to add the given entity in asynchronous fashion @param entity the entity @param callbackHandler the callback handler @throws FMSException throws FMSException """ IntuitMessage intuitMessage = prepareAdd(entity); //set callback handler intuitMessage.getRequestElements().setCallbackHandler(callbackHandler); //execute async interceptors executeAsyncInterceptors(intuitMessage); }
java
public <T extends IEntity> void addAsync(T entity, CallbackHandler callbackHandler) throws FMSException { IntuitMessage intuitMessage = prepareAdd(entity); //set callback handler intuitMessage.getRequestElements().setCallbackHandler(callbackHandler); //execute async interceptors executeAsyncInterceptors(intuitMessage); }
[ "public", "<", "T", "extends", "IEntity", ">", "void", "addAsync", "(", "T", "entity", ",", "CallbackHandler", "callbackHandler", ")", "throws", "FMSException", "{", "IntuitMessage", "intuitMessage", "=", "prepareAdd", "(", "entity", ")", ";", "//set callback handler", "intuitMessage", ".", "getRequestElements", "(", ")", ".", "setCallbackHandler", "(", "callbackHandler", ")", ";", "//execute async interceptors", "executeAsyncInterceptors", "(", "intuitMessage", ")", ";", "}" ]
Method to add the given entity in asynchronous fashion @param entity the entity @param callbackHandler the callback handler @throws FMSException throws FMSException
[ "Method", "to", "add", "the", "given", "entity", "in", "asynchronous", "fashion" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L757-L766
jhalterman/failsafe
src/main/java/net/jodah/failsafe/FailsafeExecutor.java
FailsafeExecutor.getAsyncExecution
public <T extends R> CompletableFuture<T> getAsyncExecution(AsyncSupplier<T> supplier) { """ Executes the {@code supplier} asynchronously until a successful result is returned or the configured policies are exceeded. This method is intended for integration with asynchronous code. Retries must be manually scheduled via one of the {@code AsyncExecution.retry} methods. <p> If a configured circuit breaker is open, the resulting future is completed with {@link CircuitBreakerOpenException}. @throws NullPointerException if the {@code supplier} is null @throws RejectedExecutionException if the {@code supplier} cannot be scheduled for execution """ return callAsync(execution -> Functions.asyncOfExecution(supplier, execution), true); }
java
public <T extends R> CompletableFuture<T> getAsyncExecution(AsyncSupplier<T> supplier) { return callAsync(execution -> Functions.asyncOfExecution(supplier, execution), true); }
[ "public", "<", "T", "extends", "R", ">", "CompletableFuture", "<", "T", ">", "getAsyncExecution", "(", "AsyncSupplier", "<", "T", ">", "supplier", ")", "{", "return", "callAsync", "(", "execution", "->", "Functions", ".", "asyncOfExecution", "(", "supplier", ",", "execution", ")", ",", "true", ")", ";", "}" ]
Executes the {@code supplier} asynchronously until a successful result is returned or the configured policies are exceeded. This method is intended for integration with asynchronous code. Retries must be manually scheduled via one of the {@code AsyncExecution.retry} methods. <p> If a configured circuit breaker is open, the resulting future is completed with {@link CircuitBreakerOpenException}. @throws NullPointerException if the {@code supplier} is null @throws RejectedExecutionException if the {@code supplier} cannot be scheduled for execution
[ "Executes", "the", "{", "@code", "supplier", "}", "asynchronously", "until", "a", "successful", "result", "is", "returned", "or", "the", "configured", "policies", "are", "exceeded", ".", "This", "method", "is", "intended", "for", "integration", "with", "asynchronous", "code", ".", "Retries", "must", "be", "manually", "scheduled", "via", "one", "of", "the", "{", "@code", "AsyncExecution", ".", "retry", "}", "methods", ".", "<p", ">", "If", "a", "configured", "circuit", "breaker", "is", "open", "the", "resulting", "future", "is", "completed", "with", "{", "@link", "CircuitBreakerOpenException", "}", "." ]
train
https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/FailsafeExecutor.java#L123-L125
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/ObjectsApi.java
ObjectsApi.getPermissionsAsync
public com.squareup.okhttp.Call getPermissionsAsync(String objectType, String dbids, String dnType, String folderType, final ApiCallback<GetPermissionsSuccessResponse> callback) throws ApiException { """ Get permissions for a list of objects. (asynchronously) Get permissions from Configuration Server for objects identified by their type and DBIDs. @param objectType The type of object. Any type supported by the Config server (folders, business-attributes etc). (required) @param dbids Comma-separated list of object DBIDs to query permissions. (required) @param dnType If the object_type is &#39;dns&#39;, then you may specify the DN type (for example, CFGRoutingPoint). This parameter does not affect request results but may increase performance For possible values, see [CfgDNType](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgDNType) in the Platform SDK documentation. (optional) @param folderType If the object_type is &#39;folders&#39;, then you may specify the object type of the folders (for example, CFGPerson). This parameter does not affect request results but may increase performance For possible values, see [CfgObjectType](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgObjectType) in the Platform SDK documentation. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getPermissionsValidateBeforeCall(objectType, dbids, dnType, folderType, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<GetPermissionsSuccessResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getPermissionsAsync(String objectType, String dbids, String dnType, String folderType, final ApiCallback<GetPermissionsSuccessResponse> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getPermissionsValidateBeforeCall(objectType, dbids, dnType, folderType, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<GetPermissionsSuccessResponse>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getPermissionsAsync", "(", "String", "objectType", ",", "String", "dbids", ",", "String", "dnType", ",", "String", "folderType", ",", "final", "ApiCallback", "<", "GetPermissionsSuccessResponse", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "getPermissionsValidateBeforeCall", "(", "objectType", ",", "dbids", ",", "dnType", ",", "folderType", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "GetPermissionsSuccessResponse", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
Get permissions for a list of objects. (asynchronously) Get permissions from Configuration Server for objects identified by their type and DBIDs. @param objectType The type of object. Any type supported by the Config server (folders, business-attributes etc). (required) @param dbids Comma-separated list of object DBIDs to query permissions. (required) @param dnType If the object_type is &#39;dns&#39;, then you may specify the DN type (for example, CFGRoutingPoint). This parameter does not affect request results but may increase performance For possible values, see [CfgDNType](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgDNType) in the Platform SDK documentation. (optional) @param folderType If the object_type is &#39;folders&#39;, then you may specify the object type of the folders (for example, CFGPerson). This parameter does not affect request results but may increase performance For possible values, see [CfgObjectType](https://docs.genesys.com/Documentation/PSDK/9.0.x/ConfigLayerRef/CfgObjectType) in the Platform SDK documentation. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Get", "permissions", "for", "a", "list", "of", "objects", ".", "(", "asynchronously", ")", "Get", "permissions", "from", "Configuration", "Server", "for", "objects", "identified", "by", "their", "type", "and", "DBIDs", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/ObjectsApi.java#L381-L406
petergeneric/stdlib
guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/TransactionMethodInterceptor.java
TransactionMethodInterceptor.shouldRollback
private boolean shouldRollback(Transactional annotation, Exception e) { """ @param annotation The metadata annotation of the method @param e The exception to test for rollback @return returns true if the transaction should be rolled back, otherwise false """ return isInstanceOf(e, annotation.rollbackOn()) && !isInstanceOf(e, annotation.exceptOn()); }
java
private boolean shouldRollback(Transactional annotation, Exception e) { return isInstanceOf(e, annotation.rollbackOn()) && !isInstanceOf(e, annotation.exceptOn()); }
[ "private", "boolean", "shouldRollback", "(", "Transactional", "annotation", ",", "Exception", "e", ")", "{", "return", "isInstanceOf", "(", "e", ",", "annotation", ".", "rollbackOn", "(", ")", ")", "&&", "!", "isInstanceOf", "(", "e", ",", "annotation", ".", "exceptOn", "(", ")", ")", ";", "}" ]
@param annotation The metadata annotation of the method @param e The exception to test for rollback @return returns true if the transaction should be rolled back, otherwise false
[ "@param", "annotation", "The", "metadata", "annotation", "of", "the", "method", "@param", "e", "The", "exception", "to", "test", "for", "rollback" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/TransactionMethodInterceptor.java#L390-L393
toberkoe/fluent-assertions
src/main/java/de/toberkoe/fluentassertions/api/objects/ThrowableAssert.java
ThrowableAssert.extractThrowable
private Throwable extractThrowable(Throwable exception, Class<?> causeClass) { """ Extracts the requested throwable from given {@link Throwable}. @param exception the complete exception stack @param causeClass the requested cause to search for @return found throwable or null """ if (exception == null) { return null; } else if (causeClass.isInstance(exception)) { return exception; } else { return extractThrowable(exception.getCause(), causeClass); } }
java
private Throwable extractThrowable(Throwable exception, Class<?> causeClass) { if (exception == null) { return null; } else if (causeClass.isInstance(exception)) { return exception; } else { return extractThrowable(exception.getCause(), causeClass); } }
[ "private", "Throwable", "extractThrowable", "(", "Throwable", "exception", ",", "Class", "<", "?", ">", "causeClass", ")", "{", "if", "(", "exception", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(", "causeClass", ".", "isInstance", "(", "exception", ")", ")", "{", "return", "exception", ";", "}", "else", "{", "return", "extractThrowable", "(", "exception", ".", "getCause", "(", ")", ",", "causeClass", ")", ";", "}", "}" ]
Extracts the requested throwable from given {@link Throwable}. @param exception the complete exception stack @param causeClass the requested cause to search for @return found throwable or null
[ "Extracts", "the", "requested", "throwable", "from", "given", "{", "@link", "Throwable", "}", "." ]
train
https://github.com/toberkoe/fluent-assertions/blob/8942959ee244cd63dc139a98dc445aec924e3143/src/main/java/de/toberkoe/fluentassertions/api/objects/ThrowableAssert.java#L122-L130
jMotif/GI
src/main/java/net/seninp/gi/sequitur/SequiturFactory.java
SequiturFactory.series2SequiturRules
public static GrammarRules series2SequiturRules(double[] timeseries, int saxWindowSize, int saxPAASize, int saxAlphabetSize, NumerosityReductionStrategy numerosityReductionStrategy, double normalizationThreshold) throws Exception, IOException { """ Takes a time series and returns a grammar. @param timeseries the input time series. @param saxWindowSize the sliding window size. @param saxPAASize the PAA num. @param saxAlphabetSize the SAX alphabet size. @param numerosityReductionStrategy the SAX Numerosity Reduction strategy. @param normalizationThreshold the SAX normalization threshod. @return the set of rules, i.e. the grammar. @throws Exception if error occurs. @throws IOException if error occurs. """ LOGGER.debug("Discretizing time series..."); SAXRecords saxFrequencyData = sp.ts2saxViaWindow(timeseries, saxWindowSize, saxPAASize, normalA.getCuts(saxAlphabetSize), numerosityReductionStrategy, normalizationThreshold); LOGGER.debug("Inferring the grammar..."); // this is a string we are about to feed into Sequitur // String saxDisplayString = saxFrequencyData.getSAXString(" "); // reset the Sequitur data structures SAXRule.numRules = new AtomicInteger(0); SAXRule.theRules.clear(); SAXSymbol.theDigrams.clear(); // bootstrap the grammar SAXRule grammar = new SAXRule(); SAXRule.arrRuleRecords = new ArrayList<GrammarRuleRecord>(); // digest the string via the tokenizer and build the grammar StringTokenizer st = new StringTokenizer(saxDisplayString, " "); int currentPosition = 0; while (st.hasMoreTokens()) { grammar.last().insertAfter(new SAXTerminal(st.nextToken(), currentPosition)); grammar.last().p.check(); currentPosition++; } // bw.close(); LOGGER.debug("Collecting the grammar rules statistics and expanding the rules..."); GrammarRules rules = grammar.toGrammarRulesData(); LOGGER.debug("Mapping expanded rules to time-series intervals..."); SequiturFactory.updateRuleIntervals(rules, saxFrequencyData, true, timeseries, saxWindowSize, saxPAASize); return rules; }
java
public static GrammarRules series2SequiturRules(double[] timeseries, int saxWindowSize, int saxPAASize, int saxAlphabetSize, NumerosityReductionStrategy numerosityReductionStrategy, double normalizationThreshold) throws Exception, IOException { LOGGER.debug("Discretizing time series..."); SAXRecords saxFrequencyData = sp.ts2saxViaWindow(timeseries, saxWindowSize, saxPAASize, normalA.getCuts(saxAlphabetSize), numerosityReductionStrategy, normalizationThreshold); LOGGER.debug("Inferring the grammar..."); // this is a string we are about to feed into Sequitur // String saxDisplayString = saxFrequencyData.getSAXString(" "); // reset the Sequitur data structures SAXRule.numRules = new AtomicInteger(0); SAXRule.theRules.clear(); SAXSymbol.theDigrams.clear(); // bootstrap the grammar SAXRule grammar = new SAXRule(); SAXRule.arrRuleRecords = new ArrayList<GrammarRuleRecord>(); // digest the string via the tokenizer and build the grammar StringTokenizer st = new StringTokenizer(saxDisplayString, " "); int currentPosition = 0; while (st.hasMoreTokens()) { grammar.last().insertAfter(new SAXTerminal(st.nextToken(), currentPosition)); grammar.last().p.check(); currentPosition++; } // bw.close(); LOGGER.debug("Collecting the grammar rules statistics and expanding the rules..."); GrammarRules rules = grammar.toGrammarRulesData(); LOGGER.debug("Mapping expanded rules to time-series intervals..."); SequiturFactory.updateRuleIntervals(rules, saxFrequencyData, true, timeseries, saxWindowSize, saxPAASize); return rules; }
[ "public", "static", "GrammarRules", "series2SequiturRules", "(", "double", "[", "]", "timeseries", ",", "int", "saxWindowSize", ",", "int", "saxPAASize", ",", "int", "saxAlphabetSize", ",", "NumerosityReductionStrategy", "numerosityReductionStrategy", ",", "double", "normalizationThreshold", ")", "throws", "Exception", ",", "IOException", "{", "LOGGER", ".", "debug", "(", "\"Discretizing time series...\"", ")", ";", "SAXRecords", "saxFrequencyData", "=", "sp", ".", "ts2saxViaWindow", "(", "timeseries", ",", "saxWindowSize", ",", "saxPAASize", ",", "normalA", ".", "getCuts", "(", "saxAlphabetSize", ")", ",", "numerosityReductionStrategy", ",", "normalizationThreshold", ")", ";", "LOGGER", ".", "debug", "(", "\"Inferring the grammar...\"", ")", ";", "// this is a string we are about to feed into Sequitur", "//", "String", "saxDisplayString", "=", "saxFrequencyData", ".", "getSAXString", "(", "\" \"", ")", ";", "// reset the Sequitur data structures", "SAXRule", ".", "numRules", "=", "new", "AtomicInteger", "(", "0", ")", ";", "SAXRule", ".", "theRules", ".", "clear", "(", ")", ";", "SAXSymbol", ".", "theDigrams", ".", "clear", "(", ")", ";", "// bootstrap the grammar", "SAXRule", "grammar", "=", "new", "SAXRule", "(", ")", ";", "SAXRule", ".", "arrRuleRecords", "=", "new", "ArrayList", "<", "GrammarRuleRecord", ">", "(", ")", ";", "// digest the string via the tokenizer and build the grammar", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "saxDisplayString", ",", "\" \"", ")", ";", "int", "currentPosition", "=", "0", ";", "while", "(", "st", ".", "hasMoreTokens", "(", ")", ")", "{", "grammar", ".", "last", "(", ")", ".", "insertAfter", "(", "new", "SAXTerminal", "(", "st", ".", "nextToken", "(", ")", ",", "currentPosition", ")", ")", ";", "grammar", ".", "last", "(", ")", ".", "p", ".", "check", "(", ")", ";", "currentPosition", "++", ";", "}", "// bw.close();", "LOGGER", ".", "debug", "(", "\"Collecting the grammar rules statistics and expanding the rules...\"", ")", ";", "GrammarRules", "rules", "=", "grammar", ".", "toGrammarRulesData", "(", ")", ";", "LOGGER", ".", "debug", "(", "\"Mapping expanded rules to time-series intervals...\"", ")", ";", "SequiturFactory", ".", "updateRuleIntervals", "(", "rules", ",", "saxFrequencyData", ",", "true", ",", "timeseries", ",", "saxWindowSize", ",", "saxPAASize", ")", ";", "return", "rules", ";", "}" ]
Takes a time series and returns a grammar. @param timeseries the input time series. @param saxWindowSize the sliding window size. @param saxPAASize the PAA num. @param saxAlphabetSize the SAX alphabet size. @param numerosityReductionStrategy the SAX Numerosity Reduction strategy. @param normalizationThreshold the SAX normalization threshod. @return the set of rules, i.e. the grammar. @throws Exception if error occurs. @throws IOException if error occurs.
[ "Takes", "a", "time", "series", "and", "returns", "a", "grammar", "." ]
train
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/sequitur/SequiturFactory.java#L112-L155
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
StringUtils.toStringBuilder
public static StringBuilder toStringBuilder(Collection<? extends Object> collection, String delimiter) { """ Transform a collection of objects to a delimited String. @param collection the collection to transform. @param delimiter the delimiter used to delimit the Strings. @return a StringBuilder with all the elements of the collection. """ StringBuilder sb = new StringBuilder(collection.size() * 20); for (Iterator<? extends Object> it = collection.iterator(); it.hasNext();) { Object cs = it.next(); sb.append(cs); if (it.hasNext()) { sb.append(delimiter); } } return sb; }
java
public static StringBuilder toStringBuilder(Collection<? extends Object> collection, String delimiter) { StringBuilder sb = new StringBuilder(collection.size() * 20); for (Iterator<? extends Object> it = collection.iterator(); it.hasNext();) { Object cs = it.next(); sb.append(cs); if (it.hasNext()) { sb.append(delimiter); } } return sb; }
[ "public", "static", "StringBuilder", "toStringBuilder", "(", "Collection", "<", "?", "extends", "Object", ">", "collection", ",", "String", "delimiter", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "collection", ".", "size", "(", ")", "*", "20", ")", ";", "for", "(", "Iterator", "<", "?", "extends", "Object", ">", "it", "=", "collection", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Object", "cs", "=", "it", ".", "next", "(", ")", ";", "sb", ".", "append", "(", "cs", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "sb", ".", "append", "(", "delimiter", ")", ";", "}", "}", "return", "sb", ";", "}" ]
Transform a collection of objects to a delimited String. @param collection the collection to transform. @param delimiter the delimiter used to delimit the Strings. @return a StringBuilder with all the elements of the collection.
[ "Transform", "a", "collection", "of", "objects", "to", "a", "delimited", "String", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java#L390-L400
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/CpuNDArrayFactory.java
CpuNDArrayFactory.pullRows
@Override public INDArray pullRows(INDArray source, int sourceDimension, int[] indexes) { """ This method produces concatenated array, that consist from tensors, fetched from source array, against some dimension and specified indexes @param source source tensor @param sourceDimension dimension of source tensor @param indexes indexes from source array @return """ return pullRows(source, sourceDimension, ArrayUtil.toLongArray(indexes)); }
java
@Override public INDArray pullRows(INDArray source, int sourceDimension, int[] indexes) { return pullRows(source, sourceDimension, ArrayUtil.toLongArray(indexes)); }
[ "@", "Override", "public", "INDArray", "pullRows", "(", "INDArray", "source", ",", "int", "sourceDimension", ",", "int", "[", "]", "indexes", ")", "{", "return", "pullRows", "(", "source", ",", "sourceDimension", ",", "ArrayUtil", ".", "toLongArray", "(", "indexes", ")", ")", ";", "}" ]
This method produces concatenated array, that consist from tensors, fetched from source array, against some dimension and specified indexes @param source source tensor @param sourceDimension dimension of source tensor @param indexes indexes from source array @return
[ "This", "method", "produces", "concatenated", "array", "that", "consist", "from", "tensors", "fetched", "from", "source", "array", "against", "some", "dimension", "and", "specified", "indexes" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/CpuNDArrayFactory.java#L670-L673
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java
MarshallUtil.marshallSize
public static void marshallSize(ObjectOutput out, int value) throws IOException { """ A special marshall implementation for integer. <p> This method supports negative values but they are handles as {@link #NULL_VALUE}. It means that the real value is lost and {@link #NULL_VALUE} is returned by {@link #unmarshallSize(ObjectInput)}. <p> The integer is marshalled in a variable length from 1 to 5 bytes. Negatives values are always marshalled in 1 byte. @param out {@link ObjectOutput} to write. @param value Integer value to marshall. @throws IOException If any of the usual Input/Output related exceptions occur. """ if (value < 0) { out.writeByte(0x80); //meaning it is a negative value! return; } if ((value & ~0x3F) == 0) { // fits in 1 byte out.writeByte(value & 0x3F); //first bit is 0 (== positive) and second bit is zero (== not more bytes) return; } out.writeByte((value & 0x3F) | 0x40); //set second bit to 1 (== more bytes) value >>>= 6; //6 bits written so far //normal code for unsigned int. only the first byte is special while ((value & ~0x7F) != 0) { out.writeByte((byte) ((value & 0x7f) | 0x80)); value >>>= 7; } out.writeByte((byte) value); }
java
public static void marshallSize(ObjectOutput out, int value) throws IOException { if (value < 0) { out.writeByte(0x80); //meaning it is a negative value! return; } if ((value & ~0x3F) == 0) { // fits in 1 byte out.writeByte(value & 0x3F); //first bit is 0 (== positive) and second bit is zero (== not more bytes) return; } out.writeByte((value & 0x3F) | 0x40); //set second bit to 1 (== more bytes) value >>>= 6; //6 bits written so far //normal code for unsigned int. only the first byte is special while ((value & ~0x7F) != 0) { out.writeByte((byte) ((value & 0x7f) | 0x80)); value >>>= 7; } out.writeByte((byte) value); }
[ "public", "static", "void", "marshallSize", "(", "ObjectOutput", "out", ",", "int", "value", ")", "throws", "IOException", "{", "if", "(", "value", "<", "0", ")", "{", "out", ".", "writeByte", "(", "0x80", ")", ";", "//meaning it is a negative value!", "return", ";", "}", "if", "(", "(", "value", "&", "~", "0x3F", ")", "==", "0", ")", "{", "// fits in 1 byte", "out", ".", "writeByte", "(", "value", "&", "0x3F", ")", ";", "//first bit is 0 (== positive) and second bit is zero (== not more bytes)", "return", ";", "}", "out", ".", "writeByte", "(", "(", "value", "&", "0x3F", ")", "|", "0x40", ")", ";", "//set second bit to 1 (== more bytes)", "value", ">>>=", "6", ";", "//6 bits written so far", "//normal code for unsigned int. only the first byte is special", "while", "(", "(", "value", "&", "~", "0x7F", ")", "!=", "0", ")", "{", "out", ".", "writeByte", "(", "(", "byte", ")", "(", "(", "value", "&", "0x7f", ")", "|", "0x80", ")", ")", ";", "value", ">>>=", "7", ";", "}", "out", ".", "writeByte", "(", "(", "byte", ")", "value", ")", ";", "}" ]
A special marshall implementation for integer. <p> This method supports negative values but they are handles as {@link #NULL_VALUE}. It means that the real value is lost and {@link #NULL_VALUE} is returned by {@link #unmarshallSize(ObjectInput)}. <p> The integer is marshalled in a variable length from 1 to 5 bytes. Negatives values are always marshalled in 1 byte. @param out {@link ObjectOutput} to write. @param value Integer value to marshall. @throws IOException If any of the usual Input/Output related exceptions occur.
[ "A", "special", "marshall", "implementation", "for", "integer", ".", "<p", ">", "This", "method", "supports", "negative", "values", "but", "they", "are", "handles", "as", "{", "@link", "#NULL_VALUE", "}", ".", "It", "means", "that", "the", "real", "value", "is", "lost", "and", "{", "@link", "#NULL_VALUE", "}", "is", "returned", "by", "{", "@link", "#unmarshallSize", "(", "ObjectInput", ")", "}", ".", "<p", ">", "The", "integer", "is", "marshalled", "in", "a", "variable", "length", "from", "1", "to", "5", "bytes", ".", "Negatives", "values", "are", "always", "marshalled", "in", "1", "byte", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java#L396-L413
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/BoxFactory.java
BoxFactory.createBox
public ElementBox createBox(ElementBox parent, Element n, String display) { """ Creates a single new box from an element. @param n The source DOM element @param display the display: property value that is used when the box style is not known (e.g. anonymous boxes) @return A new box of a subclass of {@link ElementBox} based on the value of the 'display' CSS property """ ElementBox root = null; //New box style NodeData style = decoder.getElementStyleInherited(n); if (style == null) style = createAnonymousStyle(display); //Special (HTML) tag names if (config.getUseHTML() && html.isTagSupported(n)) { root = html.createBox(parent, n, viewport, style); } //Not created yet -- create a box according to the display value if (root == null) { root = createElementInstance(parent, n, style); } root.setBase(baseurl); root.setViewport(viewport); root.setParent(parent); root.setOrder(next_order++); return root; }
java
public ElementBox createBox(ElementBox parent, Element n, String display) { ElementBox root = null; //New box style NodeData style = decoder.getElementStyleInherited(n); if (style == null) style = createAnonymousStyle(display); //Special (HTML) tag names if (config.getUseHTML() && html.isTagSupported(n)) { root = html.createBox(parent, n, viewport, style); } //Not created yet -- create a box according to the display value if (root == null) { root = createElementInstance(parent, n, style); } root.setBase(baseurl); root.setViewport(viewport); root.setParent(parent); root.setOrder(next_order++); return root; }
[ "public", "ElementBox", "createBox", "(", "ElementBox", "parent", ",", "Element", "n", ",", "String", "display", ")", "{", "ElementBox", "root", "=", "null", ";", "//New box style", "NodeData", "style", "=", "decoder", ".", "getElementStyleInherited", "(", "n", ")", ";", "if", "(", "style", "==", "null", ")", "style", "=", "createAnonymousStyle", "(", "display", ")", ";", "//Special (HTML) tag names", "if", "(", "config", ".", "getUseHTML", "(", ")", "&&", "html", ".", "isTagSupported", "(", "n", ")", ")", "{", "root", "=", "html", ".", "createBox", "(", "parent", ",", "n", ",", "viewport", ",", "style", ")", ";", "}", "//Not created yet -- create a box according to the display value", "if", "(", "root", "==", "null", ")", "{", "root", "=", "createElementInstance", "(", "parent", ",", "n", ",", "style", ")", ";", "}", "root", ".", "setBase", "(", "baseurl", ")", ";", "root", ".", "setViewport", "(", "viewport", ")", ";", "root", ".", "setParent", "(", "parent", ")", ";", "root", ".", "setOrder", "(", "next_order", "++", ")", ";", "return", "root", ";", "}" ]
Creates a single new box from an element. @param n The source DOM element @param display the display: property value that is used when the box style is not known (e.g. anonymous boxes) @return A new box of a subclass of {@link ElementBox} based on the value of the 'display' CSS property
[ "Creates", "a", "single", "new", "box", "from", "an", "element", "." ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/BoxFactory.java#L825-L849
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_input_inputId_PUT
public OvhOperation serviceName_input_inputId_PUT(String serviceName, String inputId, String description, String engineId, String exposedPort, String optionId, Boolean singleInstanceEnabled, String streamId, String title) throws IOException { """ Update information of specified input object REST: PUT /dbaas/logs/{serviceName}/input/{inputId} @param serviceName [required] Service name @param inputId [required] Input ID @param streamId [required] Stream ID @param engineId [required] Engine ID @param description [required] Description @param singleInstanceEnabled [required] Indicate if input have only a single instance @param optionId [required] Option ID @param title [required] Title @param exposedPort [required] Exposed port """ String qPath = "/dbaas/logs/{serviceName}/input/{inputId}"; StringBuilder sb = path(qPath, serviceName, inputId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "engineId", engineId); addBody(o, "exposedPort", exposedPort); addBody(o, "optionId", optionId); addBody(o, "singleInstanceEnabled", singleInstanceEnabled); addBody(o, "streamId", streamId); addBody(o, "title", title); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation serviceName_input_inputId_PUT(String serviceName, String inputId, String description, String engineId, String exposedPort, String optionId, Boolean singleInstanceEnabled, String streamId, String title) throws IOException { String qPath = "/dbaas/logs/{serviceName}/input/{inputId}"; StringBuilder sb = path(qPath, serviceName, inputId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "engineId", engineId); addBody(o, "exposedPort", exposedPort); addBody(o, "optionId", optionId); addBody(o, "singleInstanceEnabled", singleInstanceEnabled); addBody(o, "streamId", streamId); addBody(o, "title", title); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "serviceName_input_inputId_PUT", "(", "String", "serviceName", ",", "String", "inputId", ",", "String", "description", ",", "String", "engineId", ",", "String", "exposedPort", ",", "String", "optionId", ",", "Boolean", "singleInstanceEnabled", ",", "String", "streamId", ",", "String", "title", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/input/{inputId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "inputId", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"description\"", ",", "description", ")", ";", "addBody", "(", "o", ",", "\"engineId\"", ",", "engineId", ")", ";", "addBody", "(", "o", ",", "\"exposedPort\"", ",", "exposedPort", ")", ";", "addBody", "(", "o", ",", "\"optionId\"", ",", "optionId", ")", ";", "addBody", "(", "o", ",", "\"singleInstanceEnabled\"", ",", "singleInstanceEnabled", ")", ";", "addBody", "(", "o", ",", "\"streamId\"", ",", "streamId", ")", ";", "addBody", "(", "o", ",", "\"title\"", ",", "title", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOperation", ".", "class", ")", ";", "}" ]
Update information of specified input object REST: PUT /dbaas/logs/{serviceName}/input/{inputId} @param serviceName [required] Service name @param inputId [required] Input ID @param streamId [required] Stream ID @param engineId [required] Engine ID @param description [required] Description @param singleInstanceEnabled [required] Indicate if input have only a single instance @param optionId [required] Option ID @param title [required] Title @param exposedPort [required] Exposed port
[ "Update", "information", "of", "specified", "input", "object" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L417-L430
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/deployments/resources/LoggingConfigurationReadStepHandler.java
LoggingConfigurationReadStepHandler.setModelValue
static void setModelValue(final ModelNode model, final String value) { """ Sets the value of the model if the value is not {@code null}. @param model the model to update @param value the value for the model """ if (value != null) { model.set(value); } }
java
static void setModelValue(final ModelNode model, final String value) { if (value != null) { model.set(value); } }
[ "static", "void", "setModelValue", "(", "final", "ModelNode", "model", ",", "final", "String", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "model", ".", "set", "(", "value", ")", ";", "}", "}" ]
Sets the value of the model if the value is not {@code null}. @param model the model to update @param value the value for the model
[ "Sets", "the", "value", "of", "the", "model", "if", "the", "value", "is", "not", "{", "@code", "null", "}", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/deployments/resources/LoggingConfigurationReadStepHandler.java#L89-L93
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java
CompiledFEELSemanticMappings.and
public static Boolean and(Object left, Object right) { """ FEEL spec Table 38 Delegates to {@link InfixOpNode} except evaluationcontext """ return (Boolean) InfixOpNode.and(left, right, null); }
java
public static Boolean and(Object left, Object right) { return (Boolean) InfixOpNode.and(left, right, null); }
[ "public", "static", "Boolean", "and", "(", "Object", "left", ",", "Object", "right", ")", "{", "return", "(", "Boolean", ")", "InfixOpNode", ".", "and", "(", "left", ",", "right", ",", "null", ")", ";", "}" ]
FEEL spec Table 38 Delegates to {@link InfixOpNode} except evaluationcontext
[ "FEEL", "spec", "Table", "38", "Delegates", "to", "{" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java#L258-L260
m-m-m/util
value/src/main/java/net/sf/mmm/util/value/impl/AbstractValueConverterToContainer.java
AbstractValueConverterToContainer.convertFromCollection
protected <T extends CONTAINER> T convertFromCollection(Collection collectionValue, Object valueSource, GenericType<T> targetType) { """ This method performs the {@link #convert(Object, Object, GenericType) conversion} for {@link Collection} values. @param <T> is the generic type of {@code targetType}. @param collectionValue is the {@link Collection} value to convert. @param valueSource describes the source of the value or {@code null} if NOT available. @param targetType is the {@link #getTargetType() target-type} to convert to. @return the converted container. """ int size = collectionValue.size(); T container = createContainer(targetType, size); int i = 0; for (Object element : collectionValue) { convertContainerEntry(element, i, container, valueSource, targetType, collectionValue); i++; } return container; }
java
protected <T extends CONTAINER> T convertFromCollection(Collection collectionValue, Object valueSource, GenericType<T> targetType) { int size = collectionValue.size(); T container = createContainer(targetType, size); int i = 0; for (Object element : collectionValue) { convertContainerEntry(element, i, container, valueSource, targetType, collectionValue); i++; } return container; }
[ "protected", "<", "T", "extends", "CONTAINER", ">", "T", "convertFromCollection", "(", "Collection", "collectionValue", ",", "Object", "valueSource", ",", "GenericType", "<", "T", ">", "targetType", ")", "{", "int", "size", "=", "collectionValue", ".", "size", "(", ")", ";", "T", "container", "=", "createContainer", "(", "targetType", ",", "size", ")", ";", "int", "i", "=", "0", ";", "for", "(", "Object", "element", ":", "collectionValue", ")", "{", "convertContainerEntry", "(", "element", ",", "i", ",", "container", ",", "valueSource", ",", "targetType", ",", "collectionValue", ")", ";", "i", "++", ";", "}", "return", "container", ";", "}" ]
This method performs the {@link #convert(Object, Object, GenericType) conversion} for {@link Collection} values. @param <T> is the generic type of {@code targetType}. @param collectionValue is the {@link Collection} value to convert. @param valueSource describes the source of the value or {@code null} if NOT available. @param targetType is the {@link #getTargetType() target-type} to convert to. @return the converted container.
[ "This", "method", "performs", "the", "{", "@link", "#convert", "(", "Object", "Object", "GenericType", ")", "conversion", "}", "for", "{", "@link", "Collection", "}", "values", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/value/src/main/java/net/sf/mmm/util/value/impl/AbstractValueConverterToContainer.java#L149-L159
real-logic/agrona
agrona/src/main/java/org/agrona/collections/Int2IntCounterMap.java
Int2IntCounterMap.getAndAdd
public int getAndAdd(final int key, final int amount) { """ Add amount to the current value associated with this key. If no such value exists use {@link #initialValue()} as current value and associate key with {@link #initialValue()} + amount unless amount is 0, in which case map remains unchanged. @param key new or existing @param amount to be added @return the previous value associated with the specified key, or {@link #initialValue()} if there was no mapping for the key. """ final int[] entries = this.entries; final int initialValue = this.initialValue; @DoNotSub final int mask = entries.length - 1; @DoNotSub int index = Hashing.evenHash(key, mask); int oldValue = initialValue; while (entries[index + 1] != initialValue) { if (entries[index] == key) { oldValue = entries[index + 1]; break; } index = next(index, mask); } if (amount != 0) { final int newValue = oldValue + amount; entries[index + 1] = newValue; if (oldValue == initialValue) { ++size; entries[index] = key; increaseCapacity(); } else if (newValue == initialValue) { size--; compactChain(index); } } return oldValue; }
java
public int getAndAdd(final int key, final int amount) { final int[] entries = this.entries; final int initialValue = this.initialValue; @DoNotSub final int mask = entries.length - 1; @DoNotSub int index = Hashing.evenHash(key, mask); int oldValue = initialValue; while (entries[index + 1] != initialValue) { if (entries[index] == key) { oldValue = entries[index + 1]; break; } index = next(index, mask); } if (amount != 0) { final int newValue = oldValue + amount; entries[index + 1] = newValue; if (oldValue == initialValue) { ++size; entries[index] = key; increaseCapacity(); } else if (newValue == initialValue) { size--; compactChain(index); } } return oldValue; }
[ "public", "int", "getAndAdd", "(", "final", "int", "key", ",", "final", "int", "amount", ")", "{", "final", "int", "[", "]", "entries", "=", "this", ".", "entries", ";", "final", "int", "initialValue", "=", "this", ".", "initialValue", ";", "@", "DoNotSub", "final", "int", "mask", "=", "entries", ".", "length", "-", "1", ";", "@", "DoNotSub", "int", "index", "=", "Hashing", ".", "evenHash", "(", "key", ",", "mask", ")", ";", "int", "oldValue", "=", "initialValue", ";", "while", "(", "entries", "[", "index", "+", "1", "]", "!=", "initialValue", ")", "{", "if", "(", "entries", "[", "index", "]", "==", "key", ")", "{", "oldValue", "=", "entries", "[", "index", "+", "1", "]", ";", "break", ";", "}", "index", "=", "next", "(", "index", ",", "mask", ")", ";", "}", "if", "(", "amount", "!=", "0", ")", "{", "final", "int", "newValue", "=", "oldValue", "+", "amount", ";", "entries", "[", "index", "+", "1", "]", "=", "newValue", ";", "if", "(", "oldValue", "==", "initialValue", ")", "{", "++", "size", ";", "entries", "[", "index", "]", "=", "key", ";", "increaseCapacity", "(", ")", ";", "}", "else", "if", "(", "newValue", "==", "initialValue", ")", "{", "size", "--", ";", "compactChain", "(", "index", ")", ";", "}", "}", "return", "oldValue", ";", "}" ]
Add amount to the current value associated with this key. If no such value exists use {@link #initialValue()} as current value and associate key with {@link #initialValue()} + amount unless amount is 0, in which case map remains unchanged. @param key new or existing @param amount to be added @return the previous value associated with the specified key, or {@link #initialValue()} if there was no mapping for the key.
[ "Add", "amount", "to", "the", "current", "value", "associated", "with", "this", "key", ".", "If", "no", "such", "value", "exists", "use", "{", "@link", "#initialValue", "()", "}", "as", "current", "value", "and", "associate", "key", "with", "{", "@link", "#initialValue", "()", "}", "+", "amount", "unless", "amount", "is", "0", "in", "which", "case", "map", "remains", "unchanged", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/collections/Int2IntCounterMap.java#L268-L306
jglobus/JGlobus
gridftp/src/main/java/org/globus/ftp/FTPClient.java
FTPClient.setClientWaitParams
public void setClientWaitParams(int maxWait, int waitDelay) { """ Changes the default client timeout parameters. In the beginning of the transfer, the critical moment is the wait for the initial server reply. If it does not arrive after timeout, client assumes that the transfer could not start for some reason and aborts the operation. Default timeout in miliseconds is Session.DEFAULT_MAX_WAIT. During the waiting period, client polls the control channel once a certain period, which is by default set to Session.DEFAULT_WAIT_DELAY. <br> Use this method to change these parameters. @param maxWait timeout in miliseconds @param waitDelay polling period """ if (maxWait <= 0 || waitDelay <= 0) { throw new IllegalArgumentException("Parameter is less than 0"); } this.session.maxWait = maxWait; this.session.waitDelay = waitDelay; }
java
public void setClientWaitParams(int maxWait, int waitDelay) { if (maxWait <= 0 || waitDelay <= 0) { throw new IllegalArgumentException("Parameter is less than 0"); } this.session.maxWait = maxWait; this.session.waitDelay = waitDelay; }
[ "public", "void", "setClientWaitParams", "(", "int", "maxWait", ",", "int", "waitDelay", ")", "{", "if", "(", "maxWait", "<=", "0", "||", "waitDelay", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter is less than 0\"", ")", ";", "}", "this", ".", "session", ".", "maxWait", "=", "maxWait", ";", "this", ".", "session", ".", "waitDelay", "=", "waitDelay", ";", "}" ]
Changes the default client timeout parameters. In the beginning of the transfer, the critical moment is the wait for the initial server reply. If it does not arrive after timeout, client assumes that the transfer could not start for some reason and aborts the operation. Default timeout in miliseconds is Session.DEFAULT_MAX_WAIT. During the waiting period, client polls the control channel once a certain period, which is by default set to Session.DEFAULT_WAIT_DELAY. <br> Use this method to change these parameters. @param maxWait timeout in miliseconds @param waitDelay polling period
[ "Changes", "the", "default", "client", "timeout", "parameters", ".", "In", "the", "beginning", "of", "the", "transfer", "the", "critical", "moment", "is", "the", "wait", "for", "the", "initial", "server", "reply", ".", "If", "it", "does", "not", "arrive", "after", "timeout", "client", "assumes", "that", "the", "transfer", "could", "not", "start", "for", "some", "reason", "and", "aborts", "the", "operation", ".", "Default", "timeout", "in", "miliseconds", "is", "Session", ".", "DEFAULT_MAX_WAIT", ".", "During", "the", "waiting", "period", "client", "polls", "the", "control", "channel", "once", "a", "certain", "period", "which", "is", "by", "default", "set", "to", "Session", ".", "DEFAULT_WAIT_DELAY", ".", "<br", ">", "Use", "this", "method", "to", "change", "these", "parameters", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gridftp/src/main/java/org/globus/ftp/FTPClient.java#L1135-L1141
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java
WebSocketClientHandshakerFactory.newHandshaker
public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) { """ Creates a new handshaker. @param webSocketURL URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL. @param version Version of web socket specification to use to connect to the server @param subprotocol Sub protocol request sent to the server. Null if no sub-protocol support is required. @param allowExtensions Allow extensions to be used in the reserved bits of the web socket frame @param customHeaders Custom HTTP headers to send during the handshake @param maxFramePayloadLength Maximum allowable frame payload length. Setting this value to your application's requirement may reduce denial of service attacks using long data frames. """ return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, true, false); }
java
public static WebSocketClientHandshaker newHandshaker( URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) { return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders, maxFramePayloadLength, true, false); }
[ "public", "static", "WebSocketClientHandshaker", "newHandshaker", "(", "URI", "webSocketURL", ",", "WebSocketVersion", "version", ",", "String", "subprotocol", ",", "boolean", "allowExtensions", ",", "HttpHeaders", "customHeaders", ",", "int", "maxFramePayloadLength", ")", "{", "return", "newHandshaker", "(", "webSocketURL", ",", "version", ",", "subprotocol", ",", "allowExtensions", ",", "customHeaders", ",", "maxFramePayloadLength", ",", "true", ",", "false", ")", ";", "}" ]
Creates a new handshaker. @param webSocketURL URL for web socket communications. e.g "ws://myhost.com/mypath". Subsequent web socket frames will be sent to this URL. @param version Version of web socket specification to use to connect to the server @param subprotocol Sub protocol request sent to the server. Null if no sub-protocol support is required. @param allowExtensions Allow extensions to be used in the reserved bits of the web socket frame @param customHeaders Custom HTTP headers to send during the handshake @param maxFramePayloadLength Maximum allowable frame payload length. Setting this value to your application's requirement may reduce denial of service attacks using long data frames.
[ "Creates", "a", "new", "handshaker", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java#L74-L79
roboconf/roboconf-platform
core/roboconf-target-embedded/src/main/java/net/roboconf/target/embedded/internal/ConfiguratorOnCreation.java
ConfiguratorOnCreation.configureRemoteAgent
protected void configureRemoteAgent( String ip, final TargetHandlerParameters parameters ) throws IOException { """ Configures a remote agent by using SCP. <p> A user-data file will be generated, sent to the remote host (in agent configuration directory), then the remote agent configuration file will be updated to point on the new user-data file ("parameters" property). </p> @param ip IP address of remote host @param parameters Target handler parameters (with user-data inside) @throws IOException """ this.logger.fine( "Configuring remote agent @ " + ip ); SSHClient ssh = new SSHClient(); File tmpDir = new File( System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); Utils.createDirectory( tmpDir ); try { // Prepare the connection String skipHostVerification = parameters.getTargetProperties().get( SCP_DISABLE_HOST_VALIDATION ); HostKeyVerifier hostKeyVerifier; if( "true".equalsIgnoreCase( skipHostVerification )) { this.logger.fine( "Skipping host validation..." ); hostKeyVerifier = new PromiscuousVerifier(); } else { hostKeyVerifier = new FingerPrintVerifier( parameters.getTargetProperties()); } ssh.addHostKeyVerifier( hostKeyVerifier ); // Known hosts - when no file is specified, it is loaded from "~/.ssh" String knownHostsFile = this.parameters.getTargetProperties().get( SCP_KNOWN_HOSTS_FILE ); if( knownHostsFile == null ) ssh.loadKnownHosts(); else ssh.loadKnownHosts( new File( knownHostsFile )); // Open the connection this.logger.fine( "Connecting to " + ip + "..." ); ssh.connect( ip ); // "ubuntu" is the default user name on several (ubuntu) systems, including IaaS VMs String user = Utils.getValue( this.parameters.getTargetProperties(), SCP_USER, "ubuntu" ); // Key file - when no file is specified, it is loaded from "~/.ssh" String keyfile = this.parameters.getTargetProperties().get( SCP_KEY_FILE ); if( keyfile == null ) ssh.authPublickey( user ); else ssh.authPublickey( user, keyfile ); // Do what we need to do Map<String,String> keyToNewValue = prepareConfiguration( this.parameters, ssh, tmpDir ); updateAgentConfigurationFile( this.parameters, ssh, tmpDir, keyToNewValue ); } finally { try { ssh.disconnect(); ssh.close(); } catch( Exception e ) { Utils.logException( this.logger, e ); } finally { this.logger.fine( "Disconnected from " + ip ); } Utils.deleteFilesRecursivelyAndQuietly( tmpDir ); } }
java
protected void configureRemoteAgent( String ip, final TargetHandlerParameters parameters ) throws IOException { this.logger.fine( "Configuring remote agent @ " + ip ); SSHClient ssh = new SSHClient(); File tmpDir = new File( System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); Utils.createDirectory( tmpDir ); try { // Prepare the connection String skipHostVerification = parameters.getTargetProperties().get( SCP_DISABLE_HOST_VALIDATION ); HostKeyVerifier hostKeyVerifier; if( "true".equalsIgnoreCase( skipHostVerification )) { this.logger.fine( "Skipping host validation..." ); hostKeyVerifier = new PromiscuousVerifier(); } else { hostKeyVerifier = new FingerPrintVerifier( parameters.getTargetProperties()); } ssh.addHostKeyVerifier( hostKeyVerifier ); // Known hosts - when no file is specified, it is loaded from "~/.ssh" String knownHostsFile = this.parameters.getTargetProperties().get( SCP_KNOWN_HOSTS_FILE ); if( knownHostsFile == null ) ssh.loadKnownHosts(); else ssh.loadKnownHosts( new File( knownHostsFile )); // Open the connection this.logger.fine( "Connecting to " + ip + "..." ); ssh.connect( ip ); // "ubuntu" is the default user name on several (ubuntu) systems, including IaaS VMs String user = Utils.getValue( this.parameters.getTargetProperties(), SCP_USER, "ubuntu" ); // Key file - when no file is specified, it is loaded from "~/.ssh" String keyfile = this.parameters.getTargetProperties().get( SCP_KEY_FILE ); if( keyfile == null ) ssh.authPublickey( user ); else ssh.authPublickey( user, keyfile ); // Do what we need to do Map<String,String> keyToNewValue = prepareConfiguration( this.parameters, ssh, tmpDir ); updateAgentConfigurationFile( this.parameters, ssh, tmpDir, keyToNewValue ); } finally { try { ssh.disconnect(); ssh.close(); } catch( Exception e ) { Utils.logException( this.logger, e ); } finally { this.logger.fine( "Disconnected from " + ip ); } Utils.deleteFilesRecursivelyAndQuietly( tmpDir ); } }
[ "protected", "void", "configureRemoteAgent", "(", "String", "ip", ",", "final", "TargetHandlerParameters", "parameters", ")", "throws", "IOException", "{", "this", ".", "logger", ".", "fine", "(", "\"Configuring remote agent @ \"", "+", "ip", ")", ";", "SSHClient", "ssh", "=", "new", "SSHClient", "(", ")", ";", "File", "tmpDir", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"java.io.tmpdir\"", ")", ",", "UUID", ".", "randomUUID", "(", ")", ".", "toString", "(", ")", ")", ";", "Utils", ".", "createDirectory", "(", "tmpDir", ")", ";", "try", "{", "// Prepare the connection", "String", "skipHostVerification", "=", "parameters", ".", "getTargetProperties", "(", ")", ".", "get", "(", "SCP_DISABLE_HOST_VALIDATION", ")", ";", "HostKeyVerifier", "hostKeyVerifier", ";", "if", "(", "\"true\"", ".", "equalsIgnoreCase", "(", "skipHostVerification", ")", ")", "{", "this", ".", "logger", ".", "fine", "(", "\"Skipping host validation...\"", ")", ";", "hostKeyVerifier", "=", "new", "PromiscuousVerifier", "(", ")", ";", "}", "else", "{", "hostKeyVerifier", "=", "new", "FingerPrintVerifier", "(", "parameters", ".", "getTargetProperties", "(", ")", ")", ";", "}", "ssh", ".", "addHostKeyVerifier", "(", "hostKeyVerifier", ")", ";", "// Known hosts - when no file is specified, it is loaded from \"~/.ssh\"", "String", "knownHostsFile", "=", "this", ".", "parameters", ".", "getTargetProperties", "(", ")", ".", "get", "(", "SCP_KNOWN_HOSTS_FILE", ")", ";", "if", "(", "knownHostsFile", "==", "null", ")", "ssh", ".", "loadKnownHosts", "(", ")", ";", "else", "ssh", ".", "loadKnownHosts", "(", "new", "File", "(", "knownHostsFile", ")", ")", ";", "// Open the connection", "this", ".", "logger", ".", "fine", "(", "\"Connecting to \"", "+", "ip", "+", "\"...\"", ")", ";", "ssh", ".", "connect", "(", "ip", ")", ";", "// \"ubuntu\" is the default user name on several (ubuntu) systems, including IaaS VMs", "String", "user", "=", "Utils", ".", "getValue", "(", "this", ".", "parameters", ".", "getTargetProperties", "(", ")", ",", "SCP_USER", ",", "\"ubuntu\"", ")", ";", "// Key file - when no file is specified, it is loaded from \"~/.ssh\"", "String", "keyfile", "=", "this", ".", "parameters", ".", "getTargetProperties", "(", ")", ".", "get", "(", "SCP_KEY_FILE", ")", ";", "if", "(", "keyfile", "==", "null", ")", "ssh", ".", "authPublickey", "(", "user", ")", ";", "else", "ssh", ".", "authPublickey", "(", "user", ",", "keyfile", ")", ";", "// Do what we need to do", "Map", "<", "String", ",", "String", ">", "keyToNewValue", "=", "prepareConfiguration", "(", "this", ".", "parameters", ",", "ssh", ",", "tmpDir", ")", ";", "updateAgentConfigurationFile", "(", "this", ".", "parameters", ",", "ssh", ",", "tmpDir", ",", "keyToNewValue", ")", ";", "}", "finally", "{", "try", "{", "ssh", ".", "disconnect", "(", ")", ";", "ssh", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Utils", ".", "logException", "(", "this", ".", "logger", ",", "e", ")", ";", "}", "finally", "{", "this", ".", "logger", ".", "fine", "(", "\"Disconnected from \"", "+", "ip", ")", ";", "}", "Utils", ".", "deleteFilesRecursivelyAndQuietly", "(", "tmpDir", ")", ";", "}", "}" ]
Configures a remote agent by using SCP. <p> A user-data file will be generated, sent to the remote host (in agent configuration directory), then the remote agent configuration file will be updated to point on the new user-data file ("parameters" property). </p> @param ip IP address of remote host @param parameters Target handler parameters (with user-data inside) @throws IOException
[ "Configures", "a", "remote", "agent", "by", "using", "SCP", ".", "<p", ">", "A", "user", "-", "data", "file", "will", "be", "generated", "sent", "to", "the", "remote", "host", "(", "in", "agent", "configuration", "directory", ")", "then", "the", "remote", "agent", "configuration", "file", "will", "be", "updated", "to", "point", "on", "the", "new", "user", "-", "data", "file", "(", "parameters", "property", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-embedded/src/main/java/net/roboconf/target/embedded/internal/ConfiguratorOnCreation.java#L137-L196
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/consumer/diff/calculation/BlockManagement.java
BlockManagement.copy
private String copy(final char[] array, final int start, final int end) { """ Copies the specified interval of characters for the array. @return specified interval """ StringBuilder text = new StringBuilder(); for (int j = start; j < end; j++) { text.append(array[j]); } return text.toString(); }
java
private String copy(final char[] array, final int start, final int end) { StringBuilder text = new StringBuilder(); for (int j = start; j < end; j++) { text.append(array[j]); } return text.toString(); }
[ "private", "String", "copy", "(", "final", "char", "[", "]", "array", ",", "final", "int", "start", ",", "final", "int", "end", ")", "{", "StringBuilder", "text", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "j", "=", "start", ";", "j", "<", "end", ";", "j", "++", ")", "{", "text", ".", "append", "(", "array", "[", "j", "]", ")", ";", "}", "return", "text", ".", "toString", "(", ")", ";", "}" ]
Copies the specified interval of characters for the array. @return specified interval
[ "Copies", "the", "specified", "interval", "of", "characters", "for", "the", "array", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/consumer/diff/calculation/BlockManagement.java#L190-L198
phxql/argon2-jvm
src/main/java/de/mkammerer/argon2/Argon2Helper.java
Argon2Helper.findIterations
public static int findIterations(Argon2 argon2, long maxMillisecs, int memory, int parallelism) { """ Finds the number of iterations so that the hash function takes at most the given number of milliseconds. @param argon2 Argon2 instance. @param maxMillisecs Maximum number of milliseconds the hash function must take. @param memory Memory. See {@link Argon2#hash(int, int, int, char[])}. @param parallelism Parallelism. See {@link Argon2#hash(int, int, int, char[])}. @return The number of iterations so that the hash function takes at most the given number of milliseconds. """ return findIterations(argon2, maxMillisecs, memory, parallelism, new NoopLogger()); }
java
public static int findIterations(Argon2 argon2, long maxMillisecs, int memory, int parallelism) { return findIterations(argon2, maxMillisecs, memory, parallelism, new NoopLogger()); }
[ "public", "static", "int", "findIterations", "(", "Argon2", "argon2", ",", "long", "maxMillisecs", ",", "int", "memory", ",", "int", "parallelism", ")", "{", "return", "findIterations", "(", "argon2", ",", "maxMillisecs", ",", "memory", ",", "parallelism", ",", "new", "NoopLogger", "(", ")", ")", ";", "}" ]
Finds the number of iterations so that the hash function takes at most the given number of milliseconds. @param argon2 Argon2 instance. @param maxMillisecs Maximum number of milliseconds the hash function must take. @param memory Memory. See {@link Argon2#hash(int, int, int, char[])}. @param parallelism Parallelism. See {@link Argon2#hash(int, int, int, char[])}. @return The number of iterations so that the hash function takes at most the given number of milliseconds.
[ "Finds", "the", "number", "of", "iterations", "so", "that", "the", "hash", "function", "takes", "at", "most", "the", "given", "number", "of", "milliseconds", "." ]
train
https://github.com/phxql/argon2-jvm/blob/27a13907729e67e98cca53eba279e109b60f04f1/src/main/java/de/mkammerer/argon2/Argon2Helper.java#L43-L45
sebastiangraf/treetank
interfacemodules/jax-rx/src/main/java/org/jaxrx/JettyServer.java
JettyServer.register
public static void register(final Server s) { """ Constructor, attaching JAX-RX to the specified server. @param s server instance """ final ServletHolder sh = new ServletHolder(ServletContainer.class); sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig"); sh.setInitParameter("com.sun.jersey.config.property.packages", "org.jaxrx.resource"); new Context(s, "/", Context.SESSIONS).addServlet(sh, "/"); }
java
public static void register(final Server s) { final ServletHolder sh = new ServletHolder(ServletContainer.class); sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig"); sh.setInitParameter("com.sun.jersey.config.property.packages", "org.jaxrx.resource"); new Context(s, "/", Context.SESSIONS).addServlet(sh, "/"); }
[ "public", "static", "void", "register", "(", "final", "Server", "s", ")", "{", "final", "ServletHolder", "sh", "=", "new", "ServletHolder", "(", "ServletContainer", ".", "class", ")", ";", "sh", ".", "setInitParameter", "(", "\"com.sun.jersey.config.property.resourceConfigClass\"", ",", "\"com.sun.jersey.api.core.PackagesResourceConfig\"", ")", ";", "sh", ".", "setInitParameter", "(", "\"com.sun.jersey.config.property.packages\"", ",", "\"org.jaxrx.resource\"", ")", ";", "new", "Context", "(", "s", ",", "\"/\"", ",", "Context", ".", "SESSIONS", ")", ".", "addServlet", "(", "sh", ",", "\"/\"", ")", ";", "}" ]
Constructor, attaching JAX-RX to the specified server. @param s server instance
[ "Constructor", "attaching", "JAX", "-", "RX", "to", "the", "specified", "server", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/JettyServer.java#L70-L77
radkovo/jStyleParser
src/main/java/cz/vutbr/web/css/MediaSpec.java
MediaSpec.valueMatches
protected boolean valueMatches(Float required, float current, boolean min, boolean max) { """ Checks whether a value coresponds to the given criteria. @param current the actual media value @param required the required value or {@code null} for invalid requirement @param min {@code true} when the required value is the minimal one @param max {@code true} when the required value is the maximal one @return {@code true} when the value matches the criteria. """ if (required != null) { if (min) return (current >= required); else if (max) return (current <= required); else return current == required; } else return false; //invalid values don't match }
java
protected boolean valueMatches(Float required, float current, boolean min, boolean max) { if (required != null) { if (min) return (current >= required); else if (max) return (current <= required); else return current == required; } else return false; //invalid values don't match }
[ "protected", "boolean", "valueMatches", "(", "Float", "required", ",", "float", "current", ",", "boolean", "min", ",", "boolean", "max", ")", "{", "if", "(", "required", "!=", "null", ")", "{", "if", "(", "min", ")", "return", "(", "current", ">=", "required", ")", ";", "else", "if", "(", "max", ")", "return", "(", "current", "<=", "required", ")", ";", "else", "return", "current", "==", "required", ";", "}", "else", "return", "false", ";", "//invalid values don't match", "}" ]
Checks whether a value coresponds to the given criteria. @param current the actual media value @param required the required value or {@code null} for invalid requirement @param min {@code true} when the required value is the minimal one @param max {@code true} when the required value is the maximal one @return {@code true} when the value matches the criteria.
[ "Checks", "whether", "a", "value", "coresponds", "to", "the", "given", "criteria", "." ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L514-L527
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java
SignupFormPanel.newButtonLabel
protected Label newButtonLabel(final String id, final String resourceKey, final String defaultValue) { """ Factory method for creating the Button Label. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a Label. @param id the id @param resourceKey the resource key @param defaultValue the default value @return the label """ final IModel<String> labelModel = ResourceModelFactory.newResourceModel(resourceKey, this, defaultValue); final Label label = new Label(id, labelModel); label.setOutputMarkupId(true); return label; }
java
protected Label newButtonLabel(final String id, final String resourceKey, final String defaultValue) { final IModel<String> labelModel = ResourceModelFactory.newResourceModel(resourceKey, this, defaultValue); final Label label = new Label(id, labelModel); label.setOutputMarkupId(true); return label; }
[ "protected", "Label", "newButtonLabel", "(", "final", "String", "id", ",", "final", "String", "resourceKey", ",", "final", "String", "defaultValue", ")", "{", "final", "IModel", "<", "String", ">", "labelModel", "=", "ResourceModelFactory", ".", "newResourceModel", "(", "resourceKey", ",", "this", ",", "defaultValue", ")", ";", "final", "Label", "label", "=", "new", "Label", "(", "id", ",", "labelModel", ")", ";", "label", ".", "setOutputMarkupId", "(", "true", ")", ";", "return", "label", ";", "}" ]
Factory method for creating the Button Label. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a Label. @param id the id @param resourceKey the resource key @param defaultValue the default value @return the label
[ "Factory", "method", "for", "creating", "the", "Button", "Label", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", "version", "of", "a", "Label", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java#L135-L143
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.deletePublishJob
public void deletePublishJob(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException { """ Deletes a publish job identified by its history id.<p> @param dbc the current database context @param publishHistoryId the history id identifying the publish job @throws CmsException if something goes wrong """ getProjectDriver(dbc).deletePublishJob(dbc, publishHistoryId); }
java
public void deletePublishJob(CmsDbContext dbc, CmsUUID publishHistoryId) throws CmsException { getProjectDriver(dbc).deletePublishJob(dbc, publishHistoryId); }
[ "public", "void", "deletePublishJob", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "publishHistoryId", ")", "throws", "CmsException", "{", "getProjectDriver", "(", "dbc", ")", ".", "deletePublishJob", "(", "dbc", ",", "publishHistoryId", ")", ";", "}" ]
Deletes a publish job identified by its history id.<p> @param dbc the current database context @param publishHistoryId the history id identifying the publish job @throws CmsException if something goes wrong
[ "Deletes", "a", "publish", "job", "identified", "by", "its", "history", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2775-L2778
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java
EnvironmentsInner.resetPassword
public void resetPassword(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, ResetPasswordPayload resetPasswordPayload) { """ Resets the user password on an environment This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @param resetPasswordPayload Represents the payload for resetting passwords. @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 """ resetPasswordWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload).toBlocking().last().body(); }
java
public void resetPassword(String resourceGroupName, String labAccountName, String labName, String environmentSettingName, String environmentName, ResetPasswordPayload resetPasswordPayload) { resetPasswordWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName, environmentName, resetPasswordPayload).toBlocking().last().body(); }
[ "public", "void", "resetPassword", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ",", "String", "environmentName", ",", "ResetPasswordPayload", "resetPasswordPayload", ")", "{", "resetPasswordWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ",", "labName", ",", "environmentSettingName", ",", "environmentName", ",", "resetPasswordPayload", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Resets the user password on an environment This operation can take a while to complete. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @param environmentName The name of the environment. @param resetPasswordPayload Represents the payload for resetting passwords. @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
[ "Resets", "the", "user", "password", "on", "an", "environment", "This", "operation", "can", "take", "a", "while", "to", "complete", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentsInner.java#L1179-L1181
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.distancePointPlane
public static float distancePointPlane(float pointX, float pointY, float pointZ, float a, float b, float c, float d) { """ Determine the signed distance of the given point <code>(pointX, pointY, pointZ)</code> to the plane specified via its general plane equation <i>a*x + b*y + c*z + d = 0</i>. @param pointX the x coordinate of the point @param pointY the y coordinate of the point @param pointZ the z coordinate of the point @param a the x factor in the plane equation @param b the y factor in the plane equation @param c the z factor in the plane equation @param d the constant in the plane equation @return the distance between the point and the plane """ float denom = (float) Math.sqrt(a * a + b * b + c * c); return (a * pointX + b * pointY + c * pointZ + d) / denom; }
java
public static float distancePointPlane(float pointX, float pointY, float pointZ, float a, float b, float c, float d) { float denom = (float) Math.sqrt(a * a + b * b + c * c); return (a * pointX + b * pointY + c * pointZ + d) / denom; }
[ "public", "static", "float", "distancePointPlane", "(", "float", "pointX", ",", "float", "pointY", ",", "float", "pointZ", ",", "float", "a", ",", "float", "b", ",", "float", "c", ",", "float", "d", ")", "{", "float", "denom", "=", "(", "float", ")", "Math", ".", "sqrt", "(", "a", "*", "a", "+", "b", "*", "b", "+", "c", "*", "c", ")", ";", "return", "(", "a", "*", "pointX", "+", "b", "*", "pointY", "+", "c", "*", "pointZ", "+", "d", ")", "/", "denom", ";", "}" ]
Determine the signed distance of the given point <code>(pointX, pointY, pointZ)</code> to the plane specified via its general plane equation <i>a*x + b*y + c*z + d = 0</i>. @param pointX the x coordinate of the point @param pointY the y coordinate of the point @param pointZ the z coordinate of the point @param a the x factor in the plane equation @param b the y factor in the plane equation @param c the z factor in the plane equation @param d the constant in the plane equation @return the distance between the point and the plane
[ "Determine", "the", "signed", "distance", "of", "the", "given", "point", "<code", ">", "(", "pointX", "pointY", "pointZ", ")", "<", "/", "code", ">", "to", "the", "plane", "specified", "via", "its", "general", "plane", "equation", "<i", ">", "a", "*", "x", "+", "b", "*", "y", "+", "c", "*", "z", "+", "d", "=", "0<", "/", "i", ">", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L958-L961
likethecolor/Alchemy-API
src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java
AbstractParser.getJSONArray
protected JSONArray getJSONArray(final String key, final JSONObject jsonObject) { """ Check to make sure the JSONObject has the specified key and if so return the value as a JSONArray. If no key is found an empty JSONArray is returned. @param key name of the field to fetch from the json object @param jsonObject object from which to fetch the value @return json array value corresponding to the key or "" if key not found """ JSONArray value = new JSONArray(); if(hasKey(key, jsonObject)) { try { value = jsonObject.getJSONArray(key); } catch(JSONException e) { LOGGER.error("Could not get JSONArray from JSONObject for key: " + key, e); } } return value; }
java
protected JSONArray getJSONArray(final String key, final JSONObject jsonObject) { JSONArray value = new JSONArray(); if(hasKey(key, jsonObject)) { try { value = jsonObject.getJSONArray(key); } catch(JSONException e) { LOGGER.error("Could not get JSONArray from JSONObject for key: " + key, e); } } return value; }
[ "protected", "JSONArray", "getJSONArray", "(", "final", "String", "key", ",", "final", "JSONObject", "jsonObject", ")", "{", "JSONArray", "value", "=", "new", "JSONArray", "(", ")", ";", "if", "(", "hasKey", "(", "key", ",", "jsonObject", ")", ")", "{", "try", "{", "value", "=", "jsonObject", ".", "getJSONArray", "(", "key", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"Could not get JSONArray from JSONObject for key: \"", "+", "key", ",", "e", ")", ";", "}", "}", "return", "value", ";", "}" ]
Check to make sure the JSONObject has the specified key and if so return the value as a JSONArray. If no key is found an empty JSONArray is returned. @param key name of the field to fetch from the json object @param jsonObject object from which to fetch the value @return json array value corresponding to the key or "" if key not found
[ "Check", "to", "make", "sure", "the", "JSONObject", "has", "the", "specified", "key", "and", "if", "so", "return", "the", "value", "as", "a", "JSONArray", ".", "If", "no", "key", "is", "found", "an", "empty", "JSONArray", "is", "returned", "." ]
train
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java#L256-L267
openengsb/openengsb
components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/ManipulationUtils.java
ManipulationUtils.handleField
private static String handleField(CtField field, CtClass clazz) throws NotFoundException, CannotCompileException { """ Analyzes the given field and add logic based on the type of the field. """ StringBuilder builder = new StringBuilder(); CtClass fieldType = field.getType(); String property = field.getName(); if (fieldType.equals(cp.get(File.class.getName()))) { return handleFileField(property, clazz); } CtMethod getter = getFieldGetter(field, clazz); if (getter == null) { LOGGER.warn(String.format("Ignoring property '%s' since there is no getter for it defined", property)); } else if (fieldType.isPrimitive()) { builder.append(createTrace(String.format("Handle primitive type property '%s'", property))); CtPrimitiveType primitiveType = (CtPrimitiveType) fieldType; String wrapperName = primitiveType.getWrapperName(); builder.append(String.format( "elements.add(new OpenEngSBModelEntry(\"%s\", %s.valueOf(%s()), %s.class));\n", property, wrapperName, getter.getName(), wrapperName)); } else { builder.append(createTrace(String.format("Handle property '%s'", property))) .append(String.format("elements.add(new OpenEngSBModelEntry(\"%s\", %s(), %s.class));\n", property, getter.getName(), fieldType.getName())); } return builder.toString(); }
java
private static String handleField(CtField field, CtClass clazz) throws NotFoundException, CannotCompileException { StringBuilder builder = new StringBuilder(); CtClass fieldType = field.getType(); String property = field.getName(); if (fieldType.equals(cp.get(File.class.getName()))) { return handleFileField(property, clazz); } CtMethod getter = getFieldGetter(field, clazz); if (getter == null) { LOGGER.warn(String.format("Ignoring property '%s' since there is no getter for it defined", property)); } else if (fieldType.isPrimitive()) { builder.append(createTrace(String.format("Handle primitive type property '%s'", property))); CtPrimitiveType primitiveType = (CtPrimitiveType) fieldType; String wrapperName = primitiveType.getWrapperName(); builder.append(String.format( "elements.add(new OpenEngSBModelEntry(\"%s\", %s.valueOf(%s()), %s.class));\n", property, wrapperName, getter.getName(), wrapperName)); } else { builder.append(createTrace(String.format("Handle property '%s'", property))) .append(String.format("elements.add(new OpenEngSBModelEntry(\"%s\", %s(), %s.class));\n", property, getter.getName(), fieldType.getName())); } return builder.toString(); }
[ "private", "static", "String", "handleField", "(", "CtField", "field", ",", "CtClass", "clazz", ")", "throws", "NotFoundException", ",", "CannotCompileException", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "CtClass", "fieldType", "=", "field", ".", "getType", "(", ")", ";", "String", "property", "=", "field", ".", "getName", "(", ")", ";", "if", "(", "fieldType", ".", "equals", "(", "cp", ".", "get", "(", "File", ".", "class", ".", "getName", "(", ")", ")", ")", ")", "{", "return", "handleFileField", "(", "property", ",", "clazz", ")", ";", "}", "CtMethod", "getter", "=", "getFieldGetter", "(", "field", ",", "clazz", ")", ";", "if", "(", "getter", "==", "null", ")", "{", "LOGGER", ".", "warn", "(", "String", ".", "format", "(", "\"Ignoring property '%s' since there is no getter for it defined\"", ",", "property", ")", ")", ";", "}", "else", "if", "(", "fieldType", ".", "isPrimitive", "(", ")", ")", "{", "builder", ".", "append", "(", "createTrace", "(", "String", ".", "format", "(", "\"Handle primitive type property '%s'\"", ",", "property", ")", ")", ")", ";", "CtPrimitiveType", "primitiveType", "=", "(", "CtPrimitiveType", ")", "fieldType", ";", "String", "wrapperName", "=", "primitiveType", ".", "getWrapperName", "(", ")", ";", "builder", ".", "append", "(", "String", ".", "format", "(", "\"elements.add(new OpenEngSBModelEntry(\\\"%s\\\", %s.valueOf(%s()), %s.class));\\n\"", ",", "property", ",", "wrapperName", ",", "getter", ".", "getName", "(", ")", ",", "wrapperName", ")", ")", ";", "}", "else", "{", "builder", ".", "append", "(", "createTrace", "(", "String", ".", "format", "(", "\"Handle property '%s'\"", ",", "property", ")", ")", ")", ".", "append", "(", "String", ".", "format", "(", "\"elements.add(new OpenEngSBModelEntry(\\\"%s\\\", %s(), %s.class));\\n\"", ",", "property", ",", "getter", ".", "getName", "(", ")", ",", "fieldType", ".", "getName", "(", ")", ")", ")", ";", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Analyzes the given field and add logic based on the type of the field.
[ "Analyzes", "the", "given", "field", "and", "add", "logic", "based", "on", "the", "type", "of", "the", "field", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/ManipulationUtils.java#L387-L410
Metatavu/edelphi
rest/src/main/java/fi/metatavu/edelphi/comments/QueryQuestionCommentController.java
QueryQuestionCommentController.createQueryQuestionComment
public QueryQuestionComment createQueryQuestionComment(QueryReply queryReply, QueryPage queryPage, QueryQuestionComment parentComment, String comment, Boolean hidden, User creator, Date created) { """ Creates new query question comment @param queryReply query reply @param queryPage query page @param parentComment parent comment @param comment comment contents @param hidden whether comment should be hidden @param creator creator @param created create time @return created comment """ return queryQuestionCommentDAO.create(queryReply, queryPage, parentComment, comment, hidden, creator, created, creator, created); }
java
public QueryQuestionComment createQueryQuestionComment(QueryReply queryReply, QueryPage queryPage, QueryQuestionComment parentComment, String comment, Boolean hidden, User creator, Date created) { return queryQuestionCommentDAO.create(queryReply, queryPage, parentComment, comment, hidden, creator, created, creator, created); }
[ "public", "QueryQuestionComment", "createQueryQuestionComment", "(", "QueryReply", "queryReply", ",", "QueryPage", "queryPage", ",", "QueryQuestionComment", "parentComment", ",", "String", "comment", ",", "Boolean", "hidden", ",", "User", "creator", ",", "Date", "created", ")", "{", "return", "queryQuestionCommentDAO", ".", "create", "(", "queryReply", ",", "queryPage", ",", "parentComment", ",", "comment", ",", "hidden", ",", "creator", ",", "created", ",", "creator", ",", "created", ")", ";", "}" ]
Creates new query question comment @param queryReply query reply @param queryPage query page @param parentComment parent comment @param comment comment contents @param hidden whether comment should be hidden @param creator creator @param created create time @return created comment
[ "Creates", "new", "query", "question", "comment" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/rest/src/main/java/fi/metatavu/edelphi/comments/QueryQuestionCommentController.java#L49-L51
FasterXML/woodstox
src/main/java/com/ctc/wstx/evt/WstxEventReader.java
WstxEventReader.findErrorDesc
protected final String findErrorDesc(int errorType, int currEvent) { """ Method used to locate error message description to use. Calls sub-classes <code>getErrorDesc()</code> first, and only if no message found, uses default messages defined here. """ String msg = getErrorDesc(errorType, currEvent); if (msg != null) { return msg; } switch (errorType) { case ERR_GETELEMTEXT_NOT_START_ELEM: return "Current state not START_ELEMENT when calling getElementText()"; case ERR_GETELEMTEXT_NON_TEXT_EVENT: return "Expected a text token"; case ERR_NEXTTAG_NON_WS_TEXT: return "Only all-whitespace CHARACTERS/CDATA (or SPACE) allowed for nextTag()"; case ERR_NEXTTAG_WRONG_TYPE: return "Should only encounter START_ELEMENT/END_ELEMENT, SPACE, or all-white-space CHARACTERS"; } // should never happen, but it'd be bad to throw another exception... return "Internal error (unrecognized error type: "+errorType+")"; }
java
protected final String findErrorDesc(int errorType, int currEvent) { String msg = getErrorDesc(errorType, currEvent); if (msg != null) { return msg; } switch (errorType) { case ERR_GETELEMTEXT_NOT_START_ELEM: return "Current state not START_ELEMENT when calling getElementText()"; case ERR_GETELEMTEXT_NON_TEXT_EVENT: return "Expected a text token"; case ERR_NEXTTAG_NON_WS_TEXT: return "Only all-whitespace CHARACTERS/CDATA (or SPACE) allowed for nextTag()"; case ERR_NEXTTAG_WRONG_TYPE: return "Should only encounter START_ELEMENT/END_ELEMENT, SPACE, or all-white-space CHARACTERS"; } // should never happen, but it'd be bad to throw another exception... return "Internal error (unrecognized error type: "+errorType+")"; }
[ "protected", "final", "String", "findErrorDesc", "(", "int", "errorType", ",", "int", "currEvent", ")", "{", "String", "msg", "=", "getErrorDesc", "(", "errorType", ",", "currEvent", ")", ";", "if", "(", "msg", "!=", "null", ")", "{", "return", "msg", ";", "}", "switch", "(", "errorType", ")", "{", "case", "ERR_GETELEMTEXT_NOT_START_ELEM", ":", "return", "\"Current state not START_ELEMENT when calling getElementText()\"", ";", "case", "ERR_GETELEMTEXT_NON_TEXT_EVENT", ":", "return", "\"Expected a text token\"", ";", "case", "ERR_NEXTTAG_NON_WS_TEXT", ":", "return", "\"Only all-whitespace CHARACTERS/CDATA (or SPACE) allowed for nextTag()\"", ";", "case", "ERR_NEXTTAG_WRONG_TYPE", ":", "return", "\"Should only encounter START_ELEMENT/END_ELEMENT, SPACE, or all-white-space CHARACTERS\"", ";", "}", "// should never happen, but it'd be bad to throw another exception...", "return", "\"Internal error (unrecognized error type: \"", "+", "errorType", "+", "\")\"", ";", "}" ]
Method used to locate error message description to use. Calls sub-classes <code>getErrorDesc()</code> first, and only if no message found, uses default messages defined here.
[ "Method", "used", "to", "locate", "error", "message", "description", "to", "use", ".", "Calls", "sub", "-", "classes", "<code", ">", "getErrorDesc", "()", "<", "/", "code", ">", "first", "and", "only", "if", "no", "message", "found", "uses", "default", "messages", "defined", "here", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/evt/WstxEventReader.java#L568-L587
knowm/XChange
xchange-gemini/src/main/java/org/knowm/xchange/gemini/v1/service/GeminiAccountService.java
GeminiAccountService.requestDepositAddress
@Override public String requestDepositAddress(Currency currency, String... arguments) throws IOException { """ This will result in a new address being created each time, and is severely rate-limited """ GeminiDepositAddressResponse response = super.requestDepositAddressRaw(currency); return response.getAddress(); }
java
@Override public String requestDepositAddress(Currency currency, String... arguments) throws IOException { GeminiDepositAddressResponse response = super.requestDepositAddressRaw(currency); return response.getAddress(); }
[ "@", "Override", "public", "String", "requestDepositAddress", "(", "Currency", "currency", ",", "String", "...", "arguments", ")", "throws", "IOException", "{", "GeminiDepositAddressResponse", "response", "=", "super", ".", "requestDepositAddressRaw", "(", "currency", ")", ";", "return", "response", ".", "getAddress", "(", ")", ";", "}" ]
This will result in a new address being created each time, and is severely rate-limited
[ "This", "will", "result", "in", "a", "new", "address", "being", "created", "each", "time", "and", "is", "severely", "rate", "-", "limited" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-gemini/src/main/java/org/knowm/xchange/gemini/v1/service/GeminiAccountService.java#L71-L75
recommenders/rival
rival-split/src/main/java/net/recommenders/rival/split/parser/MovielensParser.java
MovielensParser.parseLine
private void parseLine(final String line, final TemporalDataModelIF<Long, Long> dataset) { """ A method that parses a line from the file. @param line the line to be parsed @param dataset the dataset where the information parsed from the line will be stored into. """ String[] toks; if (line.contains("::")) { toks = line.split("::"); } else { toks = line.split("\t"); } // user long userId = Long.parseLong(toks[USER_TOK]); // item long itemId = Long.parseLong(toks[ITEM_TOK]); // timestamp long timestamp = Long.parseLong(toks[TIME_TOK]); // preference double preference = Double.parseDouble(toks[RATING_TOK]); ////// // update information ////// dataset.addPreference(userId, itemId, preference); dataset.addTimestamp(userId, itemId, timestamp); }
java
private void parseLine(final String line, final TemporalDataModelIF<Long, Long> dataset) { String[] toks; if (line.contains("::")) { toks = line.split("::"); } else { toks = line.split("\t"); } // user long userId = Long.parseLong(toks[USER_TOK]); // item long itemId = Long.parseLong(toks[ITEM_TOK]); // timestamp long timestamp = Long.parseLong(toks[TIME_TOK]); // preference double preference = Double.parseDouble(toks[RATING_TOK]); ////// // update information ////// dataset.addPreference(userId, itemId, preference); dataset.addTimestamp(userId, itemId, timestamp); }
[ "private", "void", "parseLine", "(", "final", "String", "line", ",", "final", "TemporalDataModelIF", "<", "Long", ",", "Long", ">", "dataset", ")", "{", "String", "[", "]", "toks", ";", "if", "(", "line", ".", "contains", "(", "\"::\"", ")", ")", "{", "toks", "=", "line", ".", "split", "(", "\"::\"", ")", ";", "}", "else", "{", "toks", "=", "line", ".", "split", "(", "\"\\t\"", ")", ";", "}", "// user", "long", "userId", "=", "Long", ".", "parseLong", "(", "toks", "[", "USER_TOK", "]", ")", ";", "// item", "long", "itemId", "=", "Long", ".", "parseLong", "(", "toks", "[", "ITEM_TOK", "]", ")", ";", "// timestamp", "long", "timestamp", "=", "Long", ".", "parseLong", "(", "toks", "[", "TIME_TOK", "]", ")", ";", "// preference", "double", "preference", "=", "Double", ".", "parseDouble", "(", "toks", "[", "RATING_TOK", "]", ")", ";", "//////", "// update information", "//////", "dataset", ".", "addPreference", "(", "userId", ",", "itemId", ",", "preference", ")", ";", "dataset", ".", "addTimestamp", "(", "userId", ",", "itemId", ",", "timestamp", ")", ";", "}" ]
A method that parses a line from the file. @param line the line to be parsed @param dataset the dataset where the information parsed from the line will be stored into.
[ "A", "method", "that", "parses", "a", "line", "from", "the", "file", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-split/src/main/java/net/recommenders/rival/split/parser/MovielensParser.java#L84-L104
baratine/baratine
framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java
HeartbeatImpl.updateExternal
private void updateExternal(ServerHeartbeat server, String externalId) { """ Update the external server delegation. Cloud static IPs might be routing IPs that aren't local interfaces. In that case, the routing assignment to the dynamic IP must be passed along with the heartbeat. """ if (externalId != null) { ServerHeartbeat serverExternal = _root.getServer(externalId); server.setExternalServer(serverExternal); } else { server.setExternalServer(null); /* if (serverExternal != null) { serverExternal.setDelegate(data); _root.updateSequence(); } */ } // data.setExternalId(externalId); }
java
private void updateExternal(ServerHeartbeat server, String externalId) { if (externalId != null) { ServerHeartbeat serverExternal = _root.getServer(externalId); server.setExternalServer(serverExternal); } else { server.setExternalServer(null); /* if (serverExternal != null) { serverExternal.setDelegate(data); _root.updateSequence(); } */ } // data.setExternalId(externalId); }
[ "private", "void", "updateExternal", "(", "ServerHeartbeat", "server", ",", "String", "externalId", ")", "{", "if", "(", "externalId", "!=", "null", ")", "{", "ServerHeartbeat", "serverExternal", "=", "_root", ".", "getServer", "(", "externalId", ")", ";", "server", ".", "setExternalServer", "(", "serverExternal", ")", ";", "}", "else", "{", "server", ".", "setExternalServer", "(", "null", ")", ";", "/*\n if (serverExternal != null) {\n serverExternal.setDelegate(data);\n \n _root.updateSequence();\n }\n */", "}", "// data.setExternalId(externalId);", "}" ]
Update the external server delegation. Cloud static IPs might be routing IPs that aren't local interfaces. In that case, the routing assignment to the dynamic IP must be passed along with the heartbeat.
[ "Update", "the", "external", "server", "delegation", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L742-L761
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyTotalLeastSquares.java
HomographyTotalLeastSquares.process
public boolean process(List<AssociatedPair> points , DMatrixRMaj foundH ) { """ <p> Computes the homography matrix given a set of observed points in two images. A set of {@link AssociatedPair} is passed in. The computed homography 'H' is found such that the attributes 'p1' and 'p2' in {@link AssociatedPair} refers to x1 and x2, respectively, in the equation below:<br> x<sub>2</sub> = H*x<sub>1</sub> </p> @param points A set of observed image points that are generated from a planar object. Minimum of 4 pairs required. @param foundH Output: Storage for the found solution. 3x3 matrix. @return true if the calculation was a success. """ if (points.size() < 4) throw new IllegalArgumentException("Must be at least 4 points."); // Have to normalize the points. Being zero mean is essential in its derivation LowLevelMultiViewOps.computeNormalization(points, N1, N2); LowLevelMultiViewOps.applyNormalization(points,N1,N2,X1,X2); // Construct the linear system which is used to solve for H[6] to H[8] constructA678(); // Solve for those elements using the null space if( !solverNull.process(A,1,nullspace)) return false; DMatrixRMaj H = foundH; H.data[6] = nullspace.data[0]; H.data[7] = nullspace.data[1]; H.data[8] = nullspace.data[2]; // Determine H[0] to H[5] H.data[2] = -(XP_bar[0]*H.data[6] + XP_bar[1]*H.data[7]); H.data[5] = -(XP_bar[2]*H.data[6] + XP_bar[3]*H.data[7]); backsubstitution0134(P_plus,X1,X2,H.data); // Remove the normalization HomographyDirectLinearTransform.undoNormalizationH(foundH,N1,N2); CommonOps_DDRM.scale(1.0/foundH.get(2,2),foundH); return true; }
java
public boolean process(List<AssociatedPair> points , DMatrixRMaj foundH ) { if (points.size() < 4) throw new IllegalArgumentException("Must be at least 4 points."); // Have to normalize the points. Being zero mean is essential in its derivation LowLevelMultiViewOps.computeNormalization(points, N1, N2); LowLevelMultiViewOps.applyNormalization(points,N1,N2,X1,X2); // Construct the linear system which is used to solve for H[6] to H[8] constructA678(); // Solve for those elements using the null space if( !solverNull.process(A,1,nullspace)) return false; DMatrixRMaj H = foundH; H.data[6] = nullspace.data[0]; H.data[7] = nullspace.data[1]; H.data[8] = nullspace.data[2]; // Determine H[0] to H[5] H.data[2] = -(XP_bar[0]*H.data[6] + XP_bar[1]*H.data[7]); H.data[5] = -(XP_bar[2]*H.data[6] + XP_bar[3]*H.data[7]); backsubstitution0134(P_plus,X1,X2,H.data); // Remove the normalization HomographyDirectLinearTransform.undoNormalizationH(foundH,N1,N2); CommonOps_DDRM.scale(1.0/foundH.get(2,2),foundH); return true; }
[ "public", "boolean", "process", "(", "List", "<", "AssociatedPair", ">", "points", ",", "DMatrixRMaj", "foundH", ")", "{", "if", "(", "points", ".", "size", "(", ")", "<", "4", ")", "throw", "new", "IllegalArgumentException", "(", "\"Must be at least 4 points.\"", ")", ";", "// Have to normalize the points. Being zero mean is essential in its derivation", "LowLevelMultiViewOps", ".", "computeNormalization", "(", "points", ",", "N1", ",", "N2", ")", ";", "LowLevelMultiViewOps", ".", "applyNormalization", "(", "points", ",", "N1", ",", "N2", ",", "X1", ",", "X2", ")", ";", "// Construct the linear system which is used to solve for H[6] to H[8]", "constructA678", "(", ")", ";", "// Solve for those elements using the null space", "if", "(", "!", "solverNull", ".", "process", "(", "A", ",", "1", ",", "nullspace", ")", ")", "return", "false", ";", "DMatrixRMaj", "H", "=", "foundH", ";", "H", ".", "data", "[", "6", "]", "=", "nullspace", ".", "data", "[", "0", "]", ";", "H", ".", "data", "[", "7", "]", "=", "nullspace", ".", "data", "[", "1", "]", ";", "H", ".", "data", "[", "8", "]", "=", "nullspace", ".", "data", "[", "2", "]", ";", "// Determine H[0] to H[5]", "H", ".", "data", "[", "2", "]", "=", "-", "(", "XP_bar", "[", "0", "]", "*", "H", ".", "data", "[", "6", "]", "+", "XP_bar", "[", "1", "]", "*", "H", ".", "data", "[", "7", "]", ")", ";", "H", ".", "data", "[", "5", "]", "=", "-", "(", "XP_bar", "[", "2", "]", "*", "H", ".", "data", "[", "6", "]", "+", "XP_bar", "[", "3", "]", "*", "H", ".", "data", "[", "7", "]", ")", ";", "backsubstitution0134", "(", "P_plus", ",", "X1", ",", "X2", ",", "H", ".", "data", ")", ";", "// Remove the normalization", "HomographyDirectLinearTransform", ".", "undoNormalizationH", "(", "foundH", ",", "N1", ",", "N2", ")", ";", "CommonOps_DDRM", ".", "scale", "(", "1.0", "/", "foundH", ".", "get", "(", "2", ",", "2", ")", ",", "foundH", ")", ";", "return", "true", ";", "}" ]
<p> Computes the homography matrix given a set of observed points in two images. A set of {@link AssociatedPair} is passed in. The computed homography 'H' is found such that the attributes 'p1' and 'p2' in {@link AssociatedPair} refers to x1 and x2, respectively, in the equation below:<br> x<sub>2</sub> = H*x<sub>1</sub> </p> @param points A set of observed image points that are generated from a planar object. Minimum of 4 pairs required. @param foundH Output: Storage for the found solution. 3x3 matrix. @return true if the calculation was a success.
[ "<p", ">", "Computes", "the", "homography", "matrix", "given", "a", "set", "of", "observed", "points", "in", "two", "images", ".", "A", "set", "of", "{", "@link", "AssociatedPair", "}", "is", "passed", "in", ".", "The", "computed", "homography", "H", "is", "found", "such", "that", "the", "attributes", "p1", "and", "p2", "in", "{", "@link", "AssociatedPair", "}", "refers", "to", "x1", "and", "x2", "respectively", "in", "the", "equation", "below", ":", "<br", ">", "x<sub", ">", "2<", "/", "sub", ">", "=", "H", "*", "x<sub", ">", "1<", "/", "sub", ">", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/h/HomographyTotalLeastSquares.java#L77-L109
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java
SlotPoolImpl.scheduleRunAsync
protected void scheduleRunAsync(Runnable runnable, long delay, TimeUnit unit) { """ Execute the runnable in the main thread of the underlying RPC endpoint, with a delay of the given number of milliseconds. @param runnable Runnable to be executed @param delay The delay after which the runnable will be executed """ componentMainThreadExecutor.schedule(runnable, delay, unit); }
java
protected void scheduleRunAsync(Runnable runnable, long delay, TimeUnit unit) { componentMainThreadExecutor.schedule(runnable, delay, unit); }
[ "protected", "void", "scheduleRunAsync", "(", "Runnable", "runnable", ",", "long", "delay", ",", "TimeUnit", "unit", ")", "{", "componentMainThreadExecutor", ".", "schedule", "(", "runnable", ",", "delay", ",", "unit", ")", ";", "}" ]
Execute the runnable in the main thread of the underlying RPC endpoint, with a delay of the given number of milliseconds. @param runnable Runnable to be executed @param delay The delay after which the runnable will be executed
[ "Execute", "the", "runnable", "in", "the", "main", "thread", "of", "the", "underlying", "RPC", "endpoint", "with", "a", "delay", "of", "the", "given", "number", "of", "milliseconds", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPoolImpl.java#L889-L891
keenlabs/KeenClient-Java
core/src/main/java/io/keen/client/java/KeenClient.java
KeenClient.setAttemptsMap
private void setAttemptsMap(String projectId, String eventCollection, Map<String, Integer> attempts) throws IOException { """ Set the attempts Map in the eventStore @param projectId the project id @param eventCollection the collection name @param attempts the current attempts Map @throws IOException """ if (eventStore instanceof KeenAttemptCountingEventStore) { KeenAttemptCountingEventStore res = (KeenAttemptCountingEventStore)eventStore; StringWriter writer = null; try { writer = new StringWriter(); jsonHandler.writeJson(writer, attempts); String attemptsJSON = writer.toString(); res.setAttempts(projectId, eventCollection, attemptsJSON); } finally { KeenUtils.closeQuietly(writer); } } }
java
private void setAttemptsMap(String projectId, String eventCollection, Map<String, Integer> attempts) throws IOException { if (eventStore instanceof KeenAttemptCountingEventStore) { KeenAttemptCountingEventStore res = (KeenAttemptCountingEventStore)eventStore; StringWriter writer = null; try { writer = new StringWriter(); jsonHandler.writeJson(writer, attempts); String attemptsJSON = writer.toString(); res.setAttempts(projectId, eventCollection, attemptsJSON); } finally { KeenUtils.closeQuietly(writer); } } }
[ "private", "void", "setAttemptsMap", "(", "String", "projectId", ",", "String", "eventCollection", ",", "Map", "<", "String", ",", "Integer", ">", "attempts", ")", "throws", "IOException", "{", "if", "(", "eventStore", "instanceof", "KeenAttemptCountingEventStore", ")", "{", "KeenAttemptCountingEventStore", "res", "=", "(", "KeenAttemptCountingEventStore", ")", "eventStore", ";", "StringWriter", "writer", "=", "null", ";", "try", "{", "writer", "=", "new", "StringWriter", "(", ")", ";", "jsonHandler", ".", "writeJson", "(", "writer", ",", "attempts", ")", ";", "String", "attemptsJSON", "=", "writer", ".", "toString", "(", ")", ";", "res", ".", "setAttempts", "(", "projectId", ",", "eventCollection", ",", "attemptsJSON", ")", ";", "}", "finally", "{", "KeenUtils", ".", "closeQuietly", "(", "writer", ")", ";", "}", "}", "}" ]
Set the attempts Map in the eventStore @param projectId the project id @param eventCollection the collection name @param attempts the current attempts Map @throws IOException
[ "Set", "the", "attempts", "Map", "in", "the", "eventStore" ]
train
https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/KeenClient.java#L1774-L1787
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/io/SynchronizedIO.java
SynchronizedIO.writeFile
public void writeFile(String filePath, byte[] data) throws IOException { """ Write binary file data @param filePath the file path to write @param data the write @throws IOException when IO error occurs """ Object lock = retrieveLock(filePath); synchronized (lock) { IO.writeFile(filePath, data); } }
java
public void writeFile(String filePath, byte[] data) throws IOException { Object lock = retrieveLock(filePath); synchronized (lock) { IO.writeFile(filePath, data); } }
[ "public", "void", "writeFile", "(", "String", "filePath", ",", "byte", "[", "]", "data", ")", "throws", "IOException", "{", "Object", "lock", "=", "retrieveLock", "(", "filePath", ")", ";", "synchronized", "(", "lock", ")", "{", "IO", ".", "writeFile", "(", "filePath", ",", "data", ")", ";", "}", "}" ]
Write binary file data @param filePath the file path to write @param data the write @throws IOException when IO error occurs
[ "Write", "binary", "file", "data" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/io/SynchronizedIO.java#L86-L93
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Sphere3d.java
Sphere3d.set
@Override public void set(double x, double y, double z, double radius1) { """ Change the frame of the sphere. @param x @param y @param z @param radius1 """ this.cxProperty.set(x); this.cyProperty.set(y); this.czProperty.set(z); this.radiusProperty.set(Math.abs(radius1)); }
java
@Override public void set(double x, double y, double z, double radius1) { this.cxProperty.set(x); this.cyProperty.set(y); this.czProperty.set(z); this.radiusProperty.set(Math.abs(radius1)); }
[ "@", "Override", "public", "void", "set", "(", "double", "x", ",", "double", "y", ",", "double", "z", ",", "double", "radius1", ")", "{", "this", ".", "cxProperty", ".", "set", "(", "x", ")", ";", "this", ".", "cyProperty", ".", "set", "(", "y", ")", ";", "this", ".", "czProperty", ".", "set", "(", "z", ")", ";", "this", ".", "radiusProperty", ".", "set", "(", "Math", ".", "abs", "(", "radius1", ")", ")", ";", "}" ]
Change the frame of the sphere. @param x @param y @param z @param radius1
[ "Change", "the", "frame", "of", "the", "sphere", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Sphere3d.java#L104-L110
eFaps/eFaps-Kernel
src/main/java/org/efaps/update/version/ApplicationVersion.java
ApplicationVersion.addScript
@CallMethod(pattern = "install/version/script") public void addScript(@CallParam(pattern = "install/version/script") final String _code, @CallParam(pattern = "install/version/script", attributeName = "type") final String _type, @CallParam(pattern = "install/version/script", attributeName = "name") final String _name, @CallParam(pattern = "install/version/script", attributeName = "function") final String _function) { """ Adds a new Script to this version. @param _code code of script to execute @param _type type of the code, groovy, rhino @param _name file name of the script @param _function name of function which is called """ AbstractScript script = null; if ("rhino".equalsIgnoreCase(_type)) { script = new RhinoScript(_code, _name, _function); } else if ("groovy".equalsIgnoreCase(_type)) { script = new GroovyScript(_code, _name, _function); } if (script != null) { this.scripts.add(script); } }
java
@CallMethod(pattern = "install/version/script") public void addScript(@CallParam(pattern = "install/version/script") final String _code, @CallParam(pattern = "install/version/script", attributeName = "type") final String _type, @CallParam(pattern = "install/version/script", attributeName = "name") final String _name, @CallParam(pattern = "install/version/script", attributeName = "function") final String _function) { AbstractScript script = null; if ("rhino".equalsIgnoreCase(_type)) { script = new RhinoScript(_code, _name, _function); } else if ("groovy".equalsIgnoreCase(_type)) { script = new GroovyScript(_code, _name, _function); } if (script != null) { this.scripts.add(script); } }
[ "@", "CallMethod", "(", "pattern", "=", "\"install/version/script\"", ")", "public", "void", "addScript", "(", "@", "CallParam", "(", "pattern", "=", "\"install/version/script\"", ")", "final", "String", "_code", ",", "@", "CallParam", "(", "pattern", "=", "\"install/version/script\"", ",", "attributeName", "=", "\"type\"", ")", "final", "String", "_type", ",", "@", "CallParam", "(", "pattern", "=", "\"install/version/script\"", ",", "attributeName", "=", "\"name\"", ")", "final", "String", "_name", ",", "@", "CallParam", "(", "pattern", "=", "\"install/version/script\"", ",", "attributeName", "=", "\"function\"", ")", "final", "String", "_function", ")", "{", "AbstractScript", "script", "=", "null", ";", "if", "(", "\"rhino\"", ".", "equalsIgnoreCase", "(", "_type", ")", ")", "{", "script", "=", "new", "RhinoScript", "(", "_code", ",", "_name", ",", "_function", ")", ";", "}", "else", "if", "(", "\"groovy\"", ".", "equalsIgnoreCase", "(", "_type", ")", ")", "{", "script", "=", "new", "GroovyScript", "(", "_code", ",", "_name", ",", "_function", ")", ";", "}", "if", "(", "script", "!=", "null", ")", "{", "this", ".", "scripts", ".", "add", "(", "script", ")", ";", "}", "}" ]
Adds a new Script to this version. @param _code code of script to execute @param _type type of the code, groovy, rhino @param _name file name of the script @param _function name of function which is called
[ "Adds", "a", "new", "Script", "to", "this", "version", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/version/ApplicationVersion.java#L192-L208
google/j2objc
jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java
BigDecimal.multiply
public BigDecimal multiply(BigDecimal multiplicand) { """ Returns a {@code BigDecimal} whose value is <tt>(this &times; multiplicand)</tt>, and whose scale is {@code (this.scale() + multiplicand.scale())}. @param multiplicand value to be multiplied by this {@code BigDecimal}. @return {@code this * multiplicand} """ int productScale = checkScale((long) scale + multiplicand.scale); if (this.intCompact != INFLATED) { if ((multiplicand.intCompact != INFLATED)) { return multiply(this.intCompact, multiplicand.intCompact, productScale); } else { return multiply(this.intCompact, multiplicand.intVal, productScale); } } else { if ((multiplicand.intCompact != INFLATED)) { return multiply(multiplicand.intCompact, this.intVal, productScale); } else { return multiply(this.intVal, multiplicand.intVal, productScale); } } }
java
public BigDecimal multiply(BigDecimal multiplicand) { int productScale = checkScale((long) scale + multiplicand.scale); if (this.intCompact != INFLATED) { if ((multiplicand.intCompact != INFLATED)) { return multiply(this.intCompact, multiplicand.intCompact, productScale); } else { return multiply(this.intCompact, multiplicand.intVal, productScale); } } else { if ((multiplicand.intCompact != INFLATED)) { return multiply(multiplicand.intCompact, this.intVal, productScale); } else { return multiply(this.intVal, multiplicand.intVal, productScale); } } }
[ "public", "BigDecimal", "multiply", "(", "BigDecimal", "multiplicand", ")", "{", "int", "productScale", "=", "checkScale", "(", "(", "long", ")", "scale", "+", "multiplicand", ".", "scale", ")", ";", "if", "(", "this", ".", "intCompact", "!=", "INFLATED", ")", "{", "if", "(", "(", "multiplicand", ".", "intCompact", "!=", "INFLATED", ")", ")", "{", "return", "multiply", "(", "this", ".", "intCompact", ",", "multiplicand", ".", "intCompact", ",", "productScale", ")", ";", "}", "else", "{", "return", "multiply", "(", "this", ".", "intCompact", ",", "multiplicand", ".", "intVal", ",", "productScale", ")", ";", "}", "}", "else", "{", "if", "(", "(", "multiplicand", ".", "intCompact", "!=", "INFLATED", ")", ")", "{", "return", "multiply", "(", "multiplicand", ".", "intCompact", ",", "this", ".", "intVal", ",", "productScale", ")", ";", "}", "else", "{", "return", "multiply", "(", "this", ".", "intVal", ",", "multiplicand", ".", "intVal", ",", "productScale", ")", ";", "}", "}", "}" ]
Returns a {@code BigDecimal} whose value is <tt>(this &times; multiplicand)</tt>, and whose scale is {@code (this.scale() + multiplicand.scale())}. @param multiplicand value to be multiplied by this {@code BigDecimal}. @return {@code this * multiplicand}
[ "Returns", "a", "{", "@code", "BigDecimal", "}", "whose", "value", "is", "<tt", ">", "(", "this", "&times", ";", "multiplicand", ")", "<", "/", "tt", ">", "and", "whose", "scale", "is", "{", "@code", "(", "this", ".", "scale", "()", "+", "multiplicand", ".", "scale", "()", ")", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L1483-L1498
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getNotifications
public void getNotifications(Patient patient, Collection<Notification> result) { """ Returns notifications for the current user. @param patient If not null, only notifications associated with the current user are returned. Otherwise, all notifications for the current user are returned. @param result The list to receive the results. """ List<String> lst = null; result.clear(); if (patient == null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null); } else if (patient != null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null, patient.getIdElement().getIdPart()); } if (lst != null) { for (String item : lst) { result.add(new Notification(item)); } } }
java
public void getNotifications(Patient patient, Collection<Notification> result) { List<String> lst = null; result.clear(); if (patient == null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null); } else if (patient != null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null, patient.getIdElement().getIdPart()); } if (lst != null) { for (String item : lst) { result.add(new Notification(item)); } } }
[ "public", "void", "getNotifications", "(", "Patient", "patient", ",", "Collection", "<", "Notification", ">", "result", ")", "{", "List", "<", "String", ">", "lst", "=", "null", ";", "result", ".", "clear", "(", ")", ";", "if", "(", "patient", "==", "null", ")", "{", "lst", "=", "broker", ".", "callRPCList", "(", "\"RGCWXQ ALRLIST\"", ",", "null", ")", ";", "}", "else", "if", "(", "patient", "!=", "null", ")", "{", "lst", "=", "broker", ".", "callRPCList", "(", "\"RGCWXQ ALRLIST\"", ",", "null", ",", "patient", ".", "getIdElement", "(", ")", ".", "getIdPart", "(", ")", ")", ";", "}", "if", "(", "lst", "!=", "null", ")", "{", "for", "(", "String", "item", ":", "lst", ")", "{", "result", ".", "add", "(", "new", "Notification", "(", "item", ")", ")", ";", "}", "}", "}" ]
Returns notifications for the current user. @param patient If not null, only notifications associated with the current user are returned. Otherwise, all notifications for the current user are returned. @param result The list to receive the results.
[ "Returns", "notifications", "for", "the", "current", "user", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L86-L101
dropwizard/dropwizard
dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java
ServletEnvironment.addServlet
public ServletRegistration.Dynamic addServlet(String name, Servlet servlet) { """ Add a servlet instance. @param name the servlet's name @param servlet the servlet instance @return a {@link javax.servlet.ServletRegistration.Dynamic} instance allowing for further configuration """ final ServletHolder holder = new NonblockingServletHolder(requireNonNull(servlet)); holder.setName(name); handler.getServletHandler().addServlet(holder); final ServletRegistration.Dynamic registration = holder.getRegistration(); checkDuplicateRegistration(name, servlets, "servlet"); return registration; }
java
public ServletRegistration.Dynamic addServlet(String name, Servlet servlet) { final ServletHolder holder = new NonblockingServletHolder(requireNonNull(servlet)); holder.setName(name); handler.getServletHandler().addServlet(holder); final ServletRegistration.Dynamic registration = holder.getRegistration(); checkDuplicateRegistration(name, servlets, "servlet"); return registration; }
[ "public", "ServletRegistration", ".", "Dynamic", "addServlet", "(", "String", "name", ",", "Servlet", "servlet", ")", "{", "final", "ServletHolder", "holder", "=", "new", "NonblockingServletHolder", "(", "requireNonNull", "(", "servlet", ")", ")", ";", "holder", ".", "setName", "(", "name", ")", ";", "handler", ".", "getServletHandler", "(", ")", ".", "addServlet", "(", "holder", ")", ";", "final", "ServletRegistration", ".", "Dynamic", "registration", "=", "holder", ".", "getRegistration", "(", ")", ";", "checkDuplicateRegistration", "(", "name", ",", "servlets", ",", "\"servlet\"", ")", ";", "return", "registration", ";", "}" ]
Add a servlet instance. @param name the servlet's name @param servlet the servlet instance @return a {@link javax.servlet.ServletRegistration.Dynamic} instance allowing for further configuration
[ "Add", "a", "servlet", "instance", "." ]
train
https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L45-L54
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.beginMarkedContent
public void beginMarkedContent (final COSName tag, final PDPropertyList propertyList) throws IOException { """ Begin a marked content sequence with a reference to an entry in the page resources' Properties dictionary. @param tag the tag @param propertyList property list @throws IOException If the content stream could not be written """ writeOperand (tag); writeOperand (resources.add (propertyList)); writeOperator ((byte) 'B', (byte) 'D', (byte) 'C'); }
java
public void beginMarkedContent (final COSName tag, final PDPropertyList propertyList) throws IOException { writeOperand (tag); writeOperand (resources.add (propertyList)); writeOperator ((byte) 'B', (byte) 'D', (byte) 'C'); }
[ "public", "void", "beginMarkedContent", "(", "final", "COSName", "tag", ",", "final", "PDPropertyList", "propertyList", ")", "throws", "IOException", "{", "writeOperand", "(", "tag", ")", ";", "writeOperand", "(", "resources", ".", "add", "(", "propertyList", ")", ")", ";", "writeOperator", "(", "(", "byte", ")", "'", "'", ",", "(", "byte", ")", "'", "'", ",", "(", "byte", ")", "'", "'", ")", ";", "}" ]
Begin a marked content sequence with a reference to an entry in the page resources' Properties dictionary. @param tag the tag @param propertyList property list @throws IOException If the content stream could not be written
[ "Begin", "a", "marked", "content", "sequence", "with", "a", "reference", "to", "an", "entry", "in", "the", "page", "resources", "Properties", "dictionary", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1535-L1540
JetBrains/xodus
environment/src/main/java/jetbrains/exodus/tree/patricia/MutableNode.java
MutableNode.setRightChild
void setRightChild(final byte b, @NotNull final MutableNode child) { """ Sets in-place the right child with the same first byte. @param b next byte of child suffix. @param child child node. """ final ChildReference right = children.getRight(); if (right == null || (right.firstByte & 0xff) != (b & 0xff)) { throw new IllegalArgumentException(); } children.setAt(children.size() - 1, new ChildReferenceMutable(b, child)); }
java
void setRightChild(final byte b, @NotNull final MutableNode child) { final ChildReference right = children.getRight(); if (right == null || (right.firstByte & 0xff) != (b & 0xff)) { throw new IllegalArgumentException(); } children.setAt(children.size() - 1, new ChildReferenceMutable(b, child)); }
[ "void", "setRightChild", "(", "final", "byte", "b", ",", "@", "NotNull", "final", "MutableNode", "child", ")", "{", "final", "ChildReference", "right", "=", "children", ".", "getRight", "(", ")", ";", "if", "(", "right", "==", "null", "||", "(", "right", ".", "firstByte", "&", "0xff", ")", "!=", "(", "b", "&", "0xff", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "children", ".", "setAt", "(", "children", ".", "size", "(", ")", "-", "1", ",", "new", "ChildReferenceMutable", "(", "b", ",", "child", ")", ")", ";", "}" ]
Sets in-place the right child with the same first byte. @param b next byte of child suffix. @param child child node.
[ "Sets", "in", "-", "place", "the", "right", "child", "with", "the", "same", "first", "byte", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/environment/src/main/java/jetbrains/exodus/tree/patricia/MutableNode.java#L190-L196
mikereedell/sunrisesunsetlib-java
src/main/java/com/luckycatlabs/sunrisesunset/SunriseSunsetCalculator.java
SunriseSunsetCalculator.getSunset
public static Calendar getSunset(double latitude, double longitude, TimeZone timeZone, Calendar date, double degrees) { """ Computes the sunset for an arbitrary declination. @param latitude @param longitude Coordinates for the location to compute the sunrise/sunset for. @param timeZone timezone to compute the sunrise/sunset times in. @param date <code>Calendar</code> object containing the date to compute the official sunset for. @param degrees Angle under the horizon for which to compute sunrise. For example, "civil sunset" corresponds to 6 degrees. @return the requested sunset time as a <code>Calendar</code> object. """ SolarEventCalculator solarEventCalculator = new SolarEventCalculator(new Location(latitude, longitude), timeZone); return solarEventCalculator.computeSunsetCalendar(new Zenith(90 - degrees), date); }
java
public static Calendar getSunset(double latitude, double longitude, TimeZone timeZone, Calendar date, double degrees) { SolarEventCalculator solarEventCalculator = new SolarEventCalculator(new Location(latitude, longitude), timeZone); return solarEventCalculator.computeSunsetCalendar(new Zenith(90 - degrees), date); }
[ "public", "static", "Calendar", "getSunset", "(", "double", "latitude", ",", "double", "longitude", ",", "TimeZone", "timeZone", ",", "Calendar", "date", ",", "double", "degrees", ")", "{", "SolarEventCalculator", "solarEventCalculator", "=", "new", "SolarEventCalculator", "(", "new", "Location", "(", "latitude", ",", "longitude", ")", ",", "timeZone", ")", ";", "return", "solarEventCalculator", ".", "computeSunsetCalendar", "(", "new", "Zenith", "(", "90", "-", "degrees", ")", ",", "date", ")", ";", "}" ]
Computes the sunset for an arbitrary declination. @param latitude @param longitude Coordinates for the location to compute the sunrise/sunset for. @param timeZone timezone to compute the sunrise/sunset times in. @param date <code>Calendar</code> object containing the date to compute the official sunset for. @param degrees Angle under the horizon for which to compute sunrise. For example, "civil sunset" corresponds to 6 degrees. @return the requested sunset time as a <code>Calendar</code> object.
[ "Computes", "the", "sunset", "for", "an", "arbitrary", "declination", "." ]
train
https://github.com/mikereedell/sunrisesunsetlib-java/blob/6e6de23f1d11429eef58de2541582cbde9b85b92/src/main/java/com/luckycatlabs/sunrisesunset/SunriseSunsetCalculator.java#L277-L280
wdullaer/MaterialDateTimePicker
library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java
DatePickerDialog.setLocale
public void setLocale(Locale locale) { """ Set a custom locale to be used when generating various strings in the picker @param locale Locale """ mLocale = locale; mWeekStart = Calendar.getInstance(mTimezone, mLocale).getFirstDayOfWeek(); YEAR_FORMAT = new SimpleDateFormat("yyyy", locale); MONTH_FORMAT = new SimpleDateFormat("MMM", locale); DAY_FORMAT = new SimpleDateFormat("dd", locale); }
java
public void setLocale(Locale locale) { mLocale = locale; mWeekStart = Calendar.getInstance(mTimezone, mLocale).getFirstDayOfWeek(); YEAR_FORMAT = new SimpleDateFormat("yyyy", locale); MONTH_FORMAT = new SimpleDateFormat("MMM", locale); DAY_FORMAT = new SimpleDateFormat("dd", locale); }
[ "public", "void", "setLocale", "(", "Locale", "locale", ")", "{", "mLocale", "=", "locale", ";", "mWeekStart", "=", "Calendar", ".", "getInstance", "(", "mTimezone", ",", "mLocale", ")", ".", "getFirstDayOfWeek", "(", ")", ";", "YEAR_FORMAT", "=", "new", "SimpleDateFormat", "(", "\"yyyy\"", ",", "locale", ")", ";", "MONTH_FORMAT", "=", "new", "SimpleDateFormat", "(", "\"MMM\"", ",", "locale", ")", ";", "DAY_FORMAT", "=", "new", "SimpleDateFormat", "(", "\"dd\"", ",", "locale", ")", ";", "}" ]
Set a custom locale to be used when generating various strings in the picker @param locale Locale
[ "Set", "a", "custom", "locale", "to", "be", "used", "when", "generating", "various", "strings", "in", "the", "picker" ]
train
https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java#L998-L1004
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.xmlGlobalExistent
public static void xmlGlobalExistent(Class<?> aClass) { """ Thrown when global mapping is absent from XML configuration file. @param aClass class """ throw new XmlMappingGlobalExistException(MSG.INSTANCE.message(xmlMappingGlobalExistException, aClass.getSimpleName())); }
java
public static void xmlGlobalExistent(Class<?> aClass) { throw new XmlMappingGlobalExistException(MSG.INSTANCE.message(xmlMappingGlobalExistException, aClass.getSimpleName())); }
[ "public", "static", "void", "xmlGlobalExistent", "(", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "XmlMappingGlobalExistException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "xmlMappingGlobalExistException", ",", "aClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown when global mapping is absent from XML configuration file. @param aClass class
[ "Thrown", "when", "global", "mapping", "is", "absent", "from", "XML", "configuration", "file", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L255-L257
guardtime/ksi-java-sdk
ksi-common/src/main/java/com/guardtime/ksi/util/Base32.java
Base32.encodeWithDashes
public static String encodeWithDashes(byte[] in, int off, int len) { """ Encodes the given bytes into a base-32 string, inserting dashes after every 6 characters of output. @param in the bytes to encode. @param off the start offset of the data within {@code in}. @param len the number of bytes to encode. @return The formatted base-32 string. """ return inst.encode(in, off, len, "-", 6).toString(); }
java
public static String encodeWithDashes(byte[] in, int off, int len) { return inst.encode(in, off, len, "-", 6).toString(); }
[ "public", "static", "String", "encodeWithDashes", "(", "byte", "[", "]", "in", ",", "int", "off", ",", "int", "len", ")", "{", "return", "inst", ".", "encode", "(", "in", ",", "off", ",", "len", ",", "\"-\"", ",", "6", ")", ".", "toString", "(", ")", ";", "}" ]
Encodes the given bytes into a base-32 string, inserting dashes after every 6 characters of output. @param in the bytes to encode. @param off the start offset of the data within {@code in}. @param len the number of bytes to encode. @return The formatted base-32 string.
[ "Encodes", "the", "given", "bytes", "into", "a", "base", "-", "32", "string", "inserting", "dashes", "after", "every", "6", "characters", "of", "output", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Base32.java#L95-L97
HeidelTime/heideltime
src/jvntextpro/data/TaggingData.java
TaggingData.getContextStr
public String getContextStr(Sentence sent, int wordIdx) { """ Gets the context str. @param sent the sentence @param wordIdx the word index @return the string representing contexts extracted at wordIdx of the sentence sent """ String cpStr = ""; for (int i = 0; i < cntxGenVector.size(); ++i){ String [] context = cntxGenVector.get(i).getContext(sent, wordIdx); if (context != null){ for (int j = 0; j < context.length; ++j){ if (context[j].trim().equals("")) continue; cpStr += context[j] + " "; } } } return cpStr.trim(); }
java
public String getContextStr(Sentence sent, int wordIdx){ String cpStr = ""; for (int i = 0; i < cntxGenVector.size(); ++i){ String [] context = cntxGenVector.get(i).getContext(sent, wordIdx); if (context != null){ for (int j = 0; j < context.length; ++j){ if (context[j].trim().equals("")) continue; cpStr += context[j] + " "; } } } return cpStr.trim(); }
[ "public", "String", "getContextStr", "(", "Sentence", "sent", ",", "int", "wordIdx", ")", "{", "String", "cpStr", "=", "\"\"", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cntxGenVector", ".", "size", "(", ")", ";", "++", "i", ")", "{", "String", "[", "]", "context", "=", "cntxGenVector", ".", "get", "(", "i", ")", ".", "getContext", "(", "sent", ",", "wordIdx", ")", ";", "if", "(", "context", "!=", "null", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "context", ".", "length", ";", "++", "j", ")", "{", "if", "(", "context", "[", "j", "]", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "continue", ";", "cpStr", "+=", "context", "[", "j", "]", "+", "\" \"", ";", "}", "}", "}", "return", "cpStr", ".", "trim", "(", ")", ";", "}" ]
Gets the context str. @param sent the sentence @param wordIdx the word index @return the string representing contexts extracted at wordIdx of the sentence sent
[ "Gets", "the", "context", "str", "." ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/jvntextpro/data/TaggingData.java#L107-L121
advantageous/boon
reflekt/src/main/java/io/advantageous/boon/core/Str.java
Str.sliceOf
public static String sliceOf( String str, int start, int end ) { """ Get slice of string @param str string @param start start index @param end end index @return new string """ return slc(str, start, end); }
java
public static String sliceOf( String str, int start, int end ) { return slc(str, start, end); }
[ "public", "static", "String", "sliceOf", "(", "String", "str", ",", "int", "start", ",", "int", "end", ")", "{", "return", "slc", "(", "str", ",", "start", ",", "end", ")", ";", "}" ]
Get slice of string @param str string @param start start index @param end end index @return new string
[ "Get", "slice", "of", "string" ]
train
https://github.com/advantageous/boon/blob/12712d376761aa3b33223a9f1716720ddb67cb5e/reflekt/src/main/java/io/advantageous/boon/core/Str.java#L85-L87
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3.java
MurmurHash3.getLong
private static long getLong(final char[] charArr, final int index, final int rem) { """ Gets a long from the given char array starting at the given char array index and continuing for remainder (rem) chars. The chars are extracted in little-endian order. There is no limit checking. @param charArr The given input char array. @param index Zero-based index from the start of the char array. @param rem Remainder chars. An integer in the range [1,4]. @return long """ long out = 0L; for (int i = rem; i-- > 0;) { //i= 3,2,1,0 final char c = charArr[index + i]; out ^= (c & 0xFFFFL) << (i * 16); //equivalent to |= } return out; }
java
private static long getLong(final char[] charArr, final int index, final int rem) { long out = 0L; for (int i = rem; i-- > 0;) { //i= 3,2,1,0 final char c = charArr[index + i]; out ^= (c & 0xFFFFL) << (i * 16); //equivalent to |= } return out; }
[ "private", "static", "long", "getLong", "(", "final", "char", "[", "]", "charArr", ",", "final", "int", "index", ",", "final", "int", "rem", ")", "{", "long", "out", "=", "0L", ";", "for", "(", "int", "i", "=", "rem", ";", "i", "--", ">", "0", ";", ")", "{", "//i= 3,2,1,0", "final", "char", "c", "=", "charArr", "[", "index", "+", "i", "]", ";", "out", "^=", "(", "c", "&", "0xFFFF", "L", ")", "<<", "(", "i", "*", "16", ")", ";", "//equivalent to |=", "}", "return", "out", ";", "}" ]
Gets a long from the given char array starting at the given char array index and continuing for remainder (rem) chars. The chars are extracted in little-endian order. There is no limit checking. @param charArr The given input char array. @param index Zero-based index from the start of the char array. @param rem Remainder chars. An integer in the range [1,4]. @return long
[ "Gets", "a", "long", "from", "the", "given", "char", "array", "starting", "at", "the", "given", "char", "array", "index", "and", "continuing", "for", "remainder", "(", "rem", ")", "chars", ".", "The", "chars", "are", "extracted", "in", "little", "-", "endian", "order", ".", "There", "is", "no", "limit", "checking", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3.java#L327-L334
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java
BookKeeperLog.updateMetadata
private LogMetadata updateMetadata(LogMetadata currentMetadata, LedgerHandle newLedger, boolean clearEmptyLedgers) throws DurableDataLogException { """ Updates the metadata and persists it as a result of adding a new Ledger. @param currentMetadata The current metadata. @param newLedger The newly added Ledger. @param clearEmptyLedgers If true, the new metadata will not not contain any pointers to empty Ledgers. Setting this to true will not remove a pointer to the last few ledgers in the Log (controlled by Ledgers.MIN_FENCE_LEDGER_COUNT), even if they are indeed empty (this is so we don't interfere with any ongoing fencing activities as another instance of this Log may not have yet been fenced out). @return A new instance of the LogMetadata, which includes the new ledger. @throws DurableDataLogException If an Exception occurred. """ boolean create = currentMetadata == null; if (create) { // This is the first ledger ever in the metadata. currentMetadata = new LogMetadata(newLedger.getId()); } else { currentMetadata = currentMetadata.addLedger(newLedger.getId()); if (clearEmptyLedgers) { // Remove those ledgers from the metadata that are empty. currentMetadata = currentMetadata.removeEmptyLedgers(Ledgers.MIN_FENCE_LEDGER_COUNT); } } try { persistMetadata(currentMetadata, create); } catch (DurableDataLogException ex) { try { Ledgers.delete(newLedger.getId(), this.bookKeeper); } catch (Exception deleteEx) { log.warn("{}: Unable to delete newly created ledger {}.", this.traceObjectId, newLedger.getId(), deleteEx); ex.addSuppressed(deleteEx); } throw ex; } log.info("{} Metadata updated ({}).", this.traceObjectId, currentMetadata); return currentMetadata; }
java
private LogMetadata updateMetadata(LogMetadata currentMetadata, LedgerHandle newLedger, boolean clearEmptyLedgers) throws DurableDataLogException { boolean create = currentMetadata == null; if (create) { // This is the first ledger ever in the metadata. currentMetadata = new LogMetadata(newLedger.getId()); } else { currentMetadata = currentMetadata.addLedger(newLedger.getId()); if (clearEmptyLedgers) { // Remove those ledgers from the metadata that are empty. currentMetadata = currentMetadata.removeEmptyLedgers(Ledgers.MIN_FENCE_LEDGER_COUNT); } } try { persistMetadata(currentMetadata, create); } catch (DurableDataLogException ex) { try { Ledgers.delete(newLedger.getId(), this.bookKeeper); } catch (Exception deleteEx) { log.warn("{}: Unable to delete newly created ledger {}.", this.traceObjectId, newLedger.getId(), deleteEx); ex.addSuppressed(deleteEx); } throw ex; } log.info("{} Metadata updated ({}).", this.traceObjectId, currentMetadata); return currentMetadata; }
[ "private", "LogMetadata", "updateMetadata", "(", "LogMetadata", "currentMetadata", ",", "LedgerHandle", "newLedger", ",", "boolean", "clearEmptyLedgers", ")", "throws", "DurableDataLogException", "{", "boolean", "create", "=", "currentMetadata", "==", "null", ";", "if", "(", "create", ")", "{", "// This is the first ledger ever in the metadata.", "currentMetadata", "=", "new", "LogMetadata", "(", "newLedger", ".", "getId", "(", ")", ")", ";", "}", "else", "{", "currentMetadata", "=", "currentMetadata", ".", "addLedger", "(", "newLedger", ".", "getId", "(", ")", ")", ";", "if", "(", "clearEmptyLedgers", ")", "{", "// Remove those ledgers from the metadata that are empty.", "currentMetadata", "=", "currentMetadata", ".", "removeEmptyLedgers", "(", "Ledgers", ".", "MIN_FENCE_LEDGER_COUNT", ")", ";", "}", "}", "try", "{", "persistMetadata", "(", "currentMetadata", ",", "create", ")", ";", "}", "catch", "(", "DurableDataLogException", "ex", ")", "{", "try", "{", "Ledgers", ".", "delete", "(", "newLedger", ".", "getId", "(", ")", ",", "this", ".", "bookKeeper", ")", ";", "}", "catch", "(", "Exception", "deleteEx", ")", "{", "log", ".", "warn", "(", "\"{}: Unable to delete newly created ledger {}.\"", ",", "this", ".", "traceObjectId", ",", "newLedger", ".", "getId", "(", ")", ",", "deleteEx", ")", ";", "ex", ".", "addSuppressed", "(", "deleteEx", ")", ";", "}", "throw", "ex", ";", "}", "log", ".", "info", "(", "\"{} Metadata updated ({}).\"", ",", "this", ".", "traceObjectId", ",", "currentMetadata", ")", ";", "return", "currentMetadata", ";", "}" ]
Updates the metadata and persists it as a result of adding a new Ledger. @param currentMetadata The current metadata. @param newLedger The newly added Ledger. @param clearEmptyLedgers If true, the new metadata will not not contain any pointers to empty Ledgers. Setting this to true will not remove a pointer to the last few ledgers in the Log (controlled by Ledgers.MIN_FENCE_LEDGER_COUNT), even if they are indeed empty (this is so we don't interfere with any ongoing fencing activities as another instance of this Log may not have yet been fenced out). @return A new instance of the LogMetadata, which includes the new ledger. @throws DurableDataLogException If an Exception occurred.
[ "Updates", "the", "metadata", "and", "persists", "it", "as", "a", "result", "of", "adding", "a", "new", "Ledger", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java#L742-L770
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/Contracts.java
Contracts.assertParameterNotNull
public static void assertParameterNotNull(Object parameter, String parameterName) { """ Asserts that the given method or constructor is not {@code null}. @param parameter the parameter to validate @param parameterName the name of the parameter, will be used in the logging message in case the given object is {@code null} @throws IllegalArgumentException in case the given parameter is {@code null} """ if ( parameter == null ) { throw log.parameterMustNotBeNull( parameterName ); } }
java
public static void assertParameterNotNull(Object parameter, String parameterName) { if ( parameter == null ) { throw log.parameterMustNotBeNull( parameterName ); } }
[ "public", "static", "void", "assertParameterNotNull", "(", "Object", "parameter", ",", "String", "parameterName", ")", "{", "if", "(", "parameter", "==", "null", ")", "{", "throw", "log", ".", "parameterMustNotBeNull", "(", "parameterName", ")", ";", "}", "}" ]
Asserts that the given method or constructor is not {@code null}. @param parameter the parameter to validate @param parameterName the name of the parameter, will be used in the logging message in case the given object is {@code null} @throws IllegalArgumentException in case the given parameter is {@code null}
[ "Asserts", "that", "the", "given", "method", "or", "constructor", "is", "not", "{", "@code", "null", "}", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/Contracts.java#L46-L50
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/fxml/FXMLUtils.java
FXMLUtils.loadFXML
public static <M extends Model> FXMLComponentBase loadFXML(final M model, final String fxmlPath) { """ Load a FXML component without resource bundle. The fxml path could be : <ul> <li>Relative : fxml file will be loaded with the classloader of the given model class</li> <li>Absolute : fxml file will be loaded with default thread class loader, packages must be separated by / character</li> </ul> @param model the model that will manage the fxml node @param fxmlPath the fxml string path @return a FXMLComponent object that wrap a fxml node with its controller @param <M> the model type that will manage this fxml node """ return loadFXML(model, fxmlPath, null); }
java
public static <M extends Model> FXMLComponentBase loadFXML(final M model, final String fxmlPath) { return loadFXML(model, fxmlPath, null); }
[ "public", "static", "<", "M", "extends", "Model", ">", "FXMLComponentBase", "loadFXML", "(", "final", "M", "model", ",", "final", "String", "fxmlPath", ")", "{", "return", "loadFXML", "(", "model", ",", "fxmlPath", ",", "null", ")", ";", "}" ]
Load a FXML component without resource bundle. The fxml path could be : <ul> <li>Relative : fxml file will be loaded with the classloader of the given model class</li> <li>Absolute : fxml file will be loaded with default thread class loader, packages must be separated by / character</li> </ul> @param model the model that will manage the fxml node @param fxmlPath the fxml string path @return a FXMLComponent object that wrap a fxml node with its controller @param <M> the model type that will manage this fxml node
[ "Load", "a", "FXML", "component", "without", "resource", "bundle", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/fxml/FXMLUtils.java#L72-L74
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.accessRestriction_ip_id_PUT
public void accessRestriction_ip_id_PUT(Long id, OvhIpRestriction body) throws IOException { """ Alter this object properties REST: PUT /me/accessRestriction/ip/{id} @param body [required] New object properties @param id [required] The Id of the restriction """ String qPath = "/me/accessRestriction/ip/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void accessRestriction_ip_id_PUT(Long id, OvhIpRestriction body) throws IOException { String qPath = "/me/accessRestriction/ip/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "accessRestriction_ip_id_PUT", "(", "Long", "id", ",", "OvhIpRestriction", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/accessRestriction/ip/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /me/accessRestriction/ip/{id} @param body [required] New object properties @param id [required] The Id of the restriction
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4107-L4111
kaazing/gateway
util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java
Asn1Utils.decodeIA5String
public static String decodeIA5String(ByteBuffer buf) { """ Decode an ASN.1 IA5String. @param buf the DER-encoded IA5String @return the string """ DerId id = DerId.decode(buf); if (!id.matches(DerId.TagClass.UNIVERSAL, DerId.EncodingType.PRIMITIVE, ASN1_IA5STRING_TAG_NUM)) { throw new IllegalArgumentException("Expected IA5String identifier, received " + id); } int len = DerUtils.decodeLength(buf); if (buf.remaining() < len) { throw new IllegalArgumentException("Insufficient content for IA5String"); } byte[] dst = new byte[len]; buf.get(dst); return new String(dst); }
java
public static String decodeIA5String(ByteBuffer buf) { DerId id = DerId.decode(buf); if (!id.matches(DerId.TagClass.UNIVERSAL, DerId.EncodingType.PRIMITIVE, ASN1_IA5STRING_TAG_NUM)) { throw new IllegalArgumentException("Expected IA5String identifier, received " + id); } int len = DerUtils.decodeLength(buf); if (buf.remaining() < len) { throw new IllegalArgumentException("Insufficient content for IA5String"); } byte[] dst = new byte[len]; buf.get(dst); return new String(dst); }
[ "public", "static", "String", "decodeIA5String", "(", "ByteBuffer", "buf", ")", "{", "DerId", "id", "=", "DerId", ".", "decode", "(", "buf", ")", ";", "if", "(", "!", "id", ".", "matches", "(", "DerId", ".", "TagClass", ".", "UNIVERSAL", ",", "DerId", ".", "EncodingType", ".", "PRIMITIVE", ",", "ASN1_IA5STRING_TAG_NUM", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expected IA5String identifier, received \"", "+", "id", ")", ";", "}", "int", "len", "=", "DerUtils", ".", "decodeLength", "(", "buf", ")", ";", "if", "(", "buf", ".", "remaining", "(", ")", "<", "len", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Insufficient content for IA5String\"", ")", ";", "}", "byte", "[", "]", "dst", "=", "new", "byte", "[", "len", "]", ";", "buf", ".", "get", "(", "dst", ")", ";", "return", "new", "String", "(", "dst", ")", ";", "}" ]
Decode an ASN.1 IA5String. @param buf the DER-encoded IA5String @return the string
[ "Decode", "an", "ASN", ".", "1", "IA5String", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java#L151-L163
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.addRect
public void addRect (final float x, final float y, final float width, final float height) throws IOException { """ Add a rectangle to the current path. @param x The lower left x coordinate. @param y The lower left y coordinate. @param width The width of the rectangle. @param height The height of the rectangle. @throws IOException If the content stream could not be written. @throws IllegalStateException If the method was called within a text block. """ if (inTextMode) { throw new IllegalStateException ("Error: addRect is not allowed within a text block."); } writeOperand (x); writeOperand (y); writeOperand (width); writeOperand (height); writeOperator ((byte) 'r', (byte) 'e'); }
java
public void addRect (final float x, final float y, final float width, final float height) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: addRect is not allowed within a text block."); } writeOperand (x); writeOperand (y); writeOperand (width); writeOperand (height); writeOperator ((byte) 'r', (byte) 'e'); }
[ "public", "void", "addRect", "(", "final", "float", "x", ",", "final", "float", "y", ",", "final", "float", "width", ",", "final", "float", "height", ")", "throws", "IOException", "{", "if", "(", "inTextMode", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error: addRect is not allowed within a text block.\"", ")", ";", "}", "writeOperand", "(", "x", ")", ";", "writeOperand", "(", "y", ")", ";", "writeOperand", "(", "width", ")", ";", "writeOperand", "(", "height", ")", ";", "writeOperator", "(", "(", "byte", ")", "'", "'", ",", "(", "byte", ")", "'", "'", ")", ";", "}" ]
Add a rectangle to the current path. @param x The lower left x coordinate. @param y The lower left y coordinate. @param width The width of the rectangle. @param height The height of the rectangle. @throws IOException If the content stream could not be written. @throws IllegalStateException If the method was called within a text block.
[ "Add", "a", "rectangle", "to", "the", "current", "path", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1093-L1104
jayantk/jklol
src/com/jayantkrish/jklol/models/AbstractFactorGraphBuilder.java
AbstractFactorGraphBuilder.addConstantFactor
public void addConstantFactor(String factorName, Factor factor) { """ Adds an unparameterized factor to the model under construction. @param factor """ constantFactors.add(ReplicatedFactor.fromFactor(factor)); constantFactorNames.add(factorName); }
java
public void addConstantFactor(String factorName, Factor factor) { constantFactors.add(ReplicatedFactor.fromFactor(factor)); constantFactorNames.add(factorName); }
[ "public", "void", "addConstantFactor", "(", "String", "factorName", ",", "Factor", "factor", ")", "{", "constantFactors", ".", "add", "(", "ReplicatedFactor", ".", "fromFactor", "(", "factor", ")", ")", ";", "constantFactorNames", ".", "add", "(", "factorName", ")", ";", "}" ]
Adds an unparameterized factor to the model under construction. @param factor
[ "Adds", "an", "unparameterized", "factor", "to", "the", "model", "under", "construction", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/AbstractFactorGraphBuilder.java#L84-L87
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.canAcceptChild
public static boolean canAcceptChild(Class<? extends ElementBase> parentClass, Class<? extends ElementBase> childClass) { """ Returns true if childClass can be a child of the parentClass. @param parentClass Parent class @param childClass Child class @return True if childClass can be a child of the parentClass. """ return allowedChildClasses.isRelated(parentClass, childClass); }
java
public static boolean canAcceptChild(Class<? extends ElementBase> parentClass, Class<? extends ElementBase> childClass) { return allowedChildClasses.isRelated(parentClass, childClass); }
[ "public", "static", "boolean", "canAcceptChild", "(", "Class", "<", "?", "extends", "ElementBase", ">", "parentClass", ",", "Class", "<", "?", "extends", "ElementBase", ">", "childClass", ")", "{", "return", "allowedChildClasses", ".", "isRelated", "(", "parentClass", ",", "childClass", ")", ";", "}" ]
Returns true if childClass can be a child of the parentClass. @param parentClass Parent class @param childClass Child class @return True if childClass can be a child of the parentClass.
[ "Returns", "true", "if", "childClass", "can", "be", "a", "child", "of", "the", "parentClass", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L118-L120
alkacon/opencms-core
src/org/opencms/main/CmsSessionManager.java
CmsSessionManager.switchUser
public String switchUser(CmsObject cms, HttpServletRequest req, CmsUser user) throws CmsException { """ Switches the current user to the given user. The session info is rebuild as if the given user performs a login at the workplace. @param cms the current CmsObject @param req the current request @param user the user to switch to @return the direct edit target if available @throws CmsException if something goes wrong """ return switchUserFromSession(cms, req, user, null); }
java
public String switchUser(CmsObject cms, HttpServletRequest req, CmsUser user) throws CmsException { return switchUserFromSession(cms, req, user, null); }
[ "public", "String", "switchUser", "(", "CmsObject", "cms", ",", "HttpServletRequest", "req", ",", "CmsUser", "user", ")", "throws", "CmsException", "{", "return", "switchUserFromSession", "(", "cms", ",", "req", ",", "user", ",", "null", ")", ";", "}" ]
Switches the current user to the given user. The session info is rebuild as if the given user performs a login at the workplace. @param cms the current CmsObject @param req the current request @param user the user to switch to @return the direct edit target if available @throws CmsException if something goes wrong
[ "Switches", "the", "current", "user", "to", "the", "given", "user", ".", "The", "session", "info", "is", "rebuild", "as", "if", "the", "given", "user", "performs", "a", "login", "at", "the", "workplace", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSessionManager.java#L451-L454
box/box-java-sdk
src/main/java/com/box/sdk/InMemoryLRUAccessTokenCache.java
InMemoryLRUAccessTokenCache.put
public void put(String key, String value) { """ Add an entry to the cache. @param key key to use. @param value access token information to store. """ synchronized (this.cache) { this.cache.put(key, value); } }
java
public void put(String key, String value) { synchronized (this.cache) { this.cache.put(key, value); } }
[ "public", "void", "put", "(", "String", "key", ",", "String", "value", ")", "{", "synchronized", "(", "this", ".", "cache", ")", "{", "this", ".", "cache", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}" ]
Add an entry to the cache. @param key key to use. @param value access token information to store.
[ "Add", "an", "entry", "to", "the", "cache", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/InMemoryLRUAccessTokenCache.java#L33-L37
ogaclejapan/SmartTabLayout
utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java
Bundler.putBundle
public Bundler putBundle(String key, Bundle value) { """ Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Bundle object, or null @return this """ bundle.putBundle(key, value); return this; }
java
public Bundler putBundle(String key, Bundle value) { bundle.putBundle(key, value); return this; }
[ "public", "Bundler", "putBundle", "(", "String", "key", ",", "Bundle", "value", ")", "{", "bundle", ".", "putBundle", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a Bundle value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Bundle object, or null @return this
[ "Inserts", "a", "Bundle", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L344-L347
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/publisher/CommitSequencePublisher.java
CommitSequencePublisher.movePath
@Override protected void movePath(ParallelRunner parallelRunner, State state, Path src, Path dst, int branchId) throws IOException { """ This method does not actually move data, but it creates an {@link FsRenameCommitStep}. """ log.info(String.format("Creating CommitStep for moving %s to %s", src, dst)); boolean overwrite = state.getPropAsBoolean(ConfigurationKeys.DATA_PUBLISHER_OVERWRITE_ENABLED, false); FsRenameCommitStep.Builder<?> builder = this.commitSequenceBuilder.get().beginStep(FsRenameCommitStep.Builder.class) .withProps(this.state).from(src).withSrcFs(this.writerFileSystemByBranches.get(branchId)).to(dst) .withDstFs(this.publisherFileSystemByBranches.get(branchId)); if (overwrite) { builder.overwrite(); } builder.endStep(); }
java
@Override protected void movePath(ParallelRunner parallelRunner, State state, Path src, Path dst, int branchId) throws IOException { log.info(String.format("Creating CommitStep for moving %s to %s", src, dst)); boolean overwrite = state.getPropAsBoolean(ConfigurationKeys.DATA_PUBLISHER_OVERWRITE_ENABLED, false); FsRenameCommitStep.Builder<?> builder = this.commitSequenceBuilder.get().beginStep(FsRenameCommitStep.Builder.class) .withProps(this.state).from(src).withSrcFs(this.writerFileSystemByBranches.get(branchId)).to(dst) .withDstFs(this.publisherFileSystemByBranches.get(branchId)); if (overwrite) { builder.overwrite(); } builder.endStep(); }
[ "@", "Override", "protected", "void", "movePath", "(", "ParallelRunner", "parallelRunner", ",", "State", "state", ",", "Path", "src", ",", "Path", "dst", ",", "int", "branchId", ")", "throws", "IOException", "{", "log", ".", "info", "(", "String", ".", "format", "(", "\"Creating CommitStep for moving %s to %s\"", ",", "src", ",", "dst", ")", ")", ";", "boolean", "overwrite", "=", "state", ".", "getPropAsBoolean", "(", "ConfigurationKeys", ".", "DATA_PUBLISHER_OVERWRITE_ENABLED", ",", "false", ")", ";", "FsRenameCommitStep", ".", "Builder", "<", "?", ">", "builder", "=", "this", ".", "commitSequenceBuilder", ".", "get", "(", ")", ".", "beginStep", "(", "FsRenameCommitStep", ".", "Builder", ".", "class", ")", ".", "withProps", "(", "this", ".", "state", ")", ".", "from", "(", "src", ")", ".", "withSrcFs", "(", "this", ".", "writerFileSystemByBranches", ".", "get", "(", "branchId", ")", ")", ".", "to", "(", "dst", ")", ".", "withDstFs", "(", "this", ".", "publisherFileSystemByBranches", ".", "get", "(", "branchId", ")", ")", ";", "if", "(", "overwrite", ")", "{", "builder", ".", "overwrite", "(", ")", ";", "}", "builder", ".", "endStep", "(", ")", ";", "}" ]
This method does not actually move data, but it creates an {@link FsRenameCommitStep}.
[ "This", "method", "does", "not", "actually", "move", "data", "but", "it", "creates", "an", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/publisher/CommitSequencePublisher.java#L79-L92
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/MountTable.java
MountTable.checkUnderWritableMountPoint
public void checkUnderWritableMountPoint(AlluxioURI alluxioUri) throws InvalidPathException, AccessControlException { """ Checks to see if a write operation is allowed for the specified Alluxio path, by determining if it is under a readonly mount point. @param alluxioUri an Alluxio path URI @throws InvalidPathException if the Alluxio path is invalid @throws AccessControlException if the Alluxio path is under a readonly mount point """ try (LockResource r = new LockResource(mReadLock)) { // This will re-acquire the read lock, but that is allowed. String mountPoint = getMountPoint(alluxioUri); MountInfo mountInfo = mState.getMountTable().get(mountPoint); if (mountInfo.getOptions().getReadOnly()) { throw new AccessControlException(ExceptionMessage.MOUNT_READONLY, alluxioUri, mountPoint); } } }
java
public void checkUnderWritableMountPoint(AlluxioURI alluxioUri) throws InvalidPathException, AccessControlException { try (LockResource r = new LockResource(mReadLock)) { // This will re-acquire the read lock, but that is allowed. String mountPoint = getMountPoint(alluxioUri); MountInfo mountInfo = mState.getMountTable().get(mountPoint); if (mountInfo.getOptions().getReadOnly()) { throw new AccessControlException(ExceptionMessage.MOUNT_READONLY, alluxioUri, mountPoint); } } }
[ "public", "void", "checkUnderWritableMountPoint", "(", "AlluxioURI", "alluxioUri", ")", "throws", "InvalidPathException", ",", "AccessControlException", "{", "try", "(", "LockResource", "r", "=", "new", "LockResource", "(", "mReadLock", ")", ")", "{", "// This will re-acquire the read lock, but that is allowed.", "String", "mountPoint", "=", "getMountPoint", "(", "alluxioUri", ")", ";", "MountInfo", "mountInfo", "=", "mState", ".", "getMountTable", "(", ")", ".", "get", "(", "mountPoint", ")", ";", "if", "(", "mountInfo", ".", "getOptions", "(", ")", ".", "getReadOnly", "(", ")", ")", "{", "throw", "new", "AccessControlException", "(", "ExceptionMessage", ".", "MOUNT_READONLY", ",", "alluxioUri", ",", "mountPoint", ")", ";", "}", "}", "}" ]
Checks to see if a write operation is allowed for the specified Alluxio path, by determining if it is under a readonly mount point. @param alluxioUri an Alluxio path URI @throws InvalidPathException if the Alluxio path is invalid @throws AccessControlException if the Alluxio path is under a readonly mount point
[ "Checks", "to", "see", "if", "a", "write", "operation", "is", "allowed", "for", "the", "specified", "Alluxio", "path", "by", "determining", "if", "it", "is", "under", "a", "readonly", "mount", "point", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/MountTable.java#L352-L362
openbase/jul
extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/ProtoBufBuilderProcessor.java
ProtoBufBuilderProcessor.addDefaultInstanceToRepeatedField
public static AbstractMessage.Builder addDefaultInstanceToRepeatedField(final int repeatedFieldNumber, final AbstractMessage.Builder builder) throws CouldNotPerformException { """ Method adds a new default message instance to the repeated field and return it's builder instance. @param repeatedFieldNumber The field number of the repeated field. @param builder The builder instance of the message which contains the repeated field. @return The builder instance of the new added message is returned. @throws CouldNotPerformException """ return addDefaultInstanceToRepeatedField(builder.getDescriptorForType().findFieldByNumber(repeatedFieldNumber), builder); }
java
public static AbstractMessage.Builder addDefaultInstanceToRepeatedField(final int repeatedFieldNumber, final AbstractMessage.Builder builder) throws CouldNotPerformException { return addDefaultInstanceToRepeatedField(builder.getDescriptorForType().findFieldByNumber(repeatedFieldNumber), builder); }
[ "public", "static", "AbstractMessage", ".", "Builder", "addDefaultInstanceToRepeatedField", "(", "final", "int", "repeatedFieldNumber", ",", "final", "AbstractMessage", ".", "Builder", "builder", ")", "throws", "CouldNotPerformException", "{", "return", "addDefaultInstanceToRepeatedField", "(", "builder", ".", "getDescriptorForType", "(", ")", ".", "findFieldByNumber", "(", "repeatedFieldNumber", ")", ",", "builder", ")", ";", "}" ]
Method adds a new default message instance to the repeated field and return it's builder instance. @param repeatedFieldNumber The field number of the repeated field. @param builder The builder instance of the message which contains the repeated field. @return The builder instance of the new added message is returned. @throws CouldNotPerformException
[ "Method", "adds", "a", "new", "default", "message", "instance", "to", "the", "repeated", "field", "and", "return", "it", "s", "builder", "instance", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/protobuf/src/main/java/org/openbase/jul/extension/protobuf/ProtoBufBuilderProcessor.java#L237-L239
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java
CertificateOperations.getCertificate
public Certificate getCertificate(String thumbprintAlgorithm, String thumbprint, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { """ Gets the specified {@link Certificate}. @param thumbprintAlgorithm the algorithm used to derive the thumbprint parameter. This must be sha1. @param thumbprint the thumbprint of the certificate to get. @param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @return A {@link Certificate} containing information about the specified certificate in the Azure Batch account. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ CertificateGetOptions getCertificateOptions = new CertificateGetOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); bhMgr.applyRequestBehaviors(getCertificateOptions); return this.parentBatchClient.protocolLayer().certificates().get(thumbprintAlgorithm, thumbprint, getCertificateOptions); }
java
public Certificate getCertificate(String thumbprintAlgorithm, String thumbprint, DetailLevel detailLevel, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { CertificateGetOptions getCertificateOptions = new CertificateGetOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.appendDetailLevelToPerCallBehaviors(detailLevel); bhMgr.applyRequestBehaviors(getCertificateOptions); return this.parentBatchClient.protocolLayer().certificates().get(thumbprintAlgorithm, thumbprint, getCertificateOptions); }
[ "public", "Certificate", "getCertificate", "(", "String", "thumbprintAlgorithm", ",", "String", "thumbprint", ",", "DetailLevel", "detailLevel", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", "{", "CertificateGetOptions", "getCertificateOptions", "=", "new", "CertificateGetOptions", "(", ")", ";", "BehaviorManager", "bhMgr", "=", "new", "BehaviorManager", "(", "this", ".", "customBehaviors", "(", ")", ",", "additionalBehaviors", ")", ";", "bhMgr", ".", "appendDetailLevelToPerCallBehaviors", "(", "detailLevel", ")", ";", "bhMgr", ".", "applyRequestBehaviors", "(", "getCertificateOptions", ")", ";", "return", "this", ".", "parentBatchClient", ".", "protocolLayer", "(", ")", ".", "certificates", "(", ")", ".", "get", "(", "thumbprintAlgorithm", ",", "thumbprint", ",", "getCertificateOptions", ")", ";", "}" ]
Gets the specified {@link Certificate}. @param thumbprintAlgorithm the algorithm used to derive the thumbprint parameter. This must be sha1. @param thumbprint the thumbprint of the certificate to get. @param detailLevel A {@link DetailLevel} used for controlling which properties are retrieved from the service. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @return A {@link Certificate} containing information about the specified certificate in the Azure Batch account. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Gets", "the", "specified", "{", "@link", "Certificate", "}", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L273-L280
buschmais/jqa-rdbms-plugin
src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java
AbstractSchemaScannerPlugin.scanConnection
protected List<SchemaDescriptor> scanConnection(String url, String user, String password, String infoLevelName, String bundledDriverName, Properties properties, Store store) throws IOException { """ Scans the connection identified by the given parameters. @param url The url. @param user The user. @param password The password. @param properties The properties to pass to schema crawler. @param infoLevelName The name of the info level to use. @param bundledDriverName The name of the bundled driver as provided by schema crawler. @param store The store. @return The list of created schema descriptors. @throws java.io.IOException If retrieval fails. """ LOGGER.info("Scanning schema '{}'", url); Catalog catalog = getCatalog(url, user, password, infoLevelName, bundledDriverName, properties); return createSchemas(catalog, store); }
java
protected List<SchemaDescriptor> scanConnection(String url, String user, String password, String infoLevelName, String bundledDriverName, Properties properties, Store store) throws IOException { LOGGER.info("Scanning schema '{}'", url); Catalog catalog = getCatalog(url, user, password, infoLevelName, bundledDriverName, properties); return createSchemas(catalog, store); }
[ "protected", "List", "<", "SchemaDescriptor", ">", "scanConnection", "(", "String", "url", ",", "String", "user", ",", "String", "password", ",", "String", "infoLevelName", ",", "String", "bundledDriverName", ",", "Properties", "properties", ",", "Store", "store", ")", "throws", "IOException", "{", "LOGGER", ".", "info", "(", "\"Scanning schema '{}'\"", ",", "url", ")", ";", "Catalog", "catalog", "=", "getCatalog", "(", "url", ",", "user", ",", "password", ",", "infoLevelName", ",", "bundledDriverName", ",", "properties", ")", ";", "return", "createSchemas", "(", "catalog", ",", "store", ")", ";", "}" ]
Scans the connection identified by the given parameters. @param url The url. @param user The user. @param password The password. @param properties The properties to pass to schema crawler. @param infoLevelName The name of the info level to use. @param bundledDriverName The name of the bundled driver as provided by schema crawler. @param store The store. @return The list of created schema descriptors. @throws java.io.IOException If retrieval fails.
[ "Scans", "the", "connection", "identified", "by", "the", "given", "parameters", "." ]
train
https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L53-L58
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java
SparkComputationGraph.evaluateROC
public <T extends ROC> T evaluateROC(JavaRDD<DataSet> data) { """ Perform ROC analysis/evaluation on the given DataSet in a distributed manner, using the default number of threshold steps ({@link #DEFAULT_ROC_THRESHOLD_STEPS}) and the default minibatch size ({@link #DEFAULT_EVAL_SCORE_BATCH_SIZE}) @param data Test set data (to evaluate on) @return ROC for the entire data set """ return evaluateROC(data, DEFAULT_ROC_THRESHOLD_STEPS, DEFAULT_EVAL_SCORE_BATCH_SIZE); }
java
public <T extends ROC> T evaluateROC(JavaRDD<DataSet> data) { return evaluateROC(data, DEFAULT_ROC_THRESHOLD_STEPS, DEFAULT_EVAL_SCORE_BATCH_SIZE); }
[ "public", "<", "T", "extends", "ROC", ">", "T", "evaluateROC", "(", "JavaRDD", "<", "DataSet", ">", "data", ")", "{", "return", "evaluateROC", "(", "data", ",", "DEFAULT_ROC_THRESHOLD_STEPS", ",", "DEFAULT_EVAL_SCORE_BATCH_SIZE", ")", ";", "}" ]
Perform ROC analysis/evaluation on the given DataSet in a distributed manner, using the default number of threshold steps ({@link #DEFAULT_ROC_THRESHOLD_STEPS}) and the default minibatch size ({@link #DEFAULT_EVAL_SCORE_BATCH_SIZE}) @param data Test set data (to evaluate on) @return ROC for the entire data set
[ "Perform", "ROC", "analysis", "/", "evaluation", "on", "the", "given", "DataSet", "in", "a", "distributed", "manner", "using", "the", "default", "number", "of", "threshold", "steps", "(", "{", "@link", "#DEFAULT_ROC_THRESHOLD_STEPS", "}", ")", "and", "the", "default", "minibatch", "size", "(", "{", "@link", "#DEFAULT_EVAL_SCORE_BATCH_SIZE", "}", ")" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L663-L665
dbracewell/hermes
hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/WordNet.java
WordNet.getHypernyms
public Set<Synset> getHypernyms(@NonNull Synset node) { """ Gets the hypernyms of the given WordNetNode. @param node The WordNet node @return The hypernyms """ return getRelatedSynsets(node, WordNetRelation.HYPERNYM); }
java
public Set<Synset> getHypernyms(@NonNull Synset node) { return getRelatedSynsets(node, WordNetRelation.HYPERNYM); }
[ "public", "Set", "<", "Synset", ">", "getHypernyms", "(", "@", "NonNull", "Synset", "node", ")", "{", "return", "getRelatedSynsets", "(", "node", ",", "WordNetRelation", ".", "HYPERNYM", ")", ";", "}" ]
Gets the hypernyms of the given WordNetNode. @param node The WordNet node @return The hypernyms
[ "Gets", "the", "hypernyms", "of", "the", "given", "WordNetNode", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-wordnet/src/main/java/com/davidbracewell/hermes/wordnet/WordNet.java#L239-L241
apiman/apiman
manager/api/war/src/main/java/io/apiman/manager/api/war/WarCdiFactory.java
WarCdiFactory.initJpaStorage
private static JpaStorage initJpaStorage(ApiManagerConfig config, JpaStorage jpaStorage) { """ Initializes the JPA storage (if required). This basically amounts to installing the DDL in the database. This is optional and disabled by default. @param config @param jpaStorage """ if (sJpaStorage == null) { sJpaStorage = jpaStorage; if (config.isInitializeStorageJPA()) { JpaStorageInitializer initializer = new JpaStorageInitializer(config.getHibernateDataSource(), config.getHibernateDialect()); initializer.initialize(); } } return sJpaStorage; }
java
private static JpaStorage initJpaStorage(ApiManagerConfig config, JpaStorage jpaStorage) { if (sJpaStorage == null) { sJpaStorage = jpaStorage; if (config.isInitializeStorageJPA()) { JpaStorageInitializer initializer = new JpaStorageInitializer(config.getHibernateDataSource(), config.getHibernateDialect()); initializer.initialize(); } } return sJpaStorage; }
[ "private", "static", "JpaStorage", "initJpaStorage", "(", "ApiManagerConfig", "config", ",", "JpaStorage", "jpaStorage", ")", "{", "if", "(", "sJpaStorage", "==", "null", ")", "{", "sJpaStorage", "=", "jpaStorage", ";", "if", "(", "config", ".", "isInitializeStorageJPA", "(", ")", ")", "{", "JpaStorageInitializer", "initializer", "=", "new", "JpaStorageInitializer", "(", "config", ".", "getHibernateDataSource", "(", ")", ",", "config", ".", "getHibernateDialect", "(", ")", ")", ";", "initializer", ".", "initialize", "(", ")", ";", "}", "}", "return", "sJpaStorage", ";", "}" ]
Initializes the JPA storage (if required). This basically amounts to installing the DDL in the database. This is optional and disabled by default. @param config @param jpaStorage
[ "Initializes", "the", "JPA", "storage", "(", "if", "required", ")", ".", "This", "basically", "amounts", "to", "installing", "the", "DDL", "in", "the", "database", ".", "This", "is", "optional", "and", "disabled", "by", "default", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/war/src/main/java/io/apiman/manager/api/war/WarCdiFactory.java#L301-L310
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/Environment.java
Environment.doGet
public void doGet(String url, HttpResponse response, Map<String, Object> headers) { """ GETs content from URL. @param url url to get from. @param response response to store url and response value in. """ doGet(url, response, headers, true); }
java
public void doGet(String url, HttpResponse response, Map<String, Object> headers) { doGet(url, response, headers, true); }
[ "public", "void", "doGet", "(", "String", "url", ",", "HttpResponse", "response", ",", "Map", "<", "String", ",", "Object", ">", "headers", ")", "{", "doGet", "(", "url", ",", "response", ",", "headers", ",", "true", ")", ";", "}" ]
GETs content from URL. @param url url to get from. @param response response to store url and response value in.
[ "GETs", "content", "from", "URL", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/Environment.java#L388-L390
thorntail/thorntail
core/bootstrap/src/main/java/org/jboss/modules/maven/MavenArtifactUtil.java
MavenArtifactUtil.createMavenArtifactLoader
public static ResourceLoader createMavenArtifactLoader(final MavenResolver mavenResolver, final ArtifactCoordinates coordinates, final String rootName) throws IOException { """ A utility method to create a Maven artifact resource loader for the given artifact coordinates. @param mavenResolver the Maven resolver to use (must not be {@code null}) @param coordinates the artifact coordinates to use (must not be {@code null}) @param rootName the resource root name to use (must not be {@code null}) @return the resource loader @throws IOException if the artifact could not be resolved """ File fp = mavenResolver.resolveJarArtifact(coordinates); if (fp == null) return null; JarFile jarFile = JDKSpecific.getJarFile(fp, true); return ResourceLoaders.createJarResourceLoader(rootName, jarFile); }
java
public static ResourceLoader createMavenArtifactLoader(final MavenResolver mavenResolver, final ArtifactCoordinates coordinates, final String rootName) throws IOException { File fp = mavenResolver.resolveJarArtifact(coordinates); if (fp == null) return null; JarFile jarFile = JDKSpecific.getJarFile(fp, true); return ResourceLoaders.createJarResourceLoader(rootName, jarFile); }
[ "public", "static", "ResourceLoader", "createMavenArtifactLoader", "(", "final", "MavenResolver", "mavenResolver", ",", "final", "ArtifactCoordinates", "coordinates", ",", "final", "String", "rootName", ")", "throws", "IOException", "{", "File", "fp", "=", "mavenResolver", ".", "resolveJarArtifact", "(", "coordinates", ")", ";", "if", "(", "fp", "==", "null", ")", "return", "null", ";", "JarFile", "jarFile", "=", "JDKSpecific", ".", "getJarFile", "(", "fp", ",", "true", ")", ";", "return", "ResourceLoaders", ".", "createJarResourceLoader", "(", "rootName", ",", "jarFile", ")", ";", "}" ]
A utility method to create a Maven artifact resource loader for the given artifact coordinates. @param mavenResolver the Maven resolver to use (must not be {@code null}) @param coordinates the artifact coordinates to use (must not be {@code null}) @param rootName the resource root name to use (must not be {@code null}) @return the resource loader @throws IOException if the artifact could not be resolved
[ "A", "utility", "method", "to", "create", "a", "Maven", "artifact", "resource", "loader", "for", "the", "given", "artifact", "coordinates", "." ]
train
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/bootstrap/src/main/java/org/jboss/modules/maven/MavenArtifactUtil.java#L279-L284
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.paymentMean_bankAccount_id_PUT
public void paymentMean_bankAccount_id_PUT(Long id, OvhBankAccount body) throws IOException { """ Alter this object properties REST: PUT /me/paymentMean/bankAccount/{id} @param body [required] New object properties @param id [required] Id of the object """ String qPath = "/me/paymentMean/bankAccount/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void paymentMean_bankAccount_id_PUT(Long id, OvhBankAccount body) throws IOException { String qPath = "/me/paymentMean/bankAccount/{id}"; StringBuilder sb = path(qPath, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "paymentMean_bankAccount_id_PUT", "(", "Long", "id", ",", "OvhBankAccount", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/paymentMean/bankAccount/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "id", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /me/paymentMean/bankAccount/{id} @param body [required] New object properties @param id [required] Id of the object
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L763-L767
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java
AbstractSubCodeBuilderFragment.nameMatches
protected static boolean nameMatches(EObject element, String pattern) { """ Replies if the name of the given element is matching the pattern. @param element the element. @param pattern the name pattern. @return <code>true</code> if the element's name is matching. """ if (element instanceof RuleCall) { return nameMatches(((RuleCall) element).getRule(), pattern); } if (element instanceof AbstractRule) { final String name = ((AbstractRule) element).getName(); final Pattern compilerPattern = Pattern.compile(pattern); final Matcher matcher = compilerPattern.matcher(name); if (matcher.find()) { return true; } } return false; }
java
protected static boolean nameMatches(EObject element, String pattern) { if (element instanceof RuleCall) { return nameMatches(((RuleCall) element).getRule(), pattern); } if (element instanceof AbstractRule) { final String name = ((AbstractRule) element).getName(); final Pattern compilerPattern = Pattern.compile(pattern); final Matcher matcher = compilerPattern.matcher(name); if (matcher.find()) { return true; } } return false; }
[ "protected", "static", "boolean", "nameMatches", "(", "EObject", "element", ",", "String", "pattern", ")", "{", "if", "(", "element", "instanceof", "RuleCall", ")", "{", "return", "nameMatches", "(", "(", "(", "RuleCall", ")", "element", ")", ".", "getRule", "(", ")", ",", "pattern", ")", ";", "}", "if", "(", "element", "instanceof", "AbstractRule", ")", "{", "final", "String", "name", "=", "(", "(", "AbstractRule", ")", "element", ")", ".", "getName", "(", ")", ";", "final", "Pattern", "compilerPattern", "=", "Pattern", ".", "compile", "(", "pattern", ")", ";", "final", "Matcher", "matcher", "=", "compilerPattern", ".", "matcher", "(", "name", ")", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Replies if the name of the given element is matching the pattern. @param element the element. @param pattern the name pattern. @return <code>true</code> if the element's name is matching.
[ "Replies", "if", "the", "name", "of", "the", "given", "element", "is", "matching", "the", "pattern", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/AbstractSubCodeBuilderFragment.java#L662-L675
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java
ApacheHTTPClient.setupHTTPRequestHeaderProperties
protected void setupHTTPRequestHeaderProperties(HTTPRequest httpRequest,HttpMethodBase httpMethodClient) { """ This function sets the header properties in the HTTP method. @param httpRequest The HTTP request @param httpMethodClient The apache HTTP method """ //setup header properties Properties headerProperties=httpRequest.getHeaderProperties(); if(headerProperties!=null) { Iterator<Entry<Object,Object>> iterator=headerProperties.entrySet().iterator(); Entry<Object,Object> entry=null; while(iterator.hasNext()) { //get next entry entry=iterator.next(); //set header values httpMethodClient.addRequestHeader((String)entry.getKey(),(String)entry.getValue()); } } }
java
protected void setupHTTPRequestHeaderProperties(HTTPRequest httpRequest,HttpMethodBase httpMethodClient) { //setup header properties Properties headerProperties=httpRequest.getHeaderProperties(); if(headerProperties!=null) { Iterator<Entry<Object,Object>> iterator=headerProperties.entrySet().iterator(); Entry<Object,Object> entry=null; while(iterator.hasNext()) { //get next entry entry=iterator.next(); //set header values httpMethodClient.addRequestHeader((String)entry.getKey(),(String)entry.getValue()); } } }
[ "protected", "void", "setupHTTPRequestHeaderProperties", "(", "HTTPRequest", "httpRequest", ",", "HttpMethodBase", "httpMethodClient", ")", "{", "//setup header properties", "Properties", "headerProperties", "=", "httpRequest", ".", "getHeaderProperties", "(", ")", ";", "if", "(", "headerProperties", "!=", "null", ")", "{", "Iterator", "<", "Entry", "<", "Object", ",", "Object", ">", ">", "iterator", "=", "headerProperties", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "Entry", "<", "Object", ",", "Object", ">", "entry", "=", "null", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "//get next entry", "entry", "=", "iterator", ".", "next", "(", ")", ";", "//set header values", "httpMethodClient", ".", "addRequestHeader", "(", "(", "String", ")", "entry", ".", "getKey", "(", ")", ",", "(", "String", ")", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "}" ]
This function sets the header properties in the HTTP method. @param httpRequest The HTTP request @param httpMethodClient The apache HTTP method
[ "This", "function", "sets", "the", "header", "properties", "in", "the", "HTTP", "method", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java#L255-L272
JodaOrg/joda-time
src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java
DateTimeFormatterBuilder.appendOptional
public DateTimeFormatterBuilder appendOptional(DateTimeParser parser) { """ Appends just a parser element which is optional. With no matching printer, a printer cannot be built from this DateTimeFormatterBuilder. <p> The parser interface is part of the low-level part of the formatting API. Normally, instances are extracted from another formatter. Note however that any formatter specific information, such as the locale, time-zone, chronology, offset parsing or pivot/default year, will not be extracted by this method. @return this DateTimeFormatterBuilder, for chaining @throws IllegalArgumentException if parser is null or of an invalid type """ checkParser(parser); InternalParser[] parsers = new InternalParser[] {DateTimeParserInternalParser.of(parser), null}; return append0(null, new MatchingParser(parsers)); }
java
public DateTimeFormatterBuilder appendOptional(DateTimeParser parser) { checkParser(parser); InternalParser[] parsers = new InternalParser[] {DateTimeParserInternalParser.of(parser), null}; return append0(null, new MatchingParser(parsers)); }
[ "public", "DateTimeFormatterBuilder", "appendOptional", "(", "DateTimeParser", "parser", ")", "{", "checkParser", "(", "parser", ")", ";", "InternalParser", "[", "]", "parsers", "=", "new", "InternalParser", "[", "]", "{", "DateTimeParserInternalParser", ".", "of", "(", "parser", ")", ",", "null", "}", ";", "return", "append0", "(", "null", ",", "new", "MatchingParser", "(", "parsers", ")", ")", ";", "}" ]
Appends just a parser element which is optional. With no matching printer, a printer cannot be built from this DateTimeFormatterBuilder. <p> The parser interface is part of the low-level part of the formatting API. Normally, instances are extracted from another formatter. Note however that any formatter specific information, such as the locale, time-zone, chronology, offset parsing or pivot/default year, will not be extracted by this method. @return this DateTimeFormatterBuilder, for chaining @throws IllegalArgumentException if parser is null or of an invalid type
[ "Appends", "just", "a", "parser", "element", "which", "is", "optional", ".", "With", "no", "matching", "printer", "a", "printer", "cannot", "be", "built", "from", "this", "DateTimeFormatterBuilder", ".", "<p", ">", "The", "parser", "interface", "is", "part", "of", "the", "low", "-", "level", "part", "of", "the", "formatting", "API", ".", "Normally", "instances", "are", "extracted", "from", "another", "formatter", ".", "Note", "however", "that", "any", "formatter", "specific", "information", "such", "as", "the", "locale", "time", "-", "zone", "chronology", "offset", "parsing", "or", "pivot", "/", "default", "year", "will", "not", "be", "extracted", "by", "this", "method", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatterBuilder.java#L345-L349
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/file/FileCopier.java
FileCopier.create
public static FileCopier create(String srcPath, String destPath) { """ 新建一个文件复制器 @param srcPath 源文件路径(相对ClassPath路径或绝对路径) @param destPath 目标文件路径(相对ClassPath路径或绝对路径) @return {@link FileCopier} """ return new FileCopier(FileUtil.file(srcPath), FileUtil.file(destPath)); }
java
public static FileCopier create(String srcPath, String destPath) { return new FileCopier(FileUtil.file(srcPath), FileUtil.file(destPath)); }
[ "public", "static", "FileCopier", "create", "(", "String", "srcPath", ",", "String", "destPath", ")", "{", "return", "new", "FileCopier", "(", "FileUtil", ".", "file", "(", "srcPath", ")", ",", "FileUtil", ".", "file", "(", "destPath", ")", ")", ";", "}" ]
新建一个文件复制器 @param srcPath 源文件路径(相对ClassPath路径或绝对路径) @param destPath 目标文件路径(相对ClassPath路径或绝对路径) @return {@link FileCopier}
[ "新建一个文件复制器" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileCopier.java#L47-L49
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/utils/BsfUtils.java
BsfUtils.getLabel
public static String getLabel(FacesContext context, UIComponent comp) { """ <p> Returns the <code>label</code> property from the specified component. </p> Simplified and adapted version of the implementation of Mojarra 2.2.8-b02 (see MessageFactory). @param context - the <code>FacesContext</code> for the current request @return the label, if any, of the component """ Object o = comp.getAttributes().get("label"); if (o == null || (o instanceof String && ((String) o).length() == 0)) { ValueExpression vex = comp.getValueExpression("label"); if (null != vex) return (String) vex.getValue(context.getELContext()); } if (o == null) { // Use the "clientId" if there was no label specified. o = comp.getClientId(context); } return (String) o; }
java
public static String getLabel(FacesContext context, UIComponent comp) { Object o = comp.getAttributes().get("label"); if (o == null || (o instanceof String && ((String) o).length() == 0)) { ValueExpression vex = comp.getValueExpression("label"); if (null != vex) return (String) vex.getValue(context.getELContext()); } if (o == null) { // Use the "clientId" if there was no label specified. o = comp.getClientId(context); } return (String) o; }
[ "public", "static", "String", "getLabel", "(", "FacesContext", "context", ",", "UIComponent", "comp", ")", "{", "Object", "o", "=", "comp", ".", "getAttributes", "(", ")", ".", "get", "(", "\"label\"", ")", ";", "if", "(", "o", "==", "null", "||", "(", "o", "instanceof", "String", "&&", "(", "(", "String", ")", "o", ")", ".", "length", "(", ")", "==", "0", ")", ")", "{", "ValueExpression", "vex", "=", "comp", ".", "getValueExpression", "(", "\"label\"", ")", ";", "if", "(", "null", "!=", "vex", ")", "return", "(", "String", ")", "vex", ".", "getValue", "(", "context", ".", "getELContext", "(", ")", ")", ";", "}", "if", "(", "o", "==", "null", ")", "{", "// Use the \"clientId\" if there was no label specified.", "o", "=", "comp", ".", "getClientId", "(", "context", ")", ";", "}", "return", "(", "String", ")", "o", ";", "}" ]
<p> Returns the <code>label</code> property from the specified component. </p> Simplified and adapted version of the implementation of Mojarra 2.2.8-b02 (see MessageFactory). @param context - the <code>FacesContext</code> for the current request @return the label, if any, of the component
[ "<p", ">", "Returns", "the", "<code", ">", "label<", "/", "code", ">", "property", "from", "the", "specified", "component", ".", "<", "/", "p", ">", "Simplified", "and", "adapted", "version", "of", "the", "implementation", "of", "Mojarra", "2", ".", "2", ".", "8", "-", "b02", "(", "see", "MessageFactory", ")", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/utils/BsfUtils.java#L609-L621
alkacon/opencms-core
src/org/opencms/xml/page/CmsXmlPage.java
CmsXmlPage.setStringValue
public void setStringValue(CmsObject cms, String name, Locale locale, String content) throws CmsXmlException { """ Sets the data of an already existing value.<p> The data will be enclosed as CDATA within the xml page structure. When setting the element data, the content of this element will be processed automatically.<p> @param cms the cms object @param name name of the element @param locale locale of the element @param content character data (CDATA) of the element @throws CmsXmlException if something goes wrong """ CmsXmlHtmlValue value = (CmsXmlHtmlValue)getValue(name, locale); if (value != null) { // set the values value.setStringValue(cms, content); } else { throw new CmsXmlException( Messages.get().container(Messages.ERR_XML_PAGE_INVALID_ELEM_SELECT_2, locale, name)); } }
java
public void setStringValue(CmsObject cms, String name, Locale locale, String content) throws CmsXmlException { CmsXmlHtmlValue value = (CmsXmlHtmlValue)getValue(name, locale); if (value != null) { // set the values value.setStringValue(cms, content); } else { throw new CmsXmlException( Messages.get().container(Messages.ERR_XML_PAGE_INVALID_ELEM_SELECT_2, locale, name)); } }
[ "public", "void", "setStringValue", "(", "CmsObject", "cms", ",", "String", "name", ",", "Locale", "locale", ",", "String", "content", ")", "throws", "CmsXmlException", "{", "CmsXmlHtmlValue", "value", "=", "(", "CmsXmlHtmlValue", ")", "getValue", "(", "name", ",", "locale", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "// set the values", "value", ".", "setStringValue", "(", "cms", ",", "content", ")", ";", "}", "else", "{", "throw", "new", "CmsXmlException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_XML_PAGE_INVALID_ELEM_SELECT_2", ",", "locale", ",", "name", ")", ")", ";", "}", "}" ]
Sets the data of an already existing value.<p> The data will be enclosed as CDATA within the xml page structure. When setting the element data, the content of this element will be processed automatically.<p> @param cms the cms object @param name name of the element @param locale locale of the element @param content character data (CDATA) of the element @throws CmsXmlException if something goes wrong
[ "Sets", "the", "data", "of", "an", "already", "existing", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/page/CmsXmlPage.java#L439-L450
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_mitigation_GET
public ArrayList<String> ip_mitigation_GET(String ip, Boolean auto, OvhMitigationStateEnum state) throws IOException { """ Ip under mitigation REST: GET /ip/{ip}/mitigation @param state [required] Filter the value of state property (=) @param auto [required] Filter the value of auto property (=) @param ip [required] """ String qPath = "/ip/{ip}/mitigation"; StringBuilder sb = path(qPath, ip); query(sb, "auto", auto); query(sb, "state", state); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<String> ip_mitigation_GET(String ip, Boolean auto, OvhMitigationStateEnum state) throws IOException { String qPath = "/ip/{ip}/mitigation"; StringBuilder sb = path(qPath, ip); query(sb, "auto", auto); query(sb, "state", state); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "String", ">", "ip_mitigation_GET", "(", "String", "ip", ",", "Boolean", "auto", ",", "OvhMitigationStateEnum", "state", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/mitigation\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip", ")", ";", "query", "(", "sb", ",", "\"auto\"", ",", "auto", ")", ";", "query", "(", "sb", ",", "\"state\"", ",", "state", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t2", ")", ";", "}" ]
Ip under mitigation REST: GET /ip/{ip}/mitigation @param state [required] Filter the value of state property (=) @param auto [required] Filter the value of auto property (=) @param ip [required]
[ "Ip", "under", "mitigation" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L779-L786
derari/cthul
objects/src/main/java/org/cthul/objects/reflection/Signatures.java
Signatures.bestMethod
public static Method bestMethod(Class<?> clazz, String name, Class<?>[] argTypes) throws AmbiguousMethodMatchException { """ Finds the best method for the given argument types. @param clazz @param name @param argTypes @return method @throws AmbiguousSignatureMatchException if multiple methods match equally """ return bestMethod(collectMethods(clazz, name), argTypes); }
java
public static Method bestMethod(Class<?> clazz, String name, Class<?>[] argTypes) throws AmbiguousMethodMatchException { return bestMethod(collectMethods(clazz, name), argTypes); }
[ "public", "static", "Method", "bestMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "name", ",", "Class", "<", "?", ">", "[", "]", "argTypes", ")", "throws", "AmbiguousMethodMatchException", "{", "return", "bestMethod", "(", "collectMethods", "(", "clazz", ",", "name", ")", ",", "argTypes", ")", ";", "}" ]
Finds the best method for the given argument types. @param clazz @param name @param argTypes @return method @throws AmbiguousSignatureMatchException if multiple methods match equally
[ "Finds", "the", "best", "method", "for", "the", "given", "argument", "types", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/reflection/Signatures.java#L139-L141
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/Compare.java
Compare.compareTitles
private static boolean compareTitles(String primaryTitle, String firstCompareTitle, String secondCompareTitle, int maxDistance) { """ Compare a title with two other titles. @param primaryTitle Primary title @param firstCompareTitle First title to compare with @param secondCompareTitle Second title to compare with @param maxDistance Maximum difference between the titles @return """ // Compare with the first title if (compareDistance(primaryTitle, firstCompareTitle, maxDistance)) { return true; } // Compare with the other title return compareDistance(primaryTitle, secondCompareTitle, maxDistance); }
java
private static boolean compareTitles(String primaryTitle, String firstCompareTitle, String secondCompareTitle, int maxDistance) { // Compare with the first title if (compareDistance(primaryTitle, firstCompareTitle, maxDistance)) { return true; } // Compare with the other title return compareDistance(primaryTitle, secondCompareTitle, maxDistance); }
[ "private", "static", "boolean", "compareTitles", "(", "String", "primaryTitle", ",", "String", "firstCompareTitle", ",", "String", "secondCompareTitle", ",", "int", "maxDistance", ")", "{", "// Compare with the first title", "if", "(", "compareDistance", "(", "primaryTitle", ",", "firstCompareTitle", ",", "maxDistance", ")", ")", "{", "return", "true", ";", "}", "// Compare with the other title", "return", "compareDistance", "(", "primaryTitle", ",", "secondCompareTitle", ",", "maxDistance", ")", ";", "}" ]
Compare a title with two other titles. @param primaryTitle Primary title @param firstCompareTitle First title to compare with @param secondCompareTitle Second title to compare with @param maxDistance Maximum difference between the titles @return
[ "Compare", "a", "title", "with", "two", "other", "titles", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/Compare.java#L99-L107
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java
EnvironmentConverter.convertEnvironmentIfNecessary
StandardEnvironment convertEnvironmentIfNecessary(ConfigurableEnvironment environment, Class<? extends StandardEnvironment> type) { """ Converts the given {@code environment} to the given {@link StandardEnvironment} type. If the environment is already of the same type, no conversion is performed and it is returned unchanged. @param environment the Environment to convert @param type the type to convert the Environment to @return the converted Environment """ if (type.equals(environment.getClass())) { return (StandardEnvironment) environment; } return convertEnvironment(environment, type); }
java
StandardEnvironment convertEnvironmentIfNecessary(ConfigurableEnvironment environment, Class<? extends StandardEnvironment> type) { if (type.equals(environment.getClass())) { return (StandardEnvironment) environment; } return convertEnvironment(environment, type); }
[ "StandardEnvironment", "convertEnvironmentIfNecessary", "(", "ConfigurableEnvironment", "environment", ",", "Class", "<", "?", "extends", "StandardEnvironment", ">", "type", ")", "{", "if", "(", "type", ".", "equals", "(", "environment", ".", "getClass", "(", ")", ")", ")", "{", "return", "(", "StandardEnvironment", ")", "environment", ";", "}", "return", "convertEnvironment", "(", "environment", ",", "type", ")", ";", "}" ]
Converts the given {@code environment} to the given {@link StandardEnvironment} type. If the environment is already of the same type, no conversion is performed and it is returned unchanged. @param environment the Environment to convert @param type the type to convert the Environment to @return the converted Environment
[ "Converts", "the", "given", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/EnvironmentConverter.java#L71-L77
apache/incubator-heron
heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java
SchedulerUtils.setLibSchedulerLocation
public static boolean setLibSchedulerLocation( Config runtime, IScheduler scheduler, boolean isService) { """ Set the location of scheduler for other processes to discover, when invoke IScheduler as a library on client side @param runtime the runtime configuration @param scheduler the IScheduler to provide more info @param isService true if the scheduler is a service; false otherwise """ // Dummy value since there is no scheduler running as service final String endpoint = "scheduler_as_lib_no_endpoint"; return setSchedulerLocation(runtime, endpoint, scheduler); }
java
public static boolean setLibSchedulerLocation( Config runtime, IScheduler scheduler, boolean isService) { // Dummy value since there is no scheduler running as service final String endpoint = "scheduler_as_lib_no_endpoint"; return setSchedulerLocation(runtime, endpoint, scheduler); }
[ "public", "static", "boolean", "setLibSchedulerLocation", "(", "Config", "runtime", ",", "IScheduler", "scheduler", ",", "boolean", "isService", ")", "{", "// Dummy value since there is no scheduler running as service", "final", "String", "endpoint", "=", "\"scheduler_as_lib_no_endpoint\"", ";", "return", "setSchedulerLocation", "(", "runtime", ",", "endpoint", ",", "scheduler", ")", ";", "}" ]
Set the location of scheduler for other processes to discover, when invoke IScheduler as a library on client side @param runtime the runtime configuration @param scheduler the IScheduler to provide more info @param isService true if the scheduler is a service; false otherwise
[ "Set", "the", "location", "of", "scheduler", "for", "other", "processes", "to", "discover", "when", "invoke", "IScheduler", "as", "a", "library", "on", "client", "side" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/SchedulerUtils.java#L386-L393
kiswanij/jk-util
src/main/java/com/jk/util/JKIOUtil.java
JKIOUtil.convertToString
public static String convertToString(InputStream input) throws IOException { """ Convert to string. @param input the input @return the string @throws IOException Signals that an I/O exception has occurred. """ try { if (input == null) { throw new IOException("Input Stream Cannot be NULL"); } StringBuilder sb1 = new StringBuilder(); String line; try { BufferedReader r1 = new BufferedReader(new InputStreamReader(input, "UTF-8")); while ((line = r1.readLine()) != null) { sb1.append(line); } } finally { input.close(); } return sb1.toString(); } catch (IOException e) { throw new JKException(e); } }
java
public static String convertToString(InputStream input) throws IOException { try { if (input == null) { throw new IOException("Input Stream Cannot be NULL"); } StringBuilder sb1 = new StringBuilder(); String line; try { BufferedReader r1 = new BufferedReader(new InputStreamReader(input, "UTF-8")); while ((line = r1.readLine()) != null) { sb1.append(line); } } finally { input.close(); } return sb1.toString(); } catch (IOException e) { throw new JKException(e); } }
[ "public", "static", "String", "convertToString", "(", "InputStream", "input", ")", "throws", "IOException", "{", "try", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Input Stream Cannot be NULL\"", ")", ";", "}", "StringBuilder", "sb1", "=", "new", "StringBuilder", "(", ")", ";", "String", "line", ";", "try", "{", "BufferedReader", "r1", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "input", ",", "\"UTF-8\"", ")", ")", ";", "while", "(", "(", "line", "=", "r1", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "sb1", ".", "append", "(", "line", ")", ";", "}", "}", "finally", "{", "input", ".", "close", "(", ")", ";", "}", "return", "sb1", ".", "toString", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "JKException", "(", "e", ")", ";", "}", "}" ]
Convert to string. @param input the input @return the string @throws IOException Signals that an I/O exception has occurred.
[ "Convert", "to", "string", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKIOUtil.java#L205-L224
skuzzle/semantic-version
src/main/java/de/skuzzle/semantic/Version.java
Version.nextMajor
public Version nextMajor(String[] newPrelease) { """ Given this Version, returns the next major Version. That is, the major part is incremented by 1 and the remaining parts are set to 0. The pre-release part will be set to the given identifier and the build-meta-data is dropped. @param newPrelease The pre-release part for the resulting Version. @return The incremented version. @throws VersionFormatException If the any element of the given array is not a valid pre release identifier part. @throws IllegalArgumentException If newPreRelease is null. @see #nextMajor() @see #nextMajor(String) @since 1.2.0 """ require(newPrelease != null, "newPreRelease is null"); final String[] newPreReleaseParts = verifyAndCopyArray(newPrelease, false); return new Version(this.major + 1, 0, 0, newPreReleaseParts, EMPTY_ARRAY); }
java
public Version nextMajor(String[] newPrelease) { require(newPrelease != null, "newPreRelease is null"); final String[] newPreReleaseParts = verifyAndCopyArray(newPrelease, false); return new Version(this.major + 1, 0, 0, newPreReleaseParts, EMPTY_ARRAY); }
[ "public", "Version", "nextMajor", "(", "String", "[", "]", "newPrelease", ")", "{", "require", "(", "newPrelease", "!=", "null", ",", "\"newPreRelease is null\"", ")", ";", "final", "String", "[", "]", "newPreReleaseParts", "=", "verifyAndCopyArray", "(", "newPrelease", ",", "false", ")", ";", "return", "new", "Version", "(", "this", ".", "major", "+", "1", ",", "0", ",", "0", ",", "newPreReleaseParts", ",", "EMPTY_ARRAY", ")", ";", "}" ]
Given this Version, returns the next major Version. That is, the major part is incremented by 1 and the remaining parts are set to 0. The pre-release part will be set to the given identifier and the build-meta-data is dropped. @param newPrelease The pre-release part for the resulting Version. @return The incremented version. @throws VersionFormatException If the any element of the given array is not a valid pre release identifier part. @throws IllegalArgumentException If newPreRelease is null. @see #nextMajor() @see #nextMajor(String) @since 1.2.0
[ "Given", "this", "Version", "returns", "the", "next", "major", "Version", ".", "That", "is", "the", "major", "part", "is", "incremented", "by", "1", "and", "the", "remaining", "parts", "are", "set", "to", "0", ".", "The", "pre", "-", "release", "part", "will", "be", "set", "to", "the", "given", "identifier", "and", "the", "build", "-", "meta", "-", "data", "is", "dropped", "." ]
train
https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L737-L741
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FileSystem.java
FileSystem.mkdirs
public static boolean mkdirs(FileSystem fs, Path dir, FsPermission permission) throws IOException { """ create a directory with the provided permission The permission of the directory is set to be the provided permission as in setPermission, not permission&~umask @see #create(FileSystem, Path, FsPermission) @param fs file system handle @param dir the name of the directory to be created @param permission the permission of the directory @return true if the directory creation succeeds; false otherwise @throws IOException """ // create the directory using the default permission boolean result = fs.mkdirs(dir); // set its permission to be the supplied one fs.setPermission(dir, permission); return result; }
java
public static boolean mkdirs(FileSystem fs, Path dir, FsPermission permission) throws IOException { // create the directory using the default permission boolean result = fs.mkdirs(dir); // set its permission to be the supplied one fs.setPermission(dir, permission); return result; }
[ "public", "static", "boolean", "mkdirs", "(", "FileSystem", "fs", ",", "Path", "dir", ",", "FsPermission", "permission", ")", "throws", "IOException", "{", "// create the directory using the default permission", "boolean", "result", "=", "fs", ".", "mkdirs", "(", "dir", ")", ";", "// set its permission to be the supplied one", "fs", ".", "setPermission", "(", "dir", ",", "permission", ")", ";", "return", "result", ";", "}" ]
create a directory with the provided permission The permission of the directory is set to be the provided permission as in setPermission, not permission&~umask @see #create(FileSystem, Path, FsPermission) @param fs file system handle @param dir the name of the directory to be created @param permission the permission of the directory @return true if the directory creation succeeds; false otherwise @throws IOException
[ "create", "a", "directory", "with", "the", "provided", "permission", "The", "permission", "of", "the", "directory", "is", "set", "to", "be", "the", "provided", "permission", "as", "in", "setPermission", "not", "permission&~umask" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L328-L335
google/closure-templates
java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java
GenJsCodeVisitor.doVisitReturningCodeChunk
private Statement doVisitReturningCodeChunk(SoyNode node, boolean visitChildren) { """ Do not use directly; use {@link #visitChildrenReturningCodeChunk} instead. """ // Replace jsCodeBuilder with a child JsCodeBuilder. JsCodeBuilder original = jsCodeBuilder; jsCodeBuilder = createChildJsCodeBuilder(); // Visit body. // set indent to 0 since when rendering the CodeChunk, everything will get re-indented jsCodeBuilder.setIndent(0); if (visitChildren) { visitChildren((ParentSoyNode<?>) node); } else { visit(node); } Statement chunk = Statement.treatRawStringAsStatementLegacyOnly( jsCodeBuilder.getCode(), jsCodeBuilder.googRequires()); jsCodeBuilder = original; return chunk; }
java
private Statement doVisitReturningCodeChunk(SoyNode node, boolean visitChildren) { // Replace jsCodeBuilder with a child JsCodeBuilder. JsCodeBuilder original = jsCodeBuilder; jsCodeBuilder = createChildJsCodeBuilder(); // Visit body. // set indent to 0 since when rendering the CodeChunk, everything will get re-indented jsCodeBuilder.setIndent(0); if (visitChildren) { visitChildren((ParentSoyNode<?>) node); } else { visit(node); } Statement chunk = Statement.treatRawStringAsStatementLegacyOnly( jsCodeBuilder.getCode(), jsCodeBuilder.googRequires()); jsCodeBuilder = original; return chunk; }
[ "private", "Statement", "doVisitReturningCodeChunk", "(", "SoyNode", "node", ",", "boolean", "visitChildren", ")", "{", "// Replace jsCodeBuilder with a child JsCodeBuilder.", "JsCodeBuilder", "original", "=", "jsCodeBuilder", ";", "jsCodeBuilder", "=", "createChildJsCodeBuilder", "(", ")", ";", "// Visit body.", "// set indent to 0 since when rendering the CodeChunk, everything will get re-indented", "jsCodeBuilder", ".", "setIndent", "(", "0", ")", ";", "if", "(", "visitChildren", ")", "{", "visitChildren", "(", "(", "ParentSoyNode", "<", "?", ">", ")", "node", ")", ";", "}", "else", "{", "visit", "(", "node", ")", ";", "}", "Statement", "chunk", "=", "Statement", ".", "treatRawStringAsStatementLegacyOnly", "(", "jsCodeBuilder", ".", "getCode", "(", ")", ",", "jsCodeBuilder", ".", "googRequires", "(", ")", ")", ";", "jsCodeBuilder", "=", "original", ";", "return", "chunk", ";", "}" ]
Do not use directly; use {@link #visitChildrenReturningCodeChunk} instead.
[ "Do", "not", "use", "directly", ";", "use", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java#L335-L357
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java
IPAddressSection.containsNonZeroHosts
public boolean containsNonZeroHosts(IPAddressSection other) { """ Returns whether this address contains the non-zero host addresses in other. @param other @return """ if(!other.isPrefixed()) { return contains(other); } int otherPrefixLength = other.getNetworkPrefixLength(); if(otherPrefixLength == other.getBitCount()) { return contains(other); } return containsNonZeroHostsImpl(other, otherPrefixLength); }
java
public boolean containsNonZeroHosts(IPAddressSection other) { if(!other.isPrefixed()) { return contains(other); } int otherPrefixLength = other.getNetworkPrefixLength(); if(otherPrefixLength == other.getBitCount()) { return contains(other); } return containsNonZeroHostsImpl(other, otherPrefixLength); }
[ "public", "boolean", "containsNonZeroHosts", "(", "IPAddressSection", "other", ")", "{", "if", "(", "!", "other", ".", "isPrefixed", "(", ")", ")", "{", "return", "contains", "(", "other", ")", ";", "}", "int", "otherPrefixLength", "=", "other", ".", "getNetworkPrefixLength", "(", ")", ";", "if", "(", "otherPrefixLength", "==", "other", ".", "getBitCount", "(", ")", ")", "{", "return", "contains", "(", "other", ")", ";", "}", "return", "containsNonZeroHostsImpl", "(", "other", ",", "otherPrefixLength", ")", ";", "}" ]
Returns whether this address contains the non-zero host addresses in other. @param other @return
[ "Returns", "whether", "this", "address", "contains", "the", "non", "-", "zero", "host", "addresses", "in", "other", "." ]
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSection.java#L803-L812
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StringUtils.java
StringUtils.minIndex
public static int minIndex(int a, int b) { """ Returns the minimum index >= 0, if any <p> Use to find the first of two characters in a string:<br> <code>minIndex(s.indexOf('/'), indexOf('\'))</code> </p> """ return (a < 0) ? b : (b < 0) ? a : (a < b) ? a : b; }
java
public static int minIndex(int a, int b) { return (a < 0) ? b : (b < 0) ? a : (a < b) ? a : b; }
[ "public", "static", "int", "minIndex", "(", "int", "a", ",", "int", "b", ")", "{", "return", "(", "a", "<", "0", ")", "?", "b", ":", "(", "b", "<", "0", ")", "?", "a", ":", "(", "a", "<", "b", ")", "?", "a", ":", "b", ";", "}" ]
Returns the minimum index >= 0, if any <p> Use to find the first of two characters in a string:<br> <code>minIndex(s.indexOf('/'), indexOf('\'))</code> </p>
[ "Returns", "the", "minimum", "index", ">", "=", "0", "if", "any" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StringUtils.java#L730-L735
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java
PaymentProtocol.createPaymentAck
public static Protos.PaymentACK createPaymentAck(Protos.Payment paymentMessage, @Nullable String memo) { """ Create a payment ack. @param paymentMessage payment message to send with the ack @param memo arbitrary, user readable memo, or null if none @return created payment ack """ final Protos.PaymentACK.Builder builder = Protos.PaymentACK.newBuilder(); builder.setPayment(paymentMessage); if (memo != null) builder.setMemo(memo); return builder.build(); }
java
public static Protos.PaymentACK createPaymentAck(Protos.Payment paymentMessage, @Nullable String memo) { final Protos.PaymentACK.Builder builder = Protos.PaymentACK.newBuilder(); builder.setPayment(paymentMessage); if (memo != null) builder.setMemo(memo); return builder.build(); }
[ "public", "static", "Protos", ".", "PaymentACK", "createPaymentAck", "(", "Protos", ".", "Payment", "paymentMessage", ",", "@", "Nullable", "String", "memo", ")", "{", "final", "Protos", ".", "PaymentACK", ".", "Builder", "builder", "=", "Protos", ".", "PaymentACK", ".", "newBuilder", "(", ")", ";", "builder", ".", "setPayment", "(", "paymentMessage", ")", ";", "if", "(", "memo", "!=", "null", ")", "builder", ".", "setMemo", "(", "memo", ")", ";", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Create a payment ack. @param paymentMessage payment message to send with the ack @param memo arbitrary, user readable memo, or null if none @return created payment ack
[ "Create", "a", "payment", "ack", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java#L376-L382
TimeAndSpaceIO/SmoothieMap
src/main/java/net/openhft/smoothie/SmoothieMap.java
SmoothieMap.putIfAbsent
@Override public final V putIfAbsent(K key, V value) { """ If the specified key is not already associated with a value (or is mapped to {@code null}) associates it with the given value and returns {@code null}, else returns the current value. @param key key with which the specified value is to be associated @param value value to be associated with the specified key @return the previous value associated with the specified key, or {@code null} if there was no mapping for the key. (A {@code null} return can also indicate that the map previously associated {@code null} with the key.) """ long hash; return segment(segmentIndex(hash = keyHashCode(key))).put(this, hash, key, value, true); }
java
@Override public final V putIfAbsent(K key, V value) { long hash; return segment(segmentIndex(hash = keyHashCode(key))).put(this, hash, key, value, true); }
[ "@", "Override", "public", "final", "V", "putIfAbsent", "(", "K", "key", ",", "V", "value", ")", "{", "long", "hash", ";", "return", "segment", "(", "segmentIndex", "(", "hash", "=", "keyHashCode", "(", "key", ")", ")", ")", ".", "put", "(", "this", ",", "hash", ",", "key", ",", "value", ",", "true", ")", ";", "}" ]
If the specified key is not already associated with a value (or is mapped to {@code null}) associates it with the given value and returns {@code null}, else returns the current value. @param key key with which the specified value is to be associated @param value value to be associated with the specified key @return the previous value associated with the specified key, or {@code null} if there was no mapping for the key. (A {@code null} return can also indicate that the map previously associated {@code null} with the key.)
[ "If", "the", "specified", "key", "is", "not", "already", "associated", "with", "a", "value", "(", "or", "is", "mapped", "to", "{", "@code", "null", "}", ")", "associates", "it", "with", "the", "given", "value", "and", "returns", "{", "@code", "null", "}", "else", "returns", "the", "current", "value", "." ]
train
https://github.com/TimeAndSpaceIO/SmoothieMap/blob/c798f6cae1d377f6913e8821a1fcf5bf45ee0412/src/main/java/net/openhft/smoothie/SmoothieMap.java#L818-L822
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java
TupleCombiner.getTuples
public static Collection<Tuple> getTuples( List<VarDef> varDefs, int tupleSize) { """ Returns all valid N-tuples of values for the given input variables. A non-positive tupleSize specifies all permutations. """ if( tupleSize < 1) { tupleSize = varDefs.size(); } int varEnd = varDefs.size() - tupleSize + 1; if( varEnd <= 0) { throw new IllegalArgumentException( "Can't create " + tupleSize + "-tuples for " + varDefs.size() + " combined variables"); } return getTuples( varDefs, 0, varEnd, tupleSize); }
java
public static Collection<Tuple> getTuples( List<VarDef> varDefs, int tupleSize) { if( tupleSize < 1) { tupleSize = varDefs.size(); } int varEnd = varDefs.size() - tupleSize + 1; if( varEnd <= 0) { throw new IllegalArgumentException( "Can't create " + tupleSize + "-tuples for " + varDefs.size() + " combined variables"); } return getTuples( varDefs, 0, varEnd, tupleSize); }
[ "public", "static", "Collection", "<", "Tuple", ">", "getTuples", "(", "List", "<", "VarDef", ">", "varDefs", ",", "int", "tupleSize", ")", "{", "if", "(", "tupleSize", "<", "1", ")", "{", "tupleSize", "=", "varDefs", ".", "size", "(", ")", ";", "}", "int", "varEnd", "=", "varDefs", ".", "size", "(", ")", "-", "tupleSize", "+", "1", ";", "if", "(", "varEnd", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can't create \"", "+", "tupleSize", "+", "\"-tuples for \"", "+", "varDefs", ".", "size", "(", ")", "+", "\" combined variables\"", ")", ";", "}", "return", "getTuples", "(", "varDefs", ",", "0", ",", "varEnd", ",", "tupleSize", ")", ";", "}" ]
Returns all valid N-tuples of values for the given input variables. A non-positive tupleSize specifies all permutations.
[ "Returns", "all", "valid", "N", "-", "tuples", "of", "values", "for", "the", "given", "input", "variables", ".", "A", "non", "-", "positive", "tupleSize", "specifies", "all", "permutations", "." ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java#L251-L263
JodaOrg/joda-money
src/main/java/org/joda/money/Money.java
Money.dividedBy
public Money dividedBy(BigDecimal valueToDivideBy, RoundingMode roundingMode) { """ Returns a copy of this monetary value divided by the specified value. <p> This takes this amount and divides it by the specified value, rounding the result is rounded as specified. <p> This instance is immutable and unaffected by this method. @param valueToDivideBy the scalar value to divide by, not null @param roundingMode the rounding mode to use, not null @return the new divided instance, never null @throws ArithmeticException if dividing by zero @throws ArithmeticException if the rounding fails """ return with(money.dividedBy(valueToDivideBy, roundingMode)); }
java
public Money dividedBy(BigDecimal valueToDivideBy, RoundingMode roundingMode) { return with(money.dividedBy(valueToDivideBy, roundingMode)); }
[ "public", "Money", "dividedBy", "(", "BigDecimal", "valueToDivideBy", ",", "RoundingMode", "roundingMode", ")", "{", "return", "with", "(", "money", ".", "dividedBy", "(", "valueToDivideBy", ",", "roundingMode", ")", ")", ";", "}" ]
Returns a copy of this monetary value divided by the specified value. <p> This takes this amount and divides it by the specified value, rounding the result is rounded as specified. <p> This instance is immutable and unaffected by this method. @param valueToDivideBy the scalar value to divide by, not null @param roundingMode the rounding mode to use, not null @return the new divided instance, never null @throws ArithmeticException if dividing by zero @throws ArithmeticException if the rounding fails
[ "Returns", "a", "copy", "of", "this", "monetary", "value", "divided", "by", "the", "specified", "value", ".", "<p", ">", "This", "takes", "this", "amount", "and", "divides", "it", "by", "the", "specified", "value", "rounding", "the", "result", "is", "rounded", "as", "specified", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "." ]
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L1074-L1076
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java
SlotSharingGroupAssignment.getSlotForTask
public SimpleSlot getSlotForTask(JobVertexID vertexID, Iterable<TaskManagerLocation> locationPreferences) { """ Gets a slot suitable for the given task vertex. This method will prefer slots that are local (with respect to {@link ExecutionVertex#getPreferredLocationsBasedOnInputs()}), but will return non local slots if no local slot is available. The method returns null, when this sharing group has no slot available for the given JobVertexID. @param vertexID the vertex id @param locationPreferences location preferences @return A slot to execute the given ExecutionVertex in, or null, if none is available. """ synchronized (lock) { Tuple2<SharedSlot, Locality> p = getSharedSlotForTask(vertexID, locationPreferences, false); if (p != null) { SharedSlot ss = p.f0; SimpleSlot slot = ss.allocateSubSlot(vertexID); slot.setLocality(p.f1); return slot; } else { return null; } } }
java
public SimpleSlot getSlotForTask(JobVertexID vertexID, Iterable<TaskManagerLocation> locationPreferences) { synchronized (lock) { Tuple2<SharedSlot, Locality> p = getSharedSlotForTask(vertexID, locationPreferences, false); if (p != null) { SharedSlot ss = p.f0; SimpleSlot slot = ss.allocateSubSlot(vertexID); slot.setLocality(p.f1); return slot; } else { return null; } } }
[ "public", "SimpleSlot", "getSlotForTask", "(", "JobVertexID", "vertexID", ",", "Iterable", "<", "TaskManagerLocation", ">", "locationPreferences", ")", "{", "synchronized", "(", "lock", ")", "{", "Tuple2", "<", "SharedSlot", ",", "Locality", ">", "p", "=", "getSharedSlotForTask", "(", "vertexID", ",", "locationPreferences", ",", "false", ")", ";", "if", "(", "p", "!=", "null", ")", "{", "SharedSlot", "ss", "=", "p", ".", "f0", ";", "SimpleSlot", "slot", "=", "ss", ".", "allocateSubSlot", "(", "vertexID", ")", ";", "slot", ".", "setLocality", "(", "p", ".", "f1", ")", ";", "return", "slot", ";", "}", "else", "{", "return", "null", ";", "}", "}", "}" ]
Gets a slot suitable for the given task vertex. This method will prefer slots that are local (with respect to {@link ExecutionVertex#getPreferredLocationsBasedOnInputs()}), but will return non local slots if no local slot is available. The method returns null, when this sharing group has no slot available for the given JobVertexID. @param vertexID the vertex id @param locationPreferences location preferences @return A slot to execute the given ExecutionVertex in, or null, if none is available.
[ "Gets", "a", "slot", "suitable", "for", "the", "given", "task", "vertex", ".", "This", "method", "will", "prefer", "slots", "that", "are", "local", "(", "with", "respect", "to", "{", "@link", "ExecutionVertex#getPreferredLocationsBasedOnInputs", "()", "}", ")", "but", "will", "return", "non", "local", "slots", "if", "no", "local", "slot", "is", "available", ".", "The", "method", "returns", "null", "when", "this", "sharing", "group", "has", "no", "slot", "available", "for", "the", "given", "JobVertexID", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/SlotSharingGroupAssignment.java#L275-L289
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java
AbstractOracleQuery.connectByPrior
@WithBridgeMethods(value = OracleQuery.class, castRequired = true) public C connectByPrior(Predicate cond) { """ CONNECT BY specifies the relationship between parent rows and child rows of the hierarchy. @param cond condition @return the current object """ return addFlag(Position.BEFORE_ORDER, CONNECT_BY_PRIOR, cond); }
java
@WithBridgeMethods(value = OracleQuery.class, castRequired = true) public C connectByPrior(Predicate cond) { return addFlag(Position.BEFORE_ORDER, CONNECT_BY_PRIOR, cond); }
[ "@", "WithBridgeMethods", "(", "value", "=", "OracleQuery", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "connectByPrior", "(", "Predicate", "cond", ")", "{", "return", "addFlag", "(", "Position", ".", "BEFORE_ORDER", ",", "CONNECT_BY_PRIOR", ",", "cond", ")", ";", "}" ]
CONNECT BY specifies the relationship between parent rows and child rows of the hierarchy. @param cond condition @return the current object
[ "CONNECT", "BY", "specifies", "the", "relationship", "between", "parent", "rows", "and", "child", "rows", "of", "the", "hierarchy", "." ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/oracle/AbstractOracleQuery.java#L61-L64
JoeKerouac/utils
src/main/java/com/joe/utils/img/IQRCode.java
IQRCode.createQRCode
private static QRCode createQRCode(String data, int width, int height) { """ 将指定数据生成二维码 @param data 二维码数据 @param width 图片的宽 @param height 图片的高 @return QRCode QRCode """ logger.debug("生成二维码,要生成的图片的宽为{},高为{}", width, height); QRCode code = QRCode.from(data); code.withCharset("UTF8"); code.withSize(width, height); logger.debug("二维码生成成功"); return code; }
java
private static QRCode createQRCode(String data, int width, int height) { logger.debug("生成二维码,要生成的图片的宽为{},高为{}", width, height); QRCode code = QRCode.from(data); code.withCharset("UTF8"); code.withSize(width, height); logger.debug("二维码生成成功"); return code; }
[ "private", "static", "QRCode", "createQRCode", "(", "String", "data", ",", "int", "width", ",", "int", "height", ")", "{", "logger", ".", "debug", "(", "\"生成二维码,要生成的图片的宽为{},高为{}\", width, height);", "", "", "", "", "", "", "QRCode", "code", "=", "QRCode", ".", "from", "(", "data", ")", ";", "code", ".", "withCharset", "(", "\"UTF8\"", ")", ";", "code", ".", "withSize", "(", "width", ",", "height", ")", ";", "logger", ".", "debug", "(", "\"二维码生成成功\");", "", "", "return", "code", ";", "}" ]
将指定数据生成二维码 @param data 二维码数据 @param width 图片的宽 @param height 图片的高 @return QRCode QRCode
[ "将指定数据生成二维码" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/img/IQRCode.java#L127-L134
google/closure-compiler
src/com/google/javascript/jscomp/deps/JsFileParser.java
JsFileParser.parseFile
public DependencyInfo parseFile(String filePath, String closureRelativePath, String fileContents) { """ Parses the given file and returns the dependency information that it contained. @param filePath Path to the file to parse. @param closureRelativePath Path of the file relative to closure. @param fileContents The contents to parse. @return A DependencyInfo containing all provides/requires found in the file. """ return parseReader(filePath, closureRelativePath, new StringReader(fileContents)); }
java
public DependencyInfo parseFile(String filePath, String closureRelativePath, String fileContents) { return parseReader(filePath, closureRelativePath, new StringReader(fileContents)); }
[ "public", "DependencyInfo", "parseFile", "(", "String", "filePath", ",", "String", "closureRelativePath", ",", "String", "fileContents", ")", "{", "return", "parseReader", "(", "filePath", ",", "closureRelativePath", ",", "new", "StringReader", "(", "fileContents", ")", ")", ";", "}" ]
Parses the given file and returns the dependency information that it contained. @param filePath Path to the file to parse. @param closureRelativePath Path of the file relative to closure. @param fileContents The contents to parse. @return A DependencyInfo containing all provides/requires found in the file.
[ "Parses", "the", "given", "file", "and", "returns", "the", "dependency", "information", "that", "it", "contained", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/deps/JsFileParser.java#L180-L183
opentable/otj-logging
core/src/main/java/com/opentable/logging/LogMetadata.java
LogMetadata.of
public static LogMetadata of(String key, Object value) { """ Create a new metadata marker with a single key-value pair. @param key the key to add @param value the value to add for that key """ Map<String, Object> map = new HashMap<>(); map.put(key, value); return new LogMetadata(map); }
java
public static LogMetadata of(String key, Object value) { Map<String, Object> map = new HashMap<>(); map.put(key, value); return new LogMetadata(map); }
[ "public", "static", "LogMetadata", "of", "(", "String", "key", ",", "Object", "value", ")", "{", "Map", "<", "String", ",", "Object", ">", "map", "=", "new", "HashMap", "<>", "(", ")", ";", "map", ".", "put", "(", "key", ",", "value", ")", ";", "return", "new", "LogMetadata", "(", "map", ")", ";", "}" ]
Create a new metadata marker with a single key-value pair. @param key the key to add @param value the value to add for that key
[ "Create", "a", "new", "metadata", "marker", "with", "a", "single", "key", "-", "value", "pair", "." ]
train
https://github.com/opentable/otj-logging/blob/eaa74c877c4721ddb9af8eb7fe1612166f7ac14d/core/src/main/java/com/opentable/logging/LogMetadata.java#L46-L50
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/xml/xpath/XPathUtils.java
XPathUtils.evaluateAsString
public static String evaluateAsString(Node node, String xPathExpression, NamespaceContext nsContext) { """ Evaluate XPath expression with result type String. @param node @param xPathExpression @param nsContext @return """ String result = (String) evaluateExpression(node, xPathExpression, nsContext, XPathConstants.STRING); if (!StringUtils.hasText(result)) { //result is empty so check if the expression node really exists //if node does not exist an exception is thrown evaluateAsNode(node, xPathExpression, nsContext); } return result; }
java
public static String evaluateAsString(Node node, String xPathExpression, NamespaceContext nsContext) { String result = (String) evaluateExpression(node, xPathExpression, nsContext, XPathConstants.STRING); if (!StringUtils.hasText(result)) { //result is empty so check if the expression node really exists //if node does not exist an exception is thrown evaluateAsNode(node, xPathExpression, nsContext); } return result; }
[ "public", "static", "String", "evaluateAsString", "(", "Node", "node", ",", "String", "xPathExpression", ",", "NamespaceContext", "nsContext", ")", "{", "String", "result", "=", "(", "String", ")", "evaluateExpression", "(", "node", ",", "xPathExpression", ",", "nsContext", ",", "XPathConstants", ".", "STRING", ")", ";", "if", "(", "!", "StringUtils", ".", "hasText", "(", "result", ")", ")", "{", "//result is empty so check if the expression node really exists", "//if node does not exist an exception is thrown", "evaluateAsNode", "(", "node", ",", "xPathExpression", ",", "nsContext", ")", ";", "}", "return", "result", ";", "}" ]
Evaluate XPath expression with result type String. @param node @param xPathExpression @param nsContext @return
[ "Evaluate", "XPath", "expression", "with", "result", "type", "String", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/xpath/XPathUtils.java#L215-L225