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
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.contains
public boolean contains(T transaction, I item) { """ Checks if the given transaction-item pair is contained within the set @param transaction the transaction of the pair @param item the item of the pair @return <code>true</code> if the given transaction-item pair is contained within the set """ int t = transactionToIndex(transaction); if (t < 0) return false; int i = itemToIndex(item); if (i < 0) return false; return matrix.contains(t, i); }
java
public boolean contains(T transaction, I item) { int t = transactionToIndex(transaction); if (t < 0) return false; int i = itemToIndex(item); if (i < 0) return false; return matrix.contains(t, i); }
[ "public", "boolean", "contains", "(", "T", "transaction", ",", "I", "item", ")", "{", "int", "t", "=", "transactionToIndex", "(", "transaction", ")", ";", "if", "(", "t", "<", "0", ")", "return", "false", ";", "int", "i", "=", "itemToIndex", "(", "item", ")", ";", "if", "(", "i", "<", "0", ")", "return", "false", ";", "return", "matrix", ".", "contains", "(", "t", ",", "i", ")", ";", "}" ]
Checks if the given transaction-item pair is contained within the set @param transaction the transaction of the pair @param item the item of the pair @return <code>true</code> if the given transaction-item pair is contained within the set
[ "Checks", "if", "the", "given", "transaction", "-", "item", "pair", "is", "contained", "within", "the", "set" ]
train
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L384-L392
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.syncVirtualNetworkInfo
public void syncVirtualNetworkInfo(String resourceGroupName, String name) { """ Resume an App Service Environment. Resume an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @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 """ syncVirtualNetworkInfoWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
java
public void syncVirtualNetworkInfo(String resourceGroupName, String name) { syncVirtualNetworkInfoWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); }
[ "public", "void", "syncVirtualNetworkInfo", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "syncVirtualNetworkInfoWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Resume an App Service Environment. Resume an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @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
[ "Resume", "an", "App", "Service", "Environment", ".", "Resume", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceEnvironmentsInner.java#L5005-L5007
samskivert/samskivert
src/main/java/com/samskivert/util/StringUtil.java
StringUtil.fieldsToString
public static String fieldsToString (Object object, String sep) { """ Like {@link #fieldsToString(Object)} except that the supplied separator string will be used between fields. """ StringBuilder buf = new StringBuilder("["); fieldsToString(buf, object, sep); return buf.append("]").toString(); }
java
public static String fieldsToString (Object object, String sep) { StringBuilder buf = new StringBuilder("["); fieldsToString(buf, object, sep); return buf.append("]").toString(); }
[ "public", "static", "String", "fieldsToString", "(", "Object", "object", ",", "String", "sep", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "\"[\"", ")", ";", "fieldsToString", "(", "buf", ",", "object", ",", "sep", ")", ";", "return", "buf", ".", "append", "(", "\"]\"", ")", ".", "toString", "(", ")", ";", "}" ]
Like {@link #fieldsToString(Object)} except that the supplied separator string will be used between fields.
[ "Like", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/StringUtil.java#L525-L530
Alluxio/alluxio
core/common/src/main/java/alluxio/util/io/BufferUtils.java
BufferUtils.equalIncreasingByteArray
public static boolean equalIncreasingByteArray(int start, int len, byte[] arr) { """ Checks if the given byte array starts with an increasing sequence of bytes of the given length, starting from the given value. The array length must be equal to the length checked. @param start the starting value to use @param len the target length of the sequence @param arr the byte array to check @return true if the byte array has a prefix of length {@code len} that is an increasing sequence of bytes starting at {@code start} """ if (arr == null || arr.length != len) { return false; } for (int k = 0; k < len; k++) { if (arr[k] != (byte) (start + k)) { return false; } } return true; }
java
public static boolean equalIncreasingByteArray(int start, int len, byte[] arr) { if (arr == null || arr.length != len) { return false; } for (int k = 0; k < len; k++) { if (arr[k] != (byte) (start + k)) { return false; } } return true; }
[ "public", "static", "boolean", "equalIncreasingByteArray", "(", "int", "start", ",", "int", "len", ",", "byte", "[", "]", "arr", ")", "{", "if", "(", "arr", "==", "null", "||", "arr", ".", "length", "!=", "len", ")", "{", "return", "false", ";", "}", "for", "(", "int", "k", "=", "0", ";", "k", "<", "len", ";", "k", "++", ")", "{", "if", "(", "arr", "[", "k", "]", "!=", "(", "byte", ")", "(", "start", "+", "k", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Checks if the given byte array starts with an increasing sequence of bytes of the given length, starting from the given value. The array length must be equal to the length checked. @param start the starting value to use @param len the target length of the sequence @param arr the byte array to check @return true if the byte array has a prefix of length {@code len} that is an increasing sequence of bytes starting at {@code start}
[ "Checks", "if", "the", "given", "byte", "array", "starts", "with", "an", "increasing", "sequence", "of", "bytes", "of", "the", "given", "length", "starting", "from", "the", "given", "value", ".", "The", "array", "length", "must", "be", "equal", "to", "the", "length", "checked", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/BufferUtils.java#L207-L217
google/closure-compiler
src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java
JsDocInfoParser.createJSTypeExpression
JSTypeExpression createJSTypeExpression(Node n) { """ Constructs a new {@code JSTypeExpression}. @param n A node. May be null. """ return n == null ? null : new JSTypeExpression(n, getSourceName()); }
java
JSTypeExpression createJSTypeExpression(Node n) { return n == null ? null : new JSTypeExpression(n, getSourceName()); }
[ "JSTypeExpression", "createJSTypeExpression", "(", "Node", "n", ")", "{", "return", "n", "==", "null", "?", "null", ":", "new", "JSTypeExpression", "(", "n", ",", "getSourceName", "(", ")", ")", ";", "}" ]
Constructs a new {@code JSTypeExpression}. @param n A node. May be null.
[ "Constructs", "a", "new", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java#L1637-L1640
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
HttpContext.PATCH
public <T> Optional<T> PATCH(String partialUrl, Object payload, GenericType<T> returnType) { """ Execute a PATCH call against the partial URL. @param <T> The type parameter used for the return object @param partialUrl The partial URL to build @param payload The object to use for the PATCH @param returnType The expected return type @return The return type """ URI uri = buildUri(partialUrl); return executePatchRequest(uri, payload, null, null, returnType); }
java
public <T> Optional<T> PATCH(String partialUrl, Object payload, GenericType<T> returnType) { URI uri = buildUri(partialUrl); return executePatchRequest(uri, payload, null, null, returnType); }
[ "public", "<", "T", ">", "Optional", "<", "T", ">", "PATCH", "(", "String", "partialUrl", ",", "Object", "payload", ",", "GenericType", "<", "T", ">", "returnType", ")", "{", "URI", "uri", "=", "buildUri", "(", "partialUrl", ")", ";", "return", "executePatchRequest", "(", "uri", ",", "payload", ",", "null", ",", "null", ",", "returnType", ")", ";", "}" ]
Execute a PATCH call against the partial URL. @param <T> The type parameter used for the return object @param partialUrl The partial URL to build @param payload The object to use for the PATCH @param returnType The expected return type @return The return type
[ "Execute", "a", "PATCH", "call", "against", "the", "partial", "URL", "." ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L275-L279
tomgibara/bits
src/main/java/com/tomgibara/bits/BitVector.java
BitVector.fromBigInteger
public static BitVector fromBigInteger(BigInteger bigInt, int size) { """ Creates a {@link BitVector} from a <code>BigInteger</code>. The bits of the integer copied into the new bit vector. The size of the returned {@link BitVector} is the specified <code>size</code>. If the size exceeds <code>bigInt.bitLength()</code> then the most significant bits are padded with ones if the integer is negative and zeros otherwise. Negative values are recorded using 2's complement encoding. @param bigInt a big integer @param size the size of the {@link BitVector} to create @return a {@link BitVector} initialized with the bits of the big integer @see #fromBigInteger(BigInteger) @see Bits#asStore(BigInteger) """ if (bigInt == null) throw new IllegalArgumentException(); if (size < 0) throw new IllegalArgumentException(); return fromBigIntegerImpl(bigInt, size); }
java
public static BitVector fromBigInteger(BigInteger bigInt, int size) { if (bigInt == null) throw new IllegalArgumentException(); if (size < 0) throw new IllegalArgumentException(); return fromBigIntegerImpl(bigInt, size); }
[ "public", "static", "BitVector", "fromBigInteger", "(", "BigInteger", "bigInt", ",", "int", "size", ")", "{", "if", "(", "bigInt", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "if", "(", "size", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "return", "fromBigIntegerImpl", "(", "bigInt", ",", "size", ")", ";", "}" ]
Creates a {@link BitVector} from a <code>BigInteger</code>. The bits of the integer copied into the new bit vector. The size of the returned {@link BitVector} is the specified <code>size</code>. If the size exceeds <code>bigInt.bitLength()</code> then the most significant bits are padded with ones if the integer is negative and zeros otherwise. Negative values are recorded using 2's complement encoding. @param bigInt a big integer @param size the size of the {@link BitVector} to create @return a {@link BitVector} initialized with the bits of the big integer @see #fromBigInteger(BigInteger) @see Bits#asStore(BigInteger)
[ "Creates", "a", "{", "@link", "BitVector", "}", "from", "a", "<code", ">", "BigInteger<", "/", "code", ">", ".", "The", "bits", "of", "the", "integer", "copied", "into", "the", "new", "bit", "vector", ".", "The", "size", "of", "the", "returned", "{", "@link", "BitVector", "}", "is", "the", "specified", "<code", ">", "size<", "/", "code", ">", ".", "If", "the", "size", "exceeds", "<code", ">", "bigInt", ".", "bitLength", "()", "<", "/", "code", ">", "then", "the", "most", "significant", "bits", "are", "padded", "with", "ones", "if", "the", "integer", "is", "negative", "and", "zeros", "otherwise", ".", "Negative", "values", "are", "recorded", "using", "2", "s", "complement", "encoding", "." ]
train
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/BitVector.java#L136-L141
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java
GeneratedDConnectionDaoImpl.findByRefreshToken
public DConnection findByRefreshToken(java.lang.String refreshToken) { """ find-by method for unique field refreshToken @param refreshToken the unique attribute @return the unique DConnection for the specified refreshToken """ return queryUniqueByField(null, DConnectionMapper.Field.REFRESHTOKEN.getFieldName(), refreshToken); }
java
public DConnection findByRefreshToken(java.lang.String refreshToken) { return queryUniqueByField(null, DConnectionMapper.Field.REFRESHTOKEN.getFieldName(), refreshToken); }
[ "public", "DConnection", "findByRefreshToken", "(", "java", ".", "lang", ".", "String", "refreshToken", ")", "{", "return", "queryUniqueByField", "(", "null", ",", "DConnectionMapper", ".", "Field", ".", "REFRESHTOKEN", ".", "getFieldName", "(", ")", ",", "refreshToken", ")", ";", "}" ]
find-by method for unique field refreshToken @param refreshToken the unique attribute @return the unique DConnection for the specified refreshToken
[ "find", "-", "by", "method", "for", "unique", "field", "refreshToken" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L133-L135
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java
MultiUserChatLight.changeSubject
public void changeSubject(String subject) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Change the subject of the MUC Light. @param subject @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException """ MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, null, subject, null); connection.createStanzaCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow(); }
java
public void changeSubject(String subject) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { MUCLightSetConfigsIQ mucLightSetConfigIQ = new MUCLightSetConfigsIQ(room, null, subject, null); connection.createStanzaCollectorAndSend(mucLightSetConfigIQ).nextResultOrThrow(); }
[ "public", "void", "changeSubject", "(", "String", "subject", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "MUCLightSetConfigsIQ", "mucLightSetConfigIQ", "=", "new", "MUCLightSetConfigsIQ", "(", "room", ",", "null", ",", "subject", ",", "null", ")", ";", "connection", ".", "createStanzaCollectorAndSend", "(", "mucLightSetConfigIQ", ")", ".", "nextResultOrThrow", "(", ")", ";", "}" ]
Change the subject of the MUC Light. @param subject @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException
[ "Change", "the", "subject", "of", "the", "MUC", "Light", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLight.java#L454-L458
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.processCompositeFilter
private void processCompositeFilter(final StringBuilder whereBuilder, final List<Object> paramList, final CompositeFilter compositeFilter) throws RepositoryException { """ Processes composite filter. @param whereBuilder the specified where builder @param paramList the specified parameter list @param compositeFilter the specified composite filter @throws RepositoryException repository exception """ final List<Filter> subFilters = compositeFilter.getSubFilters(); if (2 > subFilters.size()) { throw new RepositoryException("At least two sub filters in a composite filter"); } whereBuilder.append("("); final Iterator<Filter> iterator = subFilters.iterator(); while (iterator.hasNext()) { final Filter filter = iterator.next(); if (filter instanceof PropertyFilter) { processPropertyFilter(whereBuilder, paramList, (PropertyFilter) filter); } else { // CompositeFilter processCompositeFilter(whereBuilder, paramList, (CompositeFilter) filter); } if (iterator.hasNext()) { switch (compositeFilter.getOperator()) { case AND: whereBuilder.append(" AND "); break; case OR: whereBuilder.append(" OR "); break; default: throw new RepositoryException("Unsupported composite filter [operator=" + compositeFilter.getOperator() + "]"); } } } whereBuilder.append(")"); }
java
private void processCompositeFilter(final StringBuilder whereBuilder, final List<Object> paramList, final CompositeFilter compositeFilter) throws RepositoryException { final List<Filter> subFilters = compositeFilter.getSubFilters(); if (2 > subFilters.size()) { throw new RepositoryException("At least two sub filters in a composite filter"); } whereBuilder.append("("); final Iterator<Filter> iterator = subFilters.iterator(); while (iterator.hasNext()) { final Filter filter = iterator.next(); if (filter instanceof PropertyFilter) { processPropertyFilter(whereBuilder, paramList, (PropertyFilter) filter); } else { // CompositeFilter processCompositeFilter(whereBuilder, paramList, (CompositeFilter) filter); } if (iterator.hasNext()) { switch (compositeFilter.getOperator()) { case AND: whereBuilder.append(" AND "); break; case OR: whereBuilder.append(" OR "); break; default: throw new RepositoryException("Unsupported composite filter [operator=" + compositeFilter.getOperator() + "]"); } } } whereBuilder.append(")"); }
[ "private", "void", "processCompositeFilter", "(", "final", "StringBuilder", "whereBuilder", ",", "final", "List", "<", "Object", ">", "paramList", ",", "final", "CompositeFilter", "compositeFilter", ")", "throws", "RepositoryException", "{", "final", "List", "<", "Filter", ">", "subFilters", "=", "compositeFilter", ".", "getSubFilters", "(", ")", ";", "if", "(", "2", ">", "subFilters", ".", "size", "(", ")", ")", "{", "throw", "new", "RepositoryException", "(", "\"At least two sub filters in a composite filter\"", ")", ";", "}", "whereBuilder", ".", "append", "(", "\"(\"", ")", ";", "final", "Iterator", "<", "Filter", ">", "iterator", "=", "subFilters", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "final", "Filter", "filter", "=", "iterator", ".", "next", "(", ")", ";", "if", "(", "filter", "instanceof", "PropertyFilter", ")", "{", "processPropertyFilter", "(", "whereBuilder", ",", "paramList", ",", "(", "PropertyFilter", ")", "filter", ")", ";", "}", "else", "{", "// CompositeFilter", "processCompositeFilter", "(", "whereBuilder", ",", "paramList", ",", "(", "CompositeFilter", ")", "filter", ")", ";", "}", "if", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "switch", "(", "compositeFilter", ".", "getOperator", "(", ")", ")", "{", "case", "AND", ":", "whereBuilder", ".", "append", "(", "\" AND \"", ")", ";", "break", ";", "case", "OR", ":", "whereBuilder", ".", "append", "(", "\" OR \"", ")", ";", "break", ";", "default", ":", "throw", "new", "RepositoryException", "(", "\"Unsupported composite filter [operator=\"", "+", "compositeFilter", ".", "getOperator", "(", ")", "+", "\"]\"", ")", ";", "}", "}", "}", "whereBuilder", ".", "append", "(", "\")\"", ")", ";", "}" ]
Processes composite filter. @param whereBuilder the specified where builder @param paramList the specified parameter list @param compositeFilter the specified composite filter @throws RepositoryException repository exception
[ "Processes", "composite", "filter", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L903-L939
iipc/webarchive-commons
src/main/java/org/archive/util/ProcessUtils.java
ProcessUtils.exec
public static ProcessUtils.ProcessResult exec(String [] args) throws IOException { """ Runs process. @param args List of process args. @return A ProcessResult data structure. @throws IOException If interrupted, we throw an IOException. If non-zero exit code, we throw an IOException (This may need to change). """ Process p = Runtime.getRuntime().exec(args); ProcessUtils pu = new ProcessUtils(); // Gobble up any output. StreamGobbler err = pu.new StreamGobbler(p.getErrorStream(), "stderr"); err.setDaemon(true); err.start(); StreamGobbler out = pu.new StreamGobbler(p.getInputStream(), "stdout"); out.setDaemon(true); out.start(); int exitVal; try { exitVal = p.waitFor(); } catch (InterruptedException e) { throw new IOException("Wait on process " + Arrays.toString(args) + " interrupted: " + e.getMessage()); } ProcessUtils.ProcessResult result = pu.new ProcessResult(args, exitVal, out.getSink(), err.getSink()); if (exitVal != 0) { throw new IOException(result.toString()); } else if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info(result.toString()); } return result; }
java
public static ProcessUtils.ProcessResult exec(String [] args) throws IOException { Process p = Runtime.getRuntime().exec(args); ProcessUtils pu = new ProcessUtils(); // Gobble up any output. StreamGobbler err = pu.new StreamGobbler(p.getErrorStream(), "stderr"); err.setDaemon(true); err.start(); StreamGobbler out = pu.new StreamGobbler(p.getInputStream(), "stdout"); out.setDaemon(true); out.start(); int exitVal; try { exitVal = p.waitFor(); } catch (InterruptedException e) { throw new IOException("Wait on process " + Arrays.toString(args) + " interrupted: " + e.getMessage()); } ProcessUtils.ProcessResult result = pu.new ProcessResult(args, exitVal, out.getSink(), err.getSink()); if (exitVal != 0) { throw new IOException(result.toString()); } else if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info(result.toString()); } return result; }
[ "public", "static", "ProcessUtils", ".", "ProcessResult", "exec", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "Process", "p", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "args", ")", ";", "ProcessUtils", "pu", "=", "new", "ProcessUtils", "(", ")", ";", "// Gobble up any output.", "StreamGobbler", "err", "=", "pu", ".", "new", "StreamGobbler", "(", "p", ".", "getErrorStream", "(", ")", ",", "\"stderr\"", ")", ";", "err", ".", "setDaemon", "(", "true", ")", ";", "err", ".", "start", "(", ")", ";", "StreamGobbler", "out", "=", "pu", ".", "new", "StreamGobbler", "(", "p", ".", "getInputStream", "(", ")", ",", "\"stdout\"", ")", ";", "out", ".", "setDaemon", "(", "true", ")", ";", "out", ".", "start", "(", ")", ";", "int", "exitVal", ";", "try", "{", "exitVal", "=", "p", ".", "waitFor", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Wait on process \"", "+", "Arrays", ".", "toString", "(", "args", ")", "+", "\" interrupted: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "ProcessUtils", ".", "ProcessResult", "result", "=", "pu", ".", "new", "ProcessResult", "(", "args", ",", "exitVal", ",", "out", ".", "getSink", "(", ")", ",", "err", ".", "getSink", "(", ")", ")", ";", "if", "(", "exitVal", "!=", "0", ")", "{", "throw", "new", "IOException", "(", "result", ".", "toString", "(", ")", ")", ";", "}", "else", "if", "(", "LOGGER", ".", "isLoggable", "(", "Level", ".", "INFO", ")", ")", "{", "LOGGER", ".", "info", "(", "result", ".", "toString", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Runs process. @param args List of process args. @return A ProcessResult data structure. @throws IOException If interrupted, we throw an IOException. If non-zero exit code, we throw an IOException (This may need to change).
[ "Runs", "process", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/ProcessUtils.java#L124-L150
jayantk/jklol
src/com/jayantkrish/jklol/models/TableFactor.java
TableFactor.pointDistribution
public static TableFactor pointDistribution(VariableNumMap vars, Assignment... assignments) { """ Gets a {@code TableFactor} over {@code vars} which assigns unit weight to all assignments in {@code assignments} and 0 to all other assignments. Requires each assignment in {@code assignments} to contain all of {@code vars}. @param vars @param assignment @return """ TableFactorBuilder builder = new TableFactorBuilder(vars, SparseTensorBuilder.getFactory()); for (int i = 0; i < assignments.length; i++) { builder.setWeight(assignments[i], 1.0); } // TODO: support for implicit repmat of the assignments. return builder.build(); }
java
public static TableFactor pointDistribution(VariableNumMap vars, Assignment... assignments) { TableFactorBuilder builder = new TableFactorBuilder(vars, SparseTensorBuilder.getFactory()); for (int i = 0; i < assignments.length; i++) { builder.setWeight(assignments[i], 1.0); } // TODO: support for implicit repmat of the assignments. return builder.build(); }
[ "public", "static", "TableFactor", "pointDistribution", "(", "VariableNumMap", "vars", ",", "Assignment", "...", "assignments", ")", "{", "TableFactorBuilder", "builder", "=", "new", "TableFactorBuilder", "(", "vars", ",", "SparseTensorBuilder", ".", "getFactory", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "assignments", ".", "length", ";", "i", "++", ")", "{", "builder", ".", "setWeight", "(", "assignments", "[", "i", "]", ",", "1.0", ")", ";", "}", "// TODO: support for implicit repmat of the assignments.", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Gets a {@code TableFactor} over {@code vars} which assigns unit weight to all assignments in {@code assignments} and 0 to all other assignments. Requires each assignment in {@code assignments} to contain all of {@code vars}. @param vars @param assignment @return
[ "Gets", "a", "{", "@code", "TableFactor", "}", "over", "{", "@code", "vars", "}", "which", "assigns", "unit", "weight", "to", "all", "assignments", "in", "{", "@code", "assignments", "}", "and", "0", "to", "all", "other", "assignments", ".", "Requires", "each", "assignment", "in", "{", "@code", "assignments", "}", "to", "contain", "all", "of", "{", "@code", "vars", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/TableFactor.java#L64-L72
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toLong
public static Long toLong(Object o, Long defaultValue) { """ cast a Object to a Long Object(reference type) @param o Object to cast @param defaultValue @return casted Long Object """ if (o instanceof Long) return (Long) o; if (defaultValue != null) return Long.valueOf(toLongValue(o, defaultValue.longValue())); long res = toLongValue(o, Long.MIN_VALUE); if (res == Long.MIN_VALUE) return defaultValue; return Long.valueOf(res); }
java
public static Long toLong(Object o, Long defaultValue) { if (o instanceof Long) return (Long) o; if (defaultValue != null) return Long.valueOf(toLongValue(o, defaultValue.longValue())); long res = toLongValue(o, Long.MIN_VALUE); if (res == Long.MIN_VALUE) return defaultValue; return Long.valueOf(res); }
[ "public", "static", "Long", "toLong", "(", "Object", "o", ",", "Long", "defaultValue", ")", "{", "if", "(", "o", "instanceof", "Long", ")", "return", "(", "Long", ")", "o", ";", "if", "(", "defaultValue", "!=", "null", ")", "return", "Long", ".", "valueOf", "(", "toLongValue", "(", "o", ",", "defaultValue", ".", "longValue", "(", ")", ")", ")", ";", "long", "res", "=", "toLongValue", "(", "o", ",", "Long", ".", "MIN_VALUE", ")", ";", "if", "(", "res", "==", "Long", ".", "MIN_VALUE", ")", "return", "defaultValue", ";", "return", "Long", ".", "valueOf", "(", "res", ")", ";", "}" ]
cast a Object to a Long Object(reference type) @param o Object to cast @param defaultValue @return casted Long Object
[ "cast", "a", "Object", "to", "a", "Long", "Object", "(", "reference", "type", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L1546-L1553
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java
MiniMax.updateMatrices
protected static <O> void updateMatrices(int size, MatrixParadigm mat, DBIDArrayMIter prots, PointerHierarchyRepresentationBuilder builder, Int2ObjectOpenHashMap<ModifiableDBIDs> clusters, DistanceQuery<O> dq, int c) { """ Update the entries of the matrices that contain a distance to c, the newly merged cluster. @param size number of ids in the data set @param mat matrix paradigm @param prots calculated prototypes @param builder Result builder @param clusters the clusters @param dq distance query of the data set @param c the cluster to update distances to """ final DBIDArrayIter ix = mat.ix, iy = mat.iy; // c is the new cluster. // Update entries (at (x,y) with x > y) in the matrix where x = c or y = c // Update entries at (c,y) with y < c ix.seek(c); for(iy.seek(0); iy.getOffset() < c; iy.advance()) { // Skip entry if already merged if(builder.isLinked(iy)) { continue; } updateEntry(mat, prots, clusters, dq, c, iy.getOffset()); } // Update entries at (x,c) with x > c iy.seek(c); for(ix.seek(c + 1); ix.valid(); ix.advance()) { // Skip entry if already merged if(builder.isLinked(ix)) { continue; } updateEntry(mat, prots, clusters, dq, ix.getOffset(), c); } }
java
protected static <O> void updateMatrices(int size, MatrixParadigm mat, DBIDArrayMIter prots, PointerHierarchyRepresentationBuilder builder, Int2ObjectOpenHashMap<ModifiableDBIDs> clusters, DistanceQuery<O> dq, int c) { final DBIDArrayIter ix = mat.ix, iy = mat.iy; // c is the new cluster. // Update entries (at (x,y) with x > y) in the matrix where x = c or y = c // Update entries at (c,y) with y < c ix.seek(c); for(iy.seek(0); iy.getOffset() < c; iy.advance()) { // Skip entry if already merged if(builder.isLinked(iy)) { continue; } updateEntry(mat, prots, clusters, dq, c, iy.getOffset()); } // Update entries at (x,c) with x > c iy.seek(c); for(ix.seek(c + 1); ix.valid(); ix.advance()) { // Skip entry if already merged if(builder.isLinked(ix)) { continue; } updateEntry(mat, prots, clusters, dq, ix.getOffset(), c); } }
[ "protected", "static", "<", "O", ">", "void", "updateMatrices", "(", "int", "size", ",", "MatrixParadigm", "mat", ",", "DBIDArrayMIter", "prots", ",", "PointerHierarchyRepresentationBuilder", "builder", ",", "Int2ObjectOpenHashMap", "<", "ModifiableDBIDs", ">", "clusters", ",", "DistanceQuery", "<", "O", ">", "dq", ",", "int", "c", ")", "{", "final", "DBIDArrayIter", "ix", "=", "mat", ".", "ix", ",", "iy", "=", "mat", ".", "iy", ";", "// c is the new cluster.", "// Update entries (at (x,y) with x > y) in the matrix where x = c or y = c", "// Update entries at (c,y) with y < c", "ix", ".", "seek", "(", "c", ")", ";", "for", "(", "iy", ".", "seek", "(", "0", ")", ";", "iy", ".", "getOffset", "(", ")", "<", "c", ";", "iy", ".", "advance", "(", ")", ")", "{", "// Skip entry if already merged", "if", "(", "builder", ".", "isLinked", "(", "iy", ")", ")", "{", "continue", ";", "}", "updateEntry", "(", "mat", ",", "prots", ",", "clusters", ",", "dq", ",", "c", ",", "iy", ".", "getOffset", "(", ")", ")", ";", "}", "// Update entries at (x,c) with x > c", "iy", ".", "seek", "(", "c", ")", ";", "for", "(", "ix", ".", "seek", "(", "c", "+", "1", ")", ";", "ix", ".", "valid", "(", ")", ";", "ix", ".", "advance", "(", ")", ")", "{", "// Skip entry if already merged", "if", "(", "builder", ".", "isLinked", "(", "ix", ")", ")", "{", "continue", ";", "}", "updateEntry", "(", "mat", ",", "prots", ",", "clusters", ",", "dq", ",", "ix", ".", "getOffset", "(", ")", ",", "c", ")", ";", "}", "}" ]
Update the entries of the matrices that contain a distance to c, the newly merged cluster. @param size number of ids in the data set @param mat matrix paradigm @param prots calculated prototypes @param builder Result builder @param clusters the clusters @param dq distance query of the data set @param c the cluster to update distances to
[ "Update", "the", "entries", "of", "the", "matrices", "that", "contain", "a", "distance", "to", "c", "the", "newly", "merged", "cluster", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/MiniMax.java#L237-L261
aws/aws-sdk-java
aws-java-sdk-lex/src/main/java/com/amazonaws/services/lexruntime/model/PostTextRequest.java
PostTextRequest.withSessionAttributes
public PostTextRequest withSessionAttributes(java.util.Map<String, String> sessionAttributes) { """ <p> Application-specific information passed between Amazon Lex and a client application. </p> <p> For more information, see <a href="http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-session-attribs">Setting Session Attributes</a>. </p> @param sessionAttributes Application-specific information passed between Amazon Lex and a client application.</p> <p> For more information, see <a href="http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-session-attribs">Setting Session Attributes</a>. @return Returns a reference to this object so that method calls can be chained together. """ setSessionAttributes(sessionAttributes); return this; }
java
public PostTextRequest withSessionAttributes(java.util.Map<String, String> sessionAttributes) { setSessionAttributes(sessionAttributes); return this; }
[ "public", "PostTextRequest", "withSessionAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "sessionAttributes", ")", "{", "setSessionAttributes", "(", "sessionAttributes", ")", ";", "return", "this", ";", "}" ]
<p> Application-specific information passed between Amazon Lex and a client application. </p> <p> For more information, see <a href="http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-session-attribs">Setting Session Attributes</a>. </p> @param sessionAttributes Application-specific information passed between Amazon Lex and a client application.</p> <p> For more information, see <a href="http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html#context-mgmt-session-attribs">Setting Session Attributes</a>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Application", "-", "specific", "information", "passed", "between", "Amazon", "Lex", "and", "a", "client", "application", ".", "<", "/", "p", ">", "<p", ">", "For", "more", "information", "see", "<a", "href", "=", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "lex", "/", "latest", "/", "dg", "/", "context", "-", "mgmt", ".", "html#context", "-", "mgmt", "-", "session", "-", "attribs", ">", "Setting", "Session", "Attributes<", "/", "a", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lex/src/main/java/com/amazonaws/services/lexruntime/model/PostTextRequest.java#L482-L485
OpenLiberty/open-liberty
dev/com.ibm.ws.crypto.ltpakeyutil/src/com/ibm/ws/crypto/ltpakeyutil/LTPAKeyFileUtilityImpl.java
LTPAKeyFileUtilityImpl.addLTPAKeysToFile
protected void addLTPAKeysToFile(OutputStream os, Properties ltpaProps) throws Exception { """ Write the LTPA key properties to the given OutputStream. This method will close the OutputStream. @param keyImportFile The import file to be created @param ltpaProps The properties containing the LTPA keys @throws TokenException @throws IOException """ try { // Write the ltpa key propeperties to ltpaProps.store(os, null); } catch (IOException e) { throw e; } finally { if (os != null) try { os.close(); } catch (IOException e) { } } return; }
java
protected void addLTPAKeysToFile(OutputStream os, Properties ltpaProps) throws Exception { try { // Write the ltpa key propeperties to ltpaProps.store(os, null); } catch (IOException e) { throw e; } finally { if (os != null) try { os.close(); } catch (IOException e) { } } return; }
[ "protected", "void", "addLTPAKeysToFile", "(", "OutputStream", "os", ",", "Properties", "ltpaProps", ")", "throws", "Exception", "{", "try", "{", "// Write the ltpa key propeperties to", "ltpaProps", ".", "store", "(", "os", ",", "null", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "e", ";", "}", "finally", "{", "if", "(", "os", "!=", "null", ")", "try", "{", "os", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "return", ";", "}" ]
Write the LTPA key properties to the given OutputStream. This method will close the OutputStream. @param keyImportFile The import file to be created @param ltpaProps The properties containing the LTPA keys @throws TokenException @throws IOException
[ "Write", "the", "LTPA", "key", "properties", "to", "the", "given", "OutputStream", ".", "This", "method", "will", "close", "the", "OutputStream", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.ltpakeyutil/src/com/ibm/ws/crypto/ltpakeyutil/LTPAKeyFileUtilityImpl.java#L109-L124
sniggle/simple-pgp
simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java
IOUtils.copy
public static void copy(InputStream inputStream, final OutputStream outputStream, byte[] buffer, final StreamHandler addtionalHandling) throws IOException { """ copies the input stream to the output stream using a custom buffer size and applying additional stream handling @param inputStream the source stream @param outputStream the target stream @param buffer the custom buffer @param addtionalHandling a stream handler that allows additional handling of the stream @throws IOException """ LOGGER.trace("copy(InputStream, OutputStream, byte[], StreamHandler)"); LOGGER.debug("buffer size: {} bytes", (buffer!=null) ? buffer.length : "null"); process(inputStream, new StreamHandler() { @Override public void handleStreamBuffer(byte[] buffer, int offset, int length) throws IOException { outputStream.write(buffer, offset, length); if( addtionalHandling != null ) { addtionalHandling.handleStreamBuffer(buffer, offset, length); } } }, buffer); }
java
public static void copy(InputStream inputStream, final OutputStream outputStream, byte[] buffer, final StreamHandler addtionalHandling) throws IOException { LOGGER.trace("copy(InputStream, OutputStream, byte[], StreamHandler)"); LOGGER.debug("buffer size: {} bytes", (buffer!=null) ? buffer.length : "null"); process(inputStream, new StreamHandler() { @Override public void handleStreamBuffer(byte[] buffer, int offset, int length) throws IOException { outputStream.write(buffer, offset, length); if( addtionalHandling != null ) { addtionalHandling.handleStreamBuffer(buffer, offset, length); } } }, buffer); }
[ "public", "static", "void", "copy", "(", "InputStream", "inputStream", ",", "final", "OutputStream", "outputStream", ",", "byte", "[", "]", "buffer", ",", "final", "StreamHandler", "addtionalHandling", ")", "throws", "IOException", "{", "LOGGER", ".", "trace", "(", "\"copy(InputStream, OutputStream, byte[], StreamHandler)\"", ")", ";", "LOGGER", ".", "debug", "(", "\"buffer size: {} bytes\"", ",", "(", "buffer", "!=", "null", ")", "?", "buffer", ".", "length", ":", "\"null\"", ")", ";", "process", "(", "inputStream", ",", "new", "StreamHandler", "(", ")", "{", "@", "Override", "public", "void", "handleStreamBuffer", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "outputStream", ".", "write", "(", "buffer", ",", "offset", ",", "length", ")", ";", "if", "(", "addtionalHandling", "!=", "null", ")", "{", "addtionalHandling", ".", "handleStreamBuffer", "(", "buffer", ",", "offset", ",", "length", ")", ";", "}", "}", "}", ",", "buffer", ")", ";", "}" ]
copies the input stream to the output stream using a custom buffer size and applying additional stream handling @param inputStream the source stream @param outputStream the target stream @param buffer the custom buffer @param addtionalHandling a stream handler that allows additional handling of the stream @throws IOException
[ "copies", "the", "input", "stream", "to", "the", "output", "stream", "using", "a", "custom", "buffer", "size", "and", "applying", "additional", "stream", "handling" ]
train
https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java#L88-L101
code4everything/util
src/main/java/com/zhazhapan/util/Checker.java
Checker.checkNull
public static Integer checkNull(Integer value, int elseValue) { """ 检查Integer是否为null @param value 值 @param elseValue 为null返回的值 @return {@link Integer} @since 1.0.8 """ return checkNull(value, Integer.valueOf(elseValue)); }
java
public static Integer checkNull(Integer value, int elseValue) { return checkNull(value, Integer.valueOf(elseValue)); }
[ "public", "static", "Integer", "checkNull", "(", "Integer", "value", ",", "int", "elseValue", ")", "{", "return", "checkNull", "(", "value", ",", "Integer", ".", "valueOf", "(", "elseValue", ")", ")", ";", "}" ]
检查Integer是否为null @param value 值 @param elseValue 为null返回的值 @return {@link Integer} @since 1.0.8
[ "检查Integer是否为null" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L1226-L1228
OpenBEL/openbel-framework
org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java
BELUtilities.mapfx
public static <K, V> void mapfx(Map<K, V> map, MapFunction<K, V> fx) { """ Applies the function {@code fx} to each of the {@link BELUtilities#entries(Map) entries} within the supplied map. @param map Non-null {@link Map} @param fx Non-null {@link MapFunction} to apply """ Set<Entry<K, V>> entries = entries(map); for (final Entry<K, V> entry : entries) { K key = entry.getKey(); V value = entry.getValue(); fx.apply(key, value); } }
java
public static <K, V> void mapfx(Map<K, V> map, MapFunction<K, V> fx) { Set<Entry<K, V>> entries = entries(map); for (final Entry<K, V> entry : entries) { K key = entry.getKey(); V value = entry.getValue(); fx.apply(key, value); } }
[ "public", "static", "<", "K", ",", "V", ">", "void", "mapfx", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "MapFunction", "<", "K", ",", "V", ">", "fx", ")", "{", "Set", "<", "Entry", "<", "K", ",", "V", ">", ">", "entries", "=", "entries", "(", "map", ")", ";", "for", "(", "final", "Entry", "<", "K", ",", "V", ">", "entry", ":", "entries", ")", "{", "K", "key", "=", "entry", ".", "getKey", "(", ")", ";", "V", "value", "=", "entry", ".", "getValue", "(", ")", ";", "fx", ".", "apply", "(", "key", ",", "value", ")", ";", "}", "}" ]
Applies the function {@code fx} to each of the {@link BELUtilities#entries(Map) entries} within the supplied map. @param map Non-null {@link Map} @param fx Non-null {@link MapFunction} to apply
[ "Applies", "the", "function", "{", "@code", "fx", "}", "to", "each", "of", "the", "{", "@link", "BELUtilities#entries", "(", "Map", ")", "entries", "}", "within", "the", "supplied", "map", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/BELUtilities.java#L769-L776
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/data/ArrayBasedIndexedInts.java
ArrayBasedIndexedInts.setValues
public void setValues(int[] values, int size) { """ Sets the values from the given array. The given values array is not reused and not prone to be mutated later. Instead, the values from this array are copied into an array which is internal to ArrayBasedIndexedInts. """ if (size < 0 || size > values.length) { throw new IAE("Size[%d] should be between 0 and %d", size, values.length); } ensureSize(size); System.arraycopy(values, 0, expansion, 0, size); this.size = size; }
java
public void setValues(int[] values, int size) { if (size < 0 || size > values.length) { throw new IAE("Size[%d] should be between 0 and %d", size, values.length); } ensureSize(size); System.arraycopy(values, 0, expansion, 0, size); this.size = size; }
[ "public", "void", "setValues", "(", "int", "[", "]", "values", ",", "int", "size", ")", "{", "if", "(", "size", "<", "0", "||", "size", ">", "values", ".", "length", ")", "{", "throw", "new", "IAE", "(", "\"Size[%d] should be between 0 and %d\"", ",", "size", ",", "values", ".", "length", ")", ";", "}", "ensureSize", "(", "size", ")", ";", "System", ".", "arraycopy", "(", "values", ",", "0", ",", "expansion", ",", "0", ",", "size", ")", ";", "this", ".", "size", "=", "size", ";", "}" ]
Sets the values from the given array. The given values array is not reused and not prone to be mutated later. Instead, the values from this array are copied into an array which is internal to ArrayBasedIndexedInts.
[ "Sets", "the", "values", "from", "the", "given", "array", ".", "The", "given", "values", "array", "is", "not", "reused", "and", "not", "prone", "to", "be", "mutated", "later", ".", "Instead", "the", "values", "from", "this", "array", "are", "copied", "into", "an", "array", "which", "is", "internal", "to", "ArrayBasedIndexedInts", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/data/ArrayBasedIndexedInts.java#L66-L74
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/component/behavior/ClientBehaviorContext.java
ClientBehaviorContext.createClientBehaviorContext
public static ClientBehaviorContext createClientBehaviorContext(FacesContext context, UIComponent component, String eventName, String sourceId, Collection<ClientBehaviorContext.Parameter> parameters) { """ <p class="changed_added_2_0">Creates a ClientBehaviorContext instance.</p> @param context the <code>FacesContext</code> for the current request. @param component the component instance to which the <code>ClientBehavior</code> is attached. @param eventName the name of the behavior event to which the <code>ClientBehavior</code> is attached. @param sourceId the id to use as the ClientBehavior's "source". @param parameters the collection of parameters for submitting ClientBehaviors to include in the request. @return a <code>ClientBehaviorContext</code> instance configured with the provided values. @throws NullPointerException if <code>context</code>, <code>component</code> or <code>eventName</code> is <code>null</code> @since 2.0 """ return new ClientBehaviorContextImpl(context, component, eventName, sourceId, parameters); }
java
public static ClientBehaviorContext createClientBehaviorContext(FacesContext context, UIComponent component, String eventName, String sourceId, Collection<ClientBehaviorContext.Parameter> parameters) { return new ClientBehaviorContextImpl(context, component, eventName, sourceId, parameters); }
[ "public", "static", "ClientBehaviorContext", "createClientBehaviorContext", "(", "FacesContext", "context", ",", "UIComponent", "component", ",", "String", "eventName", ",", "String", "sourceId", ",", "Collection", "<", "ClientBehaviorContext", ".", "Parameter", ">", "parameters", ")", "{", "return", "new", "ClientBehaviorContextImpl", "(", "context", ",", "component", ",", "eventName", ",", "sourceId", ",", "parameters", ")", ";", "}" ]
<p class="changed_added_2_0">Creates a ClientBehaviorContext instance.</p> @param context the <code>FacesContext</code> for the current request. @param component the component instance to which the <code>ClientBehavior</code> is attached. @param eventName the name of the behavior event to which the <code>ClientBehavior</code> is attached. @param sourceId the id to use as the ClientBehavior's "source". @param parameters the collection of parameters for submitting ClientBehaviors to include in the request. @return a <code>ClientBehaviorContext</code> instance configured with the provided values. @throws NullPointerException if <code>context</code>, <code>component</code> or <code>eventName</code> is <code>null</code> @since 2.0
[ "<p", "class", "=", "changed_added_2_0", ">", "Creates", "a", "ClientBehaviorContext", "instance", ".", "<", "/", "p", ">" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/behavior/ClientBehaviorContext.java#L79-L86
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java
WDialog.handleTriggerOpenAction
protected void handleTriggerOpenAction(final Request request) { """ Run the trigger open action. @param request the request being processed """ // Run the action (if set) final Action action = getTriggerOpenAction(); if (action != null) { final ActionEvent event = new ActionEvent(this, OPEN_DIALOG_ACTION); Runnable later = new Runnable() { @Override public void run() { action.execute(event); } }; invokeLater(later); } }
java
protected void handleTriggerOpenAction(final Request request) { // Run the action (if set) final Action action = getTriggerOpenAction(); if (action != null) { final ActionEvent event = new ActionEvent(this, OPEN_DIALOG_ACTION); Runnable later = new Runnable() { @Override public void run() { action.execute(event); } }; invokeLater(later); } }
[ "protected", "void", "handleTriggerOpenAction", "(", "final", "Request", "request", ")", "{", "// Run the action (if set)", "final", "Action", "action", "=", "getTriggerOpenAction", "(", ")", ";", "if", "(", "action", "!=", "null", ")", "{", "final", "ActionEvent", "event", "=", "new", "ActionEvent", "(", "this", ",", "OPEN_DIALOG_ACTION", ")", ";", "Runnable", "later", "=", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "action", ".", "execute", "(", "event", ")", ";", "}", "}", ";", "invokeLater", "(", "later", ")", ";", "}", "}" ]
Run the trigger open action. @param request the request being processed
[ "Run", "the", "trigger", "open", "action", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java#L337-L350
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/TextUICommandLine.java
TextUICommandLine.addAuxClassPathEntries
private void addAuxClassPathEntries(String argument) { """ Parse the argument as auxclasspath entries and add them @param argument """ StringTokenizer tok = new StringTokenizer(argument, File.pathSeparator); while (tok.hasMoreTokens()) { project.addAuxClasspathEntry(tok.nextToken()); } }
java
private void addAuxClassPathEntries(String argument) { StringTokenizer tok = new StringTokenizer(argument, File.pathSeparator); while (tok.hasMoreTokens()) { project.addAuxClasspathEntry(tok.nextToken()); } }
[ "private", "void", "addAuxClassPathEntries", "(", "String", "argument", ")", "{", "StringTokenizer", "tok", "=", "new", "StringTokenizer", "(", "argument", ",", "File", ".", "pathSeparator", ")", ";", "while", "(", "tok", ".", "hasMoreTokens", "(", ")", ")", "{", "project", ".", "addAuxClasspathEntry", "(", "tok", ".", "nextToken", "(", ")", ")", ";", "}", "}" ]
Parse the argument as auxclasspath entries and add them @param argument
[ "Parse", "the", "argument", "as", "auxclasspath", "entries", "and", "add", "them" ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/TextUICommandLine.java#L569-L574
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/PkEnumeration.java
PkEnumeration.getIdentityFromResultSet
private Identity getIdentityFromResultSet() { """ returns an Identity object representing the current resultset row """ try { // 1. get an empty instance of the target class Constructor con = classDescriptor.getZeroArgumentConstructor(); Object obj = ConstructorHelper.instantiate(con); // 2. fill only primary key values from Resultset Object colValue; FieldDescriptor fld; FieldDescriptor[] pkfields = classDescriptor.getPkFields(); for (int i = 0; i < pkfields.length; i++) { fld = pkfields[i]; colValue = fld.getJdbcType().getObjectFromColumn(resultSetAndStatment.m_rs, fld.getColumnName()); fld.getPersistentField().set(obj, colValue); } // 3. return the representing identity object return broker.serviceIdentity().buildIdentity(classDescriptor, obj); } catch (SQLException e) { throw new PersistenceBrokerSQLException("Error reading object from column", e); } catch (Exception e) { throw new PersistenceBrokerException("Error reading Identity from result set", e); } }
java
private Identity getIdentityFromResultSet() { try { // 1. get an empty instance of the target class Constructor con = classDescriptor.getZeroArgumentConstructor(); Object obj = ConstructorHelper.instantiate(con); // 2. fill only primary key values from Resultset Object colValue; FieldDescriptor fld; FieldDescriptor[] pkfields = classDescriptor.getPkFields(); for (int i = 0; i < pkfields.length; i++) { fld = pkfields[i]; colValue = fld.getJdbcType().getObjectFromColumn(resultSetAndStatment.m_rs, fld.getColumnName()); fld.getPersistentField().set(obj, colValue); } // 3. return the representing identity object return broker.serviceIdentity().buildIdentity(classDescriptor, obj); } catch (SQLException e) { throw new PersistenceBrokerSQLException("Error reading object from column", e); } catch (Exception e) { throw new PersistenceBrokerException("Error reading Identity from result set", e); } }
[ "private", "Identity", "getIdentityFromResultSet", "(", ")", "{", "try", "{", "// 1. get an empty instance of the target class\r", "Constructor", "con", "=", "classDescriptor", ".", "getZeroArgumentConstructor", "(", ")", ";", "Object", "obj", "=", "ConstructorHelper", ".", "instantiate", "(", "con", ")", ";", "// 2. fill only primary key values from Resultset\r", "Object", "colValue", ";", "FieldDescriptor", "fld", ";", "FieldDescriptor", "[", "]", "pkfields", "=", "classDescriptor", ".", "getPkFields", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pkfields", ".", "length", ";", "i", "++", ")", "{", "fld", "=", "pkfields", "[", "i", "]", ";", "colValue", "=", "fld", ".", "getJdbcType", "(", ")", ".", "getObjectFromColumn", "(", "resultSetAndStatment", ".", "m_rs", ",", "fld", ".", "getColumnName", "(", ")", ")", ";", "fld", ".", "getPersistentField", "(", ")", ".", "set", "(", "obj", ",", "colValue", ")", ";", "}", "// 3. return the representing identity object\r", "return", "broker", ".", "serviceIdentity", "(", ")", ".", "buildIdentity", "(", "classDescriptor", ",", "obj", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "PersistenceBrokerSQLException", "(", "\"Error reading object from column\"", ",", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "PersistenceBrokerException", "(", "\"Error reading Identity from result set\"", ",", "e", ")", ";", "}", "}" ]
returns an Identity object representing the current resultset row
[ "returns", "an", "Identity", "object", "representing", "the", "current", "resultset", "row" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/PkEnumeration.java#L97-L127
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java
Calendar.getInstance
public static Calendar getInstance(TimeZone zone, Locale aLocale) { """ Returns a calendar with the specified time zone and locale. @param zone the time zone to use @param aLocale the locale for the week data @return a Calendar. """ return getInstanceInternal(zone, ULocale.forLocale(aLocale)); }
java
public static Calendar getInstance(TimeZone zone, Locale aLocale) { return getInstanceInternal(zone, ULocale.forLocale(aLocale)); }
[ "public", "static", "Calendar", "getInstance", "(", "TimeZone", "zone", ",", "Locale", "aLocale", ")", "{", "return", "getInstanceInternal", "(", "zone", ",", "ULocale", ".", "forLocale", "(", "aLocale", ")", ")", ";", "}" ]
Returns a calendar with the specified time zone and locale. @param zone the time zone to use @param aLocale the locale for the week data @return a Calendar.
[ "Returns", "a", "calendar", "with", "the", "specified", "time", "zone", "and", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L1667-L1669
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java
OfferService.processFailedReceivedDeleted
private void processFailedReceivedDeleted(long[] failedMap, Block[] sent) { """ Adds blocks of incremental block report back to the receivedAndDeletedBlockList when the blocks are to be retried later (when sending to standby) @param failed """ synchronized (receivedAndDeletedBlockList) { // Blocks that do not belong to an Inode are saved for // retransmisions for (int i = sent.length - 1 ; i >= 0; i--) { if(!LightWeightBitSet.get(failedMap, i)){ continue; } // Insert into retry list. LOG.info("Block " + sent[i] + " does not belong to any file " + "on namenode " + avatarnodeAddress + " Retry later."); receivedAndDeletedBlockList.add(0, sent[i]); if (!DFSUtil.isDeleted(sent[i])) { pendingReceivedRequests++; } } lastBlockReceivedFailed = AvatarDataNode.now(); } }
java
private void processFailedReceivedDeleted(long[] failedMap, Block[] sent) { synchronized (receivedAndDeletedBlockList) { // Blocks that do not belong to an Inode are saved for // retransmisions for (int i = sent.length - 1 ; i >= 0; i--) { if(!LightWeightBitSet.get(failedMap, i)){ continue; } // Insert into retry list. LOG.info("Block " + sent[i] + " does not belong to any file " + "on namenode " + avatarnodeAddress + " Retry later."); receivedAndDeletedBlockList.add(0, sent[i]); if (!DFSUtil.isDeleted(sent[i])) { pendingReceivedRequests++; } } lastBlockReceivedFailed = AvatarDataNode.now(); } }
[ "private", "void", "processFailedReceivedDeleted", "(", "long", "[", "]", "failedMap", ",", "Block", "[", "]", "sent", ")", "{", "synchronized", "(", "receivedAndDeletedBlockList", ")", "{", "// Blocks that do not belong to an Inode are saved for", "// retransmisions", "for", "(", "int", "i", "=", "sent", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "!", "LightWeightBitSet", ".", "get", "(", "failedMap", ",", "i", ")", ")", "{", "continue", ";", "}", "// Insert into retry list.", "LOG", ".", "info", "(", "\"Block \"", "+", "sent", "[", "i", "]", "+", "\" does not belong to any file \"", "+", "\"on namenode \"", "+", "avatarnodeAddress", "+", "\" Retry later.\"", ")", ";", "receivedAndDeletedBlockList", ".", "add", "(", "0", ",", "sent", "[", "i", "]", ")", ";", "if", "(", "!", "DFSUtil", ".", "isDeleted", "(", "sent", "[", "i", "]", ")", ")", "{", "pendingReceivedRequests", "++", ";", "}", "}", "lastBlockReceivedFailed", "=", "AvatarDataNode", ".", "now", "(", ")", ";", "}", "}" ]
Adds blocks of incremental block report back to the receivedAndDeletedBlockList when the blocks are to be retried later (when sending to standby) @param failed
[ "Adds", "blocks", "of", "incremental", "block", "report", "back", "to", "the", "receivedAndDeletedBlockList", "when", "the", "blocks", "are", "to", "be", "retried", "later", "(", "when", "sending", "to", "standby", ")" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/OfferService.java#L511-L529
Azure/azure-sdk-for-java
notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java
NotificationHubsInner.deleteAuthorizationRuleAsync
public Observable<Void> deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName) { """ Deletes a notificationHub authorization rule. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @param authorizationRuleName Authorization Rule Name. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName) { return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deleteAuthorizationRuleAsync", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ",", "String", "notificationHubName", ",", "String", "authorizationRuleName", ")", "{", "return", "deleteAuthorizationRuleWithServiceResponseAsync", "(", "resourceGroupName", ",", "namespaceName", ",", "notificationHubName", ",", "authorizationRuleName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Deletes a notificationHub authorization rule. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @param authorizationRuleName Authorization Rule Name. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Deletes", "a", "notificationHub", "authorization", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L1038-L1045
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/ssh2/AuthenticationProtocol.java
AuthenticationProtocol.sendRequest
public void sendRequest(String username, String servicename, String methodname, byte[] requestdata) throws SshException { """ Send an authentication request. This sends an SSH_MSG_USERAUTH_REQUEST message. @param username @param servicename @param methodname @param requestdata the request data as defined by the authentication specification @throws SshException """ ByteArrayWriter msg = new ByteArrayWriter(); try { msg.write(SSH_MSG_USERAUTH_REQUEST); msg.writeString(username); msg.writeString(servicename); msg.writeString(methodname); if (requestdata != null) { msg.write(requestdata); } transport.sendMessage(msg.toByteArray(), true); } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } finally { try { msg.close(); } catch (IOException e) { } } }
java
public void sendRequest(String username, String servicename, String methodname, byte[] requestdata) throws SshException { ByteArrayWriter msg = new ByteArrayWriter(); try { msg.write(SSH_MSG_USERAUTH_REQUEST); msg.writeString(username); msg.writeString(servicename); msg.writeString(methodname); if (requestdata != null) { msg.write(requestdata); } transport.sendMessage(msg.toByteArray(), true); } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } finally { try { msg.close(); } catch (IOException e) { } } }
[ "public", "void", "sendRequest", "(", "String", "username", ",", "String", "servicename", ",", "String", "methodname", ",", "byte", "[", "]", "requestdata", ")", "throws", "SshException", "{", "ByteArrayWriter", "msg", "=", "new", "ByteArrayWriter", "(", ")", ";", "try", "{", "msg", ".", "write", "(", "SSH_MSG_USERAUTH_REQUEST", ")", ";", "msg", ".", "writeString", "(", "username", ")", ";", "msg", ".", "writeString", "(", "servicename", ")", ";", "msg", ".", "writeString", "(", "methodname", ")", ";", "if", "(", "requestdata", "!=", "null", ")", "{", "msg", ".", "write", "(", "requestdata", ")", ";", "}", "transport", ".", "sendMessage", "(", "msg", ".", "toByteArray", "(", ")", ",", "true", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "SshException", "(", "ex", ",", "SshException", ".", "INTERNAL_ERROR", ")", ";", "}", "finally", "{", "try", "{", "msg", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "}", "}" ]
Send an authentication request. This sends an SSH_MSG_USERAUTH_REQUEST message. @param username @param servicename @param methodname @param requestdata the request data as defined by the authentication specification @throws SshException
[ "Send", "an", "authentication", "request", ".", "This", "sends", "an", "SSH_MSG_USERAUTH_REQUEST", "message", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/AuthenticationProtocol.java#L274-L297
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/ExponentialDistribution.java
ExponentialDistribution.logpdf
public static double logpdf(double val, double rate) { """ log PDF, static version @param val Value to compute PDF at @param rate Rate parameter (1/scale) @return probability density """ return val < 0. ? Double.NEGATIVE_INFINITY : FastMath.log(rate) - rate * val; }
java
public static double logpdf(double val, double rate) { return val < 0. ? Double.NEGATIVE_INFINITY : FastMath.log(rate) - rate * val; }
[ "public", "static", "double", "logpdf", "(", "double", "val", ",", "double", "rate", ")", "{", "return", "val", "<", "0.", "?", "Double", ".", "NEGATIVE_INFINITY", ":", "FastMath", ".", "log", "(", "rate", ")", "-", "rate", "*", "val", ";", "}" ]
log PDF, static version @param val Value to compute PDF at @param rate Rate parameter (1/scale) @return probability density
[ "log", "PDF", "static", "version" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/ExponentialDistribution.java#L149-L151
tzaeschke/zoodb
src/org/zoodb/internal/util/ReflTools.java
ReflTools.getField
public static final <T> Field getField(Class<T> cls, String fieldName) { """ Gets the field <tt>fieldName</tt> from class <tt>cls</tt>, makes it accessible with <tt>Field.setAccessible(true)</tt> and returns it. @param <T> The type @param cls The class @param fieldName The field name @return the requested <tt>Field</tt> instance. """ try { Field f = cls.getDeclaredField(fieldName); f.setAccessible(true); return f; } catch (SecurityException e) { throw new RuntimeException(e); } catch (NoSuchFieldException e) { if (cls.getSuperclass() != null) { return getField(cls.getSuperclass(), fieldName); } throw new RuntimeException(e); } }
java
public static final <T> Field getField(Class<T> cls, String fieldName) { try { Field f = cls.getDeclaredField(fieldName); f.setAccessible(true); return f; } catch (SecurityException e) { throw new RuntimeException(e); } catch (NoSuchFieldException e) { if (cls.getSuperclass() != null) { return getField(cls.getSuperclass(), fieldName); } throw new RuntimeException(e); } }
[ "public", "static", "final", "<", "T", ">", "Field", "getField", "(", "Class", "<", "T", ">", "cls", ",", "String", "fieldName", ")", "{", "try", "{", "Field", "f", "=", "cls", ".", "getDeclaredField", "(", "fieldName", ")", ";", "f", ".", "setAccessible", "(", "true", ")", ";", "return", "f", ";", "}", "catch", "(", "SecurityException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "catch", "(", "NoSuchFieldException", "e", ")", "{", "if", "(", "cls", ".", "getSuperclass", "(", ")", "!=", "null", ")", "{", "return", "getField", "(", "cls", ".", "getSuperclass", "(", ")", ",", "fieldName", ")", ";", "}", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Gets the field <tt>fieldName</tt> from class <tt>cls</tt>, makes it accessible with <tt>Field.setAccessible(true)</tt> and returns it. @param <T> The type @param cls The class @param fieldName The field name @return the requested <tt>Field</tt> instance.
[ "Gets", "the", "field", "<tt", ">", "fieldName<", "/", "tt", ">", "from", "class", "<tt", ">", "cls<", "/", "tt", ">", "makes", "it", "accessible", "with", "<tt", ">", "Field", ".", "setAccessible", "(", "true", ")", "<", "/", "tt", ">", "and", "returns", "it", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/ReflTools.java#L81-L94
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/indexing/BranchUniversalObject.java
BranchUniversalObject.userCompletedAction
public void userCompletedAction(String action, HashMap<String, String> metadata) { """ <p> Method to report user actions happened on this BUO. Use this method to report the user actions for analytics purpose. </p> @param action A {@link String }with value of user action name. See {@link BranchEvent} for Branch defined user events. @param metadata A HashMap containing any additional metadata need to add to this user event NOTE : please consider using {@link #userCompletedAction(BRANCH_STANDARD_EVENT, HashMap)} instead """ JSONObject actionCompletedPayload = new JSONObject(); try { JSONArray canonicalIDList = new JSONArray(); canonicalIDList.put(canonicalIdentifier_); actionCompletedPayload.put(canonicalIdentifier_, convertToJson()); if (metadata != null) { for (String key : metadata.keySet()) { actionCompletedPayload.put(key, metadata.get(key)); } } if (Branch.getInstance() != null) { Branch.getInstance().userCompletedAction(action, actionCompletedPayload); } } catch (JSONException ignore) { } }
java
public void userCompletedAction(String action, HashMap<String, String> metadata) { JSONObject actionCompletedPayload = new JSONObject(); try { JSONArray canonicalIDList = new JSONArray(); canonicalIDList.put(canonicalIdentifier_); actionCompletedPayload.put(canonicalIdentifier_, convertToJson()); if (metadata != null) { for (String key : metadata.keySet()) { actionCompletedPayload.put(key, metadata.get(key)); } } if (Branch.getInstance() != null) { Branch.getInstance().userCompletedAction(action, actionCompletedPayload); } } catch (JSONException ignore) { } }
[ "public", "void", "userCompletedAction", "(", "String", "action", ",", "HashMap", "<", "String", ",", "String", ">", "metadata", ")", "{", "JSONObject", "actionCompletedPayload", "=", "new", "JSONObject", "(", ")", ";", "try", "{", "JSONArray", "canonicalIDList", "=", "new", "JSONArray", "(", ")", ";", "canonicalIDList", ".", "put", "(", "canonicalIdentifier_", ")", ";", "actionCompletedPayload", ".", "put", "(", "canonicalIdentifier_", ",", "convertToJson", "(", ")", ")", ";", "if", "(", "metadata", "!=", "null", ")", "{", "for", "(", "String", "key", ":", "metadata", ".", "keySet", "(", ")", ")", "{", "actionCompletedPayload", ".", "put", "(", "key", ",", "metadata", ".", "get", "(", "key", ")", ")", ";", "}", "}", "if", "(", "Branch", ".", "getInstance", "(", ")", "!=", "null", ")", "{", "Branch", ".", "getInstance", "(", ")", ".", "userCompletedAction", "(", "action", ",", "actionCompletedPayload", ")", ";", "}", "}", "catch", "(", "JSONException", "ignore", ")", "{", "}", "}" ]
<p> Method to report user actions happened on this BUO. Use this method to report the user actions for analytics purpose. </p> @param action A {@link String }with value of user action name. See {@link BranchEvent} for Branch defined user events. @param metadata A HashMap containing any additional metadata need to add to this user event NOTE : please consider using {@link #userCompletedAction(BRANCH_STANDARD_EVENT, HashMap)} instead
[ "<p", ">", "Method", "to", "report", "user", "actions", "happened", "on", "this", "BUO", ".", "Use", "this", "method", "to", "report", "the", "user", "actions", "for", "analytics", "purpose", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/indexing/BranchUniversalObject.java#L357-L373
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/utils/TotpUtils.java
TotpUtils.getOtpauthURL
public static String getOtpauthURL(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) { """ Generates a otpauth code to share a secret with a user @param name The name of the account @param issuer The name of the issuer @param secret The secret to use @param algorithm The algorithm to use @param digits The number of digits to use @param period The period to use @return An otpauth url """ Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString()); Objects.requireNonNull(secret, Required.SECRET.toString()); Objects.requireNonNull(issuer, Required.ISSUER.toString()); Objects.requireNonNull(algorithm, Required.ALGORITHM.toString()); Objects.requireNonNull(digits, Required.DIGITS.toString()); Objects.requireNonNull(period, Required.PERIOD.toString()); var buffer = new StringBuilder(); buffer.append("otpauth://totp/") .append(name) .append("?secret=") .append(RegExUtils.replaceAll(base32.encodeAsString(secret.getBytes(StandardCharsets.UTF_8)), "=", "")) .append("&algorithm=") .append(algorithm.getAlgorithm()) .append("&issuer=") .append(issuer) .append("&digits=") .append(digits) .append("&period=") .append(period); String url = ""; try { url = URLEncoder.encode(buffer.toString(), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { LOG.error("Failed to encode otpauth url", e); } return url; }
java
public static String getOtpauthURL(String name, String issuer, String secret, HmacShaAlgorithm algorithm, String digits, String period) { Objects.requireNonNull(name, Required.ACCOUNT_NAME.toString()); Objects.requireNonNull(secret, Required.SECRET.toString()); Objects.requireNonNull(issuer, Required.ISSUER.toString()); Objects.requireNonNull(algorithm, Required.ALGORITHM.toString()); Objects.requireNonNull(digits, Required.DIGITS.toString()); Objects.requireNonNull(period, Required.PERIOD.toString()); var buffer = new StringBuilder(); buffer.append("otpauth://totp/") .append(name) .append("?secret=") .append(RegExUtils.replaceAll(base32.encodeAsString(secret.getBytes(StandardCharsets.UTF_8)), "=", "")) .append("&algorithm=") .append(algorithm.getAlgorithm()) .append("&issuer=") .append(issuer) .append("&digits=") .append(digits) .append("&period=") .append(period); String url = ""; try { url = URLEncoder.encode(buffer.toString(), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { LOG.error("Failed to encode otpauth url", e); } return url; }
[ "public", "static", "String", "getOtpauthURL", "(", "String", "name", ",", "String", "issuer", ",", "String", "secret", ",", "HmacShaAlgorithm", "algorithm", ",", "String", "digits", ",", "String", "period", ")", "{", "Objects", ".", "requireNonNull", "(", "name", ",", "Required", ".", "ACCOUNT_NAME", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(", "secret", ",", "Required", ".", "SECRET", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(", "issuer", ",", "Required", ".", "ISSUER", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(", "algorithm", ",", "Required", ".", "ALGORITHM", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(", "digits", ",", "Required", ".", "DIGITS", ".", "toString", "(", ")", ")", ";", "Objects", ".", "requireNonNull", "(", "period", ",", "Required", ".", "PERIOD", ".", "toString", "(", ")", ")", ";", "var", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "buffer", ".", "append", "(", "\"otpauth://totp/\"", ")", ".", "append", "(", "name", ")", ".", "append", "(", "\"?secret=\"", ")", ".", "append", "(", "RegExUtils", ".", "replaceAll", "(", "base32", ".", "encodeAsString", "(", "secret", ".", "getBytes", "(", "StandardCharsets", ".", "UTF_8", ")", ")", ",", "\"=\"", ",", "\"\"", ")", ")", ".", "append", "(", "\"&algorithm=\"", ")", ".", "append", "(", "algorithm", ".", "getAlgorithm", "(", ")", ")", ".", "append", "(", "\"&issuer=\"", ")", ".", "append", "(", "issuer", ")", ".", "append", "(", "\"&digits=\"", ")", ".", "append", "(", "digits", ")", ".", "append", "(", "\"&period=\"", ")", ".", "append", "(", "period", ")", ";", "String", "url", "=", "\"\"", ";", "try", "{", "url", "=", "URLEncoder", ".", "encode", "(", "buffer", ".", "toString", "(", ")", ",", "StandardCharsets", ".", "UTF_8", ".", "name", "(", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "LOG", ".", "error", "(", "\"Failed to encode otpauth url\"", ",", "e", ")", ";", "}", "return", "url", ";", "}" ]
Generates a otpauth code to share a secret with a user @param name The name of the account @param issuer The name of the issuer @param secret The secret to use @param algorithm The algorithm to use @param digits The number of digits to use @param period The period to use @return An otpauth url
[ "Generates", "a", "otpauth", "code", "to", "share", "a", "secret", "with", "a", "user" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/TotpUtils.java#L183-L213
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java
AbstractRenderer.setZoomToFit
public void setZoomToFit(double drawWidth, double drawHeight, double diagramWidth, double diagramHeight) { """ Calculate and set the zoom factor needed to completely fit the diagram onto the screen bounds. @param drawWidth the width of the area to draw onto @param drawHeight the height of the area to draw onto @param diagramWidth the width of the diagram @param diagramHeight the height of the diagram """ double margin = rendererModel.getParameter(Margin.class).getValue(); // determine the zoom needed to fit the diagram to the screen double widthRatio = drawWidth / (diagramWidth + (2 * margin)); double heightRatio = drawHeight / (diagramHeight + (2 * margin)); double zoom = Math.min(widthRatio, heightRatio); this.fontManager.setFontForZoom(zoom); // record the zoom in the model, so that generators can use it rendererModel.getParameter(ZoomFactor.class).setValue(zoom); }
java
public void setZoomToFit(double drawWidth, double drawHeight, double diagramWidth, double diagramHeight) { double margin = rendererModel.getParameter(Margin.class).getValue(); // determine the zoom needed to fit the diagram to the screen double widthRatio = drawWidth / (diagramWidth + (2 * margin)); double heightRatio = drawHeight / (diagramHeight + (2 * margin)); double zoom = Math.min(widthRatio, heightRatio); this.fontManager.setFontForZoom(zoom); // record the zoom in the model, so that generators can use it rendererModel.getParameter(ZoomFactor.class).setValue(zoom); }
[ "public", "void", "setZoomToFit", "(", "double", "drawWidth", ",", "double", "drawHeight", ",", "double", "diagramWidth", ",", "double", "diagramHeight", ")", "{", "double", "margin", "=", "rendererModel", ".", "getParameter", "(", "Margin", ".", "class", ")", ".", "getValue", "(", ")", ";", "// determine the zoom needed to fit the diagram to the screen", "double", "widthRatio", "=", "drawWidth", "/", "(", "diagramWidth", "+", "(", "2", "*", "margin", ")", ")", ";", "double", "heightRatio", "=", "drawHeight", "/", "(", "diagramHeight", "+", "(", "2", "*", "margin", ")", ")", ";", "double", "zoom", "=", "Math", ".", "min", "(", "widthRatio", ",", "heightRatio", ")", ";", "this", ".", "fontManager", ".", "setFontForZoom", "(", "zoom", ")", ";", "// record the zoom in the model, so that generators can use it", "rendererModel", ".", "getParameter", "(", "ZoomFactor", ".", "class", ")", ".", "setValue", "(", "zoom", ")", ";", "}" ]
Calculate and set the zoom factor needed to completely fit the diagram onto the screen bounds. @param drawWidth the width of the area to draw onto @param drawHeight the height of the area to draw onto @param diagramWidth the width of the diagram @param diagramHeight the height of the diagram
[ "Calculate", "and", "set", "the", "zoom", "factor", "needed", "to", "completely", "fit", "the", "diagram", "onto", "the", "screen", "bounds", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java#L292-L307
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/FieldCriteria.java
FieldCriteria.buildNotEqualToCriteria
static FieldCriteria buildNotEqualToCriteria(Object anAttribute, Object aValue, UserAlias anAlias) { """ static FieldCriteria buildNotEqualToCriteria(Object anAttribute, Object aValue, String anAlias) """ return new FieldCriteria(anAttribute, aValue, NOT_EQUAL, anAlias); }
java
static FieldCriteria buildNotEqualToCriteria(Object anAttribute, Object aValue, UserAlias anAlias) { return new FieldCriteria(anAttribute, aValue, NOT_EQUAL, anAlias); }
[ "static", "FieldCriteria", "buildNotEqualToCriteria", "(", "Object", "anAttribute", ",", "Object", "aValue", ",", "UserAlias", "anAlias", ")", "{", "return", "new", "FieldCriteria", "(", "anAttribute", ",", "aValue", ",", "NOT_EQUAL", ",", "anAlias", ")", ";", "}" ]
static FieldCriteria buildNotEqualToCriteria(Object anAttribute, Object aValue, String anAlias)
[ "static", "FieldCriteria", "buildNotEqualToCriteria", "(", "Object", "anAttribute", "Object", "aValue", "String", "anAlias", ")" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/FieldCriteria.java#L35-L38
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/util/StringUtils.java
StringUtils.resolveVariable
private static Object resolveVariable (String variableName, Map<String, Object> variables, boolean systemOverrideMode) { """ Helper to {@link #replaceVariables(String, Map, boolean)} which resolves and returns a variable value depending on mode. @param variableName Name of the variable to find @param variables Map of variable values @param systemOverrideMode Override = true, Fall back = false @return The variable value for variableName. """ Object variable = (variables != null) ? variables.get(variableName) : null; String environmentValue = System.getenv(variableName); String systemValue = System.getProperty(variableName); if(systemOverrideMode) { return (systemValue != null ? systemValue : (environmentValue != null) ? environmentValue : variable); } else { return (variable != null ? variable : (systemValue != null) ? systemValue : environmentValue); } }
java
private static Object resolveVariable (String variableName, Map<String, Object> variables, boolean systemOverrideMode) { Object variable = (variables != null) ? variables.get(variableName) : null; String environmentValue = System.getenv(variableName); String systemValue = System.getProperty(variableName); if(systemOverrideMode) { return (systemValue != null ? systemValue : (environmentValue != null) ? environmentValue : variable); } else { return (variable != null ? variable : (systemValue != null) ? systemValue : environmentValue); } }
[ "private", "static", "Object", "resolveVariable", "(", "String", "variableName", ",", "Map", "<", "String", ",", "Object", ">", "variables", ",", "boolean", "systemOverrideMode", ")", "{", "Object", "variable", "=", "(", "variables", "!=", "null", ")", "?", "variables", ".", "get", "(", "variableName", ")", ":", "null", ";", "String", "environmentValue", "=", "System", ".", "getenv", "(", "variableName", ")", ";", "String", "systemValue", "=", "System", ".", "getProperty", "(", "variableName", ")", ";", "if", "(", "systemOverrideMode", ")", "{", "return", "(", "systemValue", "!=", "null", "?", "systemValue", ":", "(", "environmentValue", "!=", "null", ")", "?", "environmentValue", ":", "variable", ")", ";", "}", "else", "{", "return", "(", "variable", "!=", "null", "?", "variable", ":", "(", "systemValue", "!=", "null", ")", "?", "systemValue", ":", "environmentValue", ")", ";", "}", "}" ]
Helper to {@link #replaceVariables(String, Map, boolean)} which resolves and returns a variable value depending on mode. @param variableName Name of the variable to find @param variables Map of variable values @param systemOverrideMode Override = true, Fall back = false @return The variable value for variableName.
[ "Helper", "to", "{", "@link", "#replaceVariables", "(", "String", "Map", "boolean", ")", "}", "which", "resolves", "and", "returns", "a", "variable", "value", "depending", "on", "mode", "." ]
train
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/util/StringUtils.java#L69-L79
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java
JScreen.createScreenComponent
public JComponent createScreenComponent(Converter fieldInfo) { """ Add the screen controls to the second column of the grid. Create a default component for this fieldInfo. @param fieldInfo the field to create a control for. @return The component. """ int iRows = 1; int iColumns = fieldInfo.getMaxLength(); if (iColumns > 40) { iRows = 3; iColumns = 30; } String strDefault = fieldInfo.toString(); if (strDefault == null) strDefault = Constants.BLANK; JComponent component = null; if (iRows <= 1) { component = new JTextField(strDefault, iColumns); if (fieldInfo instanceof FieldInfo) if (Number.class.isAssignableFrom(((FieldInfo)fieldInfo).getDataClass())) ((JTextField)component).setHorizontalAlignment(JTextField.RIGHT); } else { component = new JTextArea(strDefault, iRows, iColumns); component.setBorder(m_borderLine); } return component; }
java
public JComponent createScreenComponent(Converter fieldInfo) { int iRows = 1; int iColumns = fieldInfo.getMaxLength(); if (iColumns > 40) { iRows = 3; iColumns = 30; } String strDefault = fieldInfo.toString(); if (strDefault == null) strDefault = Constants.BLANK; JComponent component = null; if (iRows <= 1) { component = new JTextField(strDefault, iColumns); if (fieldInfo instanceof FieldInfo) if (Number.class.isAssignableFrom(((FieldInfo)fieldInfo).getDataClass())) ((JTextField)component).setHorizontalAlignment(JTextField.RIGHT); } else { component = new JTextArea(strDefault, iRows, iColumns); component.setBorder(m_borderLine); } return component; }
[ "public", "JComponent", "createScreenComponent", "(", "Converter", "fieldInfo", ")", "{", "int", "iRows", "=", "1", ";", "int", "iColumns", "=", "fieldInfo", ".", "getMaxLength", "(", ")", ";", "if", "(", "iColumns", ">", "40", ")", "{", "iRows", "=", "3", ";", "iColumns", "=", "30", ";", "}", "String", "strDefault", "=", "fieldInfo", ".", "toString", "(", ")", ";", "if", "(", "strDefault", "==", "null", ")", "strDefault", "=", "Constants", ".", "BLANK", ";", "JComponent", "component", "=", "null", ";", "if", "(", "iRows", "<=", "1", ")", "{", "component", "=", "new", "JTextField", "(", "strDefault", ",", "iColumns", ")", ";", "if", "(", "fieldInfo", "instanceof", "FieldInfo", ")", "if", "(", "Number", ".", "class", ".", "isAssignableFrom", "(", "(", "(", "FieldInfo", ")", "fieldInfo", ")", ".", "getDataClass", "(", ")", ")", ")", "(", "(", "JTextField", ")", "component", ")", ".", "setHorizontalAlignment", "(", "JTextField", ".", "RIGHT", ")", ";", "}", "else", "{", "component", "=", "new", "JTextArea", "(", "strDefault", ",", "iRows", ",", "iColumns", ")", ";", "component", ".", "setBorder", "(", "m_borderLine", ")", ";", "}", "return", "component", ";", "}" ]
Add the screen controls to the second column of the grid. Create a default component for this fieldInfo. @param fieldInfo the field to create a control for. @return The component.
[ "Add", "the", "screen", "controls", "to", "the", "second", "column", "of", "the", "grid", ".", "Create", "a", "default", "component", "for", "this", "fieldInfo", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JScreen.java#L298-L325
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java
FedoraTypesUtils.getPropertyType
public static Optional<Integer> getPropertyType(final Node node, final String propertyName) throws RepositoryException { """ Get the JCR property type ID for a given property name. If unsure, mark it as UNDEFINED. @param node the JCR node to add the property on @param propertyName the property name @return a PropertyType value @throws RepositoryException if repository exception occurred """ LOGGER.debug("Getting type of property: {} from node: {}", propertyName, node); return getDefinitionForPropertyName(node, propertyName).map(PropertyDefinition::getRequiredType); }
java
public static Optional<Integer> getPropertyType(final Node node, final String propertyName) throws RepositoryException { LOGGER.debug("Getting type of property: {} from node: {}", propertyName, node); return getDefinitionForPropertyName(node, propertyName).map(PropertyDefinition::getRequiredType); }
[ "public", "static", "Optional", "<", "Integer", ">", "getPropertyType", "(", "final", "Node", "node", ",", "final", "String", "propertyName", ")", "throws", "RepositoryException", "{", "LOGGER", ".", "debug", "(", "\"Getting type of property: {} from node: {}\"", ",", "propertyName", ",", "node", ")", ";", "return", "getDefinitionForPropertyName", "(", "node", ",", "propertyName", ")", ".", "map", "(", "PropertyDefinition", "::", "getRequiredType", ")", ";", "}" ]
Get the JCR property type ID for a given property name. If unsure, mark it as UNDEFINED. @param node the JCR node to add the property on @param propertyName the property name @return a PropertyType value @throws RepositoryException if repository exception occurred
[ "Get", "the", "JCR", "property", "type", "ID", "for", "a", "given", "property", "name", ".", "If", "unsure", "mark", "it", "as", "UNDEFINED", "." ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L258-L262
mikepenz/FastAdapter
library-core/src/main/java/com/mikepenz/fastadapter/select/SelectExtension.java
SelectExtension.deselectByIdentifier
public void deselectByIdentifier(final long identifier) { """ selects an item by it's identifier @param identifier the identifier of the item to deselect """ mFastAdapter.recursive(new AdapterPredicate<Item>() { @Override public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) { if (item.getIdentifier() == identifier) { deselect(item, position, null); return true; } return false; } }, true); }
java
public void deselectByIdentifier(final long identifier) { mFastAdapter.recursive(new AdapterPredicate<Item>() { @Override public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) { if (item.getIdentifier() == identifier) { deselect(item, position, null); return true; } return false; } }, true); }
[ "public", "void", "deselectByIdentifier", "(", "final", "long", "identifier", ")", "{", "mFastAdapter", ".", "recursive", "(", "new", "AdapterPredicate", "<", "Item", ">", "(", ")", "{", "@", "Override", "public", "boolean", "apply", "(", "@", "NonNull", "IAdapter", "<", "Item", ">", "lastParentAdapter", ",", "int", "lastParentPosition", ",", "Item", "item", ",", "int", "position", ")", "{", "if", "(", "item", ".", "getIdentifier", "(", ")", "==", "identifier", ")", "{", "deselect", "(", "item", ",", "position", ",", "null", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "}", ",", "true", ")", ";", "}" ]
selects an item by it's identifier @param identifier the identifier of the item to deselect
[ "selects", "an", "item", "by", "it", "s", "identifier" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/select/SelectExtension.java#L548-L559
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/meta/common/utils/GetUtils.java
GetUtils.ensureNonNullAndNonEmpty
@Nonnull public static String ensureNonNullAndNonEmpty(@Nullable final String value, @Nonnull @Constraint("notEmpty(X)") final String dflt) { """ Get non-null non-empty string. @param value a base string @param dflt default string to be provided if value is null or empty @return non-nullable non-empty string @since 1.1.1 """ String result = value; if (result == null || result.isEmpty()) { assertFalse("Default value must not be empty", assertNotNull("Default value must not be null", dflt).isEmpty()); result = dflt; } return result; }
java
@Nonnull public static String ensureNonNullAndNonEmpty(@Nullable final String value, @Nonnull @Constraint("notEmpty(X)") final String dflt) { String result = value; if (result == null || result.isEmpty()) { assertFalse("Default value must not be empty", assertNotNull("Default value must not be null", dflt).isEmpty()); result = dflt; } return result; }
[ "@", "Nonnull", "public", "static", "String", "ensureNonNullAndNonEmpty", "(", "@", "Nullable", "final", "String", "value", ",", "@", "Nonnull", "@", "Constraint", "(", "\"notEmpty(X)\"", ")", "final", "String", "dflt", ")", "{", "String", "result", "=", "value", ";", "if", "(", "result", "==", "null", "||", "result", ".", "isEmpty", "(", ")", ")", "{", "assertFalse", "(", "\"Default value must not be empty\"", ",", "assertNotNull", "(", "\"Default value must not be null\"", ",", "dflt", ")", ".", "isEmpty", "(", ")", ")", ";", "result", "=", "dflt", ";", "}", "return", "result", ";", "}" ]
Get non-null non-empty string. @param value a base string @param dflt default string to be provided if value is null or empty @return non-nullable non-empty string @since 1.1.1
[ "Get", "non", "-", "null", "non", "-", "empty", "string", "." ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/meta/common/utils/GetUtils.java#L104-L112
atomix/catalyst
common/src/main/java/io/atomix/catalyst/util/PropertiesReader.java
PropertiesReader.getString
public String getString(String property, String defaultValue) { """ Reads a string property, returning a default value if the property is not present. @param property The property name. @param defaultValue The default value to return if the property is not present. @return The property value. """ return getProperty(property, defaultValue, v -> v); }
java
public String getString(String property, String defaultValue) { return getProperty(property, defaultValue, v -> v); }
[ "public", "String", "getString", "(", "String", "property", ",", "String", "defaultValue", ")", "{", "return", "getProperty", "(", "property", ",", "defaultValue", ",", "v", "->", "v", ")", ";", "}" ]
Reads a string property, returning a default value if the property is not present. @param property The property name. @param defaultValue The default value to return if the property is not present. @return The property value.
[ "Reads", "a", "string", "property", "returning", "a", "default", "value", "if", "the", "property", "is", "not", "present", "." ]
train
https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/common/src/main/java/io/atomix/catalyst/util/PropertiesReader.java#L237-L239
atomix/atomix
core/src/main/java/io/atomix/core/map/impl/AbstractAtomicMapService.java
AbstractAtomicMapService.scheduleTtl
protected void scheduleTtl(K key, MapEntryValue value) { """ Schedules the TTL for the given value. @param value the value for which to schedule the TTL """ if (value.ttl() > 0) { value.timer = getScheduler().schedule(Duration.ofMillis(value.ttl()), () -> { entries().remove(key, value); publish(new AtomicMapEvent<>(AtomicMapEvent.Type.REMOVE, key, null, toVersioned(value))); }); } }
java
protected void scheduleTtl(K key, MapEntryValue value) { if (value.ttl() > 0) { value.timer = getScheduler().schedule(Duration.ofMillis(value.ttl()), () -> { entries().remove(key, value); publish(new AtomicMapEvent<>(AtomicMapEvent.Type.REMOVE, key, null, toVersioned(value))); }); } }
[ "protected", "void", "scheduleTtl", "(", "K", "key", ",", "MapEntryValue", "value", ")", "{", "if", "(", "value", ".", "ttl", "(", ")", ">", "0", ")", "{", "value", ".", "timer", "=", "getScheduler", "(", ")", ".", "schedule", "(", "Duration", ".", "ofMillis", "(", "value", ".", "ttl", "(", ")", ")", ",", "(", ")", "->", "{", "entries", "(", ")", ".", "remove", "(", "key", ",", "value", ")", ";", "publish", "(", "new", "AtomicMapEvent", "<>", "(", "AtomicMapEvent", ".", "Type", ".", "REMOVE", ",", "key", ",", "null", ",", "toVersioned", "(", "value", ")", ")", ")", ";", "}", ")", ";", "}", "}" ]
Schedules the TTL for the given value. @param value the value for which to schedule the TTL
[ "Schedules", "the", "TTL", "for", "the", "given", "value", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/core/src/main/java/io/atomix/core/map/impl/AbstractAtomicMapService.java#L266-L273
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/config/ServiceDirectoryConfig.java
ServiceDirectoryConfig.getLong
public long getLong(String name, long defaultVal) { """ Get the property object as long, or return defaultVal if property is not defined. @param name property name. @param defaultVal default property value. @return property value as long, return defaultVal if property is undefined. """ if(this.configuration.containsKey(name)){ return this.configuration.getLong(name); } else { return defaultVal; } }
java
public long getLong(String name, long defaultVal){ if(this.configuration.containsKey(name)){ return this.configuration.getLong(name); } else { return defaultVal; } }
[ "public", "long", "getLong", "(", "String", "name", ",", "long", "defaultVal", ")", "{", "if", "(", "this", ".", "configuration", ".", "containsKey", "(", "name", ")", ")", "{", "return", "this", ".", "configuration", ".", "getLong", "(", "name", ")", ";", "}", "else", "{", "return", "defaultVal", ";", "}", "}" ]
Get the property object as long, or return defaultVal if property is not defined. @param name property name. @param defaultVal default property value. @return property value as long, return defaultVal if property is undefined.
[ "Get", "the", "property", "object", "as", "long", "or", "return", "defaultVal", "if", "property", "is", "not", "defined", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/config/ServiceDirectoryConfig.java#L237-L243
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.asType
@SuppressWarnings("unchecked") public static <T> T asType(Iterable iterable, Class<T> clazz) { """ Converts the given iterable to another type. @param iterable a Iterable @param clazz the desired class @return the object resulting from this type conversion @see #asType(Collection, Class) @since 2.4.12 """ if (Collection.class.isAssignableFrom(clazz)) { return asType((Collection) toList(iterable), clazz); } return asType((Object) iterable, clazz); }
java
@SuppressWarnings("unchecked") public static <T> T asType(Iterable iterable, Class<T> clazz) { if (Collection.class.isAssignableFrom(clazz)) { return asType((Collection) toList(iterable), clazz); } return asType((Object) iterable, clazz); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "asType", "(", "Iterable", "iterable", ",", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "Collection", ".", "class", ".", "isAssignableFrom", "(", "clazz", ")", ")", "{", "return", "asType", "(", "(", "Collection", ")", "toList", "(", "iterable", ")", ",", "clazz", ")", ";", "}", "return", "asType", "(", "(", "Object", ")", "iterable", ",", "clazz", ")", ";", "}" ]
Converts the given iterable to another type. @param iterable a Iterable @param clazz the desired class @return the object resulting from this type conversion @see #asType(Collection, Class) @since 2.4.12
[ "Converts", "the", "given", "iterable", "to", "another", "type", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L11659-L11666
huahin/huahin-core
src/main/java/org/huahinframework/core/SimpleJob.java
SimpleJob.setBigJoin
public SimpleJob setBigJoin(String[] masterLabels, String[] masterColumns, String[] dataColumns, String masterPath) throws DataFormatException { """ to join the data that does not fit into memory. @param masterLabels label of master data @param masterColumns master column's @param dataColumns data column's @param masterPath master data HDFS path @return this @throws DataFormatException """ String separator = conf.get(SEPARATOR); return setBigJoin(masterLabels, masterColumns, dataColumns, masterPath, separator); }
java
public SimpleJob setBigJoin(String[] masterLabels, String[] masterColumns, String[] dataColumns, String masterPath) throws DataFormatException { String separator = conf.get(SEPARATOR); return setBigJoin(masterLabels, masterColumns, dataColumns, masterPath, separator); }
[ "public", "SimpleJob", "setBigJoin", "(", "String", "[", "]", "masterLabels", ",", "String", "[", "]", "masterColumns", ",", "String", "[", "]", "dataColumns", ",", "String", "masterPath", ")", "throws", "DataFormatException", "{", "String", "separator", "=", "conf", ".", "get", "(", "SEPARATOR", ")", ";", "return", "setBigJoin", "(", "masterLabels", ",", "masterColumns", ",", "dataColumns", ",", "masterPath", ",", "separator", ")", ";", "}" ]
to join the data that does not fit into memory. @param masterLabels label of master data @param masterColumns master column's @param dataColumns data column's @param masterPath master data HDFS path @return this @throws DataFormatException
[ "to", "join", "the", "data", "that", "does", "not", "fit", "into", "memory", "." ]
train
https://github.com/huahin/huahin-core/blob/a87921b5a12be92a822f753c075ab2431036e6f5/src/main/java/org/huahinframework/core/SimpleJob.java#L403-L407
jenkinsci/jenkins
core/src/main/java/hudson/FilePath.java
FilePath.installIfNecessaryFrom
public boolean installIfNecessaryFrom(@Nonnull URL archive, @CheckForNull TaskListener listener, @Nonnull String message) throws IOException, InterruptedException { """ Given a tgz/zip file, extracts it to the given target directory, if necessary. <p> This method is a convenience method designed for installing a binary package to a location that supports upgrade and downgrade. Specifically, <ul> <li>If the target directory doesn't exist {@linkplain #mkdirs() it will be created}. <li>The timestamp of the archive is left in the installation directory upon extraction. <li>If the timestamp left in the directory does not match the timestamp of the current archive file, the directory contents will be discarded and the archive file will be re-extracted. <li>If the connection is refused but the target directory already exists, it is left alone. </ul> @param archive The resource that represents the tgz/zip file. This URL must support the {@code Last-Modified} header. (For example, you could use {@link ClassLoader#getResource}.) @param listener If non-null, a message will be printed to this listener once this method decides to extract an archive, or if there is any issue. @param message a message to be printed in case extraction will proceed. @return true if the archive was extracted. false if the extraction was skipped because the target directory was considered up to date. @since 1.299 """ return installIfNecessaryFrom(archive, listener, message, MAX_REDIRECTS); }
java
public boolean installIfNecessaryFrom(@Nonnull URL archive, @CheckForNull TaskListener listener, @Nonnull String message) throws IOException, InterruptedException { return installIfNecessaryFrom(archive, listener, message, MAX_REDIRECTS); }
[ "public", "boolean", "installIfNecessaryFrom", "(", "@", "Nonnull", "URL", "archive", ",", "@", "CheckForNull", "TaskListener", "listener", ",", "@", "Nonnull", "String", "message", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "installIfNecessaryFrom", "(", "archive", ",", "listener", ",", "message", ",", "MAX_REDIRECTS", ")", ";", "}" ]
Given a tgz/zip file, extracts it to the given target directory, if necessary. <p> This method is a convenience method designed for installing a binary package to a location that supports upgrade and downgrade. Specifically, <ul> <li>If the target directory doesn't exist {@linkplain #mkdirs() it will be created}. <li>The timestamp of the archive is left in the installation directory upon extraction. <li>If the timestamp left in the directory does not match the timestamp of the current archive file, the directory contents will be discarded and the archive file will be re-extracted. <li>If the connection is refused but the target directory already exists, it is left alone. </ul> @param archive The resource that represents the tgz/zip file. This URL must support the {@code Last-Modified} header. (For example, you could use {@link ClassLoader#getResource}.) @param listener If non-null, a message will be printed to this listener once this method decides to extract an archive, or if there is any issue. @param message a message to be printed in case extraction will proceed. @return true if the archive was extracted. false if the extraction was skipped because the target directory was considered up to date. @since 1.299
[ "Given", "a", "tgz", "/", "zip", "file", "extracts", "it", "to", "the", "given", "target", "directory", "if", "necessary", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L844-L846
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/print/value/ClassificationValueSelect.java
ClassificationValueSelect.executeOneCompleteStmt
protected boolean executeOneCompleteStmt(final String _complStmt, final List<Instance> _instances) throws EFapsException { """ Method to execute one statement against the eFaps-DataBase. @param _complStmt ststement @param _instances list of instances @return true it values where found @throws EFapsException on error """ final boolean ret = false; ConnectionResource con = null; try { con = Context.getThreadContext().getConnectionResource(); final Statement stmt = con.createStatement(); final ResultSet rs = stmt.executeQuery(_complStmt.toString()); final Map<Long, List<Long>> link2clazz = new HashMap<>(); while (rs.next()) { final long linkId = rs.getLong(2); final long classificationID = rs.getLong(3); final List<Long> templ; if (link2clazz.containsKey(linkId)) { templ = link2clazz.get(linkId); } else { templ = new ArrayList<>(); link2clazz.put(linkId, templ); } templ.add(classificationID); } for (final Instance instance : _instances) { this.instances2classId.put(instance, link2clazz.get(instance.getId())); } rs.close(); stmt.close(); } catch (final SQLException e) { throw new EFapsException(ClassificationValueSelect.class, "executeOneCompleteStmt", e); } return ret; }
java
protected boolean executeOneCompleteStmt(final String _complStmt, final List<Instance> _instances) throws EFapsException { final boolean ret = false; ConnectionResource con = null; try { con = Context.getThreadContext().getConnectionResource(); final Statement stmt = con.createStatement(); final ResultSet rs = stmt.executeQuery(_complStmt.toString()); final Map<Long, List<Long>> link2clazz = new HashMap<>(); while (rs.next()) { final long linkId = rs.getLong(2); final long classificationID = rs.getLong(3); final List<Long> templ; if (link2clazz.containsKey(linkId)) { templ = link2clazz.get(linkId); } else { templ = new ArrayList<>(); link2clazz.put(linkId, templ); } templ.add(classificationID); } for (final Instance instance : _instances) { this.instances2classId.put(instance, link2clazz.get(instance.getId())); } rs.close(); stmt.close(); } catch (final SQLException e) { throw new EFapsException(ClassificationValueSelect.class, "executeOneCompleteStmt", e); } return ret; }
[ "protected", "boolean", "executeOneCompleteStmt", "(", "final", "String", "_complStmt", ",", "final", "List", "<", "Instance", ">", "_instances", ")", "throws", "EFapsException", "{", "final", "boolean", "ret", "=", "false", ";", "ConnectionResource", "con", "=", "null", ";", "try", "{", "con", "=", "Context", ".", "getThreadContext", "(", ")", ".", "getConnectionResource", "(", ")", ";", "final", "Statement", "stmt", "=", "con", ".", "createStatement", "(", ")", ";", "final", "ResultSet", "rs", "=", "stmt", ".", "executeQuery", "(", "_complStmt", ".", "toString", "(", ")", ")", ";", "final", "Map", "<", "Long", ",", "List", "<", "Long", ">", ">", "link2clazz", "=", "new", "HashMap", "<>", "(", ")", ";", "while", "(", "rs", ".", "next", "(", ")", ")", "{", "final", "long", "linkId", "=", "rs", ".", "getLong", "(", "2", ")", ";", "final", "long", "classificationID", "=", "rs", ".", "getLong", "(", "3", ")", ";", "final", "List", "<", "Long", ">", "templ", ";", "if", "(", "link2clazz", ".", "containsKey", "(", "linkId", ")", ")", "{", "templ", "=", "link2clazz", ".", "get", "(", "linkId", ")", ";", "}", "else", "{", "templ", "=", "new", "ArrayList", "<>", "(", ")", ";", "link2clazz", ".", "put", "(", "linkId", ",", "templ", ")", ";", "}", "templ", ".", "add", "(", "classificationID", ")", ";", "}", "for", "(", "final", "Instance", "instance", ":", "_instances", ")", "{", "this", ".", "instances2classId", ".", "put", "(", "instance", ",", "link2clazz", ".", "get", "(", "instance", ".", "getId", "(", ")", ")", ")", ";", "}", "rs", ".", "close", "(", ")", ";", "stmt", ".", "close", "(", ")", ";", "}", "catch", "(", "final", "SQLException", "e", ")", "{", "throw", "new", "EFapsException", "(", "ClassificationValueSelect", ".", "class", ",", "\"executeOneCompleteStmt\"", ",", "e", ")", ";", "}", "return", "ret", ";", "}" ]
Method to execute one statement against the eFaps-DataBase. @param _complStmt ststement @param _instances list of instances @return true it values where found @throws EFapsException on error
[ "Method", "to", "execute", "one", "statement", "against", "the", "eFaps", "-", "DataBase", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/print/value/ClassificationValueSelect.java#L259-L293
gdx-libs/gdx-autumn
src/com/github/czyzby/autumn/context/ContextInitializer.java
ContextInitializer.addIfNotNull
protected <Type> void addIfNotNull(final Array<Type> array, final Type object) { """ Simple array utility. @param array will contain the object if it's not null. @param object if not null, will be added to the array. @param <Type> type of values stored in the array. """ if (object != null) { array.add(object); } }
java
protected <Type> void addIfNotNull(final Array<Type> array, final Type object) { if (object != null) { array.add(object); } }
[ "protected", "<", "Type", ">", "void", "addIfNotNull", "(", "final", "Array", "<", "Type", ">", "array", ",", "final", "Type", "object", ")", "{", "if", "(", "object", "!=", "null", ")", "{", "array", ".", "add", "(", "object", ")", ";", "}", "}" ]
Simple array utility. @param array will contain the object if it's not null. @param object if not null, will be added to the array. @param <Type> type of values stored in the array.
[ "Simple", "array", "utility", "." ]
train
https://github.com/gdx-libs/gdx-autumn/blob/75a7d8e0c838b69a06ae847f5a3c13a3bcd1d914/src/com/github/czyzby/autumn/context/ContextInitializer.java#L394-L398
logic-ng/LogicNG
src/main/java/org/logicng/backbones/BackboneGeneration.java
BackboneGeneration.computeNegative
public static Backbone computeNegative(final Collection<Formula> formulas, final Collection<Variable> variables) { """ Computes the negative backbone variables for a given collection of formulas w.r.t. a collection of variables. @param formulas the given collection of formulas @param variables the given collection of relevant variables for the backbone computation @return the negative backbone or {@code null} if the formula is UNSAT """ return compute(formulas, variables, BackboneType.ONLY_NEGATIVE); }
java
public static Backbone computeNegative(final Collection<Formula> formulas, final Collection<Variable> variables) { return compute(formulas, variables, BackboneType.ONLY_NEGATIVE); }
[ "public", "static", "Backbone", "computeNegative", "(", "final", "Collection", "<", "Formula", ">", "formulas", ",", "final", "Collection", "<", "Variable", ">", "variables", ")", "{", "return", "compute", "(", "formulas", ",", "variables", ",", "BackboneType", ".", "ONLY_NEGATIVE", ")", ";", "}" ]
Computes the negative backbone variables for a given collection of formulas w.r.t. a collection of variables. @param formulas the given collection of formulas @param variables the given collection of relevant variables for the backbone computation @return the negative backbone or {@code null} if the formula is UNSAT
[ "Computes", "the", "negative", "backbone", "variables", "for", "a", "given", "collection", "of", "formulas", "w", ".", "r", ".", "t", ".", "a", "collection", "of", "variables", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/backbones/BackboneGeneration.java#L202-L204
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/ComponentEnhancer.java
ComponentEnhancer.injectInnerComponent
@SuppressWarnings("unchecked") private static void injectInnerComponent(final Component<?> component, final Field field, final Object... keyParts) { """ Inject Inner component. @param component the component @param field the field @param keyParts the key parts """ final ParameterizedType innerComponentType = (ParameterizedType) field.getGenericType(); final Class<?> componentType = (Class<?>) innerComponentType.getActualTypeArguments()[0]; try { ClassUtility.setFieldValue(field, component, CBuilder.innerComponent((Class<Command>) componentType, keyParts).host(component)); } catch (IllegalArgumentException | CoreException e) { LOGGER.error(COMPONENT_INJECTION_FAILURE, component.getClass(), e); } }
java
@SuppressWarnings("unchecked") private static void injectInnerComponent(final Component<?> component, final Field field, final Object... keyParts) { final ParameterizedType innerComponentType = (ParameterizedType) field.getGenericType(); final Class<?> componentType = (Class<?>) innerComponentType.getActualTypeArguments()[0]; try { ClassUtility.setFieldValue(field, component, CBuilder.innerComponent((Class<Command>) componentType, keyParts).host(component)); } catch (IllegalArgumentException | CoreException e) { LOGGER.error(COMPONENT_INJECTION_FAILURE, component.getClass(), e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "void", "injectInnerComponent", "(", "final", "Component", "<", "?", ">", "component", ",", "final", "Field", "field", ",", "final", "Object", "...", "keyParts", ")", "{", "final", "ParameterizedType", "innerComponentType", "=", "(", "ParameterizedType", ")", "field", ".", "getGenericType", "(", ")", ";", "final", "Class", "<", "?", ">", "componentType", "=", "(", "Class", "<", "?", ">", ")", "innerComponentType", ".", "getActualTypeArguments", "(", ")", "[", "0", "]", ";", "try", "{", "ClassUtility", ".", "setFieldValue", "(", "field", ",", "component", ",", "CBuilder", ".", "innerComponent", "(", "(", "Class", "<", "Command", ">", ")", "componentType", ",", "keyParts", ")", ".", "host", "(", "component", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "|", "CoreException", "e", ")", "{", "LOGGER", ".", "error", "(", "COMPONENT_INJECTION_FAILURE", ",", "component", ".", "getClass", "(", ")", ",", "e", ")", ";", "}", "}" ]
Inject Inner component. @param component the component @param field the field @param keyParts the key parts
[ "Inject", "Inner", "component", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/link/ComponentEnhancer.java#L161-L174
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.makeIntersectionType
public IntersectionClassType makeIntersectionType(List<Type> bounds, boolean allInterfaces) { """ Make an intersection type from non-empty list of types. The list should be ordered according to {@link TypeSymbol#precedes(TypeSymbol, Types)}. This does not cause symbol completion as an extra parameter indicates as to whether all bounds are interfaces - in which case the supertype is implicitly assumed to be 'Object'. @param bounds the types from which the intersection type is formed @param allInterfaces are all bounds interface types? """ Assert.check(bounds.nonEmpty()); Type firstExplicitBound = bounds.head; if (allInterfaces) { bounds = bounds.prepend(syms.objectType); } ClassSymbol bc = new ClassSymbol(ABSTRACT|PUBLIC|SYNTHETIC|COMPOUND|ACYCLIC, Type.moreInfo ? names.fromString(bounds.toString()) : names.empty, null, syms.noSymbol); IntersectionClassType intersectionType = new IntersectionClassType(bounds, bc, allInterfaces); bc.type = intersectionType; bc.erasure_field = (bounds.head.hasTag(TYPEVAR)) ? syms.objectType : // error condition, recover erasure(firstExplicitBound); bc.members_field = WriteableScope.create(bc); return intersectionType; }
java
public IntersectionClassType makeIntersectionType(List<Type> bounds, boolean allInterfaces) { Assert.check(bounds.nonEmpty()); Type firstExplicitBound = bounds.head; if (allInterfaces) { bounds = bounds.prepend(syms.objectType); } ClassSymbol bc = new ClassSymbol(ABSTRACT|PUBLIC|SYNTHETIC|COMPOUND|ACYCLIC, Type.moreInfo ? names.fromString(bounds.toString()) : names.empty, null, syms.noSymbol); IntersectionClassType intersectionType = new IntersectionClassType(bounds, bc, allInterfaces); bc.type = intersectionType; bc.erasure_field = (bounds.head.hasTag(TYPEVAR)) ? syms.objectType : // error condition, recover erasure(firstExplicitBound); bc.members_field = WriteableScope.create(bc); return intersectionType; }
[ "public", "IntersectionClassType", "makeIntersectionType", "(", "List", "<", "Type", ">", "bounds", ",", "boolean", "allInterfaces", ")", "{", "Assert", ".", "check", "(", "bounds", ".", "nonEmpty", "(", ")", ")", ";", "Type", "firstExplicitBound", "=", "bounds", ".", "head", ";", "if", "(", "allInterfaces", ")", "{", "bounds", "=", "bounds", ".", "prepend", "(", "syms", ".", "objectType", ")", ";", "}", "ClassSymbol", "bc", "=", "new", "ClassSymbol", "(", "ABSTRACT", "|", "PUBLIC", "|", "SYNTHETIC", "|", "COMPOUND", "|", "ACYCLIC", ",", "Type", ".", "moreInfo", "?", "names", ".", "fromString", "(", "bounds", ".", "toString", "(", ")", ")", ":", "names", ".", "empty", ",", "null", ",", "syms", ".", "noSymbol", ")", ";", "IntersectionClassType", "intersectionType", "=", "new", "IntersectionClassType", "(", "bounds", ",", "bc", ",", "allInterfaces", ")", ";", "bc", ".", "type", "=", "intersectionType", ";", "bc", ".", "erasure_field", "=", "(", "bounds", ".", "head", ".", "hasTag", "(", "TYPEVAR", ")", ")", "?", "syms", ".", "objectType", ":", "// error condition, recover", "erasure", "(", "firstExplicitBound", ")", ";", "bc", ".", "members_field", "=", "WriteableScope", ".", "create", "(", "bc", ")", ";", "return", "intersectionType", ";", "}" ]
Make an intersection type from non-empty list of types. The list should be ordered according to {@link TypeSymbol#precedes(TypeSymbol, Types)}. This does not cause symbol completion as an extra parameter indicates as to whether all bounds are interfaces - in which case the supertype is implicitly assumed to be 'Object'. @param bounds the types from which the intersection type is formed @param allInterfaces are all bounds interface types?
[ "Make", "an", "intersection", "type", "from", "non", "-", "empty", "list", "of", "types", ".", "The", "list", "should", "be", "ordered", "according", "to", "{", "@link", "TypeSymbol#precedes", "(", "TypeSymbol", "Types", ")", "}", ".", "This", "does", "not", "cause", "symbol", "completion", "as", "an", "extra", "parameter", "indicates", "as", "to", "whether", "all", "bounds", "are", "interfaces", "-", "in", "which", "case", "the", "supertype", "is", "implicitly", "assumed", "to", "be", "Object", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L2188-L2208
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixtureWithMap.java
SlimFixtureWithMap.addValueTo
public void addValueTo(Object value, String name) { """ Adds value to (end of) a list. @param value value to be stored. @param name name of list to extend. """ getMapHelper().addValueToIn(value, name, getCurrentValues()); }
java
public void addValueTo(Object value, String name) { getMapHelper().addValueToIn(value, name, getCurrentValues()); }
[ "public", "void", "addValueTo", "(", "Object", "value", ",", "String", "name", ")", "{", "getMapHelper", "(", ")", ".", "addValueToIn", "(", "value", ",", "name", ",", "getCurrentValues", "(", ")", ")", ";", "}" ]
Adds value to (end of) a list. @param value value to be stored. @param name name of list to extend.
[ "Adds", "value", "to", "(", "end", "of", ")", "a", "list", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixtureWithMap.java#L72-L74
code4everything/util
src/main/java/com/zhazhapan/util/LoggerUtils.java
LoggerUtils.info
public static void info(Class<?> clazz, String message, String... values) { """ 信息 @param clazz 类 @param message 消息 @param values 格式化参数 @since 1.0.8 """ getLogger(clazz).info(formatString(message, values)); }
java
public static void info(Class<?> clazz, String message, String... values) { getLogger(clazz).info(formatString(message, values)); }
[ "public", "static", "void", "info", "(", "Class", "<", "?", ">", "clazz", ",", "String", "message", ",", "String", "...", "values", ")", "{", "getLogger", "(", "clazz", ")", ".", "info", "(", "formatString", "(", "message", ",", "values", ")", ")", ";", "}" ]
信息 @param clazz 类 @param message 消息 @param values 格式化参数 @since 1.0.8
[ "信息" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/LoggerUtils.java#L93-L95
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.repeatString
public static String repeatString(String str, int count) { """ reapeats a string @param str string to repeat @param count how many time string will be repeated @return reapted string """ if (count <= 0) return ""; char[] chars = str.toCharArray(); char[] rtn = new char[chars.length * count]; int pos = 0; for (int i = 0; i < count; i++) { for (int y = 0; y < chars.length; y++) rtn[pos++] = chars[y]; // rtn.append(str); } return new String(rtn); }
java
public static String repeatString(String str, int count) { if (count <= 0) return ""; char[] chars = str.toCharArray(); char[] rtn = new char[chars.length * count]; int pos = 0; for (int i = 0; i < count; i++) { for (int y = 0; y < chars.length; y++) rtn[pos++] = chars[y]; // rtn.append(str); } return new String(rtn); }
[ "public", "static", "String", "repeatString", "(", "String", "str", ",", "int", "count", ")", "{", "if", "(", "count", "<=", "0", ")", "return", "\"\"", ";", "char", "[", "]", "chars", "=", "str", ".", "toCharArray", "(", ")", ";", "char", "[", "]", "rtn", "=", "new", "char", "[", "chars", ".", "length", "*", "count", "]", ";", "int", "pos", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "for", "(", "int", "y", "=", "0", ";", "y", "<", "chars", ".", "length", ";", "y", "++", ")", "rtn", "[", "pos", "++", "]", "=", "chars", "[", "y", "]", ";", "// rtn.append(str);", "}", "return", "new", "String", "(", "rtn", ")", ";", "}" ]
reapeats a string @param str string to repeat @param count how many time string will be repeated @return reapted string
[ "reapeats", "a", "string" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L237-L248
Talend/tesb-rt-se
locator-service/locator-soap-service/src/main/java/org/talend/esb/locator/service/LocatorSoapServiceImpl.java
LocatorSoapServiceImpl.unregisterEndpoint
@Override public void unregisterEndpoint(QName serviceName, String endpointURL) throws ServiceLocatorFault, InterruptedExceptionFault { """ Unregister the endpoint for given service. @param input UnregisterEndpointRequestType encapsulate name of service and endpointURL. Must not be <code>null</code> """ if (LOG.isLoggable(Level.FINE)) { LOG.fine("Unregistering endpoint " + endpointURL + " for service " + serviceName + "..."); } try { initLocator(); locatorClient.unregister(serviceName, endpointURL); } catch (ServiceLocatorException e) { ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail(); serviceFaultDetail.setLocatorFaultDetail(serviceName.toString() + "throws ServiceLocatorFault"); throw new ServiceLocatorFault(e.getMessage(), serviceFaultDetail); } catch (InterruptedException e) { InterruptionFaultDetail interruptionFaultDetail = new InterruptionFaultDetail(); interruptionFaultDetail.setInterruptionDetail(serviceName .toString() + "throws InterruptionFault"); throw new InterruptedExceptionFault(e.getMessage(), interruptionFaultDetail); } }
java
@Override public void unregisterEndpoint(QName serviceName, String endpointURL) throws ServiceLocatorFault, InterruptedExceptionFault { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Unregistering endpoint " + endpointURL + " for service " + serviceName + "..."); } try { initLocator(); locatorClient.unregister(serviceName, endpointURL); } catch (ServiceLocatorException e) { ServiceLocatorFaultDetail serviceFaultDetail = new ServiceLocatorFaultDetail(); serviceFaultDetail.setLocatorFaultDetail(serviceName.toString() + "throws ServiceLocatorFault"); throw new ServiceLocatorFault(e.getMessage(), serviceFaultDetail); } catch (InterruptedException e) { InterruptionFaultDetail interruptionFaultDetail = new InterruptionFaultDetail(); interruptionFaultDetail.setInterruptionDetail(serviceName .toString() + "throws InterruptionFault"); throw new InterruptedExceptionFault(e.getMessage(), interruptionFaultDetail); } }
[ "@", "Override", "public", "void", "unregisterEndpoint", "(", "QName", "serviceName", ",", "String", "endpointURL", ")", "throws", "ServiceLocatorFault", ",", "InterruptedExceptionFault", "{", "if", "(", "LOG", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "LOG", ".", "fine", "(", "\"Unregistering endpoint \"", "+", "endpointURL", "+", "\" for service \"", "+", "serviceName", "+", "\"...\"", ")", ";", "}", "try", "{", "initLocator", "(", ")", ";", "locatorClient", ".", "unregister", "(", "serviceName", ",", "endpointURL", ")", ";", "}", "catch", "(", "ServiceLocatorException", "e", ")", "{", "ServiceLocatorFaultDetail", "serviceFaultDetail", "=", "new", "ServiceLocatorFaultDetail", "(", ")", ";", "serviceFaultDetail", ".", "setLocatorFaultDetail", "(", "serviceName", ".", "toString", "(", ")", "+", "\"throws ServiceLocatorFault\"", ")", ";", "throw", "new", "ServiceLocatorFault", "(", "e", ".", "getMessage", "(", ")", ",", "serviceFaultDetail", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "InterruptionFaultDetail", "interruptionFaultDetail", "=", "new", "InterruptionFaultDetail", "(", ")", ";", "interruptionFaultDetail", ".", "setInterruptionDetail", "(", "serviceName", ".", "toString", "(", ")", "+", "\"throws InterruptionFault\"", ")", ";", "throw", "new", "InterruptedExceptionFault", "(", "e", ".", "getMessage", "(", ")", ",", "interruptionFaultDetail", ")", ";", "}", "}" ]
Unregister the endpoint for given service. @param input UnregisterEndpointRequestType encapsulate name of service and endpointURL. Must not be <code>null</code>
[ "Unregister", "the", "endpoint", "for", "given", "service", "." ]
train
https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/locator-service/locator-soap-service/src/main/java/org/talend/esb/locator/service/LocatorSoapServiceImpl.java#L232-L254
forge/core
parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/utils/JLSValidator.java
JLSValidator.validateVariableName
public static ValidationResult validateVariableName(String identifier) { """ Validates whether the <code>identifier</code> parameter is a valid variable name. @param identifier @return """ if (Strings.isNullOrEmpty(identifier)) return new ValidationResult(ERROR, Messages.notNullOrEmpty(VARIABLE_NAME)); return validateIdentifier(identifier, IdentifierType.VARIABLE_NAME); }
java
public static ValidationResult validateVariableName(String identifier) { if (Strings.isNullOrEmpty(identifier)) return new ValidationResult(ERROR, Messages.notNullOrEmpty(VARIABLE_NAME)); return validateIdentifier(identifier, IdentifierType.VARIABLE_NAME); }
[ "public", "static", "ValidationResult", "validateVariableName", "(", "String", "identifier", ")", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "identifier", ")", ")", "return", "new", "ValidationResult", "(", "ERROR", ",", "Messages", ".", "notNullOrEmpty", "(", "VARIABLE_NAME", ")", ")", ";", "return", "validateIdentifier", "(", "identifier", ",", "IdentifierType", ".", "VARIABLE_NAME", ")", ";", "}" ]
Validates whether the <code>identifier</code> parameter is a valid variable name. @param identifier @return
[ "Validates", "whether", "the", "<code", ">", "identifier<", "/", "code", ">", "parameter", "is", "a", "valid", "variable", "name", "." ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/parser-java/api/src/main/java/org/jboss/forge/addon/parser/java/utils/JLSValidator.java#L51-L56
LearnLib/automatalib
util/src/main/java/net/automatalib/util/minimizer/Minimizer.java
Minimizer.addAllToSplitterQueue
private void addAllToSplitterQueue(Collection<Block<S, L>> blocks) { """ Adds all but the largest block of a given collection to the splitter queue. """ for (Block<S, L> block : blocks) { addToSplitterQueue(block); } }
java
private void addAllToSplitterQueue(Collection<Block<S, L>> blocks) { for (Block<S, L> block : blocks) { addToSplitterQueue(block); } }
[ "private", "void", "addAllToSplitterQueue", "(", "Collection", "<", "Block", "<", "S", ",", "L", ">", ">", "blocks", ")", "{", "for", "(", "Block", "<", "S", ",", "L", ">", "block", ":", "blocks", ")", "{", "addToSplitterQueue", "(", "block", ")", ";", "}", "}" ]
Adds all but the largest block of a given collection to the splitter queue.
[ "Adds", "all", "but", "the", "largest", "block", "of", "a", "given", "collection", "to", "the", "splitter", "queue", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/minimizer/Minimizer.java#L454-L458
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.isRoundingAvailable
public static boolean isRoundingAvailable(CurrencyUnit currencyUnit, String... providers) { """ Checks if a {@link MonetaryRounding} is available given a roundingId. @param currencyUnit The currency, which determines the required scale. As {@link java.math.RoundingMode}, by default, {@link java.math.RoundingMode#HALF_UP} is used. @param providers the providers and ordering to be used. By default providers and ordering as defined in #getDefaultProviders is used. @return true, if a corresponding {@link javax.money.MonetaryRounding} is available. @throws IllegalArgumentException if no such rounding is registered using a {@link javax.money.spi.RoundingProviderSpi} instance. """ return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow( () -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available.")) .isRoundingAvailable(currencyUnit, providers); }
java
public static boolean isRoundingAvailable(CurrencyUnit currencyUnit, String... providers) { return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow( () -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available.")) .isRoundingAvailable(currencyUnit, providers); }
[ "public", "static", "boolean", "isRoundingAvailable", "(", "CurrencyUnit", "currencyUnit", ",", "String", "...", "providers", ")", "{", "return", "Optional", ".", "ofNullable", "(", "monetaryRoundingsSingletonSpi", "(", ")", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "MonetaryException", "(", "\"No MonetaryRoundingsSpi loaded, query functionality is not available.\"", ")", ")", ".", "isRoundingAvailable", "(", "currencyUnit", ",", "providers", ")", ";", "}" ]
Checks if a {@link MonetaryRounding} is available given a roundingId. @param currencyUnit The currency, which determines the required scale. As {@link java.math.RoundingMode}, by default, {@link java.math.RoundingMode#HALF_UP} is used. @param providers the providers and ordering to be used. By default providers and ordering as defined in #getDefaultProviders is used. @return true, if a corresponding {@link javax.money.MonetaryRounding} is available. @throws IllegalArgumentException if no such rounding is registered using a {@link javax.money.spi.RoundingProviderSpi} instance.
[ "Checks", "if", "a", "{", "@link", "MonetaryRounding", "}", "is", "available", "given", "a", "roundingId", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L219-L223
uniform-java/uniform
src/main/java/net/uniform/html/elements/DatePicker.java
DatePicker.getConvertedValue
@Override public Date getConvertedValue() { """ Returns the value of this element as a Date, automatically converting the value string with the configured date format. If the value is not empty and its format is incorrect, an exception will be thrown. @return Date """ String dateStr = this.getFirstValue(); if (dateStr != null && !dateStr.trim().isEmpty()) { dateStr = dateStr.trim(); try { return dateFormat.parse(dateStr); } catch (ParseException ex) { throw new UniformException(String.format("Could not parse date %s", dateStr), ex); } } return null; }
java
@Override public Date getConvertedValue() { String dateStr = this.getFirstValue(); if (dateStr != null && !dateStr.trim().isEmpty()) { dateStr = dateStr.trim(); try { return dateFormat.parse(dateStr); } catch (ParseException ex) { throw new UniformException(String.format("Could not parse date %s", dateStr), ex); } } return null; }
[ "@", "Override", "public", "Date", "getConvertedValue", "(", ")", "{", "String", "dateStr", "=", "this", ".", "getFirstValue", "(", ")", ";", "if", "(", "dateStr", "!=", "null", "&&", "!", "dateStr", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "dateStr", "=", "dateStr", ".", "trim", "(", ")", ";", "try", "{", "return", "dateFormat", ".", "parse", "(", "dateStr", ")", ";", "}", "catch", "(", "ParseException", "ex", ")", "{", "throw", "new", "UniformException", "(", "String", ".", "format", "(", "\"Could not parse date %s\"", ",", "dateStr", ")", ",", "ex", ")", ";", "}", "}", "return", "null", ";", "}" ]
Returns the value of this element as a Date, automatically converting the value string with the configured date format. If the value is not empty and its format is incorrect, an exception will be thrown. @return Date
[ "Returns", "the", "value", "of", "this", "element", "as", "a", "Date", "automatically", "converting", "the", "value", "string", "with", "the", "configured", "date", "format", ".", "If", "the", "value", "is", "not", "empty", "and", "its", "format", "is", "incorrect", "an", "exception", "will", "be", "thrown", "." ]
train
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/html/elements/DatePicker.java#L90-L104
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/SimonConsolePlugin.java
SimonConsolePlugin.addResource
public final void addResource(String path, HtmlResourceType type) { """ Add a resource to this plugin. @param path Resource path @param type Resource type """ resources.add(new HtmlResource(path, type)); }
java
public final void addResource(String path, HtmlResourceType type) { resources.add(new HtmlResource(path, type)); }
[ "public", "final", "void", "addResource", "(", "String", "path", ",", "HtmlResourceType", "type", ")", "{", "resources", ".", "add", "(", "new", "HtmlResource", "(", "path", ",", "type", ")", ")", ";", "}" ]
Add a resource to this plugin. @param path Resource path @param type Resource type
[ "Add", "a", "resource", "to", "this", "plugin", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonConsolePlugin.java#L54-L56
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java
Matrix.getMatrix
public Matrix getMatrix(int i0, int i1, int[] c) { """ Get a submatrix. @param i0 Initial row index @param i1 Final row index @param c Array of column indices. @return A(i0:i1, c(:)) @throws ArrayIndexOutOfBoundsException Submatrix indices """ Matrix X = new Matrix(i1 - i0 + 1, c.length); double[][] B = X.getArray(); try { for (int i = i0; i <= i1; i++) { for (int j = 0; j < c.length; j++) { B[i - i0][j] = A[i][c[j]]; } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } return X; }
java
public Matrix getMatrix(int i0, int i1, int[] c) { Matrix X = new Matrix(i1 - i0 + 1, c.length); double[][] B = X.getArray(); try { for (int i = i0; i <= i1; i++) { for (int j = 0; j < c.length; j++) { B[i - i0][j] = A[i][c[j]]; } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } return X; }
[ "public", "Matrix", "getMatrix", "(", "int", "i0", ",", "int", "i1", ",", "int", "[", "]", "c", ")", "{", "Matrix", "X", "=", "new", "Matrix", "(", "i1", "-", "i0", "+", "1", ",", "c", ".", "length", ")", ";", "double", "[", "]", "[", "]", "B", "=", "X", ".", "getArray", "(", ")", ";", "try", "{", "for", "(", "int", "i", "=", "i0", ";", "i", "<=", "i1", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "c", ".", "length", ";", "j", "++", ")", "{", "B", "[", "i", "-", "i0", "]", "[", "j", "]", "=", "A", "[", "i", "]", "[", "c", "[", "j", "]", "]", ";", "}", "}", "}", "catch", "(", "ArrayIndexOutOfBoundsException", "e", ")", "{", "throw", "new", "ArrayIndexOutOfBoundsException", "(", "\"Submatrix indices\"", ")", ";", "}", "return", "X", ";", "}" ]
Get a submatrix. @param i0 Initial row index @param i1 Final row index @param c Array of column indices. @return A(i0:i1, c(:)) @throws ArrayIndexOutOfBoundsException Submatrix indices
[ "Get", "a", "submatrix", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L423-L442
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.unsetUser
public String unsetUser(String uid, List<String> properties) throws ExecutionException, InterruptedException, IOException { """ Unsets properties of a user. Same as {@link #unsetUser(String, List, DateTime) unsetUser(String, List&lt;String&gt;, DateTime)} except event time is not specified and recorded as the time when the function is called. """ return unsetUser(uid, properties, new DateTime()); }
java
public String unsetUser(String uid, List<String> properties) throws ExecutionException, InterruptedException, IOException { return unsetUser(uid, properties, new DateTime()); }
[ "public", "String", "unsetUser", "(", "String", "uid", ",", "List", "<", "String", ">", "properties", ")", "throws", "ExecutionException", ",", "InterruptedException", ",", "IOException", "{", "return", "unsetUser", "(", "uid", ",", "properties", ",", "new", "DateTime", "(", ")", ")", ";", "}" ]
Unsets properties of a user. Same as {@link #unsetUser(String, List, DateTime) unsetUser(String, List&lt;String&gt;, DateTime)} except event time is not specified and recorded as the time when the function is called.
[ "Unsets", "properties", "of", "a", "user", ".", "Same", "as", "{" ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L391-L394
ozimov/cirneco
hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/date/IsDateWithTime.java
IsDateWithTime.hasHourMinSecAndMillis
public static Matcher<Date> hasHourMinSecAndMillis(final int hour, final int minute, final int second, final int millisecond) { """ Creates a matcher that matches when the examined {@linkplain Date} has the given values <code>hour</code> in a 24 hours clock period, <code>minute</code>, <code>sec</code> and <code>millis</code>. """ return new IsDateWithTime(hour, minute, second, millisecond); }
java
public static Matcher<Date> hasHourMinSecAndMillis(final int hour, final int minute, final int second, final int millisecond) { return new IsDateWithTime(hour, minute, second, millisecond); }
[ "public", "static", "Matcher", "<", "Date", ">", "hasHourMinSecAndMillis", "(", "final", "int", "hour", ",", "final", "int", "minute", ",", "final", "int", "second", ",", "final", "int", "millisecond", ")", "{", "return", "new", "IsDateWithTime", "(", "hour", ",", "minute", ",", "second", ",", "millisecond", ")", ";", "}" ]
Creates a matcher that matches when the examined {@linkplain Date} has the given values <code>hour</code> in a 24 hours clock period, <code>minute</code>, <code>sec</code> and <code>millis</code>.
[ "Creates", "a", "matcher", "that", "matches", "when", "the", "examined", "{" ]
train
https://github.com/ozimov/cirneco/blob/78ad782da0a2256634cfbebb2f97ed78c993b999/hamcrest/hamcrest-matchers/src/main/java/it/ozimov/cirneco/hamcrest/date/IsDateWithTime.java#L125-L128
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmUtils.java
XsdAsmUtils.createAttribute
private static void createAttribute(Map<String, List<XsdAttribute>> createdAttributes, XsdAttribute elementAttribute) { """ Adds an attribute to createAttributes {@link Map} object. @param createdAttributes The received {@link Map}. Contains the already created attributes. @param elementAttribute The new attribute to add to the {@link Map} object. """ if (!createdAttributes.containsKey(elementAttribute.getName())){ List<XsdAttribute> attributes = new ArrayList<>(); attributes.add(elementAttribute); createdAttributes.put(elementAttribute.getName(), attributes); } else { List<XsdAttribute> attributes = createdAttributes.get(elementAttribute.getName()); if (!attributes.contains(elementAttribute)){ attributes.add(elementAttribute); } } }
java
private static void createAttribute(Map<String, List<XsdAttribute>> createdAttributes, XsdAttribute elementAttribute) { if (!createdAttributes.containsKey(elementAttribute.getName())){ List<XsdAttribute> attributes = new ArrayList<>(); attributes.add(elementAttribute); createdAttributes.put(elementAttribute.getName(), attributes); } else { List<XsdAttribute> attributes = createdAttributes.get(elementAttribute.getName()); if (!attributes.contains(elementAttribute)){ attributes.add(elementAttribute); } } }
[ "private", "static", "void", "createAttribute", "(", "Map", "<", "String", ",", "List", "<", "XsdAttribute", ">", ">", "createdAttributes", ",", "XsdAttribute", "elementAttribute", ")", "{", "if", "(", "!", "createdAttributes", ".", "containsKey", "(", "elementAttribute", ".", "getName", "(", ")", ")", ")", "{", "List", "<", "XsdAttribute", ">", "attributes", "=", "new", "ArrayList", "<>", "(", ")", ";", "attributes", ".", "add", "(", "elementAttribute", ")", ";", "createdAttributes", ".", "put", "(", "elementAttribute", ".", "getName", "(", ")", ",", "attributes", ")", ";", "}", "else", "{", "List", "<", "XsdAttribute", ">", "attributes", "=", "createdAttributes", ".", "get", "(", "elementAttribute", ".", "getName", "(", ")", ")", ";", "if", "(", "!", "attributes", ".", "contains", "(", "elementAttribute", ")", ")", "{", "attributes", ".", "add", "(", "elementAttribute", ")", ";", "}", "}", "}" ]
Adds an attribute to createAttributes {@link Map} object. @param createdAttributes The received {@link Map}. Contains the already created attributes. @param elementAttribute The new attribute to add to the {@link Map} object.
[ "Adds", "an", "attribute", "to", "createAttributes", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmUtils.java#L320-L334
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
SubWriterHolderWriter.addIndexComment
protected void addIndexComment(Doc member, Content contentTree) { """ Add the index comment. @param member the member being documented @param contentTree the content tree to which the comment will be added """ addIndexComment(member, member.firstSentenceTags(), contentTree); }
java
protected void addIndexComment(Doc member, Content contentTree) { addIndexComment(member, member.firstSentenceTags(), contentTree); }
[ "protected", "void", "addIndexComment", "(", "Doc", "member", ",", "Content", "contentTree", ")", "{", "addIndexComment", "(", "member", ",", "member", ".", "firstSentenceTags", "(", ")", ",", "contentTree", ")", ";", "}" ]
Add the index comment. @param member the member being documented @param contentTree the content tree to which the comment will be added
[ "Add", "the", "index", "comment", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java#L169-L171
bwkimmel/java-util
src/main/java/ca/eandb/util/io/FileUtil.java
FileUtil.setFileContents
public static void setFileContents(File file, byte[] contents, boolean createDirectory) throws IOException { """ Writes the specified byte array to a file. @param file The <code>File</code> to write. @param contents The byte array to write to the file. @param createDirectory A value indicating whether the directory containing the file to be written should be created if it does not exist. @throws IOException If the file could not be written. """ if (createDirectory) { File directory = file.getParentFile(); if (!directory.exists()) { directory.mkdirs(); } } FileOutputStream stream = new FileOutputStream(file); stream.write(contents); stream.close(); }
java
public static void setFileContents(File file, byte[] contents, boolean createDirectory) throws IOException { if (createDirectory) { File directory = file.getParentFile(); if (!directory.exists()) { directory.mkdirs(); } } FileOutputStream stream = new FileOutputStream(file); stream.write(contents); stream.close(); }
[ "public", "static", "void", "setFileContents", "(", "File", "file", ",", "byte", "[", "]", "contents", ",", "boolean", "createDirectory", ")", "throws", "IOException", "{", "if", "(", "createDirectory", ")", "{", "File", "directory", "=", "file", ".", "getParentFile", "(", ")", ";", "if", "(", "!", "directory", ".", "exists", "(", ")", ")", "{", "directory", ".", "mkdirs", "(", ")", ";", "}", "}", "FileOutputStream", "stream", "=", "new", "FileOutputStream", "(", "file", ")", ";", "stream", ".", "write", "(", "contents", ")", ";", "stream", ".", "close", "(", ")", ";", "}" ]
Writes the specified byte array to a file. @param file The <code>File</code> to write. @param contents The byte array to write to the file. @param createDirectory A value indicating whether the directory containing the file to be written should be created if it does not exist. @throws IOException If the file could not be written.
[ "Writes", "the", "specified", "byte", "array", "to", "a", "file", "." ]
train
https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/FileUtil.java#L110-L121
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java
ToPojo.readAnnotationProperty
private static String readAnnotationProperty(String ref, TypeDef source, Property property) { """ Returns the string representation of the code that reads a primitive array property. @param ref The reference. @param source The type of the reference. @param property The property to read. @return The code. """ return convertReference(ref, source, ((ClassRef)property.getTypeRef()).getDefinition()); }
java
private static String readAnnotationProperty(String ref, TypeDef source, Property property) { return convertReference(ref, source, ((ClassRef)property.getTypeRef()).getDefinition()); }
[ "private", "static", "String", "readAnnotationProperty", "(", "String", "ref", ",", "TypeDef", "source", ",", "Property", "property", ")", "{", "return", "convertReference", "(", "ref", ",", "source", ",", "(", "(", "ClassRef", ")", "property", ".", "getTypeRef", "(", ")", ")", ".", "getDefinition", "(", ")", ")", ";", "}" ]
Returns the string representation of the code that reads a primitive array property. @param ref The reference. @param source The type of the reference. @param property The property to read. @return The code.
[ "Returns", "the", "string", "representation", "of", "the", "code", "that", "reads", "a", "primitive", "array", "property", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L675-L677
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.createClosedListEntityRoleAsync
public Observable<UUID> createClosedListEntityRoleAsync(UUID appId, String versionId, UUID entityId, CreateClosedListEntityRoleOptionalParameter createClosedListEntityRoleOptionalParameter) { """ Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param entityId The entity model ID. @param createClosedListEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object """ return createClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createClosedListEntityRoleOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() { @Override public UUID call(ServiceResponse<UUID> response) { return response.body(); } }); }
java
public Observable<UUID> createClosedListEntityRoleAsync(UUID appId, String versionId, UUID entityId, CreateClosedListEntityRoleOptionalParameter createClosedListEntityRoleOptionalParameter) { return createClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createClosedListEntityRoleOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() { @Override public UUID call(ServiceResponse<UUID> response) { return response.body(); } }); }
[ "public", "Observable", "<", "UUID", ">", "createClosedListEntityRoleAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "CreateClosedListEntityRoleOptionalParameter", "createClosedListEntityRoleOptionalParameter", ")", "{", "return", "createClosedListEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ",", "createClosedListEntityRoleOptionalParameter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "UUID", ">", ",", "UUID", ">", "(", ")", "{", "@", "Override", "public", "UUID", "call", "(", "ServiceResponse", "<", "UUID", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param entityId The entity model ID. @param createClosedListEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object
[ "Create", "an", "entity", "role", "for", "an", "entity", "in", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L8341-L8348
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java
PersonGroupPersonsImpl.addPersonFaceFromUrl
public PersistedFace addPersonFaceFromUrl(String personGroupId, UUID personId, String url, AddPersonFaceFromUrlOptionalParameter addPersonFaceFromUrlOptionalParameter) { """ Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @param personGroupId Id referencing a particular person group. @param personId Id referencing a particular person. @param url Publicly reachable URL of an image @param addPersonFaceFromUrlOptionalParameter the object representing the optional parameters to be set before calling this API @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 PersistedFace object if successful. """ return addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, addPersonFaceFromUrlOptionalParameter).toBlocking().single().body(); }
java
public PersistedFace addPersonFaceFromUrl(String personGroupId, UUID personId, String url, AddPersonFaceFromUrlOptionalParameter addPersonFaceFromUrlOptionalParameter) { return addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, addPersonFaceFromUrlOptionalParameter).toBlocking().single().body(); }
[ "public", "PersistedFace", "addPersonFaceFromUrl", "(", "String", "personGroupId", ",", "UUID", "personId", ",", "String", "url", ",", "AddPersonFaceFromUrlOptionalParameter", "addPersonFaceFromUrlOptionalParameter", ")", "{", "return", "addPersonFaceFromUrlWithServiceResponseAsync", "(", "personGroupId", ",", "personId", ",", "url", ",", "addPersonFaceFromUrlOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @param personGroupId Id referencing a particular person group. @param personId Id referencing a particular person. @param url Publicly reachable URL of an image @param addPersonFaceFromUrlOptionalParameter the object representing the optional parameters to be set before calling this API @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 PersistedFace object if successful.
[ "Add", "a", "representative", "face", "to", "a", "person", "for", "identification", ".", "The", "input", "face", "is", "specified", "as", "an", "image", "with", "a", "targetFace", "rectangle", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java#L1171-L1173
spring-projects/spring-hateoas
src/main/java/org/springframework/hateoas/Link.java
Link.withRel
public Link withRel(LinkRelation relation) { """ Creates a new {@link Link} with the same href but given {@link LinkRelation}. @param relation must not be {@literal null}. @return """ Assert.notNull(relation, "LinkRelation must not be null!"); return new Link(relation, href, hreflang, media, title, type, deprecation, profile, name, template, affordances); }
java
public Link withRel(LinkRelation relation) { Assert.notNull(relation, "LinkRelation must not be null!"); return new Link(relation, href, hreflang, media, title, type, deprecation, profile, name, template, affordances); }
[ "public", "Link", "withRel", "(", "LinkRelation", "relation", ")", "{", "Assert", ".", "notNull", "(", "relation", ",", "\"LinkRelation must not be null!\"", ")", ";", "return", "new", "Link", "(", "relation", ",", "href", ",", "hreflang", ",", "media", ",", "title", ",", "type", ",", "deprecation", ",", "profile", ",", "name", ",", "template", ",", "affordances", ")", ";", "}" ]
Creates a new {@link Link} with the same href but given {@link LinkRelation}. @param relation must not be {@literal null}. @return
[ "Creates", "a", "new", "{", "@link", "Link", "}", "with", "the", "same", "href", "but", "given", "{", "@link", "LinkRelation", "}", "." ]
train
https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/Link.java#L350-L355
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/data/DMatrixSparseTriplet.java
DMatrixSparseTriplet.addItem
public void addItem(int row , int col , double value ) { """ <p>Adds a triplet of (row,vol,value) to the end of the list. This is the preferred way to add elements into this array type as it has a runtime complexity of O(1).</p> One potential problem with using this function instead of {@link #set(int, int, double)} is that it does not check to see if a (row,col) has already been assigned a value. If a (row,col) is defined multiple times how this is handled is not defined. @param row Row the element belongs in @param col Column the element belongs in @param value The value of the element """ if( nz_length == nz_value.data.length ) { int amount = nz_length + 10; nz_value.growInternal(amount); nz_rowcol.growInternal(amount*2); } nz_value.data[nz_length] = value; nz_rowcol.data[nz_length*2] = row; nz_rowcol.data[nz_length*2+1] = col; nz_length += 1; }
java
public void addItem(int row , int col , double value ) { if( nz_length == nz_value.data.length ) { int amount = nz_length + 10; nz_value.growInternal(amount); nz_rowcol.growInternal(amount*2); } nz_value.data[nz_length] = value; nz_rowcol.data[nz_length*2] = row; nz_rowcol.data[nz_length*2+1] = col; nz_length += 1; }
[ "public", "void", "addItem", "(", "int", "row", ",", "int", "col", ",", "double", "value", ")", "{", "if", "(", "nz_length", "==", "nz_value", ".", "data", ".", "length", ")", "{", "int", "amount", "=", "nz_length", "+", "10", ";", "nz_value", ".", "growInternal", "(", "amount", ")", ";", "nz_rowcol", ".", "growInternal", "(", "amount", "*", "2", ")", ";", "}", "nz_value", ".", "data", "[", "nz_length", "]", "=", "value", ";", "nz_rowcol", ".", "data", "[", "nz_length", "*", "2", "]", "=", "row", ";", "nz_rowcol", ".", "data", "[", "nz_length", "*", "2", "+", "1", "]", "=", "col", ";", "nz_length", "+=", "1", ";", "}" ]
<p>Adds a triplet of (row,vol,value) to the end of the list. This is the preferred way to add elements into this array type as it has a runtime complexity of O(1).</p> One potential problem with using this function instead of {@link #set(int, int, double)} is that it does not check to see if a (row,col) has already been assigned a value. If a (row,col) is defined multiple times how this is handled is not defined. @param row Row the element belongs in @param col Column the element belongs in @param value The value of the element
[ "<p", ">", "Adds", "a", "triplet", "of", "(", "row", "vol", "value", ")", "to", "the", "end", "of", "the", "list", ".", "This", "is", "the", "preferred", "way", "to", "add", "elements", "into", "this", "array", "type", "as", "it", "has", "a", "runtime", "complexity", "of", "O", "(", "1", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixSparseTriplet.java#L108-L118
alkacon/opencms-core
src-setup/org/opencms/setup/db/update6to7/postgresql/CmsUpdateDBCmsUsers.java
CmsUpdateDBCmsUsers.writeUserInfo
@Override protected void writeUserInfo(CmsSetupDb dbCon, String id, String key, Object value) { """ Writes one set of additional user info (key and its value) to the CMS_USERDATA table.<p> @param dbCon the db connection interface @param id the user id @param key the data key @param value the data value """ Connection conn = dbCon.getConnection(); try { PreparedStatement p = conn.prepareStatement(readQuery(QUERY_INSERT_CMS_USERDATA)); p.setString(1, id); p.setString(2, key); p.setBytes(3, CmsDataTypeUtil.dataSerialize(value)); p.setString(4, value.getClass().getName()); p.executeUpdate(); conn.commit(); } catch (SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
java
@Override protected void writeUserInfo(CmsSetupDb dbCon, String id, String key, Object value) { Connection conn = dbCon.getConnection(); try { PreparedStatement p = conn.prepareStatement(readQuery(QUERY_INSERT_CMS_USERDATA)); p.setString(1, id); p.setString(2, key); p.setBytes(3, CmsDataTypeUtil.dataSerialize(value)); p.setString(4, value.getClass().getName()); p.executeUpdate(); conn.commit(); } catch (SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
[ "@", "Override", "protected", "void", "writeUserInfo", "(", "CmsSetupDb", "dbCon", ",", "String", "id", ",", "String", "key", ",", "Object", "value", ")", "{", "Connection", "conn", "=", "dbCon", ".", "getConnection", "(", ")", ";", "try", "{", "PreparedStatement", "p", "=", "conn", ".", "prepareStatement", "(", "readQuery", "(", "QUERY_INSERT_CMS_USERDATA", ")", ")", ";", "p", ".", "setString", "(", "1", ",", "id", ")", ";", "p", ".", "setString", "(", "2", ",", "key", ")", ";", "p", ".", "setBytes", "(", "3", ",", "CmsDataTypeUtil", ".", "dataSerialize", "(", "value", ")", ")", ";", "p", ".", "setString", "(", "4", ",", "value", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "p", ".", "executeUpdate", "(", ")", ";", "conn", ".", "commit", "(", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Writes one set of additional user info (key and its value) to the CMS_USERDATA table.<p> @param dbCon the db connection interface @param id the user id @param key the data key @param value the data value
[ "Writes", "one", "set", "of", "additional", "user", "info", "(", "key", "and", "its", "value", ")", "to", "the", "CMS_USERDATA", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/update6to7/postgresql/CmsUpdateDBCmsUsers.java#L214-L233
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/RequestHandler.java
RequestHandler.diagnostics
public Observable<DiagnosticsResponse> diagnostics(final String id) { """ Performs the logistics of collecting and assembling the individual health check information on a per-service basis. @return an observable with the response once ready. """ List<Observable<EndpointHealth>> diags = new ArrayList<Observable<EndpointHealth>>(nodes.size()); for (Node node : nodes) { diags.add(node.diagnostics()); } final RingBufferDiagnostics ringBufferDiagnostics = RingBufferMonitor.instance().diagnostics(); return Observable.merge(diags).toList().map(new Func1<List<EndpointHealth>, DiagnosticsResponse>() { @Override public DiagnosticsResponse call(List<EndpointHealth> checks) { return new DiagnosticsResponse(new DiagnosticsReport(checks, environment.userAgent(), id, ringBufferDiagnostics)); } }); }
java
public Observable<DiagnosticsResponse> diagnostics(final String id) { List<Observable<EndpointHealth>> diags = new ArrayList<Observable<EndpointHealth>>(nodes.size()); for (Node node : nodes) { diags.add(node.diagnostics()); } final RingBufferDiagnostics ringBufferDiagnostics = RingBufferMonitor.instance().diagnostics(); return Observable.merge(diags).toList().map(new Func1<List<EndpointHealth>, DiagnosticsResponse>() { @Override public DiagnosticsResponse call(List<EndpointHealth> checks) { return new DiagnosticsResponse(new DiagnosticsReport(checks, environment.userAgent(), id, ringBufferDiagnostics)); } }); }
[ "public", "Observable", "<", "DiagnosticsResponse", ">", "diagnostics", "(", "final", "String", "id", ")", "{", "List", "<", "Observable", "<", "EndpointHealth", ">>", "diags", "=", "new", "ArrayList", "<", "Observable", "<", "EndpointHealth", ">", ">", "(", "nodes", ".", "size", "(", ")", ")", ";", "for", "(", "Node", "node", ":", "nodes", ")", "{", "diags", ".", "add", "(", "node", ".", "diagnostics", "(", ")", ")", ";", "}", "final", "RingBufferDiagnostics", "ringBufferDiagnostics", "=", "RingBufferMonitor", ".", "instance", "(", ")", ".", "diagnostics", "(", ")", ";", "return", "Observable", ".", "merge", "(", "diags", ")", ".", "toList", "(", ")", ".", "map", "(", "new", "Func1", "<", "List", "<", "EndpointHealth", ">", ",", "DiagnosticsResponse", ">", "(", ")", "{", "@", "Override", "public", "DiagnosticsResponse", "call", "(", "List", "<", "EndpointHealth", ">", "checks", ")", "{", "return", "new", "DiagnosticsResponse", "(", "new", "DiagnosticsReport", "(", "checks", ",", "environment", ".", "userAgent", "(", ")", ",", "id", ",", "ringBufferDiagnostics", ")", ")", ";", "}", "}", ")", ";", "}" ]
Performs the logistics of collecting and assembling the individual health check information on a per-service basis. @return an observable with the response once ready.
[ "Performs", "the", "logistics", "of", "collecting", "and", "assembling", "the", "individual", "health", "check", "information", "on", "a", "per", "-", "service", "basis", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/RequestHandler.java#L420-L432
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java
XBasePanel.printXMLHeaderInfo
public void printXMLHeaderInfo(PrintWriter out, ResourceBundle reg) { """ Print the header info, such as title, keywords and meta-desc. @param out The http output stream. @param reg Local resource bundle. """ String strTitle = this.getProperty("title"); // Menu page if ((strTitle == null) || (strTitle.length() == 0)) strTitle = ((BasePanel)this.getScreenField()).getTitle(); out.println(Utility.startTag(XMLTags.TITLE) + strTitle + Utility.endTag(XMLTags.TITLE)); String strKeywords = this.getKeywords(); if ((strKeywords != null) && (strKeywords.length() > 0)) out.println(Utility.startTag(XMLTags.META_KEYWORDS) + strKeywords + Utility.endTag(XMLTags.META_KEYWORDS)); String strDescription = strTitle; out.println(Utility.startTag(XMLTags.META_DESCRIPTION) + strDescription + Utility.endTag(XMLTags.META_DESCRIPTION)); String redirect = this.getMetaRedirect(); if ((redirect != null) && (redirect.length() > 0)) out.println(Utility.startTag(XMLTags.META_REDIRECT) + redirect + Utility.endTag(XMLTags.META_REDIRECT)); }
java
public void printXMLHeaderInfo(PrintWriter out, ResourceBundle reg) { String strTitle = this.getProperty("title"); // Menu page if ((strTitle == null) || (strTitle.length() == 0)) strTitle = ((BasePanel)this.getScreenField()).getTitle(); out.println(Utility.startTag(XMLTags.TITLE) + strTitle + Utility.endTag(XMLTags.TITLE)); String strKeywords = this.getKeywords(); if ((strKeywords != null) && (strKeywords.length() > 0)) out.println(Utility.startTag(XMLTags.META_KEYWORDS) + strKeywords + Utility.endTag(XMLTags.META_KEYWORDS)); String strDescription = strTitle; out.println(Utility.startTag(XMLTags.META_DESCRIPTION) + strDescription + Utility.endTag(XMLTags.META_DESCRIPTION)); String redirect = this.getMetaRedirect(); if ((redirect != null) && (redirect.length() > 0)) out.println(Utility.startTag(XMLTags.META_REDIRECT) + redirect + Utility.endTag(XMLTags.META_REDIRECT)); }
[ "public", "void", "printXMLHeaderInfo", "(", "PrintWriter", "out", ",", "ResourceBundle", "reg", ")", "{", "String", "strTitle", "=", "this", ".", "getProperty", "(", "\"title\"", ")", ";", "// Menu page", "if", "(", "(", "strTitle", "==", "null", ")", "||", "(", "strTitle", ".", "length", "(", ")", "==", "0", ")", ")", "strTitle", "=", "(", "(", "BasePanel", ")", "this", ".", "getScreenField", "(", ")", ")", ".", "getTitle", "(", ")", ";", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "TITLE", ")", "+", "strTitle", "+", "Utility", ".", "endTag", "(", "XMLTags", ".", "TITLE", ")", ")", ";", "String", "strKeywords", "=", "this", ".", "getKeywords", "(", ")", ";", "if", "(", "(", "strKeywords", "!=", "null", ")", "&&", "(", "strKeywords", ".", "length", "(", ")", ">", "0", ")", ")", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "META_KEYWORDS", ")", "+", "strKeywords", "+", "Utility", ".", "endTag", "(", "XMLTags", ".", "META_KEYWORDS", ")", ")", ";", "String", "strDescription", "=", "strTitle", ";", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "META_DESCRIPTION", ")", "+", "strDescription", "+", "Utility", ".", "endTag", "(", "XMLTags", ".", "META_DESCRIPTION", ")", ")", ";", "String", "redirect", "=", "this", ".", "getMetaRedirect", "(", ")", ";", "if", "(", "(", "redirect", "!=", "null", ")", "&&", "(", "redirect", ".", "length", "(", ")", ">", "0", ")", ")", "out", ".", "println", "(", "Utility", ".", "startTag", "(", "XMLTags", ".", "META_REDIRECT", ")", "+", "redirect", "+", "Utility", ".", "endTag", "(", "XMLTags", ".", "META_REDIRECT", ")", ")", ";", "}" ]
Print the header info, such as title, keywords and meta-desc. @param out The http output stream. @param reg Local resource bundle.
[ "Print", "the", "header", "info", "such", "as", "title", "keywords", "and", "meta", "-", "desc", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java#L225-L239
Netflix/ribbon
ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java
LoadBalancerContext.noteRequestCompletion
public void noteRequestCompletion(ServerStats stats, Object response, Throwable e, long responseTime, RetryHandler errorHandler) { """ This is called after a response is received or an exception is thrown from the client to update related stats. """ if (stats == null) { return; } try { recordStats(stats, responseTime); RetryHandler callErrorHandler = errorHandler == null ? getRetryHandler() : errorHandler; if (callErrorHandler != null && response != null) { stats.clearSuccessiveConnectionFailureCount(); } else if (callErrorHandler != null && e != null) { if (callErrorHandler.isCircuitTrippingException(e)) { stats.incrementSuccessiveConnectionFailureCount(); stats.addToFailureCount(); } else { stats.clearSuccessiveConnectionFailureCount(); } } } catch (Exception ex) { logger.error("Error noting stats for client {}", clientName, ex); } }
java
public void noteRequestCompletion(ServerStats stats, Object response, Throwable e, long responseTime, RetryHandler errorHandler) { if (stats == null) { return; } try { recordStats(stats, responseTime); RetryHandler callErrorHandler = errorHandler == null ? getRetryHandler() : errorHandler; if (callErrorHandler != null && response != null) { stats.clearSuccessiveConnectionFailureCount(); } else if (callErrorHandler != null && e != null) { if (callErrorHandler.isCircuitTrippingException(e)) { stats.incrementSuccessiveConnectionFailureCount(); stats.addToFailureCount(); } else { stats.clearSuccessiveConnectionFailureCount(); } } } catch (Exception ex) { logger.error("Error noting stats for client {}", clientName, ex); } }
[ "public", "void", "noteRequestCompletion", "(", "ServerStats", "stats", ",", "Object", "response", ",", "Throwable", "e", ",", "long", "responseTime", ",", "RetryHandler", "errorHandler", ")", "{", "if", "(", "stats", "==", "null", ")", "{", "return", ";", "}", "try", "{", "recordStats", "(", "stats", ",", "responseTime", ")", ";", "RetryHandler", "callErrorHandler", "=", "errorHandler", "==", "null", "?", "getRetryHandler", "(", ")", ":", "errorHandler", ";", "if", "(", "callErrorHandler", "!=", "null", "&&", "response", "!=", "null", ")", "{", "stats", ".", "clearSuccessiveConnectionFailureCount", "(", ")", ";", "}", "else", "if", "(", "callErrorHandler", "!=", "null", "&&", "e", "!=", "null", ")", "{", "if", "(", "callErrorHandler", ".", "isCircuitTrippingException", "(", "e", ")", ")", "{", "stats", ".", "incrementSuccessiveConnectionFailureCount", "(", ")", ";", "stats", ".", "addToFailureCount", "(", ")", ";", "}", "else", "{", "stats", ".", "clearSuccessiveConnectionFailureCount", "(", ")", ";", "}", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "logger", ".", "error", "(", "\"Error noting stats for client {}\"", ",", "clientName", ",", "ex", ")", ";", "}", "}" ]
This is called after a response is received or an exception is thrown from the client to update related stats.
[ "This", "is", "called", "after", "a", "response", "is", "received", "or", "an", "exception", "is", "thrown", "from", "the", "client", "to", "update", "related", "stats", "." ]
train
https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/LoadBalancerContext.java#L267-L287
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/BarcodePostnet.java
BarcodePostnet.getBarcodeSize
public Rectangle getBarcodeSize() { """ Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). @return the size the barcode occupies. """ float width = ((code.length() + 1) * 5 + 1) * n + x; return new Rectangle(width, barHeight); }
java
public Rectangle getBarcodeSize() { float width = ((code.length() + 1) * 5 + 1) * n + x; return new Rectangle(width, barHeight); }
[ "public", "Rectangle", "getBarcodeSize", "(", ")", "{", "float", "width", "=", "(", "(", "code", ".", "length", "(", ")", "+", "1", ")", "*", "5", "+", "1", ")", "*", "n", "+", "x", ";", "return", "new", "Rectangle", "(", "width", ",", "barHeight", ")", ";", "}" ]
Gets the maximum area that the barcode and the text, if any, will occupy. The lower left corner is always (0, 0). @return the size the barcode occupies.
[ "Gets", "the", "maximum", "area", "that", "the", "barcode", "and", "the", "text", "if", "any", "will", "occupy", ".", "The", "lower", "left", "corner", "is", "always", "(", "0", "0", ")", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BarcodePostnet.java#L118-L121
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java
EJSWrapperCommon.getFieldValue
private static Object getFieldValue(FieldClassValue fieldClassValue, Object obj) { """ Get the value of a field from an object. @param fieldClassValue the Field class value @param obj the object @return the field value """ try { return fieldClassValue.get(obj.getClass()).get(obj); } catch (IllegalAccessException e) { // FieldClassValueFactory returns ClassValue that make the Field // accessible, so this should not happen. throw new IllegalStateException(e); } }
java
private static Object getFieldValue(FieldClassValue fieldClassValue, Object obj) { try { return fieldClassValue.get(obj.getClass()).get(obj); } catch (IllegalAccessException e) { // FieldClassValueFactory returns ClassValue that make the Field // accessible, so this should not happen. throw new IllegalStateException(e); } }
[ "private", "static", "Object", "getFieldValue", "(", "FieldClassValue", "fieldClassValue", ",", "Object", "obj", ")", "{", "try", "{", "return", "fieldClassValue", ".", "get", "(", "obj", ".", "getClass", "(", ")", ")", ".", "get", "(", "obj", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "// FieldClassValueFactory returns ClassValue that make the Field", "// accessible, so this should not happen.", "throw", "new", "IllegalStateException", "(", "e", ")", ";", "}", "}" ]
Get the value of a field from an object. @param fieldClassValue the Field class value @param obj the object @return the field value
[ "Get", "the", "value", "of", "a", "field", "from", "an", "object", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSWrapperCommon.java#L468-L476
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/Stream.java
Stream.mapToInt
@NotNull public IntStream mapToInt(@NotNull final ToIntFunction<? super T> mapper) { """ Returns {@code IntStream} with elements that obtained by applying the given function. <p>This is an intermediate operation. @param mapper the mapper function used to apply to each element @return the new {@code IntStream} @see #map(com.annimon.stream.function.Function) """ return new IntStream(params, new ObjMapToInt<T>(iterator, mapper)); }
java
@NotNull public IntStream mapToInt(@NotNull final ToIntFunction<? super T> mapper) { return new IntStream(params, new ObjMapToInt<T>(iterator, mapper)); }
[ "@", "NotNull", "public", "IntStream", "mapToInt", "(", "@", "NotNull", "final", "ToIntFunction", "<", "?", "super", "T", ">", "mapper", ")", "{", "return", "new", "IntStream", "(", "params", ",", "new", "ObjMapToInt", "<", "T", ">", "(", "iterator", ",", "mapper", ")", ")", ";", "}" ]
Returns {@code IntStream} with elements that obtained by applying the given function. <p>This is an intermediate operation. @param mapper the mapper function used to apply to each element @return the new {@code IntStream} @see #map(com.annimon.stream.function.Function)
[ "Returns", "{", "@code", "IntStream", "}", "with", "elements", "that", "obtained", "by", "applying", "the", "given", "function", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Stream.java#L811-L814
uaihebert/uaiMockServer
src/main/java/com/uaihebert/uaimockserver/validator/body/XmlUnitWrapper.java
XmlUnitWrapper.isIdentical
public static boolean isIdentical(final String expected, final String actual) { """ This method will compare both XMLs and validate its attribute order. @param expected what are we expecting @param actual what we receive @return if they have same value and child order """ final Diff diff = createDiffResult(expected, actual, false); return diff.identical(); }
java
public static boolean isIdentical(final String expected, final String actual) { final Diff diff = createDiffResult(expected, actual, false); return diff.identical(); }
[ "public", "static", "boolean", "isIdentical", "(", "final", "String", "expected", ",", "final", "String", "actual", ")", "{", "final", "Diff", "diff", "=", "createDiffResult", "(", "expected", ",", "actual", ",", "false", ")", ";", "return", "diff", ".", "identical", "(", ")", ";", "}" ]
This method will compare both XMLs and validate its attribute order. @param expected what are we expecting @param actual what we receive @return if they have same value and child order
[ "This", "method", "will", "compare", "both", "XMLs", "and", "validate", "its", "attribute", "order", "." ]
train
https://github.com/uaihebert/uaiMockServer/blob/8b0090d4018c2f430cfbbb3ae249347652802f2b/src/main/java/com/uaihebert/uaimockserver/validator/body/XmlUnitWrapper.java#L33-L37
JOML-CI/JOML
src/org/joml/Matrix3x2d.java
Matrix3x2d.scale
public Matrix3x2d scale(Vector2fc xy, Matrix3x2d dest) { """ Apply scaling to this matrix by scaling the base axes by the given <code>xy</code> factors and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix, then the new matrix will be <code>M * S</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the scaling will be applied first! @param xy the factors of the x and y component, respectively @param dest will hold the result @return dest """ return scale(xy.x(), xy.y(), dest); }
java
public Matrix3x2d scale(Vector2fc xy, Matrix3x2d dest) { return scale(xy.x(), xy.y(), dest); }
[ "public", "Matrix3x2d", "scale", "(", "Vector2fc", "xy", ",", "Matrix3x2d", "dest", ")", "{", "return", "scale", "(", "xy", ".", "x", "(", ")", ",", "xy", ".", "y", "(", ")", ",", "dest", ")", ";", "}" ]
Apply scaling to this matrix by scaling the base axes by the given <code>xy</code> factors and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix, then the new matrix will be <code>M * S</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the scaling will be applied first! @param xy the factors of the x and y component, respectively @param dest will hold the result @return dest
[ "Apply", "scaling", "to", "this", "matrix", "by", "scaling", "the", "base", "axes", "by", "the", "given", "<code", ">", "xy<", "/", "code", ">", "factors", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "S<", "/", "code", ">", "the", "scaling", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "S<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "S", "*", "v<", "/", "code", ">", "the", "scaling", "will", "be", "applied", "first!" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L1313-L1315
Stratio/bdt
src/main/java/com/stratio/qa/specs/SeleniumSpec.java
SeleniumSpec.saveContentWebElementInEnvVar
@Then("^I save content of element in index '(\\d+?)' in environment variable '(.+?)'$") public void saveContentWebElementInEnvVar(Integer index, String envVar) { """ Takes the content of a webElement and stores it in the thread environment variable passed as parameter @param index position of the element in the array of webElements found @param envVar name of the thread environment variable where to store the text """ assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required") .hasAtLeast(index); String text = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getText(); ThreadProperty.set(envVar, text); }
java
@Then("^I save content of element in index '(\\d+?)' in environment variable '(.+?)'$") public void saveContentWebElementInEnvVar(Integer index, String envVar) { assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required") .hasAtLeast(index); String text = commonspec.getPreviousWebElements().getPreviousWebElements().get(index).getText(); ThreadProperty.set(envVar, text); }
[ "@", "Then", "(", "\"^I save content of element in index '(\\\\d+?)' in environment variable '(.+?)'$\"", ")", "public", "void", "saveContentWebElementInEnvVar", "(", "Integer", "index", ",", "String", "envVar", ")", "{", "assertThat", "(", "this", ".", "commonspec", ",", "commonspec", ".", "getPreviousWebElements", "(", ")", ")", ".", "as", "(", "\"There are less found elements than required\"", ")", ".", "hasAtLeast", "(", "index", ")", ";", "String", "text", "=", "commonspec", ".", "getPreviousWebElements", "(", ")", ".", "getPreviousWebElements", "(", ")", ".", "get", "(", "index", ")", ".", "getText", "(", ")", ";", "ThreadProperty", ".", "set", "(", "envVar", ",", "text", ")", ";", "}" ]
Takes the content of a webElement and stores it in the thread environment variable passed as parameter @param index position of the element in the array of webElements found @param envVar name of the thread environment variable where to store the text
[ "Takes", "the", "content", "of", "a", "webElement", "and", "stores", "it", "in", "the", "thread", "environment", "variable", "passed", "as", "parameter" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/SeleniumSpec.java#L640-L646
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/BooleanUtils.java
BooleanUtils.toIntegerObject
public static Integer toIntegerObject(final Boolean bool, final Integer trueValue, final Integer falseValue, final Integer nullValue) { """ <p>Converts a Boolean to an Integer specifying the conversion values.</p> <pre> BooleanUtils.toIntegerObject(Boolean.TRUE, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(1) BooleanUtils.toIntegerObject(Boolean.FALSE, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(0) BooleanUtils.toIntegerObject(null, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(2) </pre> @param bool the Boolean to convert @param trueValue the value to return if {@code true}, may be {@code null} @param falseValue the value to return if {@code false}, may be {@code null} @param nullValue the value to return if {@code null}, may be {@code null} @return the appropriate value """ if (bool == null) { return nullValue; } return bool.booleanValue() ? trueValue : falseValue; }
java
public static Integer toIntegerObject(final Boolean bool, final Integer trueValue, final Integer falseValue, final Integer nullValue) { if (bool == null) { return nullValue; } return bool.booleanValue() ? trueValue : falseValue; }
[ "public", "static", "Integer", "toIntegerObject", "(", "final", "Boolean", "bool", ",", "final", "Integer", "trueValue", ",", "final", "Integer", "falseValue", ",", "final", "Integer", "nullValue", ")", "{", "if", "(", "bool", "==", "null", ")", "{", "return", "nullValue", ";", "}", "return", "bool", ".", "booleanValue", "(", ")", "?", "trueValue", ":", "falseValue", ";", "}" ]
<p>Converts a Boolean to an Integer specifying the conversion values.</p> <pre> BooleanUtils.toIntegerObject(Boolean.TRUE, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(1) BooleanUtils.toIntegerObject(Boolean.FALSE, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(0) BooleanUtils.toIntegerObject(null, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(2) </pre> @param bool the Boolean to convert @param trueValue the value to return if {@code true}, may be {@code null} @param falseValue the value to return if {@code false}, may be {@code null} @param nullValue the value to return if {@code null}, may be {@code null} @return the appropriate value
[ "<p", ">", "Converts", "a", "Boolean", "to", "an", "Integer", "specifying", "the", "conversion", "values", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/BooleanUtils.java#L503-L508
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.listFromJobScheduleNextWithServiceResponseAsync
public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> listFromJobScheduleNextWithServiceResponseAsync(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions) { """ Lists the jobs that have been created under the specified job schedule. @param nextPageLink The NextLink from the previous successful call to List operation. @param jobListFromJobScheduleNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;CloudJob&gt; object """ return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> call(ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listFromJobScheduleNextWithServiceResponseAsync(nextPageLink, jobListFromJobScheduleNextOptions)); } }); }
java
public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> listFromJobScheduleNextWithServiceResponseAsync(final String nextPageLink, final JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions) { return listFromJobScheduleNextSinglePageAsync(nextPageLink, jobListFromJobScheduleNextOptions) .concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> call(ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listFromJobScheduleNextWithServiceResponseAsync(nextPageLink, jobListFromJobScheduleNextOptions)); } }); }
[ "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJob", ">", ",", "JobListFromJobScheduleHeaders", ">", ">", "listFromJobScheduleNextWithServiceResponseAsync", "(", "final", "String", "nextPageLink", ",", "final", "JobListFromJobScheduleNextOptions", "jobListFromJobScheduleNextOptions", ")", "{", "return", "listFromJobScheduleNextSinglePageAsync", "(", "nextPageLink", ",", "jobListFromJobScheduleNextOptions", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJob", ">", ",", "JobListFromJobScheduleHeaders", ">", ",", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJob", ">", ",", "JobListFromJobScheduleHeaders", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJob", ">", ",", "JobListFromJobScheduleHeaders", ">", ">", "call", "(", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJob", ">", ",", "JobListFromJobScheduleHeaders", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listFromJobScheduleNextWithServiceResponseAsync", "(", "nextPageLink", ",", "jobListFromJobScheduleNextOptions", ")", ")", ";", "}", "}", ")", ";", "}" ]
Lists the jobs that have been created under the specified job schedule. @param nextPageLink The NextLink from the previous successful call to List operation. @param jobListFromJobScheduleNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;CloudJob&gt; object
[ "Lists", "the", "jobs", "that", "have", "been", "created", "under", "the", "specified", "job", "schedule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L3730-L3742
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.setBody
@Override protected void setBody(JvmExecutable executable, XExpression expression) { """ {@inheritDoc}. <p>Overridden for: removing the existing associated body, and delaying the local type inference. """ final GenerationContext context = getContext( EcoreUtil2.getContainerOfType(executable, JvmType.class)); this.typeBuilder.removeExistingBody(executable); this.associator.associateLogicalContainer(expression, executable); if (expression != null) { if (context.getParentContext() == null) { context.getPostFinalizationElements().add(() -> { initializeLocalTypes(context, executable, expression); }); } else { initializeLocalTypes(context, executable, expression); } } else { initializeLocalTypes(context, executable, expression); } }
java
@Override protected void setBody(JvmExecutable executable, XExpression expression) { final GenerationContext context = getContext( EcoreUtil2.getContainerOfType(executable, JvmType.class)); this.typeBuilder.removeExistingBody(executable); this.associator.associateLogicalContainer(expression, executable); if (expression != null) { if (context.getParentContext() == null) { context.getPostFinalizationElements().add(() -> { initializeLocalTypes(context, executable, expression); }); } else { initializeLocalTypes(context, executable, expression); } } else { initializeLocalTypes(context, executable, expression); } }
[ "@", "Override", "protected", "void", "setBody", "(", "JvmExecutable", "executable", ",", "XExpression", "expression", ")", "{", "final", "GenerationContext", "context", "=", "getContext", "(", "EcoreUtil2", ".", "getContainerOfType", "(", "executable", ",", "JvmType", ".", "class", ")", ")", ";", "this", ".", "typeBuilder", ".", "removeExistingBody", "(", "executable", ")", ";", "this", ".", "associator", ".", "associateLogicalContainer", "(", "expression", ",", "executable", ")", ";", "if", "(", "expression", "!=", "null", ")", "{", "if", "(", "context", ".", "getParentContext", "(", ")", "==", "null", ")", "{", "context", ".", "getPostFinalizationElements", "(", ")", ".", "add", "(", "(", ")", "->", "{", "initializeLocalTypes", "(", "context", ",", "executable", ",", "expression", ")", ";", "}", ")", ";", "}", "else", "{", "initializeLocalTypes", "(", "context", ",", "executable", ",", "expression", ")", ";", "}", "}", "else", "{", "initializeLocalTypes", "(", "context", ",", "executable", ",", "expression", ")", ";", "}", "}" ]
{@inheritDoc}. <p>Overridden for: removing the existing associated body, and delaying the local type inference.
[ "{", "@inheritDoc", "}", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L477-L494
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java
SvgGraphicsContext.drawPolygon
public void drawPolygon(Object parent, String name, Polygon polygon, ShapeStyle style) { """ Draw a {@link Polygon} geometry onto the <code>GraphicsContext</code>. @param parent parent group object @param name The Polygon's name. @param polygon The Polygon to be drawn. @param style The styling object for the Polygon. """ if (isAttached()) { Element element = helper.createOrUpdateElement(parent, name, "path", style); if (polygon != null) { Dom.setElementAttribute(element, "d", SvgPathDecoder.decode(polygon)); Dom.setElementAttribute(element, "fill-rule", "evenodd"); } } }
java
public void drawPolygon(Object parent, String name, Polygon polygon, ShapeStyle style) { if (isAttached()) { Element element = helper.createOrUpdateElement(parent, name, "path", style); if (polygon != null) { Dom.setElementAttribute(element, "d", SvgPathDecoder.decode(polygon)); Dom.setElementAttribute(element, "fill-rule", "evenodd"); } } }
[ "public", "void", "drawPolygon", "(", "Object", "parent", ",", "String", "name", ",", "Polygon", "polygon", ",", "ShapeStyle", "style", ")", "{", "if", "(", "isAttached", "(", ")", ")", "{", "Element", "element", "=", "helper", ".", "createOrUpdateElement", "(", "parent", ",", "name", ",", "\"path\"", ",", "style", ")", ";", "if", "(", "polygon", "!=", "null", ")", "{", "Dom", ".", "setElementAttribute", "(", "element", ",", "\"d\"", ",", "SvgPathDecoder", ".", "decode", "(", "polygon", ")", ")", ";", "Dom", ".", "setElementAttribute", "(", "element", ",", "\"fill-rule\"", ",", "\"evenodd\"", ")", ";", "}", "}", "}" ]
Draw a {@link Polygon} geometry onto the <code>GraphicsContext</code>. @param parent parent group object @param name The Polygon's name. @param polygon The Polygon to be drawn. @param style The styling object for the Polygon.
[ "Draw", "a", "{", "@link", "Polygon", "}", "geometry", "onto", "the", "<code", ">", "GraphicsContext<", "/", "code", ">", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L316-L324
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/security/CredentialReference.java
CredentialReference.credentialReferencePartAsStringIfDefined
public static String credentialReferencePartAsStringIfDefined(ModelNode credentialReferenceValue, String name) throws OperationFailedException { """ Utility method to return part of {@link ObjectTypeAttributeDefinition} for credential reference attribute. {@see CredentialReference#getAttributeDefinition} @param credentialReferenceValue value of credential reference attribute @param name name of part to return (supported names: {@link #STORE} {@link #ALIAS} {@link #TYPE} {@link #CLEAR_TEXT} @return value of part as {@link String} @throws OperationFailedException when something goes wrong """ assert credentialReferenceValue.isDefined() : credentialReferenceValue; ModelNode result = credentialReferenceValue.get(name); if (result.isDefined()) { return result.asString(); } return null; }
java
public static String credentialReferencePartAsStringIfDefined(ModelNode credentialReferenceValue, String name) throws OperationFailedException { assert credentialReferenceValue.isDefined() : credentialReferenceValue; ModelNode result = credentialReferenceValue.get(name); if (result.isDefined()) { return result.asString(); } return null; }
[ "public", "static", "String", "credentialReferencePartAsStringIfDefined", "(", "ModelNode", "credentialReferenceValue", ",", "String", "name", ")", "throws", "OperationFailedException", "{", "assert", "credentialReferenceValue", ".", "isDefined", "(", ")", ":", "credentialReferenceValue", ";", "ModelNode", "result", "=", "credentialReferenceValue", ".", "get", "(", "name", ")", ";", "if", "(", "result", ".", "isDefined", "(", ")", ")", "{", "return", "result", ".", "asString", "(", ")", ";", "}", "return", "null", ";", "}" ]
Utility method to return part of {@link ObjectTypeAttributeDefinition} for credential reference attribute. {@see CredentialReference#getAttributeDefinition} @param credentialReferenceValue value of credential reference attribute @param name name of part to return (supported names: {@link #STORE} {@link #ALIAS} {@link #TYPE} {@link #CLEAR_TEXT} @return value of part as {@link String} @throws OperationFailedException when something goes wrong
[ "Utility", "method", "to", "return", "part", "of", "{", "@link", "ObjectTypeAttributeDefinition", "}", "for", "credential", "reference", "attribute", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/security/CredentialReference.java#L275-L282
zxing/zxing
core/src/main/java/com/google/zxing/oned/ITFReader.java
ITFReader.decodeEnd
private int[] decodeEnd(BitArray row) throws NotFoundException { """ Identify where the end of the middle / payload section ends. @param row row of black/white values to search @return Array, containing index of start of 'end block' and end of 'end block' """ // For convenience, reverse the row and then // search from 'the start' for the end block row.reverse(); try { int endStart = skipWhiteSpace(row); int[] endPattern; try { endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED[0]); } catch (NotFoundException nfe) { endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED[1]); } // The start & end patterns must be pre/post fixed by a quiet zone. This // zone must be at least 10 times the width of a narrow line. // ref: http://www.barcode-1.net/i25code.html validateQuietZone(row, endPattern[0]); // Now recalculate the indices of where the 'endblock' starts & stops to // accommodate // the reversed nature of the search int temp = endPattern[0]; endPattern[0] = row.getSize() - endPattern[1]; endPattern[1] = row.getSize() - temp; return endPattern; } finally { // Put the row back the right way. row.reverse(); } }
java
private int[] decodeEnd(BitArray row) throws NotFoundException { // For convenience, reverse the row and then // search from 'the start' for the end block row.reverse(); try { int endStart = skipWhiteSpace(row); int[] endPattern; try { endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED[0]); } catch (NotFoundException nfe) { endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED[1]); } // The start & end patterns must be pre/post fixed by a quiet zone. This // zone must be at least 10 times the width of a narrow line. // ref: http://www.barcode-1.net/i25code.html validateQuietZone(row, endPattern[0]); // Now recalculate the indices of where the 'endblock' starts & stops to // accommodate // the reversed nature of the search int temp = endPattern[0]; endPattern[0] = row.getSize() - endPattern[1]; endPattern[1] = row.getSize() - temp; return endPattern; } finally { // Put the row back the right way. row.reverse(); } }
[ "private", "int", "[", "]", "decodeEnd", "(", "BitArray", "row", ")", "throws", "NotFoundException", "{", "// For convenience, reverse the row and then", "// search from 'the start' for the end block", "row", ".", "reverse", "(", ")", ";", "try", "{", "int", "endStart", "=", "skipWhiteSpace", "(", "row", ")", ";", "int", "[", "]", "endPattern", ";", "try", "{", "endPattern", "=", "findGuardPattern", "(", "row", ",", "endStart", ",", "END_PATTERN_REVERSED", "[", "0", "]", ")", ";", "}", "catch", "(", "NotFoundException", "nfe", ")", "{", "endPattern", "=", "findGuardPattern", "(", "row", ",", "endStart", ",", "END_PATTERN_REVERSED", "[", "1", "]", ")", ";", "}", "// The start & end patterns must be pre/post fixed by a quiet zone. This", "// zone must be at least 10 times the width of a narrow line.", "// ref: http://www.barcode-1.net/i25code.html", "validateQuietZone", "(", "row", ",", "endPattern", "[", "0", "]", ")", ";", "// Now recalculate the indices of where the 'endblock' starts & stops to", "// accommodate", "// the reversed nature of the search", "int", "temp", "=", "endPattern", "[", "0", "]", ";", "endPattern", "[", "0", "]", "=", "row", ".", "getSize", "(", ")", "-", "endPattern", "[", "1", "]", ";", "endPattern", "[", "1", "]", "=", "row", ".", "getSize", "(", ")", "-", "temp", ";", "return", "endPattern", ";", "}", "finally", "{", "// Put the row back the right way.", "row", ".", "reverse", "(", ")", ";", "}", "}" ]
Identify where the end of the middle / payload section ends. @param row row of black/white values to search @return Array, containing index of start of 'end block' and end of 'end block'
[ "Identify", "where", "the", "end", "of", "the", "middle", "/", "payload", "section", "ends", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/oned/ITFReader.java#L271-L302
apache/incubator-shardingsphere
sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/GeneratedKey.java
GeneratedKey.getGenerateKey
public static Optional<GeneratedKey> getGenerateKey(final ShardingRule shardingRule, final List<Object> parameters, final InsertStatement insertStatement) { """ Get generate key. @param shardingRule sharding rule @param parameters SQL parameters @param insertStatement insert statement @return generate key """ Optional<String> generateKeyColumnName = shardingRule.findGenerateKeyColumnName(insertStatement.getTables().getSingleTableName()); if (!generateKeyColumnName.isPresent()) { return Optional.absent(); } return isContainsGenerateKeyColumn(insertStatement, generateKeyColumnName.get()) ? findGeneratedKey(parameters, insertStatement, generateKeyColumnName.get()) : Optional.of(createGeneratedKey(shardingRule, insertStatement, generateKeyColumnName.get())); }
java
public static Optional<GeneratedKey> getGenerateKey(final ShardingRule shardingRule, final List<Object> parameters, final InsertStatement insertStatement) { Optional<String> generateKeyColumnName = shardingRule.findGenerateKeyColumnName(insertStatement.getTables().getSingleTableName()); if (!generateKeyColumnName.isPresent()) { return Optional.absent(); } return isContainsGenerateKeyColumn(insertStatement, generateKeyColumnName.get()) ? findGeneratedKey(parameters, insertStatement, generateKeyColumnName.get()) : Optional.of(createGeneratedKey(shardingRule, insertStatement, generateKeyColumnName.get())); }
[ "public", "static", "Optional", "<", "GeneratedKey", ">", "getGenerateKey", "(", "final", "ShardingRule", "shardingRule", ",", "final", "List", "<", "Object", ">", "parameters", ",", "final", "InsertStatement", "insertStatement", ")", "{", "Optional", "<", "String", ">", "generateKeyColumnName", "=", "shardingRule", ".", "findGenerateKeyColumnName", "(", "insertStatement", ".", "getTables", "(", ")", ".", "getSingleTableName", "(", ")", ")", ";", "if", "(", "!", "generateKeyColumnName", ".", "isPresent", "(", ")", ")", "{", "return", "Optional", ".", "absent", "(", ")", ";", "}", "return", "isContainsGenerateKeyColumn", "(", "insertStatement", ",", "generateKeyColumnName", ".", "get", "(", ")", ")", "?", "findGeneratedKey", "(", "parameters", ",", "insertStatement", ",", "generateKeyColumnName", ".", "get", "(", ")", ")", ":", "Optional", ".", "of", "(", "createGeneratedKey", "(", "shardingRule", ",", "insertStatement", ",", "generateKeyColumnName", ".", "get", "(", ")", ")", ")", ";", "}" ]
Get generate key. @param shardingRule sharding rule @param parameters SQL parameters @param insertStatement insert statement @return generate key
[ "Get", "generate", "key", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/GeneratedKey.java#L60-L67
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/SquareBase_to_FiducialDetector.java
SquareBase_to_FiducialDetector.getCenter
@Override public void getCenter(int which, Point2D_F64 location) { """ Return the intersection of two lines defined by opposing corners. This should also be the geometric center @param which Fiducial's index @param location (output) Storage for the transform. modified. """ Quadrilateral_F64 q = alg.getFound().get(which).distortedPixels; // compute intersection in undistorted pixels so that the intersection is the true // geometric center of the square. Since distorted pixels are being used this will only be approximate UtilLine2D_F64.convert(q.a, q.c,line02); UtilLine2D_F64.convert(q.b, q.d,line13); Intersection2D_F64.intersection(line02,line13,location); }
java
@Override public void getCenter(int which, Point2D_F64 location) { Quadrilateral_F64 q = alg.getFound().get(which).distortedPixels; // compute intersection in undistorted pixels so that the intersection is the true // geometric center of the square. Since distorted pixels are being used this will only be approximate UtilLine2D_F64.convert(q.a, q.c,line02); UtilLine2D_F64.convert(q.b, q.d,line13); Intersection2D_F64.intersection(line02,line13,location); }
[ "@", "Override", "public", "void", "getCenter", "(", "int", "which", ",", "Point2D_F64", "location", ")", "{", "Quadrilateral_F64", "q", "=", "alg", ".", "getFound", "(", ")", ".", "get", "(", "which", ")", ".", "distortedPixels", ";", "// compute intersection in undistorted pixels so that the intersection is the true", "// geometric center of the square. Since distorted pixels are being used this will only be approximate", "UtilLine2D_F64", ".", "convert", "(", "q", ".", "a", ",", "q", ".", "c", ",", "line02", ")", ";", "UtilLine2D_F64", ".", "convert", "(", "q", ".", "b", ",", "q", ".", "d", ",", "line13", ")", ";", "Intersection2D_F64", ".", "intersection", "(", "line02", ",", "line13", ",", "location", ")", ";", "}" ]
Return the intersection of two lines defined by opposing corners. This should also be the geometric center @param which Fiducial's index @param location (output) Storage for the transform. modified.
[ "Return", "the", "intersection", "of", "two", "lines", "defined", "by", "opposing", "corners", ".", "This", "should", "also", "be", "the", "geometric", "center" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/SquareBase_to_FiducialDetector.java#L91-L101
ragnor/simple-spring-memcached
simple-spring-memcached/src/main/java/com/google/code/ssm/aop/support/CacheKeyBuilderImpl.java
CacheKeyBuilderImpl.getCacheKey
@Override public String getCacheKey(final Object keyObject, final String namespace) { """ Builds cache key from one key object. @param keyObject @param namespace @return cache key (with namespace) """ return namespace + SEPARATOR + defaultKeyProvider.generateKey(keyObject); }
java
@Override public String getCacheKey(final Object keyObject, final String namespace) { return namespace + SEPARATOR + defaultKeyProvider.generateKey(keyObject); }
[ "@", "Override", "public", "String", "getCacheKey", "(", "final", "Object", "keyObject", ",", "final", "String", "namespace", ")", "{", "return", "namespace", "+", "SEPARATOR", "+", "defaultKeyProvider", ".", "generateKey", "(", "keyObject", ")", ";", "}" ]
Builds cache key from one key object. @param keyObject @param namespace @return cache key (with namespace)
[ "Builds", "cache", "key", "from", "one", "key", "object", "." ]
train
https://github.com/ragnor/simple-spring-memcached/blob/83db68aa1af219397e132426e377d45f397d31e7/simple-spring-memcached/src/main/java/com/google/code/ssm/aop/support/CacheKeyBuilderImpl.java#L61-L64
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java
CPDefinitionLinkPersistenceImpl.removeByUUID_G
@Override public CPDefinitionLink removeByUUID_G(String uuid, long groupId) throws NoSuchCPDefinitionLinkException { """ Removes the cp definition link where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the cp definition link that was removed """ CPDefinitionLink cpDefinitionLink = findByUUID_G(uuid, groupId); return remove(cpDefinitionLink); }
java
@Override public CPDefinitionLink removeByUUID_G(String uuid, long groupId) throws NoSuchCPDefinitionLinkException { CPDefinitionLink cpDefinitionLink = findByUUID_G(uuid, groupId); return remove(cpDefinitionLink); }
[ "@", "Override", "public", "CPDefinitionLink", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCPDefinitionLinkException", "{", "CPDefinitionLink", "cpDefinitionLink", "=", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "return", "remove", "(", "cpDefinitionLink", ")", ";", "}" ]
Removes the cp definition link where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the cp definition link that was removed
[ "Removes", "the", "cp", "definition", "link", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L812-L818
Erudika/para
para-core/src/main/java/com/erudika/para/core/App.java
App.addSetting
public App addSetting(String name, Object value) { """ Adds a new setting to the map. @param name a key @param value a value @return this """ if (!StringUtils.isBlank(name) && value != null) { getSettings().put(name, value); for (AppSettingAddedListener listener : ADD_SETTING_LISTENERS) { listener.onSettingAdded(this, name, value); logger.debug("Executed {}.onSettingAdded().", listener.getClass().getName()); } } return this; }
java
public App addSetting(String name, Object value) { if (!StringUtils.isBlank(name) && value != null) { getSettings().put(name, value); for (AppSettingAddedListener listener : ADD_SETTING_LISTENERS) { listener.onSettingAdded(this, name, value); logger.debug("Executed {}.onSettingAdded().", listener.getClass().getName()); } } return this; }
[ "public", "App", "addSetting", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "!", "StringUtils", ".", "isBlank", "(", "name", ")", "&&", "value", "!=", "null", ")", "{", "getSettings", "(", ")", ".", "put", "(", "name", ",", "value", ")", ";", "for", "(", "AppSettingAddedListener", "listener", ":", "ADD_SETTING_LISTENERS", ")", "{", "listener", ".", "onSettingAdded", "(", "this", ",", "name", ",", "value", ")", ";", "logger", ".", "debug", "(", "\"Executed {}.onSettingAdded().\"", ",", "listener", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "}", "return", "this", ";", "}" ]
Adds a new setting to the map. @param name a key @param value a value @return this
[ "Adds", "a", "new", "setting", "to", "the", "map", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/App.java#L174-L183
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java
BaseMessagingEngineImpl.getSIBDestinationByUuid
BaseDestinationDefinition getSIBDestinationByUuid(String bus, String key, boolean newCache) throws SIBExceptionDestinationNotFound, SIBExceptionBase { """ Accessor method to return a destination definition. @param bus @param key @param newCache @return the destination cache """ String thisMethodName = "getSIBDestinationByUuid"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, new Object[] { bus, key, new Boolean(newCache) }); } BaseDestinationDefinition bdd = null; if (oldDestCache == null || newCache) { bdd = (BaseDestinationDefinition) _bus.getDestinationCache().getSIBDestinationByUuid(bus, key).clone(); } else { bdd = (BaseDestinationDefinition) oldDestCache.getSIBDestinationByUuid(bus, key).clone(); } // Resolve Exception Destination if necessary resolveExceptionDestination(bdd); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, bdd); } return bdd; }
java
BaseDestinationDefinition getSIBDestinationByUuid(String bus, String key, boolean newCache) throws SIBExceptionDestinationNotFound, SIBExceptionBase { String thisMethodName = "getSIBDestinationByUuid"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, thisMethodName, new Object[] { bus, key, new Boolean(newCache) }); } BaseDestinationDefinition bdd = null; if (oldDestCache == null || newCache) { bdd = (BaseDestinationDefinition) _bus.getDestinationCache().getSIBDestinationByUuid(bus, key).clone(); } else { bdd = (BaseDestinationDefinition) oldDestCache.getSIBDestinationByUuid(bus, key).clone(); } // Resolve Exception Destination if necessary resolveExceptionDestination(bdd); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, thisMethodName, bdd); } return bdd; }
[ "BaseDestinationDefinition", "getSIBDestinationByUuid", "(", "String", "bus", ",", "String", "key", ",", "boolean", "newCache", ")", "throws", "SIBExceptionDestinationNotFound", ",", "SIBExceptionBase", "{", "String", "thisMethodName", "=", "\"getSIBDestinationByUuid\"", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "entry", "(", "tc", ",", "thisMethodName", ",", "new", "Object", "[", "]", "{", "bus", ",", "key", ",", "new", "Boolean", "(", "newCache", ")", "}", ")", ";", "}", "BaseDestinationDefinition", "bdd", "=", "null", ";", "if", "(", "oldDestCache", "==", "null", "||", "newCache", ")", "{", "bdd", "=", "(", "BaseDestinationDefinition", ")", "_bus", ".", "getDestinationCache", "(", ")", ".", "getSIBDestinationByUuid", "(", "bus", ",", "key", ")", ".", "clone", "(", ")", ";", "}", "else", "{", "bdd", "=", "(", "BaseDestinationDefinition", ")", "oldDestCache", ".", "getSIBDestinationByUuid", "(", "bus", ",", "key", ")", ".", "clone", "(", ")", ";", "}", "// Resolve Exception Destination if necessary", "resolveExceptionDestination", "(", "bdd", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exit", "(", "tc", ",", "thisMethodName", ",", "bdd", ")", ";", "}", "return", "bdd", ";", "}" ]
Accessor method to return a destination definition. @param bus @param key @param newCache @return the destination cache
[ "Accessor", "method", "to", "return", "a", "destination", "definition", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/admin/internal/BaseMessagingEngineImpl.java#L1133-L1157
hawkular/hawkular-inventory
hawkular-inventory-security-parent/hawkular-inventory-security-accounts/src/main/java/org/hawkular/inventory/rest/security/accounts/SecurityIntegration.java
SecurityIntegration.establishOwner
private Persona establishOwner(org.hawkular.accounts.api.model.Resource resource, Persona current) { """ Establishes the owner. If the owner of the parent is the same as the current user, then create the resource as being owner-less, inheriting the owner from the parent. """ while (resource != null && resource.getPersona() == null) { resource = resource.getParent(); } if (resource != null && resource.getPersona().equals(current)) { current = null; } return current; }
java
private Persona establishOwner(org.hawkular.accounts.api.model.Resource resource, Persona current) { while (resource != null && resource.getPersona() == null) { resource = resource.getParent(); } if (resource != null && resource.getPersona().equals(current)) { current = null; } return current; }
[ "private", "Persona", "establishOwner", "(", "org", ".", "hawkular", ".", "accounts", ".", "api", ".", "model", ".", "Resource", "resource", ",", "Persona", "current", ")", "{", "while", "(", "resource", "!=", "null", "&&", "resource", ".", "getPersona", "(", ")", "==", "null", ")", "{", "resource", "=", "resource", ".", "getParent", "(", ")", ";", "}", "if", "(", "resource", "!=", "null", "&&", "resource", ".", "getPersona", "(", ")", ".", "equals", "(", "current", ")", ")", "{", "current", "=", "null", ";", "}", "return", "current", ";", "}" ]
Establishes the owner. If the owner of the parent is the same as the current user, then create the resource as being owner-less, inheriting the owner from the parent.
[ "Establishes", "the", "owner", ".", "If", "the", "owner", "of", "the", "parent", "is", "the", "same", "as", "the", "current", "user", "then", "create", "the", "resource", "as", "being", "owner", "-", "less", "inheriting", "the", "owner", "from", "the", "parent", "." ]
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-security-parent/hawkular-inventory-security-accounts/src/main/java/org/hawkular/inventory/rest/security/accounts/SecurityIntegration.java#L131-L141
spotify/ratatool
ratatool-sampling/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryServicesImpl.java
PatchedBigQueryServicesImpl.nextBackOff
private static boolean nextBackOff(Sleeper sleeper, BackOff backoff) throws InterruptedException { """ Identical to {@link BackOffUtils#next} but without checked IOException. """ try { return BackOffUtils.next(sleeper, backoff); } catch (IOException e) { throw new RuntimeException(e); } }
java
private static boolean nextBackOff(Sleeper sleeper, BackOff backoff) throws InterruptedException { try { return BackOffUtils.next(sleeper, backoff); } catch (IOException e) { throw new RuntimeException(e); } }
[ "private", "static", "boolean", "nextBackOff", "(", "Sleeper", "sleeper", ",", "BackOff", "backoff", ")", "throws", "InterruptedException", "{", "try", "{", "return", "BackOffUtils", ".", "next", "(", "sleeper", ",", "backoff", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Identical to {@link BackOffUtils#next} but without checked IOException.
[ "Identical", "to", "{" ]
train
https://github.com/spotify/ratatool/blob/e997df0bcd245a14d22a20e64b1fe8354ce7f225/ratatool-sampling/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/PatchedBigQueryServicesImpl.java#L937-L943
openbase/jul
pattern/default/src/main/java/org/openbase/jul/pattern/ObservableImpl.java
ObservableImpl.waitForValue
@Override public void waitForValue(final long timeout, final TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException { """ {@inheritDoc} @param timeout {@inheritDoc} @param timeUnit {@inheritDoc} @throws InterruptedException {@inheritDoc} @throws CouldNotPerformException {@inheritDoc} """ synchronized (VALUE_LOCK) { if (value != null) { return; } // if 0 wait forever like the default java wait() implementation. if (timeUnit.toMillis(timeout) == 0) { VALUE_LOCK.wait(); } else { timeUnit.timedWait(VALUE_LOCK, timeout); } if (value == null) { throw new NotAvailableException(Observable.class, new TimeoutException()); } } //waitUntilNotificationIsFinished(); }
java
@Override public void waitForValue(final long timeout, final TimeUnit timeUnit) throws CouldNotPerformException, InterruptedException { synchronized (VALUE_LOCK) { if (value != null) { return; } // if 0 wait forever like the default java wait() implementation. if (timeUnit.toMillis(timeout) == 0) { VALUE_LOCK.wait(); } else { timeUnit.timedWait(VALUE_LOCK, timeout); } if (value == null) { throw new NotAvailableException(Observable.class, new TimeoutException()); } } //waitUntilNotificationIsFinished(); }
[ "@", "Override", "public", "void", "waitForValue", "(", "final", "long", "timeout", ",", "final", "TimeUnit", "timeUnit", ")", "throws", "CouldNotPerformException", ",", "InterruptedException", "{", "synchronized", "(", "VALUE_LOCK", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "return", ";", "}", "// if 0 wait forever like the default java wait() implementation.", "if", "(", "timeUnit", ".", "toMillis", "(", "timeout", ")", "==", "0", ")", "{", "VALUE_LOCK", ".", "wait", "(", ")", ";", "}", "else", "{", "timeUnit", ".", "timedWait", "(", "VALUE_LOCK", ",", "timeout", ")", ";", "}", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "NotAvailableException", "(", "Observable", ".", "class", ",", "new", "TimeoutException", "(", ")", ")", ";", "}", "}", "//waitUntilNotificationIsFinished();", "}" ]
{@inheritDoc} @param timeout {@inheritDoc} @param timeUnit {@inheritDoc} @throws InterruptedException {@inheritDoc} @throws CouldNotPerformException {@inheritDoc}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/pattern/default/src/main/java/org/openbase/jul/pattern/ObservableImpl.java#L99-L117
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/DBObject.java
DBObject.addFieldValue
public void addFieldValue(String fieldName, String value) { """ Add the given value to the field with the given name. For a system field, its existing value, if any, is replaced. If a null or empty field is added for an SV scalar, the field is nullified. @param fieldName Name of a field. @param value Value to add to field. Ignored if null or empty. """ Utils.require(!Utils.isEmpty(fieldName), "fieldName"); if (fieldName.charAt(0) == '_') { setSystemField(fieldName, value); } else { List<String> currValues = m_valueMap.get(fieldName); if (currValues == null) { currValues = new ArrayList<>(); m_valueMap.put(fieldName, currValues); } currValues.add(value); } }
java
public void addFieldValue(String fieldName, String value) { Utils.require(!Utils.isEmpty(fieldName), "fieldName"); if (fieldName.charAt(0) == '_') { setSystemField(fieldName, value); } else { List<String> currValues = m_valueMap.get(fieldName); if (currValues == null) { currValues = new ArrayList<>(); m_valueMap.put(fieldName, currValues); } currValues.add(value); } }
[ "public", "void", "addFieldValue", "(", "String", "fieldName", ",", "String", "value", ")", "{", "Utils", ".", "require", "(", "!", "Utils", ".", "isEmpty", "(", "fieldName", ")", ",", "\"fieldName\"", ")", ";", "if", "(", "fieldName", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "setSystemField", "(", "fieldName", ",", "value", ")", ";", "}", "else", "{", "List", "<", "String", ">", "currValues", "=", "m_valueMap", ".", "get", "(", "fieldName", ")", ";", "if", "(", "currValues", "==", "null", ")", "{", "currValues", "=", "new", "ArrayList", "<>", "(", ")", ";", "m_valueMap", ".", "put", "(", "fieldName", ",", "currValues", ")", ";", "}", "currValues", ".", "add", "(", "value", ")", ";", "}", "}" ]
Add the given value to the field with the given name. For a system field, its existing value, if any, is replaced. If a null or empty field is added for an SV scalar, the field is nullified. @param fieldName Name of a field. @param value Value to add to field. Ignored if null or empty.
[ "Add", "the", "given", "value", "to", "the", "field", "with", "the", "given", "name", ".", "For", "a", "system", "field", "its", "existing", "value", "if", "any", "is", "replaced", ".", "If", "a", "null", "or", "empty", "field", "is", "added", "for", "an", "SV", "scalar", "the", "field", "is", "nullified", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/DBObject.java#L403-L416
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/GVRNewWrapperProvider.java
GVRNewWrapperProvider.wrapQuaternion
@Override public Quaternionf wrapQuaternion(ByteBuffer buffer, int offset) { """ Wraps a quaternion. <p> A quaternion consists of 4 float values (w,x,y,z) starting from offset @param buffer the buffer to wrap @param offset the offset into buffer @return the wrapped quaternion """ float w = buffer.getFloat(offset); float x = buffer.getFloat(offset + 4); float y = buffer.getFloat(offset + 8); float z = buffer.getFloat(offset + 12); return new Quaternionf(x, y, z, w); }
java
@Override public Quaternionf wrapQuaternion(ByteBuffer buffer, int offset) { float w = buffer.getFloat(offset); float x = buffer.getFloat(offset + 4); float y = buffer.getFloat(offset + 8); float z = buffer.getFloat(offset + 12); return new Quaternionf(x, y, z, w); }
[ "@", "Override", "public", "Quaternionf", "wrapQuaternion", "(", "ByteBuffer", "buffer", ",", "int", "offset", ")", "{", "float", "w", "=", "buffer", ".", "getFloat", "(", "offset", ")", ";", "float", "x", "=", "buffer", ".", "getFloat", "(", "offset", "+", "4", ")", ";", "float", "y", "=", "buffer", ".", "getFloat", "(", "offset", "+", "8", ")", ";", "float", "z", "=", "buffer", ".", "getFloat", "(", "offset", "+", "12", ")", ";", "return", "new", "Quaternionf", "(", "x", ",", "y", ",", "z", ",", "w", ")", ";", "}" ]
Wraps a quaternion. <p> A quaternion consists of 4 float values (w,x,y,z) starting from offset @param buffer the buffer to wrap @param offset the offset into buffer @return the wrapped quaternion
[ "Wraps", "a", "quaternion", ".", "<p", ">" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/GVRNewWrapperProvider.java#L59-L66
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.amean
public SDVariable amean(SDVariable in, int... dimensions) { """ Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x)) @param in Input variable @param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed @return Reduced array of rank (input rank - num dimensions) """ validateNumerical("amean", in); return amean(null, in, dimensions); }
java
public SDVariable amean(SDVariable in, int... dimensions) { validateNumerical("amean", in); return amean(null, in, dimensions); }
[ "public", "SDVariable", "amean", "(", "SDVariable", "in", ",", "int", "...", "dimensions", ")", "{", "validateNumerical", "(", "\"amean\"", ",", "in", ")", ";", "return", "amean", "(", "null", ",", "in", ",", "dimensions", ")", ";", "}" ]
Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x)) @param in Input variable @param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed @return Reduced array of rank (input rank - num dimensions)
[ "Absolute", "mean", "array", "reduction", "operation", "optionally", "along", "specified", "dimensions", ":", "out", "=", "mean", "(", "abs", "(", "x", "))" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L130-L133
Labs64/swid-generator
src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java
ExtendedSwidProcessor.setProductCategory
public ExtendedSwidProcessor setProductCategory(final String unspscVer, final String segmentTitle, final String familyTitle, final String classTitle, final String commodityTitle, final BigInteger code) { """ Defines product category (tag: product_category). @see <a href="http://en.wikipedia.org/wiki/UNSPSC">United Nations Standard Products and Services Code (UNSPSC)</a> for guidance. @param unspscVer UNSPSC version @param segmentTitle segment title @param familyTitle family title @param classTitle class title @param commodityTitle commodity title @param code UNSPSC code @return a reference to this object. """ final CategoryComplexType cct = new CategoryComplexType( new Token(unspscVer, idGenerator.nextId()), new Token(segmentTitle, idGenerator.nextId()), new Token(familyTitle, idGenerator.nextId()), new Token(classTitle, idGenerator.nextId()), new Token(commodityTitle, idGenerator.nextId()), new UnspscIdType(code, idGenerator.nextId()), idGenerator.nextId()); swidTag.setProductCategory(cct); return this; }
java
public ExtendedSwidProcessor setProductCategory(final String unspscVer, final String segmentTitle, final String familyTitle, final String classTitle, final String commodityTitle, final BigInteger code) { final CategoryComplexType cct = new CategoryComplexType( new Token(unspscVer, idGenerator.nextId()), new Token(segmentTitle, idGenerator.nextId()), new Token(familyTitle, idGenerator.nextId()), new Token(classTitle, idGenerator.nextId()), new Token(commodityTitle, idGenerator.nextId()), new UnspscIdType(code, idGenerator.nextId()), idGenerator.nextId()); swidTag.setProductCategory(cct); return this; }
[ "public", "ExtendedSwidProcessor", "setProductCategory", "(", "final", "String", "unspscVer", ",", "final", "String", "segmentTitle", ",", "final", "String", "familyTitle", ",", "final", "String", "classTitle", ",", "final", "String", "commodityTitle", ",", "final", "BigInteger", "code", ")", "{", "final", "CategoryComplexType", "cct", "=", "new", "CategoryComplexType", "(", "new", "Token", "(", "unspscVer", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "new", "Token", "(", "segmentTitle", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "new", "Token", "(", "familyTitle", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "new", "Token", "(", "classTitle", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "new", "Token", "(", "commodityTitle", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "new", "UnspscIdType", "(", "code", ",", "idGenerator", ".", "nextId", "(", ")", ")", ",", "idGenerator", ".", "nextId", "(", ")", ")", ";", "swidTag", ".", "setProductCategory", "(", "cct", ")", ";", "return", "this", ";", "}" ]
Defines product category (tag: product_category). @see <a href="http://en.wikipedia.org/wiki/UNSPSC">United Nations Standard Products and Services Code (UNSPSC)</a> for guidance. @param unspscVer UNSPSC version @param segmentTitle segment title @param familyTitle family title @param classTitle class title @param commodityTitle commodity title @param code UNSPSC code @return a reference to this object.
[ "Defines", "product", "category", "(", "tag", ":", "product_category", ")", "." ]
train
https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java#L142-L154
mikepenz/FastAdapter
library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java
FastAdapterDialog.withNegativeButton
public FastAdapterDialog<Item> withNegativeButton(String text, OnClickListener listener) { """ Set a listener to be invoked when the negative button of the dialog is pressed. @param text The text to display in the negative button @param listener The {@link DialogInterface.OnClickListener} to use. @return This Builder object to allow for chaining of calls to set methods """ return withButton(BUTTON_NEGATIVE, text, listener); }
java
public FastAdapterDialog<Item> withNegativeButton(String text, OnClickListener listener) { return withButton(BUTTON_NEGATIVE, text, listener); }
[ "public", "FastAdapterDialog", "<", "Item", ">", "withNegativeButton", "(", "String", "text", ",", "OnClickListener", "listener", ")", "{", "return", "withButton", "(", "BUTTON_NEGATIVE", ",", "text", ",", "listener", ")", ";", "}" ]
Set a listener to be invoked when the negative button of the dialog is pressed. @param text The text to display in the negative button @param listener The {@link DialogInterface.OnClickListener} to use. @return This Builder object to allow for chaining of calls to set methods
[ "Set", "a", "listener", "to", "be", "invoked", "when", "the", "negative", "button", "of", "the", "dialog", "is", "pressed", "." ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java#L153-L155