repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java
TypesafeConfigUtils.getDuration
public static Duration getDuration(Config config, String path) { """ Get a configuration as duration (parses special strings like "10s"). Return {@code null} if missing, wrong type or bad value. @param config @param path @return """ try { return config.getDuration(path); } catch (ConfigException.Missing | ConfigException.WrongType | ConfigException.BadValue e) { if (e instanceof ConfigException.WrongType || e instanceof ConfigException.BadValue) { LOGGER.warn(e.getMessage(), e); } return null; } }
java
public static Duration getDuration(Config config, String path) { try { return config.getDuration(path); } catch (ConfigException.Missing | ConfigException.WrongType | ConfigException.BadValue e) { if (e instanceof ConfigException.WrongType || e instanceof ConfigException.BadValue) { LOGGER.warn(e.getMessage(), e); } return null; } }
[ "public", "static", "Duration", "getDuration", "(", "Config", "config", ",", "String", "path", ")", "{", "try", "{", "return", "config", ".", "getDuration", "(", "path", ")", ";", "}", "catch", "(", "ConfigException", ".", "Missing", "|", "ConfigException", ".", "WrongType", "|", "ConfigException", ".", "BadValue", "e", ")", "{", "if", "(", "e", "instanceof", "ConfigException", ".", "WrongType", "||", "e", "instanceof", "ConfigException", ".", "BadValue", ")", "{", "LOGGER", ".", "warn", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "return", "null", ";", "}", "}" ]
Get a configuration as duration (parses special strings like "10s"). Return {@code null} if missing, wrong type or bad value. @param config @param path @return
[ "Get", "a", "configuration", "as", "duration", "(", "parses", "special", "strings", "like", "10s", ")", ".", "Return", "{", "@code", "null", "}", "if", "missing", "wrong", "type", "or", "bad", "value", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L635-L644
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java
PyExpressionGenerator._generate
@SuppressWarnings("static-method") protected XExpression _generate(XNullLiteral literal, IAppendable it, IExtraLanguageGeneratorContext context) { """ Generate the given object. @param literal the null literal. @param it the target for the generated content. @param context the context. @return the literal. """ appendReturnIfExpectedReturnedExpression(it, context); it.append("None"); //$NON-NLS-1$ return literal; }
java
@SuppressWarnings("static-method") protected XExpression _generate(XNullLiteral literal, IAppendable it, IExtraLanguageGeneratorContext context) { appendReturnIfExpectedReturnedExpression(it, context); it.append("None"); //$NON-NLS-1$ return literal; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "XExpression", "_generate", "(", "XNullLiteral", "literal", ",", "IAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "appendReturnIfExpectedReturnedExpression", "(", "it", ",", "context", ")", ";", "it", ".", "append", "(", "\"None\"", ")", ";", "//$NON-NLS-1$", "return", "literal", ";", "}" ]
Generate the given object. @param literal the null literal. @param it the target for the generated content. @param context the context. @return the literal.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L798-L803
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java
CacheOnDisk.readHashcodeByRange
public Result readHashcodeByRange(int index, int length, boolean debug, boolean useValue) { """ This method find the hashcode based on index and length. @param index If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous". @param length The max number of cache ids to be read. If length = -1, it reads all cache ids until the end. @param debug true to output id and its hashcode to systemout.log @param useValue true to calculate hashcode including value """ // LI4337-17 Result result = this.htod.readHashcodeByRange(index, length, debug, useValue); if (result.returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(result.diskException); } return result; }
java
public Result readHashcodeByRange(int index, int length, boolean debug, boolean useValue) { // LI4337-17 Result result = this.htod.readHashcodeByRange(index, length, debug, useValue); if (result.returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(result.diskException); } return result; }
[ "public", "Result", "readHashcodeByRange", "(", "int", "index", ",", "int", "length", ",", "boolean", "debug", ",", "boolean", "useValue", ")", "{", "// LI4337-17", "Result", "result", "=", "this", ".", "htod", ".", "readHashcodeByRange", "(", "index", ",", "length", ",", "debug", ",", "useValue", ")", ";", "if", "(", "result", ".", "returnCode", "==", "HTODDynacache", ".", "DISK_EXCEPTION", ")", "{", "stopOnError", "(", "result", ".", "diskException", ")", ";", "}", "return", "result", ";", "}" ]
This method find the hashcode based on index and length. @param index If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous". @param length The max number of cache ids to be read. If length = -1, it reads all cache ids until the end. @param debug true to output id and its hashcode to systemout.log @param useValue true to calculate hashcode including value
[ "This", "method", "find", "the", "hashcode", "based", "on", "index", "and", "length", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1731-L1737
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java
XMLConfigAdmin.updateCustomTag
public void updateCustomTag(String virtual, String physical, String archive, String primary, short inspect) throws ExpressionException, SecurityException { """ insert or update a mapping for Custom Tag @param virtual @param physical @param archive @param primary @param trusted @throws ExpressionException @throws SecurityException """ checkWriteAccess(); _updateCustomTag(virtual, physical, archive, primary, inspect); }
java
public void updateCustomTag(String virtual, String physical, String archive, String primary, short inspect) throws ExpressionException, SecurityException { checkWriteAccess(); _updateCustomTag(virtual, physical, archive, primary, inspect); }
[ "public", "void", "updateCustomTag", "(", "String", "virtual", ",", "String", "physical", ",", "String", "archive", ",", "String", "primary", ",", "short", "inspect", ")", "throws", "ExpressionException", ",", "SecurityException", "{", "checkWriteAccess", "(", ")", ";", "_updateCustomTag", "(", "virtual", ",", "physical", ",", "archive", ",", "primary", ",", "inspect", ")", ";", "}" ]
insert or update a mapping for Custom Tag @param virtual @param physical @param archive @param primary @param trusted @throws ExpressionException @throws SecurityException
[ "insert", "or", "update", "a", "mapping", "for", "Custom", "Tag" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java#L867-L870
jamesagnew/hapi-fhir
hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/interceptor/AdditionalRequestHeadersInterceptor.java
AdditionalRequestHeadersInterceptor.addHeaderValue
public void addHeaderValue(String headerName, String headerValue) { """ Adds the given header value. Note that {@code headerName} and {@code headerValue} cannot be null. @param headerName the name of the header @param headerValue the value to add for the header @throws NullPointerException if either parameter is {@code null} """ Objects.requireNonNull(headerName, "headerName cannot be null"); Objects.requireNonNull(headerValue, "headerValue cannot be null"); getHeaderValues(headerName).add(headerValue); }
java
public void addHeaderValue(String headerName, String headerValue) { Objects.requireNonNull(headerName, "headerName cannot be null"); Objects.requireNonNull(headerValue, "headerValue cannot be null"); getHeaderValues(headerName).add(headerValue); }
[ "public", "void", "addHeaderValue", "(", "String", "headerName", ",", "String", "headerValue", ")", "{", "Objects", ".", "requireNonNull", "(", "headerName", ",", "\"headerName cannot be null\"", ")", ";", "Objects", ".", "requireNonNull", "(", "headerValue", ",", "\"headerValue cannot be null\"", ")", ";", "getHeaderValues", "(", "headerName", ")", ".", "add", "(", "headerValue", ")", ";", "}" ]
Adds the given header value. Note that {@code headerName} and {@code headerValue} cannot be null. @param headerName the name of the header @param headerValue the value to add for the header @throws NullPointerException if either parameter is {@code null}
[ "Adds", "the", "given", "header", "value", ".", "Note", "that", "{" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/interceptor/AdditionalRequestHeadersInterceptor.java#L58-L63
googleads/googleads-java-lib
modules/ads_lib_appengine/src/main/java/com/google/api/ads/common/lib/soap/jaxws/JaxWsHandler.java
JaxWsHandler.setEndpointAddress
@Override public void setEndpointAddress(BindingProvider soapClient, String endpointAddress) { """ Sets the endpoint address of the given SOAP client. @param soapClient the SOAP client to set the endpoint address for @param endpointAddress the target endpoint address """ soapClient.getRequestContext().put( BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress); }
java
@Override public void setEndpointAddress(BindingProvider soapClient, String endpointAddress) { soapClient.getRequestContext().put( BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress); }
[ "@", "Override", "public", "void", "setEndpointAddress", "(", "BindingProvider", "soapClient", ",", "String", "endpointAddress", ")", "{", "soapClient", ".", "getRequestContext", "(", ")", ".", "put", "(", "BindingProvider", ".", "ENDPOINT_ADDRESS_PROPERTY", ",", "endpointAddress", ")", ";", "}" ]
Sets the endpoint address of the given SOAP client. @param soapClient the SOAP client to set the endpoint address for @param endpointAddress the target endpoint address
[ "Sets", "the", "endpoint", "address", "of", "the", "given", "SOAP", "client", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib_appengine/src/main/java/com/google/api/ads/common/lib/soap/jaxws/JaxWsHandler.java#L72-L76
apache/incubator-heron
heron/schedulers/src/java/org/apache/heron/scheduler/aurora/AuroraCLIController.java
AuroraCLIController.appendAuroraCommandOptions
private static void appendAuroraCommandOptions(List<String> auroraCmd, boolean isVerbose) { """ Static method to append verbose and batching options if needed """ // Append verbose if needed if (isVerbose) { auroraCmd.add("--verbose"); } // Append batch size. // Note that we can not use "--no-batching" since "restart" command does not accept it. // So we play a small trick here by setting batch size Integer.MAX_VALUE. auroraCmd.add("--batch-size"); auroraCmd.add(Integer.toString(Integer.MAX_VALUE)); }
java
private static void appendAuroraCommandOptions(List<String> auroraCmd, boolean isVerbose) { // Append verbose if needed if (isVerbose) { auroraCmd.add("--verbose"); } // Append batch size. // Note that we can not use "--no-batching" since "restart" command does not accept it. // So we play a small trick here by setting batch size Integer.MAX_VALUE. auroraCmd.add("--batch-size"); auroraCmd.add(Integer.toString(Integer.MAX_VALUE)); }
[ "private", "static", "void", "appendAuroraCommandOptions", "(", "List", "<", "String", ">", "auroraCmd", ",", "boolean", "isVerbose", ")", "{", "// Append verbose if needed", "if", "(", "isVerbose", ")", "{", "auroraCmd", ".", "add", "(", "\"--verbose\"", ")", ";", "}", "// Append batch size.", "// Note that we can not use \"--no-batching\" since \"restart\" command does not accept it.", "// So we play a small trick here by setting batch size Integer.MAX_VALUE.", "auroraCmd", ".", "add", "(", "\"--batch-size\"", ")", ";", "auroraCmd", ".", "add", "(", "Integer", ".", "toString", "(", "Integer", ".", "MAX_VALUE", ")", ")", ";", "}" ]
Static method to append verbose and batching options if needed
[ "Static", "method", "to", "append", "verbose", "and", "batching", "options", "if", "needed" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/aurora/AuroraCLIController.java#L202-L213
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.acceptSessionFromConnectionStringBuilderAsync
public static CompletableFuture<IMessageSession> acceptSessionFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId) { """ Accept a {@link IMessageSession} in default {@link ReceiveMode#PEEKLOCK} mode asynchronously from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session. @param amqpConnectionStringBuilder the connection string builder @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session @return a CompletableFuture representing the pending session accepting """ return acceptSessionFromConnectionStringBuilderAsync(amqpConnectionStringBuilder, sessionId, DEFAULTRECEIVEMODE); }
java
public static CompletableFuture<IMessageSession> acceptSessionFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId) { return acceptSessionFromConnectionStringBuilderAsync(amqpConnectionStringBuilder, sessionId, DEFAULTRECEIVEMODE); }
[ "public", "static", "CompletableFuture", "<", "IMessageSession", ">", "acceptSessionFromConnectionStringBuilderAsync", "(", "ConnectionStringBuilder", "amqpConnectionStringBuilder", ",", "String", "sessionId", ")", "{", "return", "acceptSessionFromConnectionStringBuilderAsync", "(", "amqpConnectionStringBuilder", ",", "sessionId", ",", "DEFAULTRECEIVEMODE", ")", ";", "}" ]
Accept a {@link IMessageSession} in default {@link ReceiveMode#PEEKLOCK} mode asynchronously from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session. @param amqpConnectionStringBuilder the connection string builder @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session @return a CompletableFuture representing the pending session accepting
[ "Accept", "a", "{", "@link", "IMessageSession", "}", "in", "default", "{", "@link", "ReceiveMode#PEEKLOCK", "}", "mode", "asynchronously", "from", "service", "bus", "connection", "string", "builder", "with", "specified", "session", "id", ".", "Session", "Id", "can", "be", "null", "if", "null", "service", "will", "return", "the", "first", "available", "session", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L646-L648
landawn/AbacusUtil
src/com/landawn/abacus/util/Sheet.java
Sheet.moveColumn
public void moveColumn(Object columnKey, int newColumnIndex) { """ Move the specified column to the new position. @param columnKey @param newColumnIndex """ checkFrozen(); this.checkColumnIndex(newColumnIndex); final int columnIndex = this.getColumnIndex(columnKey); final List<C> tmp = new ArrayList<>(columnLength()); tmp.addAll(_columnKeySet); tmp.add(newColumnIndex, tmp.remove(columnIndex)); _columnKeySet.clear(); _columnKeySet.addAll(tmp); _columnKeyIndexMap = null; if (_initialized && _columnList.size() > 0) { _columnList.add(newColumnIndex, _columnList.remove(columnIndex)); } }
java
public void moveColumn(Object columnKey, int newColumnIndex) { checkFrozen(); this.checkColumnIndex(newColumnIndex); final int columnIndex = this.getColumnIndex(columnKey); final List<C> tmp = new ArrayList<>(columnLength()); tmp.addAll(_columnKeySet); tmp.add(newColumnIndex, tmp.remove(columnIndex)); _columnKeySet.clear(); _columnKeySet.addAll(tmp); _columnKeyIndexMap = null; if (_initialized && _columnList.size() > 0) { _columnList.add(newColumnIndex, _columnList.remove(columnIndex)); } }
[ "public", "void", "moveColumn", "(", "Object", "columnKey", ",", "int", "newColumnIndex", ")", "{", "checkFrozen", "(", ")", ";", "this", ".", "checkColumnIndex", "(", "newColumnIndex", ")", ";", "final", "int", "columnIndex", "=", "this", ".", "getColumnIndex", "(", "columnKey", ")", ";", "final", "List", "<", "C", ">", "tmp", "=", "new", "ArrayList", "<>", "(", "columnLength", "(", ")", ")", ";", "tmp", ".", "addAll", "(", "_columnKeySet", ")", ";", "tmp", ".", "add", "(", "newColumnIndex", ",", "tmp", ".", "remove", "(", "columnIndex", ")", ")", ";", "_columnKeySet", ".", "clear", "(", ")", ";", "_columnKeySet", ".", "addAll", "(", "tmp", ")", ";", "_columnKeyIndexMap", "=", "null", ";", "if", "(", "_initialized", "&&", "_columnList", ".", "size", "(", ")", ">", "0", ")", "{", "_columnList", ".", "add", "(", "newColumnIndex", ",", "_columnList", ".", "remove", "(", "columnIndex", ")", ")", ";", "}", "}" ]
Move the specified column to the new position. @param columnKey @param newColumnIndex
[ "Move", "the", "specified", "column", "to", "the", "new", "position", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Sheet.java#L823-L841
LearnLib/automatalib
util/src/main/java/net/automatalib/util/minimizer/State.java
State.addToSignature
public boolean addToSignature(TransitionLabel<S, L> letter) { """ Adds a transition label (letter) to this state's signature. @param letter the letter to add. @return <code>true</code> iff this was the first letter to be added to the signature, <code>false</code> otherwise. """ boolean first = signature.isEmpty(); signature.add(letter); return first; }
java
public boolean addToSignature(TransitionLabel<S, L> letter) { boolean first = signature.isEmpty(); signature.add(letter); return first; }
[ "public", "boolean", "addToSignature", "(", "TransitionLabel", "<", "S", ",", "L", ">", "letter", ")", "{", "boolean", "first", "=", "signature", ".", "isEmpty", "(", ")", ";", "signature", ".", "add", "(", "letter", ")", ";", "return", "first", ";", "}" ]
Adds a transition label (letter) to this state's signature. @param letter the letter to add. @return <code>true</code> iff this was the first letter to be added to the signature, <code>false</code> otherwise.
[ "Adds", "a", "transition", "label", "(", "letter", ")", "to", "this", "state", "s", "signature", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/minimizer/State.java#L188-L192
elki-project/elki
elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/minkowski/LPIntegerNormDistanceFunction.java
LPIntegerNormDistanceFunction.preDistance
private double preDistance(NumberVector v1, NumberVector v2, final int start, final int end) { """ Compute unscaled distance in a range of dimensions. @param v1 First object @param v2 Second object @param start First dimension @param end Exclusive last dimension @return Aggregated values. """ double agg = 0.; for(int d = start; d < end; d++) { final double xd = v1.doubleValue(d), yd = v2.doubleValue(d); final double delta = xd >= yd ? xd - yd : yd - xd; agg += MathUtil.powi(delta, intp); } return agg; }
java
private double preDistance(NumberVector v1, NumberVector v2, final int start, final int end) { double agg = 0.; for(int d = start; d < end; d++) { final double xd = v1.doubleValue(d), yd = v2.doubleValue(d); final double delta = xd >= yd ? xd - yd : yd - xd; agg += MathUtil.powi(delta, intp); } return agg; }
[ "private", "double", "preDistance", "(", "NumberVector", "v1", ",", "NumberVector", "v2", ",", "final", "int", "start", ",", "final", "int", "end", ")", "{", "double", "agg", "=", "0.", ";", "for", "(", "int", "d", "=", "start", ";", "d", "<", "end", ";", "d", "++", ")", "{", "final", "double", "xd", "=", "v1", ".", "doubleValue", "(", "d", ")", ",", "yd", "=", "v2", ".", "doubleValue", "(", "d", ")", ";", "final", "double", "delta", "=", "xd", ">=", "yd", "?", "xd", "-", "yd", ":", "yd", "-", "xd", ";", "agg", "+=", "MathUtil", ".", "powi", "(", "delta", ",", "intp", ")", ";", "}", "return", "agg", ";", "}" ]
Compute unscaled distance in a range of dimensions. @param v1 First object @param v2 Second object @param start First dimension @param end Exclusive last dimension @return Aggregated values.
[ "Compute", "unscaled", "distance", "in", "a", "range", "of", "dimensions", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/minkowski/LPIntegerNormDistanceFunction.java#L74-L82
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/spi/MoneyUtils.java
MoneyUtils.getBigDecimal
public static BigDecimal getBigDecimal(Number num, MonetaryContext moneyContext) { """ Creates a {@link BigDecimal} from the given {@link Number} doing the valid conversion depending the type given, if a {@link MonetaryContext} is given, it is applied to the number returned. @param num the number type @return the corresponding {@link BigDecimal} """ BigDecimal bd = getBigDecimal(num); if (moneyContext!=null) { MathContext mc = getMathContext(moneyContext, RoundingMode.HALF_EVEN); bd = new BigDecimal(bd.toString(), mc); if (moneyContext.getMaxScale() > 0) { LOG.fine(String.format("Got Max Scale %s", moneyContext.getMaxScale())); bd = bd.setScale(moneyContext.getMaxScale(), mc.getRoundingMode()); } } return bd; }
java
public static BigDecimal getBigDecimal(Number num, MonetaryContext moneyContext) { BigDecimal bd = getBigDecimal(num); if (moneyContext!=null) { MathContext mc = getMathContext(moneyContext, RoundingMode.HALF_EVEN); bd = new BigDecimal(bd.toString(), mc); if (moneyContext.getMaxScale() > 0) { LOG.fine(String.format("Got Max Scale %s", moneyContext.getMaxScale())); bd = bd.setScale(moneyContext.getMaxScale(), mc.getRoundingMode()); } } return bd; }
[ "public", "static", "BigDecimal", "getBigDecimal", "(", "Number", "num", ",", "MonetaryContext", "moneyContext", ")", "{", "BigDecimal", "bd", "=", "getBigDecimal", "(", "num", ")", ";", "if", "(", "moneyContext", "!=", "null", ")", "{", "MathContext", "mc", "=", "getMathContext", "(", "moneyContext", ",", "RoundingMode", ".", "HALF_EVEN", ")", ";", "bd", "=", "new", "BigDecimal", "(", "bd", ".", "toString", "(", ")", ",", "mc", ")", ";", "if", "(", "moneyContext", ".", "getMaxScale", "(", ")", ">", "0", ")", "{", "LOG", ".", "fine", "(", "String", ".", "format", "(", "\"Got Max Scale %s\"", ",", "moneyContext", ".", "getMaxScale", "(", ")", ")", ")", ";", "bd", "=", "bd", ".", "setScale", "(", "moneyContext", ".", "getMaxScale", "(", ")", ",", "mc", ".", "getRoundingMode", "(", ")", ")", ";", "}", "}", "return", "bd", ";", "}" ]
Creates a {@link BigDecimal} from the given {@link Number} doing the valid conversion depending the type given, if a {@link MonetaryContext} is given, it is applied to the number returned. @param num the number type @return the corresponding {@link BigDecimal}
[ "Creates", "a", "{", "@link", "BigDecimal", "}", "from", "the", "given", "{", "@link", "Number", "}", "doing", "the", "valid", "conversion", "depending", "the", "type", "given", "if", "a", "{", "@link", "MonetaryContext", "}", "is", "given", "it", "is", "applied", "to", "the", "number", "returned", "." ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/MoneyUtils.java#L96-L107
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java
StaxUtils.getUniquePrefix
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException { """ Create a unique namespace uri/prefix combination. @return The namespace with the specified URI. If one doesn't exist, one is created. @throws XMLStreamException """ String prefix = writer.getPrefix(namespaceURI); if (prefix == null) { prefix = getUniquePrefix(writer); if (declare) { writer.setPrefix(prefix, namespaceURI); writer.writeNamespace(prefix, namespaceURI); } } return prefix; }
java
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException { String prefix = writer.getPrefix(namespaceURI); if (prefix == null) { prefix = getUniquePrefix(writer); if (declare) { writer.setPrefix(prefix, namespaceURI); writer.writeNamespace(prefix, namespaceURI); } } return prefix; }
[ "public", "static", "String", "getUniquePrefix", "(", "XMLStreamWriter", "writer", ",", "String", "namespaceURI", ",", "boolean", "declare", ")", "throws", "XMLStreamException", "{", "String", "prefix", "=", "writer", ".", "getPrefix", "(", "namespaceURI", ")", ";", "if", "(", "prefix", "==", "null", ")", "{", "prefix", "=", "getUniquePrefix", "(", "writer", ")", ";", "if", "(", "declare", ")", "{", "writer", ".", "setPrefix", "(", "prefix", ",", "namespaceURI", ")", ";", "writer", ".", "writeNamespace", "(", "prefix", ",", "namespaceURI", ")", ";", "}", "}", "return", "prefix", ";", "}" ]
Create a unique namespace uri/prefix combination. @return The namespace with the specified URI. If one doesn't exist, one is created. @throws XMLStreamException
[ "Create", "a", "unique", "namespace", "uri", "/", "prefix", "combination", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java#L1886-L1898
jalkanen/speed4j
src/main/java/com/ecyrd/speed4j/util/Percentile.java
Percentile.evaluate
public double evaluate(final double[] values, final double p) { """ Returns an estimate of the <code>p</code>th percentile of the values in the <code>values</code> array. <p> Calls to this method do not modify the internal <code>quantile</code> state of this statistic. <p> <ul> <li>Returns <code>Double.NaN</code> if <code>values</code> has length <code>0</code></li> <li>Returns (for any value of <code>p</code>) <code>values[0]</code> if <code>values</code> has length <code>1</code></li> <li>Throws <code>IllegalArgumentException</code> if <code>values</code> is null </li> </ul> <p> See {@link Percentile} for a description of the percentile estimation algorithm used. @param values input array of values @param p the percentile value to compute @return the result of the evaluation or Double.NaN if the array is empty @throws IllegalArgumentException if <code>values</code> is null """ test(values, 0, 0); return evaluate(values, 0, values.length, p); }
java
public double evaluate(final double[] values, final double p) { test(values, 0, 0); return evaluate(values, 0, values.length, p); }
[ "public", "double", "evaluate", "(", "final", "double", "[", "]", "values", ",", "final", "double", "p", ")", "{", "test", "(", "values", ",", "0", ",", "0", ")", ";", "return", "evaluate", "(", "values", ",", "0", ",", "values", ".", "length", ",", "p", ")", ";", "}" ]
Returns an estimate of the <code>p</code>th percentile of the values in the <code>values</code> array. <p> Calls to this method do not modify the internal <code>quantile</code> state of this statistic. <p> <ul> <li>Returns <code>Double.NaN</code> if <code>values</code> has length <code>0</code></li> <li>Returns (for any value of <code>p</code>) <code>values[0]</code> if <code>values</code> has length <code>1</code></li> <li>Throws <code>IllegalArgumentException</code> if <code>values</code> is null </li> </ul> <p> See {@link Percentile} for a description of the percentile estimation algorithm used. @param values input array of values @param p the percentile value to compute @return the result of the evaluation or Double.NaN if the array is empty @throws IllegalArgumentException if <code>values</code> is null
[ "Returns", "an", "estimate", "of", "the", "<code", ">", "p<", "/", "code", ">", "th", "percentile", "of", "the", "values", "in", "the", "<code", ">", "values<", "/", "code", ">", "array", ".", "<p", ">", "Calls", "to", "this", "method", "do", "not", "modify", "the", "internal", "<code", ">", "quantile<", "/", "code", ">", "state", "of", "this", "statistic", ".", "<p", ">", "<ul", ">", "<li", ">", "Returns", "<code", ">", "Double", ".", "NaN<", "/", "code", ">", "if", "<code", ">", "values<", "/", "code", ">", "has", "length", "<code", ">", "0<", "/", "code", ">", "<", "/", "li", ">", "<li", ">", "Returns", "(", "for", "any", "value", "of", "<code", ">", "p<", "/", "code", ">", ")", "<code", ">", "values", "[", "0", "]", "<", "/", "code", ">", "if", "<code", ">", "values<", "/", "code", ">", "has", "length", "<code", ">", "1<", "/", "code", ">", "<", "/", "li", ">", "<li", ">", "Throws", "<code", ">", "IllegalArgumentException<", "/", "code", ">", "if", "<code", ">", "values<", "/", "code", ">", "is", "null", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "See", "{", "@link", "Percentile", "}", "for", "a", "description", "of", "the", "percentile", "estimation", "algorithm", "used", "." ]
train
https://github.com/jalkanen/speed4j/blob/1d2db9c9b9def869c25fedb9bbd7cf95c39023bd/src/main/java/com/ecyrd/speed4j/util/Percentile.java#L127-L130
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.rnnSetPreviousStates
public void rnnSetPreviousStates(Map<String, Map<String, INDArray>> previousStates) { """ Set the states for all RNN layers, for use in {@link #rnnTimeStep(INDArray...)} @param previousStates The previous time step states for all layers (key: layer name. Value: layer states) @see #rnnGetPreviousStates() """ for (Map.Entry<String, Map<String, INDArray>> entry : previousStates.entrySet()) { rnnSetPreviousState(entry.getKey(), entry.getValue()); } }
java
public void rnnSetPreviousStates(Map<String, Map<String, INDArray>> previousStates) { for (Map.Entry<String, Map<String, INDArray>> entry : previousStates.entrySet()) { rnnSetPreviousState(entry.getKey(), entry.getValue()); } }
[ "public", "void", "rnnSetPreviousStates", "(", "Map", "<", "String", ",", "Map", "<", "String", ",", "INDArray", ">", ">", "previousStates", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Map", "<", "String", ",", "INDArray", ">", ">", "entry", ":", "previousStates", ".", "entrySet", "(", ")", ")", "{", "rnnSetPreviousState", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Set the states for all RNN layers, for use in {@link #rnnTimeStep(INDArray...)} @param previousStates The previous time step states for all layers (key: layer name. Value: layer states) @see #rnnGetPreviousStates()
[ "Set", "the", "states", "for", "all", "RNN", "layers", "for", "use", "in", "{", "@link", "#rnnTimeStep", "(", "INDArray", "...", ")", "}" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3533-L3537
googleapis/google-cloud-java
google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java
BlobInfo.newBuilder
public static Builder newBuilder(BucketInfo bucketInfo, String name) { """ Returns a {@code BlobInfo} builder where blob identity is set using the provided values. """ return newBuilder(bucketInfo.getName(), name); }
java
public static Builder newBuilder(BucketInfo bucketInfo, String name) { return newBuilder(bucketInfo.getName(), name); }
[ "public", "static", "Builder", "newBuilder", "(", "BucketInfo", "bucketInfo", ",", "String", "name", ")", "{", "return", "newBuilder", "(", "bucketInfo", ".", "getName", "(", ")", ",", "name", ")", ";", "}" ]
Returns a {@code BlobInfo} builder where blob identity is set using the provided values.
[ "Returns", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java#L1004-L1006
groovy/gmaven
gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java
GroovyRuntimeImpl.createGroovyClassLoader
public GroovyClassLoader createGroovyClassLoader(final ClassLoader classLoader, final ResourceLoader resourceLoader) { """ Create a {@link GroovyClassLoader} from given {@link ClassLoader} and {@link ResourceLoader}. """ return AccessController.doPrivileged(new PrivilegedAction<GroovyClassLoader>() { @Override public GroovyClassLoader run() { GroovyClassLoader gcl = new GroovyClassLoader(classLoader); gcl.setResourceLoader(createGroovyResourceLoader(resourceLoader)); return gcl; } }); }
java
public GroovyClassLoader createGroovyClassLoader(final ClassLoader classLoader, final ResourceLoader resourceLoader) { return AccessController.doPrivileged(new PrivilegedAction<GroovyClassLoader>() { @Override public GroovyClassLoader run() { GroovyClassLoader gcl = new GroovyClassLoader(classLoader); gcl.setResourceLoader(createGroovyResourceLoader(resourceLoader)); return gcl; } }); }
[ "public", "GroovyClassLoader", "createGroovyClassLoader", "(", "final", "ClassLoader", "classLoader", ",", "final", "ResourceLoader", "resourceLoader", ")", "{", "return", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "GroovyClassLoader", ">", "(", ")", "{", "@", "Override", "public", "GroovyClassLoader", "run", "(", ")", "{", "GroovyClassLoader", "gcl", "=", "new", "GroovyClassLoader", "(", "classLoader", ")", ";", "gcl", ".", "setResourceLoader", "(", "createGroovyResourceLoader", "(", "resourceLoader", ")", ")", ";", "return", "gcl", ";", "}", "}", ")", ";", "}" ]
Create a {@link GroovyClassLoader} from given {@link ClassLoader} and {@link ResourceLoader}.
[ "Create", "a", "{" ]
train
https://github.com/groovy/gmaven/blob/6978316bbc29d9cc6793494e0d1a0a057e47de6c/gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java#L85-L95
alibaba/Tangram-Android
tangram/src/main/java/com/tmall/wireless/tangram/util/ImageUtils.java
ImageUtils.doLoadImageUrl
public static <IMAGE extends ImageView> void doLoadImageUrl(@NonNull IMAGE view, @Nullable String url) { """ load image using {@link IInnerImageSetter} @param view the imageView instance @param url image url @param <IMAGE> ImageView class type """ Preconditions.checkState(sImageSetter != null, "ImageSetter must be initialized before calling image load"); sImageSetter.doLoadImageUrl(view, url); }
java
public static <IMAGE extends ImageView> void doLoadImageUrl(@NonNull IMAGE view, @Nullable String url) { Preconditions.checkState(sImageSetter != null, "ImageSetter must be initialized before calling image load"); sImageSetter.doLoadImageUrl(view, url); }
[ "public", "static", "<", "IMAGE", "extends", "ImageView", ">", "void", "doLoadImageUrl", "(", "@", "NonNull", "IMAGE", "view", ",", "@", "Nullable", "String", "url", ")", "{", "Preconditions", ".", "checkState", "(", "sImageSetter", "!=", "null", ",", "\"ImageSetter must be initialized before calling image load\"", ")", ";", "sImageSetter", ".", "doLoadImageUrl", "(", "view", ",", "url", ")", ";", "}" ]
load image using {@link IInnerImageSetter} @param view the imageView instance @param url image url @param <IMAGE> ImageView class type
[ "load", "image", "using", "{" ]
train
https://github.com/alibaba/Tangram-Android/blob/caa57f54e009c8dacd34a2322d5761956ebed321/tangram/src/main/java/com/tmall/wireless/tangram/util/ImageUtils.java#L91-L94
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java
Disk.createSnapshot
public Operation createSnapshot(String snapshot, OperationOption... options) { """ Creates a snapshot for this disk given the snapshot's name. @return a zone operation for snapshot creation @throws ComputeException upon failure """ return compute.create(SnapshotInfo.of(SnapshotId.of(snapshot), getDiskId()), options); }
java
public Operation createSnapshot(String snapshot, OperationOption... options) { return compute.create(SnapshotInfo.of(SnapshotId.of(snapshot), getDiskId()), options); }
[ "public", "Operation", "createSnapshot", "(", "String", "snapshot", ",", "OperationOption", "...", "options", ")", "{", "return", "compute", ".", "create", "(", "SnapshotInfo", ".", "of", "(", "SnapshotId", ".", "of", "(", "snapshot", ")", ",", "getDiskId", "(", ")", ")", ",", "options", ")", ";", "}" ]
Creates a snapshot for this disk given the snapshot's name. @return a zone operation for snapshot creation @throws ComputeException upon failure
[ "Creates", "a", "snapshot", "for", "this", "disk", "given", "the", "snapshot", "s", "name", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java#L169-L171
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFInt32.java
MFInt32.setValue
public void setValue(int size, int[] newValue) { """ Assign an array subset to this field. @param size - number of new values """ try { for (int i = 0; i < size; i++) { value.add(i, newValue[i]); //value.set( i, newValue ); } } catch (IndexOutOfBoundsException e) { Log.e(TAG, "X3D MFInt32 setValue(size,newValue[]) out of bounds." + e); } catch (Exception e) { Log.e(TAG, "X3D MFInt32 setValue(size, newValue[]) exception " + e); } }
java
public void setValue(int size, int[] newValue) { try { for (int i = 0; i < size; i++) { value.add(i, newValue[i]); //value.set( i, newValue ); } } catch (IndexOutOfBoundsException e) { Log.e(TAG, "X3D MFInt32 setValue(size,newValue[]) out of bounds." + e); } catch (Exception e) { Log.e(TAG, "X3D MFInt32 setValue(size, newValue[]) exception " + e); } }
[ "public", "void", "setValue", "(", "int", "size", ",", "int", "[", "]", "newValue", ")", "{", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "value", ".", "add", "(", "i", ",", "newValue", "[", "i", "]", ")", ";", "//value.set( i, newValue );", "}", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"X3D MFInt32 setValue(size,newValue[]) out of bounds.\"", "+", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"X3D MFInt32 setValue(size, newValue[]) exception \"", "+", "e", ")", ";", "}", "}" ]
Assign an array subset to this field. @param size - number of new values
[ "Assign", "an", "array", "subset", "to", "this", "field", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFInt32.java#L144-L157
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/NodeRepresentationService.java
NodeRepresentationService.getNodeRepresentation
public NodeRepresentation getNodeRepresentation(Node node, String mediaTypeHint) throws RepositoryException { """ Get NodeRepresentation for given node. String mediaTypeHint can be used as external information for representation. By default node will be represented as doc-view. @param node the jcr node. @param mediaTypeHint the mimetype hint or null if not known. @return the NodeRepresentation. @throws RepositoryException """ NodeRepresentationFactory factory = factory(node); if (factory != null) return factory.createNodeRepresentation(node, mediaTypeHint); else return new DocumentViewNodeRepresentation(node); }
java
public NodeRepresentation getNodeRepresentation(Node node, String mediaTypeHint) throws RepositoryException { NodeRepresentationFactory factory = factory(node); if (factory != null) return factory.createNodeRepresentation(node, mediaTypeHint); else return new DocumentViewNodeRepresentation(node); }
[ "public", "NodeRepresentation", "getNodeRepresentation", "(", "Node", "node", ",", "String", "mediaTypeHint", ")", "throws", "RepositoryException", "{", "NodeRepresentationFactory", "factory", "=", "factory", "(", "node", ")", ";", "if", "(", "factory", "!=", "null", ")", "return", "factory", ".", "createNodeRepresentation", "(", "node", ",", "mediaTypeHint", ")", ";", "else", "return", "new", "DocumentViewNodeRepresentation", "(", "node", ")", ";", "}" ]
Get NodeRepresentation for given node. String mediaTypeHint can be used as external information for representation. By default node will be represented as doc-view. @param node the jcr node. @param mediaTypeHint the mimetype hint or null if not known. @return the NodeRepresentation. @throws RepositoryException
[ "Get", "NodeRepresentation", "for", "given", "node", ".", "String", "mediaTypeHint", "can", "be", "used", "as", "external", "information", "for", "representation", ".", "By", "default", "node", "will", "be", "represented", "as", "doc", "-", "view", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/resource/NodeRepresentationService.java#L87-L95
Alexey1Gavrilov/ExpectIt
expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java
Matchers.eof
public static Matcher<Result> eof() { """ Creates a matcher that matches if input reaches the end of stream. <p/> If succeeded, the {@link net.sf.expectit.Result#getBefore()} will return the entire input buffer, and the {@link net.sf.expectit.Result#group()} returns an empty string. @return the matcher """ return new Matcher<Result>() { @Override public Result matches(String input, boolean isEof) { return isEof ? success(input, input, "") : failure(input, false); } @Override public String toString() { return "eof"; } }; }
java
public static Matcher<Result> eof() { return new Matcher<Result>() { @Override public Result matches(String input, boolean isEof) { return isEof ? success(input, input, "") : failure(input, false); } @Override public String toString() { return "eof"; } }; }
[ "public", "static", "Matcher", "<", "Result", ">", "eof", "(", ")", "{", "return", "new", "Matcher", "<", "Result", ">", "(", ")", "{", "@", "Override", "public", "Result", "matches", "(", "String", "input", ",", "boolean", "isEof", ")", "{", "return", "isEof", "?", "success", "(", "input", ",", "input", ",", "\"\"", ")", ":", "failure", "(", "input", ",", "false", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"eof\"", ";", "}", "}", ";", "}" ]
Creates a matcher that matches if input reaches the end of stream. <p/> If succeeded, the {@link net.sf.expectit.Result#getBefore()} will return the entire input buffer, and the {@link net.sf.expectit.Result#group()} returns an empty string. @return the matcher
[ "Creates", "a", "matcher", "that", "matches", "if", "input", "reaches", "the", "end", "of", "stream", ".", "<p", "/", ">", "If", "succeeded", "the", "{", "@link", "net", ".", "sf", ".", "expectit", ".", "Result#getBefore", "()", "}", "will", "return", "the", "entire", "input", "buffer", "and", "the", "{", "@link", "net", ".", "sf", ".", "expectit", ".", "Result#group", "()", "}", "returns", "an", "empty", "string", "." ]
train
https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java#L206-L218
walkmod/walkmod-core
src/main/java/org/walkmod/WalkModFacade.java
WalkModFacade.getConfiguration
public Configuration getConfiguration() throws Exception { """ Returns the equivalent configuration representation of the Walkmod config file. @return Configuration object representation of the config file. @throws Exception If the walkmod configuration file can't be read. """ Configuration result = null; if (cfg.exists()) { userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); manager.executeConfigurationProviders(); result = manager.getConfiguration(); } finally { System.setProperty("user.dir", userDir); } } return result; }
java
public Configuration getConfiguration() throws Exception { Configuration result = null; if (cfg.exists()) { userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); manager.executeConfigurationProviders(); result = manager.getConfiguration(); } finally { System.setProperty("user.dir", userDir); } } return result; }
[ "public", "Configuration", "getConfiguration", "(", ")", "throws", "Exception", "{", "Configuration", "result", "=", "null", ";", "if", "(", "cfg", ".", "exists", "(", ")", ")", "{", "userDir", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"user.dir\"", ")", ")", ".", "getAbsolutePath", "(", ")", ";", "System", ".", "setProperty", "(", "\"user.dir\"", ",", "options", ".", "getExecutionDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ";", "try", "{", "ConfigurationManager", "manager", "=", "new", "ConfigurationManager", "(", "cfg", ",", "false", ")", ";", "manager", ".", "executeConfigurationProviders", "(", ")", ";", "result", "=", "manager", ".", "getConfiguration", "(", ")", ";", "}", "finally", "{", "System", ".", "setProperty", "(", "\"user.dir\"", ",", "userDir", ")", ";", "}", "}", "return", "result", ";", "}" ]
Returns the equivalent configuration representation of the Walkmod config file. @return Configuration object representation of the config file. @throws Exception If the walkmod configuration file can't be read.
[ "Returns", "the", "equivalent", "configuration", "representation", "of", "the", "Walkmod", "config", "file", "." ]
train
https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L929-L944
ironjacamar/ironjacamar
validator/src/main/java/org/ironjacamar/validator/Validation.java
Validation.createResourceAdapter
private static List<Validate> createResourceAdapter(Connector cmd, List<Failure> failures, ResourceBundle rb, ClassLoader cl) { """ createResourceAdapter @param cmd connector metadata @param failures list of failures @param rb ResourceBundle @param cl classloador @return list of validate objects """ List<Validate> result = new ArrayList<Validate>(); if (cmd.getVersion() != Version.V_10 && cmd.getResourceadapter() != null && cmd.getResourceadapter().getResourceadapterClass() != null) { try { Class<?> clazz = Class.forName(cmd.getResourceadapter().getResourceadapterClass(), true, cl); List<ConfigProperty> configProperties = cmd.getResourceadapter().getConfigProperties(); ValidateClass vc = new ValidateClass(Key.RESOURCE_ADAPTER, clazz, configProperties); result.add(vc); } catch (ClassNotFoundException e) { Failure failure = new Failure(Severity.ERROR, rb.getString("uncategorized"), rb.getString("ra.cnfe"), e.getMessage()); failures.add(failure); } } return result; }
java
private static List<Validate> createResourceAdapter(Connector cmd, List<Failure> failures, ResourceBundle rb, ClassLoader cl) { List<Validate> result = new ArrayList<Validate>(); if (cmd.getVersion() != Version.V_10 && cmd.getResourceadapter() != null && cmd.getResourceadapter().getResourceadapterClass() != null) { try { Class<?> clazz = Class.forName(cmd.getResourceadapter().getResourceadapterClass(), true, cl); List<ConfigProperty> configProperties = cmd.getResourceadapter().getConfigProperties(); ValidateClass vc = new ValidateClass(Key.RESOURCE_ADAPTER, clazz, configProperties); result.add(vc); } catch (ClassNotFoundException e) { Failure failure = new Failure(Severity.ERROR, rb.getString("uncategorized"), rb.getString("ra.cnfe"), e.getMessage()); failures.add(failure); } } return result; }
[ "private", "static", "List", "<", "Validate", ">", "createResourceAdapter", "(", "Connector", "cmd", ",", "List", "<", "Failure", ">", "failures", ",", "ResourceBundle", "rb", ",", "ClassLoader", "cl", ")", "{", "List", "<", "Validate", ">", "result", "=", "new", "ArrayList", "<", "Validate", ">", "(", ")", ";", "if", "(", "cmd", ".", "getVersion", "(", ")", "!=", "Version", ".", "V_10", "&&", "cmd", ".", "getResourceadapter", "(", ")", "!=", "null", "&&", "cmd", ".", "getResourceadapter", "(", ")", ".", "getResourceadapterClass", "(", ")", "!=", "null", ")", "{", "try", "{", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "cmd", ".", "getResourceadapter", "(", ")", ".", "getResourceadapterClass", "(", ")", ",", "true", ",", "cl", ")", ";", "List", "<", "ConfigProperty", ">", "configProperties", "=", "cmd", ".", "getResourceadapter", "(", ")", ".", "getConfigProperties", "(", ")", ";", "ValidateClass", "vc", "=", "new", "ValidateClass", "(", "Key", ".", "RESOURCE_ADAPTER", ",", "clazz", ",", "configProperties", ")", ";", "result", ".", "add", "(", "vc", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "Failure", "failure", "=", "new", "Failure", "(", "Severity", ".", "ERROR", ",", "rb", ".", "getString", "(", "\"uncategorized\"", ")", ",", "rb", ".", "getString", "(", "\"ra.cnfe\"", ")", ",", "e", ".", "getMessage", "(", ")", ")", ";", "failures", ".", "add", "(", "failure", ")", ";", "}", "}", "return", "result", ";", "}" ]
createResourceAdapter @param cmd connector metadata @param failures list of failures @param rb ResourceBundle @param cl classloador @return list of validate objects
[ "createResourceAdapter" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/validator/src/main/java/org/ironjacamar/validator/Validation.java#L298-L325
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java
Utils.setStructuralFeature
public static void setStructuralFeature(EObject object, EStructuralFeature property, Object value) { """ Set the given structure feature with the given value. @param object the object that contains the feature. @param property the feature to change. @param value the value of the feature. """ assert object != null; assert property != null; if (value == null) { object.eUnset(property); } else { object.eSet(property, value); } }
java
public static void setStructuralFeature(EObject object, EStructuralFeature property, Object value) { assert object != null; assert property != null; if (value == null) { object.eUnset(property); } else { object.eSet(property, value); } }
[ "public", "static", "void", "setStructuralFeature", "(", "EObject", "object", ",", "EStructuralFeature", "property", ",", "Object", "value", ")", "{", "assert", "object", "!=", "null", ";", "assert", "property", "!=", "null", ";", "if", "(", "value", "==", "null", ")", "{", "object", ".", "eUnset", "(", "property", ")", ";", "}", "else", "{", "object", ".", "eSet", "(", "property", ",", "value", ")", ";", "}", "}" ]
Set the given structure feature with the given value. @param object the object that contains the feature. @param property the feature to change. @param value the value of the feature.
[ "Set", "the", "given", "structure", "feature", "with", "the", "given", "value", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L1696-L1704
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSubMenuRenderer.java
WSubMenuRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WSubMenu. @param component the WSubMenu to paint. @param renderContext the RenderContext to paint to. """ WSubMenu menu = (WSubMenu) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:submenu"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); if (isTree(menu)) { xml.appendAttribute("open", String.valueOf(isOpen(menu))); } xml.appendOptionalAttribute("disabled", menu.isDisabled(), "true"); xml.appendOptionalAttribute("hidden", menu.isHidden(), "true"); if (menu.isTopLevelMenu()) { xml.appendOptionalAttribute("accessKey", menu.getAccessKeyAsString()); } else { xml.appendAttribute("nested", "true"); } xml.appendOptionalAttribute("type", getMenuType(menu)); switch (menu.getMode()) { case CLIENT: xml.appendAttribute("mode", "client"); break; case LAZY: xml.appendAttribute("mode", "lazy"); break; case EAGER: xml.appendAttribute("mode", "eager"); break; case DYNAMIC: case SERVER: // mode server mapped to mode dynamic as per https://github.com/BorderTech/wcomponents/issues/687 xml.appendAttribute("mode", "dynamic"); break; default: throw new SystemException("Unknown menu mode: " + menu.getMode()); } xml.appendClose(); // Paint label menu.getDecoratedLabel().paint(renderContext); MenuMode mode = menu.getMode(); // Paint submenu items xml.appendTagOpen("ui:content"); xml.appendAttribute("id", component.getId() + "-content"); xml.appendClose(); // Render content if not EAGER Mode or is EAGER and is the current AJAX request if (mode != MenuMode.EAGER || AjaxHelper.isCurrentAjaxTrigger(menu)) { // Visibility of content set in prepare paint menu.paintMenuItems(renderContext); } xml.appendEndTag("ui:content"); xml.appendEndTag("ui:submenu"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WSubMenu menu = (WSubMenu) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:submenu"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); if (isTree(menu)) { xml.appendAttribute("open", String.valueOf(isOpen(menu))); } xml.appendOptionalAttribute("disabled", menu.isDisabled(), "true"); xml.appendOptionalAttribute("hidden", menu.isHidden(), "true"); if (menu.isTopLevelMenu()) { xml.appendOptionalAttribute("accessKey", menu.getAccessKeyAsString()); } else { xml.appendAttribute("nested", "true"); } xml.appendOptionalAttribute("type", getMenuType(menu)); switch (menu.getMode()) { case CLIENT: xml.appendAttribute("mode", "client"); break; case LAZY: xml.appendAttribute("mode", "lazy"); break; case EAGER: xml.appendAttribute("mode", "eager"); break; case DYNAMIC: case SERVER: // mode server mapped to mode dynamic as per https://github.com/BorderTech/wcomponents/issues/687 xml.appendAttribute("mode", "dynamic"); break; default: throw new SystemException("Unknown menu mode: " + menu.getMode()); } xml.appendClose(); // Paint label menu.getDecoratedLabel().paint(renderContext); MenuMode mode = menu.getMode(); // Paint submenu items xml.appendTagOpen("ui:content"); xml.appendAttribute("id", component.getId() + "-content"); xml.appendClose(); // Render content if not EAGER Mode or is EAGER and is the current AJAX request if (mode != MenuMode.EAGER || AjaxHelper.isCurrentAjaxTrigger(menu)) { // Visibility of content set in prepare paint menu.paintMenuItems(renderContext); } xml.appendEndTag("ui:content"); xml.appendEndTag("ui:submenu"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WSubMenu", "menu", "=", "(", "WSubMenu", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:submenu\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"class\"", ",", "component", ".", "getHtmlClass", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "if", "(", "isTree", "(", "menu", ")", ")", "{", "xml", ".", "appendAttribute", "(", "\"open\"", ",", "String", ".", "valueOf", "(", "isOpen", "(", "menu", ")", ")", ")", ";", "}", "xml", ".", "appendOptionalAttribute", "(", "\"disabled\"", ",", "menu", ".", "isDisabled", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hidden\"", ",", "menu", ".", "isHidden", "(", ")", ",", "\"true\"", ")", ";", "if", "(", "menu", ".", "isTopLevelMenu", "(", ")", ")", "{", "xml", ".", "appendOptionalAttribute", "(", "\"accessKey\"", ",", "menu", ".", "getAccessKeyAsString", "(", ")", ")", ";", "}", "else", "{", "xml", ".", "appendAttribute", "(", "\"nested\"", ",", "\"true\"", ")", ";", "}", "xml", ".", "appendOptionalAttribute", "(", "\"type\"", ",", "getMenuType", "(", "menu", ")", ")", ";", "switch", "(", "menu", ".", "getMode", "(", ")", ")", "{", "case", "CLIENT", ":", "xml", ".", "appendAttribute", "(", "\"mode\"", ",", "\"client\"", ")", ";", "break", ";", "case", "LAZY", ":", "xml", ".", "appendAttribute", "(", "\"mode\"", ",", "\"lazy\"", ")", ";", "break", ";", "case", "EAGER", ":", "xml", ".", "appendAttribute", "(", "\"mode\"", ",", "\"eager\"", ")", ";", "break", ";", "case", "DYNAMIC", ":", "case", "SERVER", ":", "// mode server mapped to mode dynamic as per https://github.com/BorderTech/wcomponents/issues/687", "xml", ".", "appendAttribute", "(", "\"mode\"", ",", "\"dynamic\"", ")", ";", "break", ";", "default", ":", "throw", "new", "SystemException", "(", "\"Unknown menu mode: \"", "+", "menu", ".", "getMode", "(", ")", ")", ";", "}", "xml", ".", "appendClose", "(", ")", ";", "// Paint label", "menu", ".", "getDecoratedLabel", "(", ")", ".", "paint", "(", "renderContext", ")", ";", "MenuMode", "mode", "=", "menu", ".", "getMode", "(", ")", ";", "// Paint submenu items", "xml", ".", "appendTagOpen", "(", "\"ui:content\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", "+", "\"-content\"", ")", ";", "xml", ".", "appendClose", "(", ")", ";", "// Render content if not EAGER Mode or is EAGER and is the current AJAX request", "if", "(", "mode", "!=", "MenuMode", ".", "EAGER", "||", "AjaxHelper", ".", "isCurrentAjaxTrigger", "(", "menu", ")", ")", "{", "// Visibility of content set in prepare paint", "menu", ".", "paintMenuItems", "(", "renderContext", ")", ";", "}", "xml", ".", "appendEndTag", "(", "\"ui:content\"", ")", ";", "xml", ".", "appendEndTag", "(", "\"ui:submenu\"", ")", ";", "}" ]
Paints the given WSubMenu. @param component the WSubMenu to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WSubMenu", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSubMenuRenderer.java#L70-L131
hawkular/hawkular-apm
client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java
OpenTracingManager.startSpanWithContext
public void startSpanWithContext(SpanBuilder spanBuilder, SpanContext context, String id) { """ This is a convenience method for situations where we don't know if a parent span is available. If we try to add a childOf relationship to a null context, it would cause a null pointer exception. The optional id is associated with the started span. @param spanBuilder The span builder @param context The span context @param id The optional id to associate with the span """ if (context != null) { spanBuilder.asChildOf(context); } doStartSpan(spanBuilder, id); }
java
public void startSpanWithContext(SpanBuilder spanBuilder, SpanContext context, String id) { if (context != null) { spanBuilder.asChildOf(context); } doStartSpan(spanBuilder, id); }
[ "public", "void", "startSpanWithContext", "(", "SpanBuilder", "spanBuilder", ",", "SpanContext", "context", ",", "String", "id", ")", "{", "if", "(", "context", "!=", "null", ")", "{", "spanBuilder", ".", "asChildOf", "(", "context", ")", ";", "}", "doStartSpan", "(", "spanBuilder", ",", "id", ")", ";", "}" ]
This is a convenience method for situations where we don't know if a parent span is available. If we try to add a childOf relationship to a null context, it would cause a null pointer exception. The optional id is associated with the started span. @param spanBuilder The span builder @param context The span context @param id The optional id to associate with the span
[ "This", "is", "a", "convenience", "method", "for", "situations", "where", "we", "don", "t", "know", "if", "a", "parent", "span", "is", "available", ".", "If", "we", "try", "to", "add", "a", "childOf", "relationship", "to", "a", "null", "context", "it", "would", "cause", "a", "null", "pointer", "exception", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java#L169-L175
michael-rapp/AndroidMaterialPreferences
library/src/main/java/de/mrapp/android/preference/DigitPickerPreference.java
DigitPickerPreference.getDigit
private int getDigit(final int index, final int number) { """ Returns the the digit, which corresponds to a specific index of a number. @param index The index of the digit, which should be retrieved, as an {@link Integer} value @param number The number, which contains the digit, which should be retrieved, as an {@link Integer} value @return The digit, which corresponds to the given index, as an {@link Integer} value """ String format = "%0" + getNumberOfDigits() + "d"; String formattedNumber = String.format(Locale.getDefault(), format, number); String digit = formattedNumber.substring(index, index + 1); return Integer.valueOf(digit); }
java
private int getDigit(final int index, final int number) { String format = "%0" + getNumberOfDigits() + "d"; String formattedNumber = String.format(Locale.getDefault(), format, number); String digit = formattedNumber.substring(index, index + 1); return Integer.valueOf(digit); }
[ "private", "int", "getDigit", "(", "final", "int", "index", ",", "final", "int", "number", ")", "{", "String", "format", "=", "\"%0\"", "+", "getNumberOfDigits", "(", ")", "+", "\"d\"", ";", "String", "formattedNumber", "=", "String", ".", "format", "(", "Locale", ".", "getDefault", "(", ")", ",", "format", ",", "number", ")", ";", "String", "digit", "=", "formattedNumber", ".", "substring", "(", "index", ",", "index", "+", "1", ")", ";", "return", "Integer", ".", "valueOf", "(", "digit", ")", ";", "}" ]
Returns the the digit, which corresponds to a specific index of a number. @param index The index of the digit, which should be retrieved, as an {@link Integer} value @param number The number, which contains the digit, which should be retrieved, as an {@link Integer} value @return The digit, which corresponds to the given index, as an {@link Integer} value
[ "Returns", "the", "the", "digit", "which", "corresponds", "to", "a", "specific", "index", "of", "a", "number", "." ]
train
https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/library/src/main/java/de/mrapp/android/preference/DigitPickerPreference.java#L219-L224
xvik/guice-persist-orient
src/main/java/ru/vyarus/guice/persist/orient/repository/command/core/AbstractCommandExtension.java
AbstractCommandExtension.analyzeParameters
protected void analyzeParameters(final T descriptor, final DescriptorContext context) { """ Analyze method parameters, search for extensions and prepare parameters context. @param descriptor repository method descriptor @param context repository method context """ final CommandParamsContext paramsContext = new CommandParamsContext(context); spiService.process(descriptor, paramsContext); }
java
protected void analyzeParameters(final T descriptor, final DescriptorContext context) { final CommandParamsContext paramsContext = new CommandParamsContext(context); spiService.process(descriptor, paramsContext); }
[ "protected", "void", "analyzeParameters", "(", "final", "T", "descriptor", ",", "final", "DescriptorContext", "context", ")", "{", "final", "CommandParamsContext", "paramsContext", "=", "new", "CommandParamsContext", "(", "context", ")", ";", "spiService", ".", "process", "(", "descriptor", ",", "paramsContext", ")", ";", "}" ]
Analyze method parameters, search for extensions and prepare parameters context. @param descriptor repository method descriptor @param context repository method context
[ "Analyze", "method", "parameters", "search", "for", "extensions", "and", "prepare", "parameters", "context", "." ]
train
https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/command/core/AbstractCommandExtension.java#L60-L63
aws/aws-sdk-java
aws-java-sdk-config/src/main/java/com/amazonaws/services/config/model/ConfigurationItem.java
ConfigurationItem.getRelatedEvents
public java.util.List<String> getRelatedEvents() { """ <p> A list of CloudTrail event IDs. </p> <p> A populated field indicates that the current configuration was initiated by the events recorded in the CloudTrail log. For more information about CloudTrail, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html">What Is AWS CloudTrail</a>. </p> <p> An empty field indicates that the current configuration was not initiated by any event. </p> @return A list of CloudTrail event IDs.</p> <p> A populated field indicates that the current configuration was initiated by the events recorded in the CloudTrail log. For more information about CloudTrail, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html">What Is AWS CloudTrail</a>. </p> <p> An empty field indicates that the current configuration was not initiated by any event. """ if (relatedEvents == null) { relatedEvents = new com.amazonaws.internal.SdkInternalList<String>(); } return relatedEvents; }
java
public java.util.List<String> getRelatedEvents() { if (relatedEvents == null) { relatedEvents = new com.amazonaws.internal.SdkInternalList<String>(); } return relatedEvents; }
[ "public", "java", ".", "util", ".", "List", "<", "String", ">", "getRelatedEvents", "(", ")", "{", "if", "(", "relatedEvents", "==", "null", ")", "{", "relatedEvents", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<", "String", ">", "(", ")", ";", "}", "return", "relatedEvents", ";", "}" ]
<p> A list of CloudTrail event IDs. </p> <p> A populated field indicates that the current configuration was initiated by the events recorded in the CloudTrail log. For more information about CloudTrail, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html">What Is AWS CloudTrail</a>. </p> <p> An empty field indicates that the current configuration was not initiated by any event. </p> @return A list of CloudTrail event IDs.</p> <p> A populated field indicates that the current configuration was initiated by the events recorded in the CloudTrail log. For more information about CloudTrail, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/what_is_cloud_trail_top_level.html">What Is AWS CloudTrail</a>. </p> <p> An empty field indicates that the current configuration was not initiated by any event.
[ "<p", ">", "A", "list", "of", "CloudTrail", "event", "IDs", ".", "<", "/", "p", ">", "<p", ">", "A", "populated", "field", "indicates", "that", "the", "current", "configuration", "was", "initiated", "by", "the", "events", "recorded", "in", "the", "CloudTrail", "log", ".", "For", "more", "information", "about", "CloudTrail", "see", "<a", "href", "=", "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "awscloudtrail", "/", "latest", "/", "userguide", "/", "what_is_cloud_trail_top_level", ".", "html", ">", "What", "Is", "AWS", "CloudTrail<", "/", "a", ">", ".", "<", "/", "p", ">", "<p", ">", "An", "empty", "field", "indicates", "that", "the", "current", "configuration", "was", "not", "initiated", "by", "any", "event", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-config/src/main/java/com/amazonaws/services/config/model/ConfigurationItem.java#L847-L852
infinispan/infinispan
core/src/main/java/org/infinispan/util/AbstractDelegatingCacheStream.java
AbstractDelegatingCacheStream.mapToInt
@Override public IntCacheStream mapToInt(ToIntFunction<? super R> mapper) { """ These are methods that convert to a different AbstractDelegating*CacheStream """ return new AbstractDelegatingIntCacheStream(this, castStream(underlyingStream).mapToInt(mapper)); }
java
@Override public IntCacheStream mapToInt(ToIntFunction<? super R> mapper) { return new AbstractDelegatingIntCacheStream(this, castStream(underlyingStream).mapToInt(mapper)); }
[ "@", "Override", "public", "IntCacheStream", "mapToInt", "(", "ToIntFunction", "<", "?", "super", "R", ">", "mapper", ")", "{", "return", "new", "AbstractDelegatingIntCacheStream", "(", "this", ",", "castStream", "(", "underlyingStream", ")", ".", "mapToInt", "(", "mapper", ")", ")", ";", "}" ]
These are methods that convert to a different AbstractDelegating*CacheStream
[ "These", "are", "methods", "that", "convert", "to", "a", "different", "AbstractDelegating", "*", "CacheStream" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/AbstractDelegatingCacheStream.java#L51-L54
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Camera.java
Camera.setView
public void setView(int x, int y, int width, int height, int screenHeight) { """ Define the rendering area. Useful to apply an offset during rendering, in order to avoid hiding part. <p> For example: </p> <ul> <li>If the view set is <code>(0, 0, 320, 240)</code>, and the tile size is <code>16</code>, then <code>20</code> horizontal tiles and <code>15</code> vertical tiles will be rendered from <code>0, 0</code> (screen top-left).</li> <li>If the view set is <code>(64, 64, 240, 160)</code>, and the tile size is <code>16</code>, then <code>15</code> horizontal tiles and <code>10</code> vertical tiles will be rendered from <code>64, 64</code> (screen top-left).</li> </ul> <p> It is also compatible with object rendering (by using an {@link com.b3dgs.lionengine.game.feature.Handler}). The object which is outside the camera view will not be rendered. This avoid useless rendering. </p> <p> Note: The rendering view is from the camera location. So <code>x</code> and <code>y</code> are an offset from this location. </p> @param x The horizontal offset. @param y The vertical offset. @param width The rendering width (positive value). @param height The rendering height (positive value). @param screenHeight The screen height. """ this.x = x; this.y = y; this.width = UtilMath.clamp(width, 0, Integer.MAX_VALUE); this.height = UtilMath.clamp(height, 0, Integer.MAX_VALUE); this.screenHeight = screenHeight; }
java
public void setView(int x, int y, int width, int height, int screenHeight) { this.x = x; this.y = y; this.width = UtilMath.clamp(width, 0, Integer.MAX_VALUE); this.height = UtilMath.clamp(height, 0, Integer.MAX_VALUE); this.screenHeight = screenHeight; }
[ "public", "void", "setView", "(", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ",", "int", "screenHeight", ")", "{", "this", ".", "x", "=", "x", ";", "this", ".", "y", "=", "y", ";", "this", ".", "width", "=", "UtilMath", ".", "clamp", "(", "width", ",", "0", ",", "Integer", ".", "MAX_VALUE", ")", ";", "this", ".", "height", "=", "UtilMath", ".", "clamp", "(", "height", ",", "0", ",", "Integer", ".", "MAX_VALUE", ")", ";", "this", ".", "screenHeight", "=", "screenHeight", ";", "}" ]
Define the rendering area. Useful to apply an offset during rendering, in order to avoid hiding part. <p> For example: </p> <ul> <li>If the view set is <code>(0, 0, 320, 240)</code>, and the tile size is <code>16</code>, then <code>20</code> horizontal tiles and <code>15</code> vertical tiles will be rendered from <code>0, 0</code> (screen top-left).</li> <li>If the view set is <code>(64, 64, 240, 160)</code>, and the tile size is <code>16</code>, then <code>15</code> horizontal tiles and <code>10</code> vertical tiles will be rendered from <code>64, 64</code> (screen top-left).</li> </ul> <p> It is also compatible with object rendering (by using an {@link com.b3dgs.lionengine.game.feature.Handler}). The object which is outside the camera view will not be rendered. This avoid useless rendering. </p> <p> Note: The rendering view is from the camera location. So <code>x</code> and <code>y</code> are an offset from this location. </p> @param x The horizontal offset. @param y The vertical offset. @param width The rendering width (positive value). @param height The rendering height (positive value). @param screenHeight The screen height.
[ "Define", "the", "rendering", "area", ".", "Useful", "to", "apply", "an", "offset", "during", "rendering", "in", "order", "to", "avoid", "hiding", "part", ".", "<p", ">", "For", "example", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "If", "the", "view", "set", "is", "<code", ">", "(", "0", "0", "320", "240", ")", "<", "/", "code", ">", "and", "the", "tile", "size", "is", "<code", ">", "16<", "/", "code", ">", "then", "<code", ">", "20<", "/", "code", ">", "horizontal", "tiles", "and", "<code", ">", "15<", "/", "code", ">", "vertical", "tiles", "will", "be", "rendered", "from", "<code", ">", "0", "0<", "/", "code", ">", "(", "screen", "top", "-", "left", ")", ".", "<", "/", "li", ">", "<li", ">", "If", "the", "view", "set", "is", "<code", ">", "(", "64", "64", "240", "160", ")", "<", "/", "code", ">", "and", "the", "tile", "size", "is", "<code", ">", "16<", "/", "code", ">", "then", "<code", ">", "15<", "/", "code", ">", "horizontal", "tiles", "and", "<code", ">", "10<", "/", "code", ">", "vertical", "tiles", "will", "be", "rendered", "from", "<code", ">", "64", "64<", "/", "code", ">", "(", "screen", "top", "-", "left", ")", ".", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "It", "is", "also", "compatible", "with", "object", "rendering", "(", "by", "using", "an", "{", "@link", "com", ".", "b3dgs", ".", "lionengine", ".", "game", ".", "feature", ".", "Handler", "}", ")", ".", "The", "object", "which", "is", "outside", "the", "camera", "view", "will", "not", "be", "rendered", ".", "This", "avoid", "useless", "rendering", ".", "<", "/", "p", ">", "<p", ">", "Note", ":", "The", "rendering", "view", "is", "from", "the", "camera", "location", ".", "So", "<code", ">", "x<", "/", "code", ">", "and", "<code", ">", "y<", "/", "code", ">", "are", "an", "offset", "from", "this", "location", ".", "<", "/", "p", ">" ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Camera.java#L216-L223
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.createPolylineOptions
public static PolylineOptions createPolylineOptions(StyleRow style, float density) { """ Create new polyline options populated with the style @param style style row @param density display density: {@link android.util.DisplayMetrics#density} @return polyline options populated with the style """ PolylineOptions polylineOptions = new PolylineOptions(); setStyle(polylineOptions, style, density); return polylineOptions; }
java
public static PolylineOptions createPolylineOptions(StyleRow style, float density) { PolylineOptions polylineOptions = new PolylineOptions(); setStyle(polylineOptions, style, density); return polylineOptions; }
[ "public", "static", "PolylineOptions", "createPolylineOptions", "(", "StyleRow", "style", ",", "float", "density", ")", "{", "PolylineOptions", "polylineOptions", "=", "new", "PolylineOptions", "(", ")", ";", "setStyle", "(", "polylineOptions", ",", "style", ",", "density", ")", ";", "return", "polylineOptions", ";", "}" ]
Create new polyline options populated with the style @param style style row @param density display density: {@link android.util.DisplayMetrics#density} @return polyline options populated with the style
[ "Create", "new", "polyline", "options", "populated", "with", "the", "style" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L449-L455
DDTH/ddth-tsc
ddth-tsc-core/src/main/java/com/github/ddth/tsc/AbstractCounter.java
AbstractCounter.getAllInRange
protected DataPoint[] getAllInRange(long timestampStartMs, long timestampEndMs) { """ Gets all data points in range [{@code timestampStartMs}, {@code timestampEndMs}). @param timestampStartMs @param timestampEndMs @return @since 0.3.2 """ SortedSet<DataPoint> result = new TreeSet<DataPoint>(new Comparator<DataPoint>() { @Override public int compare(DataPoint block1, DataPoint block2) { return Longs.compare(block1.timestamp(), block2.timestamp()); } }); long keyStart = toTimeSeriesPoint(timestampStartMs); long keyEnd = toTimeSeriesPoint(timestampEndMs); if (keyEnd == timestampStartMs) { keyEnd = toTimeSeriesPoint(timestampEndMs - 1); } for (long timestamp = keyStart, _end = keyEnd; timestamp <= _end; timestamp += RESOLUTION_MS) { DataPoint block = get(timestamp); result.add(block); } return result.toArray(DataPoint.EMPTY_ARR); }
java
protected DataPoint[] getAllInRange(long timestampStartMs, long timestampEndMs) { SortedSet<DataPoint> result = new TreeSet<DataPoint>(new Comparator<DataPoint>() { @Override public int compare(DataPoint block1, DataPoint block2) { return Longs.compare(block1.timestamp(), block2.timestamp()); } }); long keyStart = toTimeSeriesPoint(timestampStartMs); long keyEnd = toTimeSeriesPoint(timestampEndMs); if (keyEnd == timestampStartMs) { keyEnd = toTimeSeriesPoint(timestampEndMs - 1); } for (long timestamp = keyStart, _end = keyEnd; timestamp <= _end; timestamp += RESOLUTION_MS) { DataPoint block = get(timestamp); result.add(block); } return result.toArray(DataPoint.EMPTY_ARR); }
[ "protected", "DataPoint", "[", "]", "getAllInRange", "(", "long", "timestampStartMs", ",", "long", "timestampEndMs", ")", "{", "SortedSet", "<", "DataPoint", ">", "result", "=", "new", "TreeSet", "<", "DataPoint", ">", "(", "new", "Comparator", "<", "DataPoint", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "DataPoint", "block1", ",", "DataPoint", "block2", ")", "{", "return", "Longs", ".", "compare", "(", "block1", ".", "timestamp", "(", ")", ",", "block2", ".", "timestamp", "(", ")", ")", ";", "}", "}", ")", ";", "long", "keyStart", "=", "toTimeSeriesPoint", "(", "timestampStartMs", ")", ";", "long", "keyEnd", "=", "toTimeSeriesPoint", "(", "timestampEndMs", ")", ";", "if", "(", "keyEnd", "==", "timestampStartMs", ")", "{", "keyEnd", "=", "toTimeSeriesPoint", "(", "timestampEndMs", "-", "1", ")", ";", "}", "for", "(", "long", "timestamp", "=", "keyStart", ",", "_end", "=", "keyEnd", ";", "timestamp", "<=", "_end", ";", "timestamp", "+=", "RESOLUTION_MS", ")", "{", "DataPoint", "block", "=", "get", "(", "timestamp", ")", ";", "result", ".", "add", "(", "block", ")", ";", "}", "return", "result", ".", "toArray", "(", "DataPoint", ".", "EMPTY_ARR", ")", ";", "}" ]
Gets all data points in range [{@code timestampStartMs}, {@code timestampEndMs}). @param timestampStartMs @param timestampEndMs @return @since 0.3.2
[ "Gets", "all", "data", "points", "in", "range", "[", "{", "@code", "timestampStartMs", "}", "{", "@code", "timestampEndMs", "}", ")", "." ]
train
https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/AbstractCounter.java#L213-L230
spring-projects/spring-social-facebook
spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestDecoder.java
SignedRequestDecoder.decodeSignedRequest
public <T> T decodeSignedRequest(String signedRequest, Class<T> type) throws SignedRequestException { """ Decodes a signed request, returning the payload of the signed request as a specified type. @param signedRequest the value of the signed_request parameter sent by Facebook. @param type the type to bind the signed_request to. @param <T> the Java type to bind the signed_request to. @return the payload of the signed request as an object @throws SignedRequestException if there is an error decoding the signed request """ String[] split = signedRequest.split("\\."); String encodedSignature = split[0]; String payload = split[1]; String decoded = base64DecodeToString(payload); byte[] signature = base64DecodeToBytes(encodedSignature); try { T data = objectMapper.readValue(decoded, type); String algorithm = objectMapper.readTree(decoded).get("algorithm").textValue(); if (algorithm == null || !algorithm.equals("HMAC-SHA256")) { throw new SignedRequestException("Unknown encryption algorithm: " + algorithm); } byte[] expectedSignature = encrypt(payload, secret); if (!Arrays.equals(expectedSignature, signature)) { throw new SignedRequestException("Invalid signature."); } return data; } catch (IOException e) { throw new SignedRequestException("Error parsing payload.", e); } }
java
public <T> T decodeSignedRequest(String signedRequest, Class<T> type) throws SignedRequestException { String[] split = signedRequest.split("\\."); String encodedSignature = split[0]; String payload = split[1]; String decoded = base64DecodeToString(payload); byte[] signature = base64DecodeToBytes(encodedSignature); try { T data = objectMapper.readValue(decoded, type); String algorithm = objectMapper.readTree(decoded).get("algorithm").textValue(); if (algorithm == null || !algorithm.equals("HMAC-SHA256")) { throw new SignedRequestException("Unknown encryption algorithm: " + algorithm); } byte[] expectedSignature = encrypt(payload, secret); if (!Arrays.equals(expectedSignature, signature)) { throw new SignedRequestException("Invalid signature."); } return data; } catch (IOException e) { throw new SignedRequestException("Error parsing payload.", e); } }
[ "public", "<", "T", ">", "T", "decodeSignedRequest", "(", "String", "signedRequest", ",", "Class", "<", "T", ">", "type", ")", "throws", "SignedRequestException", "{", "String", "[", "]", "split", "=", "signedRequest", ".", "split", "(", "\"\\\\.\"", ")", ";", "String", "encodedSignature", "=", "split", "[", "0", "]", ";", "String", "payload", "=", "split", "[", "1", "]", ";", "String", "decoded", "=", "base64DecodeToString", "(", "payload", ")", ";", "byte", "[", "]", "signature", "=", "base64DecodeToBytes", "(", "encodedSignature", ")", ";", "try", "{", "T", "data", "=", "objectMapper", ".", "readValue", "(", "decoded", ",", "type", ")", ";", "String", "algorithm", "=", "objectMapper", ".", "readTree", "(", "decoded", ")", ".", "get", "(", "\"algorithm\"", ")", ".", "textValue", "(", ")", ";", "if", "(", "algorithm", "==", "null", "||", "!", "algorithm", ".", "equals", "(", "\"HMAC-SHA256\"", ")", ")", "{", "throw", "new", "SignedRequestException", "(", "\"Unknown encryption algorithm: \"", "+", "algorithm", ")", ";", "}", "byte", "[", "]", "expectedSignature", "=", "encrypt", "(", "payload", ",", "secret", ")", ";", "if", "(", "!", "Arrays", ".", "equals", "(", "expectedSignature", ",", "signature", ")", ")", "{", "throw", "new", "SignedRequestException", "(", "\"Invalid signature.\"", ")", ";", "}", "return", "data", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "SignedRequestException", "(", "\"Error parsing payload.\"", ",", "e", ")", ";", "}", "}" ]
Decodes a signed request, returning the payload of the signed request as a specified type. @param signedRequest the value of the signed_request parameter sent by Facebook. @param type the type to bind the signed_request to. @param <T> the Java type to bind the signed_request to. @return the payload of the signed request as an object @throws SignedRequestException if there is an error decoding the signed request
[ "Decodes", "a", "signed", "request", "returning", "the", "payload", "of", "the", "signed", "request", "as", "a", "specified", "type", "." ]
train
https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestDecoder.java#L71-L91
Azure/azure-sdk-for-java
streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java
StreamingJobsInner.beginStart
public void beginStart(String resourceGroupName, String jobName, StartStreamingJobParameters startJobParameters) { """ Starts a streaming job. Once a job is started it will start processing input events and produce output. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param jobName The name of the streaming job. @param startJobParameters Parameters applicable to a start streaming job operation. @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 """ beginStartWithServiceResponseAsync(resourceGroupName, jobName, startJobParameters).toBlocking().single().body(); }
java
public void beginStart(String resourceGroupName, String jobName, StartStreamingJobParameters startJobParameters) { beginStartWithServiceResponseAsync(resourceGroupName, jobName, startJobParameters).toBlocking().single().body(); }
[ "public", "void", "beginStart", "(", "String", "resourceGroupName", ",", "String", "jobName", ",", "StartStreamingJobParameters", "startJobParameters", ")", "{", "beginStartWithServiceResponseAsync", "(", "resourceGroupName", ",", "jobName", ",", "startJobParameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Starts a streaming job. Once a job is started it will start processing input events and produce output. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param jobName The name of the streaming job. @param startJobParameters Parameters applicable to a start streaming job operation. @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
[ "Starts", "a", "streaming", "job", ".", "Once", "a", "job", "is", "started", "it", "will", "start", "processing", "input", "events", "and", "produce", "output", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java#L1670-L1672
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/RedundantGeneratorMappingFilter.java
RedundantGeneratorMappingFilter.isRedundant
private boolean isRedundant(IContextMapping<INode> mapping, INode source, INode target, char R) { """ Checks whether the relation between source and target is redundant or not for minimal mapping. @param mapping a mapping @param source source @param target target @param R relation between source and target node @return true for redundant relation @return true if the relation between source and target is redundant """ switch (R) { case IMappingElement.LESS_GENERAL: { if (verifyCondition1(mapping, source, target)) { return true; } break; } case IMappingElement.MORE_GENERAL: { if (verifyCondition2(mapping, source, target)) { return true; } break; } case IMappingElement.DISJOINT: { if (verifyCondition3(mapping, source, target)) { return true; } break; } case IMappingElement.EQUIVALENCE: { if (verifyCondition1(mapping, source, target) && verifyCondition2(mapping, source, target)) { return true; } break; } default: { return false; } }// end switch return false; }
java
private boolean isRedundant(IContextMapping<INode> mapping, INode source, INode target, char R) { switch (R) { case IMappingElement.LESS_GENERAL: { if (verifyCondition1(mapping, source, target)) { return true; } break; } case IMappingElement.MORE_GENERAL: { if (verifyCondition2(mapping, source, target)) { return true; } break; } case IMappingElement.DISJOINT: { if (verifyCondition3(mapping, source, target)) { return true; } break; } case IMappingElement.EQUIVALENCE: { if (verifyCondition1(mapping, source, target) && verifyCondition2(mapping, source, target)) { return true; } break; } default: { return false; } }// end switch return false; }
[ "private", "boolean", "isRedundant", "(", "IContextMapping", "<", "INode", ">", "mapping", ",", "INode", "source", ",", "INode", "target", ",", "char", "R", ")", "{", "switch", "(", "R", ")", "{", "case", "IMappingElement", ".", "LESS_GENERAL", ":", "{", "if", "(", "verifyCondition1", "(", "mapping", ",", "source", ",", "target", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "case", "IMappingElement", ".", "MORE_GENERAL", ":", "{", "if", "(", "verifyCondition2", "(", "mapping", ",", "source", ",", "target", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "case", "IMappingElement", ".", "DISJOINT", ":", "{", "if", "(", "verifyCondition3", "(", "mapping", ",", "source", ",", "target", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "case", "IMappingElement", ".", "EQUIVALENCE", ":", "{", "if", "(", "verifyCondition1", "(", "mapping", ",", "source", ",", "target", ")", "&&", "verifyCondition2", "(", "mapping", ",", "source", ",", "target", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "default", ":", "{", "return", "false", ";", "}", "}", "// end switch\r", "return", "false", ";", "}" ]
Checks whether the relation between source and target is redundant or not for minimal mapping. @param mapping a mapping @param source source @param target target @param R relation between source and target node @return true for redundant relation @return true if the relation between source and target is redundant
[ "Checks", "whether", "the", "relation", "between", "source", "and", "target", "is", "redundant", "or", "not", "for", "minimal", "mapping", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/RedundantGeneratorMappingFilter.java#L122-L155
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java
GraphUtils.countAllDistinct
public static <T extends GraphNode<T>> int countAllDistinct(T node) { """ Counts all distinct nodes in the graph reachable from the given node. This method can properly deal with cycles in the graph. @param node the root node @return the number of distinct nodes """ if (node == null) return 0; return collectAllNodes(node, new HashSet<T>()).size(); }
java
public static <T extends GraphNode<T>> int countAllDistinct(T node) { if (node == null) return 0; return collectAllNodes(node, new HashSet<T>()).size(); }
[ "public", "static", "<", "T", "extends", "GraphNode", "<", "T", ">", ">", "int", "countAllDistinct", "(", "T", "node", ")", "{", "if", "(", "node", "==", "null", ")", "return", "0", ";", "return", "collectAllNodes", "(", "node", ",", "new", "HashSet", "<", "T", ">", "(", ")", ")", ".", "size", "(", ")", ";", "}" ]
Counts all distinct nodes in the graph reachable from the given node. This method can properly deal with cycles in the graph. @param node the root node @return the number of distinct nodes
[ "Counts", "all", "distinct", "nodes", "in", "the", "graph", "reachable", "from", "the", "given", "node", ".", "This", "method", "can", "properly", "deal", "with", "cycles", "in", "the", "graph", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/trees/GraphUtils.java#L71-L74
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/Matrices.java
Matrices.copy
public static Matrix copy(Matrix matrix) { """ Returns a copied version of a given matrix. The returned matrix will have the same dimensionality, values, and sparsity, but it may not have the same exact sub-type. @param matrix the matrix to be copied @throws IllegalArgumentException when the dimensionality of matrix and output do not match @return a copied version of matrix """ Matrix copiedMatrix = null; if (matrix instanceof SparseMatrix) copiedMatrix = Matrices.create( matrix.rows(), matrix.columns(), Type.SPARSE_IN_MEMORY); else copiedMatrix = Matrices.create( matrix.rows(), matrix.columns(), Type.DENSE_IN_MEMORY); return copyTo(matrix, copiedMatrix); }
java
public static Matrix copy(Matrix matrix) { Matrix copiedMatrix = null; if (matrix instanceof SparseMatrix) copiedMatrix = Matrices.create( matrix.rows(), matrix.columns(), Type.SPARSE_IN_MEMORY); else copiedMatrix = Matrices.create( matrix.rows(), matrix.columns(), Type.DENSE_IN_MEMORY); return copyTo(matrix, copiedMatrix); }
[ "public", "static", "Matrix", "copy", "(", "Matrix", "matrix", ")", "{", "Matrix", "copiedMatrix", "=", "null", ";", "if", "(", "matrix", "instanceof", "SparseMatrix", ")", "copiedMatrix", "=", "Matrices", ".", "create", "(", "matrix", ".", "rows", "(", ")", ",", "matrix", ".", "columns", "(", ")", ",", "Type", ".", "SPARSE_IN_MEMORY", ")", ";", "else", "copiedMatrix", "=", "Matrices", ".", "create", "(", "matrix", ".", "rows", "(", ")", ",", "matrix", ".", "columns", "(", ")", ",", "Type", ".", "DENSE_IN_MEMORY", ")", ";", "return", "copyTo", "(", "matrix", ",", "copiedMatrix", ")", ";", "}" ]
Returns a copied version of a given matrix. The returned matrix will have the same dimensionality, values, and sparsity, but it may not have the same exact sub-type. @param matrix the matrix to be copied @throws IllegalArgumentException when the dimensionality of matrix and output do not match @return a copied version of matrix
[ "Returns", "a", "copied", "version", "of", "a", "given", "matrix", ".", "The", "returned", "matrix", "will", "have", "the", "same", "dimensionality", "values", "and", "sparsity", "but", "it", "may", "not", "have", "the", "same", "exact", "sub", "-", "type", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/Matrices.java#L148-L157
javaruntype/javaruntype
src/main/java/org/javaruntype/util/Utils.java
Utils.isArrayEqual
public static boolean isArrayEqual(final Object[] left, final Object[] right) { """ <p> Internal utility method. DO NOT use this method directly. </p> @param left left side of the comparison @param right left side of the comparison @return true if both arrays are equal """ if (left == right) { return true; } if (left == null || right == null) { return false; } if (left.length != right.length) { return false; } for (int i = 0; i < left.length; ++i) { if (!isArrayElementEqual(left[i], right[i])) { return false; } } return true; }
java
public static boolean isArrayEqual(final Object[] left, final Object[] right) { if (left == right) { return true; } if (left == null || right == null) { return false; } if (left.length != right.length) { return false; } for (int i = 0; i < left.length; ++i) { if (!isArrayElementEqual(left[i], right[i])) { return false; } } return true; }
[ "public", "static", "boolean", "isArrayEqual", "(", "final", "Object", "[", "]", "left", ",", "final", "Object", "[", "]", "right", ")", "{", "if", "(", "left", "==", "right", ")", "{", "return", "true", ";", "}", "if", "(", "left", "==", "null", "||", "right", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "left", ".", "length", "!=", "right", ".", "length", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "left", ".", "length", ";", "++", "i", ")", "{", "if", "(", "!", "isArrayElementEqual", "(", "left", "[", "i", "]", ",", "right", "[", "i", "]", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
<p> Internal utility method. DO NOT use this method directly. </p> @param left left side of the comparison @param right left side of the comparison @return true if both arrays are equal
[ "<p", ">", "Internal", "utility", "method", ".", "DO", "NOT", "use", "this", "method", "directly", ".", "<", "/", "p", ">" ]
train
https://github.com/javaruntype/javaruntype/blob/d3c522d16fd2295d09a11570d8c951c4821eff0a/src/main/java/org/javaruntype/util/Utils.java#L133-L149
di2e/Argo
Responder/ResponderDaemon/src/main/java/ws/argo/responder/transport/AmazonSNSTransport.java
AmazonSNSTransport.subscribe
public void subscribe() throws URISyntaxException, TransportConfigException { """ Attempt to subscript to the Argo SNS topic. @throws URISyntaxException if the subscription HTTP URL is messed up @throws TransportConfigException if there was some Amazon specific issue while subscribing """ /* * if this instance of the transport (as there could be several - each with * a different topic) is in shutdown mode then don't subscribe. This is a * side effect of when you shutdown a sns transport and the listener gets an * UnsubscribeConfirmation. In normal operation, when the topic does * occasional house keeping and clears out the subscriptions, running * transports will just re-subscribe. */ if (_inShutdown) return; URI url = getBaseSubscriptionURI(); String subscriptionURL = url.toString() + "listener/sns"; LOGGER.info("Subscription URI - " + subscriptionURL); SubscribeRequest subRequest = new SubscribeRequest(_argoTopicName, "http", subscriptionURL); try { getSNSClient().subscribe(subRequest); } catch (AmazonServiceException e) { throw new TransportConfigException("Error subscribing to SNS topic.", e); } // get request id for SubscribeRequest from SNS metadata this._subscriptionArn = getSNSClient().getCachedResponseMetadata(subRequest).toString(); LOGGER.info("SubscribeRequest - " + _subscriptionArn); }
java
public void subscribe() throws URISyntaxException, TransportConfigException { /* * if this instance of the transport (as there could be several - each with * a different topic) is in shutdown mode then don't subscribe. This is a * side effect of when you shutdown a sns transport and the listener gets an * UnsubscribeConfirmation. In normal operation, when the topic does * occasional house keeping and clears out the subscriptions, running * transports will just re-subscribe. */ if (_inShutdown) return; URI url = getBaseSubscriptionURI(); String subscriptionURL = url.toString() + "listener/sns"; LOGGER.info("Subscription URI - " + subscriptionURL); SubscribeRequest subRequest = new SubscribeRequest(_argoTopicName, "http", subscriptionURL); try { getSNSClient().subscribe(subRequest); } catch (AmazonServiceException e) { throw new TransportConfigException("Error subscribing to SNS topic.", e); } // get request id for SubscribeRequest from SNS metadata this._subscriptionArn = getSNSClient().getCachedResponseMetadata(subRequest).toString(); LOGGER.info("SubscribeRequest - " + _subscriptionArn); }
[ "public", "void", "subscribe", "(", ")", "throws", "URISyntaxException", ",", "TransportConfigException", "{", "/*\n * if this instance of the transport (as there could be several - each with\n * a different topic) is in shutdown mode then don't subscribe. This is a\n * side effect of when you shutdown a sns transport and the listener gets an\n * UnsubscribeConfirmation. In normal operation, when the topic does\n * occasional house keeping and clears out the subscriptions, running\n * transports will just re-subscribe.\n */", "if", "(", "_inShutdown", ")", "return", ";", "URI", "url", "=", "getBaseSubscriptionURI", "(", ")", ";", "String", "subscriptionURL", "=", "url", ".", "toString", "(", ")", "+", "\"listener/sns\"", ";", "LOGGER", ".", "info", "(", "\"Subscription URI - \"", "+", "subscriptionURL", ")", ";", "SubscribeRequest", "subRequest", "=", "new", "SubscribeRequest", "(", "_argoTopicName", ",", "\"http\"", ",", "subscriptionURL", ")", ";", "try", "{", "getSNSClient", "(", ")", ".", "subscribe", "(", "subRequest", ")", ";", "}", "catch", "(", "AmazonServiceException", "e", ")", "{", "throw", "new", "TransportConfigException", "(", "\"Error subscribing to SNS topic.\"", ",", "e", ")", ";", "}", "// get request id for SubscribeRequest from SNS metadata", "this", ".", "_subscriptionArn", "=", "getSNSClient", "(", ")", ".", "getCachedResponseMetadata", "(", "subRequest", ")", ".", "toString", "(", ")", ";", "LOGGER", ".", "info", "(", "\"SubscribeRequest - \"", "+", "_subscriptionArn", ")", ";", "}" ]
Attempt to subscript to the Argo SNS topic. @throws URISyntaxException if the subscription HTTP URL is messed up @throws TransportConfigException if there was some Amazon specific issue while subscribing
[ "Attempt", "to", "subscript", "to", "the", "Argo", "SNS", "topic", "." ]
train
https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/transport/AmazonSNSTransport.java#L162-L189
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java
GVRAssetLoader.loadTexture
public GVRTexture loadTexture(GVRAndroidResource resource, GVRTextureParameters textureParameters) { """ Loads file placed in the assets folder, as a {@link GVRBitmapImage} with the user provided texture parameters. The bitmap is loaded asynchronously. <p> This method automatically scales large images to fit the GPU's restrictions and to avoid {@linkplain OutOfMemoryError out of memory errors.} @param resource A stream containing a bitmap texture. The {@link GVRAndroidResource} class has six constructors to handle a wide variety of Android resource types. Taking a {@code GVRAndroidResource} here eliminates six overloads. @param textureParameters The texture parameter object which has all the values that were provided by the user for texture enhancement. The {@link GVRTextureParameters} class has methods to set all the texture filters and wrap states. If this parameter is nullo, default texture parameters are used. @return The file as a texture, or {@code null} if the file can not be decoded into a Bitmap. @see GVRAssetLoader#getDefaultTextureParameters """ GVRTexture texture = new GVRTexture(mContext, textureParameters); TextureRequest request = new TextureRequest(resource, texture); GVRAsynchronousResourceLoader.loadTexture(mContext, mTextureCache, request, resource, DEFAULT_PRIORITY, GVRCompressedImage.BALANCED); return texture; }
java
public GVRTexture loadTexture(GVRAndroidResource resource, GVRTextureParameters textureParameters) { GVRTexture texture = new GVRTexture(mContext, textureParameters); TextureRequest request = new TextureRequest(resource, texture); GVRAsynchronousResourceLoader.loadTexture(mContext, mTextureCache, request, resource, DEFAULT_PRIORITY, GVRCompressedImage.BALANCED); return texture; }
[ "public", "GVRTexture", "loadTexture", "(", "GVRAndroidResource", "resource", ",", "GVRTextureParameters", "textureParameters", ")", "{", "GVRTexture", "texture", "=", "new", "GVRTexture", "(", "mContext", ",", "textureParameters", ")", ";", "TextureRequest", "request", "=", "new", "TextureRequest", "(", "resource", ",", "texture", ")", ";", "GVRAsynchronousResourceLoader", ".", "loadTexture", "(", "mContext", ",", "mTextureCache", ",", "request", ",", "resource", ",", "DEFAULT_PRIORITY", ",", "GVRCompressedImage", ".", "BALANCED", ")", ";", "return", "texture", ";", "}" ]
Loads file placed in the assets folder, as a {@link GVRBitmapImage} with the user provided texture parameters. The bitmap is loaded asynchronously. <p> This method automatically scales large images to fit the GPU's restrictions and to avoid {@linkplain OutOfMemoryError out of memory errors.} @param resource A stream containing a bitmap texture. The {@link GVRAndroidResource} class has six constructors to handle a wide variety of Android resource types. Taking a {@code GVRAndroidResource} here eliminates six overloads. @param textureParameters The texture parameter object which has all the values that were provided by the user for texture enhancement. The {@link GVRTextureParameters} class has methods to set all the texture filters and wrap states. If this parameter is nullo, default texture parameters are used. @return The file as a texture, or {@code null} if the file can not be decoded into a Bitmap. @see GVRAssetLoader#getDefaultTextureParameters
[ "Loads", "file", "placed", "in", "the", "assets", "folder", "as", "a", "{", "@link", "GVRBitmapImage", "}", "with", "the", "user", "provided", "texture", "parameters", ".", "The", "bitmap", "is", "loaded", "asynchronously", ".", "<p", ">", "This", "method", "automatically", "scales", "large", "images", "to", "fit", "the", "GPU", "s", "restrictions", "and", "to", "avoid", "{", "@linkplain", "OutOfMemoryError", "out", "of", "memory", "errors", ".", "}" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java#L658-L666
line/centraldogma
common/src/main/java/com/linecorp/centraldogma/common/Entry.java
Entry.ofJson
public static Entry<JsonNode> ofJson(Revision revision, String path, String content) throws JsonParseException { """ Returns a newly-created {@link Entry} of a JSON file. @param revision the revision of the JSON file @param path the path of the JSON file @param content the content of the JSON file @throws JsonParseException if the {@code content} is not a valid JSON """ return ofJson(revision, path, Jackson.readTree(content)); }
java
public static Entry<JsonNode> ofJson(Revision revision, String path, String content) throws JsonParseException { return ofJson(revision, path, Jackson.readTree(content)); }
[ "public", "static", "Entry", "<", "JsonNode", ">", "ofJson", "(", "Revision", "revision", ",", "String", "path", ",", "String", "content", ")", "throws", "JsonParseException", "{", "return", "ofJson", "(", "revision", ",", "path", ",", "Jackson", ".", "readTree", "(", "content", ")", ")", ";", "}" ]
Returns a newly-created {@link Entry} of a JSON file. @param revision the revision of the JSON file @param path the path of the JSON file @param content the content of the JSON file @throws JsonParseException if the {@code content} is not a valid JSON
[ "Returns", "a", "newly", "-", "created", "{", "@link", "Entry", "}", "of", "a", "JSON", "file", "." ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/common/src/main/java/com/linecorp/centraldogma/common/Entry.java#L70-L73
Netflix/karyon
karyon2-admin-web/src/main/java/netflix/adminresources/tableview/DataTableHelper.java
DataTableHelper.applyQueryParams
private static void applyQueryParams(TableViewResource resource, MultivaluedMap<String, String> queryParams) { """ apply pagination, search, sort params <p/> Sample query from DataTables - sEcho=1&iColumns=2&sColumns=&iDisplayStart=0&iDisplayLength=25&mDataProp_0=0&mDataProp_1=1&sSearch=& bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true& iSortingCols=1&iSortCol_0=0&sSortDir_0=asc&bSortable_0=true&bSortable_1=true """ final String allColsSearch = queryParams.getFirst("sSearch"); final String displayStart = queryParams.getFirst("iDisplayStart"); final String displayLen = queryParams.getFirst("iDisplayLength"); String sortColumnIndex = queryParams.getFirst("iSortCol_0"); String sortColumnDir = queryParams.getFirst("sSortDir_0"); if (sortColumnDir == null || sortColumnIndex == null) { // defaults sortColumnDir = "asc"; sortColumnIndex = "0"; } int colIndex = Integer.parseInt(sortColumnIndex); String sortColumnName = resource.getColumns().get(colIndex); if (displayLen != null && displayStart != null) { final int iDisplayLen = Integer.parseInt(displayLen); final int iDisplayStart = Integer.parseInt(displayStart); resource.setAllColumnsSearchTerm(allColsSearch) .setCurrentPageInfo(iDisplayStart, iDisplayLen) .enableColumnSort(sortColumnName, !(sortColumnDir.equalsIgnoreCase("asc"))); } }
java
private static void applyQueryParams(TableViewResource resource, MultivaluedMap<String, String> queryParams) { final String allColsSearch = queryParams.getFirst("sSearch"); final String displayStart = queryParams.getFirst("iDisplayStart"); final String displayLen = queryParams.getFirst("iDisplayLength"); String sortColumnIndex = queryParams.getFirst("iSortCol_0"); String sortColumnDir = queryParams.getFirst("sSortDir_0"); if (sortColumnDir == null || sortColumnIndex == null) { // defaults sortColumnDir = "asc"; sortColumnIndex = "0"; } int colIndex = Integer.parseInt(sortColumnIndex); String sortColumnName = resource.getColumns().get(colIndex); if (displayLen != null && displayStart != null) { final int iDisplayLen = Integer.parseInt(displayLen); final int iDisplayStart = Integer.parseInt(displayStart); resource.setAllColumnsSearchTerm(allColsSearch) .setCurrentPageInfo(iDisplayStart, iDisplayLen) .enableColumnSort(sortColumnName, !(sortColumnDir.equalsIgnoreCase("asc"))); } }
[ "private", "static", "void", "applyQueryParams", "(", "TableViewResource", "resource", ",", "MultivaluedMap", "<", "String", ",", "String", ">", "queryParams", ")", "{", "final", "String", "allColsSearch", "=", "queryParams", ".", "getFirst", "(", "\"sSearch\"", ")", ";", "final", "String", "displayStart", "=", "queryParams", ".", "getFirst", "(", "\"iDisplayStart\"", ")", ";", "final", "String", "displayLen", "=", "queryParams", ".", "getFirst", "(", "\"iDisplayLength\"", ")", ";", "String", "sortColumnIndex", "=", "queryParams", ".", "getFirst", "(", "\"iSortCol_0\"", ")", ";", "String", "sortColumnDir", "=", "queryParams", ".", "getFirst", "(", "\"sSortDir_0\"", ")", ";", "if", "(", "sortColumnDir", "==", "null", "||", "sortColumnIndex", "==", "null", ")", "{", "// defaults", "sortColumnDir", "=", "\"asc\"", ";", "sortColumnIndex", "=", "\"0\"", ";", "}", "int", "colIndex", "=", "Integer", ".", "parseInt", "(", "sortColumnIndex", ")", ";", "String", "sortColumnName", "=", "resource", ".", "getColumns", "(", ")", ".", "get", "(", "colIndex", ")", ";", "if", "(", "displayLen", "!=", "null", "&&", "displayStart", "!=", "null", ")", "{", "final", "int", "iDisplayLen", "=", "Integer", ".", "parseInt", "(", "displayLen", ")", ";", "final", "int", "iDisplayStart", "=", "Integer", ".", "parseInt", "(", "displayStart", ")", ";", "resource", ".", "setAllColumnsSearchTerm", "(", "allColsSearch", ")", ".", "setCurrentPageInfo", "(", "iDisplayStart", ",", "iDisplayLen", ")", ".", "enableColumnSort", "(", "sortColumnName", ",", "!", "(", "sortColumnDir", ".", "equalsIgnoreCase", "(", "\"asc\"", ")", ")", ")", ";", "}", "}" ]
apply pagination, search, sort params <p/> Sample query from DataTables - sEcho=1&iColumns=2&sColumns=&iDisplayStart=0&iDisplayLength=25&mDataProp_0=0&mDataProp_1=1&sSearch=& bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true& iSortingCols=1&iSortCol_0=0&sSortDir_0=asc&bSortable_0=true&bSortable_1=true
[ "apply", "pagination", "search", "sort", "params", "<p", "/", ">", "Sample", "query", "from", "DataTables", "-", "sEcho", "=", "1&iColumns", "=", "2&sColumns", "=", "&iDisplayStart", "=", "0&iDisplayLength", "=", "25&mDataProp_0", "=", "0&mDataProp_1", "=", "1&sSearch", "=", "&", "bRegex", "=", "false&sSearch_0", "=", "&bRegex_0", "=", "false&bSearchable_0", "=", "true&sSearch_1", "=", "&bRegex_1", "=", "false&bSearchable_1", "=", "true&", "iSortingCols", "=", "1&iSortCol_0", "=", "0&sSortDir_0", "=", "asc&bSortable_0", "=", "true&bSortable_1", "=", "true" ]
train
https://github.com/Netflix/karyon/blob/d50bc0ff37693ef3fbda373e90a109d1f92e0b9a/karyon2-admin-web/src/main/java/netflix/adminresources/tableview/DataTableHelper.java#L31-L56
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.setItem
public String setItem(String iid, Map<String, Object> properties) throws ExecutionException, InterruptedException, IOException { """ Sets properties of a item. Same as {@link #setItem(String, Map, DateTime) setItem(String, Map&lt;String, Object&gt;, DateTime)} except event time is not specified and recorded as the time when the function is called. """ return setItem(iid, properties, new DateTime()); }
java
public String setItem(String iid, Map<String, Object> properties) throws ExecutionException, InterruptedException, IOException { return setItem(iid, properties, new DateTime()); }
[ "public", "String", "setItem", "(", "String", "iid", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "ExecutionException", ",", "InterruptedException", ",", "IOException", "{", "return", "setItem", "(", "iid", ",", "properties", ",", "new", "DateTime", "(", ")", ")", ";", "}" ]
Sets properties of a item. Same as {@link #setItem(String, Map, DateTime) setItem(String, Map&lt;String, Object&gt;, DateTime)} except event time is not specified and recorded as the time when the function is called.
[ "Sets", "properties", "of", "a", "item", ".", "Same", "as", "{" ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L493-L496
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/DatastoreUtils.java
DatastoreUtils.toEntities
static <E> List<E> toEntities(Class<E> entityClass, Entity[] nativeEntities) { """ Converts the given array of native entities to a list of model objects of given type, <code>entityClass</code>. @param entityClass the entity class @param nativeEntities native entities to convert @return the list of model objects """ if (nativeEntities == null || nativeEntities.length == 0) { return new ArrayList<>(); } return toEntities(entityClass, Arrays.asList(nativeEntities)); }
java
static <E> List<E> toEntities(Class<E> entityClass, Entity[] nativeEntities) { if (nativeEntities == null || nativeEntities.length == 0) { return new ArrayList<>(); } return toEntities(entityClass, Arrays.asList(nativeEntities)); }
[ "static", "<", "E", ">", "List", "<", "E", ">", "toEntities", "(", "Class", "<", "E", ">", "entityClass", ",", "Entity", "[", "]", "nativeEntities", ")", "{", "if", "(", "nativeEntities", "==", "null", "||", "nativeEntities", ".", "length", "==", "0", ")", "{", "return", "new", "ArrayList", "<>", "(", ")", ";", "}", "return", "toEntities", "(", "entityClass", ",", "Arrays", ".", "asList", "(", "nativeEntities", ")", ")", ";", "}" ]
Converts the given array of native entities to a list of model objects of given type, <code>entityClass</code>. @param entityClass the entity class @param nativeEntities native entities to convert @return the list of model objects
[ "Converts", "the", "given", "array", "of", "native", "entities", "to", "a", "list", "of", "model", "objects", "of", "given", "type", "<code", ">", "entityClass<", "/", "code", ">", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DatastoreUtils.java#L94-L99
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.createAward
public GitlabAward createAward(GitlabMergeRequest mergeRequest, String awardName) throws IOException { """ Create an award for a merge request @param mergeRequest @param awardName @throws IOException on gitlab api call error """ Query query = new Query().append("name", awardName); String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabAward.URL + query.toString(); return dispatch().to(tailUrl, GitlabAward.class); }
java
public GitlabAward createAward(GitlabMergeRequest mergeRequest, String awardName) throws IOException { Query query = new Query().append("name", awardName); String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabAward.URL + query.toString(); return dispatch().to(tailUrl, GitlabAward.class); }
[ "public", "GitlabAward", "createAward", "(", "GitlabMergeRequest", "mergeRequest", ",", "String", "awardName", ")", "throws", "IOException", "{", "Query", "query", "=", "new", "Query", "(", ")", ".", "append", "(", "\"name\"", ",", "awardName", ")", ";", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "mergeRequest", ".", "getProjectId", "(", ")", "+", "GitlabMergeRequest", ".", "URL", "+", "\"/\"", "+", "mergeRequest", ".", "getIid", "(", ")", "+", "GitlabAward", ".", "URL", "+", "query", ".", "toString", "(", ")", ";", "return", "dispatch", "(", ")", ".", "to", "(", "tailUrl", ",", "GitlabAward", ".", "class", ")", ";", "}" ]
Create an award for a merge request @param mergeRequest @param awardName @throws IOException on gitlab api call error
[ "Create", "an", "award", "for", "a", "merge", "request" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3477-L3483
JM-Lab/utils-java8
src/main/java/kr/jm/utils/datastructure/JMMap.java
JMMap.sortByValue
public static <K, V extends Comparable<V>> Map<K, V> sortByValue(Map<K, V> map) { """ Sort by value map. @param <K> the type parameter @param <V> the type parameter @param map the map @return the map """ return sort(map, comparing(map::get)); }
java
public static <K, V extends Comparable<V>> Map<K, V> sortByValue(Map<K, V> map) { return sort(map, comparing(map::get)); }
[ "public", "static", "<", "K", ",", "V", "extends", "Comparable", "<", "V", ">", ">", "Map", "<", "K", ",", "V", ">", "sortByValue", "(", "Map", "<", "K", ",", "V", ">", "map", ")", "{", "return", "sort", "(", "map", ",", "comparing", "(", "map", "::", "get", ")", ")", ";", "}" ]
Sort by value map. @param <K> the type parameter @param <V> the type parameter @param map the map @return the map
[ "Sort", "by", "value", "map", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/datastructure/JMMap.java#L456-L459
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.listUsageMetricsAsync
public ServiceFuture<List<PoolUsageMetrics>> listUsageMetricsAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions, final ListOperationCallback<PoolUsageMetrics> serviceCallback) { """ Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. @param poolListUsageMetricsOptions Additional parameters for the operation @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return AzureServiceFuture.fromHeaderPageResponse( listUsageMetricsSinglePageAsync(poolListUsageMetricsOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>> call(String nextPageLink) { PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null; if (poolListUsageMetricsOptions != null) { poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions(); poolListUsageMetricsNextOptions.withClientRequestId(poolListUsageMetricsOptions.clientRequestId()); poolListUsageMetricsNextOptions.withReturnClientRequestId(poolListUsageMetricsOptions.returnClientRequestId()); poolListUsageMetricsNextOptions.withOcpDate(poolListUsageMetricsOptions.ocpDate()); } return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions); } }, serviceCallback); }
java
public ServiceFuture<List<PoolUsageMetrics>> listUsageMetricsAsync(final PoolListUsageMetricsOptions poolListUsageMetricsOptions, final ListOperationCallback<PoolUsageMetrics> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listUsageMetricsSinglePageAsync(poolListUsageMetricsOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>> call(String nextPageLink) { PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null; if (poolListUsageMetricsOptions != null) { poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions(); poolListUsageMetricsNextOptions.withClientRequestId(poolListUsageMetricsOptions.clientRequestId()); poolListUsageMetricsNextOptions.withReturnClientRequestId(poolListUsageMetricsOptions.returnClientRequestId()); poolListUsageMetricsNextOptions.withOcpDate(poolListUsageMetricsOptions.ocpDate()); } return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "PoolUsageMetrics", ">", ">", "listUsageMetricsAsync", "(", "final", "PoolListUsageMetricsOptions", "poolListUsageMetricsOptions", ",", "final", "ListOperationCallback", "<", "PoolUsageMetrics", ">", "serviceCallback", ")", "{", "return", "AzureServiceFuture", ".", "fromHeaderPageResponse", "(", "listUsageMetricsSinglePageAsync", "(", "poolListUsageMetricsOptions", ")", ",", "new", "Func1", "<", "String", ",", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "PoolUsageMetrics", ">", ",", "PoolListUsageMetricsHeaders", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "PoolUsageMetrics", ">", ",", "PoolListUsageMetricsHeaders", ">", ">", "call", "(", "String", "nextPageLink", ")", "{", "PoolListUsageMetricsNextOptions", "poolListUsageMetricsNextOptions", "=", "null", ";", "if", "(", "poolListUsageMetricsOptions", "!=", "null", ")", "{", "poolListUsageMetricsNextOptions", "=", "new", "PoolListUsageMetricsNextOptions", "(", ")", ";", "poolListUsageMetricsNextOptions", ".", "withClientRequestId", "(", "poolListUsageMetricsOptions", ".", "clientRequestId", "(", ")", ")", ";", "poolListUsageMetricsNextOptions", ".", "withReturnClientRequestId", "(", "poolListUsageMetricsOptions", ".", "returnClientRequestId", "(", ")", ")", ";", "poolListUsageMetricsNextOptions", ".", "withOcpDate", "(", "poolListUsageMetricsOptions", ".", "ocpDate", "(", ")", ")", ";", "}", "return", "listUsageMetricsNextSinglePageAsync", "(", "nextPageLink", ",", "poolListUsageMetricsNextOptions", ")", ";", "}", "}", ",", "serviceCallback", ")", ";", "}" ]
Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. @param poolListUsageMetricsOptions Additional parameters for the operation @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Lists", "the", "usage", "metrics", "aggregated", "by", "pool", "across", "individual", "time", "intervals", "for", "the", "specified", "account", ".", "If", "you", "do", "not", "specify", "a", "$filter", "clause", "including", "a", "poolId", "the", "response", "includes", "all", "pools", "that", "existed", "in", "the", "account", "in", "the", "time", "range", "of", "the", "returned", "aggregation", "intervals", ".", "If", "you", "do", "not", "specify", "a", "$filter", "clause", "including", "a", "startTime", "or", "endTime", "these", "filters", "default", "to", "the", "start", "and", "end", "times", "of", "the", "last", "aggregation", "interval", "currently", "available", ";", "that", "is", "only", "the", "last", "aggregation", "interval", "is", "returned", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L336-L353
rimerosolutions/ant-git-tasks
src/main/java/com/rimerosolutions/ant/git/AbstractGitTask.java
AbstractGitTask.setUri
public void setUri(String uri) { """ Sets the git repository uri @antdoc.notrequired @param uri The repository uri """ if (GitTaskUtils.isNullOrBlankString(uri)) { throw new BuildException("Can't set null URI attribute."); } if (this.uri == null) { try { new URIish(uri); this.uri = uri; } catch (URISyntaxException e) { throw new BuildException(String.format("Invalid URI '%s'.", uri), e); } } }
java
public void setUri(String uri) { if (GitTaskUtils.isNullOrBlankString(uri)) { throw new BuildException("Can't set null URI attribute."); } if (this.uri == null) { try { new URIish(uri); this.uri = uri; } catch (URISyntaxException e) { throw new BuildException(String.format("Invalid URI '%s'.", uri), e); } } }
[ "public", "void", "setUri", "(", "String", "uri", ")", "{", "if", "(", "GitTaskUtils", ".", "isNullOrBlankString", "(", "uri", ")", ")", "{", "throw", "new", "BuildException", "(", "\"Can't set null URI attribute.\"", ")", ";", "}", "if", "(", "this", ".", "uri", "==", "null", ")", "{", "try", "{", "new", "URIish", "(", "uri", ")", ";", "this", ".", "uri", "=", "uri", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "BuildException", "(", "String", ".", "format", "(", "\"Invalid URI '%s'.\"", ",", "uri", ")", ",", "e", ")", ";", "}", "}", "}" ]
Sets the git repository uri @antdoc.notrequired @param uri The repository uri
[ "Sets", "the", "git", "repository", "uri" ]
train
https://github.com/rimerosolutions/ant-git-tasks/blob/bfb32fe68afe6b9dcfd0a5194497d748ef3e8a6f/src/main/java/com/rimerosolutions/ant/git/AbstractGitTask.java#L122-L135
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/EditManager.java
EditManager.addPrefsDirective
public static void addPrefsDirective(Element plfNode, String attributeName, IPerson person) throws PortalException { """ Create and append a user preferences edit directive to the edit set if not there. This only records that the attribute was changed. The value will be in the user preferences object for the user. """ addDirective(plfNode, attributeName, Constants.ELM_PREF, person); }
java
public static void addPrefsDirective(Element plfNode, String attributeName, IPerson person) throws PortalException { addDirective(plfNode, attributeName, Constants.ELM_PREF, person); }
[ "public", "static", "void", "addPrefsDirective", "(", "Element", "plfNode", ",", "String", "attributeName", ",", "IPerson", "person", ")", "throws", "PortalException", "{", "addDirective", "(", "plfNode", ",", "attributeName", ",", "Constants", ".", "ELM_PREF", ",", "person", ")", ";", "}" ]
Create and append a user preferences edit directive to the edit set if not there. This only records that the attribute was changed. The value will be in the user preferences object for the user.
[ "Create", "and", "append", "a", "user", "preferences", "edit", "directive", "to", "the", "edit", "set", "if", "not", "there", ".", "This", "only", "records", "that", "the", "attribute", "was", "changed", ".", "The", "value", "will", "be", "in", "the", "user", "preferences", "object", "for", "the", "user", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/EditManager.java#L99-L102
Azure/azure-sdk-for-java
datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java
ServicesInner.beginUpdate
public DataMigrationServiceInner beginUpdate(String groupName, String serviceName, DataMigrationServiceInner parameters) { """ Create or update DMS Service Instance. The services resource is the top-level resource that represents the Data Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). @param groupName Name of the resource group @param serviceName Name of the service @param parameters Information about the service @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DataMigrationServiceInner object if successful. """ return beginUpdateWithServiceResponseAsync(groupName, serviceName, parameters).toBlocking().single().body(); }
java
public DataMigrationServiceInner beginUpdate(String groupName, String serviceName, DataMigrationServiceInner parameters) { return beginUpdateWithServiceResponseAsync(groupName, serviceName, parameters).toBlocking().single().body(); }
[ "public", "DataMigrationServiceInner", "beginUpdate", "(", "String", "groupName", ",", "String", "serviceName", ",", "DataMigrationServiceInner", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "groupName", ",", "serviceName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or update DMS Service Instance. The services resource is the top-level resource that represents the Data Migration Service. The PATCH method updates an existing service. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). @param groupName Name of the resource group @param serviceName Name of the service @param parameters Information about the service @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DataMigrationServiceInner object if successful.
[ "Create", "or", "update", "DMS", "Service", "Instance", ".", "The", "services", "resource", "is", "the", "top", "-", "level", "resource", "that", "represents", "the", "Data", "Migration", "Service", ".", "The", "PATCH", "method", "updates", "an", "existing", "service", ".", "This", "method", "can", "change", "the", "kind", "SKU", "and", "network", "of", "the", "service", "but", "if", "tasks", "are", "currently", "running", "(", "i", ".", "e", ".", "the", "service", "is", "busy", ")", "this", "will", "fail", "with", "400", "Bad", "Request", "(", "ServiceIsBusy", ")", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L842-L844
m-m-m/util
sandbox/src/main/java/net/sf/mmm/util/xml/NamespaceContextImpl.java
NamespaceContextImpl.setNamespace
public void setNamespace(String prefix, String uri) { """ This method is used to declare a namespace in this context. @param prefix is the prefix for the namespace. @param uri is the URI of the namespace. """ this.prefix2namespace.put(prefix, uri); this.namespace2prefix.put(uri, prefix); }
java
public void setNamespace(String prefix, String uri) { this.prefix2namespace.put(prefix, uri); this.namespace2prefix.put(uri, prefix); }
[ "public", "void", "setNamespace", "(", "String", "prefix", ",", "String", "uri", ")", "{", "this", ".", "prefix2namespace", ".", "put", "(", "prefix", ",", "uri", ")", ";", "this", ".", "namespace2prefix", ".", "put", "(", "uri", ",", "prefix", ")", ";", "}" ]
This method is used to declare a namespace in this context. @param prefix is the prefix for the namespace. @param uri is the URI of the namespace.
[ "This", "method", "is", "used", "to", "declare", "a", "namespace", "in", "this", "context", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/sandbox/src/main/java/net/sf/mmm/util/xml/NamespaceContextImpl.java#L89-L93
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/WServlet.java
WServlet.createServletHelper
protected WServletHelper createServletHelper(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) { """ Create a support class to coordinate the web request. @param httpServletRequest the request being processed @param httpServletResponse the servlet response @return the servlet helper """ LOG.debug("Creating a new WServletHelper instance"); WServletHelper helper = new WServletHelper(this, httpServletRequest, httpServletResponse); return helper; }
java
protected WServletHelper createServletHelper(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) { LOG.debug("Creating a new WServletHelper instance"); WServletHelper helper = new WServletHelper(this, httpServletRequest, httpServletResponse); return helper; }
[ "protected", "WServletHelper", "createServletHelper", "(", "final", "HttpServletRequest", "httpServletRequest", ",", "final", "HttpServletResponse", "httpServletResponse", ")", "{", "LOG", ".", "debug", "(", "\"Creating a new WServletHelper instance\"", ")", ";", "WServletHelper", "helper", "=", "new", "WServletHelper", "(", "this", ",", "httpServletRequest", ",", "httpServletResponse", ")", ";", "return", "helper", ";", "}" ]
Create a support class to coordinate the web request. @param httpServletRequest the request being processed @param httpServletResponse the servlet response @return the servlet helper
[ "Create", "a", "support", "class", "to", "coordinate", "the", "web", "request", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/WServlet.java#L189-L194
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/QuickSelect.java
QuickSelect.selectExcludingZeros
public static double selectExcludingZeros(final double[] arr, final int nonZeros, final int pivot) { """ Gets the 1-based kth order statistic from the array excluding any zero values in the array. Warning! This changes the ordering of elements in the given array! @param arr The hash array. @param nonZeros The number of non-zero values in the array. @param pivot The 1-based index of the value that is chosen as the pivot for the array. After the operation all values below this 1-based index will be less than this value and all values above this index will be greater. The 0-based index of the pivot will be pivot+arr.length-nonZeros-1. @return The value of the smallest (N)th element excluding zeros, where N is 1-based. """ if (pivot > nonZeros) { return 0L; } final int arrSize = arr.length; final int zeros = arrSize - nonZeros; final int adjK = (pivot + zeros) - 1; return select(arr, 0, arrSize - 1, adjK); }
java
public static double selectExcludingZeros(final double[] arr, final int nonZeros, final int pivot) { if (pivot > nonZeros) { return 0L; } final int arrSize = arr.length; final int zeros = arrSize - nonZeros; final int adjK = (pivot + zeros) - 1; return select(arr, 0, arrSize - 1, adjK); }
[ "public", "static", "double", "selectExcludingZeros", "(", "final", "double", "[", "]", "arr", ",", "final", "int", "nonZeros", ",", "final", "int", "pivot", ")", "{", "if", "(", "pivot", ">", "nonZeros", ")", "{", "return", "0L", ";", "}", "final", "int", "arrSize", "=", "arr", ".", "length", ";", "final", "int", "zeros", "=", "arrSize", "-", "nonZeros", ";", "final", "int", "adjK", "=", "(", "pivot", "+", "zeros", ")", "-", "1", ";", "return", "select", "(", "arr", ",", "0", ",", "arrSize", "-", "1", ",", "adjK", ")", ";", "}" ]
Gets the 1-based kth order statistic from the array excluding any zero values in the array. Warning! This changes the ordering of elements in the given array! @param arr The hash array. @param nonZeros The number of non-zero values in the array. @param pivot The 1-based index of the value that is chosen as the pivot for the array. After the operation all values below this 1-based index will be less than this value and all values above this index will be greater. The 0-based index of the pivot will be pivot+arr.length-nonZeros-1. @return The value of the smallest (N)th element excluding zeros, where N is 1-based.
[ "Gets", "the", "1", "-", "based", "kth", "order", "statistic", "from", "the", "array", "excluding", "any", "zero", "values", "in", "the", "array", ".", "Warning!", "This", "changes", "the", "ordering", "of", "elements", "in", "the", "given", "array!" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuickSelect.java#L181-L189
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java
RouteTablesInner.createOrUpdateAsync
public Observable<RouteTableInner> createOrUpdateAsync(String resourceGroupName, String routeTableName, RouteTableInner parameters) { """ Create or updates a route table in a specified resource group. @param resourceGroupName The name of the resource group. @param routeTableName The name of the route table. @param parameters Parameters supplied to the create or update route table operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, parameters).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() { @Override public RouteTableInner call(ServiceResponse<RouteTableInner> response) { return response.body(); } }); }
java
public Observable<RouteTableInner> createOrUpdateAsync(String resourceGroupName, String routeTableName, RouteTableInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, parameters).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() { @Override public RouteTableInner call(ServiceResponse<RouteTableInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RouteTableInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "routeTableName", ",", "RouteTableInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "routeTableName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "RouteTableInner", ">", ",", "RouteTableInner", ">", "(", ")", "{", "@", "Override", "public", "RouteTableInner", "call", "(", "ServiceResponse", "<", "RouteTableInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or updates a route table in a specified resource group. @param resourceGroupName The name of the resource group. @param routeTableName The name of the route table. @param parameters Parameters supplied to the create or update route table operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "or", "updates", "a", "route", "table", "in", "a", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java#L471-L478
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/inmemory/InMemoryLookupTable.java
InMemoryLookupTable.putVector
@Override public void putVector(String word, INDArray vector) { """ Inserts a word vector @param word the word to insert @param vector the vector to insert """ if (word == null) throw new IllegalArgumentException("No null words allowed"); if (vector == null) throw new IllegalArgumentException("No null vectors allowed"); int idx = vocab.indexOf(word); syn0.slice(idx).assign(vector); }
java
@Override public void putVector(String word, INDArray vector) { if (word == null) throw new IllegalArgumentException("No null words allowed"); if (vector == null) throw new IllegalArgumentException("No null vectors allowed"); int idx = vocab.indexOf(word); syn0.slice(idx).assign(vector); }
[ "@", "Override", "public", "void", "putVector", "(", "String", "word", ",", "INDArray", "vector", ")", "{", "if", "(", "word", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"No null words allowed\"", ")", ";", "if", "(", "vector", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"No null vectors allowed\"", ")", ";", "int", "idx", "=", "vocab", ".", "indexOf", "(", "word", ")", ";", "syn0", ".", "slice", "(", "idx", ")", ".", "assign", "(", "vector", ")", ";", "}" ]
Inserts a word vector @param word the word to insert @param vector the vector to insert
[ "Inserts", "a", "word", "vector" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/inmemory/InMemoryLookupTable.java#L496-L505
OpenTSDB/opentsdb
src/utils/Config.java
Config.overrideConfig
public void overrideConfig(final String property, final String value) { """ Allows for modifying properties after creation or loading. WARNING: This should only be used on initialization and is meant for command line overrides. Also note that it will reset all static config variables when called. @param property The name of the property to override @param value The value to store """ properties.put(property, value); loadStaticVariables(); }
java
public void overrideConfig(final String property, final String value) { properties.put(property, value); loadStaticVariables(); }
[ "public", "void", "overrideConfig", "(", "final", "String", "property", ",", "final", "String", "value", ")", "{", "properties", ".", "put", "(", "property", ",", "value", ")", ";", "loadStaticVariables", "(", ")", ";", "}" ]
Allows for modifying properties after creation or loading. WARNING: This should only be used on initialization and is meant for command line overrides. Also note that it will reset all static config variables when called. @param property The name of the property to override @param value The value to store
[ "Allows", "for", "modifying", "properties", "after", "creation", "or", "loading", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/Config.java#L317-L320
mpetazzoni/ttorrent
ttorrent-tracker/src/main/java/com/turn/ttorrent/tracker/TrackerRequestProcessor.java
TrackerRequestProcessor.serveError
private void serveError(Status status, ErrorMessage.FailureReason reason, RequestHandler requestHandler) throws IOException { """ Write a tracker failure reason code to the response with the given HTTP status code. @param status The HTTP status code to return. @param reason The failure reason reported by the tracker. """ this.serveError(status, reason.getMessage(), requestHandler); }
java
private void serveError(Status status, ErrorMessage.FailureReason reason, RequestHandler requestHandler) throws IOException { this.serveError(status, reason.getMessage(), requestHandler); }
[ "private", "void", "serveError", "(", "Status", "status", ",", "ErrorMessage", ".", "FailureReason", "reason", ",", "RequestHandler", "requestHandler", ")", "throws", "IOException", "{", "this", ".", "serveError", "(", "status", ",", "reason", ".", "getMessage", "(", ")", ",", "requestHandler", ")", ";", "}" ]
Write a tracker failure reason code to the response with the given HTTP status code. @param status The HTTP status code to return. @param reason The failure reason reported by the tracker.
[ "Write", "a", "tracker", "failure", "reason", "code", "to", "the", "response", "with", "the", "given", "HTTP", "status", "code", "." ]
train
https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-tracker/src/main/java/com/turn/ttorrent/tracker/TrackerRequestProcessor.java#L311-L313
ical4j/ical4j
src/main/java/net/fortuna/ical4j/model/component/VEvent.java
VEvent.getConsumedTime
public final PeriodList getConsumedTime(final Date rangeStart, final Date rangeEnd) { """ Returns a normalised list of periods representing the consumed time for this event. @param rangeStart the start of a range @param rangeEnd the end of a range @return a normalised list of periods representing consumed time for this event @see VEvent#getConsumedTime(Date, Date, boolean) """ return getConsumedTime(rangeStart, rangeEnd, true); }
java
public final PeriodList getConsumedTime(final Date rangeStart, final Date rangeEnd) { return getConsumedTime(rangeStart, rangeEnd, true); }
[ "public", "final", "PeriodList", "getConsumedTime", "(", "final", "Date", "rangeStart", ",", "final", "Date", "rangeEnd", ")", "{", "return", "getConsumedTime", "(", "rangeStart", ",", "rangeEnd", ",", "true", ")", ";", "}" ]
Returns a normalised list of periods representing the consumed time for this event. @param rangeStart the start of a range @param rangeEnd the end of a range @return a normalised list of periods representing consumed time for this event @see VEvent#getConsumedTime(Date, Date, boolean)
[ "Returns", "a", "normalised", "list", "of", "periods", "representing", "the", "consumed", "time", "for", "this", "event", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/model/component/VEvent.java#L436-L439
google/error-prone
check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java
SuggestedFixes.qualifyType
public static String qualifyType(VisitorState state, SuggestedFix.Builder fix, String typeName) { """ Returns a human-friendly name of the given {@code typeName} for use in fixes. <p>This should be used if the type may not be loaded. """ for (int startOfClass = typeName.indexOf('.'); startOfClass > 0; startOfClass = typeName.indexOf('.', startOfClass + 1)) { int endOfClass = typeName.indexOf('.', startOfClass + 1); if (endOfClass < 0) { endOfClass = typeName.length(); } if (!Character.isUpperCase(typeName.charAt(startOfClass + 1))) { continue; } String className = typeName.substring(startOfClass + 1); Symbol found = FindIdentifiers.findIdent(className, state, KindSelector.VAL_TYP); // No clashing name: import it and return. if (found == null) { fix.addImport(typeName.substring(0, endOfClass)); return className; } // Type already imported. if (found.getQualifiedName().contentEquals(typeName)) { return className; } } return typeName; }
java
public static String qualifyType(VisitorState state, SuggestedFix.Builder fix, String typeName) { for (int startOfClass = typeName.indexOf('.'); startOfClass > 0; startOfClass = typeName.indexOf('.', startOfClass + 1)) { int endOfClass = typeName.indexOf('.', startOfClass + 1); if (endOfClass < 0) { endOfClass = typeName.length(); } if (!Character.isUpperCase(typeName.charAt(startOfClass + 1))) { continue; } String className = typeName.substring(startOfClass + 1); Symbol found = FindIdentifiers.findIdent(className, state, KindSelector.VAL_TYP); // No clashing name: import it and return. if (found == null) { fix.addImport(typeName.substring(0, endOfClass)); return className; } // Type already imported. if (found.getQualifiedName().contentEquals(typeName)) { return className; } } return typeName; }
[ "public", "static", "String", "qualifyType", "(", "VisitorState", "state", ",", "SuggestedFix", ".", "Builder", "fix", ",", "String", "typeName", ")", "{", "for", "(", "int", "startOfClass", "=", "typeName", ".", "indexOf", "(", "'", "'", ")", ";", "startOfClass", ">", "0", ";", "startOfClass", "=", "typeName", ".", "indexOf", "(", "'", "'", ",", "startOfClass", "+", "1", ")", ")", "{", "int", "endOfClass", "=", "typeName", ".", "indexOf", "(", "'", "'", ",", "startOfClass", "+", "1", ")", ";", "if", "(", "endOfClass", "<", "0", ")", "{", "endOfClass", "=", "typeName", ".", "length", "(", ")", ";", "}", "if", "(", "!", "Character", ".", "isUpperCase", "(", "typeName", ".", "charAt", "(", "startOfClass", "+", "1", ")", ")", ")", "{", "continue", ";", "}", "String", "className", "=", "typeName", ".", "substring", "(", "startOfClass", "+", "1", ")", ";", "Symbol", "found", "=", "FindIdentifiers", ".", "findIdent", "(", "className", ",", "state", ",", "KindSelector", ".", "VAL_TYP", ")", ";", "// No clashing name: import it and return.", "if", "(", "found", "==", "null", ")", "{", "fix", ".", "addImport", "(", "typeName", ".", "substring", "(", "0", ",", "endOfClass", ")", ")", ";", "return", "className", ";", "}", "// Type already imported.", "if", "(", "found", ".", "getQualifiedName", "(", ")", ".", "contentEquals", "(", "typeName", ")", ")", "{", "return", "className", ";", "}", "}", "return", "typeName", ";", "}" ]
Returns a human-friendly name of the given {@code typeName} for use in fixes. <p>This should be used if the type may not be loaded.
[ "Returns", "a", "human", "-", "friendly", "name", "of", "the", "given", "{", "@code", "typeName", "}", "for", "use", "in", "fixes", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java#L336-L360
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.writeString
public static void writeString(String s, ByteBuffer buf) { """ Writes a string to buf. The length of the string is written first, followed by the chars (as single-byte values). Multi-byte values are truncated: only the lower byte of each multi-byte char is written, similar to {@link DataOutput#writeChars(String)}. @param s the string @param buf the buffer """ buf.put((byte)(s != null? 1 : 0)); if(s != null) { byte[] bytes=s.getBytes(); writeInt(bytes.length, buf); buf.put(bytes); } }
java
public static void writeString(String s, ByteBuffer buf) { buf.put((byte)(s != null? 1 : 0)); if(s != null) { byte[] bytes=s.getBytes(); writeInt(bytes.length, buf); buf.put(bytes); } }
[ "public", "static", "void", "writeString", "(", "String", "s", ",", "ByteBuffer", "buf", ")", "{", "buf", ".", "put", "(", "(", "byte", ")", "(", "s", "!=", "null", "?", "1", ":", "0", ")", ")", ";", "if", "(", "s", "!=", "null", ")", "{", "byte", "[", "]", "bytes", "=", "s", ".", "getBytes", "(", ")", ";", "writeInt", "(", "bytes", ".", "length", ",", "buf", ")", ";", "buf", ".", "put", "(", "bytes", ")", ";", "}", "}" ]
Writes a string to buf. The length of the string is written first, followed by the chars (as single-byte values). Multi-byte values are truncated: only the lower byte of each multi-byte char is written, similar to {@link DataOutput#writeChars(String)}. @param s the string @param buf the buffer
[ "Writes", "a", "string", "to", "buf", ".", "The", "length", "of", "the", "string", "is", "written", "first", "followed", "by", "the", "chars", "(", "as", "single", "-", "byte", "values", ")", ".", "Multi", "-", "byte", "values", "are", "truncated", ":", "only", "the", "lower", "byte", "of", "each", "multi", "-", "byte", "char", "is", "written", "similar", "to", "{" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L600-L607
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/util/NumUtils.java
NumUtils.longVal
public static long longVal(String val, long defaultValue) { """ 转换为long类型数据 @param val 需要转换的值 @param defaultValue 默认值 @return long """ try { return NumberUtils.createNumber(val).longValue(); } catch (Exception e) { log.warn("longVal(String, int) throw {}, return defaultValue = {}", e, defaultValue); return defaultValue; } }
java
public static long longVal(String val, long defaultValue) { try { return NumberUtils.createNumber(val).longValue(); } catch (Exception e) { log.warn("longVal(String, int) throw {}, return defaultValue = {}", e, defaultValue); return defaultValue; } }
[ "public", "static", "long", "longVal", "(", "String", "val", ",", "long", "defaultValue", ")", "{", "try", "{", "return", "NumberUtils", ".", "createNumber", "(", "val", ")", ".", "longValue", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "warn", "(", "\"longVal(String, int) throw {}, return defaultValue = {}\"", ",", "e", ",", "defaultValue", ")", ";", "return", "defaultValue", ";", "}", "}" ]
转换为long类型数据 @param val 需要转换的值 @param defaultValue 默认值 @return long
[ "转换为long类型数据" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/util/NumUtils.java#L66-L73
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.withRemoteSane
public static SaneSession withRemoteSane(InetAddress saneAddress, long timeout, TimeUnit timeUnit) throws IOException { """ Establishes a connection to the SANE daemon running on the given host on the default SANE port with the given connection timeout. """ return withRemoteSane(saneAddress, DEFAULT_PORT, timeout, timeUnit, 0, TimeUnit.MILLISECONDS); }
java
public static SaneSession withRemoteSane(InetAddress saneAddress, long timeout, TimeUnit timeUnit) throws IOException { return withRemoteSane(saneAddress, DEFAULT_PORT, timeout, timeUnit, 0, TimeUnit.MILLISECONDS); }
[ "public", "static", "SaneSession", "withRemoteSane", "(", "InetAddress", "saneAddress", ",", "long", "timeout", ",", "TimeUnit", "timeUnit", ")", "throws", "IOException", "{", "return", "withRemoteSane", "(", "saneAddress", ",", "DEFAULT_PORT", ",", "timeout", ",", "timeUnit", ",", "0", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}" ]
Establishes a connection to the SANE daemon running on the given host on the default SANE port with the given connection timeout.
[ "Establishes", "a", "connection", "to", "the", "SANE", "daemon", "running", "on", "the", "given", "host", "on", "the", "default", "SANE", "port", "with", "the", "given", "connection", "timeout", "." ]
train
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L77-L80
alkacon/opencms-core
src/org/opencms/db/CmsExportPointDriver.java
CmsExportPointDriver.getExportPointFile
protected File getExportPointFile(String rootPath, String exportpoint) { """ Returns the File for the given export point resource.<p> @param rootPath name of a file in the VFS @param exportpoint the name of the export point @return the File for the given export point resource """ StringBuffer exportpath = new StringBuffer(128); exportpath.append(m_exportpointLookupMap.get(exportpoint)); exportpath.append(rootPath.substring(exportpoint.length())); return new File(exportpath.toString()); }
java
protected File getExportPointFile(String rootPath, String exportpoint) { StringBuffer exportpath = new StringBuffer(128); exportpath.append(m_exportpointLookupMap.get(exportpoint)); exportpath.append(rootPath.substring(exportpoint.length())); return new File(exportpath.toString()); }
[ "protected", "File", "getExportPointFile", "(", "String", "rootPath", ",", "String", "exportpoint", ")", "{", "StringBuffer", "exportpath", "=", "new", "StringBuffer", "(", "128", ")", ";", "exportpath", ".", "append", "(", "m_exportpointLookupMap", ".", "get", "(", "exportpoint", ")", ")", ";", "exportpath", ".", "append", "(", "rootPath", ".", "substring", "(", "exportpoint", ".", "length", "(", ")", ")", ")", ";", "return", "new", "File", "(", "exportpath", ".", "toString", "(", ")", ")", ";", "}" ]
Returns the File for the given export point resource.<p> @param rootPath name of a file in the VFS @param exportpoint the name of the export point @return the File for the given export point resource
[ "Returns", "the", "File", "for", "the", "given", "export", "point", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsExportPointDriver.java#L174-L180
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/ZoneInfo.java
ZoneInfo.of
public static ZoneInfo of(String name, String dnsName, String description) { """ Returns a ZoneInfo object with assigned {@code name}, {@code dnsName} and {@code description}. """ return new BuilderImpl(name).setDnsName(dnsName).setDescription(description).build(); }
java
public static ZoneInfo of(String name, String dnsName, String description) { return new BuilderImpl(name).setDnsName(dnsName).setDescription(description).build(); }
[ "public", "static", "ZoneInfo", "of", "(", "String", "name", ",", "String", "dnsName", ",", "String", "description", ")", "{", "return", "new", "BuilderImpl", "(", "name", ")", ".", "setDnsName", "(", "dnsName", ")", ".", "setDescription", "(", "description", ")", ".", "build", "(", ")", ";", "}" ]
Returns a ZoneInfo object with assigned {@code name}, {@code dnsName} and {@code description}.
[ "Returns", "a", "ZoneInfo", "object", "with", "assigned", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/ZoneInfo.java#L180-L182
dita-ot/dita-ot
src/main/plugins/org.dita.pdf2/src/com/idiominc/ws/opentopic/fo/index2/IndexPreprocessor.java
IndexPreprocessor.processCurrNode
private Node[] processCurrNode(final Node theNode, final Document theTargetDocument, final IndexEntryFoundListener theIndexEntryFoundListener) { """ Processes curr node. Copies node to the target document if its is not a text node of index entry element. Otherwise it process it and creates nodes with "prefix" in given "namespace_url" from the parsed index entry text. @param theNode node to process @param theTargetDocument target document used to import and create nodes @param theIndexEntryFoundListener listener to notify that new index entry was found @return the array of nodes after processing input node """ final NodeList childNodes = theNode.getChildNodes(); if (checkElementName(theNode) && !excludedDraftSection.peek()) { return processIndexNode(theNode, theTargetDocument, theIndexEntryFoundListener); } else { final Node result = theTargetDocument.importNode(theNode, false); if (!includeDraft && checkDraftNode(theNode)) { excludedDraftSection.add(true); } for (int i = 0; i < childNodes.getLength(); i++) { final Node[] processedNodes = processCurrNode(childNodes.item(i), theTargetDocument, theIndexEntryFoundListener); for (final Node node : processedNodes) { result.appendChild(node); } } if (!includeDraft && checkDraftNode(theNode)) { excludedDraftSection.pop(); } return new Node[]{result}; } }
java
private Node[] processCurrNode(final Node theNode, final Document theTargetDocument, final IndexEntryFoundListener theIndexEntryFoundListener) { final NodeList childNodes = theNode.getChildNodes(); if (checkElementName(theNode) && !excludedDraftSection.peek()) { return processIndexNode(theNode, theTargetDocument, theIndexEntryFoundListener); } else { final Node result = theTargetDocument.importNode(theNode, false); if (!includeDraft && checkDraftNode(theNode)) { excludedDraftSection.add(true); } for (int i = 0; i < childNodes.getLength(); i++) { final Node[] processedNodes = processCurrNode(childNodes.item(i), theTargetDocument, theIndexEntryFoundListener); for (final Node node : processedNodes) { result.appendChild(node); } } if (!includeDraft && checkDraftNode(theNode)) { excludedDraftSection.pop(); } return new Node[]{result}; } }
[ "private", "Node", "[", "]", "processCurrNode", "(", "final", "Node", "theNode", ",", "final", "Document", "theTargetDocument", ",", "final", "IndexEntryFoundListener", "theIndexEntryFoundListener", ")", "{", "final", "NodeList", "childNodes", "=", "theNode", ".", "getChildNodes", "(", ")", ";", "if", "(", "checkElementName", "(", "theNode", ")", "&&", "!", "excludedDraftSection", ".", "peek", "(", ")", ")", "{", "return", "processIndexNode", "(", "theNode", ",", "theTargetDocument", ",", "theIndexEntryFoundListener", ")", ";", "}", "else", "{", "final", "Node", "result", "=", "theTargetDocument", ".", "importNode", "(", "theNode", ",", "false", ")", ";", "if", "(", "!", "includeDraft", "&&", "checkDraftNode", "(", "theNode", ")", ")", "{", "excludedDraftSection", ".", "add", "(", "true", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childNodes", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "final", "Node", "[", "]", "processedNodes", "=", "processCurrNode", "(", "childNodes", ".", "item", "(", "i", ")", ",", "theTargetDocument", ",", "theIndexEntryFoundListener", ")", ";", "for", "(", "final", "Node", "node", ":", "processedNodes", ")", "{", "result", ".", "appendChild", "(", "node", ")", ";", "}", "}", "if", "(", "!", "includeDraft", "&&", "checkDraftNode", "(", "theNode", ")", ")", "{", "excludedDraftSection", ".", "pop", "(", ")", ";", "}", "return", "new", "Node", "[", "]", "{", "result", "}", ";", "}", "}" ]
Processes curr node. Copies node to the target document if its is not a text node of index entry element. Otherwise it process it and creates nodes with "prefix" in given "namespace_url" from the parsed index entry text. @param theNode node to process @param theTargetDocument target document used to import and create nodes @param theIndexEntryFoundListener listener to notify that new index entry was found @return the array of nodes after processing input node
[ "Processes", "curr", "node", ".", "Copies", "node", "to", "the", "target", "document", "if", "its", "is", "not", "a", "text", "node", "of", "index", "entry", "element", ".", "Otherwise", "it", "process", "it", "and", "creates", "nodes", "with", "prefix", "in", "given", "namespace_url", "from", "the", "parsed", "index", "entry", "text", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.pdf2/src/com/idiominc/ws/opentopic/fo/index2/IndexPreprocessor.java#L161-L182
timewalker74/ffmq
core/src/main/java/net/timewalker/ffmq4/utils/md5/MD5.java
MD5.digest
public byte[] digest() { """ Returns array of bytes (16 bytes) representing hash as of the current state of this object. Note: getting a hash does not invalidate the hash object, it only creates a copy of the real state which is finalized. @return Array of 16 bytes, the hash of all updated bytes """ byte bits[]; int index, padlen; int[] count_ints = { (int) (state.count << 3), (int) (state.count >> 29) }; bits = encode(count_ints, 8); index = (int) (state.count & 0x3f); padlen = (index < 56) ? (56 - index) : (120 - index); update(PADDING, 0, padlen); update(bits, 0, 8); return encode(state.state, 16); }
java
public byte[] digest() { byte bits[]; int index, padlen; int[] count_ints = { (int) (state.count << 3), (int) (state.count >> 29) }; bits = encode(count_ints, 8); index = (int) (state.count & 0x3f); padlen = (index < 56) ? (56 - index) : (120 - index); update(PADDING, 0, padlen); update(bits, 0, 8); return encode(state.state, 16); }
[ "public", "byte", "[", "]", "digest", "(", ")", "{", "byte", "bits", "[", "]", ";", "int", "index", ",", "padlen", ";", "int", "[", "]", "count_ints", "=", "{", "(", "int", ")", "(", "state", ".", "count", "<<", "3", ")", ",", "(", "int", ")", "(", "state", ".", "count", ">>", "29", ")", "}", ";", "bits", "=", "encode", "(", "count_ints", ",", "8", ")", ";", "index", "=", "(", "int", ")", "(", "state", ".", "count", "&", "0x3f", ")", ";", "padlen", "=", "(", "index", "<", "56", ")", "?", "(", "56", "-", "index", ")", ":", "(", "120", "-", "index", ")", ";", "update", "(", "PADDING", ",", "0", ",", "padlen", ")", ";", "update", "(", "bits", ",", "0", ",", "8", ")", ";", "return", "encode", "(", "state", ".", "state", ",", "16", ")", ";", "}" ]
Returns array of bytes (16 bytes) representing hash as of the current state of this object. Note: getting a hash does not invalidate the hash object, it only creates a copy of the real state which is finalized. @return Array of 16 bytes, the hash of all updated bytes
[ "Returns", "array", "of", "bytes", "(", "16", "bytes", ")", "representing", "hash", "as", "of", "the", "current", "state", "of", "this", "object", ".", "Note", ":", "getting", "a", "hash", "does", "not", "invalidate", "the", "hash", "object", "it", "only", "creates", "a", "copy", "of", "the", "real", "state", "which", "is", "finalized", "." ]
train
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/utils/md5/MD5.java#L340-L355
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java
ESFilterBuilder.populateFilterClause
private FilterClause populateFilterClause(ComparisonExpression conditionalExpression) { """ Populate filter clause. @param conditionalExpression the conditional expression @return the filter clause """ String property = ((StateFieldPathExpression) conditionalExpression.getLeftExpression()).getPath(1); String condition = conditionalExpression.getComparisonOperator(); Expression rightExpression = conditionalExpression.getRightExpression(); Object value = (rightExpression instanceof InputParameter) ? kunderaQuery.getParametersMap().get( (rightExpression).toParsedText()) : rightExpression.toParsedText(); return (condition != null && property != null) ? kunderaQuery.new FilterClause(property, condition, value, property) : null; }
java
private FilterClause populateFilterClause(ComparisonExpression conditionalExpression) { String property = ((StateFieldPathExpression) conditionalExpression.getLeftExpression()).getPath(1); String condition = conditionalExpression.getComparisonOperator(); Expression rightExpression = conditionalExpression.getRightExpression(); Object value = (rightExpression instanceof InputParameter) ? kunderaQuery.getParametersMap().get( (rightExpression).toParsedText()) : rightExpression.toParsedText(); return (condition != null && property != null) ? kunderaQuery.new FilterClause(property, condition, value, property) : null; }
[ "private", "FilterClause", "populateFilterClause", "(", "ComparisonExpression", "conditionalExpression", ")", "{", "String", "property", "=", "(", "(", "StateFieldPathExpression", ")", "conditionalExpression", ".", "getLeftExpression", "(", ")", ")", ".", "getPath", "(", "1", ")", ";", "String", "condition", "=", "conditionalExpression", ".", "getComparisonOperator", "(", ")", ";", "Expression", "rightExpression", "=", "conditionalExpression", ".", "getRightExpression", "(", ")", ";", "Object", "value", "=", "(", "rightExpression", "instanceof", "InputParameter", ")", "?", "kunderaQuery", ".", "getParametersMap", "(", ")", ".", "get", "(", "(", "rightExpression", ")", ".", "toParsedText", "(", ")", ")", ":", "rightExpression", ".", "toParsedText", "(", ")", ";", "return", "(", "condition", "!=", "null", "&&", "property", "!=", "null", ")", "?", "kunderaQuery", ".", "new", "FilterClause", "(", "property", ",", "condition", ",", "value", ",", "property", ")", ":", "null", ";", "}" ]
Populate filter clause. @param conditionalExpression the conditional expression @return the filter clause
[ "Populate", "filter", "clause", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java#L394-L404
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRConsole.java
GVRConsole.writeLine
public void writeLine(String pattern, Object... parameters) { """ Write a message to the console. @param pattern A {@link String#format(String, Object...)} pattern @param parameters Optional parameters to plug into the pattern """ String line = (parameters == null || parameters.length == 0) ? pattern : String.format(pattern, parameters); lines.add(0, line); // we'll write bottom to top, then purge unwritten // lines from end updateHUD(); }
java
public void writeLine(String pattern, Object... parameters) { String line = (parameters == null || parameters.length == 0) ? pattern : String.format(pattern, parameters); lines.add(0, line); // we'll write bottom to top, then purge unwritten // lines from end updateHUD(); }
[ "public", "void", "writeLine", "(", "String", "pattern", ",", "Object", "...", "parameters", ")", "{", "String", "line", "=", "(", "parameters", "==", "null", "||", "parameters", ".", "length", "==", "0", ")", "?", "pattern", ":", "String", ".", "format", "(", "pattern", ",", "parameters", ")", ";", "lines", ".", "add", "(", "0", ",", "line", ")", ";", "// we'll write bottom to top, then purge unwritten", "// lines from end", "updateHUD", "(", ")", ";", "}" ]
Write a message to the console. @param pattern A {@link String#format(String, Object...)} pattern @param parameters Optional parameters to plug into the pattern
[ "Write", "a", "message", "to", "the", "console", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRConsole.java#L178-L184
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javah/Main.java
Main.run
public static int run(String[] args, PrintWriter out) { """ Entry point that does <i>not</i> call System.exit. @param args command line arguments @param out output stream @return an exit code. 0 means success, non-zero means an error occurred. """ JavahTask t = new JavahTask(); t.setLog(out); return t.run(args); }
java
public static int run(String[] args, PrintWriter out) { JavahTask t = new JavahTask(); t.setLog(out); return t.run(args); }
[ "public", "static", "int", "run", "(", "String", "[", "]", "args", ",", "PrintWriter", "out", ")", "{", "JavahTask", "t", "=", "new", "JavahTask", "(", ")", ";", "t", ".", "setLog", "(", "out", ")", ";", "return", "t", ".", "run", "(", "args", ")", ";", "}" ]
Entry point that does <i>not</i> call System.exit. @param args command line arguments @param out output stream @return an exit code. 0 means success, non-zero means an error occurred.
[ "Entry", "point", "that", "does", "<i", ">", "not<", "/", "i", ">", "call", "System", ".", "exit", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javah/Main.java#L56-L60
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java
PoiWorkSheet.createTitleCells
public void createTitleCells(double width, String... strs) { """ Create title cells. @param width the width @param strs the strs """ for (String s : strs) { this.createTitleCell(s, width); } }
java
public void createTitleCells(double width, String... strs) { for (String s : strs) { this.createTitleCell(s, width); } }
[ "public", "void", "createTitleCells", "(", "double", "width", ",", "String", "...", "strs", ")", "{", "for", "(", "String", "s", ":", "strs", ")", "{", "this", ".", "createTitleCell", "(", "s", ",", "width", ")", ";", "}", "}" ]
Create title cells. @param width the width @param strs the strs
[ "Create", "title", "cells", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java#L121-L125
Coveros/selenified
src/main/java/com/coveros/selenified/element/check/wait/WaitForEquals.java
WaitForEquals.selectedValue
public void selectedValue(String expectedValue, double seconds) { """ Waits for the element's selected value equals the provided expected value. If the element isn't present or a select, this will constitute a failure, same as a mismatch. The provided wait time will be used and if the element doesn't have the desired match count at that time, it will fail, and log the issue with a screenshot for traceability and added debugging support. @param expectedValue - the expected input value of the element @param seconds - how many seconds to wait for """ double end = System.currentTimeMillis() + (seconds * 1000); try { elementPresent(seconds); if (!element.is().select()) { throw new TimeoutException(ELEMENT_NOT_SELECT); } while (!element.get().selectedValue().equals(expectedValue) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkSelectedValue(expectedValue, seconds, timeTook); } catch (TimeoutException e) { checkSelectedValue(expectedValue, seconds, seconds); } }
java
public void selectedValue(String expectedValue, double seconds) { double end = System.currentTimeMillis() + (seconds * 1000); try { elementPresent(seconds); if (!element.is().select()) { throw new TimeoutException(ELEMENT_NOT_SELECT); } while (!element.get().selectedValue().equals(expectedValue) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkSelectedValue(expectedValue, seconds, timeTook); } catch (TimeoutException e) { checkSelectedValue(expectedValue, seconds, seconds); } }
[ "public", "void", "selectedValue", "(", "String", "expectedValue", ",", "double", "seconds", ")", "{", "double", "end", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "(", "seconds", "*", "1000", ")", ";", "try", "{", "elementPresent", "(", "seconds", ")", ";", "if", "(", "!", "element", ".", "is", "(", ")", ".", "select", "(", ")", ")", "{", "throw", "new", "TimeoutException", "(", "ELEMENT_NOT_SELECT", ")", ";", "}", "while", "(", "!", "element", ".", "get", "(", ")", ".", "selectedValue", "(", ")", ".", "equals", "(", "expectedValue", ")", "&&", "System", ".", "currentTimeMillis", "(", ")", "<", "end", ")", ";", "double", "timeTook", "=", "Math", ".", "min", "(", "(", "seconds", "*", "1000", ")", "-", "(", "end", "-", "System", ".", "currentTimeMillis", "(", ")", ")", ",", "seconds", "*", "1000", ")", "/", "1000", ";", "checkSelectedValue", "(", "expectedValue", ",", "seconds", ",", "timeTook", ")", ";", "}", "catch", "(", "TimeoutException", "e", ")", "{", "checkSelectedValue", "(", "expectedValue", ",", "seconds", ",", "seconds", ")", ";", "}", "}" ]
Waits for the element's selected value equals the provided expected value. If the element isn't present or a select, this will constitute a failure, same as a mismatch. The provided wait time will be used and if the element doesn't have the desired match count at that time, it will fail, and log the issue with a screenshot for traceability and added debugging support. @param expectedValue - the expected input value of the element @param seconds - how many seconds to wait for
[ "Waits", "for", "the", "element", "s", "selected", "value", "equals", "the", "provided", "expected", "value", ".", "If", "the", "element", "isn", "t", "present", "or", "a", "select", "this", "will", "constitute", "a", "failure", "same", "as", "a", "mismatch", ".", "The", "provided", "wait", "time", "will", "be", "used", "and", "if", "the", "element", "doesn", "t", "have", "the", "desired", "match", "count", "at", "that", "time", "it", "will", "fail", "and", "log", "the", "issue", "with", "a", "screenshot", "for", "traceability", "and", "added", "debugging", "support", "." ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/check/wait/WaitForEquals.java#L460-L473
Netflix/eureka
eureka-client/src/main/java/com/netflix/discovery/shared/Applications.java
Applications.populateInstanceCountMap
public void populateInstanceCountMap(Map<String, AtomicInteger> instanceCountMap) { """ Populates the provided instance count map. The instance count map is used as part of the general app list synchronization mechanism. @param instanceCountMap the map to populate """ for (Application app : this.getRegisteredApplications()) { for (InstanceInfo info : app.getInstancesAsIsFromEureka()) { AtomicInteger instanceCount = instanceCountMap.computeIfAbsent(info.getStatus().name(), k -> new AtomicInteger(0)); instanceCount.incrementAndGet(); } } }
java
public void populateInstanceCountMap(Map<String, AtomicInteger> instanceCountMap) { for (Application app : this.getRegisteredApplications()) { for (InstanceInfo info : app.getInstancesAsIsFromEureka()) { AtomicInteger instanceCount = instanceCountMap.computeIfAbsent(info.getStatus().name(), k -> new AtomicInteger(0)); instanceCount.incrementAndGet(); } } }
[ "public", "void", "populateInstanceCountMap", "(", "Map", "<", "String", ",", "AtomicInteger", ">", "instanceCountMap", ")", "{", "for", "(", "Application", "app", ":", "this", ".", "getRegisteredApplications", "(", ")", ")", "{", "for", "(", "InstanceInfo", "info", ":", "app", ".", "getInstancesAsIsFromEureka", "(", ")", ")", "{", "AtomicInteger", "instanceCount", "=", "instanceCountMap", ".", "computeIfAbsent", "(", "info", ".", "getStatus", "(", ")", ".", "name", "(", ")", ",", "k", "->", "new", "AtomicInteger", "(", "0", ")", ")", ";", "instanceCount", ".", "incrementAndGet", "(", ")", ";", "}", "}", "}" ]
Populates the provided instance count map. The instance count map is used as part of the general app list synchronization mechanism. @param instanceCountMap the map to populate
[ "Populates", "the", "provided", "instance", "count", "map", ".", "The", "instance", "count", "map", "is", "used", "as", "part", "of", "the", "general", "app", "list", "synchronization", "mechanism", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-client/src/main/java/com/netflix/discovery/shared/Applications.java#L246-L254
landawn/AbacusUtil
src/com/landawn/abacus/util/IOUtil.java
IOUtil.map
public static MappedByteBuffer map(File file) { """ Note: copied from Google Guava under Apache License v2. @param file @return """ N.checkArgNotNull(file); return map(file, MapMode.READ_ONLY); }
java
public static MappedByteBuffer map(File file) { N.checkArgNotNull(file); return map(file, MapMode.READ_ONLY); }
[ "public", "static", "MappedByteBuffer", "map", "(", "File", "file", ")", "{", "N", ".", "checkArgNotNull", "(", "file", ")", ";", "return", "map", "(", "file", ",", "MapMode", ".", "READ_ONLY", ")", ";", "}" ]
Note: copied from Google Guava under Apache License v2. @param file @return
[ "Note", ":", "copied", "from", "Google", "Guava", "under", "Apache", "License", "v2", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/IOUtil.java#L2317-L2321
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginGetAzureReachabilityReport
public AzureReachabilityReportInner beginGetAzureReachabilityReport(String resourceGroupName, String networkWatcherName, AzureReachabilityReportParameters parameters) { """ Gets the relative latency score for internet service providers from a specified location to Azure regions. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that determine Azure reachability report configuration. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AzureReachabilityReportInner object if successful. """ return beginGetAzureReachabilityReportWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
java
public AzureReachabilityReportInner beginGetAzureReachabilityReport(String resourceGroupName, String networkWatcherName, AzureReachabilityReportParameters parameters) { return beginGetAzureReachabilityReportWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body(); }
[ "public", "AzureReachabilityReportInner", "beginGetAzureReachabilityReport", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "AzureReachabilityReportParameters", "parameters", ")", "{", "return", "beginGetAzureReachabilityReportWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets the relative latency score for internet service providers from a specified location to Azure regions. @param resourceGroupName The name of the network watcher resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that determine Azure reachability report configuration. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AzureReachabilityReportInner object if successful.
[ "Gets", "the", "relative", "latency", "score", "for", "internet", "service", "providers", "from", "a", "specified", "location", "to", "Azure", "regions", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L2383-L2385
facebookarchive/hive-dwrf
hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java
Slice.getBytes
public void getBytes(int index, byte[] destination, int destinationIndex, int length) { """ Transfers portion of data from this slice into the specified destination starting at the specified absolute {@code index}. @param destinationIndex the first index of the destination @param length the number of bytes to transfer @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0}, if the specified {@code destinationIndex} is less than {@code 0}, if {@code index + length} is greater than {@code this.length()}, or if {@code destinationIndex + length} is greater than {@code destination.length} """ checkIndexLength(index, length); checkPositionIndexes(destinationIndex, destinationIndex + length, destination.length); copyMemory(base, address + index, destination, (long) SizeOf.ARRAY_BYTE_BASE_OFFSET + destinationIndex, length); }
java
public void getBytes(int index, byte[] destination, int destinationIndex, int length) { checkIndexLength(index, length); checkPositionIndexes(destinationIndex, destinationIndex + length, destination.length); copyMemory(base, address + index, destination, (long) SizeOf.ARRAY_BYTE_BASE_OFFSET + destinationIndex, length); }
[ "public", "void", "getBytes", "(", "int", "index", ",", "byte", "[", "]", "destination", ",", "int", "destinationIndex", ",", "int", "length", ")", "{", "checkIndexLength", "(", "index", ",", "length", ")", ";", "checkPositionIndexes", "(", "destinationIndex", ",", "destinationIndex", "+", "length", ",", "destination", ".", "length", ")", ";", "copyMemory", "(", "base", ",", "address", "+", "index", ",", "destination", ",", "(", "long", ")", "SizeOf", ".", "ARRAY_BYTE_BASE_OFFSET", "+", "destinationIndex", ",", "length", ")", ";", "}" ]
Transfers portion of data from this slice into the specified destination starting at the specified absolute {@code index}. @param destinationIndex the first index of the destination @param length the number of bytes to transfer @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0}, if the specified {@code destinationIndex} is less than {@code 0}, if {@code index + length} is greater than {@code this.length()}, or if {@code destinationIndex + length} is greater than {@code destination.length}
[ "Transfers", "portion", "of", "data", "from", "this", "slice", "into", "the", "specified", "destination", "starting", "at", "the", "specified", "absolute", "{", "@code", "index", "}", "." ]
train
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L350-L356
line/armeria
core/src/main/java/com/linecorp/armeria/server/AbstractVirtualHostBuilder.java
AbstractVirtualHostBuilder.sslContext
@Deprecated public B sslContext( SessionProtocol protocol, File keyCertChainFile, File keyFile, @Nullable String keyPassword) throws SSLException { """ Sets the {@link SslContext} of this {@link VirtualHost} from the specified {@link SessionProtocol}, {@code keyCertChainFile}, {@code keyFile} and {@code keyPassword}. @deprecated Use {@link #tls(File, File, String)}. """ if (requireNonNull(protocol, "protocol") != SessionProtocol.HTTPS) { throw new IllegalArgumentException("unsupported protocol: " + protocol); } return tls(keyCertChainFile, keyFile, keyPassword); }
java
@Deprecated public B sslContext( SessionProtocol protocol, File keyCertChainFile, File keyFile, @Nullable String keyPassword) throws SSLException { if (requireNonNull(protocol, "protocol") != SessionProtocol.HTTPS) { throw new IllegalArgumentException("unsupported protocol: " + protocol); } return tls(keyCertChainFile, keyFile, keyPassword); }
[ "@", "Deprecated", "public", "B", "sslContext", "(", "SessionProtocol", "protocol", ",", "File", "keyCertChainFile", ",", "File", "keyFile", ",", "@", "Nullable", "String", "keyPassword", ")", "throws", "SSLException", "{", "if", "(", "requireNonNull", "(", "protocol", ",", "\"protocol\"", ")", "!=", "SessionProtocol", ".", "HTTPS", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"unsupported protocol: \"", "+", "protocol", ")", ";", "}", "return", "tls", "(", "keyCertChainFile", ",", "keyFile", ",", "keyPassword", ")", ";", "}" ]
Sets the {@link SslContext} of this {@link VirtualHost} from the specified {@link SessionProtocol}, {@code keyCertChainFile}, {@code keyFile} and {@code keyPassword}. @deprecated Use {@link #tls(File, File, String)}.
[ "Sets", "the", "{", "@link", "SslContext", "}", "of", "this", "{", "@link", "VirtualHost", "}", "from", "the", "specified", "{", "@link", "SessionProtocol", "}", "{", "@code", "keyCertChainFile", "}", "{", "@code", "keyFile", "}", "and", "{", "@code", "keyPassword", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/AbstractVirtualHostBuilder.java#L285-L295
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java
Request.mandatoryParamAsBoolean
public boolean mandatoryParamAsBoolean(String key) { """ Returns a boolean value. To be used when parameter is required or has a default value. @throws java.lang.IllegalArgumentException is value is null or blank """ String s = mandatoryParam(key); return parseBoolean(key, s); }
java
public boolean mandatoryParamAsBoolean(String key) { String s = mandatoryParam(key); return parseBoolean(key, s); }
[ "public", "boolean", "mandatoryParamAsBoolean", "(", "String", "key", ")", "{", "String", "s", "=", "mandatoryParam", "(", "key", ")", ";", "return", "parseBoolean", "(", "key", ",", "s", ")", ";", "}" ]
Returns a boolean value. To be used when parameter is required or has a default value. @throws java.lang.IllegalArgumentException is value is null or blank
[ "Returns", "a", "boolean", "value", ".", "To", "be", "used", "when", "parameter", "is", "required", "or", "has", "a", "default", "value", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java#L89-L92
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java
AttributesImpl.setURI
public void setURI (int index, String uri) { """ Set the Namespace URI of a specific attribute. @param index The index of the attribute (zero-based). @param uri The attribute's Namespace URI, or the empty string for none. @exception java.lang.ArrayIndexOutOfBoundsException When the supplied index does not point to an attribute in the list. """ if (index >= 0 && index < length) { data[index*5] = uri; } else { badIndex(index); } }
java
public void setURI (int index, String uri) { if (index >= 0 && index < length) { data[index*5] = uri; } else { badIndex(index); } }
[ "public", "void", "setURI", "(", "int", "index", ",", "String", "uri", ")", "{", "if", "(", "index", ">=", "0", "&&", "index", "<", "length", ")", "{", "data", "[", "index", "*", "5", "]", "=", "uri", ";", "}", "else", "{", "badIndex", "(", "index", ")", ";", "}", "}" ]
Set the Namespace URI of a specific attribute. @param index The index of the attribute (zero-based). @param uri The attribute's Namespace URI, or the empty string for none. @exception java.lang.ArrayIndexOutOfBoundsException When the supplied index does not point to an attribute in the list.
[ "Set", "the", "Namespace", "URI", "of", "a", "specific", "attribute", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L466-L473
micronaut-projects/micronaut-core
http/src/main/java/io/micronaut/http/context/ServerRequestContext.java
ServerRequestContext.with
public static <T> T with(HttpRequest request, Callable<T> callable) throws Exception { """ Wrap the execution of the given callable in request context processing. @param request The request @param callable The callable @param <T> The return type of the callable @return The return value of the callable @throws Exception If the callable throws an exception """ HttpRequest existing = REQUEST.get(); boolean isSet = false; try { if (request != existing) { isSet = true; REQUEST.set(request); } return callable.call(); } finally { if (isSet) { REQUEST.remove(); } } }
java
public static <T> T with(HttpRequest request, Callable<T> callable) throws Exception { HttpRequest existing = REQUEST.get(); boolean isSet = false; try { if (request != existing) { isSet = true; REQUEST.set(request); } return callable.call(); } finally { if (isSet) { REQUEST.remove(); } } }
[ "public", "static", "<", "T", ">", "T", "with", "(", "HttpRequest", "request", ",", "Callable", "<", "T", ">", "callable", ")", "throws", "Exception", "{", "HttpRequest", "existing", "=", "REQUEST", ".", "get", "(", ")", ";", "boolean", "isSet", "=", "false", ";", "try", "{", "if", "(", "request", "!=", "existing", ")", "{", "isSet", "=", "true", ";", "REQUEST", ".", "set", "(", "request", ")", ";", "}", "return", "callable", ".", "call", "(", ")", ";", "}", "finally", "{", "if", "(", "isSet", ")", "{", "REQUEST", ".", "remove", "(", ")", ";", "}", "}", "}" ]
Wrap the execution of the given callable in request context processing. @param request The request @param callable The callable @param <T> The return type of the callable @return The return value of the callable @throws Exception If the callable throws an exception
[ "Wrap", "the", "execution", "of", "the", "given", "callable", "in", "request", "context", "processing", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http/src/main/java/io/micronaut/http/context/ServerRequestContext.java#L104-L118
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserRte.java
AbstractGpxParserRte.initialise
public void initialise(XMLReader reader, AbstractGpxParserDefault parent) { """ Create a new specific parser. It has in memory the default parser, the contentBuffer, the elementNames, the currentLine and the rteID. @param reader The XMLReader used in the default class @param parent The parser used in the default class """ setReader(reader); setParent(parent); setContentBuffer(parent.getContentBuffer()); setRtePreparedStmt(parent.getRtePreparedStmt()); setRteptPreparedStmt(parent.getRteptPreparedStmt()); setElementNames(parent.getElementNames()); setCurrentLine(parent.getCurrentLine()); setRteList(new ArrayList<Coordinate>()); }
java
public void initialise(XMLReader reader, AbstractGpxParserDefault parent) { setReader(reader); setParent(parent); setContentBuffer(parent.getContentBuffer()); setRtePreparedStmt(parent.getRtePreparedStmt()); setRteptPreparedStmt(parent.getRteptPreparedStmt()); setElementNames(parent.getElementNames()); setCurrentLine(parent.getCurrentLine()); setRteList(new ArrayList<Coordinate>()); }
[ "public", "void", "initialise", "(", "XMLReader", "reader", ",", "AbstractGpxParserDefault", "parent", ")", "{", "setReader", "(", "reader", ")", ";", "setParent", "(", "parent", ")", ";", "setContentBuffer", "(", "parent", ".", "getContentBuffer", "(", ")", ")", ";", "setRtePreparedStmt", "(", "parent", ".", "getRtePreparedStmt", "(", ")", ")", ";", "setRteptPreparedStmt", "(", "parent", ".", "getRteptPreparedStmt", "(", ")", ")", ";", "setElementNames", "(", "parent", ".", "getElementNames", "(", ")", ")", ";", "setCurrentLine", "(", "parent", ".", "getCurrentLine", "(", ")", ")", ";", "setRteList", "(", "new", "ArrayList", "<", "Coordinate", ">", "(", ")", ")", ";", "}" ]
Create a new specific parser. It has in memory the default parser, the contentBuffer, the elementNames, the currentLine and the rteID. @param reader The XMLReader used in the default class @param parent The parser used in the default class
[ "Create", "a", "new", "specific", "parser", ".", "It", "has", "in", "memory", "the", "default", "parser", "the", "contentBuffer", "the", "elementNames", "the", "currentLine", "and", "the", "rteID", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserRte.java#L58-L67
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LiveOutputsInner.java
LiveOutputsInner.createAsync
public Observable<LiveOutputInner> createAsync(String resourceGroupName, String accountName, String liveEventName, String liveOutputName, LiveOutputInner parameters) { """ Create Live Output. Creates a Live Output. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param liveEventName The name of the Live Event. @param liveOutputName The name of the Live Output. @param parameters Live Output properties needed for creation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, liveOutputName, parameters).map(new Func1<ServiceResponse<LiveOutputInner>, LiveOutputInner>() { @Override public LiveOutputInner call(ServiceResponse<LiveOutputInner> response) { return response.body(); } }); }
java
public Observable<LiveOutputInner> createAsync(String resourceGroupName, String accountName, String liveEventName, String liveOutputName, LiveOutputInner parameters) { return createWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, liveOutputName, parameters).map(new Func1<ServiceResponse<LiveOutputInner>, LiveOutputInner>() { @Override public LiveOutputInner call(ServiceResponse<LiveOutputInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LiveOutputInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "liveEventName", ",", "String", "liveOutputName", ",", "LiveOutputInner", "parameters", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "liveEventName", ",", "liveOutputName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "LiveOutputInner", ">", ",", "LiveOutputInner", ">", "(", ")", "{", "@", "Override", "public", "LiveOutputInner", "call", "(", "ServiceResponse", "<", "LiveOutputInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create Live Output. Creates a Live Output. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param liveEventName The name of the Live Event. @param liveOutputName The name of the Live Output. @param parameters Live Output properties needed for creation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "Live", "Output", ".", "Creates", "a", "Live", "Output", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LiveOutputsInner.java#L382-L389
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/value/binary/DatabaseBinaryStore.java
DatabaseBinaryStore.getInputStream
@Override public InputStream getInputStream( BinaryKey key ) throws BinaryStoreException { """ @inheritDoc In addition to the generic contract from {@link BinaryStore}, this implementation will use a database connection to read the contents of a binary stream from the database. If such a stream cannot be found or an unexpected exception occurs, the connection is always closed. <p/> However, if the content is found in the database, the {@link Connection} <b>is not closed</b> until the {@code InputStream} is closed because otherwise actual streaming from the database could not be possible. """ Connection connection = newConnection(); try { InputStream inputStream = database.readContent(key, connection); if (inputStream == null) { // if we didn't find anything, the connection should've been closed already throw new BinaryStoreException(JcrI18n.unableToFindBinaryValue.text(key, database.getTableName())); } // the connection & statement will be left open until the stream is closed ! return inputStream; } catch (SQLException e) { throw new BinaryStoreException(e); } }
java
@Override public InputStream getInputStream( BinaryKey key ) throws BinaryStoreException { Connection connection = newConnection(); try { InputStream inputStream = database.readContent(key, connection); if (inputStream == null) { // if we didn't find anything, the connection should've been closed already throw new BinaryStoreException(JcrI18n.unableToFindBinaryValue.text(key, database.getTableName())); } // the connection & statement will be left open until the stream is closed ! return inputStream; } catch (SQLException e) { throw new BinaryStoreException(e); } }
[ "@", "Override", "public", "InputStream", "getInputStream", "(", "BinaryKey", "key", ")", "throws", "BinaryStoreException", "{", "Connection", "connection", "=", "newConnection", "(", ")", ";", "try", "{", "InputStream", "inputStream", "=", "database", ".", "readContent", "(", "key", ",", "connection", ")", ";", "if", "(", "inputStream", "==", "null", ")", "{", "// if we didn't find anything, the connection should've been closed already", "throw", "new", "BinaryStoreException", "(", "JcrI18n", ".", "unableToFindBinaryValue", ".", "text", "(", "key", ",", "database", ".", "getTableName", "(", ")", ")", ")", ";", "}", "// the connection & statement will be left open until the stream is closed !", "return", "inputStream", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "BinaryStoreException", "(", "e", ")", ";", "}", "}" ]
@inheritDoc In addition to the generic contract from {@link BinaryStore}, this implementation will use a database connection to read the contents of a binary stream from the database. If such a stream cannot be found or an unexpected exception occurs, the connection is always closed. <p/> However, if the content is found in the database, the {@link Connection} <b>is not closed</b> until the {@code InputStream} is closed because otherwise actual streaming from the database could not be possible.
[ "@inheritDoc" ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/value/binary/DatabaseBinaryStore.java#L216-L230
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java
JdbcAccessImpl.materializeObject
public Object materializeObject(ClassDescriptor cld, Identity oid) throws PersistenceBrokerException { """ performs a primary key lookup operation against RDBMS and materializes an object from the resulting row. Only skalar attributes are filled from the row, references are not resolved. @param oid contains the primary key info. @param cld ClassDescriptor providing mapping information. @return the materialized object, null if no matching row was found or if any error occured. """ final StatementManagerIF sm = broker.serviceStatementManager(); final SelectStatement sql = broker.serviceSqlGenerator().getPreparedSelectByPkStatement(cld); Object result = null; PreparedStatement stmt = null; ResultSet rs = null; try { stmt = sm.getSelectByPKStatement(cld); if (stmt == null) { logger.error("getSelectByPKStatement returned a null statement"); throw new PersistenceBrokerException("getSelectByPKStatement returned a null statement"); } /* arminw: currently a select by PK could never be a stored procedure, thus we can always set 'false'. Is this correct?? */ sm.bindSelect(stmt, oid, cld, false); rs = stmt.executeQuery(); // data available read object, else return null ResultSetAndStatement rs_stmt = new ResultSetAndStatement(broker.serviceStatementManager(), stmt, rs, sql); if (rs.next()) { Map row = new HashMap(); cld.getRowReader().readObjectArrayFrom(rs_stmt, row); result = cld.getRowReader().readObjectFrom(row); } // close resources rs_stmt.close(); } catch (PersistenceBrokerException e) { // release resources on exception sm.closeResources(stmt, rs); logger.error("PersistenceBrokerException during the execution of materializeObject: " + e.getMessage(), e); throw e; } catch (SQLException e) { // release resources on exception sm.closeResources(stmt, rs); throw ExceptionHelper.generateException(e, sql.getStatement(), cld, logger, null); } return result; }
java
public Object materializeObject(ClassDescriptor cld, Identity oid) throws PersistenceBrokerException { final StatementManagerIF sm = broker.serviceStatementManager(); final SelectStatement sql = broker.serviceSqlGenerator().getPreparedSelectByPkStatement(cld); Object result = null; PreparedStatement stmt = null; ResultSet rs = null; try { stmt = sm.getSelectByPKStatement(cld); if (stmt == null) { logger.error("getSelectByPKStatement returned a null statement"); throw new PersistenceBrokerException("getSelectByPKStatement returned a null statement"); } /* arminw: currently a select by PK could never be a stored procedure, thus we can always set 'false'. Is this correct?? */ sm.bindSelect(stmt, oid, cld, false); rs = stmt.executeQuery(); // data available read object, else return null ResultSetAndStatement rs_stmt = new ResultSetAndStatement(broker.serviceStatementManager(), stmt, rs, sql); if (rs.next()) { Map row = new HashMap(); cld.getRowReader().readObjectArrayFrom(rs_stmt, row); result = cld.getRowReader().readObjectFrom(row); } // close resources rs_stmt.close(); } catch (PersistenceBrokerException e) { // release resources on exception sm.closeResources(stmt, rs); logger.error("PersistenceBrokerException during the execution of materializeObject: " + e.getMessage(), e); throw e; } catch (SQLException e) { // release resources on exception sm.closeResources(stmt, rs); throw ExceptionHelper.generateException(e, sql.getStatement(), cld, logger, null); } return result; }
[ "public", "Object", "materializeObject", "(", "ClassDescriptor", "cld", ",", "Identity", "oid", ")", "throws", "PersistenceBrokerException", "{", "final", "StatementManagerIF", "sm", "=", "broker", ".", "serviceStatementManager", "(", ")", ";", "final", "SelectStatement", "sql", "=", "broker", ".", "serviceSqlGenerator", "(", ")", ".", "getPreparedSelectByPkStatement", "(", "cld", ")", ";", "Object", "result", "=", "null", ";", "PreparedStatement", "stmt", "=", "null", ";", "ResultSet", "rs", "=", "null", ";", "try", "{", "stmt", "=", "sm", ".", "getSelectByPKStatement", "(", "cld", ")", ";", "if", "(", "stmt", "==", "null", ")", "{", "logger", ".", "error", "(", "\"getSelectByPKStatement returned a null statement\"", ")", ";", "throw", "new", "PersistenceBrokerException", "(", "\"getSelectByPKStatement returned a null statement\"", ")", ";", "}", "/*\r\n arminw: currently a select by PK could never be a stored procedure,\r\n thus we can always set 'false'. Is this correct??\r\n */", "sm", ".", "bindSelect", "(", "stmt", ",", "oid", ",", "cld", ",", "false", ")", ";", "rs", "=", "stmt", ".", "executeQuery", "(", ")", ";", "// data available read object, else return null\r", "ResultSetAndStatement", "rs_stmt", "=", "new", "ResultSetAndStatement", "(", "broker", ".", "serviceStatementManager", "(", ")", ",", "stmt", ",", "rs", ",", "sql", ")", ";", "if", "(", "rs", ".", "next", "(", ")", ")", "{", "Map", "row", "=", "new", "HashMap", "(", ")", ";", "cld", ".", "getRowReader", "(", ")", ".", "readObjectArrayFrom", "(", "rs_stmt", ",", "row", ")", ";", "result", "=", "cld", ".", "getRowReader", "(", ")", ".", "readObjectFrom", "(", "row", ")", ";", "}", "// close resources\r", "rs_stmt", ".", "close", "(", ")", ";", "}", "catch", "(", "PersistenceBrokerException", "e", ")", "{", "// release resources on exception\r", "sm", ".", "closeResources", "(", "stmt", ",", "rs", ")", ";", "logger", ".", "error", "(", "\"PersistenceBrokerException during the execution of materializeObject: \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "throw", "e", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "// release resources on exception\r", "sm", ".", "closeResources", "(", "stmt", ",", "rs", ")", ";", "throw", "ExceptionHelper", ".", "generateException", "(", "e", ",", "sql", ".", "getStatement", "(", ")", ",", "cld", ",", "logger", ",", "null", ")", ";", "}", "return", "result", ";", "}" ]
performs a primary key lookup operation against RDBMS and materializes an object from the resulting row. Only skalar attributes are filled from the row, references are not resolved. @param oid contains the primary key info. @param cld ClassDescriptor providing mapping information. @return the materialized object, null if no matching row was found or if any error occured.
[ "performs", "a", "primary", "key", "lookup", "operation", "against", "RDBMS", "and", "materializes", "an", "object", "from", "the", "resulting", "row", ".", "Only", "skalar", "attributes", "are", "filled", "from", "the", "row", "references", "are", "not", "resolved", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/JdbcAccessImpl.java#L570-L617
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.scale
public static void scale(InputStream srcStream, OutputStream destStream, int width, int height, Color fixedColor) throws IORuntimeException { """ 缩放图像(按高度和宽度缩放)<br> 缩放后默认为jpeg格式,此方法并不关闭流 @param srcStream 源图像流 @param destStream 缩放后的图像目标流 @param width 缩放后的宽度 @param height 缩放后的高度 @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code> @throws IORuntimeException IO异常 """ scale(read(srcStream), getImageOutputStream(destStream), width, height, fixedColor); }
java
public static void scale(InputStream srcStream, OutputStream destStream, int width, int height, Color fixedColor) throws IORuntimeException { scale(read(srcStream), getImageOutputStream(destStream), width, height, fixedColor); }
[ "public", "static", "void", "scale", "(", "InputStream", "srcStream", ",", "OutputStream", "destStream", ",", "int", "width", ",", "int", "height", ",", "Color", "fixedColor", ")", "throws", "IORuntimeException", "{", "scale", "(", "read", "(", "srcStream", ")", ",", "getImageOutputStream", "(", "destStream", ")", ",", "width", ",", "height", ",", "fixedColor", ")", ";", "}" ]
缩放图像(按高度和宽度缩放)<br> 缩放后默认为jpeg格式,此方法并不关闭流 @param srcStream 源图像流 @param destStream 缩放后的图像目标流 @param width 缩放后的宽度 @param height 缩放后的高度 @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code> @throws IORuntimeException IO异常
[ "缩放图像(按高度和宽度缩放)<br", ">", "缩放后默认为jpeg格式,此方法并不关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L199-L201
neo4j/neo4j-java-driver
driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java
DriverFactory.createDirectDriver
protected InternalDriver createDirectDriver( SecurityPlan securityPlan, BoltServerAddress address, ConnectionPool connectionPool, RetryLogic retryLogic, MetricsProvider metricsProvider, Config config ) { """ Creates a new driver for "bolt" scheme. <p> <b>This method is protected only for testing</b> """ ConnectionProvider connectionProvider = new DirectConnectionProvider( address, connectionPool ); SessionFactory sessionFactory = createSessionFactory( connectionProvider, retryLogic, config ); InternalDriver driver = createDriver( securityPlan, sessionFactory, metricsProvider, config ); Logger log = config.logging().getLog( Driver.class.getSimpleName() ); log.info( "Direct driver instance %s created for server address %s", driver.hashCode(), address ); return driver; }
java
protected InternalDriver createDirectDriver( SecurityPlan securityPlan, BoltServerAddress address, ConnectionPool connectionPool, RetryLogic retryLogic, MetricsProvider metricsProvider, Config config ) { ConnectionProvider connectionProvider = new DirectConnectionProvider( address, connectionPool ); SessionFactory sessionFactory = createSessionFactory( connectionProvider, retryLogic, config ); InternalDriver driver = createDriver( securityPlan, sessionFactory, metricsProvider, config ); Logger log = config.logging().getLog( Driver.class.getSimpleName() ); log.info( "Direct driver instance %s created for server address %s", driver.hashCode(), address ); return driver; }
[ "protected", "InternalDriver", "createDirectDriver", "(", "SecurityPlan", "securityPlan", ",", "BoltServerAddress", "address", ",", "ConnectionPool", "connectionPool", ",", "RetryLogic", "retryLogic", ",", "MetricsProvider", "metricsProvider", ",", "Config", "config", ")", "{", "ConnectionProvider", "connectionProvider", "=", "new", "DirectConnectionProvider", "(", "address", ",", "connectionPool", ")", ";", "SessionFactory", "sessionFactory", "=", "createSessionFactory", "(", "connectionProvider", ",", "retryLogic", ",", "config", ")", ";", "InternalDriver", "driver", "=", "createDriver", "(", "securityPlan", ",", "sessionFactory", ",", "metricsProvider", ",", "config", ")", ";", "Logger", "log", "=", "config", ".", "logging", "(", ")", ".", "getLog", "(", "Driver", ".", "class", ".", "getSimpleName", "(", ")", ")", ";", "log", ".", "info", "(", "\"Direct driver instance %s created for server address %s\"", ",", "driver", ".", "hashCode", "(", ")", ",", "address", ")", ";", "return", "driver", ";", "}" ]
Creates a new driver for "bolt" scheme. <p> <b>This method is protected only for testing</b>
[ "Creates", "a", "new", "driver", "for", "bolt", "scheme", ".", "<p", ">", "<b", ">", "This", "method", "is", "protected", "only", "for", "testing<", "/", "b", ">" ]
train
https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/DriverFactory.java#L156-L165
xm-online/xm-commons
xm-commons-i18n/src/main/java/com/icthh/xm/commons/i18n/spring/service/LocalizationMessageService.java
LocalizationMessageService.getMessage
public String getMessage(String code, Map<String, String> substitutes) { """ Finds localized message template by code and current locale from config. If not found it takes message from message bundle and replaces all the occurrences of variables with their matching values from the substitute map. @param code the message code @param substitutes the substitute map for message template @return localized message """ return getMessage(code, substitutes, true, null); }
java
public String getMessage(String code, Map<String, String> substitutes) { return getMessage(code, substitutes, true, null); }
[ "public", "String", "getMessage", "(", "String", "code", ",", "Map", "<", "String", ",", "String", ">", "substitutes", ")", "{", "return", "getMessage", "(", "code", ",", "substitutes", ",", "true", ",", "null", ")", ";", "}" ]
Finds localized message template by code and current locale from config. If not found it takes message from message bundle and replaces all the occurrences of variables with their matching values from the substitute map. @param code the message code @param substitutes the substitute map for message template @return localized message
[ "Finds", "localized", "message", "template", "by", "code", "and", "current", "locale", "from", "config", ".", "If", "not", "found", "it", "takes", "message", "from", "message", "bundle", "and", "replaces", "all", "the", "occurrences", "of", "variables", "with", "their", "matching", "values", "from", "the", "substitute", "map", "." ]
train
https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-i18n/src/main/java/com/icthh/xm/commons/i18n/spring/service/LocalizationMessageService.java#L104-L106
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java
Quaternion.interpolate
public final void interpolate(Quaternion q1, double alpha) { """ Performs a great circle interpolation between this quaternion and the quaternion parameter and places the result into this quaternion. @param q1 the other quaternion @param alpha the alpha interpolation parameter """ // From "Advanced Animation and Rendering Techniques" // by Watt and Watt pg. 364, function as implemented appeared to be // incorrect. Fails to choose the same quaternion for the double // covering. Resulting in change of direction for rotations. // Fixed function to negate the first quaternion in the case that the // dot product of q1 and this is negative. Second case was not needed. double dot,s1,s2,om,sinom; dot = this.x*q1.x + this.y*q1.y + this.z*q1.z + this.w*q1.w; if ( dot < 0 ) { // negate quaternion q1.x = -q1.x; q1.y = -q1.y; q1.z = -q1.z; q1.w = -q1.w; dot = -dot; } if ( (1.0 - dot) > EPS ) { om = Math.acos(dot); sinom = Math.sin(om); s1 = Math.sin((1.0-alpha)*om)/sinom; s2 = Math.sin( alpha*om)/sinom; } else{ s1 = 1.0 - alpha; s2 = alpha; } this.w = (s1*this.w + s2*q1.w); this.x = (s1*this.x + s2*q1.x); this.y = (s1*this.y + s2*q1.y); this.z = (s1*this.z + s2*q1.z); }
java
public final void interpolate(Quaternion q1, double alpha) { // From "Advanced Animation and Rendering Techniques" // by Watt and Watt pg. 364, function as implemented appeared to be // incorrect. Fails to choose the same quaternion for the double // covering. Resulting in change of direction for rotations. // Fixed function to negate the first quaternion in the case that the // dot product of q1 and this is negative. Second case was not needed. double dot,s1,s2,om,sinom; dot = this.x*q1.x + this.y*q1.y + this.z*q1.z + this.w*q1.w; if ( dot < 0 ) { // negate quaternion q1.x = -q1.x; q1.y = -q1.y; q1.z = -q1.z; q1.w = -q1.w; dot = -dot; } if ( (1.0 - dot) > EPS ) { om = Math.acos(dot); sinom = Math.sin(om); s1 = Math.sin((1.0-alpha)*om)/sinom; s2 = Math.sin( alpha*om)/sinom; } else{ s1 = 1.0 - alpha; s2 = alpha; } this.w = (s1*this.w + s2*q1.w); this.x = (s1*this.x + s2*q1.x); this.y = (s1*this.y + s2*q1.y); this.z = (s1*this.z + s2*q1.z); }
[ "public", "final", "void", "interpolate", "(", "Quaternion", "q1", ",", "double", "alpha", ")", "{", "// From \"Advanced Animation and Rendering Techniques\"", "// by Watt and Watt pg. 364, function as implemented appeared to be ", "// incorrect. Fails to choose the same quaternion for the double", "// covering. Resulting in change of direction for rotations.", "// Fixed function to negate the first quaternion in the case that the", "// dot product of q1 and this is negative. Second case was not needed. ", "double", "dot", ",", "s1", ",", "s2", ",", "om", ",", "sinom", ";", "dot", "=", "this", ".", "x", "*", "q1", ".", "x", "+", "this", ".", "y", "*", "q1", ".", "y", "+", "this", ".", "z", "*", "q1", ".", "z", "+", "this", ".", "w", "*", "q1", ".", "w", ";", "if", "(", "dot", "<", "0", ")", "{", "// negate quaternion", "q1", ".", "x", "=", "-", "q1", ".", "x", ";", "q1", ".", "y", "=", "-", "q1", ".", "y", ";", "q1", ".", "z", "=", "-", "q1", ".", "z", ";", "q1", ".", "w", "=", "-", "q1", ".", "w", ";", "dot", "=", "-", "dot", ";", "}", "if", "(", "(", "1.0", "-", "dot", ")", ">", "EPS", ")", "{", "om", "=", "Math", ".", "acos", "(", "dot", ")", ";", "sinom", "=", "Math", ".", "sin", "(", "om", ")", ";", "s1", "=", "Math", ".", "sin", "(", "(", "1.0", "-", "alpha", ")", "*", "om", ")", "/", "sinom", ";", "s2", "=", "Math", ".", "sin", "(", "alpha", "*", "om", ")", "/", "sinom", ";", "}", "else", "{", "s1", "=", "1.0", "-", "alpha", ";", "s2", "=", "alpha", ";", "}", "this", ".", "w", "=", "(", "s1", "*", "this", ".", "w", "+", "s2", "*", "q1", ".", "w", ")", ";", "this", ".", "x", "=", "(", "s1", "*", "this", ".", "x", "+", "s2", "*", "q1", ".", "x", ")", ";", "this", ".", "y", "=", "(", "s1", "*", "this", ".", "y", "+", "s2", "*", "q1", ".", "y", ")", ";", "this", ".", "z", "=", "(", "s1", "*", "this", ".", "z", "+", "s2", "*", "q1", ".", "z", ")", ";", "}" ]
Performs a great circle interpolation between this quaternion and the quaternion parameter and places the result into this quaternion. @param q1 the other quaternion @param alpha the alpha interpolation parameter
[ "Performs", "a", "great", "circle", "interpolation", "between", "this", "quaternion", "and", "the", "quaternion", "parameter", "and", "places", "the", "result", "into", "this", "quaternion", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java#L738-L770
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java
GeoPackageCoreConnection.queryResults
public List<List<Object>> queryResults(String sql, String[] args) { """ Query for values @param sql sql statement @param args arguments @return results @since 3.1.0 """ return queryResults(sql, args, null, null); }
java
public List<List<Object>> queryResults(String sql, String[] args) { return queryResults(sql, args, null, null); }
[ "public", "List", "<", "List", "<", "Object", ">", ">", "queryResults", "(", "String", "sql", ",", "String", "[", "]", "args", ")", "{", "return", "queryResults", "(", "sql", ",", "args", ",", "null", ",", "null", ")", ";", "}" ]
Query for values @param sql sql statement @param args arguments @return results @since 3.1.0
[ "Query", "for", "values" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java#L563-L565
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java
AbstractOptionsForSelect.withResultSetAsyncListeners
public T withResultSetAsyncListeners(List<Function<ResultSet, ResultSet>> resultSetAsyncListeners) { """ Add the given list of async listeners on the {@link com.datastax.driver.core.ResultSet} object. Example of usage: <pre class="code"><code class="java"> .withResultSetAsyncListeners(Arrays.asList(resultSet -> { //Do something with the resultSet object here })) </code></pre> Remark: <strong>it is not allowed to consume the ResultSet values. It is strongly advised to read only meta data</strong> """ getOptions().setResultSetAsyncListeners(Optional.of(resultSetAsyncListeners)); return getThis(); }
java
public T withResultSetAsyncListeners(List<Function<ResultSet, ResultSet>> resultSetAsyncListeners) { getOptions().setResultSetAsyncListeners(Optional.of(resultSetAsyncListeners)); return getThis(); }
[ "public", "T", "withResultSetAsyncListeners", "(", "List", "<", "Function", "<", "ResultSet", ",", "ResultSet", ">", ">", "resultSetAsyncListeners", ")", "{", "getOptions", "(", ")", ".", "setResultSetAsyncListeners", "(", "Optional", ".", "of", "(", "resultSetAsyncListeners", ")", ")", ";", "return", "getThis", "(", ")", ";", "}" ]
Add the given list of async listeners on the {@link com.datastax.driver.core.ResultSet} object. Example of usage: <pre class="code"><code class="java"> .withResultSetAsyncListeners(Arrays.asList(resultSet -> { //Do something with the resultSet object here })) </code></pre> Remark: <strong>it is not allowed to consume the ResultSet values. It is strongly advised to read only meta data</strong>
[ "Add", "the", "given", "list", "of", "async", "listeners", "on", "the", "{", "@link", "com", ".", "datastax", ".", "driver", ".", "core", ".", "ResultSet", "}", "object", ".", "Example", "of", "usage", ":", "<pre", "class", "=", "code", ">", "<code", "class", "=", "java", ">" ]
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java#L182-L185
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/BatchOperation.java
BatchOperation.addQuery
public void addQuery(String query, String bId) { """ Method to add the query batch operation to batchItemRequest @param query the query @param bId the batch Id """ BatchItemRequest batchItemRequest = new BatchItemRequest(); batchItemRequest.setBId(bId); batchItemRequest.setQuery(query); batchItemRequests.add(batchItemRequest); bIds.add(bId); }
java
public void addQuery(String query, String bId) { BatchItemRequest batchItemRequest = new BatchItemRequest(); batchItemRequest.setBId(bId); batchItemRequest.setQuery(query); batchItemRequests.add(batchItemRequest); bIds.add(bId); }
[ "public", "void", "addQuery", "(", "String", "query", ",", "String", "bId", ")", "{", "BatchItemRequest", "batchItemRequest", "=", "new", "BatchItemRequest", "(", ")", ";", "batchItemRequest", ".", "setBId", "(", "bId", ")", ";", "batchItemRequest", ".", "setQuery", "(", "query", ")", ";", "batchItemRequests", ".", "add", "(", "batchItemRequest", ")", ";", "bIds", ".", "add", "(", "bId", ")", ";", "}" ]
Method to add the query batch operation to batchItemRequest @param query the query @param bId the batch Id
[ "Method", "to", "add", "the", "query", "batch", "operation", "to", "batchItemRequest" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/BatchOperation.java#L112-L120
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.readXMLFragment
public static DocumentFragment readXMLFragment(InputStream stream) throws IOException, SAXException, ParserConfigurationException { """ Read an XML fragment from an XML file. The XML file is well-formed. It means that the fragment will contains a single element: the root element within the input stream. @param stream is the stream to read @return the fragment from the {@code stream}. @throws IOException if the stream cannot be read. @throws SAXException if the stream does not contains valid XML data. @throws ParserConfigurationException if the parser cannot be configured. """ return readXMLFragment(stream, false); }
java
public static DocumentFragment readXMLFragment(InputStream stream) throws IOException, SAXException, ParserConfigurationException { return readXMLFragment(stream, false); }
[ "public", "static", "DocumentFragment", "readXMLFragment", "(", "InputStream", "stream", ")", "throws", "IOException", ",", "SAXException", ",", "ParserConfigurationException", "{", "return", "readXMLFragment", "(", "stream", ",", "false", ")", ";", "}" ]
Read an XML fragment from an XML file. The XML file is well-formed. It means that the fragment will contains a single element: the root element within the input stream. @param stream is the stream to read @return the fragment from the {@code stream}. @throws IOException if the stream cannot be read. @throws SAXException if the stream does not contains valid XML data. @throws ParserConfigurationException if the parser cannot be configured.
[ "Read", "an", "XML", "fragment", "from", "an", "XML", "file", ".", "The", "XML", "file", "is", "well", "-", "formed", ".", "It", "means", "that", "the", "fragment", "will", "contains", "a", "single", "element", ":", "the", "root", "element", "within", "the", "input", "stream", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1980-L1983
rjeschke/txtmark
src/main/java/com/github/rjeschke/txtmark/Utils.java
Utils.skipSpaces
public final static int skipSpaces(final String in, final int start) { """ Skips spaces in the given String. @param in Input String. @param start Starting position. @return The new position or -1 if EOL has been reached. """ int pos = start; while (pos < in.length() && (in.charAt(pos) == ' ' || in.charAt(pos) == '\n')) { pos++; } return pos < in.length() ? pos : -1; }
java
public final static int skipSpaces(final String in, final int start) { int pos = start; while (pos < in.length() && (in.charAt(pos) == ' ' || in.charAt(pos) == '\n')) { pos++; } return pos < in.length() ? pos : -1; }
[ "public", "final", "static", "int", "skipSpaces", "(", "final", "String", "in", ",", "final", "int", "start", ")", "{", "int", "pos", "=", "start", ";", "while", "(", "pos", "<", "in", ".", "length", "(", ")", "&&", "(", "in", ".", "charAt", "(", "pos", ")", "==", "'", "'", "||", "in", ".", "charAt", "(", "pos", ")", "==", "'", "'", ")", ")", "{", "pos", "++", ";", "}", "return", "pos", "<", "in", ".", "length", "(", ")", "?", "pos", ":", "-", "1", ";", "}" ]
Skips spaces in the given String. @param in Input String. @param start Starting position. @return The new position or -1 if EOL has been reached.
[ "Skips", "spaces", "in", "the", "given", "String", "." ]
train
https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L47-L55
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/rule/RuleTagHelper.java
RuleTagHelper.applyTags
static boolean applyTags(RuleDto rule, Set<String> tags) { """ Validates tags and resolves conflicts between user and system tags. """ for (String tag : tags) { RuleTagFormat.validate(tag); } Set<String> initialTags = rule.getTags(); final Set<String> systemTags = rule.getSystemTags(); Set<String> withoutSystemTags = Sets.filter(tags, input -> input != null && !systemTags.contains(input)); rule.setTags(withoutSystemTags); return withoutSystemTags.size() != initialTags.size() || !withoutSystemTags.containsAll(initialTags); }
java
static boolean applyTags(RuleDto rule, Set<String> tags) { for (String tag : tags) { RuleTagFormat.validate(tag); } Set<String> initialTags = rule.getTags(); final Set<String> systemTags = rule.getSystemTags(); Set<String> withoutSystemTags = Sets.filter(tags, input -> input != null && !systemTags.contains(input)); rule.setTags(withoutSystemTags); return withoutSystemTags.size() != initialTags.size() || !withoutSystemTags.containsAll(initialTags); }
[ "static", "boolean", "applyTags", "(", "RuleDto", "rule", ",", "Set", "<", "String", ">", "tags", ")", "{", "for", "(", "String", "tag", ":", "tags", ")", "{", "RuleTagFormat", ".", "validate", "(", "tag", ")", ";", "}", "Set", "<", "String", ">", "initialTags", "=", "rule", ".", "getTags", "(", ")", ";", "final", "Set", "<", "String", ">", "systemTags", "=", "rule", ".", "getSystemTags", "(", ")", ";", "Set", "<", "String", ">", "withoutSystemTags", "=", "Sets", ".", "filter", "(", "tags", ",", "input", "->", "input", "!=", "null", "&&", "!", "systemTags", ".", "contains", "(", "input", ")", ")", ";", "rule", ".", "setTags", "(", "withoutSystemTags", ")", ";", "return", "withoutSystemTags", ".", "size", "(", ")", "!=", "initialTags", ".", "size", "(", ")", "||", "!", "withoutSystemTags", ".", "containsAll", "(", "initialTags", ")", ";", "}" ]
Validates tags and resolves conflicts between user and system tags.
[ "Validates", "tags", "and", "resolves", "conflicts", "between", "user", "and", "system", "tags", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleTagHelper.java#L36-L46
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Checker.java
Checker.isSpinnerTextSelected
public boolean isSpinnerTextSelected(int spinnerIndex, String text) { """ Checks if a given text is selected in a given {@link Spinner} @param spinnerIndex the index of the spinner to check. 0 if only one spinner is available @param text the text that is expected to be selected @return true if the given text is selected in the given {@code Spinner} and false if it is not """ Spinner spinner = waiter.waitForAndGetView(spinnerIndex, Spinner.class); TextView textView = (TextView) spinner.getChildAt(0); if(textView.getText().equals(text)) return true; else return false; }
java
public boolean isSpinnerTextSelected(int spinnerIndex, String text) { Spinner spinner = waiter.waitForAndGetView(spinnerIndex, Spinner.class); TextView textView = (TextView) spinner.getChildAt(0); if(textView.getText().equals(text)) return true; else return false; }
[ "public", "boolean", "isSpinnerTextSelected", "(", "int", "spinnerIndex", ",", "String", "text", ")", "{", "Spinner", "spinner", "=", "waiter", ".", "waitForAndGetView", "(", "spinnerIndex", ",", "Spinner", ".", "class", ")", ";", "TextView", "textView", "=", "(", "TextView", ")", "spinner", ".", "getChildAt", "(", "0", ")", ";", "if", "(", "textView", ".", "getText", "(", ")", ".", "equals", "(", "text", ")", ")", "return", "true", ";", "else", "return", "false", ";", "}" ]
Checks if a given text is selected in a given {@link Spinner} @param spinnerIndex the index of the spinner to check. 0 if only one spinner is available @param text the text that is expected to be selected @return true if the given text is selected in the given {@code Spinner} and false if it is not
[ "Checks", "if", "a", "given", "text", "is", "selected", "in", "a", "given", "{" ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Checker.java#L112-L121
playn/playn
java-base/src/playn/java/JavaAudio.java
JavaAudio.createSound
public JavaSound createSound(final JavaAssets.Resource rsrc, final boolean music) { """ Creates a sound instance from the audio data available via {@code in}. @param rsrc an resource instance via which the audio data can be read. @param music if true, a custom {@link Clip} implementation will be used which can handle long audio clips; if false, the default Java clip implementation is used which cannot handle long audio clips. """ final JavaSound sound = new JavaSound(exec); exec.invokeAsync(new Runnable() { public void run () { try { AudioInputStream ais = rsrc.openAudioStream(); AudioFormat format = ais.getFormat(); Clip clip; if (music) { // BigClip needs sounds in PCM_SIGNED format; it attempts to do this conversion // internally, but the way it does it fails in some circumstances, so we do it out here if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) { ais = AudioSystem.getAudioInputStream(new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, format.getSampleRate(), 16, // we have to force sample size to 16 format.getChannels(), format.getChannels()*2, format.getSampleRate(), false // big endian ), ais); } clip = new BigClip(); } else { DataLine.Info info = new DataLine.Info(Clip.class, format); clip = (Clip) AudioSystem.getLine(info); } clip.open(ais); sound.succeed(clip); } catch (Exception e) { sound.fail(e); } } }); return sound; }
java
public JavaSound createSound(final JavaAssets.Resource rsrc, final boolean music) { final JavaSound sound = new JavaSound(exec); exec.invokeAsync(new Runnable() { public void run () { try { AudioInputStream ais = rsrc.openAudioStream(); AudioFormat format = ais.getFormat(); Clip clip; if (music) { // BigClip needs sounds in PCM_SIGNED format; it attempts to do this conversion // internally, but the way it does it fails in some circumstances, so we do it out here if (format.getEncoding() != AudioFormat.Encoding.PCM_SIGNED) { ais = AudioSystem.getAudioInputStream(new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, format.getSampleRate(), 16, // we have to force sample size to 16 format.getChannels(), format.getChannels()*2, format.getSampleRate(), false // big endian ), ais); } clip = new BigClip(); } else { DataLine.Info info = new DataLine.Info(Clip.class, format); clip = (Clip) AudioSystem.getLine(info); } clip.open(ais); sound.succeed(clip); } catch (Exception e) { sound.fail(e); } } }); return sound; }
[ "public", "JavaSound", "createSound", "(", "final", "JavaAssets", ".", "Resource", "rsrc", ",", "final", "boolean", "music", ")", "{", "final", "JavaSound", "sound", "=", "new", "JavaSound", "(", "exec", ")", ";", "exec", ".", "invokeAsync", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "try", "{", "AudioInputStream", "ais", "=", "rsrc", ".", "openAudioStream", "(", ")", ";", "AudioFormat", "format", "=", "ais", ".", "getFormat", "(", ")", ";", "Clip", "clip", ";", "if", "(", "music", ")", "{", "// BigClip needs sounds in PCM_SIGNED format; it attempts to do this conversion", "// internally, but the way it does it fails in some circumstances, so we do it out here", "if", "(", "format", ".", "getEncoding", "(", ")", "!=", "AudioFormat", ".", "Encoding", ".", "PCM_SIGNED", ")", "{", "ais", "=", "AudioSystem", ".", "getAudioInputStream", "(", "new", "AudioFormat", "(", "AudioFormat", ".", "Encoding", ".", "PCM_SIGNED", ",", "format", ".", "getSampleRate", "(", ")", ",", "16", ",", "// we have to force sample size to 16", "format", ".", "getChannels", "(", ")", ",", "format", ".", "getChannels", "(", ")", "*", "2", ",", "format", ".", "getSampleRate", "(", ")", ",", "false", "// big endian", ")", ",", "ais", ")", ";", "}", "clip", "=", "new", "BigClip", "(", ")", ";", "}", "else", "{", "DataLine", ".", "Info", "info", "=", "new", "DataLine", ".", "Info", "(", "Clip", ".", "class", ",", "format", ")", ";", "clip", "=", "(", "Clip", ")", "AudioSystem", ".", "getLine", "(", "info", ")", ";", "}", "clip", ".", "open", "(", "ais", ")", ";", "sound", ".", "succeed", "(", "clip", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "sound", ".", "fail", "(", "e", ")", ";", "}", "}", "}", ")", ";", "return", "sound", ";", "}" ]
Creates a sound instance from the audio data available via {@code in}. @param rsrc an resource instance via which the audio data can be read. @param music if true, a custom {@link Clip} implementation will be used which can handle long audio clips; if false, the default Java clip implementation is used which cannot handle long audio clips.
[ "Creates", "a", "sound", "instance", "from", "the", "audio", "data", "available", "via", "{", "@code", "in", "}", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaAudio.java#L43-L78
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.addDeprecation
@Deprecated public static void addDeprecation(String key, String[] newKeys) { """ Adds the deprecated key to the global deprecation map when no custom message is provided. It does not override any existing entries in the deprecation map. This is to be used only by the developers in order to add deprecation of keys, and attempts to call this method after loading resources once, would lead to <tt>UnsupportedOperationException</tt> If a key is deprecated in favor of multiple keys, they are all treated as aliases of each other, and setting any one of them resets all the others to the new value. If you have multiple deprecation entries to add, it is more efficient to use #addDeprecations(DeprecationDelta[] deltas) instead. @param key Key that is to be deprecated @param newKeys list of keys that take up the values of deprecated key @deprecated use {@link #addDeprecation(String key, String newKey)} instead """ addDeprecation(key, newKeys, null); }
java
@Deprecated public static void addDeprecation(String key, String[] newKeys) { addDeprecation(key, newKeys, null); }
[ "@", "Deprecated", "public", "static", "void", "addDeprecation", "(", "String", "key", ",", "String", "[", "]", "newKeys", ")", "{", "addDeprecation", "(", "key", ",", "newKeys", ",", "null", ")", ";", "}" ]
Adds the deprecated key to the global deprecation map when no custom message is provided. It does not override any existing entries in the deprecation map. This is to be used only by the developers in order to add deprecation of keys, and attempts to call this method after loading resources once, would lead to <tt>UnsupportedOperationException</tt> If a key is deprecated in favor of multiple keys, they are all treated as aliases of each other, and setting any one of them resets all the others to the new value. If you have multiple deprecation entries to add, it is more efficient to use #addDeprecations(DeprecationDelta[] deltas) instead. @param key Key that is to be deprecated @param newKeys list of keys that take up the values of deprecated key @deprecated use {@link #addDeprecation(String key, String newKey)} instead
[ "Adds", "the", "deprecated", "key", "to", "the", "global", "deprecation", "map", "when", "no", "custom", "message", "is", "provided", ".", "It", "does", "not", "override", "any", "existing", "entries", "in", "the", "deprecation", "map", ".", "This", "is", "to", "be", "used", "only", "by", "the", "developers", "in", "order", "to", "add", "deprecation", "of", "keys", "and", "attempts", "to", "call", "this", "method", "after", "loading", "resources", "once", "would", "lead", "to", "<tt", ">", "UnsupportedOperationException<", "/", "tt", ">" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L530-L533
crawljax/crawljax
core/src/main/java/com/crawljax/util/XPathHelper.java
XPathHelper.evaluateXpathExpression
public static NodeList evaluateXpathExpression(Document dom, String xpathExpr) throws XPathExpressionException { """ Returns the list of nodes which match the expression xpathExpr in the Document dom. @param dom the Document to search in @param xpathExpr the xpath query @return the list of nodes which match the query @throws XPathExpressionException On error. """ XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile(xpathExpr); Object result = expr.evaluate(dom, XPathConstants.NODESET); return (NodeList) result; }
java
public static NodeList evaluateXpathExpression(Document dom, String xpathExpr) throws XPathExpressionException { XPathFactory factory = XPathFactory.newInstance(); XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile(xpathExpr); Object result = expr.evaluate(dom, XPathConstants.NODESET); return (NodeList) result; }
[ "public", "static", "NodeList", "evaluateXpathExpression", "(", "Document", "dom", ",", "String", "xpathExpr", ")", "throws", "XPathExpressionException", "{", "XPathFactory", "factory", "=", "XPathFactory", ".", "newInstance", "(", ")", ";", "XPath", "xpath", "=", "factory", ".", "newXPath", "(", ")", ";", "XPathExpression", "expr", "=", "xpath", ".", "compile", "(", "xpathExpr", ")", ";", "Object", "result", "=", "expr", ".", "evaluate", "(", "dom", ",", "XPathConstants", ".", "NODESET", ")", ";", "return", "(", "NodeList", ")", "result", ";", "}" ]
Returns the list of nodes which match the expression xpathExpr in the Document dom. @param dom the Document to search in @param xpathExpr the xpath query @return the list of nodes which match the query @throws XPathExpressionException On error.
[ "Returns", "the", "list", "of", "nodes", "which", "match", "the", "expression", "xpathExpr", "in", "the", "Document", "dom", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/util/XPathHelper.java#L126-L133
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/TableAppender.java
TableAppender.flushSomeAvailableRowsFrom
public void flushSomeAvailableRowsFrom(final XMLUtil util, final Appendable appendable, final int rowIndex) throws IOException { """ Flush all rows from a given position, but do not freeze the table @param util a XMLUtil instance for writing XML @param appendable where to write @param rowIndex the index of the row @throws IOException if an I/O error occurs during the flush """ if (rowIndex == 0) this.appendPreamble(util, appendable); this.appendRows(util, appendable, rowIndex); }
java
public void flushSomeAvailableRowsFrom(final XMLUtil util, final Appendable appendable, final int rowIndex) throws IOException { if (rowIndex == 0) this.appendPreamble(util, appendable); this.appendRows(util, appendable, rowIndex); }
[ "public", "void", "flushSomeAvailableRowsFrom", "(", "final", "XMLUtil", "util", ",", "final", "Appendable", "appendable", ",", "final", "int", "rowIndex", ")", "throws", "IOException", "{", "if", "(", "rowIndex", "==", "0", ")", "this", ".", "appendPreamble", "(", "util", ",", "appendable", ")", ";", "this", ".", "appendRows", "(", "util", ",", "appendable", ",", "rowIndex", ")", ";", "}" ]
Flush all rows from a given position, but do not freeze the table @param util a XMLUtil instance for writing XML @param appendable where to write @param rowIndex the index of the row @throws IOException if an I/O error occurs during the flush
[ "Flush", "all", "rows", "from", "a", "given", "position", "but", "do", "not", "freeze", "the", "table" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableAppender.java#L134-L139