repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
mcxiaoke/Android-Next
core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java
IOUtils.writeStream
public static boolean writeStream(File file, InputStream stream) throws IOException { """ write file @param file @param stream @return @see {@link #writeStream(File, InputStream, boolean)} """ return writeStream(file, stream, false); }
java
public static boolean writeStream(File file, InputStream stream) throws IOException { return writeStream(file, stream, false); }
[ "public", "static", "boolean", "writeStream", "(", "File", "file", ",", "InputStream", "stream", ")", "throws", "IOException", "{", "return", "writeStream", "(", "file", ",", "stream", ",", "false", ")", ";", "}" ]
write file @param file @param stream @return @see {@link #writeStream(File, InputStream, boolean)}
[ "write", "file" ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/core/src/main/java/com/mcxiaoke/next/utils/IOUtils.java#L1211-L1213
h2oai/h2o-3
h2o-algos/src/main/java/hex/util/DimensionReductionUtils.java
DimensionReductionUtils.getTransformedEigenvectors
public static double[][] getTransformedEigenvectors(DataInfo dinfo, double[][] vEigenIn) { """ This function will tranform the eigenvectors calculated for a matrix T(A) to the ones calculated for matrix A. @param dinfo @param vEigenIn @return transformed eigenvectors """ Frame tempFrame = new Frame(dinfo._adaptedFrame); Frame eigFrame = new water.util.ArrayUtils().frame(vEigenIn); tempFrame.add(eigFrame); LinearAlgebraUtils.SMulTask stsk = new LinearAlgebraUtils.SMulTask(dinfo, eigFrame.numCols(), dinfo._numOffsets[dinfo._numOffsets.length - 1]); // will allocate new memory for _atq double[][] eigenVecs = stsk.doAll(tempFrame)._atq; if (eigFrame != null) { // delete frame to prevent leak keys. eigFrame.delete(); } // need to normalize eigenvectors after multiplication by transpose(A) so that they have unit norm double[][] eigenVecsTranspose = transpose(eigenVecs); // transpose will allocate memory double[] eigenNormsI = new double[eigenVecsTranspose.length]; for (int vecIndex = 0; vecIndex < eigenVecsTranspose.length; vecIndex++) { eigenNormsI[vecIndex] = 1.0 / l2norm(eigenVecsTranspose[vecIndex]); } return transpose(mult(eigenVecsTranspose, eigenNormsI)); }
java
public static double[][] getTransformedEigenvectors(DataInfo dinfo, double[][] vEigenIn) { Frame tempFrame = new Frame(dinfo._adaptedFrame); Frame eigFrame = new water.util.ArrayUtils().frame(vEigenIn); tempFrame.add(eigFrame); LinearAlgebraUtils.SMulTask stsk = new LinearAlgebraUtils.SMulTask(dinfo, eigFrame.numCols(), dinfo._numOffsets[dinfo._numOffsets.length - 1]); // will allocate new memory for _atq double[][] eigenVecs = stsk.doAll(tempFrame)._atq; if (eigFrame != null) { // delete frame to prevent leak keys. eigFrame.delete(); } // need to normalize eigenvectors after multiplication by transpose(A) so that they have unit norm double[][] eigenVecsTranspose = transpose(eigenVecs); // transpose will allocate memory double[] eigenNormsI = new double[eigenVecsTranspose.length]; for (int vecIndex = 0; vecIndex < eigenVecsTranspose.length; vecIndex++) { eigenNormsI[vecIndex] = 1.0 / l2norm(eigenVecsTranspose[vecIndex]); } return transpose(mult(eigenVecsTranspose, eigenNormsI)); }
[ "public", "static", "double", "[", "]", "[", "]", "getTransformedEigenvectors", "(", "DataInfo", "dinfo", ",", "double", "[", "]", "[", "]", "vEigenIn", ")", "{", "Frame", "tempFrame", "=", "new", "Frame", "(", "dinfo", ".", "_adaptedFrame", ")", ";", "Frame", "eigFrame", "=", "new", "water", ".", "util", ".", "ArrayUtils", "(", ")", ".", "frame", "(", "vEigenIn", ")", ";", "tempFrame", ".", "add", "(", "eigFrame", ")", ";", "LinearAlgebraUtils", ".", "SMulTask", "stsk", "=", "new", "LinearAlgebraUtils", ".", "SMulTask", "(", "dinfo", ",", "eigFrame", ".", "numCols", "(", ")", ",", "dinfo", ".", "_numOffsets", "[", "dinfo", ".", "_numOffsets", ".", "length", "-", "1", "]", ")", ";", "// will allocate new memory for _atq", "double", "[", "]", "[", "]", "eigenVecs", "=", "stsk", ".", "doAll", "(", "tempFrame", ")", ".", "_atq", ";", "if", "(", "eigFrame", "!=", "null", ")", "{", "// delete frame to prevent leak keys.", "eigFrame", ".", "delete", "(", ")", ";", "}", "// need to normalize eigenvectors after multiplication by transpose(A) so that they have unit norm", "double", "[", "]", "[", "]", "eigenVecsTranspose", "=", "transpose", "(", "eigenVecs", ")", ";", "// transpose will allocate memory", "double", "[", "]", "eigenNormsI", "=", "new", "double", "[", "eigenVecsTranspose", ".", "length", "]", ";", "for", "(", "int", "vecIndex", "=", "0", ";", "vecIndex", "<", "eigenVecsTranspose", ".", "length", ";", "vecIndex", "++", ")", "{", "eigenNormsI", "[", "vecIndex", "]", "=", "1.0", "/", "l2norm", "(", "eigenVecsTranspose", "[", "vecIndex", "]", ")", ";", "}", "return", "transpose", "(", "mult", "(", "eigenVecsTranspose", ",", "eigenNormsI", ")", ")", ";", "}" ]
This function will tranform the eigenvectors calculated for a matrix T(A) to the ones calculated for matrix A. @param dinfo @param vEigenIn @return transformed eigenvectors
[ "This", "function", "will", "tranform", "the", "eigenvectors", "calculated", "for", "a", "matrix", "T", "(", "A", ")", "to", "the", "ones", "calculated", "for", "matrix", "A", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-algos/src/main/java/hex/util/DimensionReductionUtils.java#L118-L139
cdk/cdk
base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java
SmilesValencyChecker.isSaturated
public boolean isSaturated(IBond bond, IAtomContainer atomContainer) throws CDKException { """ Returns whether a bond is saturated. A bond is saturated if <b>both</b> Atoms in the bond are saturated. """ logger.debug("isBondSaturated?: ", bond); IAtom[] atoms = BondManipulator.getAtomArray(bond); boolean isSaturated = true; for (int i = 0; i < atoms.length; i++) { logger.debug("isSaturated(Bond, AC): atom I=", i); isSaturated = isSaturated && isSaturated(atoms[i], atomContainer); } logger.debug("isSaturated(Bond, AC): result=", isSaturated); return isSaturated; }
java
public boolean isSaturated(IBond bond, IAtomContainer atomContainer) throws CDKException { logger.debug("isBondSaturated?: ", bond); IAtom[] atoms = BondManipulator.getAtomArray(bond); boolean isSaturated = true; for (int i = 0; i < atoms.length; i++) { logger.debug("isSaturated(Bond, AC): atom I=", i); isSaturated = isSaturated && isSaturated(atoms[i], atomContainer); } logger.debug("isSaturated(Bond, AC): result=", isSaturated); return isSaturated; }
[ "public", "boolean", "isSaturated", "(", "IBond", "bond", ",", "IAtomContainer", "atomContainer", ")", "throws", "CDKException", "{", "logger", ".", "debug", "(", "\"isBondSaturated?: \"", ",", "bond", ")", ";", "IAtom", "[", "]", "atoms", "=", "BondManipulator", ".", "getAtomArray", "(", "bond", ")", ";", "boolean", "isSaturated", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "atoms", ".", "length", ";", "i", "++", ")", "{", "logger", ".", "debug", "(", "\"isSaturated(Bond, AC): atom I=\"", ",", "i", ")", ";", "isSaturated", "=", "isSaturated", "&&", "isSaturated", "(", "atoms", "[", "i", "]", ",", "atomContainer", ")", ";", "}", "logger", ".", "debug", "(", "\"isSaturated(Bond, AC): result=\"", ",", "isSaturated", ")", ";", "return", "isSaturated", ";", "}" ]
Returns whether a bond is saturated. A bond is saturated if <b>both</b> Atoms in the bond are saturated.
[ "Returns", "whether", "a", "bond", "is", "saturated", ".", "A", "bond", "is", "saturated", "if", "<b", ">", "both<", "/", "b", ">", "Atoms", "in", "the", "bond", "are", "saturated", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/valencycheck/src/main/java/org/openscience/cdk/tools/SmilesValencyChecker.java#L198-L208
lonnyj/liquibase-spatial
src/main/java/liquibase/ext/spatial/preconditions/SpatialIndexExistsPrecondition.java
SpatialIndexExistsPrecondition.getIndexExample
protected Index getIndexExample(final Database database, final Schema schema, final String tableName) { """ Generates the {@link Index} example (taken from {@link IndexExistsPrecondition}). @param database the database instance. @param schema the schema instance. @param tableName the table name of the index. @return the index example. """ final Index example = new Index(); if (tableName != null) { example.setTable((Table) new Table().setName( database.correctObjectName(getTableName(), Table.class)).setSchema(schema)); } example.setName(database.correctObjectName(getIndexName(), Index.class)); if (StringUtils.trimToNull(getColumnNames()) != null) { for (final String columnName : getColumnNames().split("\\s*,\\s*")) { final Column column = new Column(database.correctObjectName(columnName, Column.class)); example.getColumns().add(column); } } return example; }
java
protected Index getIndexExample(final Database database, final Schema schema, final String tableName) { final Index example = new Index(); if (tableName != null) { example.setTable((Table) new Table().setName( database.correctObjectName(getTableName(), Table.class)).setSchema(schema)); } example.setName(database.correctObjectName(getIndexName(), Index.class)); if (StringUtils.trimToNull(getColumnNames()) != null) { for (final String columnName : getColumnNames().split("\\s*,\\s*")) { final Column column = new Column(database.correctObjectName(columnName, Column.class)); example.getColumns().add(column); } } return example; }
[ "protected", "Index", "getIndexExample", "(", "final", "Database", "database", ",", "final", "Schema", "schema", ",", "final", "String", "tableName", ")", "{", "final", "Index", "example", "=", "new", "Index", "(", ")", ";", "if", "(", "tableName", "!=", "null", ")", "{", "example", ".", "setTable", "(", "(", "Table", ")", "new", "Table", "(", ")", ".", "setName", "(", "database", ".", "correctObjectName", "(", "getTableName", "(", ")", ",", "Table", ".", "class", ")", ")", ".", "setSchema", "(", "schema", ")", ")", ";", "}", "example", ".", "setName", "(", "database", ".", "correctObjectName", "(", "getIndexName", "(", ")", ",", "Index", ".", "class", ")", ")", ";", "if", "(", "StringUtils", ".", "trimToNull", "(", "getColumnNames", "(", ")", ")", "!=", "null", ")", "{", "for", "(", "final", "String", "columnName", ":", "getColumnNames", "(", ")", ".", "split", "(", "\"\\\\s*,\\\\s*\"", ")", ")", "{", "final", "Column", "column", "=", "new", "Column", "(", "database", ".", "correctObjectName", "(", "columnName", ",", "Column", ".", "class", ")", ")", ";", "example", ".", "getColumns", "(", ")", ".", "add", "(", "column", ")", ";", "}", "}", "return", "example", ";", "}" ]
Generates the {@link Index} example (taken from {@link IndexExistsPrecondition}). @param database the database instance. @param schema the schema instance. @param tableName the table name of the index. @return the index example.
[ "Generates", "the", "{", "@link", "Index", "}", "example", "(", "taken", "from", "{", "@link", "IndexExistsPrecondition", "}", ")", "." ]
train
https://github.com/lonnyj/liquibase-spatial/blob/36ae41b0d3d08bb00a22c856e51ffeed08891c0e/src/main/java/liquibase/ext/spatial/preconditions/SpatialIndexExistsPrecondition.java#L187-L202
box/box-java-sdk
src/main/java/com/box/sdk/RetentionPolicyParams.java
RetentionPolicyParams.addCustomNotificationRecipient
public void addCustomNotificationRecipient(String userID) { """ Add a user by ID to the list of people to notify when the retention period is ending. @param userID The ID of the user to add to the list. """ BoxUser user = new BoxUser(null, userID); this.customNotificationRecipients.add(user.new Info()); }
java
public void addCustomNotificationRecipient(String userID) { BoxUser user = new BoxUser(null, userID); this.customNotificationRecipients.add(user.new Info()); }
[ "public", "void", "addCustomNotificationRecipient", "(", "String", "userID", ")", "{", "BoxUser", "user", "=", "new", "BoxUser", "(", "null", ",", "userID", ")", ";", "this", ".", "customNotificationRecipients", ".", "add", "(", "user", ".", "new", "Info", "(", ")", ")", ";", "}" ]
Add a user by ID to the list of people to notify when the retention period is ending. @param userID The ID of the user to add to the list.
[ "Add", "a", "user", "by", "ID", "to", "the", "list", "of", "people", "to", "notify", "when", "the", "retention", "period", "is", "ending", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/RetentionPolicyParams.java#L85-L89
gocd/gocd
server/src/main/java/com/thoughtworks/go/server/service/RestfulService.java
RestfulService.findJob
public JobIdentifier findJob(String pipelineName, String pipelineCounter, String stageName, String stageCounter, String buildName, Long buildId) { """ buildId should only be given when caller is absolutely sure about the job instance (makes sense in agent-uploading artifacts/properties scenario because agent won't run a job if its copied over(it only executes real jobs)) -JJ <p> This does not return pipelineLabel """ JobConfigIdentifier jobConfigIdentifier = goConfigService.translateToActualCase(new JobConfigIdentifier(pipelineName, stageName, buildName)); PipelineIdentifier pipelineIdentifier; if (JobIdentifier.LATEST.equalsIgnoreCase(pipelineCounter)) { pipelineIdentifier = pipelineService.mostRecentPipelineIdentifier(jobConfigIdentifier.getPipelineName()); } else if (StringUtils.isNumeric(pipelineCounter)) { pipelineIdentifier = pipelineService.findPipelineByNameAndCounter(pipelineName, Integer.parseInt(pipelineCounter)).getIdentifier(); } else { throw new RuntimeException("Expected numeric pipeline counter but received '%s'" + pipelineCounter); } stageCounter = StringUtils.isEmpty(stageCounter) ? JobIdentifier.LATEST : stageCounter; StageIdentifier stageIdentifier = translateStageCounter(pipelineIdentifier, jobConfigIdentifier.getStageName(), stageCounter); JobIdentifier jobId; if (buildId == null) { jobId = jobResolverService.actualJobIdentifier(new JobIdentifier(stageIdentifier, jobConfigIdentifier.getJobName())); } else { jobId = new JobIdentifier(stageIdentifier, jobConfigIdentifier.getJobName(), buildId); } if (jobId == null) { //fix for #5739 throw new RecordNotFoundException(String.format("Job '%s' not found in pipeline '%s' stage '%s'", buildName, pipelineName, stageName)); } return jobId; }
java
public JobIdentifier findJob(String pipelineName, String pipelineCounter, String stageName, String stageCounter, String buildName, Long buildId) { JobConfigIdentifier jobConfigIdentifier = goConfigService.translateToActualCase(new JobConfigIdentifier(pipelineName, stageName, buildName)); PipelineIdentifier pipelineIdentifier; if (JobIdentifier.LATEST.equalsIgnoreCase(pipelineCounter)) { pipelineIdentifier = pipelineService.mostRecentPipelineIdentifier(jobConfigIdentifier.getPipelineName()); } else if (StringUtils.isNumeric(pipelineCounter)) { pipelineIdentifier = pipelineService.findPipelineByNameAndCounter(pipelineName, Integer.parseInt(pipelineCounter)).getIdentifier(); } else { throw new RuntimeException("Expected numeric pipeline counter but received '%s'" + pipelineCounter); } stageCounter = StringUtils.isEmpty(stageCounter) ? JobIdentifier.LATEST : stageCounter; StageIdentifier stageIdentifier = translateStageCounter(pipelineIdentifier, jobConfigIdentifier.getStageName(), stageCounter); JobIdentifier jobId; if (buildId == null) { jobId = jobResolverService.actualJobIdentifier(new JobIdentifier(stageIdentifier, jobConfigIdentifier.getJobName())); } else { jobId = new JobIdentifier(stageIdentifier, jobConfigIdentifier.getJobName(), buildId); } if (jobId == null) { //fix for #5739 throw new RecordNotFoundException(String.format("Job '%s' not found in pipeline '%s' stage '%s'", buildName, pipelineName, stageName)); } return jobId; }
[ "public", "JobIdentifier", "findJob", "(", "String", "pipelineName", ",", "String", "pipelineCounter", ",", "String", "stageName", ",", "String", "stageCounter", ",", "String", "buildName", ",", "Long", "buildId", ")", "{", "JobConfigIdentifier", "jobConfigIdentifier", "=", "goConfigService", ".", "translateToActualCase", "(", "new", "JobConfigIdentifier", "(", "pipelineName", ",", "stageName", ",", "buildName", ")", ")", ";", "PipelineIdentifier", "pipelineIdentifier", ";", "if", "(", "JobIdentifier", ".", "LATEST", ".", "equalsIgnoreCase", "(", "pipelineCounter", ")", ")", "{", "pipelineIdentifier", "=", "pipelineService", ".", "mostRecentPipelineIdentifier", "(", "jobConfigIdentifier", ".", "getPipelineName", "(", ")", ")", ";", "}", "else", "if", "(", "StringUtils", ".", "isNumeric", "(", "pipelineCounter", ")", ")", "{", "pipelineIdentifier", "=", "pipelineService", ".", "findPipelineByNameAndCounter", "(", "pipelineName", ",", "Integer", ".", "parseInt", "(", "pipelineCounter", ")", ")", ".", "getIdentifier", "(", ")", ";", "}", "else", "{", "throw", "new", "RuntimeException", "(", "\"Expected numeric pipeline counter but received '%s'\"", "+", "pipelineCounter", ")", ";", "}", "stageCounter", "=", "StringUtils", ".", "isEmpty", "(", "stageCounter", ")", "?", "JobIdentifier", ".", "LATEST", ":", "stageCounter", ";", "StageIdentifier", "stageIdentifier", "=", "translateStageCounter", "(", "pipelineIdentifier", ",", "jobConfigIdentifier", ".", "getStageName", "(", ")", ",", "stageCounter", ")", ";", "JobIdentifier", "jobId", ";", "if", "(", "buildId", "==", "null", ")", "{", "jobId", "=", "jobResolverService", ".", "actualJobIdentifier", "(", "new", "JobIdentifier", "(", "stageIdentifier", ",", "jobConfigIdentifier", ".", "getJobName", "(", ")", ")", ")", ";", "}", "else", "{", "jobId", "=", "new", "JobIdentifier", "(", "stageIdentifier", ",", "jobConfigIdentifier", ".", "getJobName", "(", ")", ",", "buildId", ")", ";", "}", "if", "(", "jobId", "==", "null", ")", "{", "//fix for #5739", "throw", "new", "RecordNotFoundException", "(", "String", ".", "format", "(", "\"Job '%s' not found in pipeline '%s' stage '%s'\"", ",", "buildName", ",", "pipelineName", ",", "stageName", ")", ")", ";", "}", "return", "jobId", ";", "}" ]
buildId should only be given when caller is absolutely sure about the job instance (makes sense in agent-uploading artifacts/properties scenario because agent won't run a job if its copied over(it only executes real jobs)) -JJ <p> This does not return pipelineLabel
[ "buildId", "should", "only", "be", "given", "when", "caller", "is", "absolutely", "sure", "about", "the", "job", "instance", "(", "makes", "sense", "in", "agent", "-", "uploading", "artifacts", "/", "properties", "scenario", "because", "agent", "won", "t", "run", "a", "job", "if", "its", "copied", "over", "(", "it", "only", "executes", "real", "jobs", "))", "-", "JJ", "<p", ">", "This", "does", "not", "return", "pipelineLabel" ]
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/server/src/main/java/com/thoughtworks/go/server/service/RestfulService.java#L46-L73
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.lastIndexOf
public static int lastIndexOf(final CharSequence seq, final int searchChar, final int startPos) { """ Returns the index within <code>seq</code> of the last occurrence of the specified character, searching backward starting at the specified index. For values of <code>searchChar</code> in the range from 0 to 0xFFFF (inclusive), the index returned is the largest value <i>k</i> such that: <blockquote><pre> (this.charAt(<i>k</i>) == searchChar) &amp;&amp; (<i>k</i> &lt;= startPos) </pre></blockquote> is true. For other values of <code>searchChar</code>, it is the largest value <i>k</i> such that: <blockquote><pre> (this.codePointAt(<i>k</i>) == searchChar) &amp;&amp; (<i>k</i> &lt;= startPos) </pre></blockquote> is true. In either case, if no such character occurs in <code>seq</code> at or before position <code>startPos</code>, then <code>-1</code> is returned. Furthermore, a {@code null} or empty ("") <code>CharSequence</code> will return {@code -1}. A start position greater than the string length searches the whole string. The search starts at the <code>startPos</code> and works backwards; matches starting after the start position are ignored. <p>All indices are specified in <code>char</code> values (Unicode code units). <pre> StringUtils.lastIndexOf(null, *, *) = -1 StringUtils.lastIndexOf("", *, *) = -1 StringUtils.lastIndexOf("aabaabaa", 'b', 8) = 5 StringUtils.lastIndexOf("aabaabaa", 'b', 4) = 2 StringUtils.lastIndexOf("aabaabaa", 'b', 0) = -1 StringUtils.lastIndexOf("aabaabaa", 'b', 9) = 5 StringUtils.lastIndexOf("aabaabaa", 'b', -1) = -1 StringUtils.lastIndexOf("aabaabaa", 'a', 0) = 0 </pre> @param seq the CharSequence to check, may be null @param searchChar the character to find @param startPos the start position @return the last index of the search character (always &le; startPos), -1 if no match or {@code null} string input @since 2.0 @since 3.0 Changed signature from lastIndexOf(String, int, int) to lastIndexOf(CharSequence, int, int) """ if (isEmpty(seq)) { return INDEX_NOT_FOUND; } return CharSequenceUtils.lastIndexOf(seq, searchChar, startPos); }
java
public static int lastIndexOf(final CharSequence seq, final int searchChar, final int startPos) { if (isEmpty(seq)) { return INDEX_NOT_FOUND; } return CharSequenceUtils.lastIndexOf(seq, searchChar, startPos); }
[ "public", "static", "int", "lastIndexOf", "(", "final", "CharSequence", "seq", ",", "final", "int", "searchChar", ",", "final", "int", "startPos", ")", "{", "if", "(", "isEmpty", "(", "seq", ")", ")", "{", "return", "INDEX_NOT_FOUND", ";", "}", "return", "CharSequenceUtils", ".", "lastIndexOf", "(", "seq", ",", "searchChar", ",", "startPos", ")", ";", "}" ]
Returns the index within <code>seq</code> of the last occurrence of the specified character, searching backward starting at the specified index. For values of <code>searchChar</code> in the range from 0 to 0xFFFF (inclusive), the index returned is the largest value <i>k</i> such that: <blockquote><pre> (this.charAt(<i>k</i>) == searchChar) &amp;&amp; (<i>k</i> &lt;= startPos) </pre></blockquote> is true. For other values of <code>searchChar</code>, it is the largest value <i>k</i> such that: <blockquote><pre> (this.codePointAt(<i>k</i>) == searchChar) &amp;&amp; (<i>k</i> &lt;= startPos) </pre></blockquote> is true. In either case, if no such character occurs in <code>seq</code> at or before position <code>startPos</code>, then <code>-1</code> is returned. Furthermore, a {@code null} or empty ("") <code>CharSequence</code> will return {@code -1}. A start position greater than the string length searches the whole string. The search starts at the <code>startPos</code> and works backwards; matches starting after the start position are ignored. <p>All indices are specified in <code>char</code> values (Unicode code units). <pre> StringUtils.lastIndexOf(null, *, *) = -1 StringUtils.lastIndexOf("", *, *) = -1 StringUtils.lastIndexOf("aabaabaa", 'b', 8) = 5 StringUtils.lastIndexOf("aabaabaa", 'b', 4) = 2 StringUtils.lastIndexOf("aabaabaa", 'b', 0) = -1 StringUtils.lastIndexOf("aabaabaa", 'b', 9) = 5 StringUtils.lastIndexOf("aabaabaa", 'b', -1) = -1 StringUtils.lastIndexOf("aabaabaa", 'a', 0) = 0 </pre> @param seq the CharSequence to check, may be null @param searchChar the character to find @param startPos the start position @return the last index of the search character (always &le; startPos), -1 if no match or {@code null} string input @since 2.0 @since 3.0 Changed signature from lastIndexOf(String, int, int) to lastIndexOf(CharSequence, int, int)
[ "Returns", "the", "index", "within", "<code", ">", "seq<", "/", "code", ">", "of", "the", "last", "occurrence", "of", "the", "specified", "character", "searching", "backward", "starting", "at", "the", "specified", "index", ".", "For", "values", "of", "<code", ">", "searchChar<", "/", "code", ">", "in", "the", "range", "from", "0", "to", "0xFFFF", "(", "inclusive", ")", "the", "index", "returned", "is", "the", "largest", "value", "<i", ">", "k<", "/", "i", ">", "such", "that", ":", "<blockquote", ">", "<pre", ">", "(", "this", ".", "charAt", "(", "<i", ">", "k<", "/", "i", ">", ")", "==", "searchChar", ")", "&amp", ";", "&amp", ";", "(", "<i", ">", "k<", "/", "i", ">", "&lt", ";", "=", "startPos", ")", "<", "/", "pre", ">", "<", "/", "blockquote", ">", "is", "true", ".", "For", "other", "values", "of", "<code", ">", "searchChar<", "/", "code", ">", "it", "is", "the", "largest", "value", "<i", ">", "k<", "/", "i", ">", "such", "that", ":", "<blockquote", ">", "<pre", ">", "(", "this", ".", "codePointAt", "(", "<i", ">", "k<", "/", "i", ">", ")", "==", "searchChar", ")", "&amp", ";", "&amp", ";", "(", "<i", ">", "k<", "/", "i", ">", "&lt", ";", "=", "startPos", ")", "<", "/", "pre", ">", "<", "/", "blockquote", ">", "is", "true", ".", "In", "either", "case", "if", "no", "such", "character", "occurs", "in", "<code", ">", "seq<", "/", "code", ">", "at", "or", "before", "position", "<code", ">", "startPos<", "/", "code", ">", "then", "<code", ">", "-", "1<", "/", "code", ">", "is", "returned", ".", "Furthermore", "a", "{", "@code", "null", "}", "or", "empty", "(", ")", "<code", ">", "CharSequence<", "/", "code", ">", "will", "return", "{", "@code", "-", "1", "}", ".", "A", "start", "position", "greater", "than", "the", "string", "length", "searches", "the", "whole", "string", ".", "The", "search", "starts", "at", "the", "<code", ">", "startPos<", "/", "code", ">", "and", "works", "backwards", ";", "matches", "starting", "after", "the", "start", "position", "are", "ignored", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L1726-L1731
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.postAsync
public <T> CompletableFuture<T> postAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) { """ Executes an asynchronous POST request on the configured URI (asynchronous alias to the `post(Class,Closure)` method), with additional configuration provided by the configuration closure. The result will be cast to the specified `type`. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101' } CompletedFuture<Date> future = http.postAsync(Date){ request.uri.path = '/date' request.body = '{ "timezone": "America/Chicago" }' request.contentType = 'application/json' response.parser('text/date') { ChainedHttpConfig config, FromServer fromServer -> Date.parse('yyyy.MM.dd HH:mm', fromServer.inputStream.text) } } Date date = future.get() ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} containing the result of the request """ return CompletableFuture.supplyAsync(() -> post(type, closure), getExecutor()); }
java
public <T> CompletableFuture<T> postAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) { return CompletableFuture.supplyAsync(() -> post(type, closure), getExecutor()); }
[ "public", "<", "T", ">", "CompletableFuture", "<", "T", ">", "postAsync", "(", "final", "Class", "<", "T", ">", "type", ",", "@", "DelegatesTo", "(", "HttpConfig", ".", "class", ")", "final", "Closure", "closure", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "post", "(", "type", ",", "closure", ")", ",", "getExecutor", "(", ")", ")", ";", "}" ]
Executes an asynchronous POST request on the configured URI (asynchronous alias to the `post(Class,Closure)` method), with additional configuration provided by the configuration closure. The result will be cast to the specified `type`. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101' } CompletedFuture<Date> future = http.postAsync(Date){ request.uri.path = '/date' request.body = '{ "timezone": "America/Chicago" }' request.contentType = 'application/json' response.parser('text/date') { ChainedHttpConfig config, FromServer fromServer -> Date.parse('yyyy.MM.dd HH:mm', fromServer.inputStream.text) } } Date date = future.get() ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return the {@link CompletableFuture} containing the result of the request
[ "Executes", "an", "asynchronous", "POST", "request", "on", "the", "configured", "URI", "(", "asynchronous", "alias", "to", "the", "post", "(", "Class", "Closure", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "closure", ".", "The", "result", "will", "be", "cast", "to", "the", "specified", "type", "." ]
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L856-L858
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java
ComponentFactory.newFragment
public static <T> Fragment newFragment(final String id, final String markupId, final MarkupContainer markupProvider, final IModel<T> model) { """ Factory method for create a new {@link Fragment}. @param <T> the generic type @param id the id @param markupId The associated id of the associated markup fragment @param markupProvider The component whose markup contains the fragment's markup @param model The model for this {@link Fragment} @return The new {@link Fragment}. """ final Fragment fragment = new Fragment(id, markupId, markupProvider, model); fragment.setOutputMarkupId(true); return fragment; }
java
public static <T> Fragment newFragment(final String id, final String markupId, final MarkupContainer markupProvider, final IModel<T> model) { final Fragment fragment = new Fragment(id, markupId, markupProvider, model); fragment.setOutputMarkupId(true); return fragment; }
[ "public", "static", "<", "T", ">", "Fragment", "newFragment", "(", "final", "String", "id", ",", "final", "String", "markupId", ",", "final", "MarkupContainer", "markupProvider", ",", "final", "IModel", "<", "T", ">", "model", ")", "{", "final", "Fragment", "fragment", "=", "new", "Fragment", "(", "id", ",", "markupId", ",", "markupProvider", ",", "model", ")", ";", "fragment", ".", "setOutputMarkupId", "(", "true", ")", ";", "return", "fragment", ";", "}" ]
Factory method for create a new {@link Fragment}. @param <T> the generic type @param id the id @param markupId The associated id of the associated markup fragment @param markupProvider The component whose markup contains the fragment's markup @param model The model for this {@link Fragment} @return The new {@link Fragment}.
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "Fragment", "}", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java#L336-L342
morfologik/morfologik-stemming
morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java
Dictionary.read
public static Dictionary read(InputStream fsaStream, InputStream metadataStream) throws IOException { """ Attempts to load a dictionary from opened streams of FSA dictionary data and associated metadata. Input streams are not closed automatically. @param fsaStream The stream with FSA data @param metadataStream The stream with metadata @return Returns an instantiated {@link Dictionary}. @throws IOException if an I/O error occurs. """ return new Dictionary(FSA.read(fsaStream), DictionaryMetadata.read(metadataStream)); }
java
public static Dictionary read(InputStream fsaStream, InputStream metadataStream) throws IOException { return new Dictionary(FSA.read(fsaStream), DictionaryMetadata.read(metadataStream)); }
[ "public", "static", "Dictionary", "read", "(", "InputStream", "fsaStream", ",", "InputStream", "metadataStream", ")", "throws", "IOException", "{", "return", "new", "Dictionary", "(", "FSA", ".", "read", "(", "fsaStream", ")", ",", "DictionaryMetadata", ".", "read", "(", "metadataStream", ")", ")", ";", "}" ]
Attempts to load a dictionary from opened streams of FSA dictionary data and associated metadata. Input streams are not closed automatically. @param fsaStream The stream with FSA data @param metadataStream The stream with metadata @return Returns an instantiated {@link Dictionary}. @throws IOException if an I/O error occurs.
[ "Attempts", "to", "load", "a", "dictionary", "from", "opened", "streams", "of", "FSA", "dictionary", "data", "and", "associated", "metadata", ".", "Input", "streams", "are", "not", "closed", "automatically", "." ]
train
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-stemming/src/main/java/morfologik/stemming/Dictionary.java#L101-L103
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/DefaultConvolutionInstance.java
DefaultConvolutionInstance.convn
@Override public INDArray convn(INDArray input, INDArray kernel, Convolution.Type type, int[] axes) { """ ND Convolution @param input the input to op @param kernel the kernel to op with @param type the opType of convolution @param axes the axes to do the convolution along @return the convolution of the given input and kernel """ throw new UnsupportedOperationException(); }
java
@Override public INDArray convn(INDArray input, INDArray kernel, Convolution.Type type, int[] axes) { throw new UnsupportedOperationException(); }
[ "@", "Override", "public", "INDArray", "convn", "(", "INDArray", "input", ",", "INDArray", "kernel", ",", "Convolution", ".", "Type", "type", ",", "int", "[", "]", "axes", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}" ]
ND Convolution @param input the input to op @param kernel the kernel to op with @param type the opType of convolution @param axes the axes to do the convolution along @return the convolution of the given input and kernel
[ "ND", "Convolution" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/DefaultConvolutionInstance.java#L37-L40
meertensinstituut/mtas
src/main/java/mtas/parser/cql/util/MtasCQLParserSentencePartCondition.java
MtasCQLParserSentencePartCondition.setFirstOccurence
public void setFirstOccurence(int min, int max) throws ParseException { """ Sets the first occurence. @param min the min @param max the max @throws ParseException the parse exception """ if (fullCondition == null) { if ((min < 0) || (min > max) || (max < 1)) { throw new ParseException("Illegal number {" + min + "," + max + "}"); } if (min == 0) { firstOptional = true; } firstMinimumOccurence = Math.max(1, min); firstMaximumOccurence = max; } else { throw new ParseException("fullCondition already generated"); } }
java
public void setFirstOccurence(int min, int max) throws ParseException { if (fullCondition == null) { if ((min < 0) || (min > max) || (max < 1)) { throw new ParseException("Illegal number {" + min + "," + max + "}"); } if (min == 0) { firstOptional = true; } firstMinimumOccurence = Math.max(1, min); firstMaximumOccurence = max; } else { throw new ParseException("fullCondition already generated"); } }
[ "public", "void", "setFirstOccurence", "(", "int", "min", ",", "int", "max", ")", "throws", "ParseException", "{", "if", "(", "fullCondition", "==", "null", ")", "{", "if", "(", "(", "min", "<", "0", ")", "||", "(", "min", ">", "max", ")", "||", "(", "max", "<", "1", ")", ")", "{", "throw", "new", "ParseException", "(", "\"Illegal number {\"", "+", "min", "+", "\",\"", "+", "max", "+", "\"}\"", ")", ";", "}", "if", "(", "min", "==", "0", ")", "{", "firstOptional", "=", "true", ";", "}", "firstMinimumOccurence", "=", "Math", ".", "max", "(", "1", ",", "min", ")", ";", "firstMaximumOccurence", "=", "max", ";", "}", "else", "{", "throw", "new", "ParseException", "(", "\"fullCondition already generated\"", ")", ";", "}", "}" ]
Sets the first occurence. @param min the min @param max the max @throws ParseException the parse exception
[ "Sets", "the", "first", "occurence", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/parser/cql/util/MtasCQLParserSentencePartCondition.java#L83-L96
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/runtime/AbstractEJBRuntime.java
AbstractEJBRuntime.createPersistentAutomaticTimers
protected int createPersistentAutomaticTimers(String appName, String moduleName, List<AutomaticTimerBean> timerBeans) throws RuntimeWarning { """ Only called if persistent timers exist <p> Creates the persistent automatic timers for the specified module. <p> The default behavior is that persistent timers are not supported and warnings will be logged if they are present. Subclasses should override this method if different behavior is required. <p> @param appName the application name @param moduleName the module name @param timerBeans the beans with automatic timers @return the number of timers created """ for (AutomaticTimerBean timerBean : timerBeans) { if (timerBean.getNumPersistentTimers() != 0) { Tr.warning(tc, "AUTOMATIC_PERSISTENT_TIMERS_NOT_SUPPORTED_CNTR0330W", new Object[] { timerBean.getBeanMetaData().getName(), moduleName, appName }); } } return 0; }
java
protected int createPersistentAutomaticTimers(String appName, String moduleName, List<AutomaticTimerBean> timerBeans) throws RuntimeWarning { for (AutomaticTimerBean timerBean : timerBeans) { if (timerBean.getNumPersistentTimers() != 0) { Tr.warning(tc, "AUTOMATIC_PERSISTENT_TIMERS_NOT_SUPPORTED_CNTR0330W", new Object[] { timerBean.getBeanMetaData().getName(), moduleName, appName }); } } return 0; }
[ "protected", "int", "createPersistentAutomaticTimers", "(", "String", "appName", ",", "String", "moduleName", ",", "List", "<", "AutomaticTimerBean", ">", "timerBeans", ")", "throws", "RuntimeWarning", "{", "for", "(", "AutomaticTimerBean", "timerBean", ":", "timerBeans", ")", "{", "if", "(", "timerBean", ".", "getNumPersistentTimers", "(", ")", "!=", "0", ")", "{", "Tr", ".", "warning", "(", "tc", ",", "\"AUTOMATIC_PERSISTENT_TIMERS_NOT_SUPPORTED_CNTR0330W\"", ",", "new", "Object", "[", "]", "{", "timerBean", ".", "getBeanMetaData", "(", ")", ".", "getName", "(", ")", ",", "moduleName", ",", "appName", "}", ")", ";", "}", "}", "return", "0", ";", "}" ]
Only called if persistent timers exist <p> Creates the persistent automatic timers for the specified module. <p> The default behavior is that persistent timers are not supported and warnings will be logged if they are present. Subclasses should override this method if different behavior is required. <p> @param appName the application name @param moduleName the module name @param timerBeans the beans with automatic timers @return the number of timers created
[ "Only", "called", "if", "persistent", "timers", "exist", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/runtime/AbstractEJBRuntime.java#L1779-L1787
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/HttpServerRequestActionBuilder.java
HttpServerRequestActionBuilder.queryParam
public HttpServerRequestActionBuilder queryParam(String name, String value) { """ Adds a query param to the request uri. @param name @param value @return """ httpMessage.queryParam(name, value); return this; }
java
public HttpServerRequestActionBuilder queryParam(String name, String value) { httpMessage.queryParam(name, value); return this; }
[ "public", "HttpServerRequestActionBuilder", "queryParam", "(", "String", "name", ",", "String", "value", ")", "{", "httpMessage", ".", "queryParam", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a query param to the request uri. @param name @param value @return
[ "Adds", "a", "query", "param", "to", "the", "request", "uri", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/HttpServerRequestActionBuilder.java#L111-L114
zaproxy/zaproxy
src/org/zaproxy/zap/extension/script/ScriptVars.java
ScriptVars.getScriptVar
public static String getScriptVar(ScriptContext context, String key) { """ Gets a script variable. @param context the context of the script. @param key the key of the variable. @return the value of the variable, might be {@code null} if no value was previously set. @throws IllegalArgumentException if the {@code context} is {@code null} or it does not contain the name of the script. """ return getScriptVarImpl(getScriptName(context), key); }
java
public static String getScriptVar(ScriptContext context, String key) { return getScriptVarImpl(getScriptName(context), key); }
[ "public", "static", "String", "getScriptVar", "(", "ScriptContext", "context", ",", "String", "key", ")", "{", "return", "getScriptVarImpl", "(", "getScriptName", "(", "context", ")", ",", "key", ")", ";", "}" ]
Gets a script variable. @param context the context of the script. @param key the key of the variable. @return the value of the variable, might be {@code null} if no value was previously set. @throws IllegalArgumentException if the {@code context} is {@code null} or it does not contain the name of the script.
[ "Gets", "a", "script", "variable", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ScriptVars.java#L249-L251
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/Context.java
Context.isTMNoTransaction
public static boolean isTMNoTransaction() throws EFapsException { """ Is a transaction associated with a target object for transaction manager? @return <i>true</i> if a transaction associated, otherwise <i>false</i> @throws EFapsException if the status of the transaction manager could not be evaluated @see #TRANSMANAG """ try { return Context.TRANSMANAG.getStatus() == Status.STATUS_NO_TRANSACTION; } catch (final SystemException e) { throw new EFapsException(Context.class, "isTMNoTransaction.SystemException", e); } }
java
public static boolean isTMNoTransaction() throws EFapsException { try { return Context.TRANSMANAG.getStatus() == Status.STATUS_NO_TRANSACTION; } catch (final SystemException e) { throw new EFapsException(Context.class, "isTMNoTransaction.SystemException", e); } }
[ "public", "static", "boolean", "isTMNoTransaction", "(", ")", "throws", "EFapsException", "{", "try", "{", "return", "Context", ".", "TRANSMANAG", ".", "getStatus", "(", ")", "==", "Status", ".", "STATUS_NO_TRANSACTION", ";", "}", "catch", "(", "final", "SystemException", "e", ")", "{", "throw", "new", "EFapsException", "(", "Context", ".", "class", ",", "\"isTMNoTransaction.SystemException\"", ",", "e", ")", ";", "}", "}" ]
Is a transaction associated with a target object for transaction manager? @return <i>true</i> if a transaction associated, otherwise <i>false</i> @throws EFapsException if the status of the transaction manager could not be evaluated @see #TRANSMANAG
[ "Is", "a", "transaction", "associated", "with", "a", "target", "object", "for", "transaction", "manager?" ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/Context.java#L1147-L1155
k3po/k3po
specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java
Functions.acceptClientToken
@Function public static boolean acceptClientToken(GSSContext context, byte[] token) { """ Accept a client token to establish a secure communication channel. @param context GSSContext for which a connection has been established to the remote peer @param token the client side token (client side, as in the token had to be bootstrapped by the client and this peer uses that token to update the GSSContext) @return a boolean to indicate whether the token was used to successfully establish a communication channel """ try { if (!context.isEstablished()) { byte[] nextToken = context.acceptSecContext(token, 0, token.length); return nextToken == null; } return true; } catch (GSSException ex) { throw new RuntimeException("Exception accepting client token", ex); } }
java
@Function public static boolean acceptClientToken(GSSContext context, byte[] token) { try { if (!context.isEstablished()) { byte[] nextToken = context.acceptSecContext(token, 0, token.length); return nextToken == null; } return true; } catch (GSSException ex) { throw new RuntimeException("Exception accepting client token", ex); } }
[ "@", "Function", "public", "static", "boolean", "acceptClientToken", "(", "GSSContext", "context", ",", "byte", "[", "]", "token", ")", "{", "try", "{", "if", "(", "!", "context", ".", "isEstablished", "(", ")", ")", "{", "byte", "[", "]", "nextToken", "=", "context", ".", "acceptSecContext", "(", "token", ",", "0", ",", "token", ".", "length", ")", ";", "return", "nextToken", "==", "null", ";", "}", "return", "true", ";", "}", "catch", "(", "GSSException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "\"Exception accepting client token\"", ",", "ex", ")", ";", "}", "}" ]
Accept a client token to establish a secure communication channel. @param context GSSContext for which a connection has been established to the remote peer @param token the client side token (client side, as in the token had to be bootstrapped by the client and this peer uses that token to update the GSSContext) @return a boolean to indicate whether the token was used to successfully establish a communication channel
[ "Accept", "a", "client", "token", "to", "establish", "a", "secure", "communication", "channel", "." ]
train
https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java#L221-L232
mangstadt/biweekly
src/main/java/biweekly/util/ListMultimap.java
ListMultimap.putAll
public void putAll(K key, Collection<? extends V> values) { """ Adds multiple values to the multimap. @param key the key @param values the values to add """ if (values.isEmpty()) { return; } key = sanitizeKey(key); List<V> list = map.get(key); if (list == null) { list = new ArrayList<V>(); map.put(key, list); } list.addAll(values); }
java
public void putAll(K key, Collection<? extends V> values) { if (values.isEmpty()) { return; } key = sanitizeKey(key); List<V> list = map.get(key); if (list == null) { list = new ArrayList<V>(); map.put(key, list); } list.addAll(values); }
[ "public", "void", "putAll", "(", "K", "key", ",", "Collection", "<", "?", "extends", "V", ">", "values", ")", "{", "if", "(", "values", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "key", "=", "sanitizeKey", "(", "key", ")", ";", "List", "<", "V", ">", "list", "=", "map", ".", "get", "(", "key", ")", ";", "if", "(", "list", "==", "null", ")", "{", "list", "=", "new", "ArrayList", "<", "V", ">", "(", ")", ";", "map", ".", "put", "(", "key", ",", "list", ")", ";", "}", "list", ".", "addAll", "(", "values", ")", ";", "}" ]
Adds multiple values to the multimap. @param key the key @param values the values to add
[ "Adds", "multiple", "values", "to", "the", "multimap", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/ListMultimap.java#L135-L147
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginGetTroubleshootingAsync
public Observable<TroubleshootingResultInner> beginGetTroubleshootingAsync(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) { """ Initiate troubleshooting on a specified resource. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that define the resource to troubleshoot. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TroubleshootingResultInner object """ return beginGetTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<TroubleshootingResultInner>, TroubleshootingResultInner>() { @Override public TroubleshootingResultInner call(ServiceResponse<TroubleshootingResultInner> response) { return response.body(); } }); }
java
public Observable<TroubleshootingResultInner> beginGetTroubleshootingAsync(String resourceGroupName, String networkWatcherName, TroubleshootingParameters parameters) { return beginGetTroubleshootingWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<TroubleshootingResultInner>, TroubleshootingResultInner>() { @Override public TroubleshootingResultInner call(ServiceResponse<TroubleshootingResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TroubleshootingResultInner", ">", "beginGetTroubleshootingAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "TroubleshootingParameters", "parameters", ")", "{", "return", "beginGetTroubleshootingWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "TroubleshootingResultInner", ">", ",", "TroubleshootingResultInner", ">", "(", ")", "{", "@", "Override", "public", "TroubleshootingResultInner", "call", "(", "ServiceResponse", "<", "TroubleshootingResultInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Initiate troubleshooting on a specified resource. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher resource. @param parameters Parameters that define the resource to troubleshoot. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TroubleshootingResultInner object
[ "Initiate", "troubleshooting", "on", "a", "specified", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1566-L1573
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.registerActiveOperation
protected <T, A> ActiveOperation<T, A> registerActiveOperation(A attachment) { """ Register an active operation. The operation-id will be generated. @param attachment the shared attachment @return the active operation """ final ActiveOperation.CompletedCallback<T> callback = getDefaultCallback(); return registerActiveOperation(attachment, callback); }
java
protected <T, A> ActiveOperation<T, A> registerActiveOperation(A attachment) { final ActiveOperation.CompletedCallback<T> callback = getDefaultCallback(); return registerActiveOperation(attachment, callback); }
[ "protected", "<", "T", ",", "A", ">", "ActiveOperation", "<", "T", ",", "A", ">", "registerActiveOperation", "(", "A", "attachment", ")", "{", "final", "ActiveOperation", ".", "CompletedCallback", "<", "T", ">", "callback", "=", "getDefaultCallback", "(", ")", ";", "return", "registerActiveOperation", "(", "attachment", ",", "callback", ")", ";", "}" ]
Register an active operation. The operation-id will be generated. @param attachment the shared attachment @return the active operation
[ "Register", "an", "active", "operation", ".", "The", "operation", "-", "id", "will", "be", "generated", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L340-L343
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getRewrittenResourceURI
public static String getRewrittenResourceURI( ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, String path, Map params, String fragment, boolean forXML ) throws URISyntaxException { """ Create a fully-rewritten URI given a path and parameters. <p> Calls the rewriter service using a type of {@link URLType#RESOURCE}. </p> @param servletContext the current ServletContext. @param request the current HttpServletRequest. @param response the current HttpServletResponse. @param path the path to process into a fully-rewritten URI. @param params the additional parameters to include in the URI query. @param fragment the fragment (anchor or location) for this URI. @param forXML flag indicating that the query of the uri should be written using the &quot;&amp;amp;&quot; entity, rather than the character, '&amp;'. @return a fully-rewritten URI for the given action. @throws URISyntaxException if there's a problem converting the action URI (derived from processing the given action name) into a MutableURI. """ return rewriteResourceOrHrefURL( servletContext, request, response, path, params, fragment, forXML, URLType.RESOURCE ); }
java
public static String getRewrittenResourceURI( ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, String path, Map params, String fragment, boolean forXML ) throws URISyntaxException { return rewriteResourceOrHrefURL( servletContext, request, response, path, params, fragment, forXML, URLType.RESOURCE ); }
[ "public", "static", "String", "getRewrittenResourceURI", "(", "ServletContext", "servletContext", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "String", "path", ",", "Map", "params", ",", "String", "fragment", ",", "boolean", "forXML", ")", "throws", "URISyntaxException", "{", "return", "rewriteResourceOrHrefURL", "(", "servletContext", ",", "request", ",", "response", ",", "path", ",", "params", ",", "fragment", ",", "forXML", ",", "URLType", ".", "RESOURCE", ")", ";", "}" ]
Create a fully-rewritten URI given a path and parameters. <p> Calls the rewriter service using a type of {@link URLType#RESOURCE}. </p> @param servletContext the current ServletContext. @param request the current HttpServletRequest. @param response the current HttpServletResponse. @param path the path to process into a fully-rewritten URI. @param params the additional parameters to include in the URI query. @param fragment the fragment (anchor or location) for this URI. @param forXML flag indicating that the query of the uri should be written using the &quot;&amp;amp;&quot; entity, rather than the character, '&amp;'. @return a fully-rewritten URI for the given action. @throws URISyntaxException if there's a problem converting the action URI (derived from processing the given action name) into a MutableURI.
[ "Create", "a", "fully", "-", "rewritten", "URI", "given", "a", "path", "and", "parameters", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1546-L1552
Azure/azure-sdk-for-java
containerinstance/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_04_01/implementation/StartContainersInner.java
StartContainersInner.launchExec
public ContainerExecResponseInner launchExec(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) { """ Starts the exec command for a specific container instance. Starts the exec command for a specified container instance in a specified resource group and container group. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerName The name of the container instance. @param containerExecRequest The request for the exec command. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ContainerExecResponseInner object if successful. """ return launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).toBlocking().single().body(); }
java
public ContainerExecResponseInner launchExec(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) { return launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).toBlocking().single().body(); }
[ "public", "ContainerExecResponseInner", "launchExec", "(", "String", "resourceGroupName", ",", "String", "containerGroupName", ",", "String", "containerName", ",", "ContainerExecRequest", "containerExecRequest", ")", "{", "return", "launchExecWithServiceResponseAsync", "(", "resourceGroupName", ",", "containerGroupName", ",", "containerName", ",", "containerExecRequest", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Starts the exec command for a specific container instance. Starts the exec command for a specified container instance in a specified resource group and container group. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerName The name of the container instance. @param containerExecRequest The request for the exec command. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ContainerExecResponseInner object if successful.
[ "Starts", "the", "exec", "command", "for", "a", "specific", "container", "instance", ".", "Starts", "the", "exec", "command", "for", "a", "specified", "container", "instance", "in", "a", "specified", "resource", "group", "and", "container", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_04_01/implementation/StartContainersInner.java#L76-L78
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodeConfigurationsInner.java
DscNodeConfigurationsInner.createOrUpdateAsync
public Observable<DscNodeConfigurationInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String nodeConfigurationName, DscNodeConfigurationCreateOrUpdateParameters parameters) { """ Create the node configuration identified by node configuration name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeConfigurationName The create or update parameters for configuration. @param parameters The create or update parameters for configuration. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DscNodeConfigurationInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeConfigurationName, parameters).map(new Func1<ServiceResponse<DscNodeConfigurationInner>, DscNodeConfigurationInner>() { @Override public DscNodeConfigurationInner call(ServiceResponse<DscNodeConfigurationInner> response) { return response.body(); } }); }
java
public Observable<DscNodeConfigurationInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String nodeConfigurationName, DscNodeConfigurationCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeConfigurationName, parameters).map(new Func1<ServiceResponse<DscNodeConfigurationInner>, DscNodeConfigurationInner>() { @Override public DscNodeConfigurationInner call(ServiceResponse<DscNodeConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DscNodeConfigurationInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "nodeConfigurationName", ",", "DscNodeConfigurationCreateOrUpdateParameters", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "nodeConfigurationName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DscNodeConfigurationInner", ">", ",", "DscNodeConfigurationInner", ">", "(", ")", "{", "@", "Override", "public", "DscNodeConfigurationInner", "call", "(", "ServiceResponse", "<", "DscNodeConfigurationInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create the node configuration identified by node configuration name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param nodeConfigurationName The create or update parameters for configuration. @param parameters The create or update parameters for configuration. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DscNodeConfigurationInner object
[ "Create", "the", "node", "configuration", "identified", "by", "node", "configuration", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodeConfigurationsInner.java#L309-L316
zaproxy/zaproxy
src/org/zaproxy/zap/extension/api/API.java
API.getLongLivedNonce
public String getLongLivedNonce(String apiUrl) { """ Returns a nonce that will be valid for the lifetime of the ZAP process to used with the API call specified by the URL @param apiUrl the API URL @return a nonce that will be valid for the lifetime of the ZAP process @since 2.6.0 """ String nonce = Long.toHexString(random.nextLong()); this.nonces.put(nonce, new Nonce(nonce, apiUrl, false)); return nonce; }
java
public String getLongLivedNonce(String apiUrl) { String nonce = Long.toHexString(random.nextLong()); this.nonces.put(nonce, new Nonce(nonce, apiUrl, false)); return nonce; }
[ "public", "String", "getLongLivedNonce", "(", "String", "apiUrl", ")", "{", "String", "nonce", "=", "Long", ".", "toHexString", "(", "random", ".", "nextLong", "(", ")", ")", ";", "this", ".", "nonces", ".", "put", "(", "nonce", ",", "new", "Nonce", "(", "nonce", ",", "apiUrl", ",", "false", ")", ")", ";", "return", "nonce", ";", "}" ]
Returns a nonce that will be valid for the lifetime of the ZAP process to used with the API call specified by the URL @param apiUrl the API URL @return a nonce that will be valid for the lifetime of the ZAP process @since 2.6.0
[ "Returns", "a", "nonce", "that", "will", "be", "valid", "for", "the", "lifetime", "of", "the", "ZAP", "process", "to", "used", "with", "the", "API", "call", "specified", "by", "the", "URL" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/api/API.java#L841-L845
RestComm/Restcomm-Connect
restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java
AccountsEndpoint.updateAccountAsXmlPost
@Path("/ { """ The {accountSid} could be the email address of the account we need to update. Later we check if this is SID or EMAIL """accountSid}") @Consumes(APPLICATION_FORM_URLENCODED) @POST @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateAccountAsXmlPost(@PathParam("accountSid") final String accountSid, final MultivaluedMap<String, String> data, @HeaderParam("Accept") String accept, @Context SecurityContext sec) { return updateAccount(accountSid, data, retrieveMediaType(accept), ContextUtil.convert(sec)); }
java
@Path("/{accountSid}") @Consumes(APPLICATION_FORM_URLENCODED) @POST @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response updateAccountAsXmlPost(@PathParam("accountSid") final String accountSid, final MultivaluedMap<String, String> data, @HeaderParam("Accept") String accept, @Context SecurityContext sec) { return updateAccount(accountSid, data, retrieveMediaType(accept), ContextUtil.convert(sec)); }
[ "@", "Path", "(", "\"/{accountSid}\"", ")", "@", "Consumes", "(", "APPLICATION_FORM_URLENCODED", ")", "@", "POST", "@", "Produces", "(", "{", "MediaType", ".", "APPLICATION_XML", ",", "MediaType", ".", "APPLICATION_JSON", "}", ")", "public", "Response", "updateAccountAsXmlPost", "(", "@", "PathParam", "(", "\"accountSid\"", ")", "final", "String", "accountSid", ",", "final", "MultivaluedMap", "<", "String", ",", "String", ">", "data", ",", "@", "HeaderParam", "(", "\"Accept\"", ")", "String", "accept", ",", "@", "Context", "SecurityContext", "sec", ")", "{", "return", "updateAccount", "(", "accountSid", ",", "data", ",", "retrieveMediaType", "(", "accept", ")", ",", "ContextUtil", ".", "convert", "(", "sec", ")", ")", ";", "}" ]
The {accountSid} could be the email address of the account we need to update. Later we check if this is SID or EMAIL
[ "The", "{", "accountSid", "}", "could", "be", "the", "email", "address", "of", "the", "account", "we", "need", "to", "update", ".", "Later", "we", "check", "if", "this", "is", "SID", "or", "EMAIL" ]
train
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java#L894-L903
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java
KeyUtil.generateKeyPair
public static KeyPair generateKeyPair(String algorithm, int keySize, byte[] seed) { """ 生成用于非对称加密的公钥和私钥<br> 密钥对生成算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator @param algorithm 非对称加密算法 @param keySize 密钥模(modulus )长度 @param seed 种子 @return {@link KeyPair} """ // SM2算法需要单独定义其曲线生成 if ("SM2".equalsIgnoreCase(algorithm)) { final ECGenParameterSpec sm2p256v1 = new ECGenParameterSpec(SM2_DEFAULT_CURVE); return generateKeyPair(algorithm, keySize, seed, sm2p256v1); } return generateKeyPair(algorithm, keySize, seed, (AlgorithmParameterSpec[]) null); }
java
public static KeyPair generateKeyPair(String algorithm, int keySize, byte[] seed) { // SM2算法需要单独定义其曲线生成 if ("SM2".equalsIgnoreCase(algorithm)) { final ECGenParameterSpec sm2p256v1 = new ECGenParameterSpec(SM2_DEFAULT_CURVE); return generateKeyPair(algorithm, keySize, seed, sm2p256v1); } return generateKeyPair(algorithm, keySize, seed, (AlgorithmParameterSpec[]) null); }
[ "public", "static", "KeyPair", "generateKeyPair", "(", "String", "algorithm", ",", "int", "keySize", ",", "byte", "[", "]", "seed", ")", "{", "// SM2算法需要单独定义其曲线生成\r", "if", "(", "\"SM2\"", ".", "equalsIgnoreCase", "(", "algorithm", ")", ")", "{", "final", "ECGenParameterSpec", "sm2p256v1", "=", "new", "ECGenParameterSpec", "(", "SM2_DEFAULT_CURVE", ")", ";", "return", "generateKeyPair", "(", "algorithm", ",", "keySize", ",", "seed", ",", "sm2p256v1", ")", ";", "}", "return", "generateKeyPair", "(", "algorithm", ",", "keySize", ",", "seed", ",", "(", "AlgorithmParameterSpec", "[", "]", ")", "null", ")", ";", "}" ]
生成用于非对称加密的公钥和私钥<br> 密钥对生成算法见:https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator @param algorithm 非对称加密算法 @param keySize 密钥模(modulus )长度 @param seed 种子 @return {@link KeyPair}
[ "生成用于非对称加密的公钥和私钥<br", ">", "密钥对生成算法见:https", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "7", "/", "docs", "/", "technotes", "/", "guides", "/", "security", "/", "StandardNames", ".", "html#KeyPairGenerator" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L345-L353
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.queryAppStream
public GetAppStreamResponse queryAppStream(String app, String stream) { """ get detail of your stream by app name and stream name @param app app name @param stream stream name @return the response """ GetAppStreamRequest request = new GetAppStreamRequest(); request.setApp(app); request.setStream(stream); return queryAppStream(request); }
java
public GetAppStreamResponse queryAppStream(String app, String stream) { GetAppStreamRequest request = new GetAppStreamRequest(); request.setApp(app); request.setStream(stream); return queryAppStream(request); }
[ "public", "GetAppStreamResponse", "queryAppStream", "(", "String", "app", ",", "String", "stream", ")", "{", "GetAppStreamRequest", "request", "=", "new", "GetAppStreamRequest", "(", ")", ";", "request", ".", "setApp", "(", "app", ")", ";", "request", ".", "setStream", "(", "stream", ")", ";", "return", "queryAppStream", "(", "request", ")", ";", "}" ]
get detail of your stream by app name and stream name @param app app name @param stream stream name @return the response
[ "get", "detail", "of", "your", "stream", "by", "app", "name", "and", "stream", "name" ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L834-L839
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java
CalligraphyUtils.pullFontPathFromView
static String pullFontPathFromView(Context context, AttributeSet attrs, int[] attributeId) { """ Tries to pull the Custom Attribute directly from the TextView. @param context Activity Context @param attrs View Attributes @param attributeId if -1 returns null. @return null if attribute is not defined or added to View """ if (attributeId == null || attrs == null) return null; final String attributeName; try { attributeName = context.getResources().getResourceEntryName(attributeId[0]); } catch (Resources.NotFoundException e) { // invalid attribute ID return null; } final int stringResourceId = attrs.getAttributeResourceValue(null, attributeName, -1); return stringResourceId > 0 ? context.getString(stringResourceId) : attrs.getAttributeValue(null, attributeName); }
java
static String pullFontPathFromView(Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) return null; final String attributeName; try { attributeName = context.getResources().getResourceEntryName(attributeId[0]); } catch (Resources.NotFoundException e) { // invalid attribute ID return null; } final int stringResourceId = attrs.getAttributeResourceValue(null, attributeName, -1); return stringResourceId > 0 ? context.getString(stringResourceId) : attrs.getAttributeValue(null, attributeName); }
[ "static", "String", "pullFontPathFromView", "(", "Context", "context", ",", "AttributeSet", "attrs", ",", "int", "[", "]", "attributeId", ")", "{", "if", "(", "attributeId", "==", "null", "||", "attrs", "==", "null", ")", "return", "null", ";", "final", "String", "attributeName", ";", "try", "{", "attributeName", "=", "context", ".", "getResources", "(", ")", ".", "getResourceEntryName", "(", "attributeId", "[", "0", "]", ")", ";", "}", "catch", "(", "Resources", ".", "NotFoundException", "e", ")", "{", "// invalid attribute ID", "return", "null", ";", "}", "final", "int", "stringResourceId", "=", "attrs", ".", "getAttributeResourceValue", "(", "null", ",", "attributeName", ",", "-", "1", ")", ";", "return", "stringResourceId", ">", "0", "?", "context", ".", "getString", "(", "stringResourceId", ")", ":", "attrs", ".", "getAttributeValue", "(", "null", ",", "attributeName", ")", ";", "}" ]
Tries to pull the Custom Attribute directly from the TextView. @param context Activity Context @param attrs View Attributes @param attributeId if -1 returns null. @return null if attribute is not defined or added to View
[ "Tries", "to", "pull", "the", "Custom", "Attribute", "directly", "from", "the", "TextView", "." ]
train
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyUtils.java#L157-L173
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RepositoryFileApi.java
RepositoryFileApi.getFile
@Deprecated public RepositoryFile getFile(String filePath, Integer projectId, String ref) throws GitLabApiException { """ Get file from repository. Allows you to receive information about file in repository like name, size, content. Note that file content is Base64 encoded. <pre><code>GitLab Endpoint: GET /projects/:id/repository/files</code></pre> @param filePath (required) - Full path to the file. Ex. lib/class.rb @param projectId (required) - the project ID @param ref (required) - The name of branch, tag or commit @return a RepositoryFile instance with the file info and file content @throws GitLabApiException if any exception occurs @deprecated Will be removed in version 5.0, replaced by {@link #getFile(Object, String, String)} """ if (isApiVersion(ApiVersion.V3)) { return (getFileV3(filePath, projectId, ref)); } else { return (getFile(projectId, filePath, ref, true)); } }
java
@Deprecated public RepositoryFile getFile(String filePath, Integer projectId, String ref) throws GitLabApiException { if (isApiVersion(ApiVersion.V3)) { return (getFileV3(filePath, projectId, ref)); } else { return (getFile(projectId, filePath, ref, true)); } }
[ "@", "Deprecated", "public", "RepositoryFile", "getFile", "(", "String", "filePath", ",", "Integer", "projectId", ",", "String", "ref", ")", "throws", "GitLabApiException", "{", "if", "(", "isApiVersion", "(", "ApiVersion", ".", "V3", ")", ")", "{", "return", "(", "getFileV3", "(", "filePath", ",", "projectId", ",", "ref", ")", ")", ";", "}", "else", "{", "return", "(", "getFile", "(", "projectId", ",", "filePath", ",", "ref", ",", "true", ")", ")", ";", "}", "}" ]
Get file from repository. Allows you to receive information about file in repository like name, size, content. Note that file content is Base64 encoded. <pre><code>GitLab Endpoint: GET /projects/:id/repository/files</code></pre> @param filePath (required) - Full path to the file. Ex. lib/class.rb @param projectId (required) - the project ID @param ref (required) - The name of branch, tag or commit @return a RepositoryFile instance with the file info and file content @throws GitLabApiException if any exception occurs @deprecated Will be removed in version 5.0, replaced by {@link #getFile(Object, String, String)}
[ "Get", "file", "from", "repository", ".", "Allows", "you", "to", "receive", "information", "about", "file", "in", "repository", "like", "name", "size", "content", ".", "Note", "that", "file", "content", "is", "Base64", "encoded", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryFileApi.java#L131-L139
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.writeFile
public static void writeFile(VirtualFile virtualFile, byte[] bytes) throws IOException { """ Write the given bytes to the given virtual file, replacing its current contents (if any) or creating a new file if one does not exist. @param virtualFile the virtual file to write @param bytes the bytes @throws IOException if an error occurs """ final File file = virtualFile.getPhysicalFile(); file.getParentFile().mkdirs(); final FileOutputStream fos = new FileOutputStream(file); try { fos.write(bytes); fos.close(); } finally { safeClose(fos); } }
java
public static void writeFile(VirtualFile virtualFile, byte[] bytes) throws IOException { final File file = virtualFile.getPhysicalFile(); file.getParentFile().mkdirs(); final FileOutputStream fos = new FileOutputStream(file); try { fos.write(bytes); fos.close(); } finally { safeClose(fos); } }
[ "public", "static", "void", "writeFile", "(", "VirtualFile", "virtualFile", ",", "byte", "[", "]", "bytes", ")", "throws", "IOException", "{", "final", "File", "file", "=", "virtualFile", ".", "getPhysicalFile", "(", ")", ";", "file", ".", "getParentFile", "(", ")", ".", "mkdirs", "(", ")", ";", "final", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ";", "try", "{", "fos", ".", "write", "(", "bytes", ")", ";", "fos", ".", "close", "(", ")", ";", "}", "finally", "{", "safeClose", "(", "fos", ")", ";", "}", "}" ]
Write the given bytes to the given virtual file, replacing its current contents (if any) or creating a new file if one does not exist. @param virtualFile the virtual file to write @param bytes the bytes @throws IOException if an error occurs
[ "Write", "the", "given", "bytes", "to", "the", "given", "virtual", "file", "replacing", "its", "current", "contents", "(", "if", "any", ")", "or", "creating", "a", "new", "file", "if", "one", "does", "not", "exist", "." ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L451-L461
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryDetector.java
QuatSymmetryDetector.calcLocalSymmetries
public static List<QuatSymmetryResults> calcLocalSymmetries( List<Subunit> subunits, QuatSymmetryParameters symmParams, SubunitClustererParameters clusterParams) { """ Returns a List of LOCAL symmetry results. This means that a subset of the {@link SubunitCluster} is left out of the symmetry calculation. Each element of the List is one possible LOCAL symmetry result. <p> Determine local symmetry if global structure is: (1) asymmetric, C1; (2) heteromeric (belongs to more than 1 subunit cluster); (3) more than 2 subunits (heteromers with just 2 chains cannot have local symmetry) @param subunits list of {@link Subunit} @param symmParams quaternary symmetry parameters @param clusterParams subunit clustering parameters @return List of LOCAL quaternary structure symmetry results. Empty if none. """ Stoichiometry composition = SubunitClusterer.cluster(subunits, clusterParams); return calcLocalSymmetries(composition, symmParams); }
java
public static List<QuatSymmetryResults> calcLocalSymmetries( List<Subunit> subunits, QuatSymmetryParameters symmParams, SubunitClustererParameters clusterParams) { Stoichiometry composition = SubunitClusterer.cluster(subunits, clusterParams); return calcLocalSymmetries(composition, symmParams); }
[ "public", "static", "List", "<", "QuatSymmetryResults", ">", "calcLocalSymmetries", "(", "List", "<", "Subunit", ">", "subunits", ",", "QuatSymmetryParameters", "symmParams", ",", "SubunitClustererParameters", "clusterParams", ")", "{", "Stoichiometry", "composition", "=", "SubunitClusterer", ".", "cluster", "(", "subunits", ",", "clusterParams", ")", ";", "return", "calcLocalSymmetries", "(", "composition", ",", "symmParams", ")", ";", "}" ]
Returns a List of LOCAL symmetry results. This means that a subset of the {@link SubunitCluster} is left out of the symmetry calculation. Each element of the List is one possible LOCAL symmetry result. <p> Determine local symmetry if global structure is: (1) asymmetric, C1; (2) heteromeric (belongs to more than 1 subunit cluster); (3) more than 2 subunits (heteromers with just 2 chains cannot have local symmetry) @param subunits list of {@link Subunit} @param symmParams quaternary symmetry parameters @param clusterParams subunit clustering parameters @return List of LOCAL quaternary structure symmetry results. Empty if none.
[ "Returns", "a", "List", "of", "LOCAL", "symmetry", "results", ".", "This", "means", "that", "a", "subset", "of", "the", "{", "@link", "SubunitCluster", "}", "is", "left", "out", "of", "the", "symmetry", "calculation", ".", "Each", "element", "of", "the", "List", "is", "one", "possible", "LOCAL", "symmetry", "result", ".", "<p", ">", "Determine", "local", "symmetry", "if", "global", "structure", "is", ":", "(", "1", ")", "asymmetric", "C1", ";", "(", "2", ")", "heteromeric", "(", "belongs", "to", "more", "than", "1", "subunit", "cluster", ")", ";", "(", "3", ")", "more", "than", "2", "subunits", "(", "heteromers", "with", "just", "2", "chains", "cannot", "have", "local", "symmetry", ")" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSymmetryDetector.java#L175-L181
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/lang/parser/GosuParserFactory.java
GosuParserFactory.createParser
public static IGosuParser createParser( String strSource, ISymbolTable symTable, IScriptabilityModifier scriptabilityConstraint ) { """ Creates an IGosuParser appropriate for parsing and executing Gosu. @param strSource The text of the the rule source @param symTable The symbol table the parser uses to parse and execute the rule @param scriptabilityConstraint Specifies the types of methods/properties that are visible @return A parser appropriate for parsing Gosu source. """ return CommonServices.getGosuParserFactory().createParser( strSource, symTable, scriptabilityConstraint ); }
java
public static IGosuParser createParser( String strSource, ISymbolTable symTable, IScriptabilityModifier scriptabilityConstraint ) { return CommonServices.getGosuParserFactory().createParser( strSource, symTable, scriptabilityConstraint ); }
[ "public", "static", "IGosuParser", "createParser", "(", "String", "strSource", ",", "ISymbolTable", "symTable", ",", "IScriptabilityModifier", "scriptabilityConstraint", ")", "{", "return", "CommonServices", ".", "getGosuParserFactory", "(", ")", ".", "createParser", "(", "strSource", ",", "symTable", ",", "scriptabilityConstraint", ")", ";", "}" ]
Creates an IGosuParser appropriate for parsing and executing Gosu. @param strSource The text of the the rule source @param symTable The symbol table the parser uses to parse and execute the rule @param scriptabilityConstraint Specifies the types of methods/properties that are visible @return A parser appropriate for parsing Gosu source.
[ "Creates", "an", "IGosuParser", "appropriate", "for", "parsing", "and", "executing", "Gosu", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/parser/GosuParserFactory.java#L22-L25
chr78rm/tracelogger
src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java
AbstractTracer.logException
public void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName) { """ Logs an exception with the given logLevel and the originating class. @param logLevel one of the predefined levels INFO, WARNING, ERROR, FATAL and SEVERE @param throwable the to be logged throwable @param clazz the originating class @param methodName the name of the relevant method """ Date timeStamp = new Date(); char border[] = new char[logLevel.toString().length() + 4]; Arrays.fill(border, '*'); String message; if (throwable.getMessage() != null) { message = throwable.getMessage().trim(); message = message.replace(System.getProperty("line.separator"), " => "); } else { message = "No message."; } synchronized (this.syncObject) { this.tracePrintStream.println(border); this.tracePrintStream.printf("* %s * [%tc] [%d,%s] [%s] [%s] \"%s\"%n", logLevel.toString(), timeStamp, Thread.currentThread().getId(), Thread.currentThread().getName(), clazz.getName(), methodName, message); this.tracePrintStream.println(border); throwable.printStackTrace(this.tracePrintStream); } }
java
public void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName) { Date timeStamp = new Date(); char border[] = new char[logLevel.toString().length() + 4]; Arrays.fill(border, '*'); String message; if (throwable.getMessage() != null) { message = throwable.getMessage().trim(); message = message.replace(System.getProperty("line.separator"), " => "); } else { message = "No message."; } synchronized (this.syncObject) { this.tracePrintStream.println(border); this.tracePrintStream.printf("* %s * [%tc] [%d,%s] [%s] [%s] \"%s\"%n", logLevel.toString(), timeStamp, Thread.currentThread().getId(), Thread.currentThread().getName(), clazz.getName(), methodName, message); this.tracePrintStream.println(border); throwable.printStackTrace(this.tracePrintStream); } }
[ "public", "void", "logException", "(", "LogLevel", "logLevel", ",", "Throwable", "throwable", ",", "Class", "clazz", ",", "String", "methodName", ")", "{", "Date", "timeStamp", "=", "new", "Date", "(", ")", ";", "char", "border", "[", "]", "=", "new", "char", "[", "logLevel", ".", "toString", "(", ")", ".", "length", "(", ")", "+", "4", "]", ";", "Arrays", ".", "fill", "(", "border", ",", "'", "'", ")", ";", "String", "message", ";", "if", "(", "throwable", ".", "getMessage", "(", ")", "!=", "null", ")", "{", "message", "=", "throwable", ".", "getMessage", "(", ")", ".", "trim", "(", ")", ";", "message", "=", "message", ".", "replace", "(", "System", ".", "getProperty", "(", "\"line.separator\"", ")", ",", "\" => \"", ")", ";", "}", "else", "{", "message", "=", "\"No message.\"", ";", "}", "synchronized", "(", "this", ".", "syncObject", ")", "{", "this", ".", "tracePrintStream", ".", "println", "(", "border", ")", ";", "this", ".", "tracePrintStream", ".", "printf", "(", "\"* %s * [%tc] [%d,%s] [%s] [%s] \\\"%s\\\"%n\"", ",", "logLevel", ".", "toString", "(", ")", ",", "timeStamp", ",", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ",", "Thread", ".", "currentThread", "(", ")", ".", "getName", "(", ")", ",", "clazz", ".", "getName", "(", ")", ",", "methodName", ",", "message", ")", ";", "this", ".", "tracePrintStream", ".", "println", "(", "border", ")", ";", "throwable", ".", "printStackTrace", "(", "this", ".", "tracePrintStream", ")", ";", "}", "}" ]
Logs an exception with the given logLevel and the originating class. @param logLevel one of the predefined levels INFO, WARNING, ERROR, FATAL and SEVERE @param throwable the to be logged throwable @param clazz the originating class @param methodName the name of the relevant method
[ "Logs", "an", "exception", "with", "the", "given", "logLevel", "and", "the", "originating", "class", "." ]
train
https://github.com/chr78rm/tracelogger/blob/ad22452b20f8111ad4d367302c2b26a100a20200/src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java#L542-L563
roboconf/roboconf-platform
core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java
OpenstackIaasHandler.swiftApi
static SwiftApi swiftApi( Map<String,String> targetProperties ) throws TargetException { """ Creates a JCloud context for Swift. @param targetProperties the target properties @return a non-null object @throws TargetException if the target properties are invalid """ validate( targetProperties ); return ContextBuilder .newBuilder( PROVIDER_SWIFT ) .endpoint( targetProperties.get( API_URL )) .credentials( identity( targetProperties ), targetProperties.get( PASSWORD )) .buildApi( SwiftApi.class ); }
java
static SwiftApi swiftApi( Map<String,String> targetProperties ) throws TargetException { validate( targetProperties ); return ContextBuilder .newBuilder( PROVIDER_SWIFT ) .endpoint( targetProperties.get( API_URL )) .credentials( identity( targetProperties ), targetProperties.get( PASSWORD )) .buildApi( SwiftApi.class ); }
[ "static", "SwiftApi", "swiftApi", "(", "Map", "<", "String", ",", "String", ">", "targetProperties", ")", "throws", "TargetException", "{", "validate", "(", "targetProperties", ")", ";", "return", "ContextBuilder", ".", "newBuilder", "(", "PROVIDER_SWIFT", ")", ".", "endpoint", "(", "targetProperties", ".", "get", "(", "API_URL", ")", ")", ".", "credentials", "(", "identity", "(", "targetProperties", ")", ",", "targetProperties", ".", "get", "(", "PASSWORD", ")", ")", ".", "buildApi", "(", "SwiftApi", ".", "class", ")", ";", "}" ]
Creates a JCloud context for Swift. @param targetProperties the target properties @return a non-null object @throws TargetException if the target properties are invalid
[ "Creates", "a", "JCloud", "context", "for", "Swift", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-openstack/src/main/java/net/roboconf/target/openstack/internal/OpenstackIaasHandler.java#L374-L382
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/NamespaceDto.java
NamespaceDto.transformToDto
public static NamespaceDto transformToDto(Namespace namespace) { """ Converts a namespace entity to a DTO. @param namespace The entity to convert. @return The namespace DTO. @throws WebApplicationException If an error occurs. """ if (namespace == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } NamespaceDto result = createDtoObject(NamespaceDto.class, namespace); for (PrincipalUser user : namespace.getUsers()) { result.addUsername(user.getUserName()); } return result; }
java
public static NamespaceDto transformToDto(Namespace namespace) { if (namespace == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } NamespaceDto result = createDtoObject(NamespaceDto.class, namespace); for (PrincipalUser user : namespace.getUsers()) { result.addUsername(user.getUserName()); } return result; }
[ "public", "static", "NamespaceDto", "transformToDto", "(", "Namespace", "namespace", ")", "{", "if", "(", "namespace", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Null entity object cannot be converted to Dto object.\"", ",", "Status", ".", "INTERNAL_SERVER_ERROR", ")", ";", "}", "NamespaceDto", "result", "=", "createDtoObject", "(", "NamespaceDto", ".", "class", ",", "namespace", ")", ";", "for", "(", "PrincipalUser", "user", ":", "namespace", ".", "getUsers", "(", ")", ")", "{", "result", ".", "addUsername", "(", "user", ".", "getUserName", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Converts a namespace entity to a DTO. @param namespace The entity to convert. @return The namespace DTO. @throws WebApplicationException If an error occurs.
[ "Converts", "a", "namespace", "entity", "to", "a", "DTO", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/NamespaceDto.java#L74-L85
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java
DefaultEntityManager.putDefaultCallback
private void putDefaultCallback(CallbackType callbackType, CallbackMetadata metadata) { """ Puts/adds the given callback type and its metadata to the list of default listeners. @param callbackType the event type @param metadata the callback metadata """ List<CallbackMetadata> metadataList = globalCallbacks.get(callbackType); if (metadataList == null) { metadataList = new ArrayList<>(); globalCallbacks.put(callbackType, metadataList); } metadataList.add(metadata); }
java
private void putDefaultCallback(CallbackType callbackType, CallbackMetadata metadata) { List<CallbackMetadata> metadataList = globalCallbacks.get(callbackType); if (metadataList == null) { metadataList = new ArrayList<>(); globalCallbacks.put(callbackType, metadataList); } metadataList.add(metadata); }
[ "private", "void", "putDefaultCallback", "(", "CallbackType", "callbackType", ",", "CallbackMetadata", "metadata", ")", "{", "List", "<", "CallbackMetadata", ">", "metadataList", "=", "globalCallbacks", ".", "get", "(", "callbackType", ")", ";", "if", "(", "metadataList", "==", "null", ")", "{", "metadataList", "=", "new", "ArrayList", "<>", "(", ")", ";", "globalCallbacks", ".", "put", "(", "callbackType", ",", "metadataList", ")", ";", "}", "metadataList", ".", "add", "(", "metadata", ")", ";", "}" ]
Puts/adds the given callback type and its metadata to the list of default listeners. @param callbackType the event type @param metadata the callback metadata
[ "Puts", "/", "adds", "the", "given", "callback", "type", "and", "its", "metadata", "to", "the", "list", "of", "default", "listeners", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java#L423-L430
mcxiaoke/Android-Next
recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java
HeaderFooterRecyclerAdapter.notifyContentItemMoved
public final void notifyContentItemMoved(int fromPosition, int toPosition) { """ Notifies that an existing content item is moved to another position. @param fromPosition the original position. @param toPosition the new position. """ if (fromPosition < 0 || toPosition < 0 || fromPosition >= contentItemCount || toPosition >= contentItemCount) { throw new IndexOutOfBoundsException("The given fromPosition " + fromPosition + " or toPosition " + toPosition + " is not within the position bounds for content items [0 - " + (contentItemCount - 1) + "]."); } notifyItemMoved(fromPosition + headerItemCount, toPosition + headerItemCount); }
java
public final void notifyContentItemMoved(int fromPosition, int toPosition) { if (fromPosition < 0 || toPosition < 0 || fromPosition >= contentItemCount || toPosition >= contentItemCount) { throw new IndexOutOfBoundsException("The given fromPosition " + fromPosition + " or toPosition " + toPosition + " is not within the position bounds for content items [0 - " + (contentItemCount - 1) + "]."); } notifyItemMoved(fromPosition + headerItemCount, toPosition + headerItemCount); }
[ "public", "final", "void", "notifyContentItemMoved", "(", "int", "fromPosition", ",", "int", "toPosition", ")", "{", "if", "(", "fromPosition", "<", "0", "||", "toPosition", "<", "0", "||", "fromPosition", ">=", "contentItemCount", "||", "toPosition", ">=", "contentItemCount", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"The given fromPosition \"", "+", "fromPosition", "+", "\" or toPosition \"", "+", "toPosition", "+", "\" is not within the position bounds for content items [0 - \"", "+", "(", "contentItemCount", "-", "1", ")", "+", "\"].\"", ")", ";", "}", "notifyItemMoved", "(", "fromPosition", "+", "headerItemCount", ",", "toPosition", "+", "headerItemCount", ")", ";", "}" ]
Notifies that an existing content item is moved to another position. @param fromPosition the original position. @param toPosition the new position.
[ "Notifies", "that", "an", "existing", "content", "item", "is", "moved", "to", "another", "position", "." ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L269-L275
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java
TermOfUsePanel.newContractPanel
protected Component newContractPanel(final String id, final IModel<HeaderContentListModelBean> model) { """ Factory method for creating the new {@link Component} for the contract. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} for the contract. @param id the id @param model the model @return the new {@link Component} for the contract """ return new ContractPanel(id, Model.of(model.getObject())); }
java
protected Component newContractPanel(final String id, final IModel<HeaderContentListModelBean> model) { return new ContractPanel(id, Model.of(model.getObject())); }
[ "protected", "Component", "newContractPanel", "(", "final", "String", "id", ",", "final", "IModel", "<", "HeaderContentListModelBean", ">", "model", ")", "{", "return", "new", "ContractPanel", "(", "id", ",", "Model", ".", "of", "(", "model", ".", "getObject", "(", ")", ")", ")", ";", "}" ]
Factory method for creating the new {@link Component} for the contract. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} for the contract. @param id the id @param model the model @return the new {@link Component} for the contract
[ "Factory", "method", "for", "creating", "the", "new", "{", "@link", "Component", "}", "for", "the", "contract", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", "version", "of", "a", "new", "{", "@link", "Component", "}", "for", "the", "contract", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L191-L195
wellner/jcarafe
jcarafe-core/src/main/java/org/mitre/jcarafe/jarafe/JarafeMETrainer.java
JarafeMETrainer.addTrainingInstance
public void addTrainingInstance(String label, List<String> features) { """ /* @param label - A string value that is the "gold standard" label for this training instance @param features - A list of strings that correspond to the names of the features present for this training instance """ maxent.addInstance(label,features); }
java
public void addTrainingInstance(String label, List<String> features) { maxent.addInstance(label,features); }
[ "public", "void", "addTrainingInstance", "(", "String", "label", ",", "List", "<", "String", ">", "features", ")", "{", "maxent", ".", "addInstance", "(", "label", ",", "features", ")", ";", "}" ]
/* @param label - A string value that is the "gold standard" label for this training instance @param features - A list of strings that correspond to the names of the features present for this training instance
[ "/", "*" ]
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/org/mitre/jcarafe/jarafe/JarafeMETrainer.java#L28-L30
nlalevee/jsourcemap
jsourcemap/src/java/org/hibnet/jsourcemap/IndexedSourceMapConsumer.java
IndexedSourceMapConsumer._parseMappings
@Override void _parseMappings(String aStr, String aSourceRoot) { """ Parse the mappings in a string in to a data structure which we can easily query (the ordered arrays in the `this.__generatedMappings` and `this.__originalMappings` properties). """ this.__generatedMappings = new ArrayList<>(); this.__originalMappings = new ArrayList<>(); for (int i = 0; i < this._sections.size(); i++) { ParsedSection section = this._sections.get(i); List<ParsedMapping> sectionMappings = section.consumer._generatedMappings(); for (int j = 0; j < sectionMappings.size(); j++) { ParsedMapping mapping = sectionMappings.get(j); String source = section.consumer._sources.at(mapping.source); if (section.consumer.sourceRoot != null) { source = Util.join(section.consumer.sourceRoot, source); } this._sources.add(source); Integer source_ = this._sources.indexOf(source); String name = section.consumer._names.at(mapping.name); this._names.add(name); Integer name_ = this._names.indexOf(name); // The mappings coming from the consumer for the section have // generated positions relative to the start of the section, so we // need to offset them to be relative to the start of the concatenated // generated file. ParsedMapping adjustedMapping = new ParsedMapping(mapping.generatedLine + (section.generatedOffset.generatedLine - 1), mapping.generatedColumn + ((section.generatedOffset.generatedLine == mapping.generatedLine) ? section.generatedOffset.generatedColumn - 1 : 0), mapping.originalLine, mapping.originalColumn, source_, name_); this.__generatedMappings.add(adjustedMapping); if (adjustedMapping.originalLine != null) { this.__originalMappings.add(adjustedMapping); } } } Collections.sort(this.__generatedMappings, Util::compareByGeneratedPositionsDeflated); Collections.sort(this.__originalMappings, Util::compareByOriginalPositions); }
java
@Override void _parseMappings(String aStr, String aSourceRoot) { this.__generatedMappings = new ArrayList<>(); this.__originalMappings = new ArrayList<>(); for (int i = 0; i < this._sections.size(); i++) { ParsedSection section = this._sections.get(i); List<ParsedMapping> sectionMappings = section.consumer._generatedMappings(); for (int j = 0; j < sectionMappings.size(); j++) { ParsedMapping mapping = sectionMappings.get(j); String source = section.consumer._sources.at(mapping.source); if (section.consumer.sourceRoot != null) { source = Util.join(section.consumer.sourceRoot, source); } this._sources.add(source); Integer source_ = this._sources.indexOf(source); String name = section.consumer._names.at(mapping.name); this._names.add(name); Integer name_ = this._names.indexOf(name); // The mappings coming from the consumer for the section have // generated positions relative to the start of the section, so we // need to offset them to be relative to the start of the concatenated // generated file. ParsedMapping adjustedMapping = new ParsedMapping(mapping.generatedLine + (section.generatedOffset.generatedLine - 1), mapping.generatedColumn + ((section.generatedOffset.generatedLine == mapping.generatedLine) ? section.generatedOffset.generatedColumn - 1 : 0), mapping.originalLine, mapping.originalColumn, source_, name_); this.__generatedMappings.add(adjustedMapping); if (adjustedMapping.originalLine != null) { this.__originalMappings.add(adjustedMapping); } } } Collections.sort(this.__generatedMappings, Util::compareByGeneratedPositionsDeflated); Collections.sort(this.__originalMappings, Util::compareByOriginalPositions); }
[ "@", "Override", "void", "_parseMappings", "(", "String", "aStr", ",", "String", "aSourceRoot", ")", "{", "this", ".", "__generatedMappings", "=", "new", "ArrayList", "<>", "(", ")", ";", "this", ".", "__originalMappings", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "_sections", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ParsedSection", "section", "=", "this", ".", "_sections", ".", "get", "(", "i", ")", ";", "List", "<", "ParsedMapping", ">", "sectionMappings", "=", "section", ".", "consumer", ".", "_generatedMappings", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "sectionMappings", ".", "size", "(", ")", ";", "j", "++", ")", "{", "ParsedMapping", "mapping", "=", "sectionMappings", ".", "get", "(", "j", ")", ";", "String", "source", "=", "section", ".", "consumer", ".", "_sources", ".", "at", "(", "mapping", ".", "source", ")", ";", "if", "(", "section", ".", "consumer", ".", "sourceRoot", "!=", "null", ")", "{", "source", "=", "Util", ".", "join", "(", "section", ".", "consumer", ".", "sourceRoot", ",", "source", ")", ";", "}", "this", ".", "_sources", ".", "add", "(", "source", ")", ";", "Integer", "source_", "=", "this", ".", "_sources", ".", "indexOf", "(", "source", ")", ";", "String", "name", "=", "section", ".", "consumer", ".", "_names", ".", "at", "(", "mapping", ".", "name", ")", ";", "this", ".", "_names", ".", "add", "(", "name", ")", ";", "Integer", "name_", "=", "this", ".", "_names", ".", "indexOf", "(", "name", ")", ";", "// The mappings coming from the consumer for the section have", "// generated positions relative to the start of the section, so we", "// need to offset them to be relative to the start of the concatenated", "// generated file.", "ParsedMapping", "adjustedMapping", "=", "new", "ParsedMapping", "(", "mapping", ".", "generatedLine", "+", "(", "section", ".", "generatedOffset", ".", "generatedLine", "-", "1", ")", ",", "mapping", ".", "generatedColumn", "+", "(", "(", "section", ".", "generatedOffset", ".", "generatedLine", "==", "mapping", ".", "generatedLine", ")", "?", "section", ".", "generatedOffset", ".", "generatedColumn", "-", "1", ":", "0", ")", ",", "mapping", ".", "originalLine", ",", "mapping", ".", "originalColumn", ",", "source_", ",", "name_", ")", ";", "this", ".", "__generatedMappings", ".", "add", "(", "adjustedMapping", ")", ";", "if", "(", "adjustedMapping", ".", "originalLine", "!=", "null", ")", "{", "this", ".", "__originalMappings", ".", "add", "(", "adjustedMapping", ")", ";", "}", "}", "}", "Collections", ".", "sort", "(", "this", ".", "__generatedMappings", ",", "Util", "::", "compareByGeneratedPositionsDeflated", ")", ";", "Collections", ".", "sort", "(", "this", ".", "__originalMappings", ",", "Util", "::", "compareByOriginalPositions", ")", ";", "}" ]
Parse the mappings in a string in to a data structure which we can easily query (the ordered arrays in the `this.__generatedMappings` and `this.__originalMappings` properties).
[ "Parse", "the", "mappings", "in", "a", "string", "in", "to", "a", "data", "structure", "which", "we", "can", "easily", "query", "(", "the", "ordered", "arrays", "in", "the", "this", ".", "__generatedMappings", "and", "this", ".", "__originalMappings", "properties", ")", "." ]
train
https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/IndexedSourceMapConsumer.java#L250-L289
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java
DestinationManager.addPseudoDestination
public final void addPseudoDestination(SIBUuid12 destinationUuid, BaseDestinationHandler handler) { """ Link a pseudo destination ID to a real destination handler. This is used to link destination IDs created for remote durable pub/sub to the appropriate Pub/Sub destination handler which hosts a localization of some durable subscription. @param destinationUuid The pseudo destination ID to link. @param handler The pub/sub (well BaseDestinationHandler anyway) which the destination is linked to. """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addPseudoDestination", new Object[] { destinationUuid, handler }); destinationIndex.addPseudoUuid(handler, destinationUuid); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addPseudoDestination"); }
java
public final void addPseudoDestination(SIBUuid12 destinationUuid, BaseDestinationHandler handler) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addPseudoDestination", new Object[] { destinationUuid, handler }); destinationIndex.addPseudoUuid(handler, destinationUuid); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addPseudoDestination"); }
[ "public", "final", "void", "addPseudoDestination", "(", "SIBUuid12", "destinationUuid", ",", "BaseDestinationHandler", "handler", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"addPseudoDestination\"", ",", "new", "Object", "[", "]", "{", "destinationUuid", ",", "handler", "}", ")", ";", "destinationIndex", ".", "addPseudoUuid", "(", "handler", ",", "destinationUuid", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"addPseudoDestination\"", ")", ";", "}" ]
Link a pseudo destination ID to a real destination handler. This is used to link destination IDs created for remote durable pub/sub to the appropriate Pub/Sub destination handler which hosts a localization of some durable subscription. @param destinationUuid The pseudo destination ID to link. @param handler The pub/sub (well BaseDestinationHandler anyway) which the destination is linked to.
[ "Link", "a", "pseudo", "destination", "ID", "to", "a", "real", "destination", "handler", ".", "This", "is", "used", "to", "link", "destination", "IDs", "created", "for", "remote", "durable", "pub", "/", "sub", "to", "the", "appropriate", "Pub", "/", "Sub", "destination", "handler", "which", "hosts", "a", "localization", "of", "some", "durable", "subscription", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1638-L1645
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java
DomainsInner.createOrUpdateOwnershipIdentifierAsync
public Observable<DomainOwnershipIdentifierInner> createOrUpdateOwnershipIdentifierAsync(String resourceGroupName, String domainName, String name, DomainOwnershipIdentifierInner domainOwnershipIdentifier) { """ Creates an ownership identifier for a domain or updates identifier details for an existing identifer. Creates an ownership identifier for a domain or updates identifier details for an existing identifer. @param resourceGroupName Name of the resource group to which the resource belongs. @param domainName Name of domain. @param name Name of identifier. @param domainOwnershipIdentifier A JSON representation of the domain ownership properties. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DomainOwnershipIdentifierInner object """ return createOrUpdateOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name, domainOwnershipIdentifier).map(new Func1<ServiceResponse<DomainOwnershipIdentifierInner>, DomainOwnershipIdentifierInner>() { @Override public DomainOwnershipIdentifierInner call(ServiceResponse<DomainOwnershipIdentifierInner> response) { return response.body(); } }); }
java
public Observable<DomainOwnershipIdentifierInner> createOrUpdateOwnershipIdentifierAsync(String resourceGroupName, String domainName, String name, DomainOwnershipIdentifierInner domainOwnershipIdentifier) { return createOrUpdateOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name, domainOwnershipIdentifier).map(new Func1<ServiceResponse<DomainOwnershipIdentifierInner>, DomainOwnershipIdentifierInner>() { @Override public DomainOwnershipIdentifierInner call(ServiceResponse<DomainOwnershipIdentifierInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DomainOwnershipIdentifierInner", ">", "createOrUpdateOwnershipIdentifierAsync", "(", "String", "resourceGroupName", ",", "String", "domainName", ",", "String", "name", ",", "DomainOwnershipIdentifierInner", "domainOwnershipIdentifier", ")", "{", "return", "createOrUpdateOwnershipIdentifierWithServiceResponseAsync", "(", "resourceGroupName", ",", "domainName", ",", "name", ",", "domainOwnershipIdentifier", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DomainOwnershipIdentifierInner", ">", ",", "DomainOwnershipIdentifierInner", ">", "(", ")", "{", "@", "Override", "public", "DomainOwnershipIdentifierInner", "call", "(", "ServiceResponse", "<", "DomainOwnershipIdentifierInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates an ownership identifier for a domain or updates identifier details for an existing identifer. Creates an ownership identifier for a domain or updates identifier details for an existing identifer. @param resourceGroupName Name of the resource group to which the resource belongs. @param domainName Name of domain. @param name Name of identifier. @param domainOwnershipIdentifier A JSON representation of the domain ownership properties. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DomainOwnershipIdentifierInner object
[ "Creates", "an", "ownership", "identifier", "for", "a", "domain", "or", "updates", "identifier", "details", "for", "an", "existing", "identifer", ".", "Creates", "an", "ownership", "identifier", "for", "a", "domain", "or", "updates", "identifier", "details", "for", "an", "existing", "identifer", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java#L1552-L1559
twotoasters/JazzyListView
library-recyclerview/src/main/java/com/twotoasters/jazzylistview/recyclerview/JazzyRecyclerViewScrollListener.java
JazzyRecyclerViewScrollListener.notifyAdditionalOnScrolledListener
private void notifyAdditionalOnScrolledListener(RecyclerView recyclerView, int dx, int dy) { """ Notifies the OnScrollListener of an onScroll event, since JazzyListView is the primary listener for onScroll events. """ if (mAdditionalOnScrollListener != null) { mAdditionalOnScrollListener.onScrolled(recyclerView, dx, dy); } }
java
private void notifyAdditionalOnScrolledListener(RecyclerView recyclerView, int dx, int dy) { if (mAdditionalOnScrollListener != null) { mAdditionalOnScrollListener.onScrolled(recyclerView, dx, dy); } }
[ "private", "void", "notifyAdditionalOnScrolledListener", "(", "RecyclerView", "recyclerView", ",", "int", "dx", ",", "int", "dy", ")", "{", "if", "(", "mAdditionalOnScrollListener", "!=", "null", ")", "{", "mAdditionalOnScrollListener", ".", "onScrolled", "(", "recyclerView", ",", "dx", ",", "dy", ")", ";", "}", "}" ]
Notifies the OnScrollListener of an onScroll event, since JazzyListView is the primary listener for onScroll events.
[ "Notifies", "the", "OnScrollListener", "of", "an", "onScroll", "event", "since", "JazzyListView", "is", "the", "primary", "listener", "for", "onScroll", "events", "." ]
train
https://github.com/twotoasters/JazzyListView/blob/4a69239f90374a71e7d4073448ca049bd074f7fe/library-recyclerview/src/main/java/com/twotoasters/jazzylistview/recyclerview/JazzyRecyclerViewScrollListener.java#L107-L111
SeaCloudsEU/SeaCloudsPlatform
sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/TemplateRestEntity.java
TemplateRestEntity.getTemplates
@GET public List<ITemplate> getTemplates(@QueryParam("providerId") String providerId, @QueryParam("serviceIds") String serviceIds) { """ Gets a the list of available templates from where we can get metrics, host information, etc. <pre> GET /templates Request: GET /templates{?serviceId} HTTP/1.1 Response: HTTP/1.1 200 Ok {@code <?xml version="1.0" encoding="UTF-8"?> <collection href="/templates"> <items offset="0" total="1"> <wsag:Template>...</wsag:Template> ... </items> </collection> } </pre> Example: <li>curl http://localhost:8080/sla-service/templates</li> <li>curl http://localhost:8080/sla-service/templates?serviceIds=service02</li> <li>curl http://localhost:8080/sla-service/templates?serviceIds=service02,service03</li> @return XML information with the different details and urls of the templates """ logger.debug("StartOf getTemplates - REQUEST for /templates"); TemplateHelperE templateRestHelper = getTemplateHelper(); // we remove the blank spaces just in case somebody is adding them String serviceIdsSplitted[] = null; if (serviceIds!=null){ String serviceIdsSplittedTmp[] = serviceIds.split(","); serviceIdsSplitted = new String[serviceIdsSplittedTmp.length]; String tmp = ""; for (int i=0; i<serviceIdsSplittedTmp.length;i++){ serviceIdsSplitted[i] = serviceIdsSplittedTmp[i].trim(); tmp+= " "+serviceIdsSplitted[i]; } logger.debug("getTemplates will search for service ids:"+tmp); } List<ITemplate> templates = templateRestHelper.getTemplates(providerId, serviceIdsSplitted); logger.debug("EndOf getTemplates"); return templates; }
java
@GET public List<ITemplate> getTemplates(@QueryParam("providerId") String providerId, @QueryParam("serviceIds") String serviceIds) { logger.debug("StartOf getTemplates - REQUEST for /templates"); TemplateHelperE templateRestHelper = getTemplateHelper(); // we remove the blank spaces just in case somebody is adding them String serviceIdsSplitted[] = null; if (serviceIds!=null){ String serviceIdsSplittedTmp[] = serviceIds.split(","); serviceIdsSplitted = new String[serviceIdsSplittedTmp.length]; String tmp = ""; for (int i=0; i<serviceIdsSplittedTmp.length;i++){ serviceIdsSplitted[i] = serviceIdsSplittedTmp[i].trim(); tmp+= " "+serviceIdsSplitted[i]; } logger.debug("getTemplates will search for service ids:"+tmp); } List<ITemplate> templates = templateRestHelper.getTemplates(providerId, serviceIdsSplitted); logger.debug("EndOf getTemplates"); return templates; }
[ "@", "GET", "public", "List", "<", "ITemplate", ">", "getTemplates", "(", "@", "QueryParam", "(", "\"providerId\"", ")", "String", "providerId", ",", "@", "QueryParam", "(", "\"serviceIds\"", ")", "String", "serviceIds", ")", "{", "logger", ".", "debug", "(", "\"StartOf getTemplates - REQUEST for /templates\"", ")", ";", "TemplateHelperE", "templateRestHelper", "=", "getTemplateHelper", "(", ")", ";", "// we remove the blank spaces just in case somebody is adding them", "String", "serviceIdsSplitted", "[", "]", "=", "null", ";", "if", "(", "serviceIds", "!=", "null", ")", "{", "String", "serviceIdsSplittedTmp", "[", "]", "=", "serviceIds", ".", "split", "(", "\",\"", ")", ";", "serviceIdsSplitted", "=", "new", "String", "[", "serviceIdsSplittedTmp", ".", "length", "]", ";", "String", "tmp", "=", "\"\"", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "serviceIdsSplittedTmp", ".", "length", ";", "i", "++", ")", "{", "serviceIdsSplitted", "[", "i", "]", "=", "serviceIdsSplittedTmp", "[", "i", "]", ".", "trim", "(", ")", ";", "tmp", "+=", "\" \"", "+", "serviceIdsSplitted", "[", "i", "]", ";", "}", "logger", ".", "debug", "(", "\"getTemplates will search for service ids:\"", "+", "tmp", ")", ";", "}", "List", "<", "ITemplate", ">", "templates", "=", "templateRestHelper", ".", "getTemplates", "(", "providerId", ",", "serviceIdsSplitted", ")", ";", "logger", ".", "debug", "(", "\"EndOf getTemplates\"", ")", ";", "return", "templates", ";", "}" ]
Gets a the list of available templates from where we can get metrics, host information, etc. <pre> GET /templates Request: GET /templates{?serviceId} HTTP/1.1 Response: HTTP/1.1 200 Ok {@code <?xml version="1.0" encoding="UTF-8"?> <collection href="/templates"> <items offset="0" total="1"> <wsag:Template>...</wsag:Template> ... </items> </collection> } </pre> Example: <li>curl http://localhost:8080/sla-service/templates</li> <li>curl http://localhost:8080/sla-service/templates?serviceIds=service02</li> <li>curl http://localhost:8080/sla-service/templates?serviceIds=service02,service03</li> @return XML information with the different details and urls of the templates
[ "Gets", "a", "the", "list", "of", "available", "templates", "from", "where", "we", "can", "get", "metrics", "host", "information", "etc", "." ]
train
https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/TemplateRestEntity.java#L155-L174
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.noTemplateSheet2Excel
public void noTemplateSheet2Excel(List<NoTemplateSheetWrapper> sheets, OutputStream os) throws Excel4JException, IOException { """ 无模板、基于注解、多sheet数据 @param sheets 待导出sheet数据 @param os 生成的Excel输出文件流 @throws Excel4JException 异常 @throws IOException 异常 """ try (Workbook workbook = exportExcelNoTemplateHandler(sheets, true)) { workbook.write(os); } }
java
public void noTemplateSheet2Excel(List<NoTemplateSheetWrapper> sheets, OutputStream os) throws Excel4JException, IOException { try (Workbook workbook = exportExcelNoTemplateHandler(sheets, true)) { workbook.write(os); } }
[ "public", "void", "noTemplateSheet2Excel", "(", "List", "<", "NoTemplateSheetWrapper", ">", "sheets", ",", "OutputStream", "os", ")", "throws", "Excel4JException", ",", "IOException", "{", "try", "(", "Workbook", "workbook", "=", "exportExcelNoTemplateHandler", "(", "sheets", ",", "true", ")", ")", "{", "workbook", ".", "write", "(", "os", ")", ";", "}", "}" ]
无模板、基于注解、多sheet数据 @param sheets 待导出sheet数据 @param os 生成的Excel输出文件流 @throws Excel4JException 异常 @throws IOException 异常
[ "无模板、基于注解、多sheet数据" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L1163-L1169
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.deleteCertificateAsync
public ServiceFuture<DeletedCertificateBundle> deleteCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<DeletedCertificateBundle> serviceCallback) { """ Deletes a certificate from a specified key vault. Deletes all versions of a certificate object along with its associated policy. Delete certificate cannot be used to remove individual versions of a certificate object. This operation requires the certificates/delete permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @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(deleteCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback); }
java
public ServiceFuture<DeletedCertificateBundle> deleteCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<DeletedCertificateBundle> serviceCallback) { return ServiceFuture.fromResponse(deleteCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback); }
[ "public", "ServiceFuture", "<", "DeletedCertificateBundle", ">", "deleteCertificateAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "final", "ServiceCallback", "<", "DeletedCertificateBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "deleteCertificateWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ")", ",", "serviceCallback", ")", ";", "}" ]
Deletes a certificate from a specified key vault. Deletes all versions of a certificate object along with its associated policy. Delete certificate cannot be used to remove individual versions of a certificate object. This operation requires the certificates/delete permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Deletes", "a", "certificate", "from", "a", "specified", "key", "vault", ".", "Deletes", "all", "versions", "of", "a", "certificate", "object", "along", "with", "its", "associated", "policy", ".", "Delete", "certificate", "cannot", "be", "used", "to", "remove", "individual", "versions", "of", "a", "certificate", "object", ".", "This", "operation", "requires", "the", "certificates", "/", "delete", "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#L5339-L5341
VoltDB/voltdb
src/frontend/org/voltdb/DefaultProcedureManager.java
DefaultProcedureManager.generateCrudReplicatedUpdate
private static String generateCrudReplicatedUpdate(Table table, Constraint pkey) { """ Create a statement like: "update <table> set {<each-column = ?>...} where {<pkey-column = ?>...} for a replicated table. """ StringBuilder sb = new StringBuilder(); sb.append("UPDATE " + table.getTypeName() + " SET "); generateCrudExpressionColumns(table, sb); generateCrudPKeyWhereClause(null, pkey, sb); sb.append(';'); return sb.toString(); }
java
private static String generateCrudReplicatedUpdate(Table table, Constraint pkey) { StringBuilder sb = new StringBuilder(); sb.append("UPDATE " + table.getTypeName() + " SET "); generateCrudExpressionColumns(table, sb); generateCrudPKeyWhereClause(null, pkey, sb); sb.append(';'); return sb.toString(); }
[ "private", "static", "String", "generateCrudReplicatedUpdate", "(", "Table", "table", ",", "Constraint", "pkey", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"UPDATE \"", "+", "table", ".", "getTypeName", "(", ")", "+", "\" SET \"", ")", ";", "generateCrudExpressionColumns", "(", "table", ",", "sb", ")", ";", "generateCrudPKeyWhereClause", "(", "null", ",", "pkey", ",", "sb", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Create a statement like: "update <table> set {<each-column = ?>...} where {<pkey-column = ?>...} for a replicated table.
[ "Create", "a", "statement", "like", ":", "update", "<table", ">", "set", "{", "<each", "-", "column", "=", "?", ">", "...", "}", "where", "{", "<pkey", "-", "column", "=", "?", ">", "...", "}", "for", "a", "replicated", "table", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/DefaultProcedureManager.java#L415-L425
apache/groovy
src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
StaticTypeCheckingVisitor.findCurrentInstanceOfClass
protected ClassNode findCurrentInstanceOfClass(final Expression expr, final ClassNode type) { """ A helper method which determines which receiver class should be used in error messages when a field or attribute is not found. The returned type class depends on whether we have temporary type information available (due to instanceof checks) and whether there is a single candidate in that case. @param expr the expression for which an unknown field has been found @param type the type of the expression (used as fallback type) @return if temporary information is available and there's only one type, returns the temporary type class otherwise falls back to the provided type class. """ if (!typeCheckingContext.temporaryIfBranchTypeInformation.empty()) { List<ClassNode> nodes = getTemporaryTypesForExpression(expr); if (nodes != null && nodes.size() == 1) return nodes.get(0); } return type; }
java
protected ClassNode findCurrentInstanceOfClass(final Expression expr, final ClassNode type) { if (!typeCheckingContext.temporaryIfBranchTypeInformation.empty()) { List<ClassNode> nodes = getTemporaryTypesForExpression(expr); if (nodes != null && nodes.size() == 1) return nodes.get(0); } return type; }
[ "protected", "ClassNode", "findCurrentInstanceOfClass", "(", "final", "Expression", "expr", ",", "final", "ClassNode", "type", ")", "{", "if", "(", "!", "typeCheckingContext", ".", "temporaryIfBranchTypeInformation", ".", "empty", "(", ")", ")", "{", "List", "<", "ClassNode", ">", "nodes", "=", "getTemporaryTypesForExpression", "(", "expr", ")", ";", "if", "(", "nodes", "!=", "null", "&&", "nodes", ".", "size", "(", ")", "==", "1", ")", "return", "nodes", ".", "get", "(", "0", ")", ";", "}", "return", "type", ";", "}" ]
A helper method which determines which receiver class should be used in error messages when a field or attribute is not found. The returned type class depends on whether we have temporary type information available (due to instanceof checks) and whether there is a single candidate in that case. @param expr the expression for which an unknown field has been found @param type the type of the expression (used as fallback type) @return if temporary information is available and there's only one type, returns the temporary type class otherwise falls back to the provided type class.
[ "A", "helper", "method", "which", "determines", "which", "receiver", "class", "should", "be", "used", "in", "error", "messages", "when", "a", "field", "or", "attribute", "is", "not", "found", ".", "The", "returned", "type", "class", "depends", "on", "whether", "we", "have", "temporary", "type", "information", "available", "(", "due", "to", "instanceof", "checks", ")", "and", "whether", "there", "is", "a", "single", "candidate", "in", "that", "case", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L1507-L1513
oehf/ipf-oht-atna
nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomain.java
SecurityDomain.fixKeyManagers
private void fixKeyManagers() { """ If a keystore alias is defined, then override the key manager assigned to with an alias-sensitive wrapper that selects the proper key from your assigned key alias. """ // If the key manager factory is null, do not continue if (null == keyManagerFactory || null == keyManagerFactory.getKeyManagers()) { return; } KeyManager[] defaultKeyManagers = keyManagerFactory.getKeyManagers(); KeyManager[] newKeyManagers = new KeyManager[defaultKeyManagers.length]; KeyManager mgr = null; for (int i = 0; i < defaultKeyManagers.length; i++) { mgr = defaultKeyManagers[i]; // If we're looking at an X509 Key manager, then wrap it in our // alias-selective manager if (mgr instanceof X509KeyManager) { mgr = new AliasSensitiveX509KeyManager(this, (X509KeyManager) mgr); } newKeyManagers[i] = mgr; } keyManagers = newKeyManagers; }
java
private void fixKeyManagers() { // If the key manager factory is null, do not continue if (null == keyManagerFactory || null == keyManagerFactory.getKeyManagers()) { return; } KeyManager[] defaultKeyManagers = keyManagerFactory.getKeyManagers(); KeyManager[] newKeyManagers = new KeyManager[defaultKeyManagers.length]; KeyManager mgr = null; for (int i = 0; i < defaultKeyManagers.length; i++) { mgr = defaultKeyManagers[i]; // If we're looking at an X509 Key manager, then wrap it in our // alias-selective manager if (mgr instanceof X509KeyManager) { mgr = new AliasSensitiveX509KeyManager(this, (X509KeyManager) mgr); } newKeyManagers[i] = mgr; } keyManagers = newKeyManagers; }
[ "private", "void", "fixKeyManagers", "(", ")", "{", "// If the key manager factory is null, do not continue", "if", "(", "null", "==", "keyManagerFactory", "||", "null", "==", "keyManagerFactory", ".", "getKeyManagers", "(", ")", ")", "{", "return", ";", "}", "KeyManager", "[", "]", "defaultKeyManagers", "=", "keyManagerFactory", ".", "getKeyManagers", "(", ")", ";", "KeyManager", "[", "]", "newKeyManagers", "=", "new", "KeyManager", "[", "defaultKeyManagers", ".", "length", "]", ";", "KeyManager", "mgr", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "defaultKeyManagers", ".", "length", ";", "i", "++", ")", "{", "mgr", "=", "defaultKeyManagers", "[", "i", "]", ";", "// If we're looking at an X509 Key manager, then wrap it in our", "// alias-selective manager", "if", "(", "mgr", "instanceof", "X509KeyManager", ")", "{", "mgr", "=", "new", "AliasSensitiveX509KeyManager", "(", "this", ",", "(", "X509KeyManager", ")", "mgr", ")", ";", "}", "newKeyManagers", "[", "i", "]", "=", "mgr", ";", "}", "keyManagers", "=", "newKeyManagers", ";", "}" ]
If a keystore alias is defined, then override the key manager assigned to with an alias-sensitive wrapper that selects the proper key from your assigned key alias.
[ "If", "a", "keystore", "alias", "is", "defined", "then", "override", "the", "key", "manager", "assigned", "to", "with", "an", "alias", "-", "sensitive", "wrapper", "that", "selects", "the", "proper", "key", "from", "your", "assigned", "key", "alias", "." ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/nodeauth/src/main/java/org/openhealthtools/ihe/atna/nodeauth/SecurityDomain.java#L438-L458
primefaces/primefaces
src/main/java/org/primefaces/expression/SearchExpressionFacade.java
SearchExpressionFacade.validateExpressions
protected static void validateExpressions(FacesContext context, UIComponent source, String expressions, String[] splittedExpressions) { """ Validates the given search expressions. We only validate it, for performance reasons, if the current {@link ProjectStage} is {@link ProjectStage#Development}. @param context The {@link FacesContext}. @param source The source component. E.g. a button. @param expressions The search expression. @param splittedExpressions The already splitted expressions. """ if (context.isProjectStage(ProjectStage.Development)) { if (splittedExpressions.length > 1) { if (expressions.contains(SearchExpressionConstants.NONE_KEYWORD) || expressions.contains(SearchExpressionConstants.ALL_KEYWORD)) { throw new FacesException("It's not possible to use @none or @all combined with other expressions." + " Expressions: \"" + expressions + "\" referenced from \"" + source.getClientId(context) + "\""); } } } }
java
protected static void validateExpressions(FacesContext context, UIComponent source, String expressions, String[] splittedExpressions) { if (context.isProjectStage(ProjectStage.Development)) { if (splittedExpressions.length > 1) { if (expressions.contains(SearchExpressionConstants.NONE_KEYWORD) || expressions.contains(SearchExpressionConstants.ALL_KEYWORD)) { throw new FacesException("It's not possible to use @none or @all combined with other expressions." + " Expressions: \"" + expressions + "\" referenced from \"" + source.getClientId(context) + "\""); } } } }
[ "protected", "static", "void", "validateExpressions", "(", "FacesContext", "context", ",", "UIComponent", "source", ",", "String", "expressions", ",", "String", "[", "]", "splittedExpressions", ")", "{", "if", "(", "context", ".", "isProjectStage", "(", "ProjectStage", ".", "Development", ")", ")", "{", "if", "(", "splittedExpressions", ".", "length", ">", "1", ")", "{", "if", "(", "expressions", ".", "contains", "(", "SearchExpressionConstants", ".", "NONE_KEYWORD", ")", "||", "expressions", ".", "contains", "(", "SearchExpressionConstants", ".", "ALL_KEYWORD", ")", ")", "{", "throw", "new", "FacesException", "(", "\"It's not possible to use @none or @all combined with other expressions.\"", "+", "\" Expressions: \\\"\"", "+", "expressions", "+", "\"\\\" referenced from \\\"\"", "+", "source", ".", "getClientId", "(", "context", ")", "+", "\"\\\"\"", ")", ";", "}", "}", "}", "}" ]
Validates the given search expressions. We only validate it, for performance reasons, if the current {@link ProjectStage} is {@link ProjectStage#Development}. @param context The {@link FacesContext}. @param source The source component. E.g. a button. @param expressions The search expression. @param splittedExpressions The already splitted expressions.
[ "Validates", "the", "given", "search", "expressions", ".", "We", "only", "validate", "it", "for", "performance", "reasons", "if", "the", "current", "{", "@link", "ProjectStage", "}", "is", "{", "@link", "ProjectStage#Development", "}", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/expression/SearchExpressionFacade.java#L786-L799
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateSubList
public OperationStatus updateSubList(UUID appId, String versionId, UUID clEntityId, int subListId, WordListBaseUpdateObject wordListBaseUpdateObject) { """ Updates one of the closed list's sublists. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list entity extractor ID. @param subListId The sublist ID. @param wordListBaseUpdateObject A sublist update object containing the new canonical form and the list of words. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful. """ return updateSubListWithServiceResponseAsync(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject).toBlocking().single().body(); }
java
public OperationStatus updateSubList(UUID appId, String versionId, UUID clEntityId, int subListId, WordListBaseUpdateObject wordListBaseUpdateObject) { return updateSubListWithServiceResponseAsync(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject).toBlocking().single().body(); }
[ "public", "OperationStatus", "updateSubList", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "int", "subListId", ",", "WordListBaseUpdateObject", "wordListBaseUpdateObject", ")", "{", "return", "updateSubListWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "clEntityId", ",", "subListId", ",", "wordListBaseUpdateObject", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates one of the closed list's sublists. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list entity extractor ID. @param subListId The sublist ID. @param wordListBaseUpdateObject A sublist update object containing the new canonical form and the list of words. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Updates", "one", "of", "the", "closed", "list", "s", "sublists", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4968-L4970
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/inputs/InputType.java
InputType.convolutional3D
@Deprecated public static InputType convolutional3D(long depth, long height, long width, long channels) { """ Input type for 3D convolutional (CNN3D) data in NDHWC format, that is 5d with shape [miniBatchSize, depth, height, width, channels]. @param height height of the input @param width Width of the input @param depth Depth of the input @param channels Number of channels of the input @return InputTypeConvolutional3D @deprecated Use {@link #convolutional3D(Convolution3D.DataFormat, long, long, long, long)} """ return convolutional3D(Convolution3D.DataFormat.NDHWC, depth, height, width, channels); }
java
@Deprecated public static InputType convolutional3D(long depth, long height, long width, long channels) { return convolutional3D(Convolution3D.DataFormat.NDHWC, depth, height, width, channels); }
[ "@", "Deprecated", "public", "static", "InputType", "convolutional3D", "(", "long", "depth", ",", "long", "height", ",", "long", "width", ",", "long", "channels", ")", "{", "return", "convolutional3D", "(", "Convolution3D", ".", "DataFormat", ".", "NDHWC", ",", "depth", ",", "height", ",", "width", ",", "channels", ")", ";", "}" ]
Input type for 3D convolutional (CNN3D) data in NDHWC format, that is 5d with shape [miniBatchSize, depth, height, width, channels]. @param height height of the input @param width Width of the input @param depth Depth of the input @param channels Number of channels of the input @return InputTypeConvolutional3D @deprecated Use {@link #convolutional3D(Convolution3D.DataFormat, long, long, long, long)}
[ "Input", "type", "for", "3D", "convolutional", "(", "CNN3D", ")", "data", "in", "NDHWC", "format", "that", "is", "5d", "with", "shape", "[", "miniBatchSize", "depth", "height", "width", "channels", "]", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/inputs/InputType.java#L142-L145
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.getScaledCopy
public Image getScaledCopy(int width, int height) { """ <p>Get a scaled copy of this image.</p> <p>This will only scale the <strong>canvas</strong>, it will not scale the underlying texture data. For a downscale, the texture will get clipped. For an upscale, the texture will be repetated on both axis</p> <p>Also note that the underlying texture might be bigger than the initial image that was loaded because its size is fixed to the next power of two of the size of the image. So if a 100x100 image was loaded, the underlying texture is 128x128. If it's then scaled to 200x200, there will be a gap between 100 to 128 (black), and then the texture will be repeated.</p> <img src="doc-files/Image-getScaledCopy.png" /> <p>This especially has nasty side effects when you scale a flipped image...</p> @param width The width of the copy @param height The height of the copy @return The new scaled image """ init(); Image image = copy(); image.width = width; image.height = height; image.centerX = width / 2; image.centerY = height / 2; image.textureOffsetX *= (width/(float) this.width); image.textureOffsetY *= (height/(float) this.height); image.textureWidth *= (width/(float) this.width); image.textureHeight *= (height/(float) this.height); return image; }
java
public Image getScaledCopy(int width, int height) { init(); Image image = copy(); image.width = width; image.height = height; image.centerX = width / 2; image.centerY = height / 2; image.textureOffsetX *= (width/(float) this.width); image.textureOffsetY *= (height/(float) this.height); image.textureWidth *= (width/(float) this.width); image.textureHeight *= (height/(float) this.height); return image; }
[ "public", "Image", "getScaledCopy", "(", "int", "width", ",", "int", "height", ")", "{", "init", "(", ")", ";", "Image", "image", "=", "copy", "(", ")", ";", "image", ".", "width", "=", "width", ";", "image", ".", "height", "=", "height", ";", "image", ".", "centerX", "=", "width", "/", "2", ";", "image", ".", "centerY", "=", "height", "/", "2", ";", "image", ".", "textureOffsetX", "*=", "(", "width", "/", "(", "float", ")", "this", ".", "width", ")", ";", "image", ".", "textureOffsetY", "*=", "(", "height", "/", "(", "float", ")", "this", ".", "height", ")", ";", "image", ".", "textureWidth", "*=", "(", "width", "/", "(", "float", ")", "this", ".", "width", ")", ";", "image", ".", "textureHeight", "*=", "(", "height", "/", "(", "float", ")", "this", ".", "height", ")", ";", "return", "image", ";", "}" ]
<p>Get a scaled copy of this image.</p> <p>This will only scale the <strong>canvas</strong>, it will not scale the underlying texture data. For a downscale, the texture will get clipped. For an upscale, the texture will be repetated on both axis</p> <p>Also note that the underlying texture might be bigger than the initial image that was loaded because its size is fixed to the next power of two of the size of the image. So if a 100x100 image was loaded, the underlying texture is 128x128. If it's then scaled to 200x200, there will be a gap between 100 to 128 (black), and then the texture will be repeated.</p> <img src="doc-files/Image-getScaledCopy.png" /> <p>This especially has nasty side effects when you scale a flipped image...</p> @param width The width of the copy @param height The height of the copy @return The new scaled image
[ "<p", ">", "Get", "a", "scaled", "copy", "of", "this", "image", ".", "<", "/", "p", ">" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L1236-L1250
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/tree/analysis/Frame.java
Frame.setLocal
public void setLocal(final int i, final V value) throws IndexOutOfBoundsException { """ Sets the value of the given local variable. @param i a local variable index. @param value the new value of this local variable. @throws IndexOutOfBoundsException if the variable does not exist. """ if (i >= locals) { throw new IndexOutOfBoundsException( "Trying to access an inexistant local variable " + i); } values[i] = value; }
java
public void setLocal(final int i, final V value) throws IndexOutOfBoundsException { if (i >= locals) { throw new IndexOutOfBoundsException( "Trying to access an inexistant local variable " + i); } values[i] = value; }
[ "public", "void", "setLocal", "(", "final", "int", "i", ",", "final", "V", "value", ")", "throws", "IndexOutOfBoundsException", "{", "if", "(", "i", ">=", "locals", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Trying to access an inexistant local variable \"", "+", "i", ")", ";", "}", "values", "[", "i", "]", "=", "value", ";", "}" ]
Sets the value of the given local variable. @param i a local variable index. @param value the new value of this local variable. @throws IndexOutOfBoundsException if the variable does not exist.
[ "Sets", "the", "value", "of", "the", "given", "local", "variable", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/tree/analysis/Frame.java#L173-L180
ACRA/acra
acra-core/src/main/java/org/acra/file/CrashReportFileNameParser.java
CrashReportFileNameParser.getTimestamp
@NonNull public Calendar getTimestamp(@NonNull String reportFileName) { """ Gets the timestamp of a report from its name @param reportFileName Name of the report to get the timestamp from. @return timestamp of the report """ final String timestamp = reportFileName.replace(ACRAConstants.REPORTFILE_EXTENSION, "").replace(ACRAConstants.SILENT_SUFFIX, ""); final Calendar calendar = Calendar.getInstance(); try { calendar.setTime(new SimpleDateFormat(ACRAConstants.DATE_TIME_FORMAT_STRING, Locale.ENGLISH).parse(timestamp)); } catch (ParseException ignored) { } return calendar; }
java
@NonNull public Calendar getTimestamp(@NonNull String reportFileName) { final String timestamp = reportFileName.replace(ACRAConstants.REPORTFILE_EXTENSION, "").replace(ACRAConstants.SILENT_SUFFIX, ""); final Calendar calendar = Calendar.getInstance(); try { calendar.setTime(new SimpleDateFormat(ACRAConstants.DATE_TIME_FORMAT_STRING, Locale.ENGLISH).parse(timestamp)); } catch (ParseException ignored) { } return calendar; }
[ "@", "NonNull", "public", "Calendar", "getTimestamp", "(", "@", "NonNull", "String", "reportFileName", ")", "{", "final", "String", "timestamp", "=", "reportFileName", ".", "replace", "(", "ACRAConstants", ".", "REPORTFILE_EXTENSION", ",", "\"\"", ")", ".", "replace", "(", "ACRAConstants", ".", "SILENT_SUFFIX", ",", "\"\"", ")", ";", "final", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "try", "{", "calendar", ".", "setTime", "(", "new", "SimpleDateFormat", "(", "ACRAConstants", ".", "DATE_TIME_FORMAT_STRING", ",", "Locale", ".", "ENGLISH", ")", ".", "parse", "(", "timestamp", ")", ")", ";", "}", "catch", "(", "ParseException", "ignored", ")", "{", "}", "return", "calendar", ";", "}" ]
Gets the timestamp of a report from its name @param reportFileName Name of the report to get the timestamp from. @return timestamp of the report
[ "Gets", "the", "timestamp", "of", "a", "report", "from", "its", "name" ]
train
https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/file/CrashReportFileNameParser.java#L71-L80
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java
FactoryKernel.random2D_I32
public static Kernel2D_S32 random2D_I32(int width , int offset, int min, int max, Random rand) { """ Creates a random 2D kernel drawn from a uniform distribution. @param width Kernel's width. @param offset Offset for element zero in the kernel @param min minimum value. @param max maximum value. @param rand Random number generator. @return Randomized kernel. """ Kernel2D_S32 ret = new Kernel2D_S32(width,offset); int range = max - min; for (int i = 0; i < ret.data.length; i++) { ret.data[i] = rand.nextInt(range) + min; } return ret; }
java
public static Kernel2D_S32 random2D_I32(int width , int offset, int min, int max, Random rand) { Kernel2D_S32 ret = new Kernel2D_S32(width,offset); int range = max - min; for (int i = 0; i < ret.data.length; i++) { ret.data[i] = rand.nextInt(range) + min; } return ret; }
[ "public", "static", "Kernel2D_S32", "random2D_I32", "(", "int", "width", ",", "int", "offset", ",", "int", "min", ",", "int", "max", ",", "Random", "rand", ")", "{", "Kernel2D_S32", "ret", "=", "new", "Kernel2D_S32", "(", "width", ",", "offset", ")", ";", "int", "range", "=", "max", "-", "min", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ret", ".", "data", ".", "length", ";", "i", "++", ")", "{", "ret", ".", "data", "[", "i", "]", "=", "rand", ".", "nextInt", "(", "range", ")", "+", "min", ";", "}", "return", "ret", ";", "}" ]
Creates a random 2D kernel drawn from a uniform distribution. @param width Kernel's width. @param offset Offset for element zero in the kernel @param min minimum value. @param max maximum value. @param rand Random number generator. @return Randomized kernel.
[ "Creates", "a", "random", "2D", "kernel", "drawn", "from", "a", "uniform", "distribution", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java#L277-L286
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsADEManager.java
CmsADEManager.findEntryPoint
public String findEntryPoint(CmsObject cms, String openPath) { """ Finds the entry point to a sitemap.<p> @param cms the CMS context @param openPath the resource path to find the sitemap to @return the sitemap entry point """ CmsADEConfigData configData = lookupConfiguration(cms, openPath); String result = configData.getBasePath(); if (result == null) { return cms.getRequestContext().addSiteRoot("/"); } return result; }
java
public String findEntryPoint(CmsObject cms, String openPath) { CmsADEConfigData configData = lookupConfiguration(cms, openPath); String result = configData.getBasePath(); if (result == null) { return cms.getRequestContext().addSiteRoot("/"); } return result; }
[ "public", "String", "findEntryPoint", "(", "CmsObject", "cms", ",", "String", "openPath", ")", "{", "CmsADEConfigData", "configData", "=", "lookupConfiguration", "(", "cms", ",", "openPath", ")", ";", "String", "result", "=", "configData", ".", "getBasePath", "(", ")", ";", "if", "(", "result", "==", "null", ")", "{", "return", "cms", ".", "getRequestContext", "(", ")", ".", "addSiteRoot", "(", "\"/\"", ")", ";", "}", "return", "result", ";", "}" ]
Finds the entry point to a sitemap.<p> @param cms the CMS context @param openPath the resource path to find the sitemap to @return the sitemap entry point
[ "Finds", "the", "entry", "point", "to", "a", "sitemap", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L296-L304
kiegroup/drools
drools-core/src/main/java/org/drools/core/common/TruthMaintenanceSystem.java
TruthMaintenanceSystem.enableTMS
private void enableTMS(Object object, ObjectTypeConf conf) { """ TMS will be automatically enabled when the first logical insert happens. We will take all the already asserted objects of the same type and initialize the equality map. @param object the logically inserted object. @param conf the type's configuration. """ Iterator<InternalFactHandle> it = ((ClassAwareObjectStore) ep.getObjectStore()).iterateFactHandles(getActualClass(object)); while (it.hasNext()) { InternalFactHandle handle = it.next(); if (handle != null && handle.getEqualityKey() == null) { EqualityKey key = new EqualityKey(handle); handle.setEqualityKey(key); key.setStatus(EqualityKey.STATED); put(key); } } // Enable TMS for this type. conf.enableTMS(); }
java
private void enableTMS(Object object, ObjectTypeConf conf) { Iterator<InternalFactHandle> it = ((ClassAwareObjectStore) ep.getObjectStore()).iterateFactHandles(getActualClass(object)); while (it.hasNext()) { InternalFactHandle handle = it.next(); if (handle != null && handle.getEqualityKey() == null) { EqualityKey key = new EqualityKey(handle); handle.setEqualityKey(key); key.setStatus(EqualityKey.STATED); put(key); } } // Enable TMS for this type. conf.enableTMS(); }
[ "private", "void", "enableTMS", "(", "Object", "object", ",", "ObjectTypeConf", "conf", ")", "{", "Iterator", "<", "InternalFactHandle", ">", "it", "=", "(", "(", "ClassAwareObjectStore", ")", "ep", ".", "getObjectStore", "(", ")", ")", ".", "iterateFactHandles", "(", "getActualClass", "(", "object", ")", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "InternalFactHandle", "handle", "=", "it", ".", "next", "(", ")", ";", "if", "(", "handle", "!=", "null", "&&", "handle", ".", "getEqualityKey", "(", ")", "==", "null", ")", "{", "EqualityKey", "key", "=", "new", "EqualityKey", "(", "handle", ")", ";", "handle", ".", "setEqualityKey", "(", "key", ")", ";", "key", ".", "setStatus", "(", "EqualityKey", ".", "STATED", ")", ";", "put", "(", "key", ")", ";", "}", "}", "// Enable TMS for this type.", "conf", ".", "enableTMS", "(", ")", ";", "}" ]
TMS will be automatically enabled when the first logical insert happens. We will take all the already asserted objects of the same type and initialize the equality map. @param object the logically inserted object. @param conf the type's configuration.
[ "TMS", "will", "be", "automatically", "enabled", "when", "the", "first", "logical", "insert", "happens", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/common/TruthMaintenanceSystem.java#L262-L277
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.getMethod
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException { """ 查找指定方法 如果找不到对应的方法则返回<code>null</code> <p> 此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回<code>null</code>。 </p> @param clazz 类,如果为{@code null}返回{@code null} @param methodName 方法名,如果为空字符串返回{@code null} @param paramTypes 参数类型,指定参数类型如果是方法的子类也算 @return 方法 @throws SecurityException 无权访问抛出异常 """ return getMethod(clazz, false, methodName, paramTypes); }
java
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... paramTypes) throws SecurityException { return getMethod(clazz, false, methodName, paramTypes); }
[ "public", "static", "Method", "getMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "paramTypes", ")", "throws", "SecurityException", "{", "return", "getMethod", "(", "clazz", ",", "false", ",", "methodName", ",", "paramTypes", ")", ";", "}" ]
查找指定方法 如果找不到对应的方法则返回<code>null</code> <p> 此方法为精准获取方法名,即方法名和参数数量和类型必须一致,否则返回<code>null</code>。 </p> @param clazz 类,如果为{@code null}返回{@code null} @param methodName 方法名,如果为空字符串返回{@code null} @param paramTypes 参数类型,指定参数类型如果是方法的子类也算 @return 方法 @throws SecurityException 无权访问抛出异常
[ "查找指定方法", "如果找不到对应的方法则返回<code", ">", "null<", "/", "code", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L431-L433
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Spies.java
Spies.spy1st
public static <T> Predicate<T> spy1st(Predicate<T> predicate, Box<T> param) { """ Proxies a predicate spying for parameter. @param <T> the predicate parameter type @param predicate the predicate that will be spied @param param a box that will be containing spied parameter @return the proxied predicate """ return spy(predicate, Box.<Boolean>empty(), param); }
java
public static <T> Predicate<T> spy1st(Predicate<T> predicate, Box<T> param) { return spy(predicate, Box.<Boolean>empty(), param); }
[ "public", "static", "<", "T", ">", "Predicate", "<", "T", ">", "spy1st", "(", "Predicate", "<", "T", ">", "predicate", ",", "Box", "<", "T", ">", "param", ")", "{", "return", "spy", "(", "predicate", ",", "Box", ".", "<", "Boolean", ">", "empty", "(", ")", ",", "param", ")", ";", "}" ]
Proxies a predicate spying for parameter. @param <T> the predicate parameter type @param predicate the predicate that will be spied @param param a box that will be containing spied parameter @return the proxied predicate
[ "Proxies", "a", "predicate", "spying", "for", "parameter", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L506-L508
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierDatabase.java
TypeQualifierDatabase.setReturnValue
public void setReturnValue(MethodDescriptor methodDesc, TypeQualifierValue<?> tqv, TypeQualifierAnnotation tqa) { """ Set a TypeQualifierAnnotation on a method return value. @param methodDesc the method @param tqv the type qualifier @param tqa the type qualifier annotation """ Map<TypeQualifierValue<?>, TypeQualifierAnnotation> map = returnValueMap.get(methodDesc); if (map == null) { map = new HashMap<>(); returnValueMap.put(methodDesc, map); } map.put(tqv, tqa); if (DEBUG) { System.out.println("tqdb: " + methodDesc + " for " + tqv + " ==> " + tqa); } }
java
public void setReturnValue(MethodDescriptor methodDesc, TypeQualifierValue<?> tqv, TypeQualifierAnnotation tqa) { Map<TypeQualifierValue<?>, TypeQualifierAnnotation> map = returnValueMap.get(methodDesc); if (map == null) { map = new HashMap<>(); returnValueMap.put(methodDesc, map); } map.put(tqv, tqa); if (DEBUG) { System.out.println("tqdb: " + methodDesc + " for " + tqv + " ==> " + tqa); } }
[ "public", "void", "setReturnValue", "(", "MethodDescriptor", "methodDesc", ",", "TypeQualifierValue", "<", "?", ">", "tqv", ",", "TypeQualifierAnnotation", "tqa", ")", "{", "Map", "<", "TypeQualifierValue", "<", "?", ">", ",", "TypeQualifierAnnotation", ">", "map", "=", "returnValueMap", ".", "get", "(", "methodDesc", ")", ";", "if", "(", "map", "==", "null", ")", "{", "map", "=", "new", "HashMap", "<>", "(", ")", ";", "returnValueMap", ".", "put", "(", "methodDesc", ",", "map", ")", ";", "}", "map", ".", "put", "(", "tqv", ",", "tqa", ")", ";", "if", "(", "DEBUG", ")", "{", "System", ".", "out", ".", "println", "(", "\"tqdb: \"", "+", "methodDesc", "+", "\" for \"", "+", "tqv", "+", "\" ==> \"", "+", "tqa", ")", ";", "}", "}" ]
Set a TypeQualifierAnnotation on a method return value. @param methodDesc the method @param tqv the type qualifier @param tqa the type qualifier annotation
[ "Set", "a", "TypeQualifierAnnotation", "on", "a", "method", "return", "value", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierDatabase.java#L65-L76
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
NodeIndexer.addReferenceValue
protected void addReferenceValue(Document doc, String fieldName, Object internalValue) { """ Adds the reference value to the document as the named field. The value's string representation is added as the reference data. Additionally the reference data is stored in the index. @param doc The document to which to add the field @param fieldName The name of the field to add @param internalValue The value for the field to add to the document. """ String uuid = internalValue.toString(); doc.add(createFieldWithoutNorms(fieldName, uuid, PropertyType.REFERENCE)); doc.add(new Field(FieldNames.PROPERTIES, FieldNames.createNamedValue(fieldName, uuid), Field.Store.YES, Field.Index.NO, Field.TermVector.NO)); }
java
protected void addReferenceValue(Document doc, String fieldName, Object internalValue) { String uuid = internalValue.toString(); doc.add(createFieldWithoutNorms(fieldName, uuid, PropertyType.REFERENCE)); doc.add(new Field(FieldNames.PROPERTIES, FieldNames.createNamedValue(fieldName, uuid), Field.Store.YES, Field.Index.NO, Field.TermVector.NO)); }
[ "protected", "void", "addReferenceValue", "(", "Document", "doc", ",", "String", "fieldName", ",", "Object", "internalValue", ")", "{", "String", "uuid", "=", "internalValue", ".", "toString", "(", ")", ";", "doc", ".", "add", "(", "createFieldWithoutNorms", "(", "fieldName", ",", "uuid", ",", "PropertyType", ".", "REFERENCE", ")", ")", ";", "doc", ".", "add", "(", "new", "Field", "(", "FieldNames", ".", "PROPERTIES", ",", "FieldNames", ".", "createNamedValue", "(", "fieldName", ",", "uuid", ")", ",", "Field", ".", "Store", ".", "YES", ",", "Field", ".", "Index", ".", "NO", ",", "Field", ".", "TermVector", ".", "NO", ")", ")", ";", "}" ]
Adds the reference value to the document as the named field. The value's string representation is added as the reference data. Additionally the reference data is stored in the index. @param doc The document to which to add the field @param fieldName The name of the field to add @param internalValue The value for the field to add to the document.
[ "Adds", "the", "reference", "value", "to", "the", "document", "as", "the", "named", "field", ".", "The", "value", "s", "string", "representation", "is", "added", "as", "the", "reference", "data", ".", "Additionally", "the", "reference", "data", "is", "stored", "in", "the", "index", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L790-L796
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java
Unchecked.objIntConsumer
public static <T> ObjIntConsumer<T> objIntConsumer(CheckedObjIntConsumer<T> consumer, Consumer<Throwable> handler) { """ Wrap a {@link CheckedObjIntConsumer} in a {@link ObjIntConsumer} with a custom handler for checked exceptions. """ return (t, u) -> { try { consumer.accept(t, u); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
java
public static <T> ObjIntConsumer<T> objIntConsumer(CheckedObjIntConsumer<T> consumer, Consumer<Throwable> handler) { return (t, u) -> { try { consumer.accept(t, u); } catch (Throwable e) { handler.accept(e); throw new IllegalStateException("Exception handler must throw a RuntimeException", e); } }; }
[ "public", "static", "<", "T", ">", "ObjIntConsumer", "<", "T", ">", "objIntConsumer", "(", "CheckedObjIntConsumer", "<", "T", ">", "consumer", ",", "Consumer", "<", "Throwable", ">", "handler", ")", "{", "return", "(", "t", ",", "u", ")", "->", "{", "try", "{", "consumer", ".", "accept", "(", "t", ",", "u", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "handler", ".", "accept", "(", "e", ")", ";", "throw", "new", "IllegalStateException", "(", "\"Exception handler must throw a RuntimeException\"", ",", "e", ")", ";", "}", "}", ";", "}" ]
Wrap a {@link CheckedObjIntConsumer} in a {@link ObjIntConsumer} with a custom handler for checked exceptions.
[ "Wrap", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L253-L264
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/application/StateManager.java
StateManager.writeState
public void writeState(FacesContext context, Object state) throws IOException { """ <p>Save the state represented in the specified state <code>Object</code> instance, in an implementation dependent manner.</p> <p/> <p>This method will typically simply delegate the actual writing to the <code>writeState()</code> method of the {@link ResponseStateManager} instance provided by the {@link RenderKit} being used to render this view. This method assumes that the caller has positioned the {@link ResponseWriter} at the correct position for the saved state to be written.</p> <p/> <p>For backwards compatability with existing <code>StateManager</code> implementations, the default implementation of this method checks if the argument is an instance of <code>Object []</code> of length greater than or equal to two. If so, it creates a <code>SerializedView</code> instance with the tree structure coming from element zero and the component state coming from element one and calls through to {@link #writeState(javax.faces.context.FacesContext,javax.faces.application.StateManager.SerializedView)}. If not, does nothing.</p> @param context {@link FacesContext} for the current request @param state the Serializable state to be written, as returned by {@link #saveSerializedView} @since 1.2 """ if (null != state && state.getClass().isArray() && state.getClass().getComponentType().equals(Object.class)) { Object stateArray[] = (Object[]) state; if (2 == stateArray.length) { SerializedView view = new SerializedView(stateArray[0], stateArray[1]); writeState(context, view); } } }
java
public void writeState(FacesContext context, Object state) throws IOException { if (null != state && state.getClass().isArray() && state.getClass().getComponentType().equals(Object.class)) { Object stateArray[] = (Object[]) state; if (2 == stateArray.length) { SerializedView view = new SerializedView(stateArray[0], stateArray[1]); writeState(context, view); } } }
[ "public", "void", "writeState", "(", "FacesContext", "context", ",", "Object", "state", ")", "throws", "IOException", "{", "if", "(", "null", "!=", "state", "&&", "state", ".", "getClass", "(", ")", ".", "isArray", "(", ")", "&&", "state", ".", "getClass", "(", ")", ".", "getComponentType", "(", ")", ".", "equals", "(", "Object", ".", "class", ")", ")", "{", "Object", "stateArray", "[", "]", "=", "(", "Object", "[", "]", ")", "state", ";", "if", "(", "2", "==", "stateArray", ".", "length", ")", "{", "SerializedView", "view", "=", "new", "SerializedView", "(", "stateArray", "[", "0", "]", ",", "stateArray", "[", "1", "]", ")", ";", "writeState", "(", "context", ",", "view", ")", ";", "}", "}", "}" ]
<p>Save the state represented in the specified state <code>Object</code> instance, in an implementation dependent manner.</p> <p/> <p>This method will typically simply delegate the actual writing to the <code>writeState()</code> method of the {@link ResponseStateManager} instance provided by the {@link RenderKit} being used to render this view. This method assumes that the caller has positioned the {@link ResponseWriter} at the correct position for the saved state to be written.</p> <p/> <p>For backwards compatability with existing <code>StateManager</code> implementations, the default implementation of this method checks if the argument is an instance of <code>Object []</code> of length greater than or equal to two. If so, it creates a <code>SerializedView</code> instance with the tree structure coming from element zero and the component state coming from element one and calls through to {@link #writeState(javax.faces.context.FacesContext,javax.faces.application.StateManager.SerializedView)}. If not, does nothing.</p> @param context {@link FacesContext} for the current request @param state the Serializable state to be written, as returned by {@link #saveSerializedView} @since 1.2
[ "<p", ">", "Save", "the", "state", "represented", "in", "the", "specified", "state", "<code", ">", "Object<", "/", "code", ">", "instance", "in", "an", "implementation", "dependent", "manner", ".", "<", "/", "p", ">", "<p", "/", ">", "<p", ">", "This", "method", "will", "typically", "simply", "delegate", "the", "actual", "writing", "to", "the", "<code", ">", "writeState", "()", "<", "/", "code", ">", "method", "of", "the", "{", "@link", "ResponseStateManager", "}", "instance", "provided", "by", "the", "{", "@link", "RenderKit", "}", "being", "used", "to", "render", "this", "view", ".", "This", "method", "assumes", "that", "the", "caller", "has", "positioned", "the", "{", "@link", "ResponseWriter", "}", "at", "the", "correct", "position", "for", "the", "saved", "state", "to", "be", "written", ".", "<", "/", "p", ">", "<p", "/", ">", "<p", ">", "For", "backwards", "compatability", "with", "existing", "<code", ">", "StateManager<", "/", "code", ">", "implementations", "the", "default", "implementation", "of", "this", "method", "checks", "if", "the", "argument", "is", "an", "instance", "of", "<code", ">", "Object", "[]", "<", "/", "code", ">", "of", "length", "greater", "than", "or", "equal", "to", "two", ".", "If", "so", "it", "creates", "a", "<code", ">", "SerializedView<", "/", "code", ">", "instance", "with", "the", "tree", "structure", "coming", "from", "element", "zero", "and", "the", "component", "state", "coming", "from", "element", "one", "and", "calls", "through", "to", "{", "@link", "#writeState", "(", "javax", ".", "faces", ".", "context", ".", "FacesContext", "javax", ".", "faces", ".", "application", ".", "StateManager", ".", "SerializedView", ")", "}", ".", "If", "not", "does", "nothing", ".", "<", "/", "p", ">" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/application/StateManager.java#L377-L388
aoindustries/ao-taglib
src/main/java/com/aoindustries/taglib/Scope.java
Scope.getScopeId
public static int getScopeId(String scope) throws JspTagException { """ Gets the PageContext scope value for the textual scope name. @exception JspTagException if invalid scope """ if(scope==null || PAGE.equals(scope)) return PageContext.PAGE_SCOPE; else if(REQUEST.equals(scope)) return PageContext.REQUEST_SCOPE; else if(SESSION.equals(scope)) return PageContext.SESSION_SCOPE; else if(APPLICATION.equals(scope)) return PageContext.APPLICATION_SCOPE; else throw new LocalizedJspTagException(ApplicationResources.accessor, "Scope.scope.invalid", scope); }
java
public static int getScopeId(String scope) throws JspTagException { if(scope==null || PAGE.equals(scope)) return PageContext.PAGE_SCOPE; else if(REQUEST.equals(scope)) return PageContext.REQUEST_SCOPE; else if(SESSION.equals(scope)) return PageContext.SESSION_SCOPE; else if(APPLICATION.equals(scope)) return PageContext.APPLICATION_SCOPE; else throw new LocalizedJspTagException(ApplicationResources.accessor, "Scope.scope.invalid", scope); }
[ "public", "static", "int", "getScopeId", "(", "String", "scope", ")", "throws", "JspTagException", "{", "if", "(", "scope", "==", "null", "||", "PAGE", ".", "equals", "(", "scope", ")", ")", "return", "PageContext", ".", "PAGE_SCOPE", ";", "else", "if", "(", "REQUEST", ".", "equals", "(", "scope", ")", ")", "return", "PageContext", ".", "REQUEST_SCOPE", ";", "else", "if", "(", "SESSION", ".", "equals", "(", "scope", ")", ")", "return", "PageContext", ".", "SESSION_SCOPE", ";", "else", "if", "(", "APPLICATION", ".", "equals", "(", "scope", ")", ")", "return", "PageContext", ".", "APPLICATION_SCOPE", ";", "else", "throw", "new", "LocalizedJspTagException", "(", "ApplicationResources", ".", "accessor", ",", "\"Scope.scope.invalid\"", ",", "scope", ")", ";", "}" ]
Gets the PageContext scope value for the textual scope name. @exception JspTagException if invalid scope
[ "Gets", "the", "PageContext", "scope", "value", "for", "the", "textual", "scope", "name", "." ]
train
https://github.com/aoindustries/ao-taglib/blob/5670eba8485196bd42d31d3ff09a42deacb025f8/src/main/java/com/aoindustries/taglib/Scope.java#L51-L57
apiman/apiman
gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/auth/AuthFactory.java
AuthFactory.getAuth
public static AuthHandler getAuth(Vertx vertx, Router router, VertxEngineConfig apimanConfig) { """ Creates an auth handler of the type indicated in the `auth` section of config. @param vertx the vert.x instance @param router the vert.x web router to protect @param apimanConfig the apiman config @return an auth handler """ String type = apimanConfig.getAuth().getString("type", "NONE"); JsonObject authConfig = apimanConfig.getAuth().getJsonObject("config", new JsonObject()); switch(AuthType.getType(type)) { case BASIC: return BasicAuth.create(authConfig); case NONE: return NoneAuth.create(); case KEYCLOAK: return KeycloakOAuthFactory.create(vertx, router, apimanConfig, authConfig); default: return NoneAuth.create(); } }
java
public static AuthHandler getAuth(Vertx vertx, Router router, VertxEngineConfig apimanConfig) { String type = apimanConfig.getAuth().getString("type", "NONE"); JsonObject authConfig = apimanConfig.getAuth().getJsonObject("config", new JsonObject()); switch(AuthType.getType(type)) { case BASIC: return BasicAuth.create(authConfig); case NONE: return NoneAuth.create(); case KEYCLOAK: return KeycloakOAuthFactory.create(vertx, router, apimanConfig, authConfig); default: return NoneAuth.create(); } }
[ "public", "static", "AuthHandler", "getAuth", "(", "Vertx", "vertx", ",", "Router", "router", ",", "VertxEngineConfig", "apimanConfig", ")", "{", "String", "type", "=", "apimanConfig", ".", "getAuth", "(", ")", ".", "getString", "(", "\"type\"", ",", "\"NONE\"", ")", ";", "JsonObject", "authConfig", "=", "apimanConfig", ".", "getAuth", "(", ")", ".", "getJsonObject", "(", "\"config\"", ",", "new", "JsonObject", "(", ")", ")", ";", "switch", "(", "AuthType", ".", "getType", "(", "type", ")", ")", "{", "case", "BASIC", ":", "return", "BasicAuth", ".", "create", "(", "authConfig", ")", ";", "case", "NONE", ":", "return", "NoneAuth", ".", "create", "(", ")", ";", "case", "KEYCLOAK", ":", "return", "KeycloakOAuthFactory", ".", "create", "(", "vertx", ",", "router", ",", "apimanConfig", ",", "authConfig", ")", ";", "default", ":", "return", "NoneAuth", ".", "create", "(", ")", ";", "}", "}" ]
Creates an auth handler of the type indicated in the `auth` section of config. @param vertx the vert.x instance @param router the vert.x web router to protect @param apimanConfig the apiman config @return an auth handler
[ "Creates", "an", "auth", "handler", "of", "the", "type", "indicated", "in", "the", "auth", "section", "of", "config", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/api/auth/AuthFactory.java#L54-L68
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java
PermissionUtil.canInteract
public static boolean canInteract(Member issuer, Emote emote) { """ Check whether the provided {@link net.dv8tion.jda.core.entities.Member Member} can use the specified {@link net.dv8tion.jda.core.entities.Emote Emote}. <p>If the specified Member is not in the emote's guild or the emote provided is fake this will return false. Otherwise it will check if the emote is restricted to any roles and if that is the case if the Member has one of these. <p>In the case of an {@link net.dv8tion.jda.core.entities.Emote#isAnimated() animated} Emote, this will check if the issuer is the currently logged in account, and then check if the account has {@link net.dv8tion.jda.core.entities.SelfUser#isNitro() nitro}, and return false if it doesn't. <br>For other accounts, this method will not take into account whether the emote is animated, as there is no real way to check if the Member can interact with them. <br><b>Note</b>: This is not checking if the issuer owns the Guild or not. @param issuer The member that tries to interact with the Emote @param emote The emote that is the target interaction @throws IllegalArgumentException if any of the provided parameters is {@code null} or the provided entities are not from the same guild @return True, if the issuer can interact with the emote """ Checks.notNull(issuer, "Issuer Member"); Checks.notNull(emote, "Target Emote"); if (!issuer.getGuild().equals(emote.getGuild())) throw new IllegalArgumentException("The issuer and target are not in the same Guild"); // We don't need to check based on the fact it is animated if it's a BOT account // because BOT accounts cannot have nitro, and have access to animated Emotes naturally. if (emote.isAnimated() && !issuer.getUser().isBot()) { // This is a currently logged in client, meaning we can check if they have nitro or not. // If this isn't the currently logged in account, we just check it like a normal emote, // since there is no way to verify if they have nitro or not. if (issuer.getUser() instanceof SelfUser) { // If they don't have nitro, we immediately return // false, otherwise we proceed with the remaining checks. if (!((SelfUser)issuer.getUser()).isNitro()) return false; } } return emote.canProvideRoles() && (emote.getRoles().isEmpty() // Emote restricted to roles -> check if the issuer has them || CollectionUtils.containsAny(issuer.getRoles(), emote.getRoles())); }
java
public static boolean canInteract(Member issuer, Emote emote) { Checks.notNull(issuer, "Issuer Member"); Checks.notNull(emote, "Target Emote"); if (!issuer.getGuild().equals(emote.getGuild())) throw new IllegalArgumentException("The issuer and target are not in the same Guild"); // We don't need to check based on the fact it is animated if it's a BOT account // because BOT accounts cannot have nitro, and have access to animated Emotes naturally. if (emote.isAnimated() && !issuer.getUser().isBot()) { // This is a currently logged in client, meaning we can check if they have nitro or not. // If this isn't the currently logged in account, we just check it like a normal emote, // since there is no way to verify if they have nitro or not. if (issuer.getUser() instanceof SelfUser) { // If they don't have nitro, we immediately return // false, otherwise we proceed with the remaining checks. if (!((SelfUser)issuer.getUser()).isNitro()) return false; } } return emote.canProvideRoles() && (emote.getRoles().isEmpty() // Emote restricted to roles -> check if the issuer has them || CollectionUtils.containsAny(issuer.getRoles(), emote.getRoles())); }
[ "public", "static", "boolean", "canInteract", "(", "Member", "issuer", ",", "Emote", "emote", ")", "{", "Checks", ".", "notNull", "(", "issuer", ",", "\"Issuer Member\"", ")", ";", "Checks", ".", "notNull", "(", "emote", ",", "\"Target Emote\"", ")", ";", "if", "(", "!", "issuer", ".", "getGuild", "(", ")", ".", "equals", "(", "emote", ".", "getGuild", "(", ")", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"The issuer and target are not in the same Guild\"", ")", ";", "// We don't need to check based on the fact it is animated if it's a BOT account", "// because BOT accounts cannot have nitro, and have access to animated Emotes naturally.", "if", "(", "emote", ".", "isAnimated", "(", ")", "&&", "!", "issuer", ".", "getUser", "(", ")", ".", "isBot", "(", ")", ")", "{", "// This is a currently logged in client, meaning we can check if they have nitro or not.", "// If this isn't the currently logged in account, we just check it like a normal emote,", "// since there is no way to verify if they have nitro or not.", "if", "(", "issuer", ".", "getUser", "(", ")", "instanceof", "SelfUser", ")", "{", "// If they don't have nitro, we immediately return", "// false, otherwise we proceed with the remaining checks.", "if", "(", "!", "(", "(", "SelfUser", ")", "issuer", ".", "getUser", "(", ")", ")", ".", "isNitro", "(", ")", ")", "return", "false", ";", "}", "}", "return", "emote", ".", "canProvideRoles", "(", ")", "&&", "(", "emote", ".", "getRoles", "(", ")", ".", "isEmpty", "(", ")", "// Emote restricted to roles -> check if the issuer has them", "||", "CollectionUtils", ".", "containsAny", "(", "issuer", ".", "getRoles", "(", ")", ",", "emote", ".", "getRoles", "(", ")", ")", ")", ";", "}" ]
Check whether the provided {@link net.dv8tion.jda.core.entities.Member Member} can use the specified {@link net.dv8tion.jda.core.entities.Emote Emote}. <p>If the specified Member is not in the emote's guild or the emote provided is fake this will return false. Otherwise it will check if the emote is restricted to any roles and if that is the case if the Member has one of these. <p>In the case of an {@link net.dv8tion.jda.core.entities.Emote#isAnimated() animated} Emote, this will check if the issuer is the currently logged in account, and then check if the account has {@link net.dv8tion.jda.core.entities.SelfUser#isNitro() nitro}, and return false if it doesn't. <br>For other accounts, this method will not take into account whether the emote is animated, as there is no real way to check if the Member can interact with them. <br><b>Note</b>: This is not checking if the issuer owns the Guild or not. @param issuer The member that tries to interact with the Emote @param emote The emote that is the target interaction @throws IllegalArgumentException if any of the provided parameters is {@code null} or the provided entities are not from the same guild @return True, if the issuer can interact with the emote
[ "Check", "whether", "the", "provided", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "Member", "Member", "}", "can", "use", "the", "specified", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "Emote", "Emote", "}", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java#L139-L165
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.getProject
public Project getProject(String namespace, String project) throws GitLabApiException { """ Get a specific project, which is owned by the authentication user. <pre><code>GET /projects/:id</code></pre> @param namespace the name of the project namespace or group @param project the name of the project to get @return the specified project @throws GitLabApiException if any exception occurs """ if (namespace == null) { throw new RuntimeException("namespace cannot be null"); } if (project == null) { throw new RuntimeException("project cannot be null"); } String projectPath = null; try { projectPath = URLEncoder.encode(namespace + "/" + project, "UTF-8"); } catch (UnsupportedEncodingException uee) { throw (new GitLabApiException(uee)); } Response response = get(Response.Status.OK, null, "projects", projectPath); return (response.readEntity(Project.class)); }
java
public Project getProject(String namespace, String project) throws GitLabApiException { if (namespace == null) { throw new RuntimeException("namespace cannot be null"); } if (project == null) { throw new RuntimeException("project cannot be null"); } String projectPath = null; try { projectPath = URLEncoder.encode(namespace + "/" + project, "UTF-8"); } catch (UnsupportedEncodingException uee) { throw (new GitLabApiException(uee)); } Response response = get(Response.Status.OK, null, "projects", projectPath); return (response.readEntity(Project.class)); }
[ "public", "Project", "getProject", "(", "String", "namespace", ",", "String", "project", ")", "throws", "GitLabApiException", "{", "if", "(", "namespace", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"namespace cannot be null\"", ")", ";", "}", "if", "(", "project", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"project cannot be null\"", ")", ";", "}", "String", "projectPath", "=", "null", ";", "try", "{", "projectPath", "=", "URLEncoder", ".", "encode", "(", "namespace", "+", "\"/\"", "+", "project", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "uee", ")", "{", "throw", "(", "new", "GitLabApiException", "(", "uee", ")", ")", ";", "}", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"projects\"", ",", "projectPath", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Project", ".", "class", ")", ")", ";", "}" ]
Get a specific project, which is owned by the authentication user. <pre><code>GET /projects/:id</code></pre> @param namespace the name of the project namespace or group @param project the name of the project to get @return the specified project @throws GitLabApiException if any exception occurs
[ "Get", "a", "specific", "project", "which", "is", "owned", "by", "the", "authentication", "user", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L617-L636
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.getKeyField
public KeyField getKeyField(int iKeyFieldSeq, boolean bForceUniqueKey) { """ Get this key field taking into account whether the key must be unique. Add one key field (the counter field if this isn't a unique key area and you want to force a unique key). @param bForceUniqueKey If params must be unique, if they aren't, add the unique key to the end. @return The Key field. """ KeyField keyField = null; if (iKeyFieldSeq != this.getKeyFields(false, true)) keyField = this.getKeyField(iKeyFieldSeq); else keyField = this.getRecord().getKeyArea(0).getKeyField(0); // Special - key must be unique return keyField; }
java
public KeyField getKeyField(int iKeyFieldSeq, boolean bForceUniqueKey) { KeyField keyField = null; if (iKeyFieldSeq != this.getKeyFields(false, true)) keyField = this.getKeyField(iKeyFieldSeq); else keyField = this.getRecord().getKeyArea(0).getKeyField(0); // Special - key must be unique return keyField; }
[ "public", "KeyField", "getKeyField", "(", "int", "iKeyFieldSeq", ",", "boolean", "bForceUniqueKey", ")", "{", "KeyField", "keyField", "=", "null", ";", "if", "(", "iKeyFieldSeq", "!=", "this", ".", "getKeyFields", "(", "false", ",", "true", ")", ")", "keyField", "=", "this", ".", "getKeyField", "(", "iKeyFieldSeq", ")", ";", "else", "keyField", "=", "this", ".", "getRecord", "(", ")", ".", "getKeyArea", "(", "0", ")", ".", "getKeyField", "(", "0", ")", ";", "// Special - key must be unique", "return", "keyField", ";", "}" ]
Get this key field taking into account whether the key must be unique. Add one key field (the counter field if this isn't a unique key area and you want to force a unique key). @param bForceUniqueKey If params must be unique, if they aren't, add the unique key to the end. @return The Key field.
[ "Get", "this", "key", "field", "taking", "into", "account", "whether", "the", "key", "must", "be", "unique", ".", "Add", "one", "key", "field", "(", "the", "counter", "field", "if", "this", "isn", "t", "a", "unique", "key", "area", "and", "you", "want", "to", "force", "a", "unique", "key", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L565-L573
duracloud/mill
workman/src/main/java/org/duracloud/mill/dup/DuplicationTaskProcessor.java
DuplicationTaskProcessor.cleanProperties
private void cleanProperties(Map<String, String> props) { """ Pull out the system-generated properties, to allow the properties that are added to the duplicated item to be only the user-defined properties. @param props """ if (props != null) { props.remove(StorageProvider.PROPERTIES_CONTENT_MD5); props.remove(StorageProvider.PROPERTIES_CONTENT_CHECKSUM); props.remove(StorageProvider.PROPERTIES_CONTENT_MODIFIED); props.remove(StorageProvider.PROPERTIES_CONTENT_SIZE); props.remove(HttpHeaders.CONTENT_LENGTH); props.remove(HttpHeaders.CONTENT_TYPE); props.remove(HttpHeaders.LAST_MODIFIED); props.remove(HttpHeaders.DATE); props.remove(HttpHeaders.ETAG); props.remove(HttpHeaders.CONTENT_LENGTH.toLowerCase()); props.remove(HttpHeaders.CONTENT_TYPE.toLowerCase()); props.remove(HttpHeaders.LAST_MODIFIED.toLowerCase()); props.remove(HttpHeaders.DATE.toLowerCase()); props.remove(HttpHeaders.ETAG.toLowerCase()); } }
java
private void cleanProperties(Map<String, String> props) { if (props != null) { props.remove(StorageProvider.PROPERTIES_CONTENT_MD5); props.remove(StorageProvider.PROPERTIES_CONTENT_CHECKSUM); props.remove(StorageProvider.PROPERTIES_CONTENT_MODIFIED); props.remove(StorageProvider.PROPERTIES_CONTENT_SIZE); props.remove(HttpHeaders.CONTENT_LENGTH); props.remove(HttpHeaders.CONTENT_TYPE); props.remove(HttpHeaders.LAST_MODIFIED); props.remove(HttpHeaders.DATE); props.remove(HttpHeaders.ETAG); props.remove(HttpHeaders.CONTENT_LENGTH.toLowerCase()); props.remove(HttpHeaders.CONTENT_TYPE.toLowerCase()); props.remove(HttpHeaders.LAST_MODIFIED.toLowerCase()); props.remove(HttpHeaders.DATE.toLowerCase()); props.remove(HttpHeaders.ETAG.toLowerCase()); } }
[ "private", "void", "cleanProperties", "(", "Map", "<", "String", ",", "String", ">", "props", ")", "{", "if", "(", "props", "!=", "null", ")", "{", "props", ".", "remove", "(", "StorageProvider", ".", "PROPERTIES_CONTENT_MD5", ")", ";", "props", ".", "remove", "(", "StorageProvider", ".", "PROPERTIES_CONTENT_CHECKSUM", ")", ";", "props", ".", "remove", "(", "StorageProvider", ".", "PROPERTIES_CONTENT_MODIFIED", ")", ";", "props", ".", "remove", "(", "StorageProvider", ".", "PROPERTIES_CONTENT_SIZE", ")", ";", "props", ".", "remove", "(", "HttpHeaders", ".", "CONTENT_LENGTH", ")", ";", "props", ".", "remove", "(", "HttpHeaders", ".", "CONTENT_TYPE", ")", ";", "props", ".", "remove", "(", "HttpHeaders", ".", "LAST_MODIFIED", ")", ";", "props", ".", "remove", "(", "HttpHeaders", ".", "DATE", ")", ";", "props", ".", "remove", "(", "HttpHeaders", ".", "ETAG", ")", ";", "props", ".", "remove", "(", "HttpHeaders", ".", "CONTENT_LENGTH", ".", "toLowerCase", "(", ")", ")", ";", "props", ".", "remove", "(", "HttpHeaders", ".", "CONTENT_TYPE", ".", "toLowerCase", "(", ")", ")", ";", "props", ".", "remove", "(", "HttpHeaders", ".", "LAST_MODIFIED", ".", "toLowerCase", "(", ")", ")", ";", "props", ".", "remove", "(", "HttpHeaders", ".", "DATE", ".", "toLowerCase", "(", ")", ")", ";", "props", ".", "remove", "(", "HttpHeaders", ".", "ETAG", ".", "toLowerCase", "(", ")", ")", ";", "}", "}" ]
Pull out the system-generated properties, to allow the properties that are added to the duplicated item to be only the user-defined properties. @param props
[ "Pull", "out", "the", "system", "-", "generated", "properties", "to", "allow", "the", "properties", "that", "are", "added", "to", "the", "duplicated", "item", "to", "be", "only", "the", "user", "-", "defined", "properties", "." ]
train
https://github.com/duracloud/mill/blob/854ac6edcba7fa2cab60993f172e82c2d1dad4bd/workman/src/main/java/org/duracloud/mill/dup/DuplicationTaskProcessor.java#L356-L373
ecclesia/kipeto
kipeto/src/main/java/de/ecclesia/kipeto/RepositoryResolver.java
RepositoryResolver.determinateLocalIP
private String determinateLocalIP() throws IOException { """ Ermittelt anhand der Default-Repository-URL die IP-Adresse der Netzwerkkarte, die Verbindung zum Repository hat. """ Socket socket = null; try { URL url = new URL(defaultRepositoryUrl); int port = url.getPort() > -1 ? url.getPort() : url.getDefaultPort(); log.debug("Determinating local IP-Adress by connect to {}:{}", defaultRepositoryUrl, port); InetAddress address = Inet4Address.getByName(url.getHost()); socket = new Socket(); socket.connect(new InetSocketAddress(address, port), 3000); InputStream stream = socket.getInputStream(); InetAddress localAddress = socket.getLocalAddress(); stream.close(); String localIp = localAddress.getHostAddress(); log.info("Local IP-Adress is {}", localIp); return localIp; } finally { if (socket != null) { socket.close(); } } }
java
private String determinateLocalIP() throws IOException { Socket socket = null; try { URL url = new URL(defaultRepositoryUrl); int port = url.getPort() > -1 ? url.getPort() : url.getDefaultPort(); log.debug("Determinating local IP-Adress by connect to {}:{}", defaultRepositoryUrl, port); InetAddress address = Inet4Address.getByName(url.getHost()); socket = new Socket(); socket.connect(new InetSocketAddress(address, port), 3000); InputStream stream = socket.getInputStream(); InetAddress localAddress = socket.getLocalAddress(); stream.close(); String localIp = localAddress.getHostAddress(); log.info("Local IP-Adress is {}", localIp); return localIp; } finally { if (socket != null) { socket.close(); } } }
[ "private", "String", "determinateLocalIP", "(", ")", "throws", "IOException", "{", "Socket", "socket", "=", "null", ";", "try", "{", "URL", "url", "=", "new", "URL", "(", "defaultRepositoryUrl", ")", ";", "int", "port", "=", "url", ".", "getPort", "(", ")", ">", "-", "1", "?", "url", ".", "getPort", "(", ")", ":", "url", ".", "getDefaultPort", "(", ")", ";", "log", ".", "debug", "(", "\"Determinating local IP-Adress by connect to {}:{}\"", ",", "defaultRepositoryUrl", ",", "port", ")", ";", "InetAddress", "address", "=", "Inet4Address", ".", "getByName", "(", "url", ".", "getHost", "(", ")", ")", ";", "socket", "=", "new", "Socket", "(", ")", ";", "socket", ".", "connect", "(", "new", "InetSocketAddress", "(", "address", ",", "port", ")", ",", "3000", ")", ";", "InputStream", "stream", "=", "socket", ".", "getInputStream", "(", ")", ";", "InetAddress", "localAddress", "=", "socket", ".", "getLocalAddress", "(", ")", ";", "stream", ".", "close", "(", ")", ";", "String", "localIp", "=", "localAddress", ".", "getHostAddress", "(", ")", ";", "log", ".", "info", "(", "\"Local IP-Adress is {}\"", ",", "localIp", ")", ";", "return", "localIp", ";", "}", "finally", "{", "if", "(", "socket", "!=", "null", ")", "{", "socket", ".", "close", "(", ")", ";", "}", "}", "}" ]
Ermittelt anhand der Default-Repository-URL die IP-Adresse der Netzwerkkarte, die Verbindung zum Repository hat.
[ "Ermittelt", "anhand", "der", "Default", "-", "Repository", "-", "URL", "die", "IP", "-", "Adresse", "der", "Netzwerkkarte", "die", "Verbindung", "zum", "Repository", "hat", "." ]
train
https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto/src/main/java/de/ecclesia/kipeto/RepositoryResolver.java#L105-L131
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXReader.java
MPXReader.populateCalendar
private void populateCalendar(Record record, ProjectCalendar calendar, boolean isBaseCalendar) { """ Populates a calendar instance. @param record MPX record @param calendar calendar instance @param isBaseCalendar true if this is a base calendar """ if (isBaseCalendar == true) { calendar.setName(record.getString(0)); } else { calendar.setParent(m_projectFile.getCalendarByName(record.getString(0))); } calendar.setWorkingDay(Day.SUNDAY, DayType.getInstance(record.getInteger(1))); calendar.setWorkingDay(Day.MONDAY, DayType.getInstance(record.getInteger(2))); calendar.setWorkingDay(Day.TUESDAY, DayType.getInstance(record.getInteger(3))); calendar.setWorkingDay(Day.WEDNESDAY, DayType.getInstance(record.getInteger(4))); calendar.setWorkingDay(Day.THURSDAY, DayType.getInstance(record.getInteger(5))); calendar.setWorkingDay(Day.FRIDAY, DayType.getInstance(record.getInteger(6))); calendar.setWorkingDay(Day.SATURDAY, DayType.getInstance(record.getInteger(7))); m_eventManager.fireCalendarReadEvent(calendar); }
java
private void populateCalendar(Record record, ProjectCalendar calendar, boolean isBaseCalendar) { if (isBaseCalendar == true) { calendar.setName(record.getString(0)); } else { calendar.setParent(m_projectFile.getCalendarByName(record.getString(0))); } calendar.setWorkingDay(Day.SUNDAY, DayType.getInstance(record.getInteger(1))); calendar.setWorkingDay(Day.MONDAY, DayType.getInstance(record.getInteger(2))); calendar.setWorkingDay(Day.TUESDAY, DayType.getInstance(record.getInteger(3))); calendar.setWorkingDay(Day.WEDNESDAY, DayType.getInstance(record.getInteger(4))); calendar.setWorkingDay(Day.THURSDAY, DayType.getInstance(record.getInteger(5))); calendar.setWorkingDay(Day.FRIDAY, DayType.getInstance(record.getInteger(6))); calendar.setWorkingDay(Day.SATURDAY, DayType.getInstance(record.getInteger(7))); m_eventManager.fireCalendarReadEvent(calendar); }
[ "private", "void", "populateCalendar", "(", "Record", "record", ",", "ProjectCalendar", "calendar", ",", "boolean", "isBaseCalendar", ")", "{", "if", "(", "isBaseCalendar", "==", "true", ")", "{", "calendar", ".", "setName", "(", "record", ".", "getString", "(", "0", ")", ")", ";", "}", "else", "{", "calendar", ".", "setParent", "(", "m_projectFile", ".", "getCalendarByName", "(", "record", ".", "getString", "(", "0", ")", ")", ")", ";", "}", "calendar", ".", "setWorkingDay", "(", "Day", ".", "SUNDAY", ",", "DayType", ".", "getInstance", "(", "record", ".", "getInteger", "(", "1", ")", ")", ")", ";", "calendar", ".", "setWorkingDay", "(", "Day", ".", "MONDAY", ",", "DayType", ".", "getInstance", "(", "record", ".", "getInteger", "(", "2", ")", ")", ")", ";", "calendar", ".", "setWorkingDay", "(", "Day", ".", "TUESDAY", ",", "DayType", ".", "getInstance", "(", "record", ".", "getInteger", "(", "3", ")", ")", ")", ";", "calendar", ".", "setWorkingDay", "(", "Day", ".", "WEDNESDAY", ",", "DayType", ".", "getInstance", "(", "record", ".", "getInteger", "(", "4", ")", ")", ")", ";", "calendar", ".", "setWorkingDay", "(", "Day", ".", "THURSDAY", ",", "DayType", ".", "getInstance", "(", "record", ".", "getInteger", "(", "5", ")", ")", ")", ";", "calendar", ".", "setWorkingDay", "(", "Day", ".", "FRIDAY", ",", "DayType", ".", "getInstance", "(", "record", ".", "getInteger", "(", "6", ")", ")", ")", ";", "calendar", ".", "setWorkingDay", "(", "Day", ".", "SATURDAY", ",", "DayType", ".", "getInstance", "(", "record", ".", "getInteger", "(", "7", ")", ")", ")", ";", "m_eventManager", ".", "fireCalendarReadEvent", "(", "calendar", ")", ";", "}" ]
Populates a calendar instance. @param record MPX record @param calendar calendar instance @param isBaseCalendar true if this is a base calendar
[ "Populates", "a", "calendar", "instance", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L717-L737
line/armeria
core/src/main/java/com/linecorp/armeria/client/circuitbreaker/SlidingWindowCounter.java
SlidingWindowCounter.trimAndSum
private EventCount trimAndSum(long tickerNanos) { """ Sums up buckets within the time window, and removes all the others. """ final long oldLimit = tickerNanos - slidingWindowNanos; final Iterator<Bucket> iterator = reservoir.iterator(); long success = 0; long failure = 0; while (iterator.hasNext()) { final Bucket bucket = iterator.next(); if (bucket.timestamp < oldLimit) { // removes old bucket iterator.remove(); } else { success += bucket.success(); failure += bucket.failure(); } } return new EventCount(success, failure); }
java
private EventCount trimAndSum(long tickerNanos) { final long oldLimit = tickerNanos - slidingWindowNanos; final Iterator<Bucket> iterator = reservoir.iterator(); long success = 0; long failure = 0; while (iterator.hasNext()) { final Bucket bucket = iterator.next(); if (bucket.timestamp < oldLimit) { // removes old bucket iterator.remove(); } else { success += bucket.success(); failure += bucket.failure(); } } return new EventCount(success, failure); }
[ "private", "EventCount", "trimAndSum", "(", "long", "tickerNanos", ")", "{", "final", "long", "oldLimit", "=", "tickerNanos", "-", "slidingWindowNanos", ";", "final", "Iterator", "<", "Bucket", ">", "iterator", "=", "reservoir", ".", "iterator", "(", ")", ";", "long", "success", "=", "0", ";", "long", "failure", "=", "0", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "final", "Bucket", "bucket", "=", "iterator", ".", "next", "(", ")", ";", "if", "(", "bucket", ".", "timestamp", "<", "oldLimit", ")", "{", "// removes old bucket", "iterator", ".", "remove", "(", ")", ";", "}", "else", "{", "success", "+=", "bucket", ".", "success", "(", ")", ";", "failure", "+=", "bucket", ".", "failure", "(", ")", ";", "}", "}", "return", "new", "EventCount", "(", "success", ",", "failure", ")", ";", "}" ]
Sums up buckets within the time window, and removes all the others.
[ "Sums", "up", "buckets", "within", "the", "time", "window", "and", "removes", "all", "the", "others", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/circuitbreaker/SlidingWindowCounter.java#L123-L140
prometheus/client_java
simpleclient_caffeine/src/main/java/io/prometheus/client/cache/caffeine/CacheMetricsCollector.java
CacheMetricsCollector.addCache
public void addCache(String cacheName, AsyncLoadingCache cache) { """ Add or replace the cache with the given name. <p> Any references any previous cache with this name is invalidated. @param cacheName The name of the cache, will be the metrics label value @param cache The cache being monitored """ children.put(cacheName, cache.synchronous()); }
java
public void addCache(String cacheName, AsyncLoadingCache cache) { children.put(cacheName, cache.synchronous()); }
[ "public", "void", "addCache", "(", "String", "cacheName", ",", "AsyncLoadingCache", "cache", ")", "{", "children", ".", "put", "(", "cacheName", ",", "cache", ".", "synchronous", "(", ")", ")", ";", "}" ]
Add or replace the cache with the given name. <p> Any references any previous cache with this name is invalidated. @param cacheName The name of the cache, will be the metrics label value @param cache The cache being monitored
[ "Add", "or", "replace", "the", "cache", "with", "the", "given", "name", ".", "<p", ">", "Any", "references", "any", "previous", "cache", "with", "this", "name", "is", "invalidated", "." ]
train
https://github.com/prometheus/client_java/blob/4e0e7527b048f1ffd0382dcb74c0b9dab23b4d9f/simpleclient_caffeine/src/main/java/io/prometheus/client/cache/caffeine/CacheMetricsCollector.java#L75-L77
Daytron/SimpleDialogFX
src/main/java/com/github/daytron/simpledialogfx/dialog/Dialog.java
Dialog.setFontFamily
public void setFontFamily(String header_font_family, String details_font_family) { """ Sets both font families for the header and the details label with two font families <code>String</code> parameters given. @param header_font_family The header font family in <code>Strings</code> @param details_font_family The details font family in <code>Strings</code> """ this.headerLabel .setStyle("-fx-font-family: \"" + header_font_family + "\";"); this.detailsLabel .setStyle("-fx-font-family: \"" + details_font_family + "\";"); }
java
public void setFontFamily(String header_font_family, String details_font_family) { this.headerLabel .setStyle("-fx-font-family: \"" + header_font_family + "\";"); this.detailsLabel .setStyle("-fx-font-family: \"" + details_font_family + "\";"); }
[ "public", "void", "setFontFamily", "(", "String", "header_font_family", ",", "String", "details_font_family", ")", "{", "this", ".", "headerLabel", ".", "setStyle", "(", "\"-fx-font-family: \\\"\"", "+", "header_font_family", "+", "\"\\\";\"", ")", ";", "this", ".", "detailsLabel", ".", "setStyle", "(", "\"-fx-font-family: \\\"\"", "+", "details_font_family", "+", "\"\\\";\"", ")", ";", "}" ]
Sets both font families for the header and the details label with two font families <code>String</code> parameters given. @param header_font_family The header font family in <code>Strings</code> @param details_font_family The details font family in <code>Strings</code>
[ "Sets", "both", "font", "families", "for", "the", "header", "and", "the", "details", "label", "with", "two", "font", "families", "<code", ">", "String<", "/", "code", ">", "parameters", "given", "." ]
train
https://github.com/Daytron/SimpleDialogFX/blob/54e813dbb0ebabad8e0a81b6b5f05e518747611e/src/main/java/com/github/daytron/simpledialogfx/dialog/Dialog.java#L792-L797
Bearded-Hen/Android-Bootstrap
AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapCircleThumbnail.java
BootstrapCircleThumbnail.updateImageState
protected void updateImageState() { """ This method is called when the Circle Image needs to be recreated due to changes in size etc. A Paint object uses a BitmapShader to draw a center-cropped, circular image onto the View Canvas. A Matrix on the BitmapShader scales the original Bitmap to match the current view bounds, avoiding any inefficiencies in duplicating Bitmaps. <a href="http://www.curious-creature.com/2012/12/11/android-recipe-1-image-with-rounded-corners"> Further reading</a> """ float viewWidth = getWidth(); float viewHeight = getHeight(); if ((int) viewWidth <= 0 || (int) viewHeight <= 0) { return; } if (sourceBitmap != null) { BitmapShader imageShader = new BitmapShader(sourceBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); imagePaint.setShader(imageShader); // Scale the bitmap using a matrix, ensuring that it always matches the view bounds. float bitmapWidth = sourceBitmap.getWidth(); float bitmapHeight = sourceBitmap.getHeight(); float scaleFactor = (bitmapWidth < bitmapHeight) ? bitmapWidth : bitmapHeight; float xScale = viewWidth / scaleFactor; float yScale = viewHeight / scaleFactor; // Translate image to center crop (if it is not a perfect square bitmap) float dx = 0; float dy = 0; if (bitmapWidth > bitmapHeight) { dx = (viewWidth - bitmapWidth * xScale) * 0.5f; } else if (bitmapHeight > bitmapWidth) { dy = (viewHeight - bitmapHeight * yScale) * 0.5f; } matrix.set(null); matrix.setScale(xScale, yScale); matrix.postTranslate((dx + 0.5f), (dy + 0.5f)); imageShader.setLocalMatrix(matrix); imageRectF.set(0, 0, viewWidth, viewHeight); } updateBackground(); invalidate(); }
java
protected void updateImageState() { float viewWidth = getWidth(); float viewHeight = getHeight(); if ((int) viewWidth <= 0 || (int) viewHeight <= 0) { return; } if (sourceBitmap != null) { BitmapShader imageShader = new BitmapShader(sourceBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); imagePaint.setShader(imageShader); // Scale the bitmap using a matrix, ensuring that it always matches the view bounds. float bitmapWidth = sourceBitmap.getWidth(); float bitmapHeight = sourceBitmap.getHeight(); float scaleFactor = (bitmapWidth < bitmapHeight) ? bitmapWidth : bitmapHeight; float xScale = viewWidth / scaleFactor; float yScale = viewHeight / scaleFactor; // Translate image to center crop (if it is not a perfect square bitmap) float dx = 0; float dy = 0; if (bitmapWidth > bitmapHeight) { dx = (viewWidth - bitmapWidth * xScale) * 0.5f; } else if (bitmapHeight > bitmapWidth) { dy = (viewHeight - bitmapHeight * yScale) * 0.5f; } matrix.set(null); matrix.setScale(xScale, yScale); matrix.postTranslate((dx + 0.5f), (dy + 0.5f)); imageShader.setLocalMatrix(matrix); imageRectF.set(0, 0, viewWidth, viewHeight); } updateBackground(); invalidate(); }
[ "protected", "void", "updateImageState", "(", ")", "{", "float", "viewWidth", "=", "getWidth", "(", ")", ";", "float", "viewHeight", "=", "getHeight", "(", ")", ";", "if", "(", "(", "int", ")", "viewWidth", "<=", "0", "||", "(", "int", ")", "viewHeight", "<=", "0", ")", "{", "return", ";", "}", "if", "(", "sourceBitmap", "!=", "null", ")", "{", "BitmapShader", "imageShader", "=", "new", "BitmapShader", "(", "sourceBitmap", ",", "Shader", ".", "TileMode", ".", "CLAMP", ",", "Shader", ".", "TileMode", ".", "CLAMP", ")", ";", "imagePaint", ".", "setShader", "(", "imageShader", ")", ";", "// Scale the bitmap using a matrix, ensuring that it always matches the view bounds.", "float", "bitmapWidth", "=", "sourceBitmap", ".", "getWidth", "(", ")", ";", "float", "bitmapHeight", "=", "sourceBitmap", ".", "getHeight", "(", ")", ";", "float", "scaleFactor", "=", "(", "bitmapWidth", "<", "bitmapHeight", ")", "?", "bitmapWidth", ":", "bitmapHeight", ";", "float", "xScale", "=", "viewWidth", "/", "scaleFactor", ";", "float", "yScale", "=", "viewHeight", "/", "scaleFactor", ";", "// Translate image to center crop (if it is not a perfect square bitmap)", "float", "dx", "=", "0", ";", "float", "dy", "=", "0", ";", "if", "(", "bitmapWidth", ">", "bitmapHeight", ")", "{", "dx", "=", "(", "viewWidth", "-", "bitmapWidth", "*", "xScale", ")", "*", "0.5f", ";", "}", "else", "if", "(", "bitmapHeight", ">", "bitmapWidth", ")", "{", "dy", "=", "(", "viewHeight", "-", "bitmapHeight", "*", "yScale", ")", "*", "0.5f", ";", "}", "matrix", ".", "set", "(", "null", ")", ";", "matrix", ".", "setScale", "(", "xScale", ",", "yScale", ")", ";", "matrix", ".", "postTranslate", "(", "(", "dx", "+", "0.5f", ")", ",", "(", "dy", "+", "0.5f", ")", ")", ";", "imageShader", ".", "setLocalMatrix", "(", "matrix", ")", ";", "imageRectF", ".", "set", "(", "0", ",", "0", ",", "viewWidth", ",", "viewHeight", ")", ";", "}", "updateBackground", "(", ")", ";", "invalidate", "(", ")", ";", "}" ]
This method is called when the Circle Image needs to be recreated due to changes in size etc. A Paint object uses a BitmapShader to draw a center-cropped, circular image onto the View Canvas. A Matrix on the BitmapShader scales the original Bitmap to match the current view bounds, avoiding any inefficiencies in duplicating Bitmaps. <a href="http://www.curious-creature.com/2012/12/11/android-recipe-1-image-with-rounded-corners"> Further reading</a>
[ "This", "method", "is", "called", "when", "the", "Circle", "Image", "needs", "to", "be", "recreated", "due", "to", "changes", "in", "size", "etc", ".", "A", "Paint", "object", "uses", "a", "BitmapShader", "to", "draw", "a", "center", "-", "cropped", "circular", "image", "onto", "the", "View", "Canvas", ".", "A", "Matrix", "on", "the", "BitmapShader", "scales", "the", "original", "Bitmap", "to", "match", "the", "current", "view", "bounds", "avoiding", "any", "inefficiencies", "in", "duplicating", "Bitmaps", ".", "<a", "href", "=", "http", ":", "//", "www", ".", "curious", "-", "creature", ".", "com", "/", "2012", "/", "12", "/", "11", "/", "android", "-", "recipe", "-", "1", "-", "image", "-", "with", "-", "rounded", "-", "corners", ">", "Further", "reading<", "/", "a", ">" ]
train
https://github.com/Bearded-Hen/Android-Bootstrap/blob/b3d62cc1847e26d420c53c92665a4fe1e6ee7ecf/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapCircleThumbnail.java#L81-L121
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplex.java
BigComplex.valueOf
public static BigComplex valueOf(double real, double imaginary) { """ Returns a complex number with the specified real and imaginary {@code double} parts. @param real the real {@code double} part @param imaginary the imaginary {@code double} part @return the complex number """ return valueOf(BigDecimal.valueOf(real), BigDecimal.valueOf(imaginary)); }
java
public static BigComplex valueOf(double real, double imaginary) { return valueOf(BigDecimal.valueOf(real), BigDecimal.valueOf(imaginary)); }
[ "public", "static", "BigComplex", "valueOf", "(", "double", "real", ",", "double", "imaginary", ")", "{", "return", "valueOf", "(", "BigDecimal", ".", "valueOf", "(", "real", ")", ",", "BigDecimal", ".", "valueOf", "(", "imaginary", ")", ")", ";", "}" ]
Returns a complex number with the specified real and imaginary {@code double} parts. @param real the real {@code double} part @param imaginary the imaginary {@code double} part @return the complex number
[ "Returns", "a", "complex", "number", "with", "the", "specified", "real", "and", "imaginary", "{", "@code", "double", "}", "parts", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplex.java#L508-L510
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/EnumUtils.java
EnumUtils.generateBitVector
@GwtIncompatible("incompatible method") @SafeVarargs public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClass, final E... values) { """ <p>Creates a long bit vector representation of the given array of Enum values.</p> <p>This generates a value that is usable by {@link EnumUtils#processBitVector}.</p> <p>Do not use this method if you have more than 64 values in your Enum, as this would create a value greater than a long can hold.</p> @param enumClass the class of the enum we are working with, not {@code null} @param values the values we want to convert, not {@code null} @param <E> the type of the enumeration @return a long whose value provides a binary representation of the given set of enum values. @throws NullPointerException if {@code enumClass} or {@code values} is {@code null} @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values @since 3.0.1 @see #generateBitVectors(Class, Iterable) """ Validate.noNullElements(values); return generateBitVector(enumClass, Arrays.asList(values)); }
java
@GwtIncompatible("incompatible method") @SafeVarargs public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClass, final E... values) { Validate.noNullElements(values); return generateBitVector(enumClass, Arrays.asList(values)); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "@", "SafeVarargs", "public", "static", "<", "E", "extends", "Enum", "<", "E", ">", ">", "long", "generateBitVector", "(", "final", "Class", "<", "E", ">", "enumClass", ",", "final", "E", "...", "values", ")", "{", "Validate", ".", "noNullElements", "(", "values", ")", ";", "return", "generateBitVector", "(", "enumClass", ",", "Arrays", ".", "asList", "(", "values", ")", ")", ";", "}" ]
<p>Creates a long bit vector representation of the given array of Enum values.</p> <p>This generates a value that is usable by {@link EnumUtils#processBitVector}.</p> <p>Do not use this method if you have more than 64 values in your Enum, as this would create a value greater than a long can hold.</p> @param enumClass the class of the enum we are working with, not {@code null} @param values the values we want to convert, not {@code null} @param <E> the type of the enumeration @return a long whose value provides a binary representation of the given set of enum values. @throws NullPointerException if {@code enumClass} or {@code values} is {@code null} @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values @since 3.0.1 @see #generateBitVectors(Class, Iterable)
[ "<p", ">", "Creates", "a", "long", "bit", "vector", "representation", "of", "the", "given", "array", "of", "Enum", "values", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/EnumUtils.java#L203-L208
dhanji/sitebricks
sitebricks-converter/src/main/java/com/google/sitebricks/conversion/generics/Generics.java
Generics.getExactSuperType
public static Type getExactSuperType(Type type, Class<?> searchClass) { """ With type a supertype of searchClass, returns the exact supertype of the given class, including type parameters. For example, with <tt>class StringList implements List&lt;String&gt;</tt>, <tt>getExactSuperType(StringList.class, Collection.class)</tt> returns a {@link ParameterizedType} representing <tt>Collection&lt;String&gt;</tt>. <ul> <li>Returns null if <tt>searchClass</tt> is not a superclass of type.</li> <li>Returns an instance of {@link Class} if <tt>type</tt> if it is a raw type, or has no type parameters</li> <li>Returns an instance of {@link ParameterizedType} if the type does have parameters</li> <li>Returns an instance of {@link GenericArrayType} if <tt>searchClass</tt> is an array type, and the actual type has type parameters</li> </ul> """ if (type instanceof ParameterizedType || type instanceof Class<?> || type instanceof GenericArrayType) { Class<?> clazz = erase(type); if (searchClass == clazz) { return type; } if (!searchClass.isAssignableFrom(clazz)) return null; } for (Type superType : getExactDirectSuperTypes(type)) { Type result = getExactSuperType(superType, searchClass); if (result != null) return result; } return null; }
java
public static Type getExactSuperType(Type type, Class<?> searchClass) { if (type instanceof ParameterizedType || type instanceof Class<?> || type instanceof GenericArrayType) { Class<?> clazz = erase(type); if (searchClass == clazz) { return type; } if (!searchClass.isAssignableFrom(clazz)) return null; } for (Type superType : getExactDirectSuperTypes(type)) { Type result = getExactSuperType(superType, searchClass); if (result != null) return result; } return null; }
[ "public", "static", "Type", "getExactSuperType", "(", "Type", "type", ",", "Class", "<", "?", ">", "searchClass", ")", "{", "if", "(", "type", "instanceof", "ParameterizedType", "||", "type", "instanceof", "Class", "<", "?", ">", "||", "type", "instanceof", "GenericArrayType", ")", "{", "Class", "<", "?", ">", "clazz", "=", "erase", "(", "type", ")", ";", "if", "(", "searchClass", "==", "clazz", ")", "{", "return", "type", ";", "}", "if", "(", "!", "searchClass", ".", "isAssignableFrom", "(", "clazz", ")", ")", "return", "null", ";", "}", "for", "(", "Type", "superType", ":", "getExactDirectSuperTypes", "(", "type", ")", ")", "{", "Type", "result", "=", "getExactSuperType", "(", "superType", ",", "searchClass", ")", ";", "if", "(", "result", "!=", "null", ")", "return", "result", ";", "}", "return", "null", ";", "}" ]
With type a supertype of searchClass, returns the exact supertype of the given class, including type parameters. For example, with <tt>class StringList implements List&lt;String&gt;</tt>, <tt>getExactSuperType(StringList.class, Collection.class)</tt> returns a {@link ParameterizedType} representing <tt>Collection&lt;String&gt;</tt>. <ul> <li>Returns null if <tt>searchClass</tt> is not a superclass of type.</li> <li>Returns an instance of {@link Class} if <tt>type</tt> if it is a raw type, or has no type parameters</li> <li>Returns an instance of {@link ParameterizedType} if the type does have parameters</li> <li>Returns an instance of {@link GenericArrayType} if <tt>searchClass</tt> is an array type, and the actual type has type parameters</li> </ul>
[ "With", "type", "a", "supertype", "of", "searchClass", "returns", "the", "exact", "supertype", "of", "the", "given", "class", "including", "type", "parameters", ".", "For", "example", "with", "<tt", ">", "class", "StringList", "implements", "List&lt", ";", "String&gt", ";", "<", "/", "tt", ">", "<tt", ">", "getExactSuperType", "(", "StringList", ".", "class", "Collection", ".", "class", ")", "<", "/", "tt", ">", "returns", "a", "{" ]
train
https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks-converter/src/main/java/com/google/sitebricks/conversion/generics/Generics.java#L169-L193
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlSubstitutionFragment.java
SqlSubstitutionFragment.getPreparedStatementText
protected String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) { """ Return the text for a PreparedStatement from this fragment. This type of fragment typically evaluates any reflection parameters at this point. The exception is if the reflected result is a ComplexSqlFragment, it that case the sql text is retrieved from the fragment in this method. The parameter values are retrieved in the getParameterValues method of this class. @param context A ControlBeanContext instance @param m The annotated method @param args The method parameters @return A String containing the value of this fragment and its children """ StringBuilder sb = new StringBuilder(); for (SqlFragment frag : _children) { boolean complexFragment = frag.hasComplexValue(context, m, args); if (frag.hasParamValue() && !complexFragment) { Object[] pValues = frag.getParameterValues(context, m, args); for (Object o : pValues) { sb.append(processSqlParams(o)); } } else { _hasParamValue |= complexFragment; sb.append(frag.getPreparedStatementText(context, m, args)); } } return sb.toString(); }
java
protected String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) { StringBuilder sb = new StringBuilder(); for (SqlFragment frag : _children) { boolean complexFragment = frag.hasComplexValue(context, m, args); if (frag.hasParamValue() && !complexFragment) { Object[] pValues = frag.getParameterValues(context, m, args); for (Object o : pValues) { sb.append(processSqlParams(o)); } } else { _hasParamValue |= complexFragment; sb.append(frag.getPreparedStatementText(context, m, args)); } } return sb.toString(); }
[ "protected", "String", "getPreparedStatementText", "(", "ControlBeanContext", "context", ",", "Method", "m", ",", "Object", "[", "]", "args", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "SqlFragment", "frag", ":", "_children", ")", "{", "boolean", "complexFragment", "=", "frag", ".", "hasComplexValue", "(", "context", ",", "m", ",", "args", ")", ";", "if", "(", "frag", ".", "hasParamValue", "(", ")", "&&", "!", "complexFragment", ")", "{", "Object", "[", "]", "pValues", "=", "frag", ".", "getParameterValues", "(", "context", ",", "m", ",", "args", ")", ";", "for", "(", "Object", "o", ":", "pValues", ")", "{", "sb", ".", "append", "(", "processSqlParams", "(", "o", ")", ")", ";", "}", "}", "else", "{", "_hasParamValue", "|=", "complexFragment", ";", "sb", ".", "append", "(", "frag", ".", "getPreparedStatementText", "(", "context", ",", "m", ",", "args", ")", ")", ";", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Return the text for a PreparedStatement from this fragment. This type of fragment typically evaluates any reflection parameters at this point. The exception is if the reflected result is a ComplexSqlFragment, it that case the sql text is retrieved from the fragment in this method. The parameter values are retrieved in the getParameterValues method of this class. @param context A ControlBeanContext instance @param m The annotated method @param args The method parameters @return A String containing the value of this fragment and its children
[ "Return", "the", "text", "for", "a", "PreparedStatement", "from", "this", "fragment", ".", "This", "type", "of", "fragment", "typically", "evaluates", "any", "reflection", "parameters", "at", "this", "point", ".", "The", "exception", "is", "if", "the", "reflected", "result", "is", "a", "ComplexSqlFragment", "it", "that", "case", "the", "sql", "text", "is", "retrieved", "from", "the", "fragment", "in", "this", "method", ".", "The", "parameter", "values", "are", "retrieved", "in", "the", "getParameterValues", "method", "of", "this", "class", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlSubstitutionFragment.java#L119-L136
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java
HttpOutboundServiceContextImpl.sendRequestHeaders
@Override public VirtualConnection sendRequestHeaders(InterChannelCallback callback, boolean bForce) throws MessageSentException { """ Send the headers for the outgoing request asynchronously. If the write can be done immediately, the VirtualConnection will be returned and the callback will not be used. The caller is responsible for handling that situation in their code. A null return code means that the async write is in progress. The boolean bForce parameter allows the caller to force the asynchronous action even if it could be handled immediately. The return code will always be null and the callback always used. @param callback @param bForce @return VirtualConnection @throws MessageSentException -- if the headers have already been sent """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestHeaders(async)"); } if (headersSent()) { throw new MessageSentException("Headers already sent"); } setPartialBody(true); getLink().setAllowReconnect(true); setForceAsync(bForce); setAppWriteCallback(callback); VirtualConnection vc = sendHeaders(getRequestImpl(), HttpOSCWriteCallback.getRef()); // Note: if forcequeue is true, then we will not get a VC object as // the lower layer will use the callback and return null if (null != vc && shouldReadResponseImmediately()) { // write worked already and we need to read the response headers now vc = startResponseRead(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestHeaders(async): " + vc); } return vc; }
java
@Override public VirtualConnection sendRequestHeaders(InterChannelCallback callback, boolean bForce) throws MessageSentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "sendRequestHeaders(async)"); } if (headersSent()) { throw new MessageSentException("Headers already sent"); } setPartialBody(true); getLink().setAllowReconnect(true); setForceAsync(bForce); setAppWriteCallback(callback); VirtualConnection vc = sendHeaders(getRequestImpl(), HttpOSCWriteCallback.getRef()); // Note: if forcequeue is true, then we will not get a VC object as // the lower layer will use the callback and return null if (null != vc && shouldReadResponseImmediately()) { // write worked already and we need to read the response headers now vc = startResponseRead(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "sendRequestHeaders(async): " + vc); } return vc; }
[ "@", "Override", "public", "VirtualConnection", "sendRequestHeaders", "(", "InterChannelCallback", "callback", ",", "boolean", "bForce", ")", "throws", "MessageSentException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"sendRequestHeaders(async)\"", ")", ";", "}", "if", "(", "headersSent", "(", ")", ")", "{", "throw", "new", "MessageSentException", "(", "\"Headers already sent\"", ")", ";", "}", "setPartialBody", "(", "true", ")", ";", "getLink", "(", ")", ".", "setAllowReconnect", "(", "true", ")", ";", "setForceAsync", "(", "bForce", ")", ";", "setAppWriteCallback", "(", "callback", ")", ";", "VirtualConnection", "vc", "=", "sendHeaders", "(", "getRequestImpl", "(", ")", ",", "HttpOSCWriteCallback", ".", "getRef", "(", ")", ")", ";", "// Note: if forcequeue is true, then we will not get a VC object as", "// the lower layer will use the callback and return null", "if", "(", "null", "!=", "vc", "&&", "shouldReadResponseImmediately", "(", ")", ")", "{", "// write worked already and we need to read the response headers now", "vc", "=", "startResponseRead", "(", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"sendRequestHeaders(async): \"", "+", "vc", ")", ";", "}", "return", "vc", ";", "}" ]
Send the headers for the outgoing request asynchronously. If the write can be done immediately, the VirtualConnection will be returned and the callback will not be used. The caller is responsible for handling that situation in their code. A null return code means that the async write is in progress. The boolean bForce parameter allows the caller to force the asynchronous action even if it could be handled immediately. The return code will always be null and the callback always used. @param callback @param bForce @return VirtualConnection @throws MessageSentException -- if the headers have already been sent
[ "Send", "the", "headers", "for", "the", "outgoing", "request", "asynchronously", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/outbound/HttpOutboundServiceContextImpl.java#L923-L947
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/EnvelopesApi.java
EnvelopesApi.updateDocuments
public EnvelopeDocumentsResult updateDocuments(String accountId, String envelopeId, EnvelopeDefinition envelopeDefinition) throws ApiException { """ Adds one or more documents to an existing envelope document. Adds one or more documents to an existing envelope document. @param accountId The external account number (int) or account ID Guid. (required) @param envelopeId The envelopeId Guid of the envelope being accessed. (required) @param envelopeDefinition (optional) @return EnvelopeDocumentsResult """ return updateDocuments(accountId, envelopeId, envelopeDefinition, null); }
java
public EnvelopeDocumentsResult updateDocuments(String accountId, String envelopeId, EnvelopeDefinition envelopeDefinition) throws ApiException { return updateDocuments(accountId, envelopeId, envelopeDefinition, null); }
[ "public", "EnvelopeDocumentsResult", "updateDocuments", "(", "String", "accountId", ",", "String", "envelopeId", ",", "EnvelopeDefinition", "envelopeDefinition", ")", "throws", "ApiException", "{", "return", "updateDocuments", "(", "accountId", ",", "envelopeId", ",", "envelopeDefinition", ",", "null", ")", ";", "}" ]
Adds one or more documents to an existing envelope document. Adds one or more documents to an existing envelope document. @param accountId The external account number (int) or account ID Guid. (required) @param envelopeId The envelopeId Guid of the envelope being accessed. (required) @param envelopeDefinition (optional) @return EnvelopeDocumentsResult
[ "Adds", "one", "or", "more", "documents", "to", "an", "existing", "envelope", "document", ".", "Adds", "one", "or", "more", "documents", "to", "an", "existing", "envelope", "document", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L5130-L5132
SvenEwald/xmlbeam
src/main/java/org/xmlbeam/ProjectionInvocationHandler.java
ProjectionInvocationHandler.unwrapArgs
private static void unwrapArgs(final Class<?>[] types, final Object[] args) { """ If parameter is instance of Callable or Supplier then resolve its value. @param args @param args2 """ if (args == null) { return; } try { for (int i = 0; i < args.length; ++i) { args[i] = ReflectionHelper.unwrap(types[i], args[i]); } } catch (Exception e) { throw new IllegalArgumentException(e); } }
java
private static void unwrapArgs(final Class<?>[] types, final Object[] args) { if (args == null) { return; } try { for (int i = 0; i < args.length; ++i) { args[i] = ReflectionHelper.unwrap(types[i], args[i]); } } catch (Exception e) { throw new IllegalArgumentException(e); } }
[ "private", "static", "void", "unwrapArgs", "(", "final", "Class", "<", "?", ">", "[", "]", "types", ",", "final", "Object", "[", "]", "args", ")", "{", "if", "(", "args", "==", "null", ")", "{", "return", ";", "}", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "++", "i", ")", "{", "args", "[", "i", "]", "=", "ReflectionHelper", ".", "unwrap", "(", "types", "[", "i", "]", ",", "args", "[", "i", "]", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "e", ")", ";", "}", "}" ]
If parameter is instance of Callable or Supplier then resolve its value. @param args @param args2
[ "If", "parameter", "is", "instance", "of", "Callable", "or", "Supplier", "then", "resolve", "its", "value", "." ]
train
https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/ProjectionInvocationHandler.java#L893-L905
frostwire/frostwire-jlibtorrent
src/main/java/com/frostwire/jlibtorrent/SessionHandle.java
SessionHandle.dhtGetItem
public void dhtGetItem(byte[] key, byte[] salt) { """ Query the DHT for a mutable item under the public key {@code key}. this is an ed25519 key. The {@code salt} argument is optional and may be left as an empty string if no salt is to be used. <p> if the item is found in the DHT, a {@link DhtMutableItemAlert} is posted. @param key @param salt """ s.dht_get_item(Vectors.bytes2byte_vector(key), Vectors.bytes2byte_vector(salt)); }
java
public void dhtGetItem(byte[] key, byte[] salt) { s.dht_get_item(Vectors.bytes2byte_vector(key), Vectors.bytes2byte_vector(salt)); }
[ "public", "void", "dhtGetItem", "(", "byte", "[", "]", "key", ",", "byte", "[", "]", "salt", ")", "{", "s", ".", "dht_get_item", "(", "Vectors", ".", "bytes2byte_vector", "(", "key", ")", ",", "Vectors", ".", "bytes2byte_vector", "(", "salt", ")", ")", ";", "}" ]
Query the DHT for a mutable item under the public key {@code key}. this is an ed25519 key. The {@code salt} argument is optional and may be left as an empty string if no salt is to be used. <p> if the item is found in the DHT, a {@link DhtMutableItemAlert} is posted. @param key @param salt
[ "Query", "the", "DHT", "for", "a", "mutable", "item", "under", "the", "public", "key", "{", "@code", "key", "}", ".", "this", "is", "an", "ed25519", "key", ".", "The", "{", "@code", "salt", "}", "argument", "is", "optional", "and", "may", "be", "left", "as", "an", "empty", "string", "if", "no", "salt", "is", "to", "be", "used", ".", "<p", ">", "if", "the", "item", "is", "found", "in", "the", "DHT", "a", "{", "@link", "DhtMutableItemAlert", "}", "is", "posted", "." ]
train
https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/SessionHandle.java#L481-L483
landawn/AbacusUtil
src/com/landawn/abacus/util/stream/IteratorStream.java
IteratorStream.queued
@Override public Stream<T> queued(int queueSize) { """ Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterator asynchronously. @param stream @param queueSize Default value is 8 @return """ final Iterator<T> iter = iterator(); if (iter instanceof QueuedIterator && ((QueuedIterator<? extends T>) iter).max() >= queueSize) { return newStream(elements, sorted, cmp); } else { return newStream(Stream.parallelConcatt(Arrays.asList(iter), 1, queueSize), sorted, cmp); } }
java
@Override public Stream<T> queued(int queueSize) { final Iterator<T> iter = iterator(); if (iter instanceof QueuedIterator && ((QueuedIterator<? extends T>) iter).max() >= queueSize) { return newStream(elements, sorted, cmp); } else { return newStream(Stream.parallelConcatt(Arrays.asList(iter), 1, queueSize), sorted, cmp); } }
[ "@", "Override", "public", "Stream", "<", "T", ">", "queued", "(", "int", "queueSize", ")", "{", "final", "Iterator", "<", "T", ">", "iter", "=", "iterator", "(", ")", ";", "if", "(", "iter", "instanceof", "QueuedIterator", "&&", "(", "(", "QueuedIterator", "<", "?", "extends", "T", ">", ")", "iter", ")", ".", "max", "(", ")", ">=", "queueSize", ")", "{", "return", "newStream", "(", "elements", ",", "sorted", ",", "cmp", ")", ";", "}", "else", "{", "return", "newStream", "(", "Stream", ".", "parallelConcatt", "(", "Arrays", ".", "asList", "(", "iter", ")", ",", "1", ",", "queueSize", ")", ",", "sorted", ",", "cmp", ")", ";", "}", "}" ]
Returns a Stream with elements from a temporary queue which is filled by reading the elements from the specified iterator asynchronously. @param stream @param queueSize Default value is 8 @return
[ "Returns", "a", "Stream", "with", "elements", "from", "a", "temporary", "queue", "which", "is", "filled", "by", "reading", "the", "elements", "from", "the", "specified", "iterator", "asynchronously", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/IteratorStream.java#L3336-L3345
UrielCh/ovh-java-sdk
ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java
ApiOvhEmailpro.service_account_email_sendOnBehalfTo_allowedAccountId_GET
public OvhAccountSendOnBehalfTo service_account_email_sendOnBehalfTo_allowedAccountId_GET(String service, String email, Long allowedAccountId) throws IOException { """ Get this object properties REST: GET /email/pro/{service}/account/{email}/sendOnBehalfTo/{allowedAccountId} @param service [required] The internal name of your pro organization @param email [required] Default email for this mailbox @param allowedAccountId [required] Account id to give send on behalf to API beta """ String qPath = "/email/pro/{service}/account/{email}/sendOnBehalfTo/{allowedAccountId}"; StringBuilder sb = path(qPath, service, email, allowedAccountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAccountSendOnBehalfTo.class); }
java
public OvhAccountSendOnBehalfTo service_account_email_sendOnBehalfTo_allowedAccountId_GET(String service, String email, Long allowedAccountId) throws IOException { String qPath = "/email/pro/{service}/account/{email}/sendOnBehalfTo/{allowedAccountId}"; StringBuilder sb = path(qPath, service, email, allowedAccountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAccountSendOnBehalfTo.class); }
[ "public", "OvhAccountSendOnBehalfTo", "service_account_email_sendOnBehalfTo_allowedAccountId_GET", "(", "String", "service", ",", "String", "email", ",", "Long", "allowedAccountId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/pro/{service}/account/{email}/sendOnBehalfTo/{allowedAccountId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "service", ",", "email", ",", "allowedAccountId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhAccountSendOnBehalfTo", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /email/pro/{service}/account/{email}/sendOnBehalfTo/{allowedAccountId} @param service [required] The internal name of your pro organization @param email [required] Default email for this mailbox @param allowedAccountId [required] Account id to give send on behalf to API beta
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L575-L580
infinispan/infinispan
core/src/main/java/org/infinispan/distribution/ch/impl/ScatteredConsistentHashFactory.java
ScatteredConsistentHashFactory.updateMembers
@Override public ScatteredConsistentHash updateMembers(ScatteredConsistentHash baseCH, List<Address> actualMembers, Map<Address, Float> actualCapacityFactors) { """ Leavers are removed and segments without owners are assigned new owners. Joiners might get some of the un-owned segments but otherwise they are not taken into account (that should happen during a rebalance). @param baseCH An existing consistent hash instance, should not be {@code null} @param actualMembers A list of addresses representing the new cache members. @return """ if (actualMembers.size() == 0) throw new IllegalArgumentException("Can't construct a consistent hash without any members"); checkCapacityFactors(actualMembers, actualCapacityFactors); boolean sameCapacityFactors = actualCapacityFactors == null ? baseCH.getCapacityFactors() == null : actualCapacityFactors.equals(baseCH.getCapacityFactors()); if (actualMembers.equals(baseCH.getMembers()) && sameCapacityFactors) return baseCH; // The builder constructor automatically removes leavers Builder builder = new Builder(baseCH, actualMembers, actualCapacityFactors); return builder.build(); }
java
@Override public ScatteredConsistentHash updateMembers(ScatteredConsistentHash baseCH, List<Address> actualMembers, Map<Address, Float> actualCapacityFactors) { if (actualMembers.size() == 0) throw new IllegalArgumentException("Can't construct a consistent hash without any members"); checkCapacityFactors(actualMembers, actualCapacityFactors); boolean sameCapacityFactors = actualCapacityFactors == null ? baseCH.getCapacityFactors() == null : actualCapacityFactors.equals(baseCH.getCapacityFactors()); if (actualMembers.equals(baseCH.getMembers()) && sameCapacityFactors) return baseCH; // The builder constructor automatically removes leavers Builder builder = new Builder(baseCH, actualMembers, actualCapacityFactors); return builder.build(); }
[ "@", "Override", "public", "ScatteredConsistentHash", "updateMembers", "(", "ScatteredConsistentHash", "baseCH", ",", "List", "<", "Address", ">", "actualMembers", ",", "Map", "<", "Address", ",", "Float", ">", "actualCapacityFactors", ")", "{", "if", "(", "actualMembers", ".", "size", "(", ")", "==", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Can't construct a consistent hash without any members\"", ")", ";", "checkCapacityFactors", "(", "actualMembers", ",", "actualCapacityFactors", ")", ";", "boolean", "sameCapacityFactors", "=", "actualCapacityFactors", "==", "null", "?", "baseCH", ".", "getCapacityFactors", "(", ")", "==", "null", ":", "actualCapacityFactors", ".", "equals", "(", "baseCH", ".", "getCapacityFactors", "(", ")", ")", ";", "if", "(", "actualMembers", ".", "equals", "(", "baseCH", ".", "getMembers", "(", ")", ")", "&&", "sameCapacityFactors", ")", "return", "baseCH", ";", "// The builder constructor automatically removes leavers", "Builder", "builder", "=", "new", "Builder", "(", "baseCH", ",", "actualMembers", ",", "actualCapacityFactors", ")", ";", "return", "builder", ".", "build", "(", ")", ";", "}" ]
Leavers are removed and segments without owners are assigned new owners. Joiners might get some of the un-owned segments but otherwise they are not taken into account (that should happen during a rebalance). @param baseCH An existing consistent hash instance, should not be {@code null} @param actualMembers A list of addresses representing the new cache members. @return
[ "Leavers", "are", "removed", "and", "segments", "without", "owners", "are", "assigned", "new", "owners", ".", "Joiners", "might", "get", "some", "of", "the", "un", "-", "owned", "segments", "but", "otherwise", "they", "are", "not", "taken", "into", "account", "(", "that", "should", "happen", "during", "a", "rebalance", ")", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/distribution/ch/impl/ScatteredConsistentHashFactory.java#L64-L80
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java
ChannelCreateHandler.handleGroupChannel
private void handleGroupChannel(JsonNode channel) { """ Handles a group channel creation. @param channel The channel data. """ long channelId = channel.get("id").asLong(); if (!api.getGroupChannelById(channelId).isPresent()) { GroupChannel groupChannel = new GroupChannelImpl(api, channel); GroupChannelCreateEvent event = new GroupChannelCreateEventImpl(groupChannel); api.getEventDispatcher().dispatchGroupChannelCreateEvent(api, groupChannel.getMembers(), event); } }
java
private void handleGroupChannel(JsonNode channel) { long channelId = channel.get("id").asLong(); if (!api.getGroupChannelById(channelId).isPresent()) { GroupChannel groupChannel = new GroupChannelImpl(api, channel); GroupChannelCreateEvent event = new GroupChannelCreateEventImpl(groupChannel); api.getEventDispatcher().dispatchGroupChannelCreateEvent(api, groupChannel.getMembers(), event); } }
[ "private", "void", "handleGroupChannel", "(", "JsonNode", "channel", ")", "{", "long", "channelId", "=", "channel", ".", "get", "(", "\"id\"", ")", ".", "asLong", "(", ")", ";", "if", "(", "!", "api", ".", "getGroupChannelById", "(", "channelId", ")", ".", "isPresent", "(", ")", ")", "{", "GroupChannel", "groupChannel", "=", "new", "GroupChannelImpl", "(", "api", ",", "channel", ")", ";", "GroupChannelCreateEvent", "event", "=", "new", "GroupChannelCreateEventImpl", "(", "groupChannel", ")", ";", "api", ".", "getEventDispatcher", "(", ")", ".", "dispatchGroupChannelCreateEvent", "(", "api", ",", "groupChannel", ".", "getMembers", "(", ")", ",", "event", ")", ";", "}", "}" ]
Handles a group channel creation. @param channel The channel data.
[ "Handles", "a", "group", "channel", "creation", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/handler/channel/ChannelCreateHandler.java#L141-L149
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/component/basic/AbstractComponent.java
AbstractComponent.createWave
private Wave createWave(final WaveGroup waveGroup, final WaveType waveType, final Class<?> componentClass, final WaveBean waveBean, final WaveBean... waveBeans) { """ Build a wave object with its dedicated WaveBean. @param waveGroup the group of the wave @param waveType the type of the wave @param componentClass the component class if any @param waveBean the wave bean that holds all required data @param waveBeans the extra Wave Beans that holds all other required data @return the wave built """ final List<WaveBean> waveBeanList = new ArrayList<>(); waveBeanList.add(waveBean); if (waveBeans.length > 0) { waveBeanList.addAll(Arrays.asList(waveBeans)); } final Wave wave = wave() .waveGroup(waveGroup) .waveType(waveType) .fromClass(this.getClass()) .componentClass(componentClass) .waveBeanList(waveBeanList); // Track wave creation localFacade().globalFacade().trackEvent(JRebirthEventType.CREATE_WAVE, this.getClass(), wave.getClass()); return wave; }
java
private Wave createWave(final WaveGroup waveGroup, final WaveType waveType, final Class<?> componentClass, final WaveBean waveBean, final WaveBean... waveBeans) { final List<WaveBean> waveBeanList = new ArrayList<>(); waveBeanList.add(waveBean); if (waveBeans.length > 0) { waveBeanList.addAll(Arrays.asList(waveBeans)); } final Wave wave = wave() .waveGroup(waveGroup) .waveType(waveType) .fromClass(this.getClass()) .componentClass(componentClass) .waveBeanList(waveBeanList); // Track wave creation localFacade().globalFacade().trackEvent(JRebirthEventType.CREATE_WAVE, this.getClass(), wave.getClass()); return wave; }
[ "private", "Wave", "createWave", "(", "final", "WaveGroup", "waveGroup", ",", "final", "WaveType", "waveType", ",", "final", "Class", "<", "?", ">", "componentClass", ",", "final", "WaveBean", "waveBean", ",", "final", "WaveBean", "...", "waveBeans", ")", "{", "final", "List", "<", "WaveBean", ">", "waveBeanList", "=", "new", "ArrayList", "<>", "(", ")", ";", "waveBeanList", ".", "add", "(", "waveBean", ")", ";", "if", "(", "waveBeans", ".", "length", ">", "0", ")", "{", "waveBeanList", ".", "addAll", "(", "Arrays", ".", "asList", "(", "waveBeans", ")", ")", ";", "}", "final", "Wave", "wave", "=", "wave", "(", ")", ".", "waveGroup", "(", "waveGroup", ")", ".", "waveType", "(", "waveType", ")", ".", "fromClass", "(", "this", ".", "getClass", "(", ")", ")", ".", "componentClass", "(", "componentClass", ")", ".", "waveBeanList", "(", "waveBeanList", ")", ";", "// Track wave creation", "localFacade", "(", ")", ".", "globalFacade", "(", ")", ".", "trackEvent", "(", "JRebirthEventType", ".", "CREATE_WAVE", ",", "this", ".", "getClass", "(", ")", ",", "wave", ".", "getClass", "(", ")", ")", ";", "return", "wave", ";", "}" ]
Build a wave object with its dedicated WaveBean. @param waveGroup the group of the wave @param waveType the type of the wave @param componentClass the component class if any @param waveBean the wave bean that holds all required data @param waveBeans the extra Wave Beans that holds all other required data @return the wave built
[ "Build", "a", "wave", "object", "with", "its", "dedicated", "WaveBean", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/component/basic/AbstractComponent.java#L337-L356
mapbox/mapbox-navigation-android
libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/RouteUtils.java
RouteUtils.findCurrentBannerInstructions
@Nullable public BannerInstructions findCurrentBannerInstructions(LegStep currentStep, double stepDistanceRemaining) { """ Given the current step / current step distance remaining, this function will find the current instructions to be shown. @param currentStep holding the current banner instructions @param stepDistanceRemaining to determine progress along the currentStep @return the current banner instructions based on the current distance along the step @since 0.13.0 """ if (isValidBannerInstructions(currentStep)) { List<BannerInstructions> instructions = sortBannerInstructions(currentStep.bannerInstructions()); for (BannerInstructions instruction : instructions) { int distanceAlongGeometry = (int) instruction.distanceAlongGeometry(); if (distanceAlongGeometry >= (int) stepDistanceRemaining) { return instruction; } } return instructions.get(FIRST_INSTRUCTION); } return null; }
java
@Nullable public BannerInstructions findCurrentBannerInstructions(LegStep currentStep, double stepDistanceRemaining) { if (isValidBannerInstructions(currentStep)) { List<BannerInstructions> instructions = sortBannerInstructions(currentStep.bannerInstructions()); for (BannerInstructions instruction : instructions) { int distanceAlongGeometry = (int) instruction.distanceAlongGeometry(); if (distanceAlongGeometry >= (int) stepDistanceRemaining) { return instruction; } } return instructions.get(FIRST_INSTRUCTION); } return null; }
[ "@", "Nullable", "public", "BannerInstructions", "findCurrentBannerInstructions", "(", "LegStep", "currentStep", ",", "double", "stepDistanceRemaining", ")", "{", "if", "(", "isValidBannerInstructions", "(", "currentStep", ")", ")", "{", "List", "<", "BannerInstructions", ">", "instructions", "=", "sortBannerInstructions", "(", "currentStep", ".", "bannerInstructions", "(", ")", ")", ";", "for", "(", "BannerInstructions", "instruction", ":", "instructions", ")", "{", "int", "distanceAlongGeometry", "=", "(", "int", ")", "instruction", ".", "distanceAlongGeometry", "(", ")", ";", "if", "(", "distanceAlongGeometry", ">=", "(", "int", ")", "stepDistanceRemaining", ")", "{", "return", "instruction", ";", "}", "}", "return", "instructions", ".", "get", "(", "FIRST_INSTRUCTION", ")", ";", "}", "return", "null", ";", "}" ]
Given the current step / current step distance remaining, this function will find the current instructions to be shown. @param currentStep holding the current banner instructions @param stepDistanceRemaining to determine progress along the currentStep @return the current banner instructions based on the current distance along the step @since 0.13.0
[ "Given", "the", "current", "step", "/", "current", "step", "distance", "remaining", "this", "function", "will", "find", "the", "current", "instructions", "to", "be", "shown", "." ]
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/RouteUtils.java#L118-L131
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java
DefaultDatastoreReader.load
public <E> E load(Class<E> entityClass, DatastoreKey key) { """ Retrieves and returns the entity with the given key. @param entityClass the expected result type @param key the entity key @return the entity with the given key, or <code>null</code>, if no entity exists with the given key. @throws EntityManagerException if any error occurs while accessing the Datastore. """ return fetch(entityClass, key.nativeKey()); }
java
public <E> E load(Class<E> entityClass, DatastoreKey key) { return fetch(entityClass, key.nativeKey()); }
[ "public", "<", "E", ">", "E", "load", "(", "Class", "<", "E", ">", "entityClass", ",", "DatastoreKey", "key", ")", "{", "return", "fetch", "(", "entityClass", ",", "key", ".", "nativeKey", "(", ")", ")", ";", "}" ]
Retrieves and returns the entity with the given key. @param entityClass the expected result type @param key the entity key @return the entity with the given key, or <code>null</code>, if no entity exists with the given key. @throws EntityManagerException if any error occurs while accessing the Datastore.
[ "Retrieves", "and", "returns", "the", "entity", "with", "the", "given", "key", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java#L191-L193
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java
FileSystem.makeAbsolute
@Pure public static URL makeAbsolute(URL filename, File current) { """ Make the given filename absolute from the given root if it is not already absolute. <table border="1" width="100%" summary="Cases"> <thead> <tr> <td>{@code filename}</td><td>{@code current}</td><td>Result</td> </tr> </thead> <tr> <td><code>null</code></td> <td><code>null</code></td> <td><code>null</code></td> </tr> <tr> <td><code>null</code></td> <td><code>/myroot</code></td> <td><code>null</code></td> </tr> <tr> <td><code>file:/path/to/file</code></td> <td><code>null</code></td> <td><code>file:/path/to/file</code></td> </tr> <tr> <td><code>file:path/to/file</code></td> <td><code>null</code></td> <td><code>file:path/to/file</code></td> </tr> <tr> <td><code>file:/path/to/file</code></td> <td><code>/myroot</code></td> <td><code>file:/path/to/file</code></td> </tr> <tr> <td><code>file:path/to/file</code></td> <td><code>/myroot</code></td> <td><code>file:/myroot/path/to/file</code></td> </tr> <tr> <td><code>http://host.com/path/to/file</code></td> <td><code>null</code></td> <td><code>http://host.com/path/to/file</code></td> </tr> <tr> <td><code>http://host.com/path/to/file</code></td> <td><code>/myroot</code></td> <td><code>http://host.com/path/to/file</code></td> </tr> <tr> <td><code>ftp://host.com/path/to/file</code></td> <td><code>null</code></td> <td><code>ftp://host.com/path/to/file</code></td> </tr> <tr> <td><code>ftp://host.com/path/to/file</code></td> <td><code>/myroot</code></td> <td><code>ftp://host.com/path/to/file</code></td> </tr> <tr> <td><code>ssh://host.com/path/to/file</code></td> <td><code>null</code></td> <td><code>ssh://host.com/path/to/file</code></td> </tr> <tr> <td><code>ssh://host.com/path/to/file</code></td> <td><code>/myroot</code></td> <td><code>ssh://host.com/path/to/file</code></td> </tr> </table> @param filename is the name to make absolute. @param current is the current directory which permits to make absolute. @return an absolute filename. """ try { return makeAbsolute(filename, current == null ? null : current.toURI().toURL()); } catch (MalformedURLException exception) { // } return filename; }
java
@Pure public static URL makeAbsolute(URL filename, File current) { try { return makeAbsolute(filename, current == null ? null : current.toURI().toURL()); } catch (MalformedURLException exception) { // } return filename; }
[ "@", "Pure", "public", "static", "URL", "makeAbsolute", "(", "URL", "filename", ",", "File", "current", ")", "{", "try", "{", "return", "makeAbsolute", "(", "filename", ",", "current", "==", "null", "?", "null", ":", "current", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ")", ";", "}", "catch", "(", "MalformedURLException", "exception", ")", "{", "//", "}", "return", "filename", ";", "}" ]
Make the given filename absolute from the given root if it is not already absolute. <table border="1" width="100%" summary="Cases"> <thead> <tr> <td>{@code filename}</td><td>{@code current}</td><td>Result</td> </tr> </thead> <tr> <td><code>null</code></td> <td><code>null</code></td> <td><code>null</code></td> </tr> <tr> <td><code>null</code></td> <td><code>/myroot</code></td> <td><code>null</code></td> </tr> <tr> <td><code>file:/path/to/file</code></td> <td><code>null</code></td> <td><code>file:/path/to/file</code></td> </tr> <tr> <td><code>file:path/to/file</code></td> <td><code>null</code></td> <td><code>file:path/to/file</code></td> </tr> <tr> <td><code>file:/path/to/file</code></td> <td><code>/myroot</code></td> <td><code>file:/path/to/file</code></td> </tr> <tr> <td><code>file:path/to/file</code></td> <td><code>/myroot</code></td> <td><code>file:/myroot/path/to/file</code></td> </tr> <tr> <td><code>http://host.com/path/to/file</code></td> <td><code>null</code></td> <td><code>http://host.com/path/to/file</code></td> </tr> <tr> <td><code>http://host.com/path/to/file</code></td> <td><code>/myroot</code></td> <td><code>http://host.com/path/to/file</code></td> </tr> <tr> <td><code>ftp://host.com/path/to/file</code></td> <td><code>null</code></td> <td><code>ftp://host.com/path/to/file</code></td> </tr> <tr> <td><code>ftp://host.com/path/to/file</code></td> <td><code>/myroot</code></td> <td><code>ftp://host.com/path/to/file</code></td> </tr> <tr> <td><code>ssh://host.com/path/to/file</code></td> <td><code>null</code></td> <td><code>ssh://host.com/path/to/file</code></td> </tr> <tr> <td><code>ssh://host.com/path/to/file</code></td> <td><code>/myroot</code></td> <td><code>ssh://host.com/path/to/file</code></td> </tr> </table> @param filename is the name to make absolute. @param current is the current directory which permits to make absolute. @return an absolute filename.
[ "Make", "the", "given", "filename", "absolute", "from", "the", "given", "root", "if", "it", "is", "not", "already", "absolute", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L2255-L2263
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java
FeatureInfoBuilder.buildResultsInfoMessageAndClose
public String buildResultsInfoMessageAndClose(FeatureIndexResults results, double tolerance, LatLng clickLocation, Projection projection) { """ Build a feature results information message and close the results @param results feature index results @param tolerance distance tolerance @param clickLocation map click location @param projection desired geometry projection @return results message or null if no results """ String message = null; try { message = buildResultsInfoMessage(results, tolerance, clickLocation, projection); } finally { results.close(); } return message; }
java
public String buildResultsInfoMessageAndClose(FeatureIndexResults results, double tolerance, LatLng clickLocation, Projection projection) { String message = null; try { message = buildResultsInfoMessage(results, tolerance, clickLocation, projection); } finally { results.close(); } return message; }
[ "public", "String", "buildResultsInfoMessageAndClose", "(", "FeatureIndexResults", "results", ",", "double", "tolerance", ",", "LatLng", "clickLocation", ",", "Projection", "projection", ")", "{", "String", "message", "=", "null", ";", "try", "{", "message", "=", "buildResultsInfoMessage", "(", "results", ",", "tolerance", ",", "clickLocation", ",", "projection", ")", ";", "}", "finally", "{", "results", ".", "close", "(", ")", ";", "}", "return", "message", ";", "}" ]
Build a feature results information message and close the results @param results feature index results @param tolerance distance tolerance @param clickLocation map click location @param projection desired geometry projection @return results message or null if no results
[ "Build", "a", "feature", "results", "information", "message", "and", "close", "the", "results" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java#L276-L286
looly/hutool
hutool-db/src/main/java/cn/hutool/db/AbstractDb.java
AbstractDb.pageForEntityList
public List<Entity> pageForEntityList(Entity where, int page, int numPerPage) throws SQLException { """ 分页查询,结果为Entity列表,不计算总数<br> 查询条件为多个key value对表示,默认key = value,如果使用其它条件可以使用:where.put("key", " &gt; 1"),value也可以传Condition对象,key被忽略 @param where 条件实体类(包含表名) @param page 页码 @param numPerPage 每页条目数 @return 结果对象 @throws SQLException SQL执行异常 @since 3.2.2 """ return pageForEntityList(where, new Page(page, numPerPage)); }
java
public List<Entity> pageForEntityList(Entity where, int page, int numPerPage) throws SQLException { return pageForEntityList(where, new Page(page, numPerPage)); }
[ "public", "List", "<", "Entity", ">", "pageForEntityList", "(", "Entity", "where", ",", "int", "page", ",", "int", "numPerPage", ")", "throws", "SQLException", "{", "return", "pageForEntityList", "(", "where", ",", "new", "Page", "(", "page", ",", "numPerPage", ")", ")", ";", "}" ]
分页查询,结果为Entity列表,不计算总数<br> 查询条件为多个key value对表示,默认key = value,如果使用其它条件可以使用:where.put("key", " &gt; 1"),value也可以传Condition对象,key被忽略 @param where 条件实体类(包含表名) @param page 页码 @param numPerPage 每页条目数 @return 结果对象 @throws SQLException SQL执行异常 @since 3.2.2
[ "分页查询,结果为Entity列表,不计算总数<br", ">", "查询条件为多个key", "value对表示,默认key", "=", "value,如果使用其它条件可以使用:where", ".", "put", "(", "key", "&gt", ";", "1", ")", ",value也可以传Condition对象,key被忽略" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L659-L661
alkacon/opencms-core
src/org/opencms/ui/components/CmsFileTable.java
CmsFileTable.filterTable
public void filterTable(String search) { """ Filters the displayed resources.<p> Only resources where either the resource name, the title or the nav-text contains the given substring are shown.<p> @param search the search term """ m_container.removeAllContainerFilters(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) { m_container.addContainerFilter( new Or( new SimpleStringFilter(CmsResourceTableProperty.PROPERTY_RESOURCE_NAME, search, true, false), new SimpleStringFilter(CmsResourceTableProperty.PROPERTY_NAVIGATION_TEXT, search, true, false), new SimpleStringFilter(CmsResourceTableProperty.PROPERTY_TITLE, search, true, false))); } if ((m_fileTable.getValue() != null) & !((Set<?>)m_fileTable.getValue()).isEmpty()) { m_fileTable.setCurrentPageFirstItemId(((Set<?>)m_fileTable.getValue()).iterator().next()); } }
java
public void filterTable(String search) { m_container.removeAllContainerFilters(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) { m_container.addContainerFilter( new Or( new SimpleStringFilter(CmsResourceTableProperty.PROPERTY_RESOURCE_NAME, search, true, false), new SimpleStringFilter(CmsResourceTableProperty.PROPERTY_NAVIGATION_TEXT, search, true, false), new SimpleStringFilter(CmsResourceTableProperty.PROPERTY_TITLE, search, true, false))); } if ((m_fileTable.getValue() != null) & !((Set<?>)m_fileTable.getValue()).isEmpty()) { m_fileTable.setCurrentPageFirstItemId(((Set<?>)m_fileTable.getValue()).iterator().next()); } }
[ "public", "void", "filterTable", "(", "String", "search", ")", "{", "m_container", ".", "removeAllContainerFilters", "(", ")", ";", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "search", ")", ")", "{", "m_container", ".", "addContainerFilter", "(", "new", "Or", "(", "new", "SimpleStringFilter", "(", "CmsResourceTableProperty", ".", "PROPERTY_RESOURCE_NAME", ",", "search", ",", "true", ",", "false", ")", ",", "new", "SimpleStringFilter", "(", "CmsResourceTableProperty", ".", "PROPERTY_NAVIGATION_TEXT", ",", "search", ",", "true", ",", "false", ")", ",", "new", "SimpleStringFilter", "(", "CmsResourceTableProperty", ".", "PROPERTY_TITLE", ",", "search", ",", "true", ",", "false", ")", ")", ")", ";", "}", "if", "(", "(", "m_fileTable", ".", "getValue", "(", ")", "!=", "null", ")", "&", "!", "(", "(", "Set", "<", "?", ">", ")", "m_fileTable", ".", "getValue", "(", ")", ")", ".", "isEmpty", "(", ")", ")", "{", "m_fileTable", ".", "setCurrentPageFirstItemId", "(", "(", "(", "Set", "<", "?", ">", ")", "m_fileTable", ".", "getValue", "(", ")", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ")", ";", "}", "}" ]
Filters the displayed resources.<p> Only resources where either the resource name, the title or the nav-text contains the given substring are shown.<p> @param search the search term
[ "Filters", "the", "displayed", "resources", ".", "<p", ">", "Only", "resources", "where", "either", "the", "resource", "name", "the", "title", "or", "the", "nav", "-", "text", "contains", "the", "given", "substring", "are", "shown", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsFileTable.java#L555-L568
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java
JDBC4CallableStatement.getBigDecimal
@Override @Deprecated public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { """ Deprecated. use getBigDecimal(int parameterIndex) or getBigDecimal(String parameterName) """ checkClosed(); throw SQLError.noSupport(); }
java
@Override @Deprecated public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "@", "Deprecated", "public", "BigDecimal", "getBigDecimal", "(", "int", "parameterIndex", ",", "int", "scale", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Deprecated. use getBigDecimal(int parameterIndex) or getBigDecimal(String parameterName)
[ "Deprecated", ".", "use", "getBigDecimal", "(", "int", "parameterIndex", ")", "or", "getBigDecimal", "(", "String", "parameterName", ")" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L70-L76
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java
JacksonDBCollection.ensureIndex
public void ensureIndex(DBObject keys, String name) throws MongoException { """ calls {@link DBCollection#ensureIndex(com.mongodb.DBObject, java.lang.String, boolean)} with unique=false @param keys fields to use for index @param name an identifier for the index @throws MongoException If an error occurred """ ensureIndex(keys, name, false); }
java
public void ensureIndex(DBObject keys, String name) throws MongoException { ensureIndex(keys, name, false); }
[ "public", "void", "ensureIndex", "(", "DBObject", "keys", ",", "String", "name", ")", "throws", "MongoException", "{", "ensureIndex", "(", "keys", ",", "name", ",", "false", ")", ";", "}" ]
calls {@link DBCollection#ensureIndex(com.mongodb.DBObject, java.lang.String, boolean)} with unique=false @param keys fields to use for index @param name an identifier for the index @throws MongoException If an error occurred
[ "calls", "{", "@link", "DBCollection#ensureIndex", "(", "com", ".", "mongodb", ".", "DBObject", "java", ".", "lang", ".", "String", "boolean", ")", "}", "with", "unique", "=", "false" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L710-L712
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/Record.java
Record.moveFieldToThin
public void moveFieldToThin(FieldInfo fieldInfo, BaseField field, Record record) { """ Move the data in this record to the thin version. @param fieldInfo The destination thin field. @param field The source field (or null to auto-find) @param record The source record (or null if field supplied) """ if ((field == null) || (!field.getFieldName().equals(fieldInfo.getFieldName()))) { field = null; if (record != null) field = record.getField(fieldInfo.getFieldName()); } if (field != null) { if (field.getDataClass() == fieldInfo.getDataClass()) fieldInfo.setData(field.getData()); else fieldInfo.setString(field.toString()); } }
java
public void moveFieldToThin(FieldInfo fieldInfo, BaseField field, Record record) { if ((field == null) || (!field.getFieldName().equals(fieldInfo.getFieldName()))) { field = null; if (record != null) field = record.getField(fieldInfo.getFieldName()); } if (field != null) { if (field.getDataClass() == fieldInfo.getDataClass()) fieldInfo.setData(field.getData()); else fieldInfo.setString(field.toString()); } }
[ "public", "void", "moveFieldToThin", "(", "FieldInfo", "fieldInfo", ",", "BaseField", "field", ",", "Record", "record", ")", "{", "if", "(", "(", "field", "==", "null", ")", "||", "(", "!", "field", ".", "getFieldName", "(", ")", ".", "equals", "(", "fieldInfo", ".", "getFieldName", "(", ")", ")", ")", ")", "{", "field", "=", "null", ";", "if", "(", "record", "!=", "null", ")", "field", "=", "record", ".", "getField", "(", "fieldInfo", ".", "getFieldName", "(", ")", ")", ";", "}", "if", "(", "field", "!=", "null", ")", "{", "if", "(", "field", ".", "getDataClass", "(", ")", "==", "fieldInfo", ".", "getDataClass", "(", ")", ")", "fieldInfo", ".", "setData", "(", "field", ".", "getData", "(", ")", ")", ";", "else", "fieldInfo", ".", "setString", "(", "field", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Move the data in this record to the thin version. @param fieldInfo The destination thin field. @param field The source field (or null to auto-find) @param record The source record (or null if field supplied)
[ "Move", "the", "data", "in", "this", "record", "to", "the", "thin", "version", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L3290-L3305
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/plugins/RxJavaPlugins.java
RxJavaPlugins.createIoScheduler
@NonNull @GwtIncompatible public static Scheduler createIoScheduler(@NonNull ThreadFactory threadFactory) { """ Create an instance of the default {@link Scheduler} used for {@link Schedulers#io()} except using {@code threadFactory} for thread creation. <p>History: 2.0.5 - experimental @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any system properties for configuring new thread creation. Cannot be null. @return the created Scheduler instance @since 2.1 """ return new IoScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null")); }
java
@NonNull @GwtIncompatible public static Scheduler createIoScheduler(@NonNull ThreadFactory threadFactory) { return new IoScheduler(ObjectHelper.requireNonNull(threadFactory, "threadFactory is null")); }
[ "@", "NonNull", "@", "GwtIncompatible", "public", "static", "Scheduler", "createIoScheduler", "(", "@", "NonNull", "ThreadFactory", "threadFactory", ")", "{", "return", "new", "IoScheduler", "(", "ObjectHelper", ".", "requireNonNull", "(", "threadFactory", ",", "\"threadFactory is null\"", ")", ")", ";", "}" ]
Create an instance of the default {@link Scheduler} used for {@link Schedulers#io()} except using {@code threadFactory} for thread creation. <p>History: 2.0.5 - experimental @param threadFactory thread factory to use for creating worker threads. Note that this takes precedence over any system properties for configuring new thread creation. Cannot be null. @return the created Scheduler instance @since 2.1
[ "Create", "an", "instance", "of", "the", "default", "{" ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/plugins/RxJavaPlugins.java#L1224-L1228
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java
WordVectorSerializer.writeParagraphVectors
public static void writeParagraphVectors(ParagraphVectors vectors, File file) { """ This method saves ParagraphVectors model into compressed zip file @param file """ try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream stream = new BufferedOutputStream(fos)) { writeParagraphVectors(vectors, stream); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static void writeParagraphVectors(ParagraphVectors vectors, File file) { try (FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream stream = new BufferedOutputStream(fos)) { writeParagraphVectors(vectors, stream); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "writeParagraphVectors", "(", "ParagraphVectors", "vectors", ",", "File", "file", ")", "{", "try", "(", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ";", "BufferedOutputStream", "stream", "=", "new", "BufferedOutputStream", "(", "fos", ")", ")", "{", "writeParagraphVectors", "(", "vectors", ",", "stream", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
This method saves ParagraphVectors model into compressed zip file @param file
[ "This", "method", "saves", "ParagraphVectors", "model", "into", "compressed", "zip", "file" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L406-L413