repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
protostuff/protostuff
protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java
MsgpackIOUtil.mergeFrom
public static <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema, boolean numeric) throws IOException { """ Merges the {@code message} with the byte array using the given {@code schema}. """ ArrayBufferInput bios = new ArrayBufferInput(data, offset, length); MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bios); try { mergeFrom(unpacker, message, schema, numeric); } finally { unpacker.close(); } }
java
public static <T> void mergeFrom(byte[] data, int offset, int length, T message, Schema<T> schema, boolean numeric) throws IOException { ArrayBufferInput bios = new ArrayBufferInput(data, offset, length); MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(bios); try { mergeFrom(unpacker, message, schema, numeric); } finally { unpacker.close(); } }
[ "public", "static", "<", "T", ">", "void", "mergeFrom", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "length", ",", "T", "message", ",", "Schema", "<", "T", ">", "schema", ",", "boolean", "numeric", ")", "throws", "IOException", "{", "ArrayBufferInput", "bios", "=", "new", "ArrayBufferInput", "(", "data", ",", "offset", ",", "length", ")", ";", "MessageUnpacker", "unpacker", "=", "MessagePack", ".", "newDefaultUnpacker", "(", "bios", ")", ";", "try", "{", "mergeFrom", "(", "unpacker", ",", "message", ",", "schema", ",", "numeric", ")", ";", "}", "finally", "{", "unpacker", ".", "close", "(", ")", ";", "}", "}" ]
Merges the {@code message} with the byte array using the given {@code schema}.
[ "Merges", "the", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java#L124-L140
mgledi/DRUMS
src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java
RangeHashFunction.searchBucketIndex
protected int searchBucketIndex(byte[] key, int leftIndex, int rightIndex) { """ Searches for the given <code>key</code> in {@link #maxRangeValues} and returns the index of the corresponding range. Remember: this may not be the bucketId """ if (KeyUtils.compareKey(key, maxRangeValues[rightIndex]) > 0) { return 0; } int idx = Arrays.binarySearch(maxRangeValues, leftIndex, rightIndex, key, new ByteArrayComparator()); idx = idx < 0 ? -idx - 1 : idx; if (idx > rightIndex) { return -1; } else { return idx; } }
java
protected int searchBucketIndex(byte[] key, int leftIndex, int rightIndex) { if (KeyUtils.compareKey(key, maxRangeValues[rightIndex]) > 0) { return 0; } int idx = Arrays.binarySearch(maxRangeValues, leftIndex, rightIndex, key, new ByteArrayComparator()); idx = idx < 0 ? -idx - 1 : idx; if (idx > rightIndex) { return -1; } else { return idx; } }
[ "protected", "int", "searchBucketIndex", "(", "byte", "[", "]", "key", ",", "int", "leftIndex", ",", "int", "rightIndex", ")", "{", "if", "(", "KeyUtils", ".", "compareKey", "(", "key", ",", "maxRangeValues", "[", "rightIndex", "]", ")", ">", "0", ")", "{", "return", "0", ";", "}", "int", "idx", "=", "Arrays", ".", "binarySearch", "(", "maxRangeValues", ",", "leftIndex", ",", "rightIndex", ",", "key", ",", "new", "ByteArrayComparator", "(", ")", ")", ";", "idx", "=", "idx", "<", "0", "?", "-", "idx", "-", "1", ":", "idx", ";", "if", "(", "idx", ">", "rightIndex", ")", "{", "return", "-", "1", ";", "}", "else", "{", "return", "idx", ";", "}", "}" ]
Searches for the given <code>key</code> in {@link #maxRangeValues} and returns the index of the corresponding range. Remember: this may not be the bucketId
[ "Searches", "for", "the", "given", "<code", ">", "key<", "/", "code", ">", "in", "{" ]
train
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/RangeHashFunction.java#L195-L206
podio/podio-java
src/main/java/com/podio/tag/TagAPI.java
TagAPI.createTags
public void createTags(Reference reference, Collection<String> tags) { """ Add a new set of tags to the object. If a tag with the same text is already present, the tag will be ignored. @param reference The object the tags should be added to @param tags The tags that should be added """ getResourceFactory() .getApiResource("/tag/" + reference.toURLFragment()) .entity(tags, MediaType.APPLICATION_JSON_TYPE).post(); }
java
public void createTags(Reference reference, Collection<String> tags) { getResourceFactory() .getApiResource("/tag/" + reference.toURLFragment()) .entity(tags, MediaType.APPLICATION_JSON_TYPE).post(); }
[ "public", "void", "createTags", "(", "Reference", "reference", ",", "Collection", "<", "String", ">", "tags", ")", "{", "getResourceFactory", "(", ")", ".", "getApiResource", "(", "\"/tag/\"", "+", "reference", ".", "toURLFragment", "(", ")", ")", ".", "entity", "(", "tags", ",", "MediaType", ".", "APPLICATION_JSON_TYPE", ")", ".", "post", "(", ")", ";", "}" ]
Add a new set of tags to the object. If a tag with the same text is already present, the tag will be ignored. @param reference The object the tags should be added to @param tags The tags that should be added
[ "Add", "a", "new", "set", "of", "tags", "to", "the", "object", ".", "If", "a", "tag", "with", "the", "same", "text", "is", "already", "present", "the", "tag", "will", "be", "ignored", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/tag/TagAPI.java#L38-L42
milaboratory/milib
src/main/java/com/milaboratory/core/mutations/MutationsUtil.java
MutationsUtil.shiftIndelsAtHomopolymers
public static <S extends Sequence<S>> Mutations<S> shiftIndelsAtHomopolymers(S seq1, Mutations<S> mutations) { """ This one shifts indels to the left at homopolymer regions Applicable to KAligner data, which normally put indels randomly along such regions Required for filterMutations algorithm to work correctly Works inplace @param seq1 reference sequence for the mutations @param mutations array of mutations """ return shiftIndelsAtHomopolymers(seq1, 0, mutations); }
java
public static <S extends Sequence<S>> Mutations<S> shiftIndelsAtHomopolymers(S seq1, Mutations<S> mutations) { return shiftIndelsAtHomopolymers(seq1, 0, mutations); }
[ "public", "static", "<", "S", "extends", "Sequence", "<", "S", ">", ">", "Mutations", "<", "S", ">", "shiftIndelsAtHomopolymers", "(", "S", "seq1", ",", "Mutations", "<", "S", ">", "mutations", ")", "{", "return", "shiftIndelsAtHomopolymers", "(", "seq1", ",", "0", ",", "mutations", ")", ";", "}" ]
This one shifts indels to the left at homopolymer regions Applicable to KAligner data, which normally put indels randomly along such regions Required for filterMutations algorithm to work correctly Works inplace @param seq1 reference sequence for the mutations @param mutations array of mutations
[ "This", "one", "shifts", "indels", "to", "the", "left", "at", "homopolymer", "regions", "Applicable", "to", "KAligner", "data", "which", "normally", "put", "indels", "randomly", "along", "such", "regions", "Required", "for", "filterMutations", "algorithm", "to", "work", "correctly", "Works", "inplace" ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/mutations/MutationsUtil.java#L99-L101
actframework/actframework
src/main/java/act/data/ApacheMultipartParser.java
ApacheMultipartParser.parseHeaderLine
private void parseHeaderLine(Map<String, String> headers, String header) { """ Reads the next header line. @param headers String with all headers. @param header Map where to store the current header. """ final int colonOffset = header.indexOf(':'); if (colonOffset == -1) { // This header line is malformed, skip it. return; } String headerName = header.substring(0, colonOffset).trim().toLowerCase(); String headerValue = header.substring(header.indexOf(':') + 1).trim(); if (getHeader(headers, headerName) != null) { // More that one heder of that name exists, // append to the list. headers.put(headerName, getHeader(headers, headerName) + ',' + headerValue); } else { headers.put(headerName, headerValue); } }
java
private void parseHeaderLine(Map<String, String> headers, String header) { final int colonOffset = header.indexOf(':'); if (colonOffset == -1) { // This header line is malformed, skip it. return; } String headerName = header.substring(0, colonOffset).trim().toLowerCase(); String headerValue = header.substring(header.indexOf(':') + 1).trim(); if (getHeader(headers, headerName) != null) { // More that one heder of that name exists, // append to the list. headers.put(headerName, getHeader(headers, headerName) + ',' + headerValue); } else { headers.put(headerName, headerValue); } }
[ "private", "void", "parseHeaderLine", "(", "Map", "<", "String", ",", "String", ">", "headers", ",", "String", "header", ")", "{", "final", "int", "colonOffset", "=", "header", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "colonOffset", "==", "-", "1", ")", "{", "// This header line is malformed, skip it.", "return", ";", "}", "String", "headerName", "=", "header", ".", "substring", "(", "0", ",", "colonOffset", ")", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ";", "String", "headerValue", "=", "header", ".", "substring", "(", "header", ".", "indexOf", "(", "'", "'", ")", "+", "1", ")", ".", "trim", "(", ")", ";", "if", "(", "getHeader", "(", "headers", ",", "headerName", ")", "!=", "null", ")", "{", "// More that one heder of that name exists,", "// append to the list.", "headers", ".", "put", "(", "headerName", ",", "getHeader", "(", "headers", ",", "headerName", ")", "+", "'", "'", "+", "headerValue", ")", ";", "}", "else", "{", "headers", ".", "put", "(", "headerName", ",", "headerValue", ")", ";", "}", "}" ]
Reads the next header line. @param headers String with all headers. @param header Map where to store the current header.
[ "Reads", "the", "next", "header", "line", "." ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/data/ApacheMultipartParser.java#L296-L311
jimmoores/quandl4j
core/src/main/java/com/jimmoores/quandl/SearchResult.java
SearchResult.getTotalDocuments
public int getTotalDocuments() { """ Get the total number of documents in this result set. Throws a QuandlRuntimeException if Quandl response doesn't contain this field, although it should. @return the total number of documents in this result set """ try { final int totalDocs = _jsonObject.getJSONObject(META_OBJECT_FIELD).getInt("total_count"); return totalDocs; } catch (JSONException ex) { throw new QuandlRuntimeException("Could not find total_count field in results from Quandl", ex); } }
java
public int getTotalDocuments() { try { final int totalDocs = _jsonObject.getJSONObject(META_OBJECT_FIELD).getInt("total_count"); return totalDocs; } catch (JSONException ex) { throw new QuandlRuntimeException("Could not find total_count field in results from Quandl", ex); } }
[ "public", "int", "getTotalDocuments", "(", ")", "{", "try", "{", "final", "int", "totalDocs", "=", "_jsonObject", ".", "getJSONObject", "(", "META_OBJECT_FIELD", ")", ".", "getInt", "(", "\"total_count\"", ")", ";", "return", "totalDocs", ";", "}", "catch", "(", "JSONException", "ex", ")", "{", "throw", "new", "QuandlRuntimeException", "(", "\"Could not find total_count field in results from Quandl\"", ",", "ex", ")", ";", "}", "}" ]
Get the total number of documents in this result set. Throws a QuandlRuntimeException if Quandl response doesn't contain this field, although it should. @return the total number of documents in this result set
[ "Get", "the", "total", "number", "of", "documents", "in", "this", "result", "set", ".", "Throws", "a", "QuandlRuntimeException", "if", "Quandl", "response", "doesn", "t", "contain", "this", "field", "although", "it", "should", "." ]
train
https://github.com/jimmoores/quandl4j/blob/5d67ae60279d889da93ae7aa3bf6b7d536f88822/core/src/main/java/com/jimmoores/quandl/SearchResult.java#L47-L54
Chorus-bdd/Chorus
interpreter/chorus-processes/src/main/java/org/chorusbdd/chorus/processes/manager/ProcessManagerProcess.java
ProcessManagerProcess.writeToStdIn
public void writeToStdIn(String text, boolean newLine) { """ Write the text to the std in of the process @param newLine append a new line """ if ( outputStream == null) { outputStream = new BufferedOutputStream(process.getOutputStream()); outputWriter = new BufferedWriter(new OutputStreamWriter(outputStream)); } try { outputWriter.write(text); if ( newLine ) { outputWriter.newLine(); } outputWriter.flush(); outputStream.flush(); } catch (IOException e) { getLog().debug("Error when writing to process in for " + this, e); ChorusAssert.fail("IOException when writing line to process"); } }
java
public void writeToStdIn(String text, boolean newLine) { if ( outputStream == null) { outputStream = new BufferedOutputStream(process.getOutputStream()); outputWriter = new BufferedWriter(new OutputStreamWriter(outputStream)); } try { outputWriter.write(text); if ( newLine ) { outputWriter.newLine(); } outputWriter.flush(); outputStream.flush(); } catch (IOException e) { getLog().debug("Error when writing to process in for " + this, e); ChorusAssert.fail("IOException when writing line to process"); } }
[ "public", "void", "writeToStdIn", "(", "String", "text", ",", "boolean", "newLine", ")", "{", "if", "(", "outputStream", "==", "null", ")", "{", "outputStream", "=", "new", "BufferedOutputStream", "(", "process", ".", "getOutputStream", "(", ")", ")", ";", "outputWriter", "=", "new", "BufferedWriter", "(", "new", "OutputStreamWriter", "(", "outputStream", ")", ")", ";", "}", "try", "{", "outputWriter", ".", "write", "(", "text", ")", ";", "if", "(", "newLine", ")", "{", "outputWriter", ".", "newLine", "(", ")", ";", "}", "outputWriter", ".", "flush", "(", ")", ";", "outputStream", ".", "flush", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "getLog", "(", ")", ".", "debug", "(", "\"Error when writing to process in for \"", "+", "this", ",", "e", ")", ";", "ChorusAssert", ".", "fail", "(", "\"IOException when writing line to process\"", ")", ";", "}", "}" ]
Write the text to the std in of the process @param newLine append a new line
[ "Write", "the", "text", "to", "the", "std", "in", "of", "the", "process" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-processes/src/main/java/org/chorusbdd/chorus/processes/manager/ProcessManagerProcess.java#L171-L188
codelibs/jcifs
src/main/java/jcifs/smb1/Config.java
Config.getInt
public static int getInt( String key, int def ) { """ Retrieve an <code>int</code>. If the key does not exist or cannot be converted to an <code>int</code>, the provided default argument will be returned. """ String s = prp.getProperty( key ); if( s != null ) { try { def = Integer.parseInt( s ); } catch( NumberFormatException nfe ) { if( log.level > 0 ) nfe.printStackTrace( log ); } } return def; }
java
public static int getInt( String key, int def ) { String s = prp.getProperty( key ); if( s != null ) { try { def = Integer.parseInt( s ); } catch( NumberFormatException nfe ) { if( log.level > 0 ) nfe.printStackTrace( log ); } } return def; }
[ "public", "static", "int", "getInt", "(", "String", "key", ",", "int", "def", ")", "{", "String", "s", "=", "prp", ".", "getProperty", "(", "key", ")", ";", "if", "(", "s", "!=", "null", ")", "{", "try", "{", "def", "=", "Integer", ".", "parseInt", "(", "s", ")", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "if", "(", "log", ".", "level", ">", "0", ")", "nfe", ".", "printStackTrace", "(", "log", ")", ";", "}", "}", "return", "def", ";", "}" ]
Retrieve an <code>int</code>. If the key does not exist or cannot be converted to an <code>int</code>, the provided default argument will be returned.
[ "Retrieve", "an", "<code", ">", "int<", "/", "code", ">", ".", "If", "the", "key", "does", "not", "exist", "or", "cannot", "be", "converted", "to", "an", "<code", ">", "int<", "/", "code", ">", "the", "provided", "default", "argument", "will", "be", "returned", "." ]
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/Config.java#L222-L233
aalmiray/Json-lib
src/main/java/net/sf/json/JSONArray.java
JSONArray._fromArray
private static JSONArray _fromArray( double[] array, JsonConfig jsonConfig ) { """ Construct a JSONArray from an double[].<br> @param array An double[] array. """ if( !addInstance( array ) ){ try{ return jsonConfig.getCycleDetectionStrategy() .handleRepeatedReferenceAsArray( array ); }catch( JSONException jsone ){ removeInstance( array ); fireErrorEvent( jsone, jsonConfig ); throw jsone; }catch( RuntimeException e ){ removeInstance( array ); JSONException jsone = new JSONException( e ); fireErrorEvent( jsone, jsonConfig ); throw jsone; } } fireArrayStartEvent( jsonConfig ); JSONArray jsonArray = new JSONArray(); try{ for( int i = 0; i < array.length; i++ ){ Double d = new Double( array[i] ); JSONUtils.testValidity( d ); jsonArray.addValue( d, jsonConfig ); fireElementAddedEvent( i, d, jsonConfig ); } }catch( JSONException jsone ){ removeInstance( array ); fireErrorEvent( jsone, jsonConfig ); throw jsone; } removeInstance( array ); fireArrayEndEvent( jsonConfig ); return jsonArray; }
java
private static JSONArray _fromArray( double[] array, JsonConfig jsonConfig ) { if( !addInstance( array ) ){ try{ return jsonConfig.getCycleDetectionStrategy() .handleRepeatedReferenceAsArray( array ); }catch( JSONException jsone ){ removeInstance( array ); fireErrorEvent( jsone, jsonConfig ); throw jsone; }catch( RuntimeException e ){ removeInstance( array ); JSONException jsone = new JSONException( e ); fireErrorEvent( jsone, jsonConfig ); throw jsone; } } fireArrayStartEvent( jsonConfig ); JSONArray jsonArray = new JSONArray(); try{ for( int i = 0; i < array.length; i++ ){ Double d = new Double( array[i] ); JSONUtils.testValidity( d ); jsonArray.addValue( d, jsonConfig ); fireElementAddedEvent( i, d, jsonConfig ); } }catch( JSONException jsone ){ removeInstance( array ); fireErrorEvent( jsone, jsonConfig ); throw jsone; } removeInstance( array ); fireArrayEndEvent( jsonConfig ); return jsonArray; }
[ "private", "static", "JSONArray", "_fromArray", "(", "double", "[", "]", "array", ",", "JsonConfig", "jsonConfig", ")", "{", "if", "(", "!", "addInstance", "(", "array", ")", ")", "{", "try", "{", "return", "jsonConfig", ".", "getCycleDetectionStrategy", "(", ")", ".", "handleRepeatedReferenceAsArray", "(", "array", ")", ";", "}", "catch", "(", "JSONException", "jsone", ")", "{", "removeInstance", "(", "array", ")", ";", "fireErrorEvent", "(", "jsone", ",", "jsonConfig", ")", ";", "throw", "jsone", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "removeInstance", "(", "array", ")", ";", "JSONException", "jsone", "=", "new", "JSONException", "(", "e", ")", ";", "fireErrorEvent", "(", "jsone", ",", "jsonConfig", ")", ";", "throw", "jsone", ";", "}", "}", "fireArrayStartEvent", "(", "jsonConfig", ")", ";", "JSONArray", "jsonArray", "=", "new", "JSONArray", "(", ")", ";", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "Double", "d", "=", "new", "Double", "(", "array", "[", "i", "]", ")", ";", "JSONUtils", ".", "testValidity", "(", "d", ")", ";", "jsonArray", ".", "addValue", "(", "d", ",", "jsonConfig", ")", ";", "fireElementAddedEvent", "(", "i", ",", "d", ",", "jsonConfig", ")", ";", "}", "}", "catch", "(", "JSONException", "jsone", ")", "{", "removeInstance", "(", "array", ")", ";", "fireErrorEvent", "(", "jsone", ",", "jsonConfig", ")", ";", "throw", "jsone", ";", "}", "removeInstance", "(", "array", ")", ";", "fireArrayEndEvent", "(", "jsonConfig", ")", ";", "return", "jsonArray", ";", "}" ]
Construct a JSONArray from an double[].<br> @param array An double[] array.
[ "Construct", "a", "JSONArray", "from", "an", "double", "[]", ".", "<br", ">" ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONArray.java#L645-L680
gallandarakhneorg/afc
core/maths/mathstochastic/src/main/java/org/arakhne/afc/math/stochastic/StochasticLaw.java
StochasticLaw.paramFloat
@Pure protected static double paramFloat(String paramName, Map<String, String> parameters) throws LawParameterNotFoundException { """ Extract a parameter value from a map of parameters. @param paramName is the nameof the parameter to extract. @param parameters is the map of available parameters @return the extract value @throws LawParameterNotFoundException if the parameter was not found or the value is not a double. """ final String svalue = parameters.get(paramName); if (svalue != null && !"".equals(svalue)) { //$NON-NLS-1$ try { return Float.parseFloat(svalue); } catch (AssertionError e) { throw e; } catch (Throwable e) { // } } throw new LawParameterNotFoundException(paramName); }
java
@Pure protected static double paramFloat(String paramName, Map<String, String> parameters) throws LawParameterNotFoundException { final String svalue = parameters.get(paramName); if (svalue != null && !"".equals(svalue)) { //$NON-NLS-1$ try { return Float.parseFloat(svalue); } catch (AssertionError e) { throw e; } catch (Throwable e) { // } } throw new LawParameterNotFoundException(paramName); }
[ "@", "Pure", "protected", "static", "double", "paramFloat", "(", "String", "paramName", ",", "Map", "<", "String", ",", "String", ">", "parameters", ")", "throws", "LawParameterNotFoundException", "{", "final", "String", "svalue", "=", "parameters", ".", "get", "(", "paramName", ")", ";", "if", "(", "svalue", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "svalue", ")", ")", "{", "//$NON-NLS-1$", "try", "{", "return", "Float", ".", "parseFloat", "(", "svalue", ")", ";", "}", "catch", "(", "AssertionError", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "//", "}", "}", "throw", "new", "LawParameterNotFoundException", "(", "paramName", ")", ";", "}" ]
Extract a parameter value from a map of parameters. @param paramName is the nameof the parameter to extract. @param parameters is the map of available parameters @return the extract value @throws LawParameterNotFoundException if the parameter was not found or the value is not a double.
[ "Extract", "a", "parameter", "value", "from", "a", "map", "of", "parameters", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathstochastic/src/main/java/org/arakhne/afc/math/stochastic/StochasticLaw.java#L53-L67
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java
CmsPositionBean.isInside
public boolean isInside(CmsPositionBean child, int padding) { """ Checks whether the given position is completely surrounded by this position.<p> @param child the child position @param padding the padding to use @return <code>true</code> if the child position is completely surrounded """ return ((getLeft() + padding) < child.getLeft()) // checking left border && ((getTop() + padding) < child.getTop()) // checking top border && (((getLeft() + getWidth()) - padding) > (child.getLeft() + child.getWidth())) // checking right border && (((getTop() + getHeight()) - padding) > (child.getTop() + child.getHeight())); // checking bottom border }
java
public boolean isInside(CmsPositionBean child, int padding) { return ((getLeft() + padding) < child.getLeft()) // checking left border && ((getTop() + padding) < child.getTop()) // checking top border && (((getLeft() + getWidth()) - padding) > (child.getLeft() + child.getWidth())) // checking right border && (((getTop() + getHeight()) - padding) > (child.getTop() + child.getHeight())); // checking bottom border }
[ "public", "boolean", "isInside", "(", "CmsPositionBean", "child", ",", "int", "padding", ")", "{", "return", "(", "(", "getLeft", "(", ")", "+", "padding", ")", "<", "child", ".", "getLeft", "(", ")", ")", "// checking left border", "&&", "(", "(", "getTop", "(", ")", "+", "padding", ")", "<", "child", ".", "getTop", "(", ")", ")", "// checking top border", "&&", "(", "(", "(", "getLeft", "(", ")", "+", "getWidth", "(", ")", ")", "-", "padding", ")", ">", "(", "child", ".", "getLeft", "(", ")", "+", "child", ".", "getWidth", "(", ")", ")", ")", "// checking right border", "&&", "(", "(", "(", "getTop", "(", ")", "+", "getHeight", "(", ")", ")", "-", "padding", ")", ">", "(", "child", ".", "getTop", "(", ")", "+", "child", ".", "getHeight", "(", ")", ")", ")", ";", "// checking bottom border", "}" ]
Checks whether the given position is completely surrounded by this position.<p> @param child the child position @param padding the padding to use @return <code>true</code> if the child position is completely surrounded
[ "Checks", "whether", "the", "given", "position", "is", "completely", "surrounded", "by", "this", "position", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java#L534-L540
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java
CheckClassAdapter.checkTypeArgument
private static int checkTypeArgument(final String signature, int pos) { """ Checks a type argument in a class type signature. @param signature a string containing the signature that must be checked. @param pos index of first character to be checked. @return the index of the first character after the checked part. """ // TypeArgument: // * | ( ( + | - )? FieldTypeSignature ) char c = getChar(signature, pos); if (c == '*') { return pos + 1; } else if (c == '+' || c == '-') { pos++; } return checkFieldTypeSignature(signature, pos); }
java
private static int checkTypeArgument(final String signature, int pos) { // TypeArgument: // * | ( ( + | - )? FieldTypeSignature ) char c = getChar(signature, pos); if (c == '*') { return pos + 1; } else if (c == '+' || c == '-') { pos++; } return checkFieldTypeSignature(signature, pos); }
[ "private", "static", "int", "checkTypeArgument", "(", "final", "String", "signature", ",", "int", "pos", ")", "{", "// TypeArgument:", "// * | ( ( + | - )? FieldTypeSignature )", "char", "c", "=", "getChar", "(", "signature", ",", "pos", ")", ";", "if", "(", "c", "==", "'", "'", ")", "{", "return", "pos", "+", "1", ";", "}", "else", "if", "(", "c", "==", "'", "'", "||", "c", "==", "'", "'", ")", "{", "pos", "++", ";", "}", "return", "checkFieldTypeSignature", "(", "signature", ",", "pos", ")", ";", "}" ]
Checks a type argument in a class type signature. @param signature a string containing the signature that must be checked. @param pos index of first character to be checked. @return the index of the first character after the checked part.
[ "Checks", "a", "type", "argument", "in", "a", "class", "type", "signature", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L898-L909
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java
SARLFormatter._format
protected void _format(SarlCapacityUses capacityUses, IFormattableDocument document) { """ Format a capacity use. @param capacityUses the capacity uses. @param document the document. """ final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(capacityUses); document.append(regionFor.keyword(this.keywords.getUsesKeyword()), ONE_SPACE); formatCommaSeparatedList(capacityUses.getCapacities(), document); document.prepend(regionFor.keyword(this.keywords.getSemicolonKeyword()), NO_SPACE); }
java
protected void _format(SarlCapacityUses capacityUses, IFormattableDocument document) { final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(capacityUses); document.append(regionFor.keyword(this.keywords.getUsesKeyword()), ONE_SPACE); formatCommaSeparatedList(capacityUses.getCapacities(), document); document.prepend(regionFor.keyword(this.keywords.getSemicolonKeyword()), NO_SPACE); }
[ "protected", "void", "_format", "(", "SarlCapacityUses", "capacityUses", ",", "IFormattableDocument", "document", ")", "{", "final", "ISemanticRegionsFinder", "regionFor", "=", "this", ".", "textRegionExtensions", ".", "regionFor", "(", "capacityUses", ")", ";", "document", ".", "append", "(", "regionFor", ".", "keyword", "(", "this", ".", "keywords", ".", "getUsesKeyword", "(", ")", ")", ",", "ONE_SPACE", ")", ";", "formatCommaSeparatedList", "(", "capacityUses", ".", "getCapacities", "(", ")", ",", "document", ")", ";", "document", ".", "prepend", "(", "regionFor", ".", "keyword", "(", "this", ".", "keywords", ".", "getSemicolonKeyword", "(", ")", ")", ",", "NO_SPACE", ")", ";", "}" ]
Format a capacity use. @param capacityUses the capacity uses. @param document the document.
[ "Format", "a", "capacity", "use", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/formatting2/SARLFormatter.java#L475-L480
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjFilter.java
MpxjFilter.processTaskFilter
private static void processTaskFilter(ProjectFile project, Filter filter) { """ Apply a filter to the list of all tasks, and show the results. @param project project file @param filter filter """ for (Task task : project.getTasks()) { if (filter.evaluate(task, null)) { System.out.println(task.getID() + "," + task.getUniqueID() + "," + task.getName()); } } }
java
private static void processTaskFilter(ProjectFile project, Filter filter) { for (Task task : project.getTasks()) { if (filter.evaluate(task, null)) { System.out.println(task.getID() + "," + task.getUniqueID() + "," + task.getName()); } } }
[ "private", "static", "void", "processTaskFilter", "(", "ProjectFile", "project", ",", "Filter", "filter", ")", "{", "for", "(", "Task", "task", ":", "project", ".", "getTasks", "(", ")", ")", "{", "if", "(", "filter", ".", "evaluate", "(", "task", ",", "null", ")", ")", "{", "System", ".", "out", ".", "println", "(", "task", ".", "getID", "(", ")", "+", "\",\"", "+", "task", ".", "getUniqueID", "(", ")", "+", "\",\"", "+", "task", ".", "getName", "(", ")", ")", ";", "}", "}", "}" ]
Apply a filter to the list of all tasks, and show the results. @param project project file @param filter filter
[ "Apply", "a", "filter", "to", "the", "list", "of", "all", "tasks", "and", "show", "the", "results", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L128-L137
haraldk/TwelveMonkeys
common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java
CollectionUtil.mergeArrays
@SuppressWarnings( { """ Merges two arrays into a new array. Elements from pArray1 and pArray2 will be copied into a new array, that has pLength1 + pLength2 elements. @param pArray1 First array @param pOffset1 the offset into the first array @param pLength1 the number of elements to copy from the first array @param pArray2 Second array, must be compatible with (assignable from) the first array @param pOffset2 the offset into the second array @param pLength2 the number of elements to copy from the second array @return A new array, containing the values of pArray1 and pArray2. The array (wrapped as an object), will have the length of pArray1 + pArray2, and can be safely cast to the type of the pArray1 parameter. @see java.lang.System#arraycopy(Object,int,Object,int,int) """"SuspiciousSystemArraycopy"}) public static Object mergeArrays(Object pArray1, int pOffset1, int pLength1, Object pArray2, int pOffset2, int pLength2) { Class class1 = pArray1.getClass(); Class type = class1.getComponentType(); // Create new array of the new length Object array = Array.newInstance(type, pLength1 + pLength2); System.arraycopy(pArray1, pOffset1, array, 0, pLength1); System.arraycopy(pArray2, pOffset2, array, pLength1, pLength2); return array; }
java
@SuppressWarnings({"SuspiciousSystemArraycopy"}) public static Object mergeArrays(Object pArray1, int pOffset1, int pLength1, Object pArray2, int pOffset2, int pLength2) { Class class1 = pArray1.getClass(); Class type = class1.getComponentType(); // Create new array of the new length Object array = Array.newInstance(type, pLength1 + pLength2); System.arraycopy(pArray1, pOffset1, array, 0, pLength1); System.arraycopy(pArray2, pOffset2, array, pLength1, pLength2); return array; }
[ "@", "SuppressWarnings", "(", "{", "\"SuspiciousSystemArraycopy\"", "}", ")", "public", "static", "Object", "mergeArrays", "(", "Object", "pArray1", ",", "int", "pOffset1", ",", "int", "pLength1", ",", "Object", "pArray2", ",", "int", "pOffset2", ",", "int", "pLength2", ")", "{", "Class", "class1", "=", "pArray1", ".", "getClass", "(", ")", ";", "Class", "type", "=", "class1", ".", "getComponentType", "(", ")", ";", "// Create new array of the new length\r", "Object", "array", "=", "Array", ".", "newInstance", "(", "type", ",", "pLength1", "+", "pLength2", ")", ";", "System", ".", "arraycopy", "(", "pArray1", ",", "pOffset1", ",", "array", ",", "0", ",", "pLength1", ")", ";", "System", ".", "arraycopy", "(", "pArray2", ",", "pOffset2", ",", "array", ",", "pLength1", ",", "pLength2", ")", ";", "return", "array", ";", "}" ]
Merges two arrays into a new array. Elements from pArray1 and pArray2 will be copied into a new array, that has pLength1 + pLength2 elements. @param pArray1 First array @param pOffset1 the offset into the first array @param pLength1 the number of elements to copy from the first array @param pArray2 Second array, must be compatible with (assignable from) the first array @param pOffset2 the offset into the second array @param pLength2 the number of elements to copy from the second array @return A new array, containing the values of pArray1 and pArray2. The array (wrapped as an object), will have the length of pArray1 + pArray2, and can be safely cast to the type of the pArray1 parameter. @see java.lang.System#arraycopy(Object,int,Object,int,int)
[ "Merges", "two", "arrays", "into", "a", "new", "array", ".", "Elements", "from", "pArray1", "and", "pArray2", "will", "be", "copied", "into", "a", "new", "array", "that", "has", "pLength1", "+", "pLength2", "elements", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/CollectionUtil.java#L246-L257
aol/cyclops
cyclops/src/main/java/cyclops/companion/Functions.java
Functions.flatMapLongs
public static Function<? super ReactiveSeq<Long>, ? extends ReactiveSeq<Long>> flatMapLongs(LongFunction<? extends LongStream> b) { """ /* Fluent flatMap operation using primitive types e.g. <pre> {@code import static cyclops.ReactiveSeq.flatMapLongs; ReactiveSeq.ofLongs(1,2,3) .to(flatMapLongs(i->LongStream.of(i*2))); //[2l,4l,6l] } </pre> """ return a->a.longs(i->i,s->s.flatMap(b)); }
java
public static Function<? super ReactiveSeq<Long>, ? extends ReactiveSeq<Long>> flatMapLongs(LongFunction<? extends LongStream> b){ return a->a.longs(i->i,s->s.flatMap(b)); }
[ "public", "static", "Function", "<", "?", "super", "ReactiveSeq", "<", "Long", ">", ",", "?", "extends", "ReactiveSeq", "<", "Long", ">", ">", "flatMapLongs", "(", "LongFunction", "<", "?", "extends", "LongStream", ">", "b", ")", "{", "return", "a", "->", "a", ".", "longs", "(", "i", "->", "i", ",", "s", "->", "s", ".", "flatMap", "(", "b", ")", ")", ";", "}" ]
/* Fluent flatMap operation using primitive types e.g. <pre> {@code import static cyclops.ReactiveSeq.flatMapLongs; ReactiveSeq.ofLongs(1,2,3) .to(flatMapLongs(i->LongStream.of(i*2))); //[2l,4l,6l] } </pre>
[ "/", "*", "Fluent", "flatMap", "operation", "using", "primitive", "types", "e", ".", "g", ".", "<pre", ">", "{", "@code", "import", "static", "cyclops", ".", "ReactiveSeq", ".", "flatMapLongs", ";" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Functions.java#L414-L417
jparsec/jparsec
jparsec/src/main/java/org/jparsec/internal/util/Checks.java
Checks.checkState
public static void checkState(boolean condition, String message, Object... args) throws IllegalStateException { """ Checks a certain state. @param condition the condition of the state that has to be true @param message the error message if {@code condition} is false @param args the arguments to the error message @throws IllegalStateException if {@code condition} is false """ if (!condition) { throw new IllegalStateException(String.format(message, args)); } }
java
public static void checkState(boolean condition, String message, Object... args) throws IllegalStateException { if (!condition) { throw new IllegalStateException(String.format(message, args)); } }
[ "public", "static", "void", "checkState", "(", "boolean", "condition", ",", "String", "message", ",", "Object", "...", "args", ")", "throws", "IllegalStateException", "{", "if", "(", "!", "condition", ")", "{", "throw", "new", "IllegalStateException", "(", "String", ".", "format", "(", "message", ",", "args", ")", ")", ";", "}", "}" ]
Checks a certain state. @param condition the condition of the state that has to be true @param message the error message if {@code condition} is false @param args the arguments to the error message @throws IllegalStateException if {@code condition} is false
[ "Checks", "a", "certain", "state", "." ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/internal/util/Checks.java#L90-L95
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/utils/ESResponseWrapper.java
ESResponseWrapper.setField
private void setField(Object result, Object key, Attribute attribute, Object fieldValue) { """ Sets the field. @param result the result @param key the key @param attribute the attribute @param fieldValue the field value """ if (fieldValue != null) { if (((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(Date.class) || ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(java.sql.Date.class) || ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(Timestamp.class) || ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(Calendar.class)) { PropertyAccessorFactory.STRING.fromString(((AbstractAttribute) attribute).getBindableJavaType(), fieldValue.toString()); } else if (key == null || !key.equals(fieldValue)) { PropertyAccessorHelper.set(result, (Field) attribute.getJavaMember(), fieldValue); } } }
java
private void setField(Object result, Object key, Attribute attribute, Object fieldValue) { if (fieldValue != null) { if (((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(Date.class) || ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(java.sql.Date.class) || ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(Timestamp.class) || ((AbstractAttribute) attribute).getBindableJavaType().isAssignableFrom(Calendar.class)) { PropertyAccessorFactory.STRING.fromString(((AbstractAttribute) attribute).getBindableJavaType(), fieldValue.toString()); } else if (key == null || !key.equals(fieldValue)) { PropertyAccessorHelper.set(result, (Field) attribute.getJavaMember(), fieldValue); } } }
[ "private", "void", "setField", "(", "Object", "result", ",", "Object", "key", ",", "Attribute", "attribute", ",", "Object", "fieldValue", ")", "{", "if", "(", "fieldValue", "!=", "null", ")", "{", "if", "(", "(", "(", "AbstractAttribute", ")", "attribute", ")", ".", "getBindableJavaType", "(", ")", ".", "isAssignableFrom", "(", "Date", ".", "class", ")", "||", "(", "(", "AbstractAttribute", ")", "attribute", ")", ".", "getBindableJavaType", "(", ")", ".", "isAssignableFrom", "(", "java", ".", "sql", ".", "Date", ".", "class", ")", "||", "(", "(", "AbstractAttribute", ")", "attribute", ")", ".", "getBindableJavaType", "(", ")", ".", "isAssignableFrom", "(", "Timestamp", ".", "class", ")", "||", "(", "(", "AbstractAttribute", ")", "attribute", ")", ".", "getBindableJavaType", "(", ")", ".", "isAssignableFrom", "(", "Calendar", ".", "class", ")", ")", "{", "PropertyAccessorFactory", ".", "STRING", ".", "fromString", "(", "(", "(", "AbstractAttribute", ")", "attribute", ")", ".", "getBindableJavaType", "(", ")", ",", "fieldValue", ".", "toString", "(", ")", ")", ";", "}", "else", "if", "(", "key", "==", "null", "||", "!", "key", ".", "equals", "(", "fieldValue", ")", ")", "{", "PropertyAccessorHelper", ".", "set", "(", "result", ",", "(", "Field", ")", "attribute", ".", "getJavaMember", "(", ")", ",", "fieldValue", ")", ";", "}", "}", "}" ]
Sets the field. @param result the result @param key the key @param attribute the attribute @param fieldValue the field value
[ "Sets", "the", "field", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/utils/ESResponseWrapper.java#L685-L702
jenkinsci/github-plugin
src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java
WebhookManager.unregisterFor
public void unregisterFor(GitHubRepositoryName name, List<GitHubRepositoryName> aliveRepos) { """ Used to cleanup old hooks in case of removed or reconfigured trigger since JENKINS-28138 this method permanently removes service hooks So if the trigger for given name was only reconfigured, this method filters only service hooks (with help of aliveRepos names list), otherwise this method removes all hooks for managed url @param name repository to clean hooks @param aliveRepos repository list which has enabled trigger in jobs """ try { GHRepository repo = checkNotNull( from(name.resolve(allowedToManageHooks())).firstMatch(withAdminAccess()).orNull(), "There are no credentials with admin access to manage hooks on %s", name ); LOGGER.debug("Check {} for redundant hooks...", repo); Predicate<GHHook> predicate = aliveRepos.contains(name) ? serviceWebhookFor(endpoint) // permanently clear service hooks (JENKINS-28138) : or(serviceWebhookFor(endpoint), webhookFor(endpoint)); from(fetchHooks().apply(repo)) .filter(predicate) .filter(deleteWebhook()) .filter(log("Deleted hook")).toList(); } catch (Throwable t) { LOGGER.warn("Failed to remove hook from {}", name, t); GitHubHookRegisterProblemMonitor.get().registerProblem(name, t); } }
java
public void unregisterFor(GitHubRepositoryName name, List<GitHubRepositoryName> aliveRepos) { try { GHRepository repo = checkNotNull( from(name.resolve(allowedToManageHooks())).firstMatch(withAdminAccess()).orNull(), "There are no credentials with admin access to manage hooks on %s", name ); LOGGER.debug("Check {} for redundant hooks...", repo); Predicate<GHHook> predicate = aliveRepos.contains(name) ? serviceWebhookFor(endpoint) // permanently clear service hooks (JENKINS-28138) : or(serviceWebhookFor(endpoint), webhookFor(endpoint)); from(fetchHooks().apply(repo)) .filter(predicate) .filter(deleteWebhook()) .filter(log("Deleted hook")).toList(); } catch (Throwable t) { LOGGER.warn("Failed to remove hook from {}", name, t); GitHubHookRegisterProblemMonitor.get().registerProblem(name, t); } }
[ "public", "void", "unregisterFor", "(", "GitHubRepositoryName", "name", ",", "List", "<", "GitHubRepositoryName", ">", "aliveRepos", ")", "{", "try", "{", "GHRepository", "repo", "=", "checkNotNull", "(", "from", "(", "name", ".", "resolve", "(", "allowedToManageHooks", "(", ")", ")", ")", ".", "firstMatch", "(", "withAdminAccess", "(", ")", ")", ".", "orNull", "(", ")", ",", "\"There are no credentials with admin access to manage hooks on %s\"", ",", "name", ")", ";", "LOGGER", ".", "debug", "(", "\"Check {} for redundant hooks...\"", ",", "repo", ")", ";", "Predicate", "<", "GHHook", ">", "predicate", "=", "aliveRepos", ".", "contains", "(", "name", ")", "?", "serviceWebhookFor", "(", "endpoint", ")", "// permanently clear service hooks (JENKINS-28138)", ":", "or", "(", "serviceWebhookFor", "(", "endpoint", ")", ",", "webhookFor", "(", "endpoint", ")", ")", ";", "from", "(", "fetchHooks", "(", ")", ".", "apply", "(", "repo", ")", ")", ".", "filter", "(", "predicate", ")", ".", "filter", "(", "deleteWebhook", "(", ")", ")", ".", "filter", "(", "log", "(", "\"Deleted hook\"", ")", ")", ".", "toList", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "LOGGER", ".", "warn", "(", "\"Failed to remove hook from {}\"", ",", "name", ",", "t", ")", ";", "GitHubHookRegisterProblemMonitor", ".", "get", "(", ")", ".", "registerProblem", "(", "name", ",", "t", ")", ";", "}", "}" ]
Used to cleanup old hooks in case of removed or reconfigured trigger since JENKINS-28138 this method permanently removes service hooks So if the trigger for given name was only reconfigured, this method filters only service hooks (with help of aliveRepos names list), otherwise this method removes all hooks for managed url @param name repository to clean hooks @param aliveRepos repository list which has enabled trigger in jobs
[ "Used", "to", "cleanup", "old", "hooks", "in", "case", "of", "removed", "or", "reconfigured", "trigger", "since", "JENKINS", "-", "28138", "this", "method", "permanently", "removes", "service", "hooks" ]
train
https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java#L142-L164
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.rotationXYZ
public Matrix4d rotationXYZ(double angleX, double angleY, double angleZ) { """ Set this matrix to a rotation of <code>angleX</code> radians about the X axis, followed by a rotation of <code>angleY</code> radians about the Y axis and followed by a rotation of <code>angleZ</code> radians about the Z axis. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> This method is equivalent to calling: <code>rotationX(angleX).rotateY(angleY).rotateZ(angleZ)</code> @param angleX the angle to rotate about X @param angleY the angle to rotate about Y @param angleZ the angle to rotate about Z @return this """ double sinX = Math.sin(angleX); double cosX = Math.cosFromSin(sinX, angleX); double sinY = Math.sin(angleY); double cosY = Math.cosFromSin(sinY, angleY); double sinZ = Math.sin(angleZ); double cosZ = Math.cosFromSin(sinZ, angleZ); double m_sinX = -sinX; double m_sinY = -sinY; double m_sinZ = -sinZ; if ((properties & PROPERTY_IDENTITY) == 0) this._identity(); // rotateX double nm11 = cosX; double nm12 = sinX; double nm21 = m_sinX; double nm22 = cosX; // rotateY double nm00 = cosY; double nm01 = nm21 * m_sinY; double nm02 = nm22 * m_sinY; m20 = sinY; m21 = nm21 * cosY; m22 = nm22 * cosY; // rotateZ m00 = nm00 * cosZ; m01 = nm01 * cosZ + nm11 * sinZ; m02 = nm02 * cosZ + nm12 * sinZ; m10 = nm00 * m_sinZ; m11 = nm01 * m_sinZ + nm11 * cosZ; m12 = nm02 * m_sinZ + nm12 * cosZ; properties = PROPERTY_AFFINE | PROPERTY_ORTHONORMAL; return this; }
java
public Matrix4d rotationXYZ(double angleX, double angleY, double angleZ) { double sinX = Math.sin(angleX); double cosX = Math.cosFromSin(sinX, angleX); double sinY = Math.sin(angleY); double cosY = Math.cosFromSin(sinY, angleY); double sinZ = Math.sin(angleZ); double cosZ = Math.cosFromSin(sinZ, angleZ); double m_sinX = -sinX; double m_sinY = -sinY; double m_sinZ = -sinZ; if ((properties & PROPERTY_IDENTITY) == 0) this._identity(); // rotateX double nm11 = cosX; double nm12 = sinX; double nm21 = m_sinX; double nm22 = cosX; // rotateY double nm00 = cosY; double nm01 = nm21 * m_sinY; double nm02 = nm22 * m_sinY; m20 = sinY; m21 = nm21 * cosY; m22 = nm22 * cosY; // rotateZ m00 = nm00 * cosZ; m01 = nm01 * cosZ + nm11 * sinZ; m02 = nm02 * cosZ + nm12 * sinZ; m10 = nm00 * m_sinZ; m11 = nm01 * m_sinZ + nm11 * cosZ; m12 = nm02 * m_sinZ + nm12 * cosZ; properties = PROPERTY_AFFINE | PROPERTY_ORTHONORMAL; return this; }
[ "public", "Matrix4d", "rotationXYZ", "(", "double", "angleX", ",", "double", "angleY", ",", "double", "angleZ", ")", "{", "double", "sinX", "=", "Math", ".", "sin", "(", "angleX", ")", ";", "double", "cosX", "=", "Math", ".", "cosFromSin", "(", "sinX", ",", "angleX", ")", ";", "double", "sinY", "=", "Math", ".", "sin", "(", "angleY", ")", ";", "double", "cosY", "=", "Math", ".", "cosFromSin", "(", "sinY", ",", "angleY", ")", ";", "double", "sinZ", "=", "Math", ".", "sin", "(", "angleZ", ")", ";", "double", "cosZ", "=", "Math", ".", "cosFromSin", "(", "sinZ", ",", "angleZ", ")", ";", "double", "m_sinX", "=", "-", "sinX", ";", "double", "m_sinY", "=", "-", "sinY", ";", "double", "m_sinZ", "=", "-", "sinZ", ";", "if", "(", "(", "properties", "&", "PROPERTY_IDENTITY", ")", "==", "0", ")", "this", ".", "_identity", "(", ")", ";", "// rotateX", "double", "nm11", "=", "cosX", ";", "double", "nm12", "=", "sinX", ";", "double", "nm21", "=", "m_sinX", ";", "double", "nm22", "=", "cosX", ";", "// rotateY", "double", "nm00", "=", "cosY", ";", "double", "nm01", "=", "nm21", "*", "m_sinY", ";", "double", "nm02", "=", "nm22", "*", "m_sinY", ";", "m20", "=", "sinY", ";", "m21", "=", "nm21", "*", "cosY", ";", "m22", "=", "nm22", "*", "cosY", ";", "// rotateZ", "m00", "=", "nm00", "*", "cosZ", ";", "m01", "=", "nm01", "*", "cosZ", "+", "nm11", "*", "sinZ", ";", "m02", "=", "nm02", "*", "cosZ", "+", "nm12", "*", "sinZ", ";", "m10", "=", "nm00", "*", "m_sinZ", ";", "m11", "=", "nm01", "*", "m_sinZ", "+", "nm11", "*", "cosZ", ";", "m12", "=", "nm02", "*", "m_sinZ", "+", "nm12", "*", "cosZ", ";", "properties", "=", "PROPERTY_AFFINE", "|", "PROPERTY_ORTHONORMAL", ";", "return", "this", ";", "}" ]
Set this matrix to a rotation of <code>angleX</code> radians about the X axis, followed by a rotation of <code>angleY</code> radians about the Y axis and followed by a rotation of <code>angleZ</code> radians about the Z axis. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> This method is equivalent to calling: <code>rotationX(angleX).rotateY(angleY).rotateZ(angleZ)</code> @param angleX the angle to rotate about X @param angleY the angle to rotate about Y @param angleZ the angle to rotate about Z @return this
[ "Set", "this", "matrix", "to", "a", "rotation", "of", "<code", ">", "angleX<", "/", "code", ">", "radians", "about", "the", "X", "axis", "followed", "by", "a", "rotation", "of", "<code", ">", "angleY<", "/", "code", ">", "radians", "about", "the", "Y", "axis", "and", "followed", "by", "a", "rotation", "of", "<code", ">", "angleZ<", "/", "code", ">", "radians", "about", "the", "Z", "axis", ".", "<p", ">", "When", "used", "with", "a", "right", "-", "handed", "coordinate", "system", "the", "produced", "rotation", "will", "rotate", "a", "vector", "counter", "-", "clockwise", "around", "the", "rotation", "axis", "when", "viewing", "along", "the", "negative", "axis", "direction", "towards", "the", "origin", ".", "When", "used", "with", "a", "left", "-", "handed", "coordinate", "system", "the", "rotation", "is", "clockwise", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", ":", "<code", ">", "rotationX", "(", "angleX", ")", ".", "rotateY", "(", "angleY", ")", ".", "rotateZ", "(", "angleZ", ")", "<", "/", "code", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L3750-L3784
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.errorv
public void errorv(Throwable t, String format, Object... params) { """ Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. @param t the throwable @param format the message format string @param params the parameters """ doLog(Level.ERROR, FQCN, format, params, t); }
java
public void errorv(Throwable t, String format, Object... params) { doLog(Level.ERROR, FQCN, format, params, t); }
[ "public", "void", "errorv", "(", "Throwable", "t", ",", "String", "format", ",", "Object", "...", "params", ")", "{", "doLog", "(", "Level", ".", "ERROR", ",", "FQCN", ",", "format", ",", "params", ",", "t", ")", ";", "}" ]
Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. @param t the throwable @param format the message format string @param params the parameters
[ "Issue", "a", "log", "message", "with", "a", "level", "of", "ERROR", "using", "{", "@link", "java", ".", "text", ".", "MessageFormat", "}", "-", "style", "formatting", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1614-L1616
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/ContentSpecBuilder.java
ContentSpecBuilder.buildBook
public byte[] buildBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions builderOptions, final BuildType buildType) throws BuilderCreationException, BuildProcessingException { """ Builds a book into a zip file for the passed Content Specification. @param contentSpec The content specification that is to be built. It should have already been validated, if not errors may occur. @param requester The user who requested the book to be built. @param builderOptions The set of options what are to be when building the book. @param buildType @return A byte array that is the zip file @throws BuildProcessingException Any unexpected errors that occur during building. @throws BuilderCreationException Any error that occurs while trying to setup/create the builder """ return buildBook(contentSpec, requester, builderOptions, new HashMap<String, byte[]>(), buildType); }
java
public byte[] buildBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions builderOptions, final BuildType buildType) throws BuilderCreationException, BuildProcessingException { return buildBook(contentSpec, requester, builderOptions, new HashMap<String, byte[]>(), buildType); }
[ "public", "byte", "[", "]", "buildBook", "(", "final", "ContentSpec", "contentSpec", ",", "final", "String", "requester", ",", "final", "DocBookBuildingOptions", "builderOptions", ",", "final", "BuildType", "buildType", ")", "throws", "BuilderCreationException", ",", "BuildProcessingException", "{", "return", "buildBook", "(", "contentSpec", ",", "requester", ",", "builderOptions", ",", "new", "HashMap", "<", "String", ",", "byte", "[", "]", ">", "(", ")", ",", "buildType", ")", ";", "}" ]
Builds a book into a zip file for the passed Content Specification. @param contentSpec The content specification that is to be built. It should have already been validated, if not errors may occur. @param requester The user who requested the book to be built. @param builderOptions The set of options what are to be when building the book. @param buildType @return A byte array that is the zip file @throws BuildProcessingException Any unexpected errors that occur during building. @throws BuilderCreationException Any error that occurs while trying to setup/create the builder
[ "Builds", "a", "book", "into", "a", "zip", "file", "for", "the", "passed", "Content", "Specification", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/ContentSpecBuilder.java#L81-L84
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.parseFileMetaData
protected File parseFileMetaData(final String line, final int lineNumber) throws ParsingException { """ Parse a File MetaData component into a {@link org.jboss.pressgang.ccms.contentspec.File} object. @param line The line to be parsed. @param lineNumber The line number of the line being parsed. @return A file object initialised with the data from the line. @throws ParsingException Thrown if the line contains invalid content and couldn't be parsed. """ final File file; if (line.matches(ProcessorConstants.FILE_ID_REGEX)) { file = new File(Integer.parseInt(line)); } else if (FILE_ID_LONG_PATTERN.matcher(line).matches()) { final Matcher matcher = FILE_ID_LONG_PATTERN.matcher(line); matcher.find(); final String id = matcher.group("ID"); final String title = matcher.group("Title"); final String rev = matcher.group("REV"); file = new File(title.trim(), Integer.parseInt(id)); if (rev != null) { file.setRevision(Integer.parseInt(rev)); } } else { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_FILE_MSG, lineNumber)); } return file; }
java
protected File parseFileMetaData(final String line, final int lineNumber) throws ParsingException { final File file; if (line.matches(ProcessorConstants.FILE_ID_REGEX)) { file = new File(Integer.parseInt(line)); } else if (FILE_ID_LONG_PATTERN.matcher(line).matches()) { final Matcher matcher = FILE_ID_LONG_PATTERN.matcher(line); matcher.find(); final String id = matcher.group("ID"); final String title = matcher.group("Title"); final String rev = matcher.group("REV"); file = new File(title.trim(), Integer.parseInt(id)); if (rev != null) { file.setRevision(Integer.parseInt(rev)); } } else { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_FILE_MSG, lineNumber)); } return file; }
[ "protected", "File", "parseFileMetaData", "(", "final", "String", "line", ",", "final", "int", "lineNumber", ")", "throws", "ParsingException", "{", "final", "File", "file", ";", "if", "(", "line", ".", "matches", "(", "ProcessorConstants", ".", "FILE_ID_REGEX", ")", ")", "{", "file", "=", "new", "File", "(", "Integer", ".", "parseInt", "(", "line", ")", ")", ";", "}", "else", "if", "(", "FILE_ID_LONG_PATTERN", ".", "matcher", "(", "line", ")", ".", "matches", "(", ")", ")", "{", "final", "Matcher", "matcher", "=", "FILE_ID_LONG_PATTERN", ".", "matcher", "(", "line", ")", ";", "matcher", ".", "find", "(", ")", ";", "final", "String", "id", "=", "matcher", ".", "group", "(", "\"ID\"", ")", ";", "final", "String", "title", "=", "matcher", ".", "group", "(", "\"Title\"", ")", ";", "final", "String", "rev", "=", "matcher", ".", "group", "(", "\"REV\"", ")", ";", "file", "=", "new", "File", "(", "title", ".", "trim", "(", ")", ",", "Integer", ".", "parseInt", "(", "id", ")", ")", ";", "if", "(", "rev", "!=", "null", ")", "{", "file", ".", "setRevision", "(", "Integer", ".", "parseInt", "(", "rev", ")", ")", ";", "}", "}", "else", "{", "throw", "new", "ParsingException", "(", "format", "(", "ProcessorConstants", ".", "ERROR_INVALID_FILE_MSG", ",", "lineNumber", ")", ")", ";", "}", "return", "file", ";", "}" ]
Parse a File MetaData component into a {@link org.jboss.pressgang.ccms.contentspec.File} object. @param line The line to be parsed. @param lineNumber The line number of the line being parsed. @return A file object initialised with the data from the line. @throws ParsingException Thrown if the line contains invalid content and couldn't be parsed.
[ "Parse", "a", "File", "MetaData", "component", "into", "a", "{", "@link", "org", ".", "jboss", ".", "pressgang", ".", "ccms", ".", "contentspec", ".", "File", "}", "object", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L888-L909
bazaarvoice/jolt
complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java
ChainrFactory.fromFileSystem
public static Chainr fromFileSystem( String chainrSpecFilePath, ChainrInstantiator chainrInstantiator ) { """ Builds a Chainr instance using the spec described in the data via the file path that is passed in. @param chainrSpecFilePath The file path that points to the chainr spec. @param chainrInstantiator the ChainrInstantiator to use to initialze the Chainr instance @return a Chainr instance """ Object chainrSpec = JsonUtils.filepathToObject( chainrSpecFilePath ); return getChainr( chainrInstantiator, chainrSpec ); }
java
public static Chainr fromFileSystem( String chainrSpecFilePath, ChainrInstantiator chainrInstantiator ) { Object chainrSpec = JsonUtils.filepathToObject( chainrSpecFilePath ); return getChainr( chainrInstantiator, chainrSpec ); }
[ "public", "static", "Chainr", "fromFileSystem", "(", "String", "chainrSpecFilePath", ",", "ChainrInstantiator", "chainrInstantiator", ")", "{", "Object", "chainrSpec", "=", "JsonUtils", ".", "filepathToObject", "(", "chainrSpecFilePath", ")", ";", "return", "getChainr", "(", "chainrInstantiator", ",", "chainrSpec", ")", ";", "}" ]
Builds a Chainr instance using the spec described in the data via the file path that is passed in. @param chainrSpecFilePath The file path that points to the chainr spec. @param chainrInstantiator the ChainrInstantiator to use to initialze the Chainr instance @return a Chainr instance
[ "Builds", "a", "Chainr", "instance", "using", "the", "spec", "described", "in", "the", "data", "via", "the", "file", "path", "that", "is", "passed", "in", "." ]
train
https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java#L67-L70
phax/ph-javacc-maven-plugin
src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java
AbstractJavaCCMojo.findSourceFile
private File findSourceFile (final String filename) { """ Determines whether the specified source file is already present in any of the compile source roots registered with the current Maven project. @param filename The source filename to check, relative to a source root, must not be <code>null</code>. @return The (absolute) path to the existing source file if any, <code>null</code> otherwise. """ final Collection <File> sourceRoots = this.nonGeneratedSourceRoots; for (final File sourceRoot : sourceRoots) { final File sourceFile = new File (sourceRoot, filename); if (sourceFile.exists ()) { return sourceFile; } } return null; }
java
private File findSourceFile (final String filename) { final Collection <File> sourceRoots = this.nonGeneratedSourceRoots; for (final File sourceRoot : sourceRoots) { final File sourceFile = new File (sourceRoot, filename); if (sourceFile.exists ()) { return sourceFile; } } return null; }
[ "private", "File", "findSourceFile", "(", "final", "String", "filename", ")", "{", "final", "Collection", "<", "File", ">", "sourceRoots", "=", "this", ".", "nonGeneratedSourceRoots", ";", "for", "(", "final", "File", "sourceRoot", ":", "sourceRoots", ")", "{", "final", "File", "sourceFile", "=", "new", "File", "(", "sourceRoot", ",", "filename", ")", ";", "if", "(", "sourceFile", ".", "exists", "(", ")", ")", "{", "return", "sourceFile", ";", "}", "}", "return", "null", ";", "}" ]
Determines whether the specified source file is already present in any of the compile source roots registered with the current Maven project. @param filename The source filename to check, relative to a source root, must not be <code>null</code>. @return The (absolute) path to the existing source file if any, <code>null</code> otherwise.
[ "Determines", "whether", "the", "specified", "source", "file", "is", "already", "present", "in", "any", "of", "the", "compile", "source", "roots", "registered", "with", "the", "current", "Maven", "project", "." ]
train
https://github.com/phax/ph-javacc-maven-plugin/blob/99497a971fe59ab2289258ca7ddcfa40e651f19f/src/main/java/org/codehaus/mojo/javacc/AbstractJavaCCMojo.java#L693-L705
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RepositoryFileApi.java
RepositoryFileApi.deleteFile
public void deleteFile(Object projectIdOrPath, String filePath, String branchName, String commitMessage) throws GitLabApiException { """ Delete existing file in repository <pre><code>GitLab Endpoint: DELETE /projects/:id/repository/files</code></pre> file_path (required) - Full path to file. Ex. lib/class.rb branch_name (required) - The name of branch commit_message (required) - Commit message @param projectIdOrPath the id, path of the project, or a Project instance holding the project ID or path @param filePath full path to new file. Ex. lib/class.rb @param branchName the name of branch @param commitMessage the commit message @throws GitLabApiException if any exception occurs """ if (filePath == null) { throw new RuntimeException("filePath cannot be null"); } Form form = new Form(); addFormParam(form, isApiVersion(ApiVersion.V3) ? "branch_name" : "branch", branchName, true); addFormParam(form, "commit_message", commitMessage, true); Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); if (isApiVersion(ApiVersion.V3)) { addFormParam(form, "file_path", filePath, true); delete(expectedStatus, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files"); } else { delete(expectedStatus, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(filePath)); } }
java
public void deleteFile(Object projectIdOrPath, String filePath, String branchName, String commitMessage) throws GitLabApiException { if (filePath == null) { throw new RuntimeException("filePath cannot be null"); } Form form = new Form(); addFormParam(form, isApiVersion(ApiVersion.V3) ? "branch_name" : "branch", branchName, true); addFormParam(form, "commit_message", commitMessage, true); Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); if (isApiVersion(ApiVersion.V3)) { addFormParam(form, "file_path", filePath, true); delete(expectedStatus, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files"); } else { delete(expectedStatus, form.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "files", urlEncode(filePath)); } }
[ "public", "void", "deleteFile", "(", "Object", "projectIdOrPath", ",", "String", "filePath", ",", "String", "branchName", ",", "String", "commitMessage", ")", "throws", "GitLabApiException", "{", "if", "(", "filePath", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"filePath cannot be null\"", ")", ";", "}", "Form", "form", "=", "new", "Form", "(", ")", ";", "addFormParam", "(", "form", ",", "isApiVersion", "(", "ApiVersion", ".", "V3", ")", "?", "\"branch_name\"", ":", "\"branch\"", ",", "branchName", ",", "true", ")", ";", "addFormParam", "(", "form", ",", "\"commit_message\"", ",", "commitMessage", ",", "true", ")", ";", "Response", ".", "Status", "expectedStatus", "=", "(", "isApiVersion", "(", "ApiVersion", ".", "V3", ")", "?", "Response", ".", "Status", ".", "OK", ":", "Response", ".", "Status", ".", "NO_CONTENT", ")", ";", "if", "(", "isApiVersion", "(", "ApiVersion", ".", "V3", ")", ")", "{", "addFormParam", "(", "form", ",", "\"file_path\"", ",", "filePath", ",", "true", ")", ";", "delete", "(", "expectedStatus", ",", "form", ".", "asMap", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"repository\"", ",", "\"files\"", ")", ";", "}", "else", "{", "delete", "(", "expectedStatus", ",", "form", ".", "asMap", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"repository\"", ",", "\"files\"", ",", "urlEncode", "(", "filePath", ")", ")", ";", "}", "}" ]
Delete existing file in repository <pre><code>GitLab Endpoint: DELETE /projects/:id/repository/files</code></pre> file_path (required) - Full path to file. Ex. lib/class.rb branch_name (required) - The name of branch commit_message (required) - Commit message @param projectIdOrPath the id, path of the project, or a Project instance holding the project ID or path @param filePath full path to new file. Ex. lib/class.rb @param branchName the name of branch @param commitMessage the commit message @throws GitLabApiException if any exception occurs
[ "Delete", "existing", "file", "in", "repository" ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryFileApi.java#L317-L334
SonarSource/sonarqube
sonar-duplications/src/main/java/org/sonar/duplications/detector/original/BlocksGroup.java
BlocksGroup.subsumedBy
private static boolean subsumedBy(BlocksGroup group1, BlocksGroup group2, int indexCorrection) { """ One group is subsumed by another group, when each block from first group has corresponding block from second group with same resource id and with corrected index. """ List<Block> list1 = group1.blocks; List<Block> list2 = group2.blocks; int i = 0; int j = 0; while (i < list1.size() && j < list2.size()) { Block block1 = list1.get(i); Block block2 = list2.get(j); int c = RESOURCE_ID_COMPARATOR.compare(block1.getResourceId(), block2.getResourceId()); if (c != 0) { j++; continue; } c = block1.getIndexInFile() - indexCorrection - block2.getIndexInFile(); if (c < 0) { // list1[i] < list2[j] break; } if (c != 0) { // list1[i] != list2[j] j++; } if (c == 0) { // list1[i] == list2[j] i++; j++; } } return i == list1.size(); }
java
private static boolean subsumedBy(BlocksGroup group1, BlocksGroup group2, int indexCorrection) { List<Block> list1 = group1.blocks; List<Block> list2 = group2.blocks; int i = 0; int j = 0; while (i < list1.size() && j < list2.size()) { Block block1 = list1.get(i); Block block2 = list2.get(j); int c = RESOURCE_ID_COMPARATOR.compare(block1.getResourceId(), block2.getResourceId()); if (c != 0) { j++; continue; } c = block1.getIndexInFile() - indexCorrection - block2.getIndexInFile(); if (c < 0) { // list1[i] < list2[j] break; } if (c != 0) { // list1[i] != list2[j] j++; } if (c == 0) { // list1[i] == list2[j] i++; j++; } } return i == list1.size(); }
[ "private", "static", "boolean", "subsumedBy", "(", "BlocksGroup", "group1", ",", "BlocksGroup", "group2", ",", "int", "indexCorrection", ")", "{", "List", "<", "Block", ">", "list1", "=", "group1", ".", "blocks", ";", "List", "<", "Block", ">", "list2", "=", "group2", ".", "blocks", ";", "int", "i", "=", "0", ";", "int", "j", "=", "0", ";", "while", "(", "i", "<", "list1", ".", "size", "(", ")", "&&", "j", "<", "list2", ".", "size", "(", ")", ")", "{", "Block", "block1", "=", "list1", ".", "get", "(", "i", ")", ";", "Block", "block2", "=", "list2", ".", "get", "(", "j", ")", ";", "int", "c", "=", "RESOURCE_ID_COMPARATOR", ".", "compare", "(", "block1", ".", "getResourceId", "(", ")", ",", "block2", ".", "getResourceId", "(", ")", ")", ";", "if", "(", "c", "!=", "0", ")", "{", "j", "++", ";", "continue", ";", "}", "c", "=", "block1", ".", "getIndexInFile", "(", ")", "-", "indexCorrection", "-", "block2", ".", "getIndexInFile", "(", ")", ";", "if", "(", "c", "<", "0", ")", "{", "// list1[i] < list2[j]", "break", ";", "}", "if", "(", "c", "!=", "0", ")", "{", "// list1[i] != list2[j]", "j", "++", ";", "}", "if", "(", "c", "==", "0", ")", "{", "// list1[i] == list2[j]", "i", "++", ";", "j", "++", ";", "}", "}", "return", "i", "==", "list1", ".", "size", "(", ")", ";", "}" ]
One group is subsumed by another group, when each block from first group has corresponding block from second group with same resource id and with corrected index.
[ "One", "group", "is", "subsumed", "by", "another", "group", "when", "each", "block", "from", "first", "group", "has", "corresponding", "block", "from", "second", "group", "with", "same", "resource", "id", "and", "with", "corrected", "index", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-duplications/src/main/java/org/sonar/duplications/detector/original/BlocksGroup.java#L138-L167
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsADECache.java
CmsADECache.setCacheContainerPage
public void setCacheContainerPage(String key, CmsXmlContainerPage containerPage, boolean online) { """ Caches the given container page under the given key and for the given project.<p> @param key the cache key @param containerPage the object to cache @param online if to cache in online or offline project """ try { m_lock.writeLock().lock(); //System.out.println("caching page:" + containerPage.getFile().getRootPath()); if (online) { m_containerPagesOnline.put(key, containerPage); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_CACHE_SET_ONLINE_2, new Object[] {key, containerPage})); } } else { m_containerPagesOffline.put(key, containerPage); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_CACHE_SET_OFFLINE_2, new Object[] {key, containerPage})); } } } finally { m_lock.writeLock().unlock(); } }
java
public void setCacheContainerPage(String key, CmsXmlContainerPage containerPage, boolean online) { try { m_lock.writeLock().lock(); //System.out.println("caching page:" + containerPage.getFile().getRootPath()); if (online) { m_containerPagesOnline.put(key, containerPage); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_CACHE_SET_ONLINE_2, new Object[] {key, containerPage})); } } else { m_containerPagesOffline.put(key, containerPage); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_DEBUG_CACHE_SET_OFFLINE_2, new Object[] {key, containerPage})); } } } finally { m_lock.writeLock().unlock(); } }
[ "public", "void", "setCacheContainerPage", "(", "String", "key", ",", "CmsXmlContainerPage", "containerPage", ",", "boolean", "online", ")", "{", "try", "{", "m_lock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "//System.out.println(\"caching page:\" + containerPage.getFile().getRootPath());", "if", "(", "online", ")", "{", "m_containerPagesOnline", ".", "put", "(", "key", ",", "containerPage", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_DEBUG_CACHE_SET_ONLINE_2", ",", "new", "Object", "[", "]", "{", "key", ",", "containerPage", "}", ")", ")", ";", "}", "}", "else", "{", "m_containerPagesOffline", ".", "put", "(", "key", ",", "containerPage", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "LOG_DEBUG_CACHE_SET_OFFLINE_2", ",", "new", "Object", "[", "]", "{", "key", ",", "containerPage", "}", ")", ")", ";", "}", "}", "}", "finally", "{", "m_lock", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
Caches the given container page under the given key and for the given project.<p> @param key the cache key @param containerPage the object to cache @param online if to cache in online or offline project
[ "Caches", "the", "given", "container", "page", "under", "the", "given", "key", "and", "for", "the", "given", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADECache.java#L249-L275
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/GPXRead.java
GPXRead.readGPX
public static void readGPX(Connection connection, String fileName) throws IOException, SQLException { """ Copy data from GPX File into a new table in specified connection. @param connection @param fileName @throws IOException @throws SQLException """ final String name = URIUtilities.fileFromString(fileName).getName(); String tableName = name.substring(0, name.lastIndexOf(".")).toUpperCase(); if (tableName.matches("^[a-zA-Z][a-zA-Z0-9_]*$")) { readGPX(connection, fileName, tableName); } else { throw new SQLException("The file name contains unsupported characters"); } }
java
public static void readGPX(Connection connection, String fileName) throws IOException, SQLException { final String name = URIUtilities.fileFromString(fileName).getName(); String tableName = name.substring(0, name.lastIndexOf(".")).toUpperCase(); if (tableName.matches("^[a-zA-Z][a-zA-Z0-9_]*$")) { readGPX(connection, fileName, tableName); } else { throw new SQLException("The file name contains unsupported characters"); } }
[ "public", "static", "void", "readGPX", "(", "Connection", "connection", ",", "String", "fileName", ")", "throws", "IOException", ",", "SQLException", "{", "final", "String", "name", "=", "URIUtilities", ".", "fileFromString", "(", "fileName", ")", ".", "getName", "(", ")", ";", "String", "tableName", "=", "name", ".", "substring", "(", "0", ",", "name", ".", "lastIndexOf", "(", "\".\"", ")", ")", ".", "toUpperCase", "(", ")", ";", "if", "(", "tableName", ".", "matches", "(", "\"^[a-zA-Z][a-zA-Z0-9_]*$\"", ")", ")", "{", "readGPX", "(", "connection", ",", "fileName", ",", "tableName", ")", ";", "}", "else", "{", "throw", "new", "SQLException", "(", "\"The file name contains unsupported characters\"", ")", ";", "}", "}" ]
Copy data from GPX File into a new table in specified connection. @param connection @param fileName @throws IOException @throws SQLException
[ "Copy", "data", "from", "GPX", "File", "into", "a", "new", "table", "in", "specified", "connection", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/GPXRead.java#L94-L102
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.addGroupMember
public GitlabGroupMember addGroupMember(GitlabGroup group, GitlabUser user, GitlabAccessLevel accessLevel) throws IOException { """ Add a group member. @param group the GitlabGroup @param user the GitlabUser @param accessLevel the GitlabAccessLevel @return the GitlabGroupMember @throws IOException on gitlab api call error """ return addGroupMember(group.getId(), user.getId(), accessLevel); }
java
public GitlabGroupMember addGroupMember(GitlabGroup group, GitlabUser user, GitlabAccessLevel accessLevel) throws IOException { return addGroupMember(group.getId(), user.getId(), accessLevel); }
[ "public", "GitlabGroupMember", "addGroupMember", "(", "GitlabGroup", "group", ",", "GitlabUser", "user", ",", "GitlabAccessLevel", "accessLevel", ")", "throws", "IOException", "{", "return", "addGroupMember", "(", "group", ".", "getId", "(", ")", ",", "user", ".", "getId", "(", ")", ",", "accessLevel", ")", ";", "}" ]
Add a group member. @param group the GitlabGroup @param user the GitlabUser @param accessLevel the GitlabAccessLevel @return the GitlabGroupMember @throws IOException on gitlab api call error
[ "Add", "a", "group", "member", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L719-L721
jMetal/jMetal
jmetal-exec/src/main/java/org/uma/jmetal/experiment/ZDTScalabilityIStudy2.java
ZDTScalabilityIStudy2.configureAlgorithmList
static List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> configureAlgorithmList( List<ExperimentProblem<DoubleSolution>> problemList) { """ The algorithm list is composed of pairs {@link Algorithm} + {@link Problem} which form part of a {@link ExperimentAlgorithm}, which is a decorator for class {@link Algorithm}. The {@link ExperimentAlgorithm} has an optional tag component, that can be set as it is shown in this example, where four variants of a same algorithm are defined. """ List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> algorithms = new ArrayList<>(); for (int run = 0; run < INDEPENDENT_RUNS; run++) { for (int i = 0; i < problemList.size(); i++) { double mutationProbability = 1.0 / problemList.get(i).getProblem().getNumberOfVariables(); double mutationDistributionIndex = 20.0; Algorithm<List<DoubleSolution>> algorithm = new SMPSOBuilder( (DoubleProblem) problemList.get(i).getProblem(), new CrowdingDistanceArchive<DoubleSolution>(100)) .setMutation(new PolynomialMutation(mutationProbability, mutationDistributionIndex)) .setMaxIterations(250) .setSwarmSize(100) .setSolutionListEvaluator(new SequentialSolutionListEvaluator<DoubleSolution>()) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<DoubleSolution>( problemList.get(i).getProblem(), new SBXCrossover(1.0, 20.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 20.0), 100) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new SPEA2Builder<DoubleSolution>( problemList.get(i).getProblem(), new SBXCrossover(1.0, 10.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 20.0)) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } } return algorithms; }
java
static List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> configureAlgorithmList( List<ExperimentProblem<DoubleSolution>> problemList) { List<ExperimentAlgorithm<DoubleSolution, List<DoubleSolution>>> algorithms = new ArrayList<>(); for (int run = 0; run < INDEPENDENT_RUNS; run++) { for (int i = 0; i < problemList.size(); i++) { double mutationProbability = 1.0 / problemList.get(i).getProblem().getNumberOfVariables(); double mutationDistributionIndex = 20.0; Algorithm<List<DoubleSolution>> algorithm = new SMPSOBuilder( (DoubleProblem) problemList.get(i).getProblem(), new CrowdingDistanceArchive<DoubleSolution>(100)) .setMutation(new PolynomialMutation(mutationProbability, mutationDistributionIndex)) .setMaxIterations(250) .setSwarmSize(100) .setSolutionListEvaluator(new SequentialSolutionListEvaluator<DoubleSolution>()) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new NSGAIIBuilder<DoubleSolution>( problemList.get(i).getProblem(), new SBXCrossover(1.0, 20.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 20.0), 100) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } for (int i = 0; i < problemList.size(); i++) { Algorithm<List<DoubleSolution>> algorithm = new SPEA2Builder<DoubleSolution>( problemList.get(i).getProblem(), new SBXCrossover(1.0, 10.0), new PolynomialMutation(1.0 / problemList.get(i).getProblem().getNumberOfVariables(), 20.0)) .build(); algorithms.add(new ExperimentAlgorithm<>(algorithm, problemList.get(i), run)); } } return algorithms; }
[ "static", "List", "<", "ExperimentAlgorithm", "<", "DoubleSolution", ",", "List", "<", "DoubleSolution", ">", ">", ">", "configureAlgorithmList", "(", "List", "<", "ExperimentProblem", "<", "DoubleSolution", ">", ">", "problemList", ")", "{", "List", "<", "ExperimentAlgorithm", "<", "DoubleSolution", ",", "List", "<", "DoubleSolution", ">", ">", ">", "algorithms", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "run", "=", "0", ";", "run", "<", "INDEPENDENT_RUNS", ";", "run", "++", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "problemList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "double", "mutationProbability", "=", "1.0", "/", "problemList", ".", "get", "(", "i", ")", ".", "getProblem", "(", ")", ".", "getNumberOfVariables", "(", ")", ";", "double", "mutationDistributionIndex", "=", "20.0", ";", "Algorithm", "<", "List", "<", "DoubleSolution", ">", ">", "algorithm", "=", "new", "SMPSOBuilder", "(", "(", "DoubleProblem", ")", "problemList", ".", "get", "(", "i", ")", ".", "getProblem", "(", ")", ",", "new", "CrowdingDistanceArchive", "<", "DoubleSolution", ">", "(", "100", ")", ")", ".", "setMutation", "(", "new", "PolynomialMutation", "(", "mutationProbability", ",", "mutationDistributionIndex", ")", ")", ".", "setMaxIterations", "(", "250", ")", ".", "setSwarmSize", "(", "100", ")", ".", "setSolutionListEvaluator", "(", "new", "SequentialSolutionListEvaluator", "<", "DoubleSolution", ">", "(", ")", ")", ".", "build", "(", ")", ";", "algorithms", ".", "add", "(", "new", "ExperimentAlgorithm", "<>", "(", "algorithm", ",", "problemList", ".", "get", "(", "i", ")", ",", "run", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "problemList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Algorithm", "<", "List", "<", "DoubleSolution", ">>", "algorithm", "=", "new", "NSGAIIBuilder", "<", "DoubleSolution", ">", "(", "problemList", ".", "get", "(", "i", ")", ".", "getProblem", "(", ")", ",", "new", "SBXCrossover", "(", "1.0", ",", "20.0", ")", ",", "new", "PolynomialMutation", "(", "1.0", "/", "problemList", ".", "get", "(", "i", ")", ".", "getProblem", "(", ")", ".", "getNumberOfVariables", "(", ")", ",", "20.0", ")", ",", "100", ")", ".", "build", "(", ")", ";", "algorithms", ".", "add", "(", "new", "ExperimentAlgorithm", "<>", "(", "algorithm", ",", "problemList", ".", "get", "(", "i", ")", ",", "run", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "problemList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Algorithm", "<", "List", "<", "DoubleSolution", ">>", "algorithm", "=", "new", "SPEA2Builder", "<", "DoubleSolution", ">", "(", "problemList", ".", "get", "(", "i", ")", ".", "getProblem", "(", ")", ",", "new", "SBXCrossover", "(", "1.0", ",", "10.0", ")", ",", "new", "PolynomialMutation", "(", "1.0", "/", "problemList", ".", "get", "(", "i", ")", ".", "getProblem", "(", ")", ".", "getNumberOfVariables", "(", ")", ",", "20.0", ")", ")", ".", "build", "(", ")", ";", "algorithms", ".", "add", "(", "new", "ExperimentAlgorithm", "<>", "(", "algorithm", ",", "problemList", ".", "get", "(", "i", ")", ",", "run", ")", ")", ";", "}", "}", "return", "algorithms", ";", "}" ]
The algorithm list is composed of pairs {@link Algorithm} + {@link Problem} which form part of a {@link ExperimentAlgorithm}, which is a decorator for class {@link Algorithm}. The {@link ExperimentAlgorithm} has an optional tag component, that can be set as it is shown in this example, where four variants of a same algorithm are defined.
[ "The", "algorithm", "list", "is", "composed", "of", "pairs", "{" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-exec/src/main/java/org/uma/jmetal/experiment/ZDTScalabilityIStudy2.java#L103-L144
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.checkRole
public void checkRole(CmsRequestContext context, CmsRole role) throws CmsRoleViolationException { """ Checks if the user of the current context has permissions to impersonate the given role.<p> If the organizational unit is <code>null</code>, this method will check if the given user has the given role for at least one organizational unit.<p> @param context the current request context @param role the role to check @throws CmsRoleViolationException if the user does not have the required role permissions """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, role); } finally { dbc.clear(); } }
java
public void checkRole(CmsRequestContext context, CmsRole role) throws CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkRole(dbc, role); } finally { dbc.clear(); } }
[ "public", "void", "checkRole", "(", "CmsRequestContext", "context", ",", "CmsRole", "role", ")", "throws", "CmsRoleViolationException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "try", "{", "checkRole", "(", "dbc", ",", "role", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "}" ]
Checks if the user of the current context has permissions to impersonate the given role.<p> If the organizational unit is <code>null</code>, this method will check if the given user has the given role for at least one organizational unit.<p> @param context the current request context @param role the role to check @throws CmsRoleViolationException if the user does not have the required role permissions
[ "Checks", "if", "the", "user", "of", "the", "current", "context", "has", "permissions", "to", "impersonate", "the", "given", "role", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L584-L592
alrocar/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java
POIProxy.getFeatures
public ArrayList<JTSFeature> getFeatures(String id, int z, int x, int y, List<Param> optionalParams) throws Exception { """ This method is used to get the pois from a service and return a list of {@link JTSFeature} document with the data retrieved given a Z/X/Y tile. @param id The id of the service @param z The zoom level @param x The x tile @param y The y tile @return a list of {@link JTSFeature} """ DescribeService describeService = getDescribeServiceByID(id); Extent e1 = TileConversor.tileOSMMercatorBounds(x, y, z); double[] minXY = ConversionCoords.reproject(e1.getMinX(), e1.getMinY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); double[] maxXY = ConversionCoords.reproject(e1.getMaxX(), e1.getMaxY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); return getFeatures(id, optionalParams, describeService, minXY[0], minXY[1], maxXY[0], maxXY[1], 0, 0); }
java
public ArrayList<JTSFeature> getFeatures(String id, int z, int x, int y, List<Param> optionalParams) throws Exception { DescribeService describeService = getDescribeServiceByID(id); Extent e1 = TileConversor.tileOSMMercatorBounds(x, y, z); double[] minXY = ConversionCoords.reproject(e1.getMinX(), e1.getMinY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); double[] maxXY = ConversionCoords.reproject(e1.getMaxX(), e1.getMaxY(), CRSFactory.getCRS(MERCATOR_SRS), CRSFactory.getCRS(GEODETIC_SRS)); return getFeatures(id, optionalParams, describeService, minXY[0], minXY[1], maxXY[0], maxXY[1], 0, 0); }
[ "public", "ArrayList", "<", "JTSFeature", ">", "getFeatures", "(", "String", "id", ",", "int", "z", ",", "int", "x", ",", "int", "y", ",", "List", "<", "Param", ">", "optionalParams", ")", "throws", "Exception", "{", "DescribeService", "describeService", "=", "getDescribeServiceByID", "(", "id", ")", ";", "Extent", "e1", "=", "TileConversor", ".", "tileOSMMercatorBounds", "(", "x", ",", "y", ",", "z", ")", ";", "double", "[", "]", "minXY", "=", "ConversionCoords", ".", "reproject", "(", "e1", ".", "getMinX", "(", ")", ",", "e1", ".", "getMinY", "(", ")", ",", "CRSFactory", ".", "getCRS", "(", "MERCATOR_SRS", ")", ",", "CRSFactory", ".", "getCRS", "(", "GEODETIC_SRS", ")", ")", ";", "double", "[", "]", "maxXY", "=", "ConversionCoords", ".", "reproject", "(", "e1", ".", "getMaxX", "(", ")", ",", "e1", ".", "getMaxY", "(", ")", ",", "CRSFactory", ".", "getCRS", "(", "MERCATOR_SRS", ")", ",", "CRSFactory", ".", "getCRS", "(", "GEODETIC_SRS", ")", ")", ";", "return", "getFeatures", "(", "id", ",", "optionalParams", ",", "describeService", ",", "minXY", "[", "0", "]", ",", "minXY", "[", "1", "]", ",", "maxXY", "[", "0", "]", ",", "maxXY", "[", "1", "]", ",", "0", ",", "0", ")", ";", "}" ]
This method is used to get the pois from a service and return a list of {@link JTSFeature} document with the data retrieved given a Z/X/Y tile. @param id The id of the service @param z The zoom level @param x The x tile @param y The y tile @return a list of {@link JTSFeature}
[ "This", "method", "is", "used", "to", "get", "the", "pois", "from", "a", "service", "and", "return", "a", "list", "of", "{", "@link", "JTSFeature", "}", "document", "with", "the", "data", "retrieved", "given", "a", "Z", "/", "X", "/", "Y", "tile", "." ]
train
https://github.com/alrocar/POIProxy/blob/e1dabe738a862478b2580e90d5fc4209a2997868/es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/proxy/POIProxy.java#L255-L267
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java
VisitRegistry.markVisited
public void markVisited(int from, int upTo) { """ Marks as visited a range of locations. @param from the start of labeling (inclusive). @param upTo the end of labeling (exclusive). """ if (checkBounds(from) && checkBounds(upTo - 1)) { for (int i = from; i < upTo; i++) { this.markVisited(i); } } else { throw new RuntimeException("The location " + from + "," + upTo + " out of bounds [0," + (this.registry.length - 1) + "]"); } }
java
public void markVisited(int from, int upTo) { if (checkBounds(from) && checkBounds(upTo - 1)) { for (int i = from; i < upTo; i++) { this.markVisited(i); } } else { throw new RuntimeException("The location " + from + "," + upTo + " out of bounds [0," + (this.registry.length - 1) + "]"); } }
[ "public", "void", "markVisited", "(", "int", "from", ",", "int", "upTo", ")", "{", "if", "(", "checkBounds", "(", "from", ")", "&&", "checkBounds", "(", "upTo", "-", "1", ")", ")", "{", "for", "(", "int", "i", "=", "from", ";", "i", "<", "upTo", ";", "i", "++", ")", "{", "this", ".", "markVisited", "(", "i", ")", ";", "}", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"The location \"", "+", "from", "+", "\",\"", "+", "upTo", "+", "\" out of bounds [0,\"", "+", "(", "this", ".", "registry", ".", "length", "-", "1", ")", "+", "\"]\"", ")", ";", "}", "}" ]
Marks as visited a range of locations. @param from the start of labeling (inclusive). @param upTo the end of labeling (exclusive).
[ "Marks", "as", "visited", "a", "range", "of", "locations", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/registry/VisitRegistry.java#L67-L77
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java
PropertiesConfigHelper.getCustomBundleBooleanProperty
public boolean getCustomBundleBooleanProperty(String bundleName, String key) { """ Returns the value of the custom bundle boolean property, or <b>false</b> if no value is defined @param bundleName the bundle name @param key the key of the property @return the value of the custom bundle property """ return Boolean.parseBoolean(props.getProperty( prefix + PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_PROPERTY + bundleName + key, "false")); }
java
public boolean getCustomBundleBooleanProperty(String bundleName, String key) { return Boolean.parseBoolean(props.getProperty( prefix + PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_PROPERTY + bundleName + key, "false")); }
[ "public", "boolean", "getCustomBundleBooleanProperty", "(", "String", "bundleName", ",", "String", "key", ")", "{", "return", "Boolean", ".", "parseBoolean", "(", "props", ".", "getProperty", "(", "prefix", "+", "PropertiesBundleConstant", ".", "BUNDLE_FACTORY_CUSTOM_PROPERTY", "+", "bundleName", "+", "key", ",", "\"false\"", ")", ")", ";", "}" ]
Returns the value of the custom bundle boolean property, or <b>false</b> if no value is defined @param bundleName the bundle name @param key the key of the property @return the value of the custom bundle property
[ "Returns", "the", "value", "of", "the", "custom", "bundle", "boolean", "property", "or", "<b", ">", "false<", "/", "b", ">", "if", "no", "value", "is", "defined" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java#L167-L170
liyiorg/weixin-popular
src/main/java/weixin/popular/util/WxaUtil.java
WxaUtil.validateUserInfo
public static WxaUserInfo validateUserInfo(String session_key, String rawData, String signature) { """ 校验wx.getUserInfo rawData 签名,同时返回 userinfo @param session_key session_key @param rawData rawData @param signature signature @return WxaUserInfo 签名校验失败时,返回null """ try { if (DigestUtils.shaHex(rawData + session_key).equals(signature)) { return JsonUtil.parseObject(rawData, WxaUserInfo.class); } } catch (Exception e) { logger.error("", e); } return null; }
java
public static WxaUserInfo validateUserInfo(String session_key, String rawData, String signature) { try { if (DigestUtils.shaHex(rawData + session_key).equals(signature)) { return JsonUtil.parseObject(rawData, WxaUserInfo.class); } } catch (Exception e) { logger.error("", e); } return null; }
[ "public", "static", "WxaUserInfo", "validateUserInfo", "(", "String", "session_key", ",", "String", "rawData", ",", "String", "signature", ")", "{", "try", "{", "if", "(", "DigestUtils", ".", "shaHex", "(", "rawData", "+", "session_key", ")", ".", "equals", "(", "signature", ")", ")", "{", "return", "JsonUtil", ".", "parseObject", "(", "rawData", ",", "WxaUserInfo", ".", "class", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"\"", ",", "e", ")", ";", "}", "return", "null", ";", "}" ]
校验wx.getUserInfo rawData 签名,同时返回 userinfo @param session_key session_key @param rawData rawData @param signature signature @return WxaUserInfo 签名校验失败时,返回null
[ "校验wx", ".", "getUserInfo", "rawData", "签名", "同时返回", "userinfo" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/WxaUtil.java#L63-L72
EMCECS/nfs-client-java
src/main/java/com/emc/ecs/nfsclient/network/Connection.java
Connection.bindToPrivilegedPort
private Channel bindToPrivilegedPort() throws RpcException { """ This attempts to bind to privileged ports, starting with 1023 and working downwards, and returns when the first binding succeeds. <p> Some NFS servers apparently may require that some requests originate on an Internet port below IPPORT_RESERVED (1024). This is generally not used, though, as the client then has to run as a user authorized for privileged, which is dangerous. It is also not generally needed. </p> @return <ul> <li><code>true</code> if the binding succeeds,</li> <li><code>false</code> otherwise.</li> </ul> @throws RpcException If an exception occurs, or if no binding succeeds. """ System.out.println("Attempting to use privileged port."); for (int port = 1023; port > 0; --port) { try { ChannelPipeline pipeline = _clientBootstrap.getPipelineFactory().getPipeline(); Channel channel = _clientBootstrap.getFactory().newChannel(pipeline); channel.getConfig().setOptions(_clientBootstrap.getOptions()); ChannelFuture bindFuture = channel.bind(new InetSocketAddress(port)).awaitUninterruptibly(); if (bindFuture.isSuccess()) { System.out.println("Success! Bound to port " + port); return bindFuture.getChannel(); } } catch (Exception e) { String msg = String.format("rpc request bind error for address: %s", getRemoteAddress()); throw new RpcException(RpcStatus.NETWORK_ERROR, msg, e); } } throw new RpcException(RpcStatus.LOCAL_BINDING_ERROR, String.format("Cannot bind a port < 1024: %s", getRemoteAddress())); }
java
private Channel bindToPrivilegedPort() throws RpcException { System.out.println("Attempting to use privileged port."); for (int port = 1023; port > 0; --port) { try { ChannelPipeline pipeline = _clientBootstrap.getPipelineFactory().getPipeline(); Channel channel = _clientBootstrap.getFactory().newChannel(pipeline); channel.getConfig().setOptions(_clientBootstrap.getOptions()); ChannelFuture bindFuture = channel.bind(new InetSocketAddress(port)).awaitUninterruptibly(); if (bindFuture.isSuccess()) { System.out.println("Success! Bound to port " + port); return bindFuture.getChannel(); } } catch (Exception e) { String msg = String.format("rpc request bind error for address: %s", getRemoteAddress()); throw new RpcException(RpcStatus.NETWORK_ERROR, msg, e); } } throw new RpcException(RpcStatus.LOCAL_BINDING_ERROR, String.format("Cannot bind a port < 1024: %s", getRemoteAddress())); }
[ "private", "Channel", "bindToPrivilegedPort", "(", ")", "throws", "RpcException", "{", "System", ".", "out", ".", "println", "(", "\"Attempting to use privileged port.\"", ")", ";", "for", "(", "int", "port", "=", "1023", ";", "port", ">", "0", ";", "--", "port", ")", "{", "try", "{", "ChannelPipeline", "pipeline", "=", "_clientBootstrap", ".", "getPipelineFactory", "(", ")", ".", "getPipeline", "(", ")", ";", "Channel", "channel", "=", "_clientBootstrap", ".", "getFactory", "(", ")", ".", "newChannel", "(", "pipeline", ")", ";", "channel", ".", "getConfig", "(", ")", ".", "setOptions", "(", "_clientBootstrap", ".", "getOptions", "(", ")", ")", ";", "ChannelFuture", "bindFuture", "=", "channel", ".", "bind", "(", "new", "InetSocketAddress", "(", "port", ")", ")", ".", "awaitUninterruptibly", "(", ")", ";", "if", "(", "bindFuture", ".", "isSuccess", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Success! Bound to port \"", "+", "port", ")", ";", "return", "bindFuture", ".", "getChannel", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "String", "msg", "=", "String", ".", "format", "(", "\"rpc request bind error for address: %s\"", ",", "getRemoteAddress", "(", ")", ")", ";", "throw", "new", "RpcException", "(", "RpcStatus", ".", "NETWORK_ERROR", ",", "msg", ",", "e", ")", ";", "}", "}", "throw", "new", "RpcException", "(", "RpcStatus", ".", "LOCAL_BINDING_ERROR", ",", "String", ".", "format", "(", "\"Cannot bind a port < 1024: %s\"", ",", "getRemoteAddress", "(", ")", ")", ")", ";", "}" ]
This attempts to bind to privileged ports, starting with 1023 and working downwards, and returns when the first binding succeeds. <p> Some NFS servers apparently may require that some requests originate on an Internet port below IPPORT_RESERVED (1024). This is generally not used, though, as the client then has to run as a user authorized for privileged, which is dangerous. It is also not generally needed. </p> @return <ul> <li><code>true</code> if the binding succeeds,</li> <li><code>false</code> otherwise.</li> </ul> @throws RpcException If an exception occurs, or if no binding succeeds.
[ "This", "attempts", "to", "bind", "to", "privileged", "ports", "starting", "with", "1023", "and", "working", "downwards", "and", "returns", "when", "the", "first", "binding", "succeeds", "." ]
train
https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/network/Connection.java#L399-L419
google/closure-templates
java/src/com/google/template/soy/sharedpasses/render/RenderVisitor.java
RenderVisitor.renderBlock
private void renderBlock(BlockNode block, Appendable to) { """ Private helper to render the children of a block into a separate string (not directly appended to the current output buffer). @param block The block whose children are to be rendered. """ pushOutputBuf(to); visitChildren(block); popOutputBuf(); }
java
private void renderBlock(BlockNode block, Appendable to) { pushOutputBuf(to); visitChildren(block); popOutputBuf(); }
[ "private", "void", "renderBlock", "(", "BlockNode", "block", ",", "Appendable", "to", ")", "{", "pushOutputBuf", "(", "to", ")", ";", "visitChildren", "(", "block", ")", ";", "popOutputBuf", "(", ")", ";", "}" ]
Private helper to render the children of a block into a separate string (not directly appended to the current output buffer). @param block The block whose children are to be rendered.
[ "Private", "helper", "to", "render", "the", "children", "of", "a", "block", "into", "a", "separate", "string", "(", "not", "directly", "appended", "to", "the", "current", "output", "buffer", ")", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/sharedpasses/render/RenderVisitor.java#L742-L746
HubSpot/Singularity
SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java
SingularityClient.getRequestLogs
public Collection<SingularityS3Log> getRequestLogs(String requestId) { """ Retrieve the list of logs stored in S3 for a specific request @param requestId The request ID to search for @return A collection of {@link SingularityS3Log} """ final Function<String, String> requestUri = (host) -> String.format(S3_LOG_GET_REQUEST_LOGS, getApiBase(host), requestId); final String type = String.format("S3 logs for request %s", requestId); return getCollection(requestUri, type, S3_LOG_COLLECTION); }
java
public Collection<SingularityS3Log> getRequestLogs(String requestId) { final Function<String, String> requestUri = (host) -> String.format(S3_LOG_GET_REQUEST_LOGS, getApiBase(host), requestId); final String type = String.format("S3 logs for request %s", requestId); return getCollection(requestUri, type, S3_LOG_COLLECTION); }
[ "public", "Collection", "<", "SingularityS3Log", ">", "getRequestLogs", "(", "String", "requestId", ")", "{", "final", "Function", "<", "String", ",", "String", ">", "requestUri", "=", "(", "host", ")", "-", ">", "String", ".", "format", "(", "S3_LOG_GET_REQUEST_LOGS", ",", "getApiBase", "(", "host", ")", ",", "requestId", ")", ";", "final", "String", "type", "=", "String", ".", "format", "(", "\"S3 logs for request %s\"", ",", "requestId", ")", ";", "return", "getCollection", "(", "requestUri", ",", "type", ",", "S3_LOG_COLLECTION", ")", ";", "}" ]
Retrieve the list of logs stored in S3 for a specific request @param requestId The request ID to search for @return A collection of {@link SingularityS3Log}
[ "Retrieve", "the", "list", "of", "logs", "stored", "in", "S3", "for", "a", "specific", "request" ]
train
https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L1355-L1361
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/SyncRemoteTable.java
SyncRemoteTable.doSetHandle
public Object doSetHandle(Object bookmark, int iOpenMode, String strFields, int iHandleType) throws DBException, RemoteException { """ Reposition to this record using this bookmark.<p> JiniTables can't access the datasource on the server, so they must use the bookmark. """ synchronized(m_objSync) { return m_tableRemote.doSetHandle(bookmark, iOpenMode, strFields, iHandleType); } }
java
public Object doSetHandle(Object bookmark, int iOpenMode, String strFields, int iHandleType) throws DBException, RemoteException { synchronized(m_objSync) { return m_tableRemote.doSetHandle(bookmark, iOpenMode, strFields, iHandleType); } }
[ "public", "Object", "doSetHandle", "(", "Object", "bookmark", ",", "int", "iOpenMode", ",", "String", "strFields", ",", "int", "iHandleType", ")", "throws", "DBException", ",", "RemoteException", "{", "synchronized", "(", "m_objSync", ")", "{", "return", "m_tableRemote", ".", "doSetHandle", "(", "bookmark", ",", "iOpenMode", ",", "strFields", ",", "iHandleType", ")", ";", "}", "}" ]
Reposition to this record using this bookmark.<p> JiniTables can't access the datasource on the server, so they must use the bookmark.
[ "Reposition", "to", "this", "record", "using", "this", "bookmark", ".", "<p", ">", "JiniTables", "can", "t", "access", "the", "datasource", "on", "the", "server", "so", "they", "must", "use", "the", "bookmark", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/SyncRemoteTable.java#L190-L196
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java
AiMesh.getTexCoordU
public float getTexCoordU(int vertex, int coords) { """ Returns the u component of a coordinate from a texture coordinate set. @param vertex the vertex index @param coords the texture coordinate set @return the u component """ if (!hasTexCoords(coords)) { throw new IllegalStateException( "mesh has no texture coordinate set " + coords); } checkVertexIndexBounds(vertex); /* bound checks for coords are done by java for us */ return m_texcoords[coords].getFloat( vertex * m_numUVComponents[coords] * SIZEOF_FLOAT); }
java
public float getTexCoordU(int vertex, int coords) { if (!hasTexCoords(coords)) { throw new IllegalStateException( "mesh has no texture coordinate set " + coords); } checkVertexIndexBounds(vertex); /* bound checks for coords are done by java for us */ return m_texcoords[coords].getFloat( vertex * m_numUVComponents[coords] * SIZEOF_FLOAT); }
[ "public", "float", "getTexCoordU", "(", "int", "vertex", ",", "int", "coords", ")", "{", "if", "(", "!", "hasTexCoords", "(", "coords", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"mesh has no texture coordinate set \"", "+", "coords", ")", ";", "}", "checkVertexIndexBounds", "(", "vertex", ")", ";", "/* bound checks for coords are done by java for us */", "return", "m_texcoords", "[", "coords", "]", ".", "getFloat", "(", "vertex", "*", "m_numUVComponents", "[", "coords", "]", "*", "SIZEOF_FLOAT", ")", ";", "}" ]
Returns the u component of a coordinate from a texture coordinate set. @param vertex the vertex index @param coords the texture coordinate set @return the u component
[ "Returns", "the", "u", "component", "of", "a", "coordinate", "from", "a", "texture", "coordinate", "set", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMesh.java#L946-L957
jenkinsci/jenkins
core/src/main/java/hudson/util/ArgumentListBuilder.java
ArgumentListBuilder.addKeyValuePairsFromPropertyString
public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver<String> vr) throws IOException { """ Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties}. @param prefix The '-D' portion of the example. Defaults to -D if null. @param properties The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which case this method becomes no-op. @param vr {@link VariableResolver} to resolve variables in properties string. @since 1.262 """ return addKeyValuePairsFromPropertyString(prefix, properties, vr, null); }
java
public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver<String> vr) throws IOException { return addKeyValuePairsFromPropertyString(prefix, properties, vr, null); }
[ "public", "ArgumentListBuilder", "addKeyValuePairsFromPropertyString", "(", "String", "prefix", ",", "String", "properties", ",", "VariableResolver", "<", "String", ">", "vr", ")", "throws", "IOException", "{", "return", "addKeyValuePairsFromPropertyString", "(", "prefix", ",", "properties", ",", "vr", ",", "null", ")", ";", "}" ]
Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties}. @param prefix The '-D' portion of the example. Defaults to -D if null. @param properties The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which case this method becomes no-op. @param vr {@link VariableResolver} to resolve variables in properties string. @since 1.262
[ "Adds", "key", "value", "pairs", "as", "-", "Dkey", "=", "value", "-", "Dkey", "=", "value", "...", "by", "parsing", "a", "given", "string", "using", "{", "@link", "Properties", "}", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/ArgumentListBuilder.java#L208-L210
arnaudroger/SimpleFlatMapper
sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/JdbcMapperFactory.java
JdbcMapperFactory.addCustomFieldMapper
public JdbcMapperFactory addCustomFieldMapper(String key, FieldMapper<ResultSet, ?> fieldMapper) { """ Associate the specified FieldMapper for the specified property. @param key the property @param fieldMapper the fieldMapper @return the current factory """ return addColumnDefinition(key, FieldMapperColumnDefinition.<JdbcColumnKey>customFieldMapperDefinition(fieldMapper)); }
java
public JdbcMapperFactory addCustomFieldMapper(String key, FieldMapper<ResultSet, ?> fieldMapper) { return addColumnDefinition(key, FieldMapperColumnDefinition.<JdbcColumnKey>customFieldMapperDefinition(fieldMapper)); }
[ "public", "JdbcMapperFactory", "addCustomFieldMapper", "(", "String", "key", ",", "FieldMapper", "<", "ResultSet", ",", "?", ">", "fieldMapper", ")", "{", "return", "addColumnDefinition", "(", "key", ",", "FieldMapperColumnDefinition", ".", "<", "JdbcColumnKey", ">", "customFieldMapperDefinition", "(", "fieldMapper", ")", ")", ";", "}" ]
Associate the specified FieldMapper for the specified property. @param key the property @param fieldMapper the fieldMapper @return the current factory
[ "Associate", "the", "specified", "FieldMapper", "for", "the", "specified", "property", "." ]
train
https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-jdbc/src/main/java/org/simpleflatmapper/jdbc/JdbcMapperFactory.java#L110-L112
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DecimalFormatSymbols.java
DecimalFormatSymbols.maybeStripMarkers
private static char maybeStripMarkers(String symbol, char fallback) { """ Attempts to strip RTL, LTR and Arabic letter markers from {@code symbol}. If the symbol's length is 1, then the first char of the symbol is returned. If the symbol's length is more than 1 and the first char is a marker, then this marker is ignored. In all other cases, {@code fallback} is returned. """ final int length = symbol.length(); if (length == 1) { return symbol.charAt(0); } if (length > 1) { char first = symbol.charAt(0); if (first =='\u200E' || first =='\u200F' || first =='\u061C') { return symbol.charAt(1); } } return fallback; }
java
private static char maybeStripMarkers(String symbol, char fallback) { final int length = symbol.length(); if (length == 1) { return symbol.charAt(0); } if (length > 1) { char first = symbol.charAt(0); if (first =='\u200E' || first =='\u200F' || first =='\u061C') { return symbol.charAt(1); } } return fallback; }
[ "private", "static", "char", "maybeStripMarkers", "(", "String", "symbol", ",", "char", "fallback", ")", "{", "final", "int", "length", "=", "symbol", ".", "length", "(", ")", ";", "if", "(", "length", "==", "1", ")", "{", "return", "symbol", ".", "charAt", "(", "0", ")", ";", "}", "if", "(", "length", ">", "1", ")", "{", "char", "first", "=", "symbol", ".", "charAt", "(", "0", ")", ";", "if", "(", "first", "==", "'", "'", "||", "first", "==", "'", "'", "||", "first", "==", "'", "'", ")", "{", "return", "symbol", ".", "charAt", "(", "1", ")", ";", "}", "}", "return", "fallback", ";", "}" ]
Attempts to strip RTL, LTR and Arabic letter markers from {@code symbol}. If the symbol's length is 1, then the first char of the symbol is returned. If the symbol's length is more than 1 and the first char is a marker, then this marker is ignored. In all other cases, {@code fallback} is returned.
[ "Attempts", "to", "strip", "RTL", "LTR", "and", "Arabic", "letter", "markers", "from", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DecimalFormatSymbols.java#L720-L734
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsXmlContentEditor.java
CmsXmlContentEditor.actionCopyElementLocale
public void actionCopyElementLocale() throws JspException { """ Performs the copy locale action.<p> @throws JspException if something goes wrong """ try { setEditorValues(getElementLocale()); if (!hasValidationErrors()) { // save content of the editor only to the temporary file writeContent(); CmsObject cloneCms = getCloneCms(); CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId(); cloneCms.getRequestContext().setCurrentProject(getCms().readProject(tempProjectId)); // remove eventual release & expiration date from temporary file to make preview work cloneCms.setDateReleased(getParamTempfile(), CmsResource.DATE_RELEASED_DEFAULT, false); cloneCms.setDateExpired(getParamTempfile(), CmsResource.DATE_EXPIRED_DEFAULT, false); } } catch (CmsException e) { // show error page showErrorPage(this, e); } }
java
public void actionCopyElementLocale() throws JspException { try { setEditorValues(getElementLocale()); if (!hasValidationErrors()) { // save content of the editor only to the temporary file writeContent(); CmsObject cloneCms = getCloneCms(); CmsUUID tempProjectId = OpenCms.getWorkplaceManager().getTempFileProjectId(); cloneCms.getRequestContext().setCurrentProject(getCms().readProject(tempProjectId)); // remove eventual release & expiration date from temporary file to make preview work cloneCms.setDateReleased(getParamTempfile(), CmsResource.DATE_RELEASED_DEFAULT, false); cloneCms.setDateExpired(getParamTempfile(), CmsResource.DATE_EXPIRED_DEFAULT, false); } } catch (CmsException e) { // show error page showErrorPage(this, e); } }
[ "public", "void", "actionCopyElementLocale", "(", ")", "throws", "JspException", "{", "try", "{", "setEditorValues", "(", "getElementLocale", "(", ")", ")", ";", "if", "(", "!", "hasValidationErrors", "(", ")", ")", "{", "// save content of the editor only to the temporary file", "writeContent", "(", ")", ";", "CmsObject", "cloneCms", "=", "getCloneCms", "(", ")", ";", "CmsUUID", "tempProjectId", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getTempFileProjectId", "(", ")", ";", "cloneCms", ".", "getRequestContext", "(", ")", ".", "setCurrentProject", "(", "getCms", "(", ")", ".", "readProject", "(", "tempProjectId", ")", ")", ";", "// remove eventual release & expiration date from temporary file to make preview work", "cloneCms", ".", "setDateReleased", "(", "getParamTempfile", "(", ")", ",", "CmsResource", ".", "DATE_RELEASED_DEFAULT", ",", "false", ")", ";", "cloneCms", ".", "setDateExpired", "(", "getParamTempfile", "(", ")", ",", "CmsResource", ".", "DATE_EXPIRED_DEFAULT", ",", "false", ")", ";", "}", "}", "catch", "(", "CmsException", "e", ")", "{", "// show error page", "showErrorPage", "(", "this", ",", "e", ")", ";", "}", "}" ]
Performs the copy locale action.<p> @throws JspException if something goes wrong
[ "Performs", "the", "copy", "locale", "action", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsXmlContentEditor.java#L334-L352
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateSecretAsync
public ServiceFuture<SecretBundle> updateSecretAsync(String vaultBaseUrl, String secretName, String secretVersion, String contentType, SecretAttributes secretAttributes, Map<String, String> tags, final ServiceCallback<SecretBundle> serviceCallback) { """ Updates the attributes associated with a specified secret in a given key vault. The UPDATE operation changes specified attributes of an existing stored secret. Attributes that are not specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation requires the secrets/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param secretVersion The version of the secret. @param contentType Type of the secret value such as a password. @param secretAttributes The secret management attributes. @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(updateSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion, contentType, secretAttributes, tags), serviceCallback); }
java
public ServiceFuture<SecretBundle> updateSecretAsync(String vaultBaseUrl, String secretName, String secretVersion, String contentType, SecretAttributes secretAttributes, Map<String, String> tags, final ServiceCallback<SecretBundle> serviceCallback) { return ServiceFuture.fromResponse(updateSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion, contentType, secretAttributes, tags), serviceCallback); }
[ "public", "ServiceFuture", "<", "SecretBundle", ">", "updateSecretAsync", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ",", "String", "secretVersion", ",", "String", "contentType", ",", "SecretAttributes", "secretAttributes", ",", "Map", "<", "String", ",", "String", ">", "tags", ",", "final", "ServiceCallback", "<", "SecretBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "updateSecretWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "secretName", ",", "secretVersion", ",", "contentType", ",", "secretAttributes", ",", "tags", ")", ",", "serviceCallback", ")", ";", "}" ]
Updates the attributes associated with a specified secret in a given key vault. The UPDATE operation changes specified attributes of an existing stored secret. Attributes that are not specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation requires the secrets/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param secretVersion The version of the secret. @param contentType Type of the secret value such as a password. @param secretAttributes The secret management attributes. @param tags Application specific metadata in the form of key-value pairs. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Updates", "the", "attributes", "associated", "with", "a", "specified", "secret", "in", "a", "given", "key", "vault", ".", "The", "UPDATE", "operation", "changes", "specified", "attributes", "of", "an", "existing", "stored", "secret", ".", "Attributes", "that", "are", "not", "specified", "in", "the", "request", "are", "left", "unchanged", ".", "The", "value", "of", "a", "secret", "itself", "cannot", "be", "changed", ".", "This", "operation", "requires", "the", "secrets", "/", "set", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3736-L3738
passwordmaker/java-passwordmaker-lib
src/main/java/org/daveware/passwordmaker/AccountManager.java
AccountManager.decodeFavoritesUrls
public void decodeFavoritesUrls(String encodedUrlList, boolean clearFirst) { """ Decodes a list of favorites urls from a series of &lt;url1&gt;,&lt;url2&gt;... Will then put them into the list of favorites, optionally clearing first @param encodedUrlList - String encoded version of the list @param clearFirst - clear the list of favorites first """ int start = 0; int end = encodedUrlList.length(); if ( encodedUrlList.startsWith("<") ) start++; if ( encodedUrlList.endsWith(">") ) end--; encodedUrlList = encodedUrlList.substring(start, end); if ( clearFirst ) favoriteUrls.clear(); for (String url : Splitter.on(">,<").omitEmptyStrings().split(encodedUrlList) ) { favoriteUrls.add(url); } }
java
public void decodeFavoritesUrls(String encodedUrlList, boolean clearFirst) { int start = 0; int end = encodedUrlList.length(); if ( encodedUrlList.startsWith("<") ) start++; if ( encodedUrlList.endsWith(">") ) end--; encodedUrlList = encodedUrlList.substring(start, end); if ( clearFirst ) favoriteUrls.clear(); for (String url : Splitter.on(">,<").omitEmptyStrings().split(encodedUrlList) ) { favoriteUrls.add(url); } }
[ "public", "void", "decodeFavoritesUrls", "(", "String", "encodedUrlList", ",", "boolean", "clearFirst", ")", "{", "int", "start", "=", "0", ";", "int", "end", "=", "encodedUrlList", ".", "length", "(", ")", ";", "if", "(", "encodedUrlList", ".", "startsWith", "(", "\"<\"", ")", ")", "start", "++", ";", "if", "(", "encodedUrlList", ".", "endsWith", "(", "\">\"", ")", ")", "end", "--", ";", "encodedUrlList", "=", "encodedUrlList", ".", "substring", "(", "start", ",", "end", ")", ";", "if", "(", "clearFirst", ")", "favoriteUrls", ".", "clear", "(", ")", ";", "for", "(", "String", "url", ":", "Splitter", ".", "on", "(", "\">,<\"", ")", ".", "omitEmptyStrings", "(", ")", ".", "split", "(", "encodedUrlList", ")", ")", "{", "favoriteUrls", ".", "add", "(", "url", ")", ";", "}", "}" ]
Decodes a list of favorites urls from a series of &lt;url1&gt;,&lt;url2&gt;... Will then put them into the list of favorites, optionally clearing first @param encodedUrlList - String encoded version of the list @param clearFirst - clear the list of favorites first
[ "Decodes", "a", "list", "of", "favorites", "urls", "from", "a", "series", "of", "&lt", ";", "url1&gt", ";", "&lt", ";", "url2&gt", ";", "..." ]
train
https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/AccountManager.java#L232-L242
cogroo/cogroo4
cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenSentence.java
GoldenSentence.setGoldenGrammarErrors
public void setGoldenGrammarErrors(int i, GoldenGrammarError v) { """ indexed setter for goldenGrammarErrors - sets an indexed value - @generated """ if (GoldenSentence_Type.featOkTst && ((GoldenSentence_Type) jcasType).casFeat_goldenGrammarErrors == null) jcasType.jcas.throwFeatMissing("goldenGrammarErrors", "cogroo.uima.GoldenSentence"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i, jcasType.ll_cas.ll_getFSRef(v)); }
java
public void setGoldenGrammarErrors(int i, GoldenGrammarError v) { if (GoldenSentence_Type.featOkTst && ((GoldenSentence_Type) jcasType).casFeat_goldenGrammarErrors == null) jcasType.jcas.throwFeatMissing("goldenGrammarErrors", "cogroo.uima.GoldenSentence"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((GoldenSentence_Type) jcasType).casFeatCode_goldenGrammarErrors), i, jcasType.ll_cas.ll_getFSRef(v)); }
[ "public", "void", "setGoldenGrammarErrors", "(", "int", "i", ",", "GoldenGrammarError", "v", ")", "{", "if", "(", "GoldenSentence_Type", ".", "featOkTst", "&&", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeat_goldenGrammarErrors", "==", "null", ")", "jcasType", ".", "jcas", ".", "throwFeatMissing", "(", "\"goldenGrammarErrors\"", ",", "\"cogroo.uima.GoldenSentence\"", ")", ";", "jcasType", ".", "jcas", ".", "checkArrayBounds", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeatCode_goldenGrammarErrors", ")", ",", "i", ")", ";", "jcasType", ".", "ll_cas", ".", "ll_setRefArrayValue", "(", "jcasType", ".", "ll_cas", ".", "ll_getRefValue", "(", "addr", ",", "(", "(", "GoldenSentence_Type", ")", "jcasType", ")", ".", "casFeatCode_goldenGrammarErrors", ")", ",", "i", ",", "jcasType", ".", "ll_cas", ".", "ll_getFSRef", "(", "v", ")", ")", ";", "}" ]
indexed setter for goldenGrammarErrors - sets an indexed value - @generated
[ "indexed", "setter", "for", "goldenGrammarErrors", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/TypeSystem/src/main/java/cogroo/uima/GoldenSentence.java#L177-L187
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/util/LoadLibs.java
LoadLibs.extractTessResources
public static synchronized File extractTessResources(String resourceName) { """ Extracts tesseract resources to temp folder. @param resourceName name of file or directory @return target path, which could be file or directory """ File targetPath = null; try { targetPath = new File(TESS4J_TEMP_DIR, resourceName); Enumeration<URL> resources = LoadLibs.class.getClassLoader().getResources(resourceName); while (resources.hasMoreElements()) { URL resourceUrl = resources.nextElement(); copyResources(resourceUrl, targetPath); } } catch (IOException | URISyntaxException e) { logger.warn(e.getMessage(), e); } return targetPath; }
java
public static synchronized File extractTessResources(String resourceName) { File targetPath = null; try { targetPath = new File(TESS4J_TEMP_DIR, resourceName); Enumeration<URL> resources = LoadLibs.class.getClassLoader().getResources(resourceName); while (resources.hasMoreElements()) { URL resourceUrl = resources.nextElement(); copyResources(resourceUrl, targetPath); } } catch (IOException | URISyntaxException e) { logger.warn(e.getMessage(), e); } return targetPath; }
[ "public", "static", "synchronized", "File", "extractTessResources", "(", "String", "resourceName", ")", "{", "File", "targetPath", "=", "null", ";", "try", "{", "targetPath", "=", "new", "File", "(", "TESS4J_TEMP_DIR", ",", "resourceName", ")", ";", "Enumeration", "<", "URL", ">", "resources", "=", "LoadLibs", ".", "class", ".", "getClassLoader", "(", ")", ".", "getResources", "(", "resourceName", ")", ";", "while", "(", "resources", ".", "hasMoreElements", "(", ")", ")", "{", "URL", "resourceUrl", "=", "resources", ".", "nextElement", "(", ")", ";", "copyResources", "(", "resourceUrl", ",", "targetPath", ")", ";", "}", "}", "catch", "(", "IOException", "|", "URISyntaxException", "e", ")", "{", "logger", ".", "warn", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "return", "targetPath", ";", "}" ]
Extracts tesseract resources to temp folder. @param resourceName name of file or directory @return target path, which could be file or directory
[ "Extracts", "tesseract", "resources", "to", "temp", "folder", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/LoadLibs.java#L104-L120
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.unlockProject
public void unlockProject(CmsRequestContext context, CmsUUID projectId) throws CmsException, CmsRoleViolationException { """ Unlocks all resources in this project.<p> @param context the current request context @param projectId the id of the project to be published @throws CmsException if something goes wrong @throws CmsRoleViolationException if the current user does not own the required permissions """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsProject project = m_driverManager.readProject(dbc, projectId); try { checkManagerOfProjectRole(dbc, project); m_driverManager.unlockProject(project); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_UNLOCK_PROJECT_2, projectId, dbc.currentUser().getName()), e); } finally { dbc.clear(); } }
java
public void unlockProject(CmsRequestContext context, CmsUUID projectId) throws CmsException, CmsRoleViolationException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsProject project = m_driverManager.readProject(dbc, projectId); try { checkManagerOfProjectRole(dbc, project); m_driverManager.unlockProject(project); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_UNLOCK_PROJECT_2, projectId, dbc.currentUser().getName()), e); } finally { dbc.clear(); } }
[ "public", "void", "unlockProject", "(", "CmsRequestContext", "context", ",", "CmsUUID", "projectId", ")", "throws", "CmsException", ",", "CmsRoleViolationException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "CmsProject", "project", "=", "m_driverManager", ".", "readProject", "(", "dbc", ",", "projectId", ")", ";", "try", "{", "checkManagerOfProjectRole", "(", "dbc", ",", "project", ")", ";", "m_driverManager", ".", "unlockProject", "(", "project", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_UNLOCK_PROJECT_2", ",", "projectId", ",", "dbc", ".", "currentUser", "(", ")", ".", "getName", "(", ")", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "}" ]
Unlocks all resources in this project.<p> @param context the current request context @param projectId the id of the project to be published @throws CmsException if something goes wrong @throws CmsRoleViolationException if the current user does not own the required permissions
[ "Unlocks", "all", "resources", "in", "this", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6269-L6286
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesInner.java
DataWarehouseUserActivitiesInner.getAsync
public Observable<DataWarehouseUserActivityInner> getAsync(String resourceGroupName, String serverName, String databaseName) { """ Gets the user activities of a data warehouse which includes running and suspended queries. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataWarehouseUserActivityInner object """ return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DataWarehouseUserActivityInner>, DataWarehouseUserActivityInner>() { @Override public DataWarehouseUserActivityInner call(ServiceResponse<DataWarehouseUserActivityInner> response) { return response.body(); } }); }
java
public Observable<DataWarehouseUserActivityInner> getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DataWarehouseUserActivityInner>, DataWarehouseUserActivityInner>() { @Override public DataWarehouseUserActivityInner call(ServiceResponse<DataWarehouseUserActivityInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataWarehouseUserActivityInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DataWarehouseUserActivityInner", ">", ",", "DataWarehouseUserActivityInner", ">", "(", ")", "{", "@", "Override", "public", "DataWarehouseUserActivityInner", "call", "(", "ServiceResponse", "<", "DataWarehouseUserActivityInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the user activities of a data warehouse which includes running and suspended queries. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataWarehouseUserActivityInner object
[ "Gets", "the", "user", "activities", "of", "a", "data", "warehouse", "which", "includes", "running", "and", "suspended", "queries", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DataWarehouseUserActivitiesInner.java#L98-L105
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamidentifier.java
streamidentifier.get
public static streamidentifier get(nitro_service service, String name) throws Exception { """ Use this API to fetch streamidentifier resource of given name . """ streamidentifier obj = new streamidentifier(); obj.set_name(name); streamidentifier response = (streamidentifier) obj.get_resource(service); return response; }
java
public static streamidentifier get(nitro_service service, String name) throws Exception{ streamidentifier obj = new streamidentifier(); obj.set_name(name); streamidentifier response = (streamidentifier) obj.get_resource(service); return response; }
[ "public", "static", "streamidentifier", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "streamidentifier", "obj", "=", "new", "streamidentifier", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "streamidentifier", "response", "=", "(", "streamidentifier", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch streamidentifier resource of given name .
[ "Use", "this", "API", "to", "fetch", "streamidentifier", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamidentifier.java#L376-L381
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-zoo/src/main/java/org/deeplearning4j/zoo/util/BaseLabels.java
BaseLabels.getResourceFile
protected File getResourceFile() { """ Download the resource at getURL() to the local resource directory, and return the local copy as a File @return File of the local resource """ URL url = getURL(); String urlString = url.toString(); String filename = urlString.substring(urlString.lastIndexOf('/')+1); File resourceDir = DL4JResources.getDirectory(ResourceType.RESOURCE, resourceName()); File localFile = new File(resourceDir, filename); String expMD5 = resourceMD5(); if(localFile.exists()){ try{ if(Downloader.checkMD5OfFile(expMD5, localFile)){ return localFile; } } catch (IOException e){ //Ignore } //MD5 failed localFile.delete(); } //Download try { Downloader.download(resourceName(), url, localFile, expMD5, 3); } catch (IOException e){ throw new RuntimeException("Error downloading labels",e); } return localFile; }
java
protected File getResourceFile(){ URL url = getURL(); String urlString = url.toString(); String filename = urlString.substring(urlString.lastIndexOf('/')+1); File resourceDir = DL4JResources.getDirectory(ResourceType.RESOURCE, resourceName()); File localFile = new File(resourceDir, filename); String expMD5 = resourceMD5(); if(localFile.exists()){ try{ if(Downloader.checkMD5OfFile(expMD5, localFile)){ return localFile; } } catch (IOException e){ //Ignore } //MD5 failed localFile.delete(); } //Download try { Downloader.download(resourceName(), url, localFile, expMD5, 3); } catch (IOException e){ throw new RuntimeException("Error downloading labels",e); } return localFile; }
[ "protected", "File", "getResourceFile", "(", ")", "{", "URL", "url", "=", "getURL", "(", ")", ";", "String", "urlString", "=", "url", ".", "toString", "(", ")", ";", "String", "filename", "=", "urlString", ".", "substring", "(", "urlString", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ";", "File", "resourceDir", "=", "DL4JResources", ".", "getDirectory", "(", "ResourceType", ".", "RESOURCE", ",", "resourceName", "(", ")", ")", ";", "File", "localFile", "=", "new", "File", "(", "resourceDir", ",", "filename", ")", ";", "String", "expMD5", "=", "resourceMD5", "(", ")", ";", "if", "(", "localFile", ".", "exists", "(", ")", ")", "{", "try", "{", "if", "(", "Downloader", ".", "checkMD5OfFile", "(", "expMD5", ",", "localFile", ")", ")", "{", "return", "localFile", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "//Ignore", "}", "//MD5 failed", "localFile", ".", "delete", "(", ")", ";", "}", "//Download", "try", "{", "Downloader", ".", "download", "(", "resourceName", "(", ")", ",", "url", ",", "localFile", ",", "expMD5", ",", "3", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Error downloading labels\"", ",", "e", ")", ";", "}", "return", "localFile", ";", "}" ]
Download the resource at getURL() to the local resource directory, and return the local copy as a File @return File of the local resource
[ "Download", "the", "resource", "at", "getURL", "()", "to", "the", "local", "resource", "directory", "and", "return", "the", "local", "copy", "as", "a", "File" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-zoo/src/main/java/org/deeplearning4j/zoo/util/BaseLabels.java#L137-L166
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ServletChain.java
ServletChain.chainRequestDispatchers
public static void chainRequestDispatchers(RequestDispatcher[] dispatchers, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { """ Chain the responses of a set of request dispatchers together. """ for(int i=0; i<dispatchers.length-1; i++) { ChainedResponse chainedResp = new ChainedResponse(request, response); dispatchers[i].forward(request, chainedResp); request = chainedResp.getChainedRequest(); } dispatchers[dispatchers.length-1].forward(request, response); }
java
public static void chainRequestDispatchers(RequestDispatcher[] dispatchers, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{ for(int i=0; i<dispatchers.length-1; i++) { ChainedResponse chainedResp = new ChainedResponse(request, response); dispatchers[i].forward(request, chainedResp); request = chainedResp.getChainedRequest(); } dispatchers[dispatchers.length-1].forward(request, response); }
[ "public", "static", "void", "chainRequestDispatchers", "(", "RequestDispatcher", "[", "]", "dispatchers", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", ",", "ServletException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dispatchers", ".", "length", "-", "1", ";", "i", "++", ")", "{", "ChainedResponse", "chainedResp", "=", "new", "ChainedResponse", "(", "request", ",", "response", ")", ";", "dispatchers", "[", "i", "]", ".", "forward", "(", "request", ",", "chainedResp", ")", ";", "request", "=", "chainedResp", ".", "getChainedRequest", "(", ")", ";", "}", "dispatchers", "[", "dispatchers", ".", "length", "-", "1", "]", ".", "forward", "(", "request", ",", "response", ")", ";", "}" ]
Chain the responses of a set of request dispatchers together.
[ "Chain", "the", "responses", "of", "a", "set", "of", "request", "dispatchers", "together", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/filter/ServletChain.java#L192-L200
javamelody/javamelody
javamelody-core/src/main/java/net/bull/javamelody/internal/web/html/HtmlAbstractReport.java
HtmlAbstractReport.getFormattedString
static String getFormattedString(String key, Object... arguments) { """ Retourne une traduction dans la locale courante et insère les arguments aux positions {i}. @param key clé d'un libellé dans les fichiers de traduction @param arguments Valeur à inclure dans le résultat @return String """ return I18N.getFormattedString(key, arguments); }
java
static String getFormattedString(String key, Object... arguments) { return I18N.getFormattedString(key, arguments); }
[ "static", "String", "getFormattedString", "(", "String", "key", ",", "Object", "...", "arguments", ")", "{", "return", "I18N", ".", "getFormattedString", "(", "key", ",", "arguments", ")", ";", "}" ]
Retourne une traduction dans la locale courante et insère les arguments aux positions {i}. @param key clé d'un libellé dans les fichiers de traduction @param arguments Valeur à inclure dans le résultat @return String
[ "Retourne", "une", "traduction", "dans", "la", "locale", "courante", "et", "insère", "les", "arguments", "aux", "positions", "{", "i", "}", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/internal/web/html/HtmlAbstractReport.java#L159-L161
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/util/PGInterval.java
PGInterval.setValue
public void setValue(int years, int months, int days, int hours, int minutes, double seconds) { """ Set all values of this interval to the specified values. @param years years @param months months @param days days @param hours hours @param minutes minutes @param seconds seconds """ setYears(years); setMonths(months); setDays(days); setHours(hours); setMinutes(minutes); setSeconds(seconds); }
java
public void setValue(int years, int months, int days, int hours, int minutes, double seconds) { setYears(years); setMonths(months); setDays(days); setHours(hours); setMinutes(minutes); setSeconds(seconds); }
[ "public", "void", "setValue", "(", "int", "years", ",", "int", "months", ",", "int", "days", ",", "int", "hours", ",", "int", "minutes", ",", "double", "seconds", ")", "{", "setYears", "(", "years", ")", ";", "setMonths", "(", "months", ")", ";", "setDays", "(", "days", ")", ";", "setHours", "(", "hours", ")", ";", "setMinutes", "(", "minutes", ")", ";", "setSeconds", "(", "seconds", ")", ";", "}" ]
Set all values of this interval to the specified values. @param years years @param months months @param days days @param hours hours @param minutes minutes @param seconds seconds
[ "Set", "all", "values", "of", "this", "interval", "to", "the", "specified", "values", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/util/PGInterval.java#L174-L181
killme2008/Metamorphosis
metamorphosis-commons/src/main/java/com/taobao/metamorphosis/utils/ResourceUtils.java
ResourceUtils.getResourceAsReader
public static Reader getResourceAsReader(ClassLoader loader, String resource) throws IOException { """ Returns a resource on the classpath as a Reader object @param loader The classloader used to load the resource @param resource The resource to find @throws IOException If the resource cannot be found or read @return The resource """ return new InputStreamReader(getResourceAsStream(loader, resource)); }
java
public static Reader getResourceAsReader(ClassLoader loader, String resource) throws IOException { return new InputStreamReader(getResourceAsStream(loader, resource)); }
[ "public", "static", "Reader", "getResourceAsReader", "(", "ClassLoader", "loader", ",", "String", "resource", ")", "throws", "IOException", "{", "return", "new", "InputStreamReader", "(", "getResourceAsStream", "(", "loader", ",", "resource", ")", ")", ";", "}" ]
Returns a resource on the classpath as a Reader object @param loader The classloader used to load the resource @param resource The resource to find @throws IOException If the resource cannot be found or read @return The resource
[ "Returns", "a", "resource", "on", "the", "classpath", "as", "a", "Reader", "object" ]
train
https://github.com/killme2008/Metamorphosis/blob/1884b10620dbd640aaf85102243ca295703fbb4a/metamorphosis-commons/src/main/java/com/taobao/metamorphosis/utils/ResourceUtils.java#L213-L215
mojohaus/properties-maven-plugin
src/main/java/org/codehaus/mojo/properties/PropertyResolver.java
PropertyResolver.getPropertyValue
public String getPropertyValue( String key, Properties properties, Properties environment ) { """ Retrieves a property value, replacing values like ${token} using the Properties to look them up. Shamelessly adapted from: http://maven.apache.org/plugins/maven-war-plugin/xref/org/apache/maven/plugin/war/PropertyUtils.html It will leave unresolved properties alone, trying for System properties, and environment variables and implements reparsing (in the case that the value of a property contains a key), and will not loop endlessly on a pair like test = ${test} @param key property key @param properties project properties @param environment environment variables @return resolved property value @throws IllegalArgumentException when properties are circularly defined """ String value = properties.getProperty( key ); ExpansionBuffer buffer = new ExpansionBuffer( value ); CircularDefinitionPreventer circularDefinitionPreventer = new CircularDefinitionPreventer().visited( key, value ); while ( buffer.hasMoreLegalPlaceholders() ) { String newKey = buffer.extractPropertyKey(); String newValue = fromPropertiesThenSystemThenEnvironment( newKey, properties, environment ); circularDefinitionPreventer.visited( newKey, newValue ); buffer.add( newKey, newValue ); } return buffer.toString(); }
java
public String getPropertyValue( String key, Properties properties, Properties environment ) { String value = properties.getProperty( key ); ExpansionBuffer buffer = new ExpansionBuffer( value ); CircularDefinitionPreventer circularDefinitionPreventer = new CircularDefinitionPreventer().visited( key, value ); while ( buffer.hasMoreLegalPlaceholders() ) { String newKey = buffer.extractPropertyKey(); String newValue = fromPropertiesThenSystemThenEnvironment( newKey, properties, environment ); circularDefinitionPreventer.visited( newKey, newValue ); buffer.add( newKey, newValue ); } return buffer.toString(); }
[ "public", "String", "getPropertyValue", "(", "String", "key", ",", "Properties", "properties", ",", "Properties", "environment", ")", "{", "String", "value", "=", "properties", ".", "getProperty", "(", "key", ")", ";", "ExpansionBuffer", "buffer", "=", "new", "ExpansionBuffer", "(", "value", ")", ";", "CircularDefinitionPreventer", "circularDefinitionPreventer", "=", "new", "CircularDefinitionPreventer", "(", ")", ".", "visited", "(", "key", ",", "value", ")", ";", "while", "(", "buffer", ".", "hasMoreLegalPlaceholders", "(", ")", ")", "{", "String", "newKey", "=", "buffer", ".", "extractPropertyKey", "(", ")", ";", "String", "newValue", "=", "fromPropertiesThenSystemThenEnvironment", "(", "newKey", ",", "properties", ",", "environment", ")", ";", "circularDefinitionPreventer", ".", "visited", "(", "newKey", ",", "newValue", ")", ";", "buffer", ".", "add", "(", "newKey", ",", "newValue", ")", ";", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
Retrieves a property value, replacing values like ${token} using the Properties to look them up. Shamelessly adapted from: http://maven.apache.org/plugins/maven-war-plugin/xref/org/apache/maven/plugin/war/PropertyUtils.html It will leave unresolved properties alone, trying for System properties, and environment variables and implements reparsing (in the case that the value of a property contains a key), and will not loop endlessly on a pair like test = ${test} @param key property key @param properties project properties @param environment environment variables @return resolved property value @throws IllegalArgumentException when properties are circularly defined
[ "Retrieves", "a", "property", "value", "replacing", "values", "like", "$", "{", "token", "}", "using", "the", "Properties", "to", "look", "them", "up", ".", "Shamelessly", "adapted", "from", ":", "http", ":", "//", "maven", ".", "apache", ".", "org", "/", "plugins", "/", "maven", "-", "war", "-", "plugin", "/", "xref", "/", "org", "/", "apache", "/", "maven", "/", "plugin", "/", "war", "/", "PropertyUtils", ".", "html", "It", "will", "leave", "unresolved", "properties", "alone", "trying", "for", "System", "properties", "and", "environment", "variables", "and", "implements", "reparsing", "(", "in", "the", "case", "that", "the", "value", "of", "a", "property", "contains", "a", "key", ")", "and", "will", "not", "loop", "endlessly", "on", "a", "pair", "like", "test", "=", "$", "{", "test", "}" ]
train
https://github.com/mojohaus/properties-maven-plugin/blob/ff13d4be71fab374c271a337b2cf6d0e7d0d3d20/src/main/java/org/codehaus/mojo/properties/PropertyResolver.java#L41-L61
datacleaner/DataCleaner
engine/env/cluster/src/main/java/org/datacleaner/cluster/DistributedAnalysisRunner.java
DistributedAnalysisRunner.buildSlaveJob
private AnalysisJob buildSlaveJob(final AnalysisJob job, final int slaveJobIndex, final int firstRow, final int maxRows) { """ Creates a slave job by copying the original job and adding a {@link MaxRowsFilter} as a default requirement. @param job @param firstRow @param maxRows @return """ logger.info("Building slave job {} with firstRow={} and maxRow={}", slaveJobIndex + 1, firstRow, maxRows); try (AnalysisJobBuilder jobBuilder = new AnalysisJobBuilder(_configuration, job)) { final FilterComponentBuilder<MaxRowsFilter, Category> maxRowsFilter = jobBuilder.addFilter(MaxRowsFilter.class); maxRowsFilter.getComponentInstance().setFirstRow(firstRow); maxRowsFilter.getComponentInstance().setMaxRows(maxRows); final boolean naturalRecordOrderConsistent = jobBuilder.getDatastore().getPerformanceCharacteristics().isNaturalRecordOrderConsistent(); if (!naturalRecordOrderConsistent) { final InputColumn<?> orderColumn = findOrderByColumn(jobBuilder); maxRowsFilter.getComponentInstance().setOrderColumn(orderColumn); } jobBuilder.setDefaultRequirement(maxRowsFilter, MaxRowsFilter.Category.VALID); // in assertion/test mode do an early validation assert jobBuilder.isConfigured(true); return jobBuilder.toAnalysisJob(); } }
java
private AnalysisJob buildSlaveJob(final AnalysisJob job, final int slaveJobIndex, final int firstRow, final int maxRows) { logger.info("Building slave job {} with firstRow={} and maxRow={}", slaveJobIndex + 1, firstRow, maxRows); try (AnalysisJobBuilder jobBuilder = new AnalysisJobBuilder(_configuration, job)) { final FilterComponentBuilder<MaxRowsFilter, Category> maxRowsFilter = jobBuilder.addFilter(MaxRowsFilter.class); maxRowsFilter.getComponentInstance().setFirstRow(firstRow); maxRowsFilter.getComponentInstance().setMaxRows(maxRows); final boolean naturalRecordOrderConsistent = jobBuilder.getDatastore().getPerformanceCharacteristics().isNaturalRecordOrderConsistent(); if (!naturalRecordOrderConsistent) { final InputColumn<?> orderColumn = findOrderByColumn(jobBuilder); maxRowsFilter.getComponentInstance().setOrderColumn(orderColumn); } jobBuilder.setDefaultRequirement(maxRowsFilter, MaxRowsFilter.Category.VALID); // in assertion/test mode do an early validation assert jobBuilder.isConfigured(true); return jobBuilder.toAnalysisJob(); } }
[ "private", "AnalysisJob", "buildSlaveJob", "(", "final", "AnalysisJob", "job", ",", "final", "int", "slaveJobIndex", ",", "final", "int", "firstRow", ",", "final", "int", "maxRows", ")", "{", "logger", ".", "info", "(", "\"Building slave job {} with firstRow={} and maxRow={}\"", ",", "slaveJobIndex", "+", "1", ",", "firstRow", ",", "maxRows", ")", ";", "try", "(", "AnalysisJobBuilder", "jobBuilder", "=", "new", "AnalysisJobBuilder", "(", "_configuration", ",", "job", ")", ")", "{", "final", "FilterComponentBuilder", "<", "MaxRowsFilter", ",", "Category", ">", "maxRowsFilter", "=", "jobBuilder", ".", "addFilter", "(", "MaxRowsFilter", ".", "class", ")", ";", "maxRowsFilter", ".", "getComponentInstance", "(", ")", ".", "setFirstRow", "(", "firstRow", ")", ";", "maxRowsFilter", ".", "getComponentInstance", "(", ")", ".", "setMaxRows", "(", "maxRows", ")", ";", "final", "boolean", "naturalRecordOrderConsistent", "=", "jobBuilder", ".", "getDatastore", "(", ")", ".", "getPerformanceCharacteristics", "(", ")", ".", "isNaturalRecordOrderConsistent", "(", ")", ";", "if", "(", "!", "naturalRecordOrderConsistent", ")", "{", "final", "InputColumn", "<", "?", ">", "orderColumn", "=", "findOrderByColumn", "(", "jobBuilder", ")", ";", "maxRowsFilter", ".", "getComponentInstance", "(", ")", ".", "setOrderColumn", "(", "orderColumn", ")", ";", "}", "jobBuilder", ".", "setDefaultRequirement", "(", "maxRowsFilter", ",", "MaxRowsFilter", ".", "Category", ".", "VALID", ")", ";", "// in assertion/test mode do an early validation", "assert", "jobBuilder", ".", "isConfigured", "(", "true", ")", ";", "return", "jobBuilder", ".", "toAnalysisJob", "(", ")", ";", "}", "}" ]
Creates a slave job by copying the original job and adding a {@link MaxRowsFilter} as a default requirement. @param job @param firstRow @param maxRows @return
[ "Creates", "a", "slave", "job", "by", "copying", "the", "original", "job", "and", "adding", "a", "{", "@link", "MaxRowsFilter", "}", "as", "a", "default", "requirement", "." ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/env/cluster/src/main/java/org/datacleaner/cluster/DistributedAnalysisRunner.java#L242-L267
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Error.java
Error.setType
public void setType(String type) throws ExpressionException { """ set the value type The type of error that the custom error page handles. @param type value to set @throws ExpressionException """ type = type.toLowerCase().trim(); if (type.equals("exception")) { errorPage.setType(ErrorPage.TYPE_EXCEPTION); } else if (type.equals("request")) { errorPage.setType(ErrorPage.TYPE_REQUEST); } // else if(type.equals("validation")) this.type=VALIDATION; else throw new ExpressionException("invalid type [" + type + "] for tag error, use one of the following types [exception,request]"); }
java
public void setType(String type) throws ExpressionException { type = type.toLowerCase().trim(); if (type.equals("exception")) { errorPage.setType(ErrorPage.TYPE_EXCEPTION); } else if (type.equals("request")) { errorPage.setType(ErrorPage.TYPE_REQUEST); } // else if(type.equals("validation")) this.type=VALIDATION; else throw new ExpressionException("invalid type [" + type + "] for tag error, use one of the following types [exception,request]"); }
[ "public", "void", "setType", "(", "String", "type", ")", "throws", "ExpressionException", "{", "type", "=", "type", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "type", ".", "equals", "(", "\"exception\"", ")", ")", "{", "errorPage", ".", "setType", "(", "ErrorPage", ".", "TYPE_EXCEPTION", ")", ";", "}", "else", "if", "(", "type", ".", "equals", "(", "\"request\"", ")", ")", "{", "errorPage", ".", "setType", "(", "ErrorPage", ".", "TYPE_REQUEST", ")", ";", "}", "// else if(type.equals(\"validation\")) this.type=VALIDATION;", "else", "throw", "new", "ExpressionException", "(", "\"invalid type [\"", "+", "type", "+", "\"] for tag error, use one of the following types [exception,request]\"", ")", ";", "}" ]
set the value type The type of error that the custom error page handles. @param type value to set @throws ExpressionException
[ "set", "the", "value", "type", "The", "type", "of", "error", "that", "the", "custom", "error", "page", "handles", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Error.java#L65-L75
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/Tr.java
Tr.formatMessage
public static String formatMessage(TraceComponent tc, Locale locale, String msgKey, Object... objs) { """ Like {@link #formatMessage(TraceComponent, List, String, Object...)}, but takes a single Locale. @see #formatMessage(TraceComponent, List, String, Object...) """ return formatMessage(tc, (locale == null) ? null : Collections.singletonList(locale), msgKey, objs); }
java
public static String formatMessage(TraceComponent tc, Locale locale, String msgKey, Object... objs) { return formatMessage(tc, (locale == null) ? null : Collections.singletonList(locale), msgKey, objs); }
[ "public", "static", "String", "formatMessage", "(", "TraceComponent", "tc", ",", "Locale", "locale", ",", "String", "msgKey", ",", "Object", "...", "objs", ")", "{", "return", "formatMessage", "(", "tc", ",", "(", "locale", "==", "null", ")", "?", "null", ":", "Collections", ".", "singletonList", "(", "locale", ")", ",", "msgKey", ",", "objs", ")", ";", "}" ]
Like {@link #formatMessage(TraceComponent, List, String, Object...)}, but takes a single Locale. @see #formatMessage(TraceComponent, List, String, Object...)
[ "Like", "{", "@link", "#formatMessage", "(", "TraceComponent", "List", "String", "Object", "...", ")", "}", "but", "takes", "a", "single", "Locale", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/Tr.java#L685-L687
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/state/StateBasedGame.java
StateBasedGame.enterState
public void enterState(int id, Transition leave, Transition enter) { """ Enter a particular game state with the transitions provided @param id The ID of the state to enter @param leave The transition to use when leaving the current state @param enter The transition to use when entering the new state """ if (leave == null) { leave = new EmptyTransition(); } if (enter == null) { enter = new EmptyTransition(); } leaveTransition = leave; enterTransition = enter; nextState = getState(id); if (nextState == null) { throw new RuntimeException("No game state registered with the ID: "+id); } leaveTransition.init(currentState, nextState); }
java
public void enterState(int id, Transition leave, Transition enter) { if (leave == null) { leave = new EmptyTransition(); } if (enter == null) { enter = new EmptyTransition(); } leaveTransition = leave; enterTransition = enter; nextState = getState(id); if (nextState == null) { throw new RuntimeException("No game state registered with the ID: "+id); } leaveTransition.init(currentState, nextState); }
[ "public", "void", "enterState", "(", "int", "id", ",", "Transition", "leave", ",", "Transition", "enter", ")", "{", "if", "(", "leave", "==", "null", ")", "{", "leave", "=", "new", "EmptyTransition", "(", ")", ";", "}", "if", "(", "enter", "==", "null", ")", "{", "enter", "=", "new", "EmptyTransition", "(", ")", ";", "}", "leaveTransition", "=", "leave", ";", "enterTransition", "=", "enter", ";", "nextState", "=", "getState", "(", "id", ")", ";", "if", "(", "nextState", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"No game state registered with the ID: \"", "+", "id", ")", ";", "}", "leaveTransition", ".", "init", "(", "currentState", ",", "nextState", ")", ";", "}" ]
Enter a particular game state with the transitions provided @param id The ID of the state to enter @param leave The transition to use when leaving the current state @param enter The transition to use when entering the new state
[ "Enter", "a", "particular", "game", "state", "with", "the", "transitions", "provided" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/state/StateBasedGame.java#L141-L157
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.getPnsCredentialsAsync
public Observable<PnsCredentialsResourceInner> getPnsCredentialsAsync(String resourceGroupName, String namespaceName, String notificationHubName) { """ Lists the PNS Credentials associated with a notification hub . @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PnsCredentialsResourceInner object """ return getPnsCredentialsWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<PnsCredentialsResourceInner>, PnsCredentialsResourceInner>() { @Override public PnsCredentialsResourceInner call(ServiceResponse<PnsCredentialsResourceInner> response) { return response.body(); } }); }
java
public Observable<PnsCredentialsResourceInner> getPnsCredentialsAsync(String resourceGroupName, String namespaceName, String notificationHubName) { return getPnsCredentialsWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<PnsCredentialsResourceInner>, PnsCredentialsResourceInner>() { @Override public PnsCredentialsResourceInner call(ServiceResponse<PnsCredentialsResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PnsCredentialsResourceInner", ">", "getPnsCredentialsAsync", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ",", "String", "notificationHubName", ")", "{", "return", "getPnsCredentialsWithServiceResponseAsync", "(", "resourceGroupName", ",", "namespaceName", ",", "notificationHubName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "PnsCredentialsResourceInner", ">", ",", "PnsCredentialsResourceInner", ">", "(", ")", "{", "@", "Override", "public", "PnsCredentialsResourceInner", "call", "(", "ServiceResponse", "<", "PnsCredentialsResourceInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists the PNS Credentials associated with a notification hub . @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PnsCredentialsResourceInner object
[ "Lists", "the", "PNS", "Credentials", "associated", "with", "a", "notification", "hub", "." ]
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#L1792-L1799
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.getWriter
public static BufferedWriter getWriter(String path, String charsetName, boolean isAppend) throws IORuntimeException { """ 获得一个带缓存的写入对象 @param path 输出路径,绝对路径 @param charsetName 字符集 @param isAppend 是否追加 @return BufferedReader对象 @throws IORuntimeException IO异常 """ return getWriter(touch(path), Charset.forName(charsetName), isAppend); }
java
public static BufferedWriter getWriter(String path, String charsetName, boolean isAppend) throws IORuntimeException { return getWriter(touch(path), Charset.forName(charsetName), isAppend); }
[ "public", "static", "BufferedWriter", "getWriter", "(", "String", "path", ",", "String", "charsetName", ",", "boolean", "isAppend", ")", "throws", "IORuntimeException", "{", "return", "getWriter", "(", "touch", "(", "path", ")", ",", "Charset", ".", "forName", "(", "charsetName", ")", ",", "isAppend", ")", ";", "}" ]
获得一个带缓存的写入对象 @param path 输出路径,绝对路径 @param charsetName 字符集 @param isAppend 是否追加 @return BufferedReader对象 @throws IORuntimeException IO异常
[ "获得一个带缓存的写入对象" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2585-L2587
alkacon/opencms-core
src/org/opencms/xml/CmsXmlContentDefinition.java
CmsXmlContentDefinition.createDocument
public Document createDocument(CmsObject cms, I_CmsXmlDocument document, Locale locale) { """ Generates a valid XML document according to the XML schema of this content definition.<p> @param cms the current users OpenCms context @param document the OpenCms XML document the XML is created for @param locale the locale to create the default element in the document with @return a valid XML document according to the XML schema of this content definition """ Document doc = DocumentHelper.createDocument(); Element root = doc.addElement(getOuterName()); root.add(I_CmsXmlSchemaType.XSI_NAMESPACE); root.addAttribute(I_CmsXmlSchemaType.XSI_NAMESPACE_ATTRIBUTE_NO_SCHEMA_LOCATION, getSchemaLocation()); createLocale(cms, document, root, locale); return doc; }
java
public Document createDocument(CmsObject cms, I_CmsXmlDocument document, Locale locale) { Document doc = DocumentHelper.createDocument(); Element root = doc.addElement(getOuterName()); root.add(I_CmsXmlSchemaType.XSI_NAMESPACE); root.addAttribute(I_CmsXmlSchemaType.XSI_NAMESPACE_ATTRIBUTE_NO_SCHEMA_LOCATION, getSchemaLocation()); createLocale(cms, document, root, locale); return doc; }
[ "public", "Document", "createDocument", "(", "CmsObject", "cms", ",", "I_CmsXmlDocument", "document", ",", "Locale", "locale", ")", "{", "Document", "doc", "=", "DocumentHelper", ".", "createDocument", "(", ")", ";", "Element", "root", "=", "doc", ".", "addElement", "(", "getOuterName", "(", ")", ")", ";", "root", ".", "add", "(", "I_CmsXmlSchemaType", ".", "XSI_NAMESPACE", ")", ";", "root", ".", "addAttribute", "(", "I_CmsXmlSchemaType", ".", "XSI_NAMESPACE_ATTRIBUTE_NO_SCHEMA_LOCATION", ",", "getSchemaLocation", "(", ")", ")", ";", "createLocale", "(", "cms", ",", "document", ",", "root", ",", "locale", ")", ";", "return", "doc", ";", "}" ]
Generates a valid XML document according to the XML schema of this content definition.<p> @param cms the current users OpenCms context @param document the OpenCms XML document the XML is created for @param locale the locale to create the default element in the document with @return a valid XML document according to the XML schema of this content definition
[ "Generates", "a", "valid", "XML", "document", "according", "to", "the", "XML", "schema", "of", "this", "content", "definition", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlContentDefinition.java#L1215-L1226
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java
ProbeManagerImpl.getProbe
public synchronized ProbeImpl getProbe(Class<?> probedClass, String key) { """ Get an existing instance of a probe with the specified source class and key. @param probedClass the probe source class @param key the probe key @return an existing probe or null """ Map<String, ProbeImpl> classProbes = probesByKey.get(probedClass); if (classProbes != null) { return classProbes.get(key); } return null; }
java
public synchronized ProbeImpl getProbe(Class<?> probedClass, String key) { Map<String, ProbeImpl> classProbes = probesByKey.get(probedClass); if (classProbes != null) { return classProbes.get(key); } return null; }
[ "public", "synchronized", "ProbeImpl", "getProbe", "(", "Class", "<", "?", ">", "probedClass", ",", "String", "key", ")", "{", "Map", "<", "String", ",", "ProbeImpl", ">", "classProbes", "=", "probesByKey", ".", "get", "(", "probedClass", ")", ";", "if", "(", "classProbes", "!=", "null", ")", "{", "return", "classProbes", ".", "get", "(", "key", ")", ";", "}", "return", "null", ";", "}" ]
Get an existing instance of a probe with the specified source class and key. @param probedClass the probe source class @param key the probe key @return an existing probe or null
[ "Get", "an", "existing", "instance", "of", "a", "probe", "with", "the", "specified", "source", "class", "and", "key", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/ProbeManagerImpl.java#L617-L623
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.assertionWithCondition
public static Matcher<AssertTree> assertionWithCondition( final Matcher<ExpressionTree> conditionMatcher) { """ Matches an assertion AST node if the given matcher matches its condition. @param conditionMatcher The matcher to apply to the condition in the assertion, e.g. in "assert false", the "false" part of the statement """ return new Matcher<AssertTree>() { @Override public boolean matches(AssertTree tree, VisitorState state) { return conditionMatcher.matches(tree.getCondition(), state); } }; }
java
public static Matcher<AssertTree> assertionWithCondition( final Matcher<ExpressionTree> conditionMatcher) { return new Matcher<AssertTree>() { @Override public boolean matches(AssertTree tree, VisitorState state) { return conditionMatcher.matches(tree.getCondition(), state); } }; }
[ "public", "static", "Matcher", "<", "AssertTree", ">", "assertionWithCondition", "(", "final", "Matcher", "<", "ExpressionTree", ">", "conditionMatcher", ")", "{", "return", "new", "Matcher", "<", "AssertTree", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "AssertTree", "tree", ",", "VisitorState", "state", ")", "{", "return", "conditionMatcher", ".", "matches", "(", "tree", ".", "getCondition", "(", ")", ",", "state", ")", ";", "}", "}", ";", "}" ]
Matches an assertion AST node if the given matcher matches its condition. @param conditionMatcher The matcher to apply to the condition in the assertion, e.g. in "assert false", the "false" part of the statement
[ "Matches", "an", "assertion", "AST", "node", "if", "the", "given", "matcher", "matches", "its", "condition", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1384-L1392
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiCollaboration.java
BoxApiCollaboration.getAddToFolderRequest
public BoxRequestsShare.AddCollaboration getAddToFolderRequest(String folderId, BoxCollaboration.Role role, BoxCollaborator collaborator) { """ A request that adds a {@link com.box.androidsdk.content.models.BoxUser user} or {@link com.box.androidsdk.content.models.BoxGroup group} as a collaborator to a folder. @param folderId id of the folder to be collaborated. @param role role of the collaboration @param collaborator the {@link com.box.androidsdk.content.models.BoxUser user} or {@link com.box.androidsdk.content.models.BoxGroup group} to add as a collaborator @return request to add/create a collaboration """ return new BoxRequestsShare.AddCollaboration(getCollaborationsUrl(), BoxFolder.createFromId(folderId), role, collaborator, mSession); }
java
public BoxRequestsShare.AddCollaboration getAddToFolderRequest(String folderId, BoxCollaboration.Role role, BoxCollaborator collaborator) { return new BoxRequestsShare.AddCollaboration(getCollaborationsUrl(), BoxFolder.createFromId(folderId), role, collaborator, mSession); }
[ "public", "BoxRequestsShare", ".", "AddCollaboration", "getAddToFolderRequest", "(", "String", "folderId", ",", "BoxCollaboration", ".", "Role", "role", ",", "BoxCollaborator", "collaborator", ")", "{", "return", "new", "BoxRequestsShare", ".", "AddCollaboration", "(", "getCollaborationsUrl", "(", ")", ",", "BoxFolder", ".", "createFromId", "(", "folderId", ")", ",", "role", ",", "collaborator", ",", "mSession", ")", ";", "}" ]
A request that adds a {@link com.box.androidsdk.content.models.BoxUser user} or {@link com.box.androidsdk.content.models.BoxGroup group} as a collaborator to a folder. @param folderId id of the folder to be collaborated. @param role role of the collaboration @param collaborator the {@link com.box.androidsdk.content.models.BoxUser user} or {@link com.box.androidsdk.content.models.BoxGroup group} to add as a collaborator @return request to add/create a collaboration
[ "A", "request", "that", "adds", "a", "{" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiCollaboration.java#L74-L77
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java
ProfileSummaryBuilder.buildSummary
public void buildSummary(XMLNode node, Content profileContentTree) { """ Build the profile summary. @param node the XML element that specifies which components to document @param profileContentTree the profile content tree to which the summaries will be added """ Content summaryContentTree = profileWriter.getSummaryHeader(); buildChildren(node, summaryContentTree); profileContentTree.addContent(profileWriter.getSummaryTree(summaryContentTree)); }
java
public void buildSummary(XMLNode node, Content profileContentTree) { Content summaryContentTree = profileWriter.getSummaryHeader(); buildChildren(node, summaryContentTree); profileContentTree.addContent(profileWriter.getSummaryTree(summaryContentTree)); }
[ "public", "void", "buildSummary", "(", "XMLNode", "node", ",", "Content", "profileContentTree", ")", "{", "Content", "summaryContentTree", "=", "profileWriter", ".", "getSummaryHeader", "(", ")", ";", "buildChildren", "(", "node", ",", "summaryContentTree", ")", ";", "profileContentTree", ".", "addContent", "(", "profileWriter", ".", "getSummaryTree", "(", "summaryContentTree", ")", ")", ";", "}" ]
Build the profile summary. @param node the XML element that specifies which components to document @param profileContentTree the profile content tree to which the summaries will be added
[ "Build", "the", "profile", "summary", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java#L154-L158
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java
Configuration.getBoolean
public boolean getBoolean(String name, boolean defaultValue) { """ Get the value of the <code>name</code> property as a <code>boolean</code>. If no such property is specified, or if the specified value is not a valid <code>boolean</code>, then <code>defaultValue</code> is returned. @param name property name. @param defaultValue default value. @return property value as a <code>boolean</code>, or <code>defaultValue</code>. """ String valueString = get(name); return "true".equals(valueString) || !"false".equals(valueString) && defaultValue; }
java
public boolean getBoolean(String name, boolean defaultValue) { String valueString = get(name); return "true".equals(valueString) || !"false".equals(valueString) && defaultValue; }
[ "public", "boolean", "getBoolean", "(", "String", "name", ",", "boolean", "defaultValue", ")", "{", "String", "valueString", "=", "get", "(", "name", ")", ";", "return", "\"true\"", ".", "equals", "(", "valueString", ")", "||", "!", "\"false\"", ".", "equals", "(", "valueString", ")", "&&", "defaultValue", ";", "}" ]
Get the value of the <code>name</code> property as a <code>boolean</code>. If no such property is specified, or if the specified value is not a valid <code>boolean</code>, then <code>defaultValue</code> is returned. @param name property name. @param defaultValue default value. @return property value as a <code>boolean</code>, or <code>defaultValue</code>.
[ "Get", "the", "value", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "a", "<code", ">", "boolean<", "/", "code", ">", ".", "If", "no", "such", "property", "is", "specified", "or", "if", "the", "specified", "value", "is", "not", "a", "valid", "<code", ">", "boolean<", "/", "code", ">", "then", "<code", ">", "defaultValue<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java#L594-L597
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java
Text.isSibling
public static boolean isSibling(String p1, String p2) { """ Determines, if two paths denote hierarchical siblins. @param p1 first path @param p2 second path @return true if on same level, false otherwise """ int pos1 = p1.lastIndexOf('/'); int pos2 = p2.lastIndexOf('/'); return (pos1 == pos2 && pos1 >= 0 && p1.regionMatches(0, p2, 0, pos1)); }
java
public static boolean isSibling(String p1, String p2) { int pos1 = p1.lastIndexOf('/'); int pos2 = p2.lastIndexOf('/'); return (pos1 == pos2 && pos1 >= 0 && p1.regionMatches(0, p2, 0, pos1)); }
[ "public", "static", "boolean", "isSibling", "(", "String", "p1", ",", "String", "p2", ")", "{", "int", "pos1", "=", "p1", ".", "lastIndexOf", "(", "'", "'", ")", ";", "int", "pos2", "=", "p2", ".", "lastIndexOf", "(", "'", "'", ")", ";", "return", "(", "pos1", "==", "pos2", "&&", "pos1", ">=", "0", "&&", "p1", ".", "regionMatches", "(", "0", ",", "p2", ",", "0", ",", "pos1", ")", ")", ";", "}" ]
Determines, if two paths denote hierarchical siblins. @param p1 first path @param p2 second path @return true if on same level, false otherwise
[ "Determines", "if", "two", "paths", "denote", "hierarchical", "siblins", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L699-L704
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagContainer.java
CmsJspTagContainer.printElementErrorTag
private void printElementErrorTag(String elementSitePath, String formatterSitePath, Exception exception) throws IOException { """ Prints an element error tag to the response out.<p> @param elementSitePath the element site path @param formatterSitePath the formatter site path @param exception the exception causing the error @throws IOException if something goes wrong writing to response out """ if (m_editableRequest) { String stacktrace = CmsException.getStackTraceAsString(exception); if (CmsStringUtil.isEmptyOrWhitespaceOnly(stacktrace)) { stacktrace = null; } else { // stacktrace = CmsStringUtil.escapeJavaScript(stacktrace); stacktrace = CmsEncoder.escapeXml(stacktrace); } StringBuffer errorBox = new StringBuffer(256); errorBox.append( "<div style=\"display:block; padding: 5px; border: red solid 2px; color: black; background: white;\" class=\""); errorBox.append(CmsContainerElement.CLASS_ELEMENT_ERROR); errorBox.append("\">"); errorBox.append( Messages.get().getBundle().key( Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2, elementSitePath, formatterSitePath)); errorBox.append("<br />"); errorBox.append(exception.getLocalizedMessage()); if (stacktrace != null) { errorBox.append( "<span onclick=\"opencms.openStacktraceDialog(event);\" style=\"border: 1px solid black; cursor: pointer;\">"); errorBox.append(Messages.get().getBundle().key(Messages.GUI_LABEL_STACKTRACE_0)); String title = Messages.get().getBundle().key( Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2, elementSitePath, formatterSitePath); errorBox.append("<span title=\""); errorBox.append(CmsEncoder.escapeXml(title)); errorBox.append("\" class=\"hiddenStacktrace\" style=\"display:none;\">"); errorBox.append(stacktrace); errorBox.append("</span></span>"); } errorBox.append("</div>"); pageContext.getOut().print(errorBox.toString()); } }
java
private void printElementErrorTag(String elementSitePath, String formatterSitePath, Exception exception) throws IOException { if (m_editableRequest) { String stacktrace = CmsException.getStackTraceAsString(exception); if (CmsStringUtil.isEmptyOrWhitespaceOnly(stacktrace)) { stacktrace = null; } else { // stacktrace = CmsStringUtil.escapeJavaScript(stacktrace); stacktrace = CmsEncoder.escapeXml(stacktrace); } StringBuffer errorBox = new StringBuffer(256); errorBox.append( "<div style=\"display:block; padding: 5px; border: red solid 2px; color: black; background: white;\" class=\""); errorBox.append(CmsContainerElement.CLASS_ELEMENT_ERROR); errorBox.append("\">"); errorBox.append( Messages.get().getBundle().key( Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2, elementSitePath, formatterSitePath)); errorBox.append("<br />"); errorBox.append(exception.getLocalizedMessage()); if (stacktrace != null) { errorBox.append( "<span onclick=\"opencms.openStacktraceDialog(event);\" style=\"border: 1px solid black; cursor: pointer;\">"); errorBox.append(Messages.get().getBundle().key(Messages.GUI_LABEL_STACKTRACE_0)); String title = Messages.get().getBundle().key( Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2, elementSitePath, formatterSitePath); errorBox.append("<span title=\""); errorBox.append(CmsEncoder.escapeXml(title)); errorBox.append("\" class=\"hiddenStacktrace\" style=\"display:none;\">"); errorBox.append(stacktrace); errorBox.append("</span></span>"); } errorBox.append("</div>"); pageContext.getOut().print(errorBox.toString()); } }
[ "private", "void", "printElementErrorTag", "(", "String", "elementSitePath", ",", "String", "formatterSitePath", ",", "Exception", "exception", ")", "throws", "IOException", "{", "if", "(", "m_editableRequest", ")", "{", "String", "stacktrace", "=", "CmsException", ".", "getStackTraceAsString", "(", "exception", ")", ";", "if", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "stacktrace", ")", ")", "{", "stacktrace", "=", "null", ";", "}", "else", "{", "// stacktrace = CmsStringUtil.escapeJavaScript(stacktrace);", "stacktrace", "=", "CmsEncoder", ".", "escapeXml", "(", "stacktrace", ")", ";", "}", "StringBuffer", "errorBox", "=", "new", "StringBuffer", "(", "256", ")", ";", "errorBox", ".", "append", "(", "\"<div style=\\\"display:block; padding: 5px; border: red solid 2px; color: black; background: white;\\\" class=\\\"\"", ")", ";", "errorBox", ".", "append", "(", "CmsContainerElement", ".", "CLASS_ELEMENT_ERROR", ")", ";", "errorBox", ".", "append", "(", "\"\\\">\"", ")", ";", "errorBox", ".", "append", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2", ",", "elementSitePath", ",", "formatterSitePath", ")", ")", ";", "errorBox", ".", "append", "(", "\"<br />\"", ")", ";", "errorBox", ".", "append", "(", "exception", ".", "getLocalizedMessage", "(", ")", ")", ";", "if", "(", "stacktrace", "!=", "null", ")", "{", "errorBox", ".", "append", "(", "\"<span onclick=\\\"opencms.openStacktraceDialog(event);\\\" style=\\\"border: 1px solid black; cursor: pointer;\\\">\"", ")", ";", "errorBox", ".", "append", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "GUI_LABEL_STACKTRACE_0", ")", ")", ";", "String", "title", "=", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2", ",", "elementSitePath", ",", "formatterSitePath", ")", ";", "errorBox", ".", "append", "(", "\"<span title=\\\"\"", ")", ";", "errorBox", ".", "append", "(", "CmsEncoder", ".", "escapeXml", "(", "title", ")", ")", ";", "errorBox", ".", "append", "(", "\"\\\" class=\\\"hiddenStacktrace\\\" style=\\\"display:none;\\\">\"", ")", ";", "errorBox", ".", "append", "(", "stacktrace", ")", ";", "errorBox", ".", "append", "(", "\"</span></span>\"", ")", ";", "}", "errorBox", ".", "append", "(", "\"</div>\"", ")", ";", "pageContext", ".", "getOut", "(", ")", ".", "print", "(", "errorBox", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Prints an element error tag to the response out.<p> @param elementSitePath the element site path @param formatterSitePath the formatter site path @param exception the exception causing the error @throws IOException if something goes wrong writing to response out
[ "Prints", "an", "element", "error", "tag", "to", "the", "response", "out", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagContainer.java#L1304-L1344
Chorus-bdd/Chorus
interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/CommandLineParser.java
CommandLineParser.parseProperties
public Map<ExecutionProperty, List<String>> parseProperties(Map<ExecutionProperty, List<String>> propertyMap, String... args) throws InterpreterPropertyException { """ Add to the provided propertyMap any properties available from this source Where the map already contains property values under a given key, extra property values should be appended to the List @return propertyMap, with parsed properties added """ //if some command line switches were specified if ( args.length > 0 ) { //easiest to build the args back up into a single string then split by - StringBuilder allArgs = new StringBuilder(); for (String s : args) { allArgs.append(s).append(" "); } String allargs = allArgs.toString(); if ( allargs.trim().length() > 0 && ! allargs.startsWith("-")) { throw new InterpreterPropertyException("arguments must start with a switch, e.g. -f"); } //having checked the first char is a -, we now have to strip it //otherwise end up with a first "" token following the split - not sure that's correct behaviour from split allargs = allargs.substring(1); //hyphens may exist within paths so only split by those which have preceding empty space String[] splitParameterList = allargs.split(" -"); for ( String parameterList : splitParameterList) { //tokenize, first token will be the property name, rest will be the values StringTokenizer st = new StringTokenizer(parameterList, " "); //find the property ExecutionProperty property = getProperty(parameterList, st); //add its values addPropertyValues(propertyMap, st, property); } } return propertyMap; }
java
public Map<ExecutionProperty, List<String>> parseProperties(Map<ExecutionProperty, List<String>> propertyMap, String... args) throws InterpreterPropertyException { //if some command line switches were specified if ( args.length > 0 ) { //easiest to build the args back up into a single string then split by - StringBuilder allArgs = new StringBuilder(); for (String s : args) { allArgs.append(s).append(" "); } String allargs = allArgs.toString(); if ( allargs.trim().length() > 0 && ! allargs.startsWith("-")) { throw new InterpreterPropertyException("arguments must start with a switch, e.g. -f"); } //having checked the first char is a -, we now have to strip it //otherwise end up with a first "" token following the split - not sure that's correct behaviour from split allargs = allargs.substring(1); //hyphens may exist within paths so only split by those which have preceding empty space String[] splitParameterList = allargs.split(" -"); for ( String parameterList : splitParameterList) { //tokenize, first token will be the property name, rest will be the values StringTokenizer st = new StringTokenizer(parameterList, " "); //find the property ExecutionProperty property = getProperty(parameterList, st); //add its values addPropertyValues(propertyMap, st, property); } } return propertyMap; }
[ "public", "Map", "<", "ExecutionProperty", ",", "List", "<", "String", ">", ">", "parseProperties", "(", "Map", "<", "ExecutionProperty", ",", "List", "<", "String", ">", ">", "propertyMap", ",", "String", "...", "args", ")", "throws", "InterpreterPropertyException", "{", "//if some command line switches were specified", "if", "(", "args", ".", "length", ">", "0", ")", "{", "//easiest to build the args back up into a single string then split by -", "StringBuilder", "allArgs", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "s", ":", "args", ")", "{", "allArgs", ".", "append", "(", "s", ")", ".", "append", "(", "\" \"", ")", ";", "}", "String", "allargs", "=", "allArgs", ".", "toString", "(", ")", ";", "if", "(", "allargs", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", "&&", "!", "allargs", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "throw", "new", "InterpreterPropertyException", "(", "\"arguments must start with a switch, e.g. -f\"", ")", ";", "}", "//having checked the first char is a -, we now have to strip it", "//otherwise end up with a first \"\" token following the split - not sure that's correct behaviour from split", "allargs", "=", "allargs", ".", "substring", "(", "1", ")", ";", "//hyphens may exist within paths so only split by those which have preceding empty space", "String", "[", "]", "splitParameterList", "=", "allargs", ".", "split", "(", "\" -\"", ")", ";", "for", "(", "String", "parameterList", ":", "splitParameterList", ")", "{", "//tokenize, first token will be the property name, rest will be the values", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "parameterList", ",", "\" \"", ")", ";", "//find the property", "ExecutionProperty", "property", "=", "getProperty", "(", "parameterList", ",", "st", ")", ";", "//add its values", "addPropertyValues", "(", "propertyMap", ",", "st", ",", "property", ")", ";", "}", "}", "return", "propertyMap", ";", "}" ]
Add to the provided propertyMap any properties available from this source Where the map already contains property values under a given key, extra property values should be appended to the List @return propertyMap, with parsed properties added
[ "Add", "to", "the", "provided", "propertyMap", "any", "properties", "available", "from", "this", "source" ]
train
https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-config/src/main/java/org/chorusbdd/chorus/config/CommandLineParser.java#L50-L84
Syncleus/aparapi
src/main/java/com/aparapi/internal/kernel/KernelManager.java
KernelManager.selectLhsIfCUDA
protected static boolean selectLhsIfCUDA(OpenCLDevice _deviceLhs, OpenCLDevice _deviceRhs) { """ NVidia/CUDA architecture reports maxComputeUnits in a completely different context, i.e. maxComputeUnits is not same as (is much less than) the number of OpenCL cores available. <p>Therefore when comparing an NVidia device we use different criteria.</p> """ if (_deviceLhs.getType() != _deviceRhs.getType()) { return selectLhsByType(_deviceLhs.getType(), _deviceRhs.getType()); } return _deviceLhs.getMaxWorkGroupSize() == _deviceRhs.getMaxWorkGroupSize() ? _deviceLhs.getGlobalMemSize() > _deviceRhs.getGlobalMemSize() : _deviceLhs.getMaxWorkGroupSize() > _deviceRhs.getMaxWorkGroupSize(); }
java
protected static boolean selectLhsIfCUDA(OpenCLDevice _deviceLhs, OpenCLDevice _deviceRhs) { if (_deviceLhs.getType() != _deviceRhs.getType()) { return selectLhsByType(_deviceLhs.getType(), _deviceRhs.getType()); } return _deviceLhs.getMaxWorkGroupSize() == _deviceRhs.getMaxWorkGroupSize() ? _deviceLhs.getGlobalMemSize() > _deviceRhs.getGlobalMemSize() : _deviceLhs.getMaxWorkGroupSize() > _deviceRhs.getMaxWorkGroupSize(); }
[ "protected", "static", "boolean", "selectLhsIfCUDA", "(", "OpenCLDevice", "_deviceLhs", ",", "OpenCLDevice", "_deviceRhs", ")", "{", "if", "(", "_deviceLhs", ".", "getType", "(", ")", "!=", "_deviceRhs", ".", "getType", "(", ")", ")", "{", "return", "selectLhsByType", "(", "_deviceLhs", ".", "getType", "(", ")", ",", "_deviceRhs", ".", "getType", "(", ")", ")", ";", "}", "return", "_deviceLhs", ".", "getMaxWorkGroupSize", "(", ")", "==", "_deviceRhs", ".", "getMaxWorkGroupSize", "(", ")", "?", "_deviceLhs", ".", "getGlobalMemSize", "(", ")", ">", "_deviceRhs", ".", "getGlobalMemSize", "(", ")", ":", "_deviceLhs", ".", "getMaxWorkGroupSize", "(", ")", ">", "_deviceRhs", ".", "getMaxWorkGroupSize", "(", ")", ";", "}" ]
NVidia/CUDA architecture reports maxComputeUnits in a completely different context, i.e. maxComputeUnits is not same as (is much less than) the number of OpenCL cores available. <p>Therefore when comparing an NVidia device we use different criteria.</p>
[ "NVidia", "/", "CUDA", "architecture", "reports", "maxComputeUnits", "in", "a", "completely", "different", "context", "i", ".", "e", ".", "maxComputeUnits", "is", "not", "same", "as", "(", "is", "much", "less", "than", ")", "the", "number", "of", "OpenCL", "cores", "available", "." ]
train
https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelManager.java#L291-L298
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/DynamicByteBufferHelper.java
DynamicByteBufferHelper._idx
public static void _idx(final byte[] array, int startIndex, byte[] input) { """ Idx. @param array the array @param startIndex the start index @param input the input """ try { System.arraycopy(input, 0, array, startIndex, input.length); } catch (Exception ex) { throw new KriptonRuntimeException(String.format("array size %d, startIndex %d, input length %d", array.length, startIndex, input.length), ex); } }
java
public static void _idx(final byte[] array, int startIndex, byte[] input) { try { System.arraycopy(input, 0, array, startIndex, input.length); } catch (Exception ex) { throw new KriptonRuntimeException(String.format("array size %d, startIndex %d, input length %d", array.length, startIndex, input.length), ex); } }
[ "public", "static", "void", "_idx", "(", "final", "byte", "[", "]", "array", ",", "int", "startIndex", ",", "byte", "[", "]", "input", ")", "{", "try", "{", "System", ".", "arraycopy", "(", "input", ",", "0", ",", "array", ",", "startIndex", ",", "input", ".", "length", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "KriptonRuntimeException", "(", "String", ".", "format", "(", "\"array size %d, startIndex %d, input length %d\"", ",", "array", ".", "length", ",", "startIndex", ",", "input", ".", "length", ")", ",", "ex", ")", ";", "}", "}" ]
Idx. @param array the array @param startIndex the start index @param input the input
[ "Idx", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/DynamicByteBufferHelper.java#L1061-L1068
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.sortByProperty
public static <T> List<T> sortByProperty(List<T> list, String property) { """ 根据Bean的属性排序 @param <T> 元素类型 @param list List @param property 属性名 @return 排序后的List @since 4.0.6 """ return sort(list, new PropertyComparator<>(property)); }
java
public static <T> List<T> sortByProperty(List<T> list, String property) { return sort(list, new PropertyComparator<>(property)); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "sortByProperty", "(", "List", "<", "T", ">", "list", ",", "String", "property", ")", "{", "return", "sort", "(", "list", ",", "new", "PropertyComparator", "<>", "(", "property", ")", ")", ";", "}" ]
根据Bean的属性排序 @param <T> 元素类型 @param list List @param property 属性名 @return 排序后的List @since 4.0.6
[ "根据Bean的属性排序" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2125-L2127
apache/incubator-gobblin
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/ConfigStoreUtils.java
ConfigStoreUtils.getConfig
public static Config getConfig(ConfigClient client, URI u, Optional<Config> runtimeConfig) { """ Wrapper to convert Checked Exception to Unchecked Exception Easy to use in lambda expressions """ try { return client.getConfig(u, runtimeConfig); } catch (ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException e) { throw new Error(e); } }
java
public static Config getConfig(ConfigClient client, URI u, Optional<Config> runtimeConfig) { try { return client.getConfig(u, runtimeConfig); } catch (ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException e) { throw new Error(e); } }
[ "public", "static", "Config", "getConfig", "(", "ConfigClient", "client", ",", "URI", "u", ",", "Optional", "<", "Config", ">", "runtimeConfig", ")", "{", "try", "{", "return", "client", ".", "getConfig", "(", "u", ",", "runtimeConfig", ")", ";", "}", "catch", "(", "ConfigStoreFactoryDoesNotExistsException", "|", "ConfigStoreCreationException", "e", ")", "{", "throw", "new", "Error", "(", "e", ")", ";", "}", "}" ]
Wrapper to convert Checked Exception to Unchecked Exception Easy to use in lambda expressions
[ "Wrapper", "to", "convert", "Checked", "Exception", "to", "Unchecked", "Exception", "Easy", "to", "use", "in", "lambda", "expressions" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/ConfigStoreUtils.java#L116-L122
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPTaxCategoryWrapper.java
CPTaxCategoryWrapper.getName
@Override public String getName(String languageId, boolean useDefault) { """ Returns the localized name of this cp tax category in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized name of this cp tax category """ return _cpTaxCategory.getName(languageId, useDefault); }
java
@Override public String getName(String languageId, boolean useDefault) { return _cpTaxCategory.getName(languageId, useDefault); }
[ "@", "Override", "public", "String", "getName", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_cpTaxCategory", ".", "getName", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized name of this cp tax category in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized name of this cp tax category
[ "Returns", "the", "localized", "name", "of", "this", "cp", "tax", "category", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPTaxCategoryWrapper.java#L333-L336
micronaut-projects/micronaut-core
http-server-netty/src/main/java/io/micronaut/http/server/netty/HttpDataReference.java
HttpDataReference.addComponent
Component addComponent(Consumer<IOException> onError) { """ Adds a reference to a section of the http data. Should only be called after data has been added to the underlying http data. @param onError A consumer to call if an IOException occurs @return The newly added component, or null if an error occurred """ Component component; try { long readable = readableBytes(data); long offset = position.getAndUpdate(p -> readable); int length = new Long(readable - offset).intValue(); component = new Component(length, offset); components.add(component); } catch (IOException e) { onError.accept(e); return null; } if (!data.isInMemory()) { fileAccess.getAndUpdate(channel -> { if (channel == null) { try { return new RandomAccessFile(data.getFile(), "r"); } catch (IOException e) { onError.accept(e); } } return channel; }); } return component; }
java
Component addComponent(Consumer<IOException> onError) { Component component; try { long readable = readableBytes(data); long offset = position.getAndUpdate(p -> readable); int length = new Long(readable - offset).intValue(); component = new Component(length, offset); components.add(component); } catch (IOException e) { onError.accept(e); return null; } if (!data.isInMemory()) { fileAccess.getAndUpdate(channel -> { if (channel == null) { try { return new RandomAccessFile(data.getFile(), "r"); } catch (IOException e) { onError.accept(e); } } return channel; }); } return component; }
[ "Component", "addComponent", "(", "Consumer", "<", "IOException", ">", "onError", ")", "{", "Component", "component", ";", "try", "{", "long", "readable", "=", "readableBytes", "(", "data", ")", ";", "long", "offset", "=", "position", ".", "getAndUpdate", "(", "p", "->", "readable", ")", ";", "int", "length", "=", "new", "Long", "(", "readable", "-", "offset", ")", ".", "intValue", "(", ")", ";", "component", "=", "new", "Component", "(", "length", ",", "offset", ")", ";", "components", ".", "add", "(", "component", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "onError", ".", "accept", "(", "e", ")", ";", "return", "null", ";", "}", "if", "(", "!", "data", ".", "isInMemory", "(", ")", ")", "{", "fileAccess", ".", "getAndUpdate", "(", "channel", "->", "{", "if", "(", "channel", "==", "null", ")", "{", "try", "{", "return", "new", "RandomAccessFile", "(", "data", ".", "getFile", "(", ")", ",", "\"r\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "onError", ".", "accept", "(", "e", ")", ";", "}", "}", "return", "channel", ";", "}", ")", ";", "}", "return", "component", ";", "}" ]
Adds a reference to a section of the http data. Should only be called after data has been added to the underlying http data. @param onError A consumer to call if an IOException occurs @return The newly added component, or null if an error occurred
[ "Adds", "a", "reference", "to", "a", "section", "of", "the", "http", "data", ".", "Should", "only", "be", "called", "after", "data", "has", "been", "added", "to", "the", "underlying", "http", "data", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/http-server-netty/src/main/java/io/micronaut/http/server/netty/HttpDataReference.java#L86-L113
cdapio/tephra
tephra-core/src/main/java/co/cask/tephra/coprocessor/TransactionStateCache.java
TransactionStateCache.tryInit
private void tryInit() { """ Try to initialize the Configuration and TransactionStateStorage instances. Obtaining the Configuration may fail until ReactorServiceMain has been started. """ try { Configuration conf = getSnapshotConfiguration(); if (conf != null) { // Since this is only used for background loading of transaction snapshots, we use the no-op metrics collector, // as there are no relevant metrics to report this.storage = new HDFSTransactionStateStorage(conf, new SnapshotCodecProvider(conf), new TxMetricsCollector()); this.storage.startAndWait(); this.snapshotRefreshFrequency = conf.getLong(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, TxConstants.Manager.DEFAULT_TX_SNAPSHOT_INTERVAL) * 1000; this.initialized = true; } else { LOG.info("Could not load configuration"); } } catch (Exception e) { LOG.info("Failed to initialize TransactionStateCache due to: " + e.getMessage()); } }
java
private void tryInit() { try { Configuration conf = getSnapshotConfiguration(); if (conf != null) { // Since this is only used for background loading of transaction snapshots, we use the no-op metrics collector, // as there are no relevant metrics to report this.storage = new HDFSTransactionStateStorage(conf, new SnapshotCodecProvider(conf), new TxMetricsCollector()); this.storage.startAndWait(); this.snapshotRefreshFrequency = conf.getLong(TxConstants.Manager.CFG_TX_SNAPSHOT_INTERVAL, TxConstants.Manager.DEFAULT_TX_SNAPSHOT_INTERVAL) * 1000; this.initialized = true; } else { LOG.info("Could not load configuration"); } } catch (Exception e) { LOG.info("Failed to initialize TransactionStateCache due to: " + e.getMessage()); } }
[ "private", "void", "tryInit", "(", ")", "{", "try", "{", "Configuration", "conf", "=", "getSnapshotConfiguration", "(", ")", ";", "if", "(", "conf", "!=", "null", ")", "{", "// Since this is only used for background loading of transaction snapshots, we use the no-op metrics collector,", "// as there are no relevant metrics to report", "this", ".", "storage", "=", "new", "HDFSTransactionStateStorage", "(", "conf", ",", "new", "SnapshotCodecProvider", "(", "conf", ")", ",", "new", "TxMetricsCollector", "(", ")", ")", ";", "this", ".", "storage", ".", "startAndWait", "(", ")", ";", "this", ".", "snapshotRefreshFrequency", "=", "conf", ".", "getLong", "(", "TxConstants", ".", "Manager", ".", "CFG_TX_SNAPSHOT_INTERVAL", ",", "TxConstants", ".", "Manager", ".", "DEFAULT_TX_SNAPSHOT_INTERVAL", ")", "*", "1000", ";", "this", ".", "initialized", "=", "true", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"Could not load configuration\"", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "LOG", ".", "info", "(", "\"Failed to initialize TransactionStateCache due to: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Try to initialize the Configuration and TransactionStateStorage instances. Obtaining the Configuration may fail until ReactorServiceMain has been started.
[ "Try", "to", "initialize", "the", "Configuration", "and", "TransactionStateStorage", "instances", ".", "Obtaining", "the", "Configuration", "may", "fail", "until", "ReactorServiceMain", "has", "been", "started", "." ]
train
https://github.com/cdapio/tephra/blob/082c56c15c6ece15002631ff6f89206a00d8915c/tephra-core/src/main/java/co/cask/tephra/coprocessor/TransactionStateCache.java#L85-L103
alkacon/opencms-core
src/org/opencms/util/CmsStringUtil.java
CmsStringUtil.getColorValue
public static Color getColorValue(String value, Color defaultValue, String key) { """ Returns the color value (<code>{@link Color}</code>) for the given String value.<p> All parse errors are caught and the given default value is returned in this case.<p> @param value the value to parse as color @param defaultValue the default value in case of parsing errors @param key a key to be included in the debug output in case of parse errors @return the int value for the given parameter value String """ Color result; try { char pre = value.charAt(0); if (pre != '#') { value = "#" + value; } result = Color.decode(value); } catch (Exception e) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.ERR_UNABLE_TO_PARSE_COLOR_2, value, key)); } result = defaultValue; } return result; }
java
public static Color getColorValue(String value, Color defaultValue, String key) { Color result; try { char pre = value.charAt(0); if (pre != '#') { value = "#" + value; } result = Color.decode(value); } catch (Exception e) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.ERR_UNABLE_TO_PARSE_COLOR_2, value, key)); } result = defaultValue; } return result; }
[ "public", "static", "Color", "getColorValue", "(", "String", "value", ",", "Color", "defaultValue", ",", "String", "key", ")", "{", "Color", "result", ";", "try", "{", "char", "pre", "=", "value", ".", "charAt", "(", "0", ")", ";", "if", "(", "pre", "!=", "'", "'", ")", "{", "value", "=", "\"#\"", "+", "value", ";", "}", "result", "=", "Color", ".", "decode", "(", "value", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_UNABLE_TO_PARSE_COLOR_2", ",", "value", ",", "key", ")", ")", ";", "}", "result", "=", "defaultValue", ";", "}", "return", "result", ";", "}" ]
Returns the color value (<code>{@link Color}</code>) for the given String value.<p> All parse errors are caught and the given default value is returned in this case.<p> @param value the value to parse as color @param defaultValue the default value in case of parsing errors @param key a key to be included in the debug output in case of parse errors @return the int value for the given parameter value String
[ "Returns", "the", "color", "value", "(", "<code", ">", "{", "@link", "Color", "}", "<", "/", "code", ">", ")", "for", "the", "given", "String", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L717-L733
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java
CallTreeDetailPlugin.executeJson
@Override public ObjectJS executeJson(ActionContext context, StringifierFactory jsonStringifierFactory, Simon simon) { """ Generate a JSON call tree object or an error string if no call tree """ ObjectJS callTreeJS; if (isCallTreeCallbackRegistered(context)) { CallTree callTree = getData(simon); if (callTree == null) { callTreeJS = jsonMessage(NO_DATA_MESSAGE, jsonStringifierFactory); } else { callTreeJS = ObjectJS.create(callTree, jsonStringifierFactory); callTreeJS.setAttribute("rootNode", jsonTreeNode(callTree.getRootNode(), jsonStringifierFactory)); } } else { callTreeJS = jsonMessage(NO_CALLBACK_MESSAGE, jsonStringifierFactory); } return callTreeJS; }
java
@Override public ObjectJS executeJson(ActionContext context, StringifierFactory jsonStringifierFactory, Simon simon) { ObjectJS callTreeJS; if (isCallTreeCallbackRegistered(context)) { CallTree callTree = getData(simon); if (callTree == null) { callTreeJS = jsonMessage(NO_DATA_MESSAGE, jsonStringifierFactory); } else { callTreeJS = ObjectJS.create(callTree, jsonStringifierFactory); callTreeJS.setAttribute("rootNode", jsonTreeNode(callTree.getRootNode(), jsonStringifierFactory)); } } else { callTreeJS = jsonMessage(NO_CALLBACK_MESSAGE, jsonStringifierFactory); } return callTreeJS; }
[ "@", "Override", "public", "ObjectJS", "executeJson", "(", "ActionContext", "context", ",", "StringifierFactory", "jsonStringifierFactory", ",", "Simon", "simon", ")", "{", "ObjectJS", "callTreeJS", ";", "if", "(", "isCallTreeCallbackRegistered", "(", "context", ")", ")", "{", "CallTree", "callTree", "=", "getData", "(", "simon", ")", ";", "if", "(", "callTree", "==", "null", ")", "{", "callTreeJS", "=", "jsonMessage", "(", "NO_DATA_MESSAGE", ",", "jsonStringifierFactory", ")", ";", "}", "else", "{", "callTreeJS", "=", "ObjectJS", ".", "create", "(", "callTree", ",", "jsonStringifierFactory", ")", ";", "callTreeJS", ".", "setAttribute", "(", "\"rootNode\"", ",", "jsonTreeNode", "(", "callTree", ".", "getRootNode", "(", ")", ",", "jsonStringifierFactory", ")", ")", ";", "}", "}", "else", "{", "callTreeJS", "=", "jsonMessage", "(", "NO_CALLBACK_MESSAGE", ",", "jsonStringifierFactory", ")", ";", "}", "return", "callTreeJS", ";", "}" ]
Generate a JSON call tree object or an error string if no call tree
[ "Generate", "a", "JSON", "call", "tree", "object", "or", "an", "error", "string", "if", "no", "call", "tree" ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/plugin/CallTreeDetailPlugin.java#L145-L160
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/Table.java
Table.rollWithRows
public void rollWithRows(Consumer<Row[]> rowConsumer, int n) { """ Applies the function in {@code rowConsumer} to each group of contiguous rows of size n in the table This can be used, for example, to calculate a running average of in rows """ if (isEmpty()) { return; } Row[] rows = new Row[n]; for (int i = 0; i < n; i++) { rows[i] = new Row(this); } int max = rowCount() - (n - 2); for (int i = 1; i < max; i++) { for (int r = 0; r < n; r++) { rows[r].at(i + r - 1); } rowConsumer.accept(rows); } }
java
public void rollWithRows(Consumer<Row[]> rowConsumer, int n) { if (isEmpty()) { return; } Row[] rows = new Row[n]; for (int i = 0; i < n; i++) { rows[i] = new Row(this); } int max = rowCount() - (n - 2); for (int i = 1; i < max; i++) { for (int r = 0; r < n; r++) { rows[r].at(i + r - 1); } rowConsumer.accept(rows); } }
[ "public", "void", "rollWithRows", "(", "Consumer", "<", "Row", "[", "]", ">", "rowConsumer", ",", "int", "n", ")", "{", "if", "(", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "Row", "[", "]", "rows", "=", "new", "Row", "[", "n", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "rows", "[", "i", "]", "=", "new", "Row", "(", "this", ")", ";", "}", "int", "max", "=", "rowCount", "(", ")", "-", "(", "n", "-", "2", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "max", ";", "i", "++", ")", "{", "for", "(", "int", "r", "=", "0", ";", "r", "<", "n", ";", "r", "++", ")", "{", "rows", "[", "r", "]", ".", "at", "(", "i", "+", "r", "-", "1", ")", ";", "}", "rowConsumer", ".", "accept", "(", "rows", ")", ";", "}", "}" ]
Applies the function in {@code rowConsumer} to each group of contiguous rows of size n in the table This can be used, for example, to calculate a running average of in rows
[ "Applies", "the", "function", "in", "{" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/Table.java#L1084-L1100
cycorp/api-suite
core-api/src/main/java/com/cyc/kb/exception/KbTypeConflictException.java
KbTypeConflictException.fromThrowable
public static KbTypeConflictException fromThrowable(String message, Throwable cause) { """ Converts a Throwable to a KbTypeConflictException with the specified detail message. If the Throwable is a KbTypeConflictException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new KbTypeConflictException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a KbTypeConflictException """ return (cause instanceof KbTypeConflictException && Objects.equals(message, cause.getMessage())) ? (KbTypeConflictException) cause : new KbTypeConflictException(message, cause); }
java
public static KbTypeConflictException fromThrowable(String message, Throwable cause) { return (cause instanceof KbTypeConflictException && Objects.equals(message, cause.getMessage())) ? (KbTypeConflictException) cause : new KbTypeConflictException(message, cause); }
[ "public", "static", "KbTypeConflictException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "KbTypeConflictException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getMessage", "(", ")", ")", ")", "?", "(", "KbTypeConflictException", ")", "cause", ":", "new", "KbTypeConflictException", "(", "message", ",", "cause", ")", ";", "}" ]
Converts a Throwable to a KbTypeConflictException with the specified detail message. If the Throwable is a KbTypeConflictException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new KbTypeConflictException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a KbTypeConflictException
[ "Converts", "a", "Throwable", "to", "a", "KbTypeConflictException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "KbTypeConflictException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "the", "one", "supplied", "the", "Throwable", "will", "be", "passed", "through", "unmodified", ";", "otherwise", "it", "will", "be", "wrapped", "in", "a", "new", "KbTypeConflictException", "with", "the", "detail", "message", "." ]
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbTypeConflictException.java#L68-L72
landawn/AbacusUtil
src/com/landawn/abacus/util/StringUtil.java
StringUtil.ordinalIndexOf
public static int ordinalIndexOf(final String str, final String substr, final int ordinal) { """ <p> Finds the n-th index within a String, handling {@code null}. </p> @param str @param substr @param ordinal the n-th {@code searchStr} to find @return the n-th index of the search String, {@code -1} ( {@code N.INDEX_NOT_FOUND}) if no match or {@code null} or empty string input """ return ordinalIndexOf(str, substr, ordinal, false); }
java
public static int ordinalIndexOf(final String str, final String substr, final int ordinal) { return ordinalIndexOf(str, substr, ordinal, false); }
[ "public", "static", "int", "ordinalIndexOf", "(", "final", "String", "str", ",", "final", "String", "substr", ",", "final", "int", "ordinal", ")", "{", "return", "ordinalIndexOf", "(", "str", ",", "substr", ",", "ordinal", ",", "false", ")", ";", "}" ]
<p> Finds the n-th index within a String, handling {@code null}. </p> @param str @param substr @param ordinal the n-th {@code searchStr} to find @return the n-th index of the search String, {@code -1} ( {@code N.INDEX_NOT_FOUND}) if no match or {@code null} or empty string input
[ "<p", ">", "Finds", "the", "n", "-", "th", "index", "within", "a", "String", "handling", "{", "@code", "null", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L3609-L3611
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/IOManager.java
IOManager.createBulkBlockChannelReader
public BulkBlockChannelReader createBulkBlockChannelReader(Channel.ID channelID, List<MemorySegment> targetSegments, int numBlocks) throws IOException { """ Creates a block channel reader that reads all blocks from the given channel directly in one bulk. The reader draws segments to read the blocks into from a supplied list, which must contain as many segments as the channel has blocks. After the reader is done, the list with the full segments can be obtained from the reader. <p> If a channel is not to be read in one bulk, but in multiple smaller batches, a {@link BlockChannelReader} should be used. @param channelID The descriptor for the channel to write to. @param targetSegments The list to take the segments from into which to read the data. @param numBlocks The number of blocks in the channel to read. @return A block channel reader that reads from the given channel. @throws IOException Thrown, if the channel for the reader could not be opened. """ if (this.isClosed) { throw new IllegalStateException("I/O-Manger is closed."); } return new BulkBlockChannelReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, targetSegments, numBlocks); }
java
public BulkBlockChannelReader createBulkBlockChannelReader(Channel.ID channelID, List<MemorySegment> targetSegments, int numBlocks) throws IOException { if (this.isClosed) { throw new IllegalStateException("I/O-Manger is closed."); } return new BulkBlockChannelReader(channelID, this.readers[channelID.getThreadNum()].requestQueue, targetSegments, numBlocks); }
[ "public", "BulkBlockChannelReader", "createBulkBlockChannelReader", "(", "Channel", ".", "ID", "channelID", ",", "List", "<", "MemorySegment", ">", "targetSegments", ",", "int", "numBlocks", ")", "throws", "IOException", "{", "if", "(", "this", ".", "isClosed", ")", "{", "throw", "new", "IllegalStateException", "(", "\"I/O-Manger is closed.\"", ")", ";", "}", "return", "new", "BulkBlockChannelReader", "(", "channelID", ",", "this", ".", "readers", "[", "channelID", ".", "getThreadNum", "(", ")", "]", ".", "requestQueue", ",", "targetSegments", ",", "numBlocks", ")", ";", "}" ]
Creates a block channel reader that reads all blocks from the given channel directly in one bulk. The reader draws segments to read the blocks into from a supplied list, which must contain as many segments as the channel has blocks. After the reader is done, the list with the full segments can be obtained from the reader. <p> If a channel is not to be read in one bulk, but in multiple smaller batches, a {@link BlockChannelReader} should be used. @param channelID The descriptor for the channel to write to. @param targetSegments The list to take the segments from into which to read the data. @param numBlocks The number of blocks in the channel to read. @return A block channel reader that reads from the given channel. @throws IOException Thrown, if the channel for the reader could not be opened.
[ "Creates", "a", "block", "channel", "reader", "that", "reads", "all", "blocks", "from", "the", "given", "channel", "directly", "in", "one", "bulk", ".", "The", "reader", "draws", "segments", "to", "read", "the", "blocks", "into", "from", "a", "supplied", "list", "which", "must", "contain", "as", "many", "segments", "as", "the", "channel", "has", "blocks", ".", "After", "the", "reader", "is", "done", "the", "list", "with", "the", "full", "segments", "can", "be", "obtained", "from", "the", "reader", ".", "<p", ">", "If", "a", "channel", "is", "not", "to", "be", "read", "in", "one", "bulk", "but", "in", "multiple", "smaller", "batches", "a", "{", "@link", "BlockChannelReader", "}", "should", "be", "used", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/IOManager.java#L443-L452
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/curves/ForwardCurveInterpolation.java
ForwardCurveInterpolation.createForwardCurveFromForwards
public static ForwardCurveInterpolation createForwardCurveFromForwards(String name, LocalDate referenceDate, String paymentOffsetCode, String interpolationEntityForward, String discountCurveName, AnalyticModel model, double[] times, double[] givenForwards) { """ Create a forward curve from given times and given forwards. @param name The name of this curve. @param referenceDate The reference date for this code, i.e., the date which defines t=0. @param paymentOffsetCode The maturity of the index modeled by this curve. @param interpolationEntityForward Interpolation entity used for forward rate interpolation. @param discountCurveName The name of a discount curve associated with this index (associated with it's funding or collateralization), if any. @param model The model to be used to fetch the discount curve, if needed. @param times A vector of given time points. @param givenForwards A vector of given forwards (corresponding to the given time points). @return A new ForwardCurve object. """ return createForwardCurveFromForwards(name, referenceDate, paymentOffsetCode, InterpolationEntityForward.valueOf(interpolationEntityForward), discountCurveName, model, times, givenForwards); }
java
public static ForwardCurveInterpolation createForwardCurveFromForwards(String name, LocalDate referenceDate, String paymentOffsetCode, String interpolationEntityForward, String discountCurveName, AnalyticModel model, double[] times, double[] givenForwards) { return createForwardCurveFromForwards(name, referenceDate, paymentOffsetCode, InterpolationEntityForward.valueOf(interpolationEntityForward), discountCurveName, model, times, givenForwards); }
[ "public", "static", "ForwardCurveInterpolation", "createForwardCurveFromForwards", "(", "String", "name", ",", "LocalDate", "referenceDate", ",", "String", "paymentOffsetCode", ",", "String", "interpolationEntityForward", ",", "String", "discountCurveName", ",", "AnalyticModel", "model", ",", "double", "[", "]", "times", ",", "double", "[", "]", "givenForwards", ")", "{", "return", "createForwardCurveFromForwards", "(", "name", ",", "referenceDate", ",", "paymentOffsetCode", ",", "InterpolationEntityForward", ".", "valueOf", "(", "interpolationEntityForward", ")", ",", "discountCurveName", ",", "model", ",", "times", ",", "givenForwards", ")", ";", "}" ]
Create a forward curve from given times and given forwards. @param name The name of this curve. @param referenceDate The reference date for this code, i.e., the date which defines t=0. @param paymentOffsetCode The maturity of the index modeled by this curve. @param interpolationEntityForward Interpolation entity used for forward rate interpolation. @param discountCurveName The name of a discount curve associated with this index (associated with it's funding or collateralization), if any. @param model The model to be used to fetch the discount curve, if needed. @param times A vector of given time points. @param givenForwards A vector of given forwards (corresponding to the given time points). @return A new ForwardCurve object.
[ "Create", "a", "forward", "curve", "from", "given", "times", "and", "given", "forwards", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/ForwardCurveInterpolation.java#L188-L190
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseXcsr2coo
public static int cusparseXcsr2coo( cusparseHandle handle, Pointer csrSortedRowPtr, int nnz, int m, Pointer cooRowInd, int idxBase) { """ Description: This routine uncompresses the indecis of rows or columns. It can be interpreted as a conversion from CSR to COO sparse storage format. """ return checkResult(cusparseXcsr2cooNative(handle, csrSortedRowPtr, nnz, m, cooRowInd, idxBase)); }
java
public static int cusparseXcsr2coo( cusparseHandle handle, Pointer csrSortedRowPtr, int nnz, int m, Pointer cooRowInd, int idxBase) { return checkResult(cusparseXcsr2cooNative(handle, csrSortedRowPtr, nnz, m, cooRowInd, idxBase)); }
[ "public", "static", "int", "cusparseXcsr2coo", "(", "cusparseHandle", "handle", ",", "Pointer", "csrSortedRowPtr", ",", "int", "nnz", ",", "int", "m", ",", "Pointer", "cooRowInd", ",", "int", "idxBase", ")", "{", "return", "checkResult", "(", "cusparseXcsr2cooNative", "(", "handle", ",", "csrSortedRowPtr", ",", "nnz", ",", "m", ",", "cooRowInd", ",", "idxBase", ")", ")", ";", "}" ]
Description: This routine uncompresses the indecis of rows or columns. It can be interpreted as a conversion from CSR to COO sparse storage format.
[ "Description", ":", "This", "routine", "uncompresses", "the", "indecis", "of", "rows", "or", "columns", ".", "It", "can", "be", "interpreted", "as", "a", "conversion", "from", "CSR", "to", "COO", "sparse", "storage", "format", "." ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L11622-L11631
networknt/light-4j
dump/src/main/java/com/networknt/dump/BodyDumper.java
BodyDumper.dumpRequest
@Override public void dumpRequest(Map<String, Object> result) { """ impl of dumping request body to result @param result A map you want to put dump information to """ String contentType = exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE); //only dump json info if (contentType != null && contentType.startsWith("application/json")) { //if body info already grab by body handler, get it from attachment directly Object requestBodyAttachment = exchange.getAttachment(BodyHandler.REQUEST_BODY); if(requestBodyAttachment != null) { dumpBodyAttachment(requestBodyAttachment); } else { //otherwise get it from input stream directly dumpInputStream(); } } else { logger.info("unsupported contentType: {}", contentType); } this.putDumpInfoTo(result); }
java
@Override public void dumpRequest(Map<String, Object> result) { String contentType = exchange.getRequestHeaders().getFirst(Headers.CONTENT_TYPE); //only dump json info if (contentType != null && contentType.startsWith("application/json")) { //if body info already grab by body handler, get it from attachment directly Object requestBodyAttachment = exchange.getAttachment(BodyHandler.REQUEST_BODY); if(requestBodyAttachment != null) { dumpBodyAttachment(requestBodyAttachment); } else { //otherwise get it from input stream directly dumpInputStream(); } } else { logger.info("unsupported contentType: {}", contentType); } this.putDumpInfoTo(result); }
[ "@", "Override", "public", "void", "dumpRequest", "(", "Map", "<", "String", ",", "Object", ">", "result", ")", "{", "String", "contentType", "=", "exchange", ".", "getRequestHeaders", "(", ")", ".", "getFirst", "(", "Headers", ".", "CONTENT_TYPE", ")", ";", "//only dump json info", "if", "(", "contentType", "!=", "null", "&&", "contentType", ".", "startsWith", "(", "\"application/json\"", ")", ")", "{", "//if body info already grab by body handler, get it from attachment directly", "Object", "requestBodyAttachment", "=", "exchange", ".", "getAttachment", "(", "BodyHandler", ".", "REQUEST_BODY", ")", ";", "if", "(", "requestBodyAttachment", "!=", "null", ")", "{", "dumpBodyAttachment", "(", "requestBodyAttachment", ")", ";", "}", "else", "{", "//otherwise get it from input stream directly", "dumpInputStream", "(", ")", ";", "}", "}", "else", "{", "logger", ".", "info", "(", "\"unsupported contentType: {}\"", ",", "contentType", ")", ";", "}", "this", ".", "putDumpInfoTo", "(", "result", ")", ";", "}" ]
impl of dumping request body to result @param result A map you want to put dump information to
[ "impl", "of", "dumping", "request", "body", "to", "result" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/BodyDumper.java#L62-L79
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.setTextureNumber
@SuppressWarnings("unused") private void setTextureNumber(int type, int number) { """ This method is used by JNI, do not call or modify. @param type the type @param number the number """ m_numTextures.put(AiTextureType.fromRawValue(type), number); }
java
@SuppressWarnings("unused") private void setTextureNumber(int type, int number) { m_numTextures.put(AiTextureType.fromRawValue(type), number); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "private", "void", "setTextureNumber", "(", "int", "type", ",", "int", "number", ")", "{", "m_numTextures", ".", "put", "(", "AiTextureType", ".", "fromRawValue", "(", "type", ")", ",", "number", ")", ";", "}" ]
This method is used by JNI, do not call or modify. @param type the type @param number the number
[ "This", "method", "is", "used", "by", "JNI", "do", "not", "call", "or", "modify", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L1334-L1337
looly/hutool
hutool-core/src/main/java/cn/hutool/core/convert/Convert.java
Convert.convertTime
public static long convertTime(long sourceDuration, TimeUnit sourceUnit, TimeUnit destUnit) { """ 转换时间单位 @param sourceDuration 时长 @param sourceUnit 源单位 @param destUnit 目标单位 @return 目标单位的时长 """ Assert.notNull(sourceUnit, "sourceUnit is null !"); Assert.notNull(destUnit, "destUnit is null !"); return destUnit.convert(sourceDuration, sourceUnit); }
java
public static long convertTime(long sourceDuration, TimeUnit sourceUnit, TimeUnit destUnit) { Assert.notNull(sourceUnit, "sourceUnit is null !"); Assert.notNull(destUnit, "destUnit is null !"); return destUnit.convert(sourceDuration, sourceUnit); }
[ "public", "static", "long", "convertTime", "(", "long", "sourceDuration", ",", "TimeUnit", "sourceUnit", ",", "TimeUnit", "destUnit", ")", "{", "Assert", ".", "notNull", "(", "sourceUnit", ",", "\"sourceUnit is null !\"", ")", ";", "Assert", ".", "notNull", "(", "destUnit", ",", "\"destUnit is null !\"", ")", ";", "return", "destUnit", ".", "convert", "(", "sourceDuration", ",", "sourceUnit", ")", ";", "}" ]
转换时间单位 @param sourceDuration 时长 @param sourceUnit 源单位 @param destUnit 目标单位 @return 目标单位的时长
[ "转换时间单位" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/convert/Convert.java#L796-L800
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/EngineConfiguration.java
EngineConfiguration.nullSafeIntegerComparison
private static int nullSafeIntegerComparison(Integer o1, Integer o2) { """ Compares {@code Integer} types, taking into account possible {@code null} values. When {@code null}, then the return value will be such that the other value will come first in a comparison. If both values are {@code null}, then they are effectively equal. @param o1 The first value to compare. @param o2 The second value to compare. @return -1, 0, or 1 if the first value should come before, equal to, or after the second. """ return o1 != null ? o2 != null ? o1.compareTo(o2) : -1 : o2 != null ? 1 : 0; }
java
private static int nullSafeIntegerComparison(Integer o1, Integer o2) { return o1 != null ? o2 != null ? o1.compareTo(o2) : -1 : o2 != null ? 1 : 0; }
[ "private", "static", "int", "nullSafeIntegerComparison", "(", "Integer", "o1", ",", "Integer", "o2", ")", "{", "return", "o1", "!=", "null", "?", "o2", "!=", "null", "?", "o1", ".", "compareTo", "(", "o2", ")", ":", "-", "1", ":", "o2", "!=", "null", "?", "1", ":", "0", ";", "}" ]
Compares {@code Integer} types, taking into account possible {@code null} values. When {@code null}, then the return value will be such that the other value will come first in a comparison. If both values are {@code null}, then they are effectively equal. @param o1 The first value to compare. @param o2 The second value to compare. @return -1, 0, or 1 if the first value should come before, equal to, or after the second.
[ "Compares", "{", "@code", "Integer", "}", "types", "taking", "into", "account", "possible", "{", "@code", "null", "}", "values", ".", "When", "{", "@code", "null", "}", "then", "the", "return", "value", "will", "be", "such", "that", "the", "other", "value", "will", "come", "first", "in", "a", "comparison", ".", "If", "both", "values", "are", "{", "@code", "null", "}", "then", "they", "are", "effectively", "equal", "." ]
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/EngineConfiguration.java#L334-L336
alibaba/Tangram-Android
tangram/src/main/java/com/tmall/wireless/tangram3/DefaultResolverRegistry.java
DefaultResolverRegistry.registerCard
public void registerCard(String type, Class<? extends Card> cardClz) { """ register card with type and card class @param type @param cardClz """ mDefaultCardResolver.register(type, cardClz); }
java
public void registerCard(String type, Class<? extends Card> cardClz) { mDefaultCardResolver.register(type, cardClz); }
[ "public", "void", "registerCard", "(", "String", "type", ",", "Class", "<", "?", "extends", "Card", ">", "cardClz", ")", "{", "mDefaultCardResolver", ".", "register", "(", "type", ",", "cardClz", ")", ";", "}" ]
register card with type and card class @param type @param cardClz
[ "register", "card", "with", "type", "and", "card", "class" ]
train
https://github.com/alibaba/Tangram-Android/blob/caa57f54e009c8dacd34a2322d5761956ebed321/tangram/src/main/java/com/tmall/wireless/tangram3/DefaultResolverRegistry.java#L82-L84
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java
StreamingLocatorsInner.listAsync
public Observable<Page<StreamingLocatorInner>> listAsync(final String resourceGroupName, final String accountName) { """ List Streaming Locators. Lists the Streaming Locators in the account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StreamingLocatorInner&gt; object """ return listWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<StreamingLocatorInner>>, Page<StreamingLocatorInner>>() { @Override public Page<StreamingLocatorInner> call(ServiceResponse<Page<StreamingLocatorInner>> response) { return response.body(); } }); }
java
public Observable<Page<StreamingLocatorInner>> listAsync(final String resourceGroupName, final String accountName) { return listWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<StreamingLocatorInner>>, Page<StreamingLocatorInner>>() { @Override public Page<StreamingLocatorInner> call(ServiceResponse<Page<StreamingLocatorInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "StreamingLocatorInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "StreamingLocatorInner", ">", ">", ",", "Page", "<", "StreamingLocatorInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "StreamingLocatorInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "StreamingLocatorInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List Streaming Locators. Lists the Streaming Locators in the account. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StreamingLocatorInner&gt; object
[ "List", "Streaming", "Locators", ".", "Lists", "the", "Streaming", "Locators", "in", "the", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/StreamingLocatorsInner.java#L147-L155
Pixplicity/EasyPrefs
library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java
Prefs.putOrderedStringSet
@SuppressWarnings("WeakerAccess") public static void putOrderedStringSet(String key, Set<String> value) { """ Stores a Set of Strings, preserving the order. Note that this method is heavier that the native implementation {@link #putStringSet(String, Set)} (which does not reliably preserve the order of the Set). To preserve the order of the items in the Set, the Set implementation must be one that as an iterator with predictable order, such as {@link LinkedHashSet}. @param key The name of the preference to modify. @param value The new value for the preference. @see #putStringSet(String, Set) @see #getOrderedStringSet(String, Set) """ final Editor editor = getPreferences().edit(); int stringSetLength = 0; if (mPrefs.contains(key + LENGTH)) { // First read what the value was stringSetLength = mPrefs.getInt(key + LENGTH, -1); } editor.putInt(key + LENGTH, value.size()); int i = 0; for (String aValue : value) { editor.putString(key + "[" + i + "]", aValue); i++; } for (; i < stringSetLength; i++) { // Remove any remaining values editor.remove(key + "[" + i + "]"); } editor.apply(); }
java
@SuppressWarnings("WeakerAccess") public static void putOrderedStringSet(String key, Set<String> value) { final Editor editor = getPreferences().edit(); int stringSetLength = 0; if (mPrefs.contains(key + LENGTH)) { // First read what the value was stringSetLength = mPrefs.getInt(key + LENGTH, -1); } editor.putInt(key + LENGTH, value.size()); int i = 0; for (String aValue : value) { editor.putString(key + "[" + i + "]", aValue); i++; } for (; i < stringSetLength; i++) { // Remove any remaining values editor.remove(key + "[" + i + "]"); } editor.apply(); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "static", "void", "putOrderedStringSet", "(", "String", "key", ",", "Set", "<", "String", ">", "value", ")", "{", "final", "Editor", "editor", "=", "getPreferences", "(", ")", ".", "edit", "(", ")", ";", "int", "stringSetLength", "=", "0", ";", "if", "(", "mPrefs", ".", "contains", "(", "key", "+", "LENGTH", ")", ")", "{", "// First read what the value was", "stringSetLength", "=", "mPrefs", ".", "getInt", "(", "key", "+", "LENGTH", ",", "-", "1", ")", ";", "}", "editor", ".", "putInt", "(", "key", "+", "LENGTH", ",", "value", ".", "size", "(", ")", ")", ";", "int", "i", "=", "0", ";", "for", "(", "String", "aValue", ":", "value", ")", "{", "editor", ".", "putString", "(", "key", "+", "\"[\"", "+", "i", "+", "\"]\"", ",", "aValue", ")", ";", "i", "++", ";", "}", "for", "(", ";", "i", "<", "stringSetLength", ";", "i", "++", ")", "{", "// Remove any remaining values", "editor", ".", "remove", "(", "key", "+", "\"[\"", "+", "i", "+", "\"]\"", ")", ";", "}", "editor", ".", "apply", "(", ")", ";", "}" ]
Stores a Set of Strings, preserving the order. Note that this method is heavier that the native implementation {@link #putStringSet(String, Set)} (which does not reliably preserve the order of the Set). To preserve the order of the items in the Set, the Set implementation must be one that as an iterator with predictable order, such as {@link LinkedHashSet}. @param key The name of the preference to modify. @param value The new value for the preference. @see #putStringSet(String, Set) @see #getOrderedStringSet(String, Set)
[ "Stores", "a", "Set", "of", "Strings", "preserving", "the", "order", ".", "Note", "that", "this", "method", "is", "heavier", "that", "the", "native", "implementation", "{", "@link", "#putStringSet", "(", "String", "Set", ")", "}", "(", "which", "does", "not", "reliably", "preserve", "the", "order", "of", "the", "Set", ")", ".", "To", "preserve", "the", "order", "of", "the", "items", "in", "the", "Set", "the", "Set", "implementation", "must", "be", "one", "that", "as", "an", "iterator", "with", "predictable", "order", "such", "as", "{", "@link", "LinkedHashSet", "}", "." ]
train
https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L385-L404
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/curves/PrecisionRecallCurve.java
PrecisionRecallCurve.getPointAtPrecision
public Point getPointAtPrecision(double precision) { """ Get the point (index, threshold, precision, recall) at the given precision.<br> Specifically, return the points at the lowest threshold that has precision equal to or greater than the requested precision. @param precision Precision to get the point for @return point (index, threshold, precision, recall) at (or closest exceeding) the given precision """ //Find the LOWEST threshold that gives the specified precision for (int i = 0; i < this.precision.length; i++) { if (this.precision[i] >= precision) { return new Point(i, threshold[i], this.precision[i], recall[i]); } } //Not found, return last point. Should never happen though... int i = threshold.length - 1; return new Point(i, threshold[i], this.precision[i], this.recall[i]); }
java
public Point getPointAtPrecision(double precision) { //Find the LOWEST threshold that gives the specified precision for (int i = 0; i < this.precision.length; i++) { if (this.precision[i] >= precision) { return new Point(i, threshold[i], this.precision[i], recall[i]); } } //Not found, return last point. Should never happen though... int i = threshold.length - 1; return new Point(i, threshold[i], this.precision[i], this.recall[i]); }
[ "public", "Point", "getPointAtPrecision", "(", "double", "precision", ")", "{", "//Find the LOWEST threshold that gives the specified precision", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "precision", ".", "length", ";", "i", "++", ")", "{", "if", "(", "this", ".", "precision", "[", "i", "]", ">=", "precision", ")", "{", "return", "new", "Point", "(", "i", ",", "threshold", "[", "i", "]", ",", "this", ".", "precision", "[", "i", "]", ",", "recall", "[", "i", "]", ")", ";", "}", "}", "//Not found, return last point. Should never happen though...", "int", "i", "=", "threshold", ".", "length", "-", "1", ";", "return", "new", "Point", "(", "i", ",", "threshold", "[", "i", "]", ",", "this", ".", "precision", "[", "i", "]", ",", "this", ".", "recall", "[", "i", "]", ")", ";", "}" ]
Get the point (index, threshold, precision, recall) at the given precision.<br> Specifically, return the points at the lowest threshold that has precision equal to or greater than the requested precision. @param precision Precision to get the point for @return point (index, threshold, precision, recall) at (or closest exceeding) the given precision
[ "Get", "the", "point", "(", "index", "threshold", "precision", "recall", ")", "at", "the", "given", "precision", ".", "<br", ">", "Specifically", "return", "the", "points", "at", "the", "lowest", "threshold", "that", "has", "precision", "equal", "to", "or", "greater", "than", "the", "requested", "precision", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/curves/PrecisionRecallCurve.java#L162-L174
pf4j/pf4j-update
src/main/java/org/pf4j/update/UpdateManager.java
UpdateManager.downloadPlugin
protected Path downloadPlugin(String id, String version) throws PluginException { """ Downloads a plugin with given coordinates, runs all {@link FileVerifier}s and returns a path to the downloaded file. @param id of plugin @param version of plugin or null to download latest @return Path to file which will reside in a temporary folder in the system default temp area @throws PluginException if download failed """ try { PluginRelease release = findReleaseForPlugin(id, version); Path downloaded = getFileDownloader(id).downloadFile(new URL(release.url)); getFileVerifier(id).verify(new FileVerifier.Context(id, release), downloaded); return downloaded; } catch (IOException e) { throw new PluginException(e, "Error during download of plugin {}", id); } }
java
protected Path downloadPlugin(String id, String version) throws PluginException { try { PluginRelease release = findReleaseForPlugin(id, version); Path downloaded = getFileDownloader(id).downloadFile(new URL(release.url)); getFileVerifier(id).verify(new FileVerifier.Context(id, release), downloaded); return downloaded; } catch (IOException e) { throw new PluginException(e, "Error during download of plugin {}", id); } }
[ "protected", "Path", "downloadPlugin", "(", "String", "id", ",", "String", "version", ")", "throws", "PluginException", "{", "try", "{", "PluginRelease", "release", "=", "findReleaseForPlugin", "(", "id", ",", "version", ")", ";", "Path", "downloaded", "=", "getFileDownloader", "(", "id", ")", ".", "downloadFile", "(", "new", "URL", "(", "release", ".", "url", ")", ")", ";", "getFileVerifier", "(", "id", ")", ".", "verify", "(", "new", "FileVerifier", ".", "Context", "(", "id", ",", "release", ")", ",", "downloaded", ")", ";", "return", "downloaded", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "PluginException", "(", "e", ",", "\"Error during download of plugin {}\"", ",", "id", ")", ";", "}", "}" ]
Downloads a plugin with given coordinates, runs all {@link FileVerifier}s and returns a path to the downloaded file. @param id of plugin @param version of plugin or null to download latest @return Path to file which will reside in a temporary folder in the system default temp area @throws PluginException if download failed
[ "Downloads", "a", "plugin", "with", "given", "coordinates", "runs", "all", "{", "@link", "FileVerifier", "}", "s", "and", "returns", "a", "path", "to", "the", "downloaded", "file", "." ]
train
https://github.com/pf4j/pf4j-update/blob/80cf04b8f2790808d0cf9dff3602dc5d730ac979/src/main/java/org/pf4j/update/UpdateManager.java#L259-L268
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.setFile
public void setFile(Element el, String key, File value) { """ sets a file value to a XML Element @param el Element to set value on it @param key key to set @param value value to set """ setFile(el, key, ResourceUtil.toResource(value)); }
java
public void setFile(Element el, String key, File value) { setFile(el, key, ResourceUtil.toResource(value)); }
[ "public", "void", "setFile", "(", "Element", "el", ",", "String", "key", ",", "File", "value", ")", "{", "setFile", "(", "el", ",", "key", ",", "ResourceUtil", ".", "toResource", "(", "value", ")", ")", ";", "}" ]
sets a file value to a XML Element @param el Element to set value on it @param key key to set @param value value to set
[ "sets", "a", "file", "value", "to", "a", "XML", "Element" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L368-L370
apache/incubator-gobblin
gobblin-api/src/main/java/org/apache/gobblin/configuration/WorkUnitState.java
WorkUnitState.addFinalConstructState
public void addFinalConstructState(String infix, State finalConstructState) { """ Adds all properties from {@link org.apache.gobblin.configuration.State} to this {@link org.apache.gobblin.configuration.WorkUnitState}. <p> A property with name "property" will be added to this object with the key "{@link #FINAL_CONSTRUCT_STATE_PREFIX}[.<infix>].property" </p> @param infix Optional infix used for the name of the property in the {@link org.apache.gobblin.configuration.WorkUnitState}. @param finalConstructState {@link org.apache.gobblin.configuration.State} for which all properties should be added to this object. """ for (String property : finalConstructState.getPropertyNames()) { if (Strings.isNullOrEmpty(infix)) { setProp(FINAL_CONSTRUCT_STATE_PREFIX + property, finalConstructState.getProp(property)); } else { setProp(FINAL_CONSTRUCT_STATE_PREFIX + infix + "." + property, finalConstructState.getProp(property)); } } }
java
public void addFinalConstructState(String infix, State finalConstructState) { for (String property : finalConstructState.getPropertyNames()) { if (Strings.isNullOrEmpty(infix)) { setProp(FINAL_CONSTRUCT_STATE_PREFIX + property, finalConstructState.getProp(property)); } else { setProp(FINAL_CONSTRUCT_STATE_PREFIX + infix + "." + property, finalConstructState.getProp(property)); } } }
[ "public", "void", "addFinalConstructState", "(", "String", "infix", ",", "State", "finalConstructState", ")", "{", "for", "(", "String", "property", ":", "finalConstructState", ".", "getPropertyNames", "(", ")", ")", "{", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "infix", ")", ")", "{", "setProp", "(", "FINAL_CONSTRUCT_STATE_PREFIX", "+", "property", ",", "finalConstructState", ".", "getProp", "(", "property", ")", ")", ";", "}", "else", "{", "setProp", "(", "FINAL_CONSTRUCT_STATE_PREFIX", "+", "infix", "+", "\".\"", "+", "property", ",", "finalConstructState", ".", "getProp", "(", "property", ")", ")", ";", "}", "}", "}" ]
Adds all properties from {@link org.apache.gobblin.configuration.State} to this {@link org.apache.gobblin.configuration.WorkUnitState}. <p> A property with name "property" will be added to this object with the key "{@link #FINAL_CONSTRUCT_STATE_PREFIX}[.<infix>].property" </p> @param infix Optional infix used for the name of the property in the {@link org.apache.gobblin.configuration.WorkUnitState}. @param finalConstructState {@link org.apache.gobblin.configuration.State} for which all properties should be added to this object.
[ "Adds", "all", "properties", "from", "{", "@link", "org", ".", "apache", ".", "gobblin", ".", "configuration", ".", "State", "}", "to", "this", "{", "@link", "org", ".", "apache", ".", "gobblin", ".", "configuration", ".", "WorkUnitState", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/configuration/WorkUnitState.java#L462-L470
auth0/auth0-java
src/main/java/com/auth0/client/auth/AuthAPI.java
AuthAPI.signUp
public SignUpRequest signUp(String email, String username, String password, String connection) { """ Creates a sign up request with the given credentials and database connection. "Requires Username" option must be turned on in the Connection's configuration first. i.e.: <pre> {@code AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne"); try { Map<String, String> fields = new HashMap<String, String>(); fields.put("age", "25); fields.put("city", "Buenos Aires"); auth.signUp("[email protected]", "myself", "topsecret", "db-connection") .setCustomFields(fields) .execute(); } catch (Auth0Exception e) { //Something happened } } </pre> @param email the desired user's email. @param username the desired user's username. @param password the desired user's password. @param connection the database connection where the user is going to be created. @return a Request to configure and execute. """ Asserts.assertNotNull(username, "username"); CreateUserRequest request = (CreateUserRequest) this.signUp(email, password, connection); request.addParameter(KEY_USERNAME, username); return request; }
java
public SignUpRequest signUp(String email, String username, String password, String connection) { Asserts.assertNotNull(username, "username"); CreateUserRequest request = (CreateUserRequest) this.signUp(email, password, connection); request.addParameter(KEY_USERNAME, username); return request; }
[ "public", "SignUpRequest", "signUp", "(", "String", "email", ",", "String", "username", ",", "String", "password", ",", "String", "connection", ")", "{", "Asserts", ".", "assertNotNull", "(", "username", ",", "\"username\"", ")", ";", "CreateUserRequest", "request", "=", "(", "CreateUserRequest", ")", "this", ".", "signUp", "(", "email", ",", "password", ",", "connection", ")", ";", "request", ".", "addParameter", "(", "KEY_USERNAME", ",", "username", ")", ";", "return", "request", ";", "}" ]
Creates a sign up request with the given credentials and database connection. "Requires Username" option must be turned on in the Connection's configuration first. i.e.: <pre> {@code AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne"); try { Map<String, String> fields = new HashMap<String, String>(); fields.put("age", "25); fields.put("city", "Buenos Aires"); auth.signUp("[email protected]", "myself", "topsecret", "db-connection") .setCustomFields(fields) .execute(); } catch (Auth0Exception e) { //Something happened } } </pre> @param email the desired user's email. @param username the desired user's username. @param password the desired user's password. @param connection the database connection where the user is going to be created. @return a Request to configure and execute.
[ "Creates", "a", "sign", "up", "request", "with", "the", "given", "credentials", "and", "database", "connection", ".", "Requires", "Username", "option", "must", "be", "turned", "on", "in", "the", "Connection", "s", "configuration", "first", ".", "i", ".", "e", ".", ":", "<pre", ">", "{", "@code", "AuthAPI", "auth", "=", "new", "AuthAPI", "(", "me", ".", "auth0", ".", "com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr", "-", "yWfkaBne", ")", ";", "try", "{", "Map<String", "String", ">", "fields", "=", "new", "HashMap<String", "String", ">", "()", ";", "fields", ".", "put", "(", "age", "25", ")", ";", "fields", ".", "put", "(", "city", "Buenos", "Aires", ")", ";", "auth", ".", "signUp", "(", "me@auth0", ".", "com", "myself", "topsecret", "db", "-", "connection", ")", ".", "setCustomFields", "(", "fields", ")", ".", "execute", "()", ";", "}", "catch", "(", "Auth0Exception", "e", ")", "{", "//", "Something", "happened", "}", "}", "<", "/", "pre", ">" ]
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/auth/AuthAPI.java#L253-L259