repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
xqbase/util
util/src/main/java/com/xqbase/util/Bytes.java
Bytes.toLong
public static long toLong(byte[] b, int off, boolean littleEndian) { if (littleEndian) { return (toInt(b, off, LITTLE_ENDIAN) & 0xFFFFFFFFL) | ((toInt(b, off + 4, LITTLE_ENDIAN) & 0xFFFFFFFFL) << 32); } return ((toInt(b, off, BIG_ENDIAN) & 0xFFFFFFFFL) << 32) | (toInt(b, off + 4, BIG_ENDIAN) & 0xFFFFFFFFL); }
java
public static long toLong(byte[] b, int off, boolean littleEndian) { if (littleEndian) { return (toInt(b, off, LITTLE_ENDIAN) & 0xFFFFFFFFL) | ((toInt(b, off + 4, LITTLE_ENDIAN) & 0xFFFFFFFFL) << 32); } return ((toInt(b, off, BIG_ENDIAN) & 0xFFFFFFFFL) << 32) | (toInt(b, off + 4, BIG_ENDIAN) & 0xFFFFFFFFL); }
[ "public", "static", "long", "toLong", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "boolean", "littleEndian", ")", "{", "if", "(", "littleEndian", ")", "{", "return", "(", "toInt", "(", "b", ",", "off", ",", "LITTLE_ENDIAN", ")", "&", "0xFFFFF...
Retrieve a <b>long</b> from a byte array in a given byte order
[ "Retrieve", "a", "<b", ">", "long<", "/", "b", ">", "from", "a", "byte", "array", "in", "a", "given", "byte", "order" ]
train
https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Bytes.java#L242-L249
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/buff/BaseBuffer.java
BaseBuffer.bufferToFields
public int bufferToFields(FieldList record, boolean bDisplayOption, int iMoveMode) { this.resetPosition(); // Start at the first field int iFieldCount = record.getFieldCount(); // Number of fields to read in int iErrorCode = Constants.NORMAL_RETURN; int iTempError; for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= iFieldCount + Constants.MAIN_FIELD - 1; iFieldSeq++) { FieldInfo field = record.getField(iFieldSeq); if (this.skipField(field)) iTempError = field.initField(bDisplayOption); else iTempError = this.getNextField(field, bDisplayOption, iMoveMode); if (iTempError != Constants.NORMAL_RETURN) iErrorCode = iTempError; } return iErrorCode; }
java
public int bufferToFields(FieldList record, boolean bDisplayOption, int iMoveMode) { this.resetPosition(); // Start at the first field int iFieldCount = record.getFieldCount(); // Number of fields to read in int iErrorCode = Constants.NORMAL_RETURN; int iTempError; for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= iFieldCount + Constants.MAIN_FIELD - 1; iFieldSeq++) { FieldInfo field = record.getField(iFieldSeq); if (this.skipField(field)) iTempError = field.initField(bDisplayOption); else iTempError = this.getNextField(field, bDisplayOption, iMoveMode); if (iTempError != Constants.NORMAL_RETURN) iErrorCode = iTempError; } return iErrorCode; }
[ "public", "int", "bufferToFields", "(", "FieldList", "record", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "this", ".", "resetPosition", "(", ")", ";", "// Start at the first field", "int", "iFieldCount", "=", "record", ".", "getFieldCount...
Move the output buffer to all the fields. This is a utility method that populates the record. @param record The target record. @param bDisplayOption The display option for the movetofield call. @param iMoveMove The move mode for the movetofield call. @return The error code.
[ "Move", "the", "output", "buffer", "to", "all", "the", "fields", ".", "This", "is", "a", "utility", "method", "that", "populates", "the", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/buff/BaseBuffer.java#L171-L188
alibaba/jstorm
jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/common/security/AutoHDFS.java
AutoHDFS.getCredentials
@SuppressWarnings("unchecked") protected Credentials getCredentials(Map<String, String> credentials) { Credentials credential = null; if (credentials != null && credentials.containsKey(getCredentialKey())) { try { byte[] credBytes = DatatypeConverter.parseBase64Binary(credentials.get(getCredentialKey())); ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(credBytes)); credential = new Credentials(); credential.readFields(in); } catch (Exception e) { LOG.error("Could not obtain credentials from credentials map.", e); } } return credential; }
java
@SuppressWarnings("unchecked") protected Credentials getCredentials(Map<String, String> credentials) { Credentials credential = null; if (credentials != null && credentials.containsKey(getCredentialKey())) { try { byte[] credBytes = DatatypeConverter.parseBase64Binary(credentials.get(getCredentialKey())); ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(credBytes)); credential = new Credentials(); credential.readFields(in); } catch (Exception e) { LOG.error("Could not obtain credentials from credentials map.", e); } } return credential; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "Credentials", "getCredentials", "(", "Map", "<", "String", ",", "String", ">", "credentials", ")", "{", "Credentials", "credential", "=", "null", ";", "if", "(", "credentials", "!=", "null", "&&...
/* @param credentials map with creds. @return instance of org.apache.hadoop.security.Credentials. this class's populateCredentials must have been called before.
[ "/", "*" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/common/security/AutoHDFS.java#L94-L109
openengsb/openengsb
components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java
AbstractEDBService.performCommitLogic
protected Long performCommitLogic(EDBCommit commit) throws EDBException { if (!(commit instanceof JPACommit)) { throw new EDBException("The given commit type is not supported."); } if (commit.isCommitted()) { throw new EDBException("EDBCommit is already commitet."); } if (revisionCheckEnabled && commit.getParentRevisionNumber() != null && !commit.getParentRevisionNumber().equals(getCurrentRevisionNumber())) { throw new EDBException("EDBCommit do not have the correct head revision number."); } runBeginCommitHooks(commit); EDBException exception = runPreCommitHooks(commit); if (exception != null) { return runErrorHooks(commit, exception); } Long timestamp = performCommit((JPACommit) commit); runEDBPostHooks(commit); return timestamp; }
java
protected Long performCommitLogic(EDBCommit commit) throws EDBException { if (!(commit instanceof JPACommit)) { throw new EDBException("The given commit type is not supported."); } if (commit.isCommitted()) { throw new EDBException("EDBCommit is already commitet."); } if (revisionCheckEnabled && commit.getParentRevisionNumber() != null && !commit.getParentRevisionNumber().equals(getCurrentRevisionNumber())) { throw new EDBException("EDBCommit do not have the correct head revision number."); } runBeginCommitHooks(commit); EDBException exception = runPreCommitHooks(commit); if (exception != null) { return runErrorHooks(commit, exception); } Long timestamp = performCommit((JPACommit) commit); runEDBPostHooks(commit); return timestamp; }
[ "protected", "Long", "performCommitLogic", "(", "EDBCommit", "commit", ")", "throws", "EDBException", "{", "if", "(", "!", "(", "commit", "instanceof", "JPACommit", ")", ")", "{", "throw", "new", "EDBException", "(", "\"The given commit type is not supported.\"", ")...
Performs the actual commit logic for the EDB, including the hooks and the revision checking.
[ "Performs", "the", "actual", "commit", "logic", "for", "the", "EDB", "including", "the", "hooks", "and", "the", "revision", "checking", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java#L64-L84
FrodeRanders/java-vopn
src/main/java/org/gautelis/vopn/io/FileIO.java
FileIO.writeToTempFile
public static File writeToTempFile(ByteBuffer byteBuffer, String prefix, String suffix) throws IOException { File tmpOutputFile = null; try (RandomAccessFile outputRaf = new RandomAccessFile(tmpOutputFile, "rw")) { // Create temporary file tmpOutputFile = File.createTempFile(prefix, "." + suffix); FileChannel outputChannel = outputRaf.getChannel(); outputChannel.write(byteBuffer); } catch (IOException ioe) { String info = "Failed to write to temporary file: " + ioe.getMessage(); throw new IOException(info, ioe); } return tmpOutputFile; }
java
public static File writeToTempFile(ByteBuffer byteBuffer, String prefix, String suffix) throws IOException { File tmpOutputFile = null; try (RandomAccessFile outputRaf = new RandomAccessFile(tmpOutputFile, "rw")) { // Create temporary file tmpOutputFile = File.createTempFile(prefix, "." + suffix); FileChannel outputChannel = outputRaf.getChannel(); outputChannel.write(byteBuffer); } catch (IOException ioe) { String info = "Failed to write to temporary file: " + ioe.getMessage(); throw new IOException(info, ioe); } return tmpOutputFile; }
[ "public", "static", "File", "writeToTempFile", "(", "ByteBuffer", "byteBuffer", ",", "String", "prefix", ",", "String", "suffix", ")", "throws", "IOException", "{", "File", "tmpOutputFile", "=", "null", ";", "try", "(", "RandomAccessFile", "outputRaf", "=", "new...
Writes a ByteBuffer (internally a series of byte[]) to a temporary file
[ "Writes", "a", "ByteBuffer", "(", "internally", "a", "series", "of", "byte", "[]", ")", "to", "a", "temporary", "file" ]
train
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/io/FileIO.java#L121-L136
Impetus/Kundera
src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBDataHandler.java
KuduDBDataHandler.hasColumn
public static boolean hasColumn(Schema schema, String columnName) { try { schema.getColumn(columnName); return true; } catch (IllegalArgumentException e) { return false; } }
java
public static boolean hasColumn(Schema schema, String columnName) { try { schema.getColumn(columnName); return true; } catch (IllegalArgumentException e) { return false; } }
[ "public", "static", "boolean", "hasColumn", "(", "Schema", "schema", ",", "String", "columnName", ")", "{", "try", "{", "schema", ".", "getColumn", "(", "columnName", ")", ";", "return", "true", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", ...
Checks for column. @param schema the schema @param columnName the column name @return true, if successful
[ "Checks", "for", "column", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBDataHandler.java#L268-L279
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/cluster/api/AsyncRestBuilder.java
AsyncRestBuilder.withHeader
public AsyncRestBuilder withHeader(String key, Object value) { this.headers.put(key, value); return this; }
java
public AsyncRestBuilder withHeader(String key, Object value) { this.headers.put(key, value); return this; }
[ "public", "AsyncRestBuilder", "withHeader", "(", "String", "key", ",", "Object", "value", ")", "{", "this", ".", "headers", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds an HTTP header to the request. Using a key twice will result in the last value being used for a given header. @param key the header name (see "HttpHeaders.Names" for standard names). @param value the header value (see "HttpHeaders.Values" for standard values).
[ "Adds", "an", "HTTP", "header", "to", "the", "request", ".", "Using", "a", "key", "twice", "will", "result", "in", "the", "last", "value", "being", "used", "for", "a", "given", "header", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/cluster/api/AsyncRestBuilder.java#L103-L106
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CollectScoresIterationListener.java
CollectScoresIterationListener.exportScores
public void exportScores(File file, String delimiter) throws IOException { try (FileOutputStream fos = new FileOutputStream(file)) { exportScores(fos, delimiter); } }
java
public void exportScores(File file, String delimiter) throws IOException { try (FileOutputStream fos = new FileOutputStream(file)) { exportScores(fos, delimiter); } }
[ "public", "void", "exportScores", "(", "File", "file", ",", "String", "delimiter", ")", "throws", "IOException", "{", "try", "(", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ")", "{", "exportScores", "(", "fos", ",", "delimit...
Export the scores to the specified file in delimited (one per line) UTF-8 format, using the specified delimiter @param file File to write to @param delimiter Delimiter to use for writing scores
[ "Export", "the", "scores", "to", "the", "specified", "file", "in", "delimited", "(", "one", "per", "line", ")", "UTF", "-", "8", "format", "using", "the", "specified", "delimiter" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CollectScoresIterationListener.java#L108-L112
infinispan/infinispan
server/memcached/src/main/java/org/infinispan/server/memcached/TextProtocolUtil.java
TextProtocolUtil.readElement
static boolean readElement(ByteBuf buffer, OutputStream byteBuffer) throws IOException { for (; ; ) { byte next = buffer.readByte(); if (next == SP) { // Space return false; } else if (next == CR) { // CR next = buffer.readByte(); if (next == LF) { // LF return true; } else { byteBuffer.write(next); } } else { byteBuffer.write(next); } } }
java
static boolean readElement(ByteBuf buffer, OutputStream byteBuffer) throws IOException { for (; ; ) { byte next = buffer.readByte(); if (next == SP) { // Space return false; } else if (next == CR) { // CR next = buffer.readByte(); if (next == LF) { // LF return true; } else { byteBuffer.write(next); } } else { byteBuffer.write(next); } } }
[ "static", "boolean", "readElement", "(", "ByteBuf", "buffer", ",", "OutputStream", "byteBuffer", ")", "throws", "IOException", "{", "for", "(", ";", ";", ")", "{", "byte", "next", "=", "buffer", ".", "readByte", "(", ")", ";", "if", "(", "next", "==", ...
In the particular case of Memcached, the end of operation/command is signaled by "\r\n" characters. So, if end of operation is found, this method would return true. On the contrary, if space was found instead of end of operation character, then it'd return the element and false.
[ "In", "the", "particular", "case", "of", "Memcached", "the", "end", "of", "operation", "/", "command", "is", "signaled", "by", "\\", "r", "\\", "n", "characters", ".", "So", "if", "end", "of", "operation", "is", "found", "this", "method", "would", "retur...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/memcached/src/main/java/org/infinispan/server/memcached/TextProtocolUtil.java#L60-L76
alkacon/opencms-core
src/org/opencms/file/wrapper/CmsResourceWrapperUtils.java
CmsResourceWrapperUtils.addFileExtension
public static String addFileExtension(CmsObject cms, String resourcename, String extension) { if (!extension.startsWith(".")) { extension = "." + extension; } if (!resourcename.endsWith(extension)) { String name = resourcename + extension; int count = 0; while (cms.existsResource(name)) { count++; name = resourcename + "." + count + extension; } return name; } return resourcename; }
java
public static String addFileExtension(CmsObject cms, String resourcename, String extension) { if (!extension.startsWith(".")) { extension = "." + extension; } if (!resourcename.endsWith(extension)) { String name = resourcename + extension; int count = 0; while (cms.existsResource(name)) { count++; name = resourcename + "." + count + extension; } return name; } return resourcename; }
[ "public", "static", "String", "addFileExtension", "(", "CmsObject", "cms", ",", "String", "resourcename", ",", "String", "extension", ")", "{", "if", "(", "!", "extension", ".", "startsWith", "(", "\".\"", ")", ")", "{", "extension", "=", "\".\"", "+", "ex...
Adds a file extension to the resource name.<p> If the file with the new extension already exists, an index count will be added before the final extension.<p> For example: <code>index.html.1.jsp</code>.<p> @see #removeFileExtension(CmsObject, String, String) @param cms the actual CmsObject @param resourcename the name of the resource where to add the file extension @param extension the extension to add @return the resource name with the added file extension
[ "Adds", "a", "file", "extension", "to", "the", "resource", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/wrapper/CmsResourceWrapperUtils.java#L108-L126
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/domainquery/internal/RecordedQueryPlayer.java
RecordedQueryPlayer.replayGenericQuery
public GDomainQuery replayGenericQuery(RecordedQuery recordedQuery, IGenericDomainAccess domainAccess) { Boolean br_old = null; GDomainQuery query; try { if (!Settings.TEST_MODE) { br_old = QueryRecorder.blockRecording.get(); if (this.createNew) QueryRecorder.blockRecording.set(Boolean.FALSE); else QueryRecorder.blockRecording.set(Boolean.TRUE); } this.generic = true; this.replayedQueryContext = new ReplayedQueryContext(recordedQuery); query = ((IIntDomainAccess)domainAccess).getInternalDomainAccess().createRecordedGenQuery(this.replayedQueryContext, this.createNew); // do record this.id2ObjectMap.put(QueryRecorder.QUERY_ID, query); for (Statement stmt : recordedQuery.getStatements()) { replayStatement(stmt); } } finally { if (!Settings.TEST_MODE) QueryRecorder.blockRecording.set(br_old); } return query; }
java
public GDomainQuery replayGenericQuery(RecordedQuery recordedQuery, IGenericDomainAccess domainAccess) { Boolean br_old = null; GDomainQuery query; try { if (!Settings.TEST_MODE) { br_old = QueryRecorder.blockRecording.get(); if (this.createNew) QueryRecorder.blockRecording.set(Boolean.FALSE); else QueryRecorder.blockRecording.set(Boolean.TRUE); } this.generic = true; this.replayedQueryContext = new ReplayedQueryContext(recordedQuery); query = ((IIntDomainAccess)domainAccess).getInternalDomainAccess().createRecordedGenQuery(this.replayedQueryContext, this.createNew); // do record this.id2ObjectMap.put(QueryRecorder.QUERY_ID, query); for (Statement stmt : recordedQuery.getStatements()) { replayStatement(stmt); } } finally { if (!Settings.TEST_MODE) QueryRecorder.blockRecording.set(br_old); } return query; }
[ "public", "GDomainQuery", "replayGenericQuery", "(", "RecordedQuery", "recordedQuery", ",", "IGenericDomainAccess", "domainAccess", ")", "{", "Boolean", "br_old", "=", "null", ";", "GDomainQuery", "query", ";", "try", "{", "if", "(", "!", "Settings", ".", "TEST_MO...
Create a generic domain query from a recorded query. @param recordedQuery @param domainAccess @return
[ "Create", "a", "generic", "domain", "query", "from", "a", "recorded", "query", "." ]
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/domainquery/internal/RecordedQueryPlayer.java#L107-L133
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/inf/BruteForceInferencer.java
BruteForceInferencer.getProductOfAllFactors
private static VarTensor getProductOfAllFactors(FactorGraph fg, Algebra s) { VarTensor joint = new VarTensor(s, new VarSet(), s.one()); for (int a=0; a<fg.getNumFactors(); a++) { Factor f = fg.getFactor(a); VarTensor factor = safeNewVarTensor(s, f); assert !factor.containsBadValues() : factor; joint.prod(factor); } return joint; }
java
private static VarTensor getProductOfAllFactors(FactorGraph fg, Algebra s) { VarTensor joint = new VarTensor(s, new VarSet(), s.one()); for (int a=0; a<fg.getNumFactors(); a++) { Factor f = fg.getFactor(a); VarTensor factor = safeNewVarTensor(s, f); assert !factor.containsBadValues() : factor; joint.prod(factor); } return joint; }
[ "private", "static", "VarTensor", "getProductOfAllFactors", "(", "FactorGraph", "fg", ",", "Algebra", "s", ")", "{", "VarTensor", "joint", "=", "new", "VarTensor", "(", "s", ",", "new", "VarSet", "(", ")", ",", "s", ".", "one", "(", ")", ")", ";", "for...
Gets the product of all the factors in the factor graph. If working in the log-domain, this will do factor addition. @return The product of all the factors.
[ "Gets", "the", "product", "of", "all", "the", "factors", "in", "the", "factor", "graph", ".", "If", "working", "in", "the", "log", "-", "domain", "this", "will", "do", "factor", "addition", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/inf/BruteForceInferencer.java#L53-L62
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPAbstractTimephasedWorkNormaliser.java
MPPAbstractTimephasedWorkNormaliser.getAssignmentWork
private Duration getAssignmentWork(ProjectCalendar calendar, TimephasedWork assignment) { Date assignmentStart = assignment.getStart(); Date splitStart = assignmentStart; Date splitFinishTime = calendar.getFinishTime(splitStart); Date splitFinish = DateHelper.setTime(splitStart, splitFinishTime); Duration calendarSplitWork = calendar.getWork(splitStart, splitFinish, TimeUnit.MINUTES); Duration assignmentWorkPerDay = assignment.getAmountPerDay(); Duration splitWork; double splitMinutes = assignmentWorkPerDay.getDuration(); splitMinutes *= calendarSplitWork.getDuration(); splitMinutes /= (8 * 60); // this appears to be a fixed value splitWork = Duration.getInstance(splitMinutes, TimeUnit.MINUTES); return splitWork; }
java
private Duration getAssignmentWork(ProjectCalendar calendar, TimephasedWork assignment) { Date assignmentStart = assignment.getStart(); Date splitStart = assignmentStart; Date splitFinishTime = calendar.getFinishTime(splitStart); Date splitFinish = DateHelper.setTime(splitStart, splitFinishTime); Duration calendarSplitWork = calendar.getWork(splitStart, splitFinish, TimeUnit.MINUTES); Duration assignmentWorkPerDay = assignment.getAmountPerDay(); Duration splitWork; double splitMinutes = assignmentWorkPerDay.getDuration(); splitMinutes *= calendarSplitWork.getDuration(); splitMinutes /= (8 * 60); // this appears to be a fixed value splitWork = Duration.getInstance(splitMinutes, TimeUnit.MINUTES); return splitWork; }
[ "private", "Duration", "getAssignmentWork", "(", "ProjectCalendar", "calendar", ",", "TimephasedWork", "assignment", ")", "{", "Date", "assignmentStart", "=", "assignment", ".", "getStart", "(", ")", ";", "Date", "splitStart", "=", "assignmentStart", ";", "Date", ...
Retrieves the pro-rata work carried out on a given day. @param calendar current calendar @param assignment current assignment. @return assignment work duration
[ "Retrieves", "the", "pro", "-", "rata", "work", "carried", "out", "on", "a", "given", "day", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPAbstractTimephasedWorkNormaliser.java#L260-L277
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java
AbstractReporter.copyStream
protected void copyStream(File outputDirectory, InputStream stream, String targetFileName) throws IOException { File resourceFile = new File(outputDirectory, targetFileName); BufferedReader reader = null; Writer writer = null; try { reader = new BufferedReader(new InputStreamReader(stream, ENCODING)); writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(resourceFile), ENCODING)); String line = reader.readLine(); while (line != null) { writer.write(line); writer.write('\n'); line = reader.readLine(); } writer.flush(); } finally { if (reader != null) { reader.close(); } if (writer != null) { writer.close(); } } }
java
protected void copyStream(File outputDirectory, InputStream stream, String targetFileName) throws IOException { File resourceFile = new File(outputDirectory, targetFileName); BufferedReader reader = null; Writer writer = null; try { reader = new BufferedReader(new InputStreamReader(stream, ENCODING)); writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(resourceFile), ENCODING)); String line = reader.readLine(); while (line != null) { writer.write(line); writer.write('\n'); line = reader.readLine(); } writer.flush(); } finally { if (reader != null) { reader.close(); } if (writer != null) { writer.close(); } } }
[ "protected", "void", "copyStream", "(", "File", "outputDirectory", ",", "InputStream", "stream", ",", "String", "targetFileName", ")", "throws", "IOException", "{", "File", "resourceFile", "=", "new", "File", "(", "outputDirectory", ",", "targetFileName", ")", ";"...
Helper method to copy the contents of a stream to a file. @param outputDirectory The directory in which the new file is created. @param stream The stream to copy. @param targetFileName The file to write the stream contents to. @throws IOException If the stream cannot be copied.
[ "Helper", "method", "to", "copy", "the", "contents", "of", "a", "stream", "to", "a", "file", "." ]
train
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/AbstractReporter.java#L168-L200
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/Type1Font.java
Type1Font.writeFont
void writeFont(PdfWriter writer, PdfIndirectReference ref, Object params[]) throws DocumentException, IOException { int firstChar = ((Integer)params[0]).intValue(); int lastChar = ((Integer)params[1]).intValue(); byte shortTag[] = (byte[])params[2]; boolean subsetp = ((Boolean)params[3]).booleanValue() && subset; if (!subsetp) { firstChar = 0; lastChar = shortTag.length - 1; for (int k = 0; k < shortTag.length; ++k) shortTag[k] = 1; } PdfIndirectReference ind_font = null; PdfObject pobj = null; PdfIndirectObject obj = null; pobj = getFullFontStream(); if (pobj != null){ obj = writer.addToBody(pobj); ind_font = obj.getIndirectReference(); } pobj = getFontDescriptor(ind_font); if (pobj != null){ obj = writer.addToBody(pobj); ind_font = obj.getIndirectReference(); } pobj = getFontBaseType(ind_font, firstChar, lastChar, shortTag); writer.addToBody(pobj, ref); }
java
void writeFont(PdfWriter writer, PdfIndirectReference ref, Object params[]) throws DocumentException, IOException { int firstChar = ((Integer)params[0]).intValue(); int lastChar = ((Integer)params[1]).intValue(); byte shortTag[] = (byte[])params[2]; boolean subsetp = ((Boolean)params[3]).booleanValue() && subset; if (!subsetp) { firstChar = 0; lastChar = shortTag.length - 1; for (int k = 0; k < shortTag.length; ++k) shortTag[k] = 1; } PdfIndirectReference ind_font = null; PdfObject pobj = null; PdfIndirectObject obj = null; pobj = getFullFontStream(); if (pobj != null){ obj = writer.addToBody(pobj); ind_font = obj.getIndirectReference(); } pobj = getFontDescriptor(ind_font); if (pobj != null){ obj = writer.addToBody(pobj); ind_font = obj.getIndirectReference(); } pobj = getFontBaseType(ind_font, firstChar, lastChar, shortTag); writer.addToBody(pobj, ref); }
[ "void", "writeFont", "(", "PdfWriter", "writer", ",", "PdfIndirectReference", "ref", ",", "Object", "params", "[", "]", ")", "throws", "DocumentException", ",", "IOException", "{", "int", "firstChar", "=", "(", "(", "Integer", ")", "params", "[", "0", "]", ...
Outputs to the writer the font dictionaries and streams. @param writer the writer for this document @param ref the font indirect reference @param params several parameters that depend on the font type @throws IOException on error @throws DocumentException error in generating the object
[ "Outputs", "to", "the", "writer", "the", "font", "dictionaries", "and", "streams", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/Type1Font.java#L653-L679
craftercms/commons
utilities/src/main/java/org/craftercms/commons/lang/RegexUtils.java
RegexUtils.matchesAny
public static boolean matchesAny(String str, List<String> regexes) { return matchesAny(str, regexes, true); }
java
public static boolean matchesAny(String str, List<String> regexes) { return matchesAny(str, regexes, true); }
[ "public", "static", "boolean", "matchesAny", "(", "String", "str", ",", "List", "<", "String", ">", "regexes", ")", "{", "return", "matchesAny", "(", "str", ",", "regexes", ",", "true", ")", ";", "}" ]
Returns true if the string matches (full match) any of the specified regexes. @param str the string to match @param regexes the regexes used for matching @return true if the string matches (full match) one or more of the regexes
[ "Returns", "true", "if", "the", "string", "matches", "(", "full", "match", ")", "any", "of", "the", "specified", "regexes", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/lang/RegexUtils.java#L61-L63
akquinet/needle
src/main/java/de/akquinet/jbosscc/needle/junit/NeedleRule.java
NeedleRule.apply
@Override public Statement apply(final Statement base, final FrameworkMethod method, final Object target) { Statement appliedStatement = base; for (MethodRule rule : methodRuleChain) { appliedStatement = rule.apply(appliedStatement, method, target); } return statement(appliedStatement, target); }
java
@Override public Statement apply(final Statement base, final FrameworkMethod method, final Object target) { Statement appliedStatement = base; for (MethodRule rule : methodRuleChain) { appliedStatement = rule.apply(appliedStatement, method, target); } return statement(appliedStatement, target); }
[ "@", "Override", "public", "Statement", "apply", "(", "final", "Statement", "base", ",", "final", "FrameworkMethod", "method", ",", "final", "Object", "target", ")", "{", "Statement", "appliedStatement", "=", "base", ";", "for", "(", "MethodRule", "rule", ":",...
{@inheritDoc} Before evaluation of the base statement, the test instance will initialized.
[ "{" ]
train
https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/junit/NeedleRule.java#L64-L73
neo4j/neo4j-java-driver
driver/src/main/java/org/neo4j/driver/internal/util/CertificateTool.java
CertificateTool.loadX509Cert
public static void loadX509Cert( File certFile, KeyStore keyStore ) throws GeneralSecurityException, IOException { try ( BufferedInputStream inputStream = new BufferedInputStream( new FileInputStream( certFile ) ) ) { CertificateFactory certFactory = CertificateFactory.getInstance( "X.509" ); int certCount = 0; // The file might contain multiple certs while ( inputStream.available() > 0 ) { try { Certificate cert = certFactory.generateCertificate( inputStream ); certCount++; loadX509Cert( cert, "neo4j.javadriver.trustedcert." + certCount, keyStore ); } catch ( CertificateException e ) { if ( e.getCause() != null && e.getCause().getMessage().equals( "Empty input" ) ) { // This happens if there is whitespace at the end of the certificate - we load one cert, and then try and load a // second cert, at which point we fail return; } throw new IOException( "Failed to load certificate from `" + certFile.getAbsolutePath() + "`: " + certCount + " : " + e.getMessage(), e ); } } } }
java
public static void loadX509Cert( File certFile, KeyStore keyStore ) throws GeneralSecurityException, IOException { try ( BufferedInputStream inputStream = new BufferedInputStream( new FileInputStream( certFile ) ) ) { CertificateFactory certFactory = CertificateFactory.getInstance( "X.509" ); int certCount = 0; // The file might contain multiple certs while ( inputStream.available() > 0 ) { try { Certificate cert = certFactory.generateCertificate( inputStream ); certCount++; loadX509Cert( cert, "neo4j.javadriver.trustedcert." + certCount, keyStore ); } catch ( CertificateException e ) { if ( e.getCause() != null && e.getCause().getMessage().equals( "Empty input" ) ) { // This happens if there is whitespace at the end of the certificate - we load one cert, and then try and load a // second cert, at which point we fail return; } throw new IOException( "Failed to load certificate from `" + certFile.getAbsolutePath() + "`: " + certCount + " : " + e.getMessage(), e ); } } } }
[ "public", "static", "void", "loadX509Cert", "(", "File", "certFile", ",", "KeyStore", "keyStore", ")", "throws", "GeneralSecurityException", ",", "IOException", "{", "try", "(", "BufferedInputStream", "inputStream", "=", "new", "BufferedInputStream", "(", "new", "Fi...
Load the certificates written in X.509 format in a file to a key store. @param certFile @param keyStore @throws GeneralSecurityException @throws IOException
[ "Load", "the", "certificates", "written", "in", "X", ".", "509", "format", "in", "a", "file", "to", "a", "key", "store", "." ]
train
https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/util/CertificateTool.java#L113-L140
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/TransactWriteItemsResult.java
TransactWriteItemsResult.withItemCollectionMetrics
public TransactWriteItemsResult withItemCollectionMetrics(java.util.Map<String, java.util.List<ItemCollectionMetrics>> itemCollectionMetrics) { setItemCollectionMetrics(itemCollectionMetrics); return this; }
java
public TransactWriteItemsResult withItemCollectionMetrics(java.util.Map<String, java.util.List<ItemCollectionMetrics>> itemCollectionMetrics) { setItemCollectionMetrics(itemCollectionMetrics); return this; }
[ "public", "TransactWriteItemsResult", "withItemCollectionMetrics", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "ItemCollectionMetrics", ">", ">", "itemCollectionMetrics", ")", "{", "setItemCollectionMetrics", "(",...
<p> A list of tables that were processed by <code>TransactWriteItems</code> and, for each table, information about any item collections that were affected by individual <code>UpdateItem</code>, <code>PutItem</code> or <code>DeleteItem</code> operations. </p> @param itemCollectionMetrics A list of tables that were processed by <code>TransactWriteItems</code> and, for each table, information about any item collections that were affected by individual <code>UpdateItem</code>, <code>PutItem</code> or <code>DeleteItem</code> operations. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "list", "of", "tables", "that", "were", "processed", "by", "<code", ">", "TransactWriteItems<", "/", "code", ">", "and", "for", "each", "table", "information", "about", "any", "item", "collections", "that", "were", "affected", "by", "individu...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/TransactWriteItemsResult.java#L167-L170
spring-projects/spring-android
spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java
UriUtils.encodeQuery
public static String encodeQuery(String query, String encoding) throws UnsupportedEncodingException { return HierarchicalUriComponents.encodeUriComponent(query, encoding, HierarchicalUriComponents.Type.QUERY); }
java
public static String encodeQuery(String query, String encoding) throws UnsupportedEncodingException { return HierarchicalUriComponents.encodeUriComponent(query, encoding, HierarchicalUriComponents.Type.QUERY); }
[ "public", "static", "String", "encodeQuery", "(", "String", "query", ",", "String", "encoding", ")", "throws", "UnsupportedEncodingException", "{", "return", "HierarchicalUriComponents", ".", "encodeUriComponent", "(", "query", ",", "encoding", ",", "HierarchicalUriComp...
Encodes the given URI query with the given encoding. @param query the query to be encoded @param encoding the character encoding to encode to @return the encoded query @throws UnsupportedEncodingException when the given encoding parameter is not supported
[ "Encodes", "the", "given", "URI", "query", "with", "the", "given", "encoding", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L296-L298
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.fixReturnTypeRecommended
@Fix(io.sarl.lang.validation.IssueCodes.RETURN_TYPE_SPECIFICATION_IS_RECOMMENDED) public void fixReturnTypeRecommended(final Issue issue, IssueResolutionAcceptor acceptor) { ReturnTypeAddModification.accept(this, issue, acceptor); }
java
@Fix(io.sarl.lang.validation.IssueCodes.RETURN_TYPE_SPECIFICATION_IS_RECOMMENDED) public void fixReturnTypeRecommended(final Issue issue, IssueResolutionAcceptor acceptor) { ReturnTypeAddModification.accept(this, issue, acceptor); }
[ "@", "Fix", "(", "io", ".", "sarl", ".", "lang", ".", "validation", ".", "IssueCodes", ".", "RETURN_TYPE_SPECIFICATION_IS_RECOMMENDED", ")", "public", "void", "fixReturnTypeRecommended", "(", "final", "Issue", "issue", ",", "IssueResolutionAcceptor", "acceptor", ")"...
Quick fix for "Return type is recommended". @param issue the issue. @param acceptor the quick fix acceptor.
[ "Quick", "fix", "for", "Return", "type", "is", "recommended", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L876-L879
trellis-ldp/trellis
components/file/src/main/java/org/trellisldp/file/FileUtils.java
FileUtils.getResourceDirectory
public static File getResourceDirectory(final File baseDirectory, final IRI identifier) { requireNonNull(baseDirectory, "The baseDirectory may not be null!"); requireNonNull(identifier, "The identifier may not be null!"); final String id = identifier.getIRIString(); final StringJoiner joiner = new StringJoiner(separator); final CRC32 hasher = new CRC32(); hasher.update(id.getBytes(UTF_8)); final String intermediate = Long.toHexString(hasher.getValue()); range(0, intermediate.length() / LENGTH).limit(MAX) .forEach(i -> joiner.add(intermediate.substring(i * LENGTH, (i + 1) * LENGTH))); joiner.add(md5Hex(id)); return new File(baseDirectory, joiner.toString()); }
java
public static File getResourceDirectory(final File baseDirectory, final IRI identifier) { requireNonNull(baseDirectory, "The baseDirectory may not be null!"); requireNonNull(identifier, "The identifier may not be null!"); final String id = identifier.getIRIString(); final StringJoiner joiner = new StringJoiner(separator); final CRC32 hasher = new CRC32(); hasher.update(id.getBytes(UTF_8)); final String intermediate = Long.toHexString(hasher.getValue()); range(0, intermediate.length() / LENGTH).limit(MAX) .forEach(i -> joiner.add(intermediate.substring(i * LENGTH, (i + 1) * LENGTH))); joiner.add(md5Hex(id)); return new File(baseDirectory, joiner.toString()); }
[ "public", "static", "File", "getResourceDirectory", "(", "final", "File", "baseDirectory", ",", "final", "IRI", "identifier", ")", "{", "requireNonNull", "(", "baseDirectory", ",", "\"The baseDirectory may not be null!\"", ")", ";", "requireNonNull", "(", "identifier", ...
Get a directory for a given resource identifier. @param baseDirectory the base directory @param identifier a resource identifier @return a directory
[ "Get", "a", "directory", "for", "a", "given", "resource", "identifier", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/components/file/src/main/java/org/trellisldp/file/FileUtils.java#L86-L100
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Operation.java
Operation.operate
public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return null; // no-op }
java
public XObject operate(XObject left, XObject right) throws javax.xml.transform.TransformerException { return null; // no-op }
[ "public", "XObject", "operate", "(", "XObject", "left", ",", "XObject", "right", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "return", "null", ";", "// no-op", "}" ]
Apply the operation to two operands, and return the result. @param left non-null reference to the evaluated left operand. @param right non-null reference to the evaluated right operand. @return non-null reference to the XObject that represents the result of the operation. @throws javax.xml.transform.TransformerException
[ "Apply", "the", "operation", "to", "two", "operands", "and", "return", "the", "result", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Operation.java#L129-L133
aws/aws-sdk-java
aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GetExportRequest.java
GetExportRequest.withParameters
public GetExportRequest withParameters(java.util.Map<String, String> parameters) { setParameters(parameters); return this; }
java
public GetExportRequest withParameters(java.util.Map<String, String> parameters) { setParameters(parameters); return this; }
[ "public", "GetExportRequest", "withParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "setParameters", "(", "parameters", ")", ";", "return", "this", ";", "}" ]
<p> A key-value map of query string parameters that specify properties of the export, depending on the requested <code>exportType</code>. For <code>exportType</code> <code>oas30</code> and <code>swagger</code>, any combination of the following parameters are supported: <code>extensions='integrations'</code> or <code>extensions='apigateway'</code> will export the API with x-amazon-apigateway-integration extensions. <code>extensions='authorizers'</code> will export the API with x-amazon-apigateway-authorizer extensions. <code>postman</code> will export the API with Postman extensions, allowing for import to the Postman tool </p> @param parameters A key-value map of query string parameters that specify properties of the export, depending on the requested <code>exportType</code>. For <code>exportType</code> <code>oas30</code> and <code>swagger</code> , any combination of the following parameters are supported: <code>extensions='integrations'</code> or <code>extensions='apigateway'</code> will export the API with x-amazon-apigateway-integration extensions. <code>extensions='authorizers'</code> will export the API with x-amazon-apigateway-authorizer extensions. <code>postman</code> will export the API with Postman extensions, allowing for import to the Postman tool @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "key", "-", "value", "map", "of", "query", "string", "parameters", "that", "specify", "properties", "of", "the", "export", "depending", "on", "the", "requested", "<code", ">", "exportType<", "/", "code", ">", ".", "For", "<code", ">", "ex...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GetExportRequest.java#L260-L263
OpenLiberty/open-liberty
dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadContextAccessor.java
ThreadContextAccessor.repushContextClassLoaderForUnprivileged
public Object repushContextClassLoaderForUnprivileged(Object origLoader, ClassLoader loader) { if (origLoader == UNCHANGED) { return pushContextClassLoaderForUnprivileged(loader); } setContextClassLoaderForUnprivileged(Thread.currentThread(), loader); return origLoader; }
java
public Object repushContextClassLoaderForUnprivileged(Object origLoader, ClassLoader loader) { if (origLoader == UNCHANGED) { return pushContextClassLoaderForUnprivileged(loader); } setContextClassLoaderForUnprivileged(Thread.currentThread(), loader); return origLoader; }
[ "public", "Object", "repushContextClassLoaderForUnprivileged", "(", "Object", "origLoader", ",", "ClassLoader", "loader", ")", "{", "if", "(", "origLoader", "==", "UNCHANGED", ")", "{", "return", "pushContextClassLoaderForUnprivileged", "(", "loader", ")", ";", "}", ...
Updates the context class loader of the current thread between calls to {@link #pushContextClassLoader} and {@link #popContextClassLoader}. If the original class loader is {@link #UNCHANGED}, then this is equivalent to {@link #pushContextClassLoader}). Otherwise, this is equivalent to {@link #setContextClassLoader}, and the passed class loader is returned. The suggested pattern of use is: <pre> Object origCL = ThreadContextAccessor.UNCHANGED; try { for (SomeContext ctx : contexts) { ClassLoader cl = ctx.getClassLoader(); origCL = svThreadContextAccessor.repushContextClassLoaderForUnprivileged(origCL, cl); ... } } finally { svThreadContextAccessor.popContextClassLoaderForUnprivileged(origCL); } </pre> @param origLoader the result of {@link #pushContextClassLoader} or {@link #repushContextClassLoader} @param loader the new context class loader @return the original context class loader, or {@link #UNCHANGED}
[ "Updates", "the", "context", "class", "loader", "of", "the", "current", "thread", "between", "calls", "to", "{", "@link", "#pushContextClassLoader", "}", "and", "{", "@link", "#popContextClassLoader", "}", ".", "If", "the", "original", "class", "loader", "is", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadContextAccessor.java#L211-L218
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/XMLFactory.java
XMLFactory.createDocumentBuilder
@Nonnull public static DocumentBuilder createDocumentBuilder (@Nonnull final DocumentBuilderFactory aDocBuilderFactory) { ValueEnforcer.notNull (aDocBuilderFactory, "DocBuilderFactory"); try { final DocumentBuilder aDocBuilder = aDocBuilderFactory.newDocumentBuilder (); aDocBuilder.setErrorHandler (DOMReaderDefaultSettings.getErrorHandler ()); return aDocBuilder; } catch (final ParserConfigurationException ex) { throw new InitializationException ("Failed to create document builder", ex); } }
java
@Nonnull public static DocumentBuilder createDocumentBuilder (@Nonnull final DocumentBuilderFactory aDocBuilderFactory) { ValueEnforcer.notNull (aDocBuilderFactory, "DocBuilderFactory"); try { final DocumentBuilder aDocBuilder = aDocBuilderFactory.newDocumentBuilder (); aDocBuilder.setErrorHandler (DOMReaderDefaultSettings.getErrorHandler ()); return aDocBuilder; } catch (final ParserConfigurationException ex) { throw new InitializationException ("Failed to create document builder", ex); } }
[ "@", "Nonnull", "public", "static", "DocumentBuilder", "createDocumentBuilder", "(", "@", "Nonnull", "final", "DocumentBuilderFactory", "aDocBuilderFactory", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aDocBuilderFactory", ",", "\"DocBuilderFactory\"", ")", ";", "t...
Create a document builder without a certain schema, using the passed {@link DocumentBuilderFactory}. @param aDocBuilderFactory The document builder factory to be used. May not be <code>null</code>. @return The created document builder. Never <code>null</code>. @throws InitializationException In case some DOM initialization goes wrong
[ "Create", "a", "document", "builder", "without", "a", "certain", "schema", "using", "the", "passed", "{", "@link", "DocumentBuilderFactory", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/XMLFactory.java#L234-L249
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java
CollUtil.forEach
public static <T> void forEach(Iterator<T> iterator, Consumer<T> consumer) { int index = 0; while (iterator.hasNext()) { consumer.accept(iterator.next(), index); index++; } }
java
public static <T> void forEach(Iterator<T> iterator, Consumer<T> consumer) { int index = 0; while (iterator.hasNext()) { consumer.accept(iterator.next(), index); index++; } }
[ "public", "static", "<", "T", ">", "void", "forEach", "(", "Iterator", "<", "T", ">", "iterator", ",", "Consumer", "<", "T", ">", "consumer", ")", "{", "int", "index", "=", "0", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "...
循环遍历 {@link Iterator},使用{@link Consumer} 接受遍历的每条数据,并针对每条数据做处理 @param <T> 集合元素类型 @param iterator {@link Iterator} @param consumer {@link Consumer} 遍历的每条数据处理器
[ "循环遍历", "{", "@link", "Iterator", "}", ",使用", "{", "@link", "Consumer", "}", "接受遍历的每条数据,并针对每条数据做处理" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L2239-L2245
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/PipelineApi.java
PipelineApi.takeOwnershipPipelineSchedule
public PipelineSchedule takeOwnershipPipelineSchedule(Object projectIdOrPath, Integer pipelineScheduleId) throws GitLabApiException { Response response = post(Response.Status.OK, "", "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules", pipelineScheduleId, "take_ownership"); return (response.readEntity(PipelineSchedule.class)); }
java
public PipelineSchedule takeOwnershipPipelineSchedule(Object projectIdOrPath, Integer pipelineScheduleId) throws GitLabApiException { Response response = post(Response.Status.OK, "", "projects", getProjectIdOrPath(projectIdOrPath), "pipeline_schedules", pipelineScheduleId, "take_ownership"); return (response.readEntity(PipelineSchedule.class)); }
[ "public", "PipelineSchedule", "takeOwnershipPipelineSchedule", "(", "Object", "projectIdOrPath", ",", "Integer", "pipelineScheduleId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "OK", ",", "\"\""...
Update the owner of the pipeline schedule of a project. <pre><code>POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/take_ownership</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param pipelineScheduleId the pipelineSchedule instance id that ownership has to be taken of @return the modified project schedule @throws GitLabApiException if any exception occurs
[ "Update", "the", "owner", "of", "the", "pipeline", "schedule", "of", "a", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/PipelineApi.java#L455-L459
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.getRoundingNames
public static Set<String> getRoundingNames(String... providers) { return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow( () -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available.")) .getRoundingNames(providers); }
java
public static Set<String> getRoundingNames(String... providers) { return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow( () -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available.")) .getRoundingNames(providers); }
[ "public", "static", "Set", "<", "String", ">", "getRoundingNames", "(", "String", "...", "providers", ")", "{", "return", "Optional", ".", "ofNullable", "(", "monetaryRoundingsSingletonSpi", "(", ")", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "Mon...
Allows to access the names of the current defined roundings. @param providers the providers and ordering to be used. By default providers and ordering as defined in #getDefaultProviders is used. @return the set of custom rounding ids, never {@code null}.
[ "Allows", "to", "access", "the", "names", "of", "the", "current", "defined", "roundings", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L262-L266
hpsa/hpe-application-automation-tools-plugin
src/main/java/com/hp/application/automation/tools/results/RunResultRecorder.java
RunResultRecorder.publishLrReports
private void publishLrReports(@Nonnull Run<?, ?> build) throws IOException { File reportDirectory = new File(build.getRootDir(), PERFORMANCE_REPORT_FOLDER); if (reportDirectory.exists()) { File htmlIndexFile = new File(reportDirectory, INDEX_HTML_NAME); if (htmlIndexFile.exists()) { build.replaceAction(new PerformanceReportAction(build)); } } File summaryDirectory = new File(build.getRootDir(), TRANSACTION_SUMMARY_FOLDER); if (summaryDirectory.exists()) { File htmlIndexFile = new File(summaryDirectory, INDEX_HTML_NAME); if (htmlIndexFile.exists()) { build.replaceAction(new TransactionSummaryAction(build)); } } }
java
private void publishLrReports(@Nonnull Run<?, ?> build) throws IOException { File reportDirectory = new File(build.getRootDir(), PERFORMANCE_REPORT_FOLDER); if (reportDirectory.exists()) { File htmlIndexFile = new File(reportDirectory, INDEX_HTML_NAME); if (htmlIndexFile.exists()) { build.replaceAction(new PerformanceReportAction(build)); } } File summaryDirectory = new File(build.getRootDir(), TRANSACTION_SUMMARY_FOLDER); if (summaryDirectory.exists()) { File htmlIndexFile = new File(summaryDirectory, INDEX_HTML_NAME); if (htmlIndexFile.exists()) { build.replaceAction(new TransactionSummaryAction(build)); } } }
[ "private", "void", "publishLrReports", "(", "@", "Nonnull", "Run", "<", "?", ",", "?", ">", "build", ")", "throws", "IOException", "{", "File", "reportDirectory", "=", "new", "File", "(", "build", ".", "getRootDir", "(", ")", ",", "PERFORMANCE_REPORT_FOLDER"...
Adds the html reports actions to the left side menu. @param build
[ "Adds", "the", "html", "reports", "actions", "to", "the", "left", "side", "menu", "." ]
train
https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/RunResultRecorder.java#L238-L254
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/LinearClassifierFactory.java
LinearClassifierFactory.trainSemiSupGE
public LinearClassifier<L,F> trainSemiSupGE(GeneralDataset<L, F> labeledDataset, List<? extends Datum<L, F>> unlabeledDataList, List<F> GEFeatures, double convexComboCoeff) { LogConditionalObjectiveFunction<L, F> objective = new LogConditionalObjectiveFunction<L, F>(labeledDataset, new LogPrior(LogPrior.LogPriorType.NULL)); GeneralizedExpectationObjectiveFunction<L,F> geObjective = new GeneralizedExpectationObjectiveFunction<L,F>(labeledDataset, unlabeledDataList, GEFeatures); SemiSupervisedLogConditionalObjectiveFunction semiSupObjective = new SemiSupervisedLogConditionalObjectiveFunction(objective, geObjective, null,convexComboCoeff); double[] initial = objective.initial(); double[] weights = minimizer.minimize(semiSupObjective, TOL, initial); return new LinearClassifier<L, F>(objective.to2D(weights), labeledDataset.featureIndex(), labeledDataset.labelIndex()); }
java
public LinearClassifier<L,F> trainSemiSupGE(GeneralDataset<L, F> labeledDataset, List<? extends Datum<L, F>> unlabeledDataList, List<F> GEFeatures, double convexComboCoeff) { LogConditionalObjectiveFunction<L, F> objective = new LogConditionalObjectiveFunction<L, F>(labeledDataset, new LogPrior(LogPrior.LogPriorType.NULL)); GeneralizedExpectationObjectiveFunction<L,F> geObjective = new GeneralizedExpectationObjectiveFunction<L,F>(labeledDataset, unlabeledDataList, GEFeatures); SemiSupervisedLogConditionalObjectiveFunction semiSupObjective = new SemiSupervisedLogConditionalObjectiveFunction(objective, geObjective, null,convexComboCoeff); double[] initial = objective.initial(); double[] weights = minimizer.minimize(semiSupObjective, TOL, initial); return new LinearClassifier<L, F>(objective.to2D(weights), labeledDataset.featureIndex(), labeledDataset.labelIndex()); }
[ "public", "LinearClassifier", "<", "L", ",", "F", ">", "trainSemiSupGE", "(", "GeneralDataset", "<", "L", ",", "F", ">", "labeledDataset", ",", "List", "<", "?", "extends", "Datum", "<", "L", ",", "F", ">", ">", "unlabeledDataList", ",", "List", "<", "...
Trains the linear classifier using Generalized Expectation criteria as described in <tt>Generalized Expectation Criteria for Semi Supervised Learning of Conditional Random Fields</tt>, Mann and McCallum, ACL 2008. The original algorithm is proposed for CRFs but has been adopted to LinearClassifier (which is a simpler special case of a CRF). IMPORTANT: the labeled features that are passed as an argument are assumed to be binary valued, although other features are allowed to be real valued.
[ "Trains", "the", "linear", "classifier", "using", "Generalized", "Expectation", "criteria", "as", "described", "in", "<tt", ">", "Generalized", "Expectation", "Criteria", "for", "Semi", "Supervised", "Learning", "of", "Conditional", "Random", "Fields<", "/", "tt", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifierFactory.java#L174-L181
sarxos/win-registry
src/main/java/com/github/sarxos/winreg/WindowsRegistry.java
WindowsRegistry.writeStringValue
public void writeStringValue(HKey hk, String key, String valueName, String value) throws RegistryException { try { ReflectedMethods.writeStringValue(hk.root(), hk.hex(), key, valueName, value); } catch (Exception e) { throw new RegistryException("Cannot write " + valueName + " value " + value + " in key " + key, e); } }
java
public void writeStringValue(HKey hk, String key, String valueName, String value) throws RegistryException { try { ReflectedMethods.writeStringValue(hk.root(), hk.hex(), key, valueName, value); } catch (Exception e) { throw new RegistryException("Cannot write " + valueName + " value " + value + " in key " + key, e); } }
[ "public", "void", "writeStringValue", "(", "HKey", "hk", ",", "String", "key", ",", "String", "valueName", ",", "String", "value", ")", "throws", "RegistryException", "{", "try", "{", "ReflectedMethods", ".", "writeStringValue", "(", "hk", ".", "root", "(", ...
Write a value in a given key/value name @param hk the HKEY to be used @param key the key to be written @param valueName the value name @param value the value @throws RegistryException when something is not right
[ "Write", "a", "value", "in", "a", "given", "key", "/", "value", "name" ]
train
https://github.com/sarxos/win-registry/blob/5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437/src/main/java/com/github/sarxos/winreg/WindowsRegistry.java#L156-L162
RKumsher/utils
src/main/java/com/github/rkumsher/collection/ArrayUtils.java
ArrayUtils.randomFrom
@SafeVarargs public static <T> T randomFrom(T[] array, T... excludes) { return randomFrom(array, Arrays.asList(excludes)); }
java
@SafeVarargs public static <T> T randomFrom(T[] array, T... excludes) { return randomFrom(array, Arrays.asList(excludes)); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "T", "randomFrom", "(", "T", "[", "]", "array", ",", "T", "...", "excludes", ")", "{", "return", "randomFrom", "(", "array", ",", "Arrays", ".", "asList", "(", "excludes", ")", ")", ";", "}" ]
Returns a random element from the given array that's not in the values to exclude. @param array array to return random element from @param excludes values to exclude @param <T> the type of elements in the given array @return random element from the given array that's not in the values to exclude @throws IllegalArgumentException if the array is empty
[ "Returns", "a", "random", "element", "from", "the", "given", "array", "that", "s", "not", "in", "the", "values", "to", "exclude", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/collection/ArrayUtils.java#L40-L43
Jasig/uPortal
uPortal-rendering/src/main/java/org/apereo/portal/portlet/rendering/PortletEventQueue.java
PortletEventQueue.offerEvent
public void offerEvent(IPortletWindowId portletWindowId, QueuedEvent event) { Queue<QueuedEvent> events = resolvedEventQueues.get(portletWindowId); if (events == null) { events = ConcurrentMapUtils.putIfAbsent( resolvedEventQueues, portletWindowId, new ConcurrentLinkedQueue<QueuedEvent>()); } events.offer(event); }
java
public void offerEvent(IPortletWindowId portletWindowId, QueuedEvent event) { Queue<QueuedEvent> events = resolvedEventQueues.get(portletWindowId); if (events == null) { events = ConcurrentMapUtils.putIfAbsent( resolvedEventQueues, portletWindowId, new ConcurrentLinkedQueue<QueuedEvent>()); } events.offer(event); }
[ "public", "void", "offerEvent", "(", "IPortletWindowId", "portletWindowId", ",", "QueuedEvent", "event", ")", "{", "Queue", "<", "QueuedEvent", ">", "events", "=", "resolvedEventQueues", ".", "get", "(", "portletWindowId", ")", ";", "if", "(", "events", "==", ...
Queue an {@link Event} for the specified {@link IPortletWindowId}
[ "Queue", "an", "{" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-rendering/src/main/java/org/apereo/portal/portlet/rendering/PortletEventQueue.java#L61-L72
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java
CommerceNotificationAttachmentPersistenceImpl.findAll
@Override public List<CommerceNotificationAttachment> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceNotificationAttachment> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceNotificationAttachment", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce notification attachments. @return the commerce notification attachments
[ "Returns", "all", "the", "commerce", "notification", "attachments", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java#L2713-L2716
virgo47/javasimon
console-embed/src/main/java/org/javasimon/console/action/DetailPlugin.java
DetailPlugin.executeHtml
public DetailHtmlBuilder executeHtml(ActionContext context, DetailHtmlBuilder htmlBuilder, StringifierFactory htmlStringifierFactory, Simon simon) throws IOException { return htmlBuilder; }
java
public DetailHtmlBuilder executeHtml(ActionContext context, DetailHtmlBuilder htmlBuilder, StringifierFactory htmlStringifierFactory, Simon simon) throws IOException { return htmlBuilder; }
[ "public", "DetailHtmlBuilder", "executeHtml", "(", "ActionContext", "context", ",", "DetailHtmlBuilder", "htmlBuilder", ",", "StringifierFactory", "htmlStringifierFactory", ",", "Simon", "simon", ")", "throws", "IOException", "{", "return", "htmlBuilder", ";", "}" ]
Callback for flat HTML rendering. @param context Context (Request, parameters...) @param htmlBuilder HTML Builder (Response generation helper) @param simon Simon to render.
[ "Callback", "for", "flat", "HTML", "rendering", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/action/DetailPlugin.java#L39-L41
CloudSlang/cs-actions
cs-powershell/src/main/java/io/cloudslang/content/utils/XMLUtils.java
XMLUtils.parseXml
public static String parseXml(String xml, String expression) throws ParserConfigurationException, IOException, XPathExpressionException, SAXException { DocumentBuilder builder = ResourceLoader.getDocumentBuilder(); Document document; try { document = builder.parse(new InputSource(new StringReader(xml))); } catch (SAXException e) { throw new RuntimeException(RESPONSE_IS_NOT_WELL_FORMED + xml, e); } XPath xPath = XPathFactory.newInstance().newXPath(); return xPath.compile(expression).evaluate(document); }
java
public static String parseXml(String xml, String expression) throws ParserConfigurationException, IOException, XPathExpressionException, SAXException { DocumentBuilder builder = ResourceLoader.getDocumentBuilder(); Document document; try { document = builder.parse(new InputSource(new StringReader(xml))); } catch (SAXException e) { throw new RuntimeException(RESPONSE_IS_NOT_WELL_FORMED + xml, e); } XPath xPath = XPathFactory.newInstance().newXPath(); return xPath.compile(expression).evaluate(document); }
[ "public", "static", "String", "parseXml", "(", "String", "xml", ",", "String", "expression", ")", "throws", "ParserConfigurationException", ",", "IOException", ",", "XPathExpressionException", ",", "SAXException", "{", "DocumentBuilder", "builder", "=", "ResourceLoader"...
Parse the content of the given xml input and evaluates the given XPath expression. @param xml The xml source. @param expression The XPath expression. @return Evaluate the XPath expression and return the result as a String. @throws ParserConfigurationException @throws IOException @throws XPathExpressionException @throws SAXException
[ "Parse", "the", "content", "of", "the", "given", "xml", "input", "and", "evaluates", "the", "given", "XPath", "expression", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-powershell/src/main/java/io/cloudslang/content/utils/XMLUtils.java#L53-L63
cdk/cdk
storage/io/src/main/java/org/openscience/cdk/io/cml/CMLReactionModule.java
CMLReactionModule.getMoleculeFromID
private IAtomContainer getMoleculeFromID(IAtomContainerSet molSet, String id) { for (IAtomContainer mol : molSet.atomContainers()) { if (mol.getID().equals(id)) return mol; } return null; }
java
private IAtomContainer getMoleculeFromID(IAtomContainerSet molSet, String id) { for (IAtomContainer mol : molSet.atomContainers()) { if (mol.getID().equals(id)) return mol; } return null; }
[ "private", "IAtomContainer", "getMoleculeFromID", "(", "IAtomContainerSet", "molSet", ",", "String", "id", ")", "{", "for", "(", "IAtomContainer", "mol", ":", "molSet", ".", "atomContainers", "(", ")", ")", "{", "if", "(", "mol", ".", "getID", "(", ")", "....
Get the IAtomContainer contained in a IAtomContainerSet object with a ID. @param molSet The IAtomContainerSet @param id The ID the look @return The IAtomContainer with the ID
[ "Get", "the", "IAtomContainer", "contained", "in", "a", "IAtomContainerSet", "object", "with", "a", "ID", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/io/src/main/java/org/openscience/cdk/io/cml/CMLReactionModule.java#L188-L193
samskivert/pythagoras
src/main/java/pythagoras/f/Quaternion.java
Quaternion.fromAngles
public Quaternion fromAngles (float x, float y, float z) { // TODO: it may be more convenient to define the angles in the opposite order (first z, // then y, then x) float hx = x * 0.5f, hy = y * 0.5f, hz = z * 0.5f; float sz = FloatMath.sin(hz), cz = FloatMath.cos(hz); float sy = FloatMath.sin(hy), cy = FloatMath.cos(hy); float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx); float szsy = sz*sy, czsy = cz*sy, szcy = sz*cy, czcy = cz*cy; return set( czcy*sx - szsy*cx, czsy*cx + szcy*sx, szcy*cx - czsy*sx, czcy*cx + szsy*sx); }
java
public Quaternion fromAngles (float x, float y, float z) { // TODO: it may be more convenient to define the angles in the opposite order (first z, // then y, then x) float hx = x * 0.5f, hy = y * 0.5f, hz = z * 0.5f; float sz = FloatMath.sin(hz), cz = FloatMath.cos(hz); float sy = FloatMath.sin(hy), cy = FloatMath.cos(hy); float sx = FloatMath.sin(hx), cx = FloatMath.cos(hx); float szsy = sz*sy, czsy = cz*sy, szcy = sz*cy, czcy = cz*cy; return set( czcy*sx - szsy*cx, czsy*cx + szcy*sx, szcy*cx - czsy*sx, czcy*cx + szsy*sx); }
[ "public", "Quaternion", "fromAngles", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "// TODO: it may be more convenient to define the angles in the opposite order (first z,", "// then y, then x)", "float", "hx", "=", "x", "*", "0.5f", ",", "hy", "...
Sets this quaternion to one that first rotates about x by the specified number of radians, then rotates about y, then about z.
[ "Sets", "this", "quaternion", "to", "one", "that", "first", "rotates", "about", "x", "by", "the", "specified", "number", "of", "radians", "then", "rotates", "about", "y", "then", "about", "z", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L214-L227
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setEnterpriseText
public void setEnterpriseText(int index, String value) { set(selectField(ResourceFieldLists.ENTERPRISE_TEXT, index), value); }
java
public void setEnterpriseText(int index, String value) { set(selectField(ResourceFieldLists.ENTERPRISE_TEXT, index), value); }
[ "public", "void", "setEnterpriseText", "(", "int", "index", ",", "String", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "ENTERPRISE_TEXT", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise field value. @param index field index @param value field value
[ "Set", "an", "enterprise", "field", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L2161-L2164
scalecube/socketio
src/main/java/io/scalecube/socketio/pipeline/ResourceHandler.java
ResourceHandler.sendError
private void sendError(ChannelHandlerContext ctx, HttpResponseStatus status) { HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status); response.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/plain; charset=UTF-8"); ByteBuf content = Unpooled.copiedBuffer("Failure: " + status.toString() + "\r\n", CharsetUtil.UTF_8); ctx.write(response); // Close the connection as soon as the error message is sent. ctx.writeAndFlush(content).addListener(ChannelFutureListener.CLOSE); }
java
private void sendError(ChannelHandlerContext ctx, HttpResponseStatus status) { HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status); response.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/plain; charset=UTF-8"); ByteBuf content = Unpooled.copiedBuffer("Failure: " + status.toString() + "\r\n", CharsetUtil.UTF_8); ctx.write(response); // Close the connection as soon as the error message is sent. ctx.writeAndFlush(content).addListener(ChannelFutureListener.CLOSE); }
[ "private", "void", "sendError", "(", "ChannelHandlerContext", "ctx", ",", "HttpResponseStatus", "status", ")", "{", "HttpResponse", "response", "=", "new", "DefaultHttpResponse", "(", "HttpVersion", ".", "HTTP_1_1", ",", "status", ")", ";", "response", ".", "heade...
Sends an Error response with status message @param ctx channel context @param status status
[ "Sends", "an", "Error", "response", "with", "status", "message" ]
train
https://github.com/scalecube/socketio/blob/bad28fe7a132320750173e7cb71ad6d3688fb626/src/main/java/io/scalecube/socketio/pipeline/ResourceHandler.java#L168-L176
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.orMoreEqual
public ZealotKhala orMoreEqual(String field, Object value) { return this.doNormal(ZealotConst.OR_PREFIX, field, value, ZealotConst.GTE_SUFFIX, true); }
java
public ZealotKhala orMoreEqual(String field, Object value) { return this.doNormal(ZealotConst.OR_PREFIX, field, value, ZealotConst.GTE_SUFFIX, true); }
[ "public", "ZealotKhala", "orMoreEqual", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "this", ".", "doNormal", "(", "ZealotConst", ".", "OR_PREFIX", ",", "field", ",", "value", ",", "ZealotConst", ".", "GTE_SUFFIX", ",", "true", ")", ...
生成带" OR "前缀大于等于查询的SQL片段. @param field 数据库字段 @param value 值 @return ZealotKhala实例
[ "生成带", "OR", "前缀大于等于查询的SQL片段", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L816-L818
dustin/java-memcached-client
src/main/java/net/spy/memcached/MemcachedClient.java
MemcachedClient.asyncCAS
@Override public <T> OperationFuture<CASResponse> asyncCAS(String key, long casId, int exp, T value, Transcoder<T> tc) { CachedData co = tc.encode(value); final CountDownLatch latch = new CountDownLatch(1); final OperationFuture<CASResponse> rv = new OperationFuture<CASResponse>(key, latch, operationTimeout, executorService); Operation op = opFact.cas(StoreType.set, key, casId, co.getFlags(), exp, co.getData(), new StoreOperation.Callback() { @Override public void receivedStatus(OperationStatus val) { if (val instanceof CASOperationStatus) { rv.set(((CASOperationStatus) val).getCASResponse(), val); } else if (val instanceof CancelledOperationStatus) { getLogger().debug("CAS operation cancelled"); } else if (val instanceof TimedOutOperationStatus) { getLogger().debug("CAS operation timed out"); } else { throw new RuntimeException("Unhandled state: " + val); } } @Override public void gotData(String key, long cas) { rv.setCas(cas); } @Override public void complete() { latch.countDown(); rv.signalComplete(); } }); rv.setOperation(op); mconn.enqueueOperation(key, op); return rv; }
java
@Override public <T> OperationFuture<CASResponse> asyncCAS(String key, long casId, int exp, T value, Transcoder<T> tc) { CachedData co = tc.encode(value); final CountDownLatch latch = new CountDownLatch(1); final OperationFuture<CASResponse> rv = new OperationFuture<CASResponse>(key, latch, operationTimeout, executorService); Operation op = opFact.cas(StoreType.set, key, casId, co.getFlags(), exp, co.getData(), new StoreOperation.Callback() { @Override public void receivedStatus(OperationStatus val) { if (val instanceof CASOperationStatus) { rv.set(((CASOperationStatus) val).getCASResponse(), val); } else if (val instanceof CancelledOperationStatus) { getLogger().debug("CAS operation cancelled"); } else if (val instanceof TimedOutOperationStatus) { getLogger().debug("CAS operation timed out"); } else { throw new RuntimeException("Unhandled state: " + val); } } @Override public void gotData(String key, long cas) { rv.setCas(cas); } @Override public void complete() { latch.countDown(); rv.signalComplete(); } }); rv.setOperation(op); mconn.enqueueOperation(key, op); return rv; }
[ "@", "Override", "public", "<", "T", ">", "OperationFuture", "<", "CASResponse", ">", "asyncCAS", "(", "String", "key", ",", "long", "casId", ",", "int", "exp", ",", "T", "value", ",", "Transcoder", "<", "T", ">", "tc", ")", "{", "CachedData", "co", ...
Asynchronous CAS operation. @param <T> @param key the key @param casId the CAS identifier (from a gets operation) @param exp the expiration of this object @param value the new value @param tc the transcoder to serialize and unserialize the value @return a future that will indicate the status of the CAS @throws IllegalStateException in the rare circumstance where queue is too full to accept any more requests
[ "Asynchronous", "CAS", "operation", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L620-L655
spockframework/spock
spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java
GroovyRuntimeUtil.getAttribute
public static Object getAttribute(Object target, String name) { try { return InvokerHelper.getAttribute(target, name); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
java
public static Object getAttribute(Object target, String name) { try { return InvokerHelper.getAttribute(target, name); } catch (InvokerInvocationException e) { ExceptionUtil.sneakyThrow(e.getCause()); return null; // never reached } }
[ "public", "static", "Object", "getAttribute", "(", "Object", "target", ",", "String", "name", ")", "{", "try", "{", "return", "InvokerHelper", ".", "getAttribute", "(", "target", ",", "name", ")", ";", "}", "catch", "(", "InvokerInvocationException", "e", ")...
Note: This method may throw checked exceptions although it doesn't say so.
[ "Note", ":", "This", "method", "may", "throw", "checked", "exceptions", "although", "it", "doesn", "t", "say", "so", "." ]
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/GroovyRuntimeUtil.java#L290-L297
RestComm/jss7
m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/router/ServerM3UARouter.java
ServerM3UARouter.getAs
public AsImpl getAs(int dpc, int opc, short si) { for (FastList.Node<DPCNode> n = dpcList.head(), end = dpcList.tail(); (n = n.getNext()) != end;) { DPCNode dpcNode = n.getValue(); if (dpcNode.dpc == dpc) { return dpcNode.getAs(opc, si); } } return null; }
java
public AsImpl getAs(int dpc, int opc, short si) { for (FastList.Node<DPCNode> n = dpcList.head(), end = dpcList.tail(); (n = n.getNext()) != end;) { DPCNode dpcNode = n.getValue(); if (dpcNode.dpc == dpc) { return dpcNode.getAs(opc, si); } } return null; }
[ "public", "AsImpl", "getAs", "(", "int", "dpc", ",", "int", "opc", ",", "short", "si", ")", "{", "for", "(", "FastList", ".", "Node", "<", "DPCNode", ">", "n", "=", "dpcList", ".", "head", "(", ")", ",", "end", "=", "dpcList", ".", "tail", "(", ...
<p> Match the passed dpc, opc and si with Tree structure and return the As from corresponding matched {@link SINode}. </p> <p> For example if AS1 is added for Routing Key with DPC=123 only. The tree will be formed with 123 as {@link DPCNode} parent node and -1 as {@link OPCNode} leaf and within {@link OPCNode} -1 as {@link SINode} </p> @param dpc @param opc @param si @return
[ "<p", ">", "Match", "the", "passed", "dpc", "opc", "and", "si", "with", "Tree", "structure", "and", "return", "the", "As", "from", "corresponding", "matched", "{", "@link", "SINode", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/m3ua/impl/src/main/java/org/restcomm/protocols/ss7/m3ua/impl/router/ServerM3UARouter.java#L117-L125
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneOffset.java
ZoneOffset.parseNumber
private static int parseNumber(CharSequence offsetId, int pos, boolean precededByColon) { if (precededByColon && offsetId.charAt(pos - 1) != ':') { throw new DateTimeException("Invalid ID for ZoneOffset, colon not found when expected: " + offsetId); } char ch1 = offsetId.charAt(pos); char ch2 = offsetId.charAt(pos + 1); if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') { throw new DateTimeException("Invalid ID for ZoneOffset, non numeric characters found: " + offsetId); } return (ch1 - 48) * 10 + (ch2 - 48); }
java
private static int parseNumber(CharSequence offsetId, int pos, boolean precededByColon) { if (precededByColon && offsetId.charAt(pos - 1) != ':') { throw new DateTimeException("Invalid ID for ZoneOffset, colon not found when expected: " + offsetId); } char ch1 = offsetId.charAt(pos); char ch2 = offsetId.charAt(pos + 1); if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') { throw new DateTimeException("Invalid ID for ZoneOffset, non numeric characters found: " + offsetId); } return (ch1 - 48) * 10 + (ch2 - 48); }
[ "private", "static", "int", "parseNumber", "(", "CharSequence", "offsetId", ",", "int", "pos", ",", "boolean", "precededByColon", ")", "{", "if", "(", "precededByColon", "&&", "offsetId", ".", "charAt", "(", "pos", "-", "1", ")", "!=", "'", "'", ")", "{"...
Parse a two digit zero-prefixed number. @param offsetId the offset ID, not null @param pos the position to parse, valid @param precededByColon should this number be prefixed by a precededByColon @return the parsed number, from 0 to 99
[ "Parse", "a", "two", "digit", "zero", "-", "prefixed", "number", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneOffset.java#L256-L266
cdk/cdk
tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/ModelBuilder3D.java
ModelBuilder3D.translateStructure
private void translateStructure(Point3d originalCoord, Point3d newCoord, IAtomContainer ac) { Point3d transVector = new Point3d(originalCoord); transVector.sub(newCoord); for (int i = 0; i < ac.getAtomCount(); i++) { if (!(ac.getAtom(i).getFlag(CDKConstants.ISPLACED))) { ac.getAtom(i).getPoint3d().sub(transVector); //ac.getAtomAt(i).setFlag(CDKConstants.ISPLACED, true); } } }
java
private void translateStructure(Point3d originalCoord, Point3d newCoord, IAtomContainer ac) { Point3d transVector = new Point3d(originalCoord); transVector.sub(newCoord); for (int i = 0; i < ac.getAtomCount(); i++) { if (!(ac.getAtom(i).getFlag(CDKConstants.ISPLACED))) { ac.getAtom(i).getPoint3d().sub(transVector); //ac.getAtomAt(i).setFlag(CDKConstants.ISPLACED, true); } } }
[ "private", "void", "translateStructure", "(", "Point3d", "originalCoord", ",", "Point3d", "newCoord", ",", "IAtomContainer", "ac", ")", "{", "Point3d", "transVector", "=", "new", "Point3d", "(", "originalCoord", ")", ";", "transVector", ".", "sub", "(", "newCoor...
Translates the template ring system to new coordinates. @param originalCoord original coordinates of the placed ring atom from template @param newCoord new coordinates from branch placement @param ac AtomContainer contains atoms of ring system
[ "Translates", "the", "template", "ring", "system", "to", "new", "coordinates", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/ModelBuilder3D.java#L544-L553
ops4j/org.ops4j.pax.web
pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/ServerControllerImpl.java
ServerControllerImpl.configureUndertow
private HttpHandler configureUndertow(Configuration configuration, Undertow.Builder builder, HttpHandler rootHandler) { if (configuration.isLogNCSAFormatEnabled()) { String logNCSADirectory = configuration.getLogNCSADirectory(); String logNCSAFormat = configuration.getLogNCSAFormat(); Bundle bundle = FrameworkUtil.getBundle(ServerControllerImpl.class); ClassLoader loader = bundle.adapt(BundleWiring.class).getClassLoader(); xnioWorker = UndertowUtil.createWorker(loader); // String logNameSuffix = logNCSAFormat.substring(logNCSAFormat.lastIndexOf(".")); // String logBaseName = logNCSAFormat.substring(0, logNCSAFormat.lastIndexOf(".")); AccessLogReceiver logReceiver = DefaultAccessLogReceiver.builder().setLogWriteExecutor(xnioWorker) .setOutputDirectory(new File(logNCSADirectory).toPath()).setLogBaseName("request.") .setLogNameSuffix("log").setRotate(true).build(); String format; if (configuration.isLogNCSAExtended()) { format = "combined"; } else { format = "common"; } // String format = "%a - - [%t] \"%m %U %H\" %s "; // TODO: still need to find out how to add cookie etc. rootHandler = new AccessLogHandler(rootHandler, logReceiver, format, AccessLogHandler.class.getClassLoader()); } for (String address : configuration.getListeningAddresses()) { if (configuration.isHttpEnabled()) { LOG.info("Starting undertow http listener on " + address + ":" + configuration.getHttpPort()); builder.addHttpListener(configuration.getHttpPort(), address); } if (configuration.isHttpSecureEnabled()) { LOG.info("Starting undertow https listener on " + address + ":" + configuration.getHttpSecurePort()); // TODO: could this be shared across interface:port bindings? SSLContext context = buildSSLContext(); builder.addHttpsListener(configuration.getHttpSecurePort(), address, context); } } return rootHandler; }
java
private HttpHandler configureUndertow(Configuration configuration, Undertow.Builder builder, HttpHandler rootHandler) { if (configuration.isLogNCSAFormatEnabled()) { String logNCSADirectory = configuration.getLogNCSADirectory(); String logNCSAFormat = configuration.getLogNCSAFormat(); Bundle bundle = FrameworkUtil.getBundle(ServerControllerImpl.class); ClassLoader loader = bundle.adapt(BundleWiring.class).getClassLoader(); xnioWorker = UndertowUtil.createWorker(loader); // String logNameSuffix = logNCSAFormat.substring(logNCSAFormat.lastIndexOf(".")); // String logBaseName = logNCSAFormat.substring(0, logNCSAFormat.lastIndexOf(".")); AccessLogReceiver logReceiver = DefaultAccessLogReceiver.builder().setLogWriteExecutor(xnioWorker) .setOutputDirectory(new File(logNCSADirectory).toPath()).setLogBaseName("request.") .setLogNameSuffix("log").setRotate(true).build(); String format; if (configuration.isLogNCSAExtended()) { format = "combined"; } else { format = "common"; } // String format = "%a - - [%t] \"%m %U %H\" %s "; // TODO: still need to find out how to add cookie etc. rootHandler = new AccessLogHandler(rootHandler, logReceiver, format, AccessLogHandler.class.getClassLoader()); } for (String address : configuration.getListeningAddresses()) { if (configuration.isHttpEnabled()) { LOG.info("Starting undertow http listener on " + address + ":" + configuration.getHttpPort()); builder.addHttpListener(configuration.getHttpPort(), address); } if (configuration.isHttpSecureEnabled()) { LOG.info("Starting undertow https listener on " + address + ":" + configuration.getHttpSecurePort()); // TODO: could this be shared across interface:port bindings? SSLContext context = buildSSLContext(); builder.addHttpsListener(configuration.getHttpSecurePort(), address, context); } } return rootHandler; }
[ "private", "HttpHandler", "configureUndertow", "(", "Configuration", "configuration", ",", "Undertow", ".", "Builder", "builder", ",", "HttpHandler", "rootHandler", ")", "{", "if", "(", "configuration", ".", "isLogNCSAFormatEnabled", "(", ")", ")", "{", "String", ...
Configuration using <code>org.ops4j.pax.web</code> PID - only listeners and NCSA logging @param configuration @param builder @param rootHandler current root handler @return
[ "Configuration", "using", "<code", ">", "org", ".", "ops4j", ".", "pax", ".", "web<", "/", "code", ">", "PID", "-", "only", "listeners", "and", "NCSA", "logging" ]
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/ServerControllerImpl.java#L349-L393
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentUrl.java
DocumentUrl.deleteDocumentUrl
public static MozuUrl deleteDocumentUrl(String documentId, String documentListName) { UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documents/{documentId}"); formatter.formatUrl("documentId", documentId); formatter.formatUrl("documentListName", documentListName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl deleteDocumentUrl(String documentId, String documentListName) { UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documents/{documentId}"); formatter.formatUrl("documentId", documentId); formatter.formatUrl("documentListName", documentListName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "deleteDocumentUrl", "(", "String", "documentId", ",", "String", "documentListName", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/content/documentlists/{documentListName}/documents/{documentId}\"", ")", ";", ...
Get Resource Url for DeleteDocument @param documentId Unique identifier for a document, used by content and document calls. Document IDs are associated with document types, document type lists, sites, and tenants. @param documentListName Name of content documentListName to delete @return String Resource Url
[ "Get", "Resource", "Url", "for", "DeleteDocument" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentUrl.java#L150-L156
landawn/AbacusUtil
src/com/landawn/abacus/util/ClassUtil.java
ClassUtil.getPropValue
@SuppressWarnings("unchecked") public static <T> T getPropValue(final Object entity, final Method propGetMethod) { try { return (T) propGetMethod.invoke(entity); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw N.toRuntimeException(e); } }
java
@SuppressWarnings("unchecked") public static <T> T getPropValue(final Object entity, final Method propGetMethod) { try { return (T) propGetMethod.invoke(entity); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw N.toRuntimeException(e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getPropValue", "(", "final", "Object", "entity", ",", "final", "Method", "propGetMethod", ")", "{", "try", "{", "return", "(", "T", ")", "propGetMethod", ".", "inv...
Return the specified {@code propValue} got by the specified method {@code propSetMethod} in the specified {@code entity}. @param entity MapEntity is not supported @param propGetMethod @return
[ "Return", "the", "specified", "{", "@code", "propValue", "}", "got", "by", "the", "specified", "method", "{", "@code", "propSetMethod", "}", "in", "the", "specified", "{", "@code", "entity", "}", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ClassUtil.java#L1764-L1771
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java
RoaringBitmap.intersects
public static boolean intersects(final RoaringBitmap x1, final RoaringBitmap x2) { final int length1 = x1.highLowContainer.size(), length2 = x2.highLowContainer.size(); int pos1 = 0, pos2 = 0; while (pos1 < length1 && pos2 < length2) { final short s1 = x1.highLowContainer.getKeyAtIndex(pos1); final short s2 = x2.highLowContainer.getKeyAtIndex(pos2); if (s1 == s2) { final Container c1 = x1.highLowContainer.getContainerAtIndex(pos1); final Container c2 = x2.highLowContainer.getContainerAtIndex(pos2); if (c1.intersects(c2)) { return true; } ++pos1; ++pos2; } else if (Util.compareUnsigned(s1, s2) < 0) { // s1 < s2 pos1 = x1.highLowContainer.advanceUntil(s2, pos1); } else { // s1 > s2 pos2 = x2.highLowContainer.advanceUntil(s1, pos2); } } return false; }
java
public static boolean intersects(final RoaringBitmap x1, final RoaringBitmap x2) { final int length1 = x1.highLowContainer.size(), length2 = x2.highLowContainer.size(); int pos1 = 0, pos2 = 0; while (pos1 < length1 && pos2 < length2) { final short s1 = x1.highLowContainer.getKeyAtIndex(pos1); final short s2 = x2.highLowContainer.getKeyAtIndex(pos2); if (s1 == s2) { final Container c1 = x1.highLowContainer.getContainerAtIndex(pos1); final Container c2 = x2.highLowContainer.getContainerAtIndex(pos2); if (c1.intersects(c2)) { return true; } ++pos1; ++pos2; } else if (Util.compareUnsigned(s1, s2) < 0) { // s1 < s2 pos1 = x1.highLowContainer.advanceUntil(s2, pos1); } else { // s1 > s2 pos2 = x2.highLowContainer.advanceUntil(s1, pos2); } } return false; }
[ "public", "static", "boolean", "intersects", "(", "final", "RoaringBitmap", "x1", ",", "final", "RoaringBitmap", "x2", ")", "{", "final", "int", "length1", "=", "x1", ".", "highLowContainer", ".", "size", "(", ")", ",", "length2", "=", "x2", ".", "highLowC...
Checks whether the two bitmaps intersect. This can be much faster than calling "and" and checking the cardinality of the result. @param x1 first bitmap @param x2 other bitmap @return true if they intersect
[ "Checks", "whether", "the", "two", "bitmaps", "intersect", ".", "This", "can", "be", "much", "faster", "than", "calling", "and", "and", "checking", "the", "cardinality", "of", "the", "result", "." ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java#L625-L647
jcuda/jnvgraph
JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java
JNvgraph.nvgraphPagerank
public static int nvgraphPagerank( nvgraphHandle handle, nvgraphGraphDescr descrG, long weight_index, Pointer alpha, long bookmark_index, int has_guess, long pagerank_index, float tolerance, int max_iter) { return checkResult(nvgraphPagerankNative(handle, descrG, weight_index, alpha, bookmark_index, has_guess, pagerank_index, tolerance, max_iter)); }
java
public static int nvgraphPagerank( nvgraphHandle handle, nvgraphGraphDescr descrG, long weight_index, Pointer alpha, long bookmark_index, int has_guess, long pagerank_index, float tolerance, int max_iter) { return checkResult(nvgraphPagerankNative(handle, descrG, weight_index, alpha, bookmark_index, has_guess, pagerank_index, tolerance, max_iter)); }
[ "public", "static", "int", "nvgraphPagerank", "(", "nvgraphHandle", "handle", ",", "nvgraphGraphDescr", "descrG", ",", "long", "weight_index", ",", "Pointer", "alpha", ",", "long", "bookmark_index", ",", "int", "has_guess", ",", "long", "pagerank_index", ",", "flo...
nvGRAPH PageRank Find PageRank for each vertex of a graph with a given transition probabilities, a bookmark vector of dangling vertices, and the damping factor.
[ "nvGRAPH", "PageRank", "Find", "PageRank", "for", "each", "vertex", "of", "a", "graph", "with", "a", "given", "transition", "probabilities", "a", "bookmark", "vector", "of", "dangling", "vertices", "and", "the", "damping", "factor", "." ]
train
https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L645-L657
lessthanoptimal/BoofCV
main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java
ConvertBufferedImage.orderBandsIntoBuffered
public static Planar orderBandsIntoBuffered(Planar src, BufferedImage dst) { // see if no change is required if( dst.getType() == BufferedImage.TYPE_INT_RGB ) return src; Planar tmp = new Planar(src.type, src.getNumBands()); tmp.width = src.width; tmp.height = src.height; tmp.stride = src.stride; tmp.startIndex = src.startIndex; for( int i = 0; i < src.getNumBands(); i++ ) { tmp.bands[i] = src.bands[i]; } ConvertRaster.orderBandsBufferedFromRgb(tmp, dst); return tmp; }
java
public static Planar orderBandsIntoBuffered(Planar src, BufferedImage dst) { // see if no change is required if( dst.getType() == BufferedImage.TYPE_INT_RGB ) return src; Planar tmp = new Planar(src.type, src.getNumBands()); tmp.width = src.width; tmp.height = src.height; tmp.stride = src.stride; tmp.startIndex = src.startIndex; for( int i = 0; i < src.getNumBands(); i++ ) { tmp.bands[i] = src.bands[i]; } ConvertRaster.orderBandsBufferedFromRgb(tmp, dst); return tmp; }
[ "public", "static", "Planar", "orderBandsIntoBuffered", "(", "Planar", "src", ",", "BufferedImage", "dst", ")", "{", "// see if no change is required", "if", "(", "dst", ".", "getType", "(", ")", "==", "BufferedImage", ".", "TYPE_INT_RGB", ")", "return", "src", ...
Returns a new image with the color bands in the appropriate ordering. The returned image will reference the original image's image arrays.
[ "Returns", "a", "new", "image", "with", "the", "color", "bands", "in", "the", "appropriate", "ordering", ".", "The", "returned", "image", "will", "reference", "the", "original", "image", "s", "image", "arrays", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L930-L945
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java
StringUtil.SQLEqualsIgnoreCase
public static boolean SQLEqualsIgnoreCase(String s1, String s2) { if (s2 == null) { return false; } else { return SQLToUpperCase(s1).equals(SQLToUpperCase(s2)); } }
java
public static boolean SQLEqualsIgnoreCase(String s1, String s2) { if (s2 == null) { return false; } else { return SQLToUpperCase(s1).equals(SQLToUpperCase(s2)); } }
[ "public", "static", "boolean", "SQLEqualsIgnoreCase", "(", "String", "s1", ",", "String", "s2", ")", "{", "if", "(", "s2", "==", "null", ")", "{", "return", "false", ";", "}", "else", "{", "return", "SQLToUpperCase", "(", "s1", ")", ".", "equals", "(",...
Compares two strings Strings will be uppercased in english and compared equivalent to s1.equalsIgnoreCase(s2) throws NPE if s1 is null @param s1 first string to compare @param s2 second string to compare @return true if the two upppercased ENGLISH values are equal return false if s2 is null
[ "Compares", "two", "strings", "Strings", "will", "be", "uppercased", "in", "english", "and", "compared", "equivalent", "to", "s1", ".", "equalsIgnoreCase", "(", "s2", ")", "throws", "NPE", "if", "s1", "is", "null" ]
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/StringUtil.java#L689-L696
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsPushButton.java
CmsPushButton.setDownFace
public void setDownFace(String text, String imageClass) { m_downImageClass = imageClass; getDownFace().setHTML(getFaceHtml(text, imageClass)); }
java
public void setDownFace(String text, String imageClass) { m_downImageClass = imageClass; getDownFace().setHTML(getFaceHtml(text, imageClass)); }
[ "public", "void", "setDownFace", "(", "String", "text", ",", "String", "imageClass", ")", "{", "m_downImageClass", "=", "imageClass", ";", "getDownFace", "(", ")", ".", "setHTML", "(", "getFaceHtml", "(", "text", ",", "imageClass", ")", ")", ";", "}" ]
Sets the down face text and image.<p> @param text the down face text to set, set to <code>null</code> to not show any @param imageClass the down face image class to use, set to <code>null</code> to not show any
[ "Sets", "the", "down", "face", "text", "and", "image", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsPushButton.java#L315-L319
logic-ng/LogicNG
src/main/java/org/logicng/formulas/Formula.java
Formula.apply
public <T> T apply(final FormulaFunction<T> function, final boolean cache) { return function.apply(this, cache); }
java
public <T> T apply(final FormulaFunction<T> function, final boolean cache) { return function.apply(this, cache); }
[ "public", "<", "T", ">", "T", "apply", "(", "final", "FormulaFunction", "<", "T", ">", "function", ",", "final", "boolean", "cache", ")", "{", "return", "function", ".", "apply", "(", "this", ",", "cache", ")", ";", "}" ]
Applies a given function on this formula and returns the result. @param function the function @param cache indicates whether the result should be cached in this formula's cache @param <T> the result type of the function @return the result of the function application
[ "Applies", "a", "given", "function", "on", "this", "formula", "and", "returns", "the", "result", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/Formula.java#L317-L319
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java
Configurer.getImplementation
public final <T> T getImplementation(ClassLoader loader, Class<T> type, String... path) { return getImplementation(loader, type, new Class<?>[0], Collections.emptyList(), path); }
java
public final <T> T getImplementation(ClassLoader loader, Class<T> type, String... path) { return getImplementation(loader, type, new Class<?>[0], Collections.emptyList(), path); }
[ "public", "final", "<", "T", ">", "T", "getImplementation", "(", "ClassLoader", "loader", ",", "Class", "<", "T", ">", "type", ",", "String", "...", "path", ")", "{", "return", "getImplementation", "(", "loader", ",", "type", ",", "new", "Class", "<", ...
Get the class implementation from its name. Default constructor must be available. @param <T> The instance type. @param loader The class loader to use. @param type The class type. @param path The node path. @return The typed class instance. @throws LionEngineException If invalid class.
[ "Get", "the", "class", "implementation", "from", "its", "name", ".", "Default", "constructor", "must", "be", "available", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java#L310-L313
redkale/redkale
src/org/redkale/util/ResourceFactory.java
ResourceFactory.register
public <A> A register(final boolean autoSync, final A rs) { if (rs == null) return null; return (A) register(autoSync, "", rs); }
java
public <A> A register(final boolean autoSync, final A rs) { if (rs == null) return null; return (A) register(autoSync, "", rs); }
[ "public", "<", "A", ">", "A", "register", "(", "final", "boolean", "autoSync", ",", "final", "A", "rs", ")", "{", "if", "(", "rs", "==", "null", ")", "return", "null", ";", "return", "(", "A", ")", "register", "(", "autoSync", ",", "\"\"", ",", "...
将对象以name=""注入到资源池中,并同步已被注入的资源 @param <A> 泛型 @param autoSync 是否同步已被注入的资源 @param rs 资源对象 @return 旧资源对象
[ "将对象以name", "=", "注入到资源池中,并同步已被注入的资源" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/util/ResourceFactory.java#L159-L162
victims/victims-lib-java
src/main/java/com/redhat/victims/database/VictimsSQL.java
VictimsSQL.deleteRecord
protected void deleteRecord(Connection connection, String hash) throws SQLException { int id = selectRecordId(hash); if (id > 0) { String[] queries = new String[] { Query.DELETE_FILEHASHES, Query.DELETE_METAS, Query.DELETE_CVES, Query.DELETE_RECORD_ID }; for (String query : queries) { PreparedStatement ps = setObjects(connection, query, id); ps.execute(); ps.close(); } } }
java
protected void deleteRecord(Connection connection, String hash) throws SQLException { int id = selectRecordId(hash); if (id > 0) { String[] queries = new String[] { Query.DELETE_FILEHASHES, Query.DELETE_METAS, Query.DELETE_CVES, Query.DELETE_RECORD_ID }; for (String query : queries) { PreparedStatement ps = setObjects(connection, query, id); ps.execute(); ps.close(); } } }
[ "protected", "void", "deleteRecord", "(", "Connection", "connection", ",", "String", "hash", ")", "throws", "SQLException", "{", "int", "id", "=", "selectRecordId", "(", "hash", ")", ";", "if", "(", "id", ">", "0", ")", "{", "String", "[", "]", "queries"...
Remove records matching a given hash. This will cascade to all references. @param hash @throws SQLException
[ "Remove", "records", "matching", "a", "given", "hash", ".", "This", "will", "cascade", "to", "all", "references", "." ]
train
https://github.com/victims/victims-lib-java/blob/ccd0e2fcc409bb6cdfc5de411c3bb202c9095f8b/src/main/java/com/redhat/victims/database/VictimsSQL.java#L256-L269
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/MultimapJoiner.java
MultimapJoiner.appendTo
public <A extends Appendable> A appendTo(A appendable, Iterable<? extends Entry<?, ? extends Collection<?>>> entries) throws IOException { // checkNotNull(appendable); Iterator<? extends Entry<?, ? extends Collection<?>>> iterator = entries.iterator(); if (iterator.hasNext()) { Entry<?, ? extends Collection<?>> entry = iterator.next(); appendable.append(toString(entry.getKey())); appendable.append(keyValueSeparator); entryJoiner.appendTo(appendable, entry.getValue()); while (iterator.hasNext()) { appendable.append(separator); Entry<?, ? extends Collection<?>> e = iterator.next(); appendable.append(toString(e.getKey())); appendable.append(keyValueSeparator); entryJoiner.appendTo(appendable, e.getValue()); } } return appendable; }
java
public <A extends Appendable> A appendTo(A appendable, Iterable<? extends Entry<?, ? extends Collection<?>>> entries) throws IOException { // checkNotNull(appendable); Iterator<? extends Entry<?, ? extends Collection<?>>> iterator = entries.iterator(); if (iterator.hasNext()) { Entry<?, ? extends Collection<?>> entry = iterator.next(); appendable.append(toString(entry.getKey())); appendable.append(keyValueSeparator); entryJoiner.appendTo(appendable, entry.getValue()); while (iterator.hasNext()) { appendable.append(separator); Entry<?, ? extends Collection<?>> e = iterator.next(); appendable.append(toString(e.getKey())); appendable.append(keyValueSeparator); entryJoiner.appendTo(appendable, e.getValue()); } } return appendable; }
[ "public", "<", "A", "extends", "Appendable", ">", "A", "appendTo", "(", "A", "appendable", ",", "Iterable", "<", "?", "extends", "Entry", "<", "?", ",", "?", "extends", "Collection", "<", "?", ">", ">", ">", "entries", ")", "throws", "IOException", "{"...
Appends the string representation of each entry in {@code entries}, using the previously configured separator and key-value separator, to {@code appendable}.
[ "Appends", "the", "string", "representation", "of", "each", "entry", "in", "{" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/util/MultimapJoiner.java#L87-L105
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java
BoxApiBookmark.getMoveRequest
public BoxRequestsBookmark.UpdateBookmark getMoveRequest(String id, String parentId) { BoxRequestsBookmark.UpdateBookmark request = new BoxRequestsBookmark.UpdateBookmark(id, getBookmarkInfoUrl(id), mSession); request.setParentId(parentId); return request; }
java
public BoxRequestsBookmark.UpdateBookmark getMoveRequest(String id, String parentId) { BoxRequestsBookmark.UpdateBookmark request = new BoxRequestsBookmark.UpdateBookmark(id, getBookmarkInfoUrl(id), mSession); request.setParentId(parentId); return request; }
[ "public", "BoxRequestsBookmark", ".", "UpdateBookmark", "getMoveRequest", "(", "String", "id", ",", "String", "parentId", ")", "{", "BoxRequestsBookmark", ".", "UpdateBookmark", "request", "=", "new", "BoxRequestsBookmark", ".", "UpdateBookmark", "(", "id", ",", "ge...
Gets a request that moves a bookmark to another folder @param id id of bookmark to move @param parentId id of parent folder to move bookmark into @return request to move a bookmark
[ "Gets", "a", "request", "that", "moves", "a", "bookmark", "to", "another", "folder" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java#L133-L137
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java
Main.setDefaultValue
private static void setDefaultValue(Definition def, String className, String stringValue) { if (className.endsWith(stringValue)) def.setDefaultValue(className.substring(0, className.length() - stringValue.length())); }
java
private static void setDefaultValue(Definition def, String className, String stringValue) { if (className.endsWith(stringValue)) def.setDefaultValue(className.substring(0, className.length() - stringValue.length())); }
[ "private", "static", "void", "setDefaultValue", "(", "Definition", "def", ",", "String", "className", ",", "String", "stringValue", ")", "{", "if", "(", "className", ".", "endsWith", "(", "stringValue", ")", ")", "def", ".", "setDefaultValue", "(", "className"...
check defalut value and set it @param def definition @param className the class name @param stringValue post-fix string
[ "check", "defalut", "value", "and", "set", "it" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/Main.java#L788-L792
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
ContentSpecProcessor.mergeRelationships
protected void mergeRelationships(final Map<SpecNode, CSNodeWrapper> nodeMapping, final DataProviderFactory providerFactory) { final CSNodeProvider nodeProvider = providerFactory.getProvider(CSNodeProvider.class); for (final Map.Entry<SpecNode, CSNodeWrapper> nodes : nodeMapping.entrySet()) { // Only process relationship nodes if (!(nodes.getKey() instanceof SpecNodeWithRelationships)) continue; // Get the matching node and entity final SpecNodeWithRelationships specNode = (SpecNodeWithRelationships) nodes.getKey(); final CSNodeWrapper entity = nodes.getValue(); // Check if the node or entity have any relationships, if not then the node doesn't need to be merged if (!specNode.getRelationships().isEmpty() || entity.getRelatedToNodes() != null && !entity.getRelatedToNodes().isEmpty()) { // merge the relationships from the spec topic to the entity mergeRelationship(nodeMapping, specNode, entity, nodeProvider); } } }
java
protected void mergeRelationships(final Map<SpecNode, CSNodeWrapper> nodeMapping, final DataProviderFactory providerFactory) { final CSNodeProvider nodeProvider = providerFactory.getProvider(CSNodeProvider.class); for (final Map.Entry<SpecNode, CSNodeWrapper> nodes : nodeMapping.entrySet()) { // Only process relationship nodes if (!(nodes.getKey() instanceof SpecNodeWithRelationships)) continue; // Get the matching node and entity final SpecNodeWithRelationships specNode = (SpecNodeWithRelationships) nodes.getKey(); final CSNodeWrapper entity = nodes.getValue(); // Check if the node or entity have any relationships, if not then the node doesn't need to be merged if (!specNode.getRelationships().isEmpty() || entity.getRelatedToNodes() != null && !entity.getRelatedToNodes().isEmpty()) { // merge the relationships from the spec topic to the entity mergeRelationship(nodeMapping, specNode, entity, nodeProvider); } } }
[ "protected", "void", "mergeRelationships", "(", "final", "Map", "<", "SpecNode", ",", "CSNodeWrapper", ">", "nodeMapping", ",", "final", "DataProviderFactory", "providerFactory", ")", "{", "final", "CSNodeProvider", "nodeProvider", "=", "providerFactory", ".", "getPro...
Merges the relationships for all Spec Topics into their counterpart Entity nodes. @param nodeMapping The mapping of Spec Nodes to Entity nodes. @param providerFactory
[ "Merges", "the", "relationships", "for", "all", "Spec", "Topics", "into", "their", "counterpart", "Entity", "nodes", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L1838-L1855
captain-miao/OptionRoundCardview
optroundcardview/src/main/java/com/github/captain_miao/optroundcardview/RoundRectDrawable.java
RoundRectDrawable.createTintFilter
private PorterDuffColorFilter createTintFilter(ColorStateList tint, PorterDuff.Mode tintMode) { if (tint == null || tintMode == null) { return null; } final int color = tint.getColorForState(getState(), Color.TRANSPARENT); return new PorterDuffColorFilter(color, tintMode); }
java
private PorterDuffColorFilter createTintFilter(ColorStateList tint, PorterDuff.Mode tintMode) { if (tint == null || tintMode == null) { return null; } final int color = tint.getColorForState(getState(), Color.TRANSPARENT); return new PorterDuffColorFilter(color, tintMode); }
[ "private", "PorterDuffColorFilter", "createTintFilter", "(", "ColorStateList", "tint", ",", "PorterDuff", ".", "Mode", "tintMode", ")", "{", "if", "(", "tint", "==", "null", "||", "tintMode", "==", "null", ")", "{", "return", "null", ";", "}", "final", "int"...
Ensures the tint filter is consistent with the current tint color and mode.
[ "Ensures", "the", "tint", "filter", "is", "consistent", "with", "the", "current", "tint", "color", "and", "mode", "." ]
train
https://github.com/captain-miao/OptionRoundCardview/blob/aefad1e42351958724b916b8003a24f10634b3d8/optroundcardview/src/main/java/com/github/captain_miao/optroundcardview/RoundRectDrawable.java#L190-L196
VoltDB/voltdb
src/frontend/org/voltdb/plannodes/NodeSchema.java
NodeSchema.sortByTveIndex
void sortByTveIndex(int fromIndex, int toIndex) { Collections.sort(m_columns.subList(fromIndex, toIndex), TVE_IDX_COMPARE); }
java
void sortByTveIndex(int fromIndex, int toIndex) { Collections.sort(m_columns.subList(fromIndex, toIndex), TVE_IDX_COMPARE); }
[ "void", "sortByTveIndex", "(", "int", "fromIndex", ",", "int", "toIndex", ")", "{", "Collections", ".", "sort", "(", "m_columns", ".", "subList", "(", "fromIndex", ",", "toIndex", ")", ",", "TVE_IDX_COMPARE", ")", ";", "}" ]
Sort a sub-range of the schema columns by TVE index. All elements must be TupleValueExpressions. Modification is made in-place. @param fromIndex lower bound of range to be sorted, inclusive @param toIndex upper bound of range to be sorted, exclusive
[ "Sort", "a", "sub", "-", "range", "of", "the", "schema", "columns", "by", "TVE", "index", ".", "All", "elements", "must", "be", "TupleValueExpressions", ".", "Modification", "is", "made", "in", "-", "place", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/plannodes/NodeSchema.java#L266-L268
OpenLiberty/open-liberty
dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/interceptors/Mandatory.java
Mandatory.mandatory
@AroundInvoke public Object mandatory(final InvocationContext context) throws Exception { if (getUOWM().getUOWType() != UOWSynchronizationRegistry.UOW_TYPE_GLOBAL_TRANSACTION) { throw new TransactionalException("global tx required", new TransactionRequiredException()); } return runUnderUOWManagingEnablement(UOWSynchronizationRegistry.UOW_TYPE_GLOBAL_TRANSACTION, true, context, "MANDATORY"); }
java
@AroundInvoke public Object mandatory(final InvocationContext context) throws Exception { if (getUOWM().getUOWType() != UOWSynchronizationRegistry.UOW_TYPE_GLOBAL_TRANSACTION) { throw new TransactionalException("global tx required", new TransactionRequiredException()); } return runUnderUOWManagingEnablement(UOWSynchronizationRegistry.UOW_TYPE_GLOBAL_TRANSACTION, true, context, "MANDATORY"); }
[ "@", "AroundInvoke", "public", "Object", "mandatory", "(", "final", "InvocationContext", "context", ")", "throws", "Exception", "{", "if", "(", "getUOWM", "(", ")", ".", "getUOWType", "(", ")", "!=", "UOWSynchronizationRegistry", ".", "UOW_TYPE_GLOBAL_TRANSACTION", ...
<p>If called outside a transaction context, a TransactionalException with a nested TransactionRequiredException must be thrown.</p> <p>If called inside a transaction context, managed bean method execution will then continue under that context.</p>
[ "<p", ">", "If", "called", "outside", "a", "transaction", "context", "a", "TransactionalException", "with", "a", "nested", "TransactionRequiredException", "must", "be", "thrown", ".", "<", "/", "p", ">", "<p", ">", "If", "called", "inside", "a", "transaction",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transaction.cdi/src/com/ibm/tx/jta/cdi/interceptors/Mandatory.java#L38-L46
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/WeakObjectRegistry.java
WeakObjectRegistry.registerObject
public void registerObject(final Object object, final UUID id) { objectToId.put(object, id); idToObject.put(id, object); }
java
public void registerObject(final Object object, final UUID id) { objectToId.put(object, id); idToObject.put(id, object); }
[ "public", "void", "registerObject", "(", "final", "Object", "object", ",", "final", "UUID", "id", ")", "{", "objectToId", ".", "put", "(", "object", ",", "id", ")", ";", "idToObject", ".", "put", "(", "id", ",", "object", ")", ";", "}" ]
Registers an object in this model identified by a pre existing id. @param object The object to register. @param id The id by which this object is identified.
[ "Registers", "an", "object", "in", "this", "model", "identified", "by", "a", "pre", "existing", "id", "." ]
train
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/WeakObjectRegistry.java#L135-L138
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/Query.java
Query.adding
public Query adding( Ordering... orderings ) { List<Ordering> newOrderings = null; if (this.orderings() != null) { newOrderings = new ArrayList<Ordering>(orderings()); for (Ordering ordering : orderings) { newOrderings.add(ordering); } } else { newOrderings = Arrays.asList(orderings); } return new Query(source, constraint, newOrderings, columns, getLimits(), distinct); }
java
public Query adding( Ordering... orderings ) { List<Ordering> newOrderings = null; if (this.orderings() != null) { newOrderings = new ArrayList<Ordering>(orderings()); for (Ordering ordering : orderings) { newOrderings.add(ordering); } } else { newOrderings = Arrays.asList(orderings); } return new Query(source, constraint, newOrderings, columns, getLimits(), distinct); }
[ "public", "Query", "adding", "(", "Ordering", "...", "orderings", ")", "{", "List", "<", "Ordering", ">", "newOrderings", "=", "null", ";", "if", "(", "this", ".", "orderings", "(", ")", "!=", "null", ")", "{", "newOrderings", "=", "new", "ArrayList", ...
Create a copy of this query, but that returns results that are ordered by the {@link #orderings() orderings} of this column as well as those supplied. @param orderings the additional orderings of the result rows; may no be null @return the copy of the query returning the supplied result columns; never null
[ "Create", "a", "copy", "of", "this", "query", "but", "that", "returns", "results", "that", "are", "ordered", "by", "the", "{", "@link", "#orderings", "()", "orderings", "}", "of", "this", "column", "as", "well", "as", "those", "supplied", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/model/Query.java#L220-L231
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hll/HllSketch.java
HllSketch.writableWrap
public static final HllSketch writableWrap(final WritableMemory wmem) { final boolean compact = extractCompactFlag(wmem); if (compact) { throw new SketchesArgumentException( "Cannot perform a writableWrap of a writable sketch image that is in compact form."); } final int lgConfigK = extractLgK(wmem); final TgtHllType tgtHllType = extractTgtHllType(wmem); final long minBytes = getMaxUpdatableSerializationBytes(lgConfigK, tgtHllType); final long capBytes = wmem.getCapacity(); HllUtil.checkMemSize(minBytes, capBytes); final CurMode curMode = checkPreamble(wmem); final HllSketch directSketch; if (curMode == CurMode.HLL) { if (tgtHllType == TgtHllType.HLL_4) { directSketch = new HllSketch(new DirectHll4Array(lgConfigK, wmem)); } else if (tgtHllType == TgtHllType.HLL_6) { directSketch = new HllSketch(new DirectHll6Array(lgConfigK, wmem)); } else { //Hll_8 directSketch = new HllSketch(new DirectHll8Array(lgConfigK, wmem)); } } else if (curMode == CurMode.LIST) { directSketch = new HllSketch(new DirectCouponList(lgConfigK, tgtHllType, curMode, wmem)); } else { directSketch = new HllSketch(new DirectCouponHashSet(lgConfigK, tgtHllType, wmem)); } return directSketch; }
java
public static final HllSketch writableWrap(final WritableMemory wmem) { final boolean compact = extractCompactFlag(wmem); if (compact) { throw new SketchesArgumentException( "Cannot perform a writableWrap of a writable sketch image that is in compact form."); } final int lgConfigK = extractLgK(wmem); final TgtHllType tgtHllType = extractTgtHllType(wmem); final long minBytes = getMaxUpdatableSerializationBytes(lgConfigK, tgtHllType); final long capBytes = wmem.getCapacity(); HllUtil.checkMemSize(minBytes, capBytes); final CurMode curMode = checkPreamble(wmem); final HllSketch directSketch; if (curMode == CurMode.HLL) { if (tgtHllType == TgtHllType.HLL_4) { directSketch = new HllSketch(new DirectHll4Array(lgConfigK, wmem)); } else if (tgtHllType == TgtHllType.HLL_6) { directSketch = new HllSketch(new DirectHll6Array(lgConfigK, wmem)); } else { //Hll_8 directSketch = new HllSketch(new DirectHll8Array(lgConfigK, wmem)); } } else if (curMode == CurMode.LIST) { directSketch = new HllSketch(new DirectCouponList(lgConfigK, tgtHllType, curMode, wmem)); } else { directSketch = new HllSketch(new DirectCouponHashSet(lgConfigK, tgtHllType, wmem)); } return directSketch; }
[ "public", "static", "final", "HllSketch", "writableWrap", "(", "final", "WritableMemory", "wmem", ")", "{", "final", "boolean", "compact", "=", "extractCompactFlag", "(", "wmem", ")", ";", "if", "(", "compact", ")", "{", "throw", "new", "SketchesArgumentExceptio...
Wraps the given WritableMemory, which must be a image of a valid updatable sketch, and may have data. What remains on the java heap is a thin wrapper object that reads and writes to the given WritableMemory, which, depending on how the user configures the WritableMemory, may actually reside on the Java heap or off-heap. <p>The given <i>dstMem</i> is checked for the required capacity as determined by {@link #getMaxUpdatableSerializationBytes(int, TgtHllType)}. @param wmem an writable image of a valid sketch with data. @return an HllSketch where the sketch data is in the given dstMem.
[ "Wraps", "the", "given", "WritableMemory", "which", "must", "be", "a", "image", "of", "a", "valid", "updatable", "sketch", "and", "may", "have", "data", ".", "What", "remains", "on", "the", "java", "heap", "is", "a", "thin", "wrapper", "object", "that", ...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hll/HllSketch.java#L167-L197
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/FileListener.java
FileListener.writeField
public void writeField(ObjectOutputStream daOut, Converter converter) throws IOException { String strFieldName = DBConstants.BLANK; if (converter != null) if (converter.getField() != null) strFieldName = converter.getField().getClass().getName(); Object data = null; if (converter != null) data = converter.getData(); daOut.writeUTF(strFieldName); daOut.writeObject(data); }
java
public void writeField(ObjectOutputStream daOut, Converter converter) throws IOException { String strFieldName = DBConstants.BLANK; if (converter != null) if (converter.getField() != null) strFieldName = converter.getField().getClass().getName(); Object data = null; if (converter != null) data = converter.getData(); daOut.writeUTF(strFieldName); daOut.writeObject(data); }
[ "public", "void", "writeField", "(", "ObjectOutputStream", "daOut", ",", "Converter", "converter", ")", "throws", "IOException", "{", "String", "strFieldName", "=", "DBConstants", ".", "BLANK", ";", "if", "(", "converter", "!=", "null", ")", "if", "(", "conver...
Encode and write this field's data to the stream. @param daOut The output stream to marshal the data to. @param converter The field to serialize.
[ "Encode", "and", "write", "this", "field", "s", "data", "to", "the", "stream", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/FileListener.java#L405-L415
omadahealth/CircularBarPager
library/src/main/java/com/github/omadahealth/circularbarpager/library/CircularBar.java
CircularBar.animateProgress
public void animateProgress(List<Boolean> circlePieceFillList, int duration) { mCirclePieceFillList = circlePieceFillList; AnimatorSet set = new AnimatorSet(); set.playTogether(Glider.glide(Skill.QuadEaseInOut, duration, ObjectAnimator.ofFloat(this, "progress", 0, 100))); set.setDuration(duration); set = addListenersToSet(set); set.start(); }
java
public void animateProgress(List<Boolean> circlePieceFillList, int duration) { mCirclePieceFillList = circlePieceFillList; AnimatorSet set = new AnimatorSet(); set.playTogether(Glider.glide(Skill.QuadEaseInOut, duration, ObjectAnimator.ofFloat(this, "progress", 0, 100))); set.setDuration(duration); set = addListenersToSet(set); set.start(); }
[ "public", "void", "animateProgress", "(", "List", "<", "Boolean", ">", "circlePieceFillList", ",", "int", "duration", ")", "{", "mCirclePieceFillList", "=", "circlePieceFillList", ";", "AnimatorSet", "set", "=", "new", "AnimatorSet", "(", ")", ";", "set", ".", ...
Animate the change in progress of this view @param duration The the time to run the animation over
[ "Animate", "the", "change", "in", "progress", "of", "this", "view" ]
train
https://github.com/omadahealth/CircularBarPager/blob/3a43e8828849da727fd13345e83b8432f7271155/library/src/main/java/com/github/omadahealth/circularbarpager/library/CircularBar.java#L619-L626
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.NOSCRIPT
public static HtmlTree NOSCRIPT(Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.NOSCRIPT, nullCheck(body)); return htmltree; }
java
public static HtmlTree NOSCRIPT(Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.NOSCRIPT, nullCheck(body)); return htmltree; }
[ "public", "static", "HtmlTree", "NOSCRIPT", "(", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "NOSCRIPT", ",", "nullCheck", "(", "body", ")", ")", ";", "return", "htmltree", ";", "}" ]
Generates a NOSCRIPT tag with some content. @param body content of the noscript tag @return an HtmlTree object for the NOSCRIPT tag
[ "Generates", "a", "NOSCRIPT", "tag", "with", "some", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L615-L618
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java
CheckpointCoordinator.triggerSavepoint
public CompletableFuture<CompletedCheckpoint> triggerSavepoint( final long timestamp, @Nullable final String targetLocation) { final CheckpointProperties properties = CheckpointProperties.forSavepoint(); return triggerSavepointInternal(timestamp, properties, false, targetLocation); }
java
public CompletableFuture<CompletedCheckpoint> triggerSavepoint( final long timestamp, @Nullable final String targetLocation) { final CheckpointProperties properties = CheckpointProperties.forSavepoint(); return triggerSavepointInternal(timestamp, properties, false, targetLocation); }
[ "public", "CompletableFuture", "<", "CompletedCheckpoint", ">", "triggerSavepoint", "(", "final", "long", "timestamp", ",", "@", "Nullable", "final", "String", "targetLocation", ")", "{", "final", "CheckpointProperties", "properties", "=", "CheckpointProperties", ".", ...
Triggers a savepoint with the given savepoint directory as a target. @param timestamp The timestamp for the savepoint. @param targetLocation Target location for the savepoint, optional. If null, the state backend's configured default will be used. @return A future to the completed checkpoint @throws IllegalStateException If no savepoint directory has been specified and no default savepoint directory has been configured
[ "Triggers", "a", "savepoint", "with", "the", "given", "savepoint", "directory", "as", "a", "target", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L370-L376
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/viewer/MapTileViewerModel.java
MapTileViewerModel.renderHorizontal
private void renderHorizontal(Graphic g, int ty, double viewY) { final int inTileWidth = (int) Math.ceil(viewer.getWidth() / (double) map.getTileWidth()); final int sx = (int) Math.floor((viewer.getX() + viewer.getViewX()) / map.getTileWidth()); final double viewX = viewer.getX(); for (int h = 0; h <= inTileWidth; h++) { final int tx = h + sx; if (!(tx < 0 || tx >= map.getInTileWidth())) { renderTile(g, tx, ty, viewX, viewY); } } }
java
private void renderHorizontal(Graphic g, int ty, double viewY) { final int inTileWidth = (int) Math.ceil(viewer.getWidth() / (double) map.getTileWidth()); final int sx = (int) Math.floor((viewer.getX() + viewer.getViewX()) / map.getTileWidth()); final double viewX = viewer.getX(); for (int h = 0; h <= inTileWidth; h++) { final int tx = h + sx; if (!(tx < 0 || tx >= map.getInTileWidth())) { renderTile(g, tx, ty, viewX, viewY); } } }
[ "private", "void", "renderHorizontal", "(", "Graphic", "g", ",", "int", "ty", ",", "double", "viewY", ")", "{", "final", "int", "inTileWidth", "=", "(", "int", ")", "Math", ".", "ceil", "(", "viewer", ".", "getWidth", "(", ")", "/", "(", "double", ")...
Render horizontal tiles. @param g The graphic output. @param ty The current vertical tile location. @param viewY The vertical view offset.
[ "Render", "horizontal", "tiles", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/viewer/MapTileViewerModel.java#L97-L111
line/armeria
core/src/main/java/com/linecorp/armeria/server/throttling/ThrottlingHttpService.java
ThrottlingHttpService.newDecorator
public static Function<Service<HttpRequest, HttpResponse>, ThrottlingHttpService> newDecorator(ThrottlingStrategy<HttpRequest> strategy) { requireNonNull(strategy, "strategy"); return delegate -> new ThrottlingHttpService(delegate, strategy); }
java
public static Function<Service<HttpRequest, HttpResponse>, ThrottlingHttpService> newDecorator(ThrottlingStrategy<HttpRequest> strategy) { requireNonNull(strategy, "strategy"); return delegate -> new ThrottlingHttpService(delegate, strategy); }
[ "public", "static", "Function", "<", "Service", "<", "HttpRequest", ",", "HttpResponse", ">", ",", "ThrottlingHttpService", ">", "newDecorator", "(", "ThrottlingStrategy", "<", "HttpRequest", ">", "strategy", ")", "{", "requireNonNull", "(", "strategy", ",", "\"st...
Creates a new decorator using the specified {@link ThrottlingStrategy} instance. @param strategy The {@link ThrottlingStrategy} instance to be used
[ "Creates", "a", "new", "decorator", "using", "the", "specified", "{", "@link", "ThrottlingStrategy", "}", "instance", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/throttling/ThrottlingHttpService.java#L39-L43
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiView.java
FactoryMultiView.fundamental_1
public static Estimate1ofEpipolar fundamental_1(EnumFundamental which, int numRemoveAmbiguity) { switch( which ) { case LINEAR_8: return new WrapFundamentalLinear8(true); } if( numRemoveAmbiguity <= 0 ) throw new IllegalArgumentException("numRemoveAmbiguity must be greater than zero"); EstimateNofEpipolar alg = fundamental_N(which); DistanceEpipolarConstraint distance = new DistanceEpipolarConstraint(); return new EstimateNto1ofEpipolar(alg,distance,numRemoveAmbiguity); }
java
public static Estimate1ofEpipolar fundamental_1(EnumFundamental which, int numRemoveAmbiguity) { switch( which ) { case LINEAR_8: return new WrapFundamentalLinear8(true); } if( numRemoveAmbiguity <= 0 ) throw new IllegalArgumentException("numRemoveAmbiguity must be greater than zero"); EstimateNofEpipolar alg = fundamental_N(which); DistanceEpipolarConstraint distance = new DistanceEpipolarConstraint(); return new EstimateNto1ofEpipolar(alg,distance,numRemoveAmbiguity); }
[ "public", "static", "Estimate1ofEpipolar", "fundamental_1", "(", "EnumFundamental", "which", ",", "int", "numRemoveAmbiguity", ")", "{", "switch", "(", "which", ")", "{", "case", "LINEAR_8", ":", "return", "new", "WrapFundamentalLinear8", "(", "true", ")", ";", ...
<p> Similar to {@link #fundamental_N}, but it returns only a single hypothesis. If the underlying algorithm generates multiple hypotheses they are resolved by considering additional sample points. For example, if you are using the 7 point algorithm at least one additional sample point is required to resolve that ambiguity. So 8 or more sample points are now required. </p> <p> All estimated epipolar matrices will have the following constraint:<br> x'*F*x = 0, where F is the epipolar matrix, x' = currLoc, and x = keyLoc. </p> <p> See {@link #fundamental_N} for a description of the algorithms and what 'minimumSamples' and 'isFundamental' do. </p> <p> The 8-point algorithm already returns a single hypothesis and ignores the 'numRemoveAmbiguity' parameter. All other algorithms require one or more points to remove ambiguity. Understanding a bit of theory is required to understand what a good number of points is. If a single point is used then to select the correct answer that point must be in the inlier set. If more than one point, say 10, then not all of those points must be in the inlier set, </p> @see GeoModelEstimatorNto1 @param which Specifies which algorithm is to be created @param numRemoveAmbiguity Number of sample points used to prune hypotheses. Ignored if only a single solution. @return Fundamental or essential estimation algorithm that returns a single hypothesis.
[ "<p", ">", "Similar", "to", "{", "@link", "#fundamental_N", "}", "but", "it", "returns", "only", "a", "single", "hypothesis", ".", "If", "the", "underlying", "algorithm", "generates", "multiple", "hypotheses", "they", "are", "resolved", "by", "considering", "a...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiView.java#L328-L342
vladmihalcea/flexy-pool
flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java
ReflectionUtils.getSetter
public static Method getSetter(Object target, String property, Class<?> parameterType) { String setterMethodName = SETTER_PREFIX + property.substring(0, 1).toUpperCase() + property.substring(1); return getMethod(target, setterMethodName, parameterType); }
java
public static Method getSetter(Object target, String property, Class<?> parameterType) { String setterMethodName = SETTER_PREFIX + property.substring(0, 1).toUpperCase() + property.substring(1); return getMethod(target, setterMethodName, parameterType); }
[ "public", "static", "Method", "getSetter", "(", "Object", "target", ",", "String", "property", ",", "Class", "<", "?", ">", "parameterType", ")", "{", "String", "setterMethodName", "=", "SETTER_PREFIX", "+", "property", ".", "substring", "(", "0", ",", "1", ...
Get setter method @param target target object @param property property @param parameterType setter parameter type @return setter method
[ "Get", "setter", "method" ]
train
https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java#L109-L112
jenkinsci/github-plugin
src/main/java/org/jenkinsci/plugins/github/status/sources/misc/AnyBuildResult.java
AnyBuildResult.onAnyResult
public static AnyBuildResult onAnyResult(GHCommitState state, String msg) { AnyBuildResult cond = new AnyBuildResult(); cond.setState(state.name()); cond.setMessage(msg); return cond; }
java
public static AnyBuildResult onAnyResult(GHCommitState state, String msg) { AnyBuildResult cond = new AnyBuildResult(); cond.setState(state.name()); cond.setMessage(msg); return cond; }
[ "public", "static", "AnyBuildResult", "onAnyResult", "(", "GHCommitState", "state", ",", "String", "msg", ")", "{", "AnyBuildResult", "cond", "=", "new", "AnyBuildResult", "(", ")", ";", "cond", ".", "setState", "(", "state", ".", "name", "(", ")", ")", ";...
@param state state to set @param msg message to set. Can contain env vars @return new instance of this conditional result
[ "@param", "state", "state", "to", "set", "@param", "msg", "message", "to", "set", ".", "Can", "contain", "env", "vars" ]
train
https://github.com/jenkinsci/github-plugin/blob/4e05b9aeb488af5342c78f78aa3c55114e8d462a/src/main/java/org/jenkinsci/plugins/github/status/sources/misc/AnyBuildResult.java#L37-L42
jfinal/jfinal
src/main/java/com/jfinal/plugin/redis/Cache.java
Cache.pexpireAt
public Long pexpireAt(Object key, long millisecondsTimestamp) { Jedis jedis = getJedis(); try { return jedis.pexpireAt(keyToBytes(key), millisecondsTimestamp); } finally {close(jedis);} }
java
public Long pexpireAt(Object key, long millisecondsTimestamp) { Jedis jedis = getJedis(); try { return jedis.pexpireAt(keyToBytes(key), millisecondsTimestamp); } finally {close(jedis);} }
[ "public", "Long", "pexpireAt", "(", "Object", "key", ",", "long", "millisecondsTimestamp", ")", "{", "Jedis", "jedis", "=", "getJedis", "(", ")", ";", "try", "{", "return", "jedis", ".", "pexpireAt", "(", "keyToBytes", "(", "key", ")", ",", "millisecondsTi...
这个命令和 EXPIREAT 命令类似,但它以毫秒为单位设置 key 的过期 unix 时间戳,而不是像 EXPIREAT 那样,以秒为单位。
[ "这个命令和", "EXPIREAT", "命令类似,但它以毫秒为单位设置", "key", "的过期", "unix", "时间戳,而不是像", "EXPIREAT", "那样,以秒为单位。" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L351-L357
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/UtilChecksum.java
UtilChecksum.checkSha
public static boolean checkSha(String value, String signature) { Check.notNull(signature); return Arrays.equals(getSha(value).getBytes(StandardCharsets.UTF_8), signature.getBytes(StandardCharsets.UTF_8)); }
java
public static boolean checkSha(String value, String signature) { Check.notNull(signature); return Arrays.equals(getSha(value).getBytes(StandardCharsets.UTF_8), signature.getBytes(StandardCharsets.UTF_8)); }
[ "public", "static", "boolean", "checkSha", "(", "String", "value", ",", "String", "signature", ")", "{", "Check", ".", "notNull", "(", "signature", ")", ";", "return", "Arrays", ".", "equals", "(", "getSha", "(", "value", ")", ".", "getBytes", "(", "Stan...
Compare a checksum with its supposed original value. @param value The original value (must not be <code>null</code>). @param signature The checksum value (must not be <code>null</code>). @return <code>true</code> if corresponding (checksum of value is equal to its signature), <code>false</code> else. @throws LionEngineException If invalid arguments.
[ "Compare", "a", "checksum", "with", "its", "supposed", "original", "value", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilChecksum.java#L49-L55
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java
IndexChangeAdapters.forMultipleColumns
public static IndexChangeAdapter forMultipleColumns( ExecutionContext context, NodeTypePredicate matcher, String workspaceName, ProvidedIndex<?> index, Iterable<IndexChangeAdapter> adapters ) { return new MultiColumnChangeAdapter(context ,workspaceName, matcher, index, adapters); }
java
public static IndexChangeAdapter forMultipleColumns( ExecutionContext context, NodeTypePredicate matcher, String workspaceName, ProvidedIndex<?> index, Iterable<IndexChangeAdapter> adapters ) { return new MultiColumnChangeAdapter(context ,workspaceName, matcher, index, adapters); }
[ "public", "static", "IndexChangeAdapter", "forMultipleColumns", "(", "ExecutionContext", "context", ",", "NodeTypePredicate", "matcher", ",", "String", "workspaceName", ",", "ProvidedIndex", "<", "?", ">", "index", ",", "Iterable", "<", "IndexChangeAdapter", ">", "ada...
Creates a composite change adapter which handles the case when an index has multiple columns. @param context the execution context; may not be null @param matcher the node type matcher used to determine which nodes should be included in the index; may not be null @param workspaceName the name of the workspace; may not be null @param index the index that should be used; may not be null @param adapters an {@link Iterable} of existing "discrete" adapters. @return the new {@link IndexChangeAdapter}; never null
[ "Creates", "a", "composite", "change", "adapter", "which", "handles", "the", "case", "when", "an", "index", "has", "multiple", "columns", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/provider/IndexChangeAdapters.java#L63-L69
reactor/reactor-netty
src/main/java/reactor/netty/ByteBufMono.java
ByteBufMono.asString
public final Mono<String> asString(Charset charset) { return handle((bb, sink) -> { try { sink.next(bb.readCharSequence(bb.readableBytes(), charset).toString()); } catch (IllegalReferenceCountException e) { sink.complete(); } }); }
java
public final Mono<String> asString(Charset charset) { return handle((bb, sink) -> { try { sink.next(bb.readCharSequence(bb.readableBytes(), charset).toString()); } catch (IllegalReferenceCountException e) { sink.complete(); } }); }
[ "public", "final", "Mono", "<", "String", ">", "asString", "(", "Charset", "charset", ")", "{", "return", "handle", "(", "(", "bb", ",", "sink", ")", "->", "{", "try", "{", "sink", ".", "next", "(", "bb", ".", "readCharSequence", "(", "bb", ".", "r...
a {@link String} inbound {@link Mono} @param charset the decoding charset @return a {@link String} inbound {@link Mono}
[ "a", "{", "@link", "String", "}", "inbound", "{", "@link", "Mono", "}" ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/ByteBufMono.java#L90-L99
netty/netty
buffer/src/main/java/io/netty/buffer/PoolThreadCache.java
PoolThreadCache.allocateNormal
boolean allocateNormal(PoolArena<?> area, PooledByteBuf<?> buf, int reqCapacity, int normCapacity) { return allocate(cacheForNormal(area, normCapacity), buf, reqCapacity); }
java
boolean allocateNormal(PoolArena<?> area, PooledByteBuf<?> buf, int reqCapacity, int normCapacity) { return allocate(cacheForNormal(area, normCapacity), buf, reqCapacity); }
[ "boolean", "allocateNormal", "(", "PoolArena", "<", "?", ">", "area", ",", "PooledByteBuf", "<", "?", ">", "buf", ",", "int", "reqCapacity", ",", "int", "normCapacity", ")", "{", "return", "allocate", "(", "cacheForNormal", "(", "area", ",", "normCapacity", ...
Try to allocate a small buffer out of the cache. Returns {@code true} if successful {@code false} otherwise
[ "Try", "to", "allocate", "a", "small", "buffer", "out", "of", "the", "cache", ".", "Returns", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/PoolThreadCache.java#L179-L181
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/TrueTypeFont.java
TrueTypeFont.drawString
public void drawString(float x, float y, String whatchars) { drawString(x, y, whatchars, org.newdawn.slick.Color.white); }
java
public void drawString(float x, float y, String whatchars) { drawString(x, y, whatchars, org.newdawn.slick.Color.white); }
[ "public", "void", "drawString", "(", "float", "x", ",", "float", "y", ",", "String", "whatchars", ")", "{", "drawString", "(", "x", ",", "y", ",", "whatchars", ",", "org", ".", "newdawn", ".", "slick", ".", "Color", ".", "white", ")", ";", "}" ]
Draw a string @param x The x position to draw the string @param y The y position to draw the string @param whatchars The string to draw
[ "Draw", "a", "string" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/TrueTypeFont.java#L405-L407
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/CertificatesInner.java
CertificatesInner.generateVerificationCodeAsync
public Observable<CertificateWithNonceDescriptionInner> generateVerificationCodeAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch) { return generateVerificationCodeWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch).map(new Func1<ServiceResponse<CertificateWithNonceDescriptionInner>, CertificateWithNonceDescriptionInner>() { @Override public CertificateWithNonceDescriptionInner call(ServiceResponse<CertificateWithNonceDescriptionInner> response) { return response.body(); } }); }
java
public Observable<CertificateWithNonceDescriptionInner> generateVerificationCodeAsync(String resourceGroupName, String resourceName, String certificateName, String ifMatch) { return generateVerificationCodeWithServiceResponseAsync(resourceGroupName, resourceName, certificateName, ifMatch).map(new Func1<ServiceResponse<CertificateWithNonceDescriptionInner>, CertificateWithNonceDescriptionInner>() { @Override public CertificateWithNonceDescriptionInner call(ServiceResponse<CertificateWithNonceDescriptionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CertificateWithNonceDescriptionInner", ">", "generateVerificationCodeAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "certificateName", ",", "String", "ifMatch", ")", "{", "return", "generateVerificatio...
Generate verification code for proof of possession flow. Generates verification code for proof of possession flow. The verification code will be used to generate a leaf certificate. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param certificateName The name of the certificate @param ifMatch ETag of the Certificate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificateWithNonceDescriptionInner object
[ "Generate", "verification", "code", "for", "proof", "of", "possession", "flow", ".", "Generates", "verification", "code", "for", "proof", "of", "possession", "flow", ".", "The", "verification", "code", "will", "be", "used", "to", "generate", "a", "leaf", "cert...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/CertificatesInner.java#L623-L630
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/MultiPathImpl.java
MultiPathImpl.addEnvelope
public void addEnvelope(Envelope envSrc, boolean bReverse) { if (envSrc.isEmpty()) return; boolean bWasEmpty = m_pointCount == 0; Point pt = new Point(m_description);// getDescription()); for (int i = 0, n = 4; i < n; i++) { int j = bReverse ? n - i - 1 : i; envSrc.queryCornerByVal(j, pt); if (i == 0) startPath(pt); else lineTo(pt); } closePathWithLine(); m_bPathStarted = false; if (bWasEmpty && !bReverse) _setDirtyFlag(DirtyFlags.DirtyIsEnvelope, false);// now we know the // polypath is // envelope }
java
public void addEnvelope(Envelope envSrc, boolean bReverse) { if (envSrc.isEmpty()) return; boolean bWasEmpty = m_pointCount == 0; Point pt = new Point(m_description);// getDescription()); for (int i = 0, n = 4; i < n; i++) { int j = bReverse ? n - i - 1 : i; envSrc.queryCornerByVal(j, pt); if (i == 0) startPath(pt); else lineTo(pt); } closePathWithLine(); m_bPathStarted = false; if (bWasEmpty && !bReverse) _setDirtyFlag(DirtyFlags.DirtyIsEnvelope, false);// now we know the // polypath is // envelope }
[ "public", "void", "addEnvelope", "(", "Envelope", "envSrc", ",", "boolean", "bReverse", ")", "{", "if", "(", "envSrc", ".", "isEmpty", "(", ")", ")", "return", ";", "boolean", "bWasEmpty", "=", "m_pointCount", "==", "0", ";", "Point", "pt", "=", "new", ...
adds a rectangular closed Path to the MultiPathImpl. @param envSrc is the source rectangle. @param bReverse Creates reversed path.
[ "adds", "a", "rectangular", "closed", "Path", "to", "the", "MultiPathImpl", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/MultiPathImpl.java#L657-L680
JohnPersano/SuperToasts
library/src/main/java/com/github/johnpersano/supertoasts/library/Toaster.java
Toaster.sendDelayedMessage
private void sendDelayedMessage(SuperToast superToast, int messageId, long delay) { Message message = obtainMessage(messageId); message.obj = superToast; sendMessageDelayed(message, delay); }
java
private void sendDelayedMessage(SuperToast superToast, int messageId, long delay) { Message message = obtainMessage(messageId); message.obj = superToast; sendMessageDelayed(message, delay); }
[ "private", "void", "sendDelayedMessage", "(", "SuperToast", "superToast", ",", "int", "messageId", ",", "long", "delay", ")", "{", "Message", "message", "=", "obtainMessage", "(", "messageId", ")", ";", "message", ".", "obj", "=", "superToast", ";", "sendMessa...
Send a message at a later time. This is used to dismiss a SuperToast.
[ "Send", "a", "message", "at", "a", "later", "time", ".", "This", "is", "used", "to", "dismiss", "a", "SuperToast", "." ]
train
https://github.com/JohnPersano/SuperToasts/blob/5394db6a2f5c38410586d5d001d61f731da1132a/library/src/main/java/com/github/johnpersano/supertoasts/library/Toaster.java#L122-L126
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java
AlignedBox3f.setFromCorners
@Override public void setFromCorners(double x1, double y1, double z1, double x2, double y2, double z2) { if (x1<x2) { this.minx = x1; this.maxx = x2; } else { this.minx = x2; this.maxx = x1; } if (y1<y2) { this.miny = y1; this.maxy = y2; } else { this.miny = y2; this.maxy = y1; } if (z1<z2) { this.minz = z1; this.maxz = z2; } else { this.minz = z2; this.maxz = z1; } }
java
@Override public void setFromCorners(double x1, double y1, double z1, double x2, double y2, double z2) { if (x1<x2) { this.minx = x1; this.maxx = x2; } else { this.minx = x2; this.maxx = x1; } if (y1<y2) { this.miny = y1; this.maxy = y2; } else { this.miny = y2; this.maxy = y1; } if (z1<z2) { this.minz = z1; this.maxz = z2; } else { this.minz = z2; this.maxz = z1; } }
[ "@", "Override", "public", "void", "setFromCorners", "(", "double", "x1", ",", "double", "y1", ",", "double", "z1", ",", "double", "x2", ",", "double", "y2", ",", "double", "z2", ")", "{", "if", "(", "x1", "<", "x2", ")", "{", "this", ".", "minx", ...
Change the frame of the box. @param x1 is the coordinate of the first corner. @param y1 is the coordinate of the first corner. @param z1 is the coordinate of the first corner. @param x2 is the coordinate of the second corner. @param y2 is the coordinate of the second corner. @param z2 is the coordinate of the second corner.
[ "Change", "the", "frame", "of", "the", "box", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java#L300-L326
alibaba/vlayout
vlayout/src/main/java/com/alibaba/android/vlayout/ExposeLinearLayoutManagerEx.java
ExposeLinearLayoutManagerEx.scrollToPositionWithOffset
public void scrollToPositionWithOffset(int position, int offset) { mCurrentPendingScrollPosition = position; mPendingScrollPositionOffset = offset; if (mCurrentPendingSavedState != null) { mCurrentPendingSavedState.putInt("AnchorPosition", RecyclerView.NO_POSITION); } requestLayout(); }
java
public void scrollToPositionWithOffset(int position, int offset) { mCurrentPendingScrollPosition = position; mPendingScrollPositionOffset = offset; if (mCurrentPendingSavedState != null) { mCurrentPendingSavedState.putInt("AnchorPosition", RecyclerView.NO_POSITION); } requestLayout(); }
[ "public", "void", "scrollToPositionWithOffset", "(", "int", "position", ",", "int", "offset", ")", "{", "mCurrentPendingScrollPosition", "=", "position", ";", "mPendingScrollPositionOffset", "=", "offset", ";", "if", "(", "mCurrentPendingSavedState", "!=", "null", ")"...
Scroll to the specified adapter position with the given offset from resolved layout start. Resolved layout start depends on {@link #getReverseLayout()}, {@link ViewCompat#getLayoutDirection(View)} and {@link #getStackFromEnd()}. <p/> For example, if layout is {@link #VERTICAL} and {@link #getStackFromEnd()} is true, calling <code>scrollToPositionWithOffset(10, 20)</code> will layout such that <code>item[10]</code>'s bottom is 20 pixels above the RecyclerView's bottom. <p/> Note that scroll position change will not be reflected until the next layout call. <p/> <p/> If you are just trying to make a position visible, use {@link #scrollToPosition(int)}. @param position Index (starting at 0) of the reference item. @param offset The distance (in pixels) between the start edge of the item view and start edge of the RecyclerView. @see #setReverseLayout(boolean) @see #scrollToPosition(int)
[ "Scroll", "to", "the", "specified", "adapter", "position", "with", "the", "given", "offset", "from", "resolved", "layout", "start", ".", "Resolved", "layout", "start", "depends", "on", "{", "@link", "#getReverseLayout", "()", "}", "{", "@link", "ViewCompat#getLa...
train
https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/ExposeLinearLayoutManagerEx.java#L867-L874
anotheria/configureme
src/main/java/org/configureme/mbean/util/MBeanRegisterUtil.java
MBeanRegisterUtil.regMBean
public static void regMBean(final Object object, final String... parameters) { try { final String name = buildObjectName(object, parameters); final ObjectName objectName = new ObjectName(name); if (mbs.isRegistered(objectName)) return; mbs.registerMBean(object, objectName); } catch (final MalformedObjectNameException | InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException e) { log.error("can't register mbean regMBean("+object+", "+ Arrays.toString(parameters)+ ')', e); } catch (final AccessControlException e){ log.error("Access denied, can no register mbean add permission javax.management.MBeanTrustPermission \"register\"; to java.policy file", e); } }
java
public static void regMBean(final Object object, final String... parameters) { try { final String name = buildObjectName(object, parameters); final ObjectName objectName = new ObjectName(name); if (mbs.isRegistered(objectName)) return; mbs.registerMBean(object, objectName); } catch (final MalformedObjectNameException | InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException e) { log.error("can't register mbean regMBean("+object+", "+ Arrays.toString(parameters)+ ')', e); } catch (final AccessControlException e){ log.error("Access denied, can no register mbean add permission javax.management.MBeanTrustPermission \"register\"; to java.policy file", e); } }
[ "public", "static", "void", "regMBean", "(", "final", "Object", "object", ",", "final", "String", "...", "parameters", ")", "{", "try", "{", "final", "String", "name", "=", "buildObjectName", "(", "object", ",", "parameters", ")", ";", "final", "ObjectName",...
Register mBean object in {@link javax.management.MBeanServer}. @param object provided object @param parameters additional parameters
[ "Register", "mBean", "object", "in", "{", "@link", "javax", ".", "management", ".", "MBeanServer", "}", "." ]
train
https://github.com/anotheria/configureme/blob/1f52dd9109349623190586bdf5a592de8016e1fa/src/main/java/org/configureme/mbean/util/MBeanRegisterUtil.java#L38-L50
google/auto
value/src/main/java/com/google/auto/value/processor/TypeVariables.java
TypeVariables.rewriteReturnTypes
static ImmutableMap<ExecutableElement, TypeMirror> rewriteReturnTypes( Elements elementUtils, Types typeUtils, Collection<ExecutableElement> methods, TypeElement sourceType, TypeElement targetType) { List<? extends TypeParameterElement> sourceTypeParameters = sourceType.getTypeParameters(); List<? extends TypeParameterElement> targetTypeParameters = targetType.getTypeParameters(); Preconditions.checkArgument( sourceTypeParameters.toString().equals(targetTypeParameters.toString()), "%s != %s", sourceTypeParameters, targetTypeParameters); // What we're doing is only valid if the type parameters are "the same". The check here even // requires the names to be the same. The logic would still work without that, but we impose // that requirement elsewhere and it means we can check in this simple way. EclipseHack eclipseHack = new EclipseHack(elementUtils, typeUtils); TypeMirror[] targetTypeParameterMirrors = new TypeMirror[targetTypeParameters.size()]; for (int i = 0; i < targetTypeParameters.size(); i++) { targetTypeParameterMirrors[i] = targetTypeParameters.get(i).asType(); } DeclaredType parallelSource = typeUtils.getDeclaredType(sourceType, targetTypeParameterMirrors); return methods.stream() .collect( ImmutableMap.toImmutableMap( m -> m, m -> eclipseHack.methodReturnType(m, parallelSource))); }
java
static ImmutableMap<ExecutableElement, TypeMirror> rewriteReturnTypes( Elements elementUtils, Types typeUtils, Collection<ExecutableElement> methods, TypeElement sourceType, TypeElement targetType) { List<? extends TypeParameterElement> sourceTypeParameters = sourceType.getTypeParameters(); List<? extends TypeParameterElement> targetTypeParameters = targetType.getTypeParameters(); Preconditions.checkArgument( sourceTypeParameters.toString().equals(targetTypeParameters.toString()), "%s != %s", sourceTypeParameters, targetTypeParameters); // What we're doing is only valid if the type parameters are "the same". The check here even // requires the names to be the same. The logic would still work without that, but we impose // that requirement elsewhere and it means we can check in this simple way. EclipseHack eclipseHack = new EclipseHack(elementUtils, typeUtils); TypeMirror[] targetTypeParameterMirrors = new TypeMirror[targetTypeParameters.size()]; for (int i = 0; i < targetTypeParameters.size(); i++) { targetTypeParameterMirrors[i] = targetTypeParameters.get(i).asType(); } DeclaredType parallelSource = typeUtils.getDeclaredType(sourceType, targetTypeParameterMirrors); return methods.stream() .collect( ImmutableMap.toImmutableMap( m -> m, m -> eclipseHack.methodReturnType(m, parallelSource))); }
[ "static", "ImmutableMap", "<", "ExecutableElement", ",", "TypeMirror", ">", "rewriteReturnTypes", "(", "Elements", "elementUtils", ",", "Types", "typeUtils", ",", "Collection", "<", "ExecutableElement", ">", "methods", ",", "TypeElement", "sourceType", ",", "TypeEleme...
Returns a map from methods to return types, where the return types are not necessarily the original return types of the methods. Consider this example: <pre> &#64;AutoValue class {@code Foo<T>} { abstract T getFoo(); &#64;AutoValue.Builder abstract class {@code Builder<T>} { abstract Builder setFoo(T t); abstract {@code Foo<T>} build(); } } </pre> We want to be able to check that the parameter type of {@code setFoo} is the same as the return type of {@code getFoo}. But in fact it isn't, because the {@code T} of {@code Foo<T>} is not the same as the {@code T} of {@code Foo.Builder<T>}. So we create a parallel {@code Foo<T>} where the {@code T} <i>is</i> the one from {@code Foo.Builder<T>}. That way the types do correspond. This method then returns the return types of the given methods as they appear in that parallel class, meaning the type given for {@code getFoo()} is the {@code T} of {@code Foo.Builder<T>}. <p>We do the rewrite this way around (applying the type parameter from {@code Foo.Builder} to {@code Foo}) because if we hit one of the historical Eclipse bugs with {@link Types#asMemberOf} then {@link EclipseHack#methodReturnType} can use fallback logic, which only works for methods with no arguments. @param methods the methods whose return types are to be rewritten. @param sourceType the class containing those methods ({@code Foo} in the example). @param targetType the class to translate the methods into ({@code Foo.Builder<T>}) in the example.
[ "Returns", "a", "map", "from", "methods", "to", "return", "types", "where", "the", "return", "types", "are", "not", "necessarily", "the", "original", "return", "types", "of", "the", "methods", ".", "Consider", "this", "example", ":" ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/value/src/main/java/com/google/auto/value/processor/TypeVariables.java#L81-L107
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.getAccessControlList
public CmsAccessControlList getAccessControlList(CmsDbContext dbc, CmsResource resource, boolean inheritedOnly) throws CmsException { return getAccessControlList(dbc, resource, inheritedOnly, resource.isFolder(), 0); }
java
public CmsAccessControlList getAccessControlList(CmsDbContext dbc, CmsResource resource, boolean inheritedOnly) throws CmsException { return getAccessControlList(dbc, resource, inheritedOnly, resource.isFolder(), 0); }
[ "public", "CmsAccessControlList", "getAccessControlList", "(", "CmsDbContext", "dbc", ",", "CmsResource", "resource", ",", "boolean", "inheritedOnly", ")", "throws", "CmsException", "{", "return", "getAccessControlList", "(", "dbc", ",", "resource", ",", "inheritedOnly"...
Returns the access control list of a given resource.<p> If <code>inheritedOnly</code> is set, only inherited access control entries are returned.<p> Note: For file resources, *all* permissions set at the immediate parent folder are inherited, not only these marked to inherit. @param dbc the current database context @param resource the resource @param inheritedOnly skip non-inherited entries if set @return the access control list of the resource @throws CmsException if something goes wrong
[ "Returns", "the", "access", "control", "list", "of", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L3481-L3485
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java
AbstractHibernateDao.getAllBySql
public List< T> getAllBySql(String fullSql, Object[] paramValues, Type[] paramTypes) { return getAllBySql(fullSql, paramValues, paramTypes, null, null); }
java
public List< T> getAllBySql(String fullSql, Object[] paramValues, Type[] paramTypes) { return getAllBySql(fullSql, paramValues, paramTypes, null, null); }
[ "public", "List", "<", "T", ">", "getAllBySql", "(", "String", "fullSql", ",", "Object", "[", "]", "paramValues", ",", "Type", "[", "]", "paramTypes", ")", "{", "return", "getAllBySql", "(", "fullSql", ",", "paramValues", ",", "paramTypes", ",", "null", ...
Get all by SQL with pairs of parameterType-value @param fullSql @param paramValues @param paramTypes @return the query result
[ "Get", "all", "by", "SQL", "with", "pairs", "of", "parameterType", "-", "value" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L243-L245
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java
DisksInner.beginUpdateAsync
public Observable<DiskInner> beginUpdateAsync(String resourceGroupName, String diskName, DiskUpdate disk) { return beginUpdateWithServiceResponseAsync(resourceGroupName, diskName, disk).map(new Func1<ServiceResponse<DiskInner>, DiskInner>() { @Override public DiskInner call(ServiceResponse<DiskInner> response) { return response.body(); } }); }
java
public Observable<DiskInner> beginUpdateAsync(String resourceGroupName, String diskName, DiskUpdate disk) { return beginUpdateWithServiceResponseAsync(resourceGroupName, diskName, disk).map(new Func1<ServiceResponse<DiskInner>, DiskInner>() { @Override public DiskInner call(ServiceResponse<DiskInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DiskInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "diskName", ",", "DiskUpdate", "disk", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "diskName", ",", "dis...
Updates (patches) a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @param disk Disk object supplied in the body of the Patch disk operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DiskInner object
[ "Updates", "(", "patches", ")", "a", "disk", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L420-L427
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteLinksInner.java
ExpressRouteLinksInner.get
public ExpressRouteLinkInner get(String resourceGroupName, String expressRoutePortName, String linkName) { return getWithServiceResponseAsync(resourceGroupName, expressRoutePortName, linkName).toBlocking().single().body(); }
java
public ExpressRouteLinkInner get(String resourceGroupName, String expressRoutePortName, String linkName) { return getWithServiceResponseAsync(resourceGroupName, expressRoutePortName, linkName).toBlocking().single().body(); }
[ "public", "ExpressRouteLinkInner", "get", "(", "String", "resourceGroupName", ",", "String", "expressRoutePortName", ",", "String", "linkName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "expressRoutePortName", ",", "linkName", ")", ...
Retrieves the specified ExpressRouteLink resource. @param resourceGroupName The name of the resource group. @param expressRoutePortName The name of the ExpressRoutePort resource. @param linkName The name of the ExpressRouteLink resource. @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 ExpressRouteLinkInner object if successful.
[ "Retrieves", "the", "specified", "ExpressRouteLink", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteLinksInner.java#L85-L87
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.parseProperties
public void parseProperties(Element element, ActivityImpl activity) { List<Element> propertyElements = element.elements("property"); for (Element propertyElement : propertyElements) { parseProperty(propertyElement, activity); } }
java
public void parseProperties(Element element, ActivityImpl activity) { List<Element> propertyElements = element.elements("property"); for (Element propertyElement : propertyElements) { parseProperty(propertyElement, activity); } }
[ "public", "void", "parseProperties", "(", "Element", "element", ",", "ActivityImpl", "activity", ")", "{", "List", "<", "Element", ">", "propertyElements", "=", "element", ".", "elements", "(", "\"property\"", ")", ";", "for", "(", "Element", "propertyElement", ...
Parses the properties of an element (if any) that can contain properties (processes, activities, etc.) Returns true if property subelemens are found. @param element The element that can contain properties. @param activity The activity where the property declaration is done.
[ "Parses", "the", "properties", "of", "an", "element", "(", "if", "any", ")", "that", "can", "contain", "properties", "(", "processes", "activities", "etc", ".", ")" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L3881-L3886
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java
ClassBuilder.getInstance
public static ClassBuilder getInstance(Context context, ClassDoc classDoc, ClassWriter writer) { return new ClassBuilder(context, classDoc, writer); }
java
public static ClassBuilder getInstance(Context context, ClassDoc classDoc, ClassWriter writer) { return new ClassBuilder(context, classDoc, writer); }
[ "public", "static", "ClassBuilder", "getInstance", "(", "Context", "context", ",", "ClassDoc", "classDoc", ",", "ClassWriter", "writer", ")", "{", "return", "new", "ClassBuilder", "(", "context", ",", "classDoc", ",", "writer", ")", ";", "}" ]
Construct a new ClassBuilder. @param context the build context @param classDoc the class being documented. @param writer the doclet specific writer.
[ "Construct", "a", "new", "ClassBuilder", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java#L110-L113
opentok/Opentok-Java-SDK
src/main/java/com/opentok/OpenTok.java
OpenTok.startBroadcast
public Broadcast startBroadcast(String sessionId, BroadcastProperties properties) throws OpenTokException { if (StringUtils.isEmpty(sessionId) || (properties == null)) { throw new InvalidArgumentException("Session not valid or broadcast properties is null"); } String broadcast = this.client.startBroadcast(sessionId, properties); try { return broadcastReader.readValue( broadcast); } catch (Exception e) { throw new RequestException("Exception mapping json: " + e.getMessage()); } }
java
public Broadcast startBroadcast(String sessionId, BroadcastProperties properties) throws OpenTokException { if (StringUtils.isEmpty(sessionId) || (properties == null)) { throw new InvalidArgumentException("Session not valid or broadcast properties is null"); } String broadcast = this.client.startBroadcast(sessionId, properties); try { return broadcastReader.readValue( broadcast); } catch (Exception e) { throw new RequestException("Exception mapping json: " + e.getMessage()); } }
[ "public", "Broadcast", "startBroadcast", "(", "String", "sessionId", ",", "BroadcastProperties", "properties", ")", "throws", "OpenTokException", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "sessionId", ")", "||", "(", "properties", "==", "null", ")", ")...
Use this method to start a live streaming for an OpenTok session. This broadcasts the session to an HLS (HTTP live streaming) or to RTMP streams. <p> To successfully start broadcasting a session, at least one client must be connected to the session. <p> You can only have one active live streaming broadcast at a time for a session (however, having more than one would not be useful). The live streaming broadcast can target one HLS endpoint and up to five RTMP servers simulteneously for a session. You can only start live streaming for sessions that use the OpenTok Media Router (with the media mode set to routed); you cannot use live streaming with sessions that have the media mode set to relayed OpenTok Media Router. See <a href="https://tokbox.com/developer/guides/create-session/#media-mode">The OpenTok Media Router and media modes.</a> <p> For more information on broadcasting, see the <a href="https://tokbox.com/developer/guides/broadcast/">Broadcast developer guide.</a> @param sessionId The session ID of the OpenTok session to broadcast. @param properties This BroadcastProperties object defines options for the broadcast. @return The Broadcast object. This object includes properties defining the broadcast, including the broadcast ID.
[ "Use", "this", "method", "to", "start", "a", "live", "streaming", "for", "an", "OpenTok", "session", ".", "This", "broadcasts", "the", "session", "to", "an", "HLS", "(", "HTTP", "live", "streaming", ")", "or", "to", "RTMP", "streams", ".", "<p", ">", "...
train
https://github.com/opentok/Opentok-Java-SDK/blob/d71b7999facc3131c415aebea874ea55776d477f/src/main/java/com/opentok/OpenTok.java#L531-L543
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java
MailUtil.send
public static void send(String to, String subject, String content, boolean isHtml, File... files) { send(splitAddress(to), subject, content, isHtml, files); }
java
public static void send(String to, String subject, String content, boolean isHtml, File... files) { send(splitAddress(to), subject, content, isHtml, files); }
[ "public", "static", "void", "send", "(", "String", "to", ",", "String", "subject", ",", "String", "content", ",", "boolean", "isHtml", ",", "File", "...", "files", ")", "{", "send", "(", "splitAddress", "(", "to", ")", ",", "subject", ",", "content", "...
使用配置文件中设置的账户发送邮件,发送单个或多个收件人<br> 多个收件人可以使用逗号“,”分隔,也可以通过分号“;”分隔 @param to 收件人 @param subject 标题 @param content 正文 @param isHtml 是否为HTML @param files 附件列表
[ "使用配置文件中设置的账户发送邮件,发送单个或多个收件人<br", ">", "多个收件人可以使用逗号“", "”分隔,也可以通过分号“", ";", "”分隔" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L56-L58
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.checkArgNotNullOrEmptyOrBlank
public static <T extends CharSequence> T checkArgNotNullOrEmptyOrBlank(final T arg, final String msg) { if (N.isNullOrEmptyOrBlank(arg)) { if (isNullErrorMsg(msg)) { throw new IllegalArgumentException(msg); } else { throw new IllegalArgumentException("'" + msg + "' can not be null or empty or blank"); } } return arg; }
java
public static <T extends CharSequence> T checkArgNotNullOrEmptyOrBlank(final T arg, final String msg) { if (N.isNullOrEmptyOrBlank(arg)) { if (isNullErrorMsg(msg)) { throw new IllegalArgumentException(msg); } else { throw new IllegalArgumentException("'" + msg + "' can not be null or empty or blank"); } } return arg; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "checkArgNotNullOrEmptyOrBlank", "(", "final", "T", "arg", ",", "final", "String", "msg", ")", "{", "if", "(", "N", ".", "isNullOrEmptyOrBlank", "(", "arg", ")", ")", "{", "if", "(", "isN...
DON'T change 'OrEmptyOrBlank' to 'OrBlank' because of the occurring order in the auto-completed context menu.
[ "DON", "T", "change", "OrEmptyOrBlank", "to", "OrBlank", "because", "of", "the", "occurring", "order", "in", "the", "auto", "-", "completed", "context", "menu", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L5808-L5818