repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
Waikato/moa
moa/src/main/java/moa/gui/visualization/GraphMultiCurve.java
GraphMultiCurve.setGraph
protected void setGraph(MeasureCollection[] measures, MeasureCollection[] measureStds, int[] processFrequencies, Color[] colors){ // this.processFrequencies = processFrequencies; super.setGraph(measures, measureStds, colors); }
java
protected void setGraph(MeasureCollection[] measures, MeasureCollection[] measureStds, int[] processFrequencies, Color[] colors){ // this.processFrequencies = processFrequencies; super.setGraph(measures, measureStds, colors); }
[ "protected", "void", "setGraph", "(", "MeasureCollection", "[", "]", "measures", ",", "MeasureCollection", "[", "]", "measureStds", ",", "int", "[", "]", "processFrequencies", ",", "Color", "[", "]", "colors", ")", "{", "// \tthis.processFrequencies = processFreq...
Updates the measure collection information and repaints the curves. @param measures information about the curves @param measureStds standard deviation of the measures @param processFrequencies information about the process frequencies of the curves @param colors color encodings of the curves
[ "Updates", "the", "measure", "collection", "information", "and", "repaints", "the", "curves", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/visualization/GraphMultiCurve.java#L49-L52
likethecolor/Alchemy-API
src/main/java/com/likethecolor/alchemy/api/parser/json/ConceptParser.java
ConceptParser.getConcept
private JSONObject getConcept(final JSONArray concepts, final int index) { JSONObject object = new JSONObject(); try { object = (JSONObject) concepts.get(index); } catch(JSONException e) { e.printStackTrace(); } return object; }
java
private JSONObject getConcept(final JSONArray concepts, final int index) { JSONObject object = new JSONObject(); try { object = (JSONObject) concepts.get(index); } catch(JSONException e) { e.printStackTrace(); } return object; }
[ "private", "JSONObject", "getConcept", "(", "final", "JSONArray", "concepts", ",", "final", "int", "index", ")", "{", "JSONObject", "object", "=", "new", "JSONObject", "(", ")", ";", "try", "{", "object", "=", "(", "JSONObject", ")", "concepts", ".", "get"...
Return a json object from the provided array. Return an empty object if there is any problems fetching the concept data. @param concepts array of concept data @param index of the object to fetch @return json object from the provided array
[ "Return", "a", "json", "object", "from", "the", "provided", "array", ".", "Return", "an", "empty", "object", "if", "there", "is", "any", "problems", "fetching", "the", "concept", "data", "." ]
train
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/ConceptParser.java#L77-L86
OpenFeign/feign
core/src/main/java/feign/template/UriUtils.java
UriUtils.pathEncode
public static String pathEncode(String path, Charset charset) { return encodeReserved(path, FragmentType.PATH_SEGMENT, charset); /* * path encoding is not equivalent to query encoding, there are few differences, namely dealing * with spaces, !, ', (, ), and ~ characters. we will need to manually process those values. */ // return encoded.replaceAll("\\+", "%20"); }
java
public static String pathEncode(String path, Charset charset) { return encodeReserved(path, FragmentType.PATH_SEGMENT, charset); /* * path encoding is not equivalent to query encoding, there are few differences, namely dealing * with spaces, !, ', (, ), and ~ characters. we will need to manually process those values. */ // return encoded.replaceAll("\\+", "%20"); }
[ "public", "static", "String", "pathEncode", "(", "String", "path", ",", "Charset", "charset", ")", "{", "return", "encodeReserved", "(", "path", ",", "FragmentType", ".", "PATH_SEGMENT", ",", "charset", ")", ";", "/*\n * path encoding is not equivalent to query en...
Uri Encode a Path Fragment. @param path containing the path fragment. @param charset to use. @return the encoded path fragment.
[ "Uri", "Encode", "a", "Path", "Fragment", "." ]
train
https://github.com/OpenFeign/feign/blob/318fb0e955b8cfcf64f70d6aeea0ba5795f8a7eb/core/src/main/java/feign/template/UriUtils.java#L86-L94
jamesagnew/hapi-fhir
hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsProvider.java
AbstractJaxRsProvider.getRequest
public Builder getRequest(final RequestTypeEnum requestType, final RestOperationTypeEnum restOperation) { return getRequest(requestType, restOperation, null); }
java
public Builder getRequest(final RequestTypeEnum requestType, final RestOperationTypeEnum restOperation) { return getRequest(requestType, restOperation, null); }
[ "public", "Builder", "getRequest", "(", "final", "RequestTypeEnum", "requestType", ",", "final", "RestOperationTypeEnum", "restOperation", ")", "{", "return", "getRequest", "(", "requestType", ",", "restOperation", ",", "null", ")", ";", "}" ]
Return the requestbuilder for the server @param requestType the type of the request @param restOperation the rest operation type @return the requestbuilder
[ "Return", "the", "requestbuilder", "for", "the", "server" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsProvider.java#L192-L194
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/converter/avro/JsonElementConversionFactory.java
JsonElementConversionFactory.getConvertor
public static JsonElementConverter getConvertor(String fieldName, String fieldType, JsonObject schemaNode, WorkUnitState state, boolean nullable) throws UnsupportedDateTypeException { if (!schemaNode.has(COLUMN_NAME_KEY)) { schemaNode.addProperty(COLUMN_NAME_KEY, fieldName); } if (!schemaNode.has(DATA_TYPE_KEY)) { schemaNode.add(DATA_TYPE_KEY, new JsonObject()); } JsonObject dataType = schemaNode.get(DATA_TYPE_KEY).getAsJsonObject(); if (!dataType.has(TYPE_KEY)) { dataType.addProperty(TYPE_KEY, fieldType); } if (!schemaNode.has(IS_NULLABLE_KEY)) { schemaNode.addProperty(IS_NULLABLE_KEY, nullable); } JsonSchema schema = new JsonSchema(schemaNode); return getConvertor(schema, null, state); }
java
public static JsonElementConverter getConvertor(String fieldName, String fieldType, JsonObject schemaNode, WorkUnitState state, boolean nullable) throws UnsupportedDateTypeException { if (!schemaNode.has(COLUMN_NAME_KEY)) { schemaNode.addProperty(COLUMN_NAME_KEY, fieldName); } if (!schemaNode.has(DATA_TYPE_KEY)) { schemaNode.add(DATA_TYPE_KEY, new JsonObject()); } JsonObject dataType = schemaNode.get(DATA_TYPE_KEY).getAsJsonObject(); if (!dataType.has(TYPE_KEY)) { dataType.addProperty(TYPE_KEY, fieldType); } if (!schemaNode.has(IS_NULLABLE_KEY)) { schemaNode.addProperty(IS_NULLABLE_KEY, nullable); } JsonSchema schema = new JsonSchema(schemaNode); return getConvertor(schema, null, state); }
[ "public", "static", "JsonElementConverter", "getConvertor", "(", "String", "fieldName", ",", "String", "fieldType", ",", "JsonObject", "schemaNode", ",", "WorkUnitState", "state", ",", "boolean", "nullable", ")", "throws", "UnsupportedDateTypeException", "{", "if", "(...
Backward Compatible form of {@link JsonElementConverter#getConvertor(JsonSchema, String, WorkUnitState)} @param fieldName @param fieldType @param schemaNode @param state @param nullable @return @throws UnsupportedDateTypeException
[ "Backward", "Compatible", "form", "of", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/avro/JsonElementConversionFactory.java#L177-L195
roboconf/roboconf-platform
core/roboconf-plugin-script/src/main/java/net/roboconf/plugin/script/internal/templating/InstanceTemplateHelper.java
InstanceTemplateHelper.injectInstanceImports
public static void injectInstanceImports(Instance instance, File templateFile, Writer writer) throws IOException { MustacheFactory mf = new DefaultMustacheFactory( templateFile.getParentFile()); Mustache mustache = mf.compile( templateFile.getName()); mustache.execute(writer, new InstanceBean( instance )).flush(); }
java
public static void injectInstanceImports(Instance instance, File templateFile, Writer writer) throws IOException { MustacheFactory mf = new DefaultMustacheFactory( templateFile.getParentFile()); Mustache mustache = mf.compile( templateFile.getName()); mustache.execute(writer, new InstanceBean( instance )).flush(); }
[ "public", "static", "void", "injectInstanceImports", "(", "Instance", "instance", ",", "File", "templateFile", ",", "Writer", "writer", ")", "throws", "IOException", "{", "MustacheFactory", "mf", "=", "new", "DefaultMustacheFactory", "(", "templateFile", ".", "getPa...
Reads the import values of the instances and injects them into the template file. <p> See test resources to see the associated way to write templates </p> @param instance the instance whose imports must be injected @param templateFile the template file @param writer a writer @throws IOException if something went wrong
[ "Reads", "the", "import", "values", "of", "the", "instances", "and", "injects", "them", "into", "the", "template", "file", ".", "<p", ">", "See", "test", "resources", "to", "see", "the", "associated", "way", "to", "write", "templates", "<", "/", "p", ">"...
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-plugin-script/src/main/java/net/roboconf/plugin/script/internal/templating/InstanceTemplateHelper.java#L68-L74
HadoopGenomics/Hadoop-BAM
src/main/java/org/seqdoop/hadoop_bam/SequencedFragment.java
SequencedFragment.verifyQuality
public static int verifyQuality(Text quality, BaseQualityEncoding encoding) { // set allowed quality range int max, min; if (encoding == BaseQualityEncoding.Illumina) { max = FormatConstants.ILLUMINA_OFFSET + FormatConstants.ILLUMINA_MAX; min = FormatConstants.ILLUMINA_OFFSET; } else if (encoding == BaseQualityEncoding.Sanger) { max = FormatConstants.SANGER_OFFSET + FormatConstants.SANGER_MAX; min = FormatConstants.SANGER_OFFSET; } else throw new IllegalArgumentException("Unsupported base encoding quality " + encoding); // verify final byte[] bytes = quality.getBytes(); final int len = quality.getLength(); for (int i = 0; i < len; ++i) { if (bytes[i] < min || bytes[i] > max) return i; } return -1; }
java
public static int verifyQuality(Text quality, BaseQualityEncoding encoding) { // set allowed quality range int max, min; if (encoding == BaseQualityEncoding.Illumina) { max = FormatConstants.ILLUMINA_OFFSET + FormatConstants.ILLUMINA_MAX; min = FormatConstants.ILLUMINA_OFFSET; } else if (encoding == BaseQualityEncoding.Sanger) { max = FormatConstants.SANGER_OFFSET + FormatConstants.SANGER_MAX; min = FormatConstants.SANGER_OFFSET; } else throw new IllegalArgumentException("Unsupported base encoding quality " + encoding); // verify final byte[] bytes = quality.getBytes(); final int len = quality.getLength(); for (int i = 0; i < len; ++i) { if (bytes[i] < min || bytes[i] > max) return i; } return -1; }
[ "public", "static", "int", "verifyQuality", "(", "Text", "quality", ",", "BaseQualityEncoding", "encoding", ")", "{", "// set allowed quality range", "int", "max", ",", "min", ";", "if", "(", "encoding", "==", "BaseQualityEncoding", ".", "Illumina", ")", "{", "m...
Verify that the given quality bytes are within the range allowed for the specified encoding. In theory, the Sanger encoding uses the entire range of characters from ASCII 33 to 126, giving a value range of [0,93]. However, values over 60 are unlikely in practice, and are more likely to be caused by mistaking a file that uses Illumina encoding for Sanger. So, we'll enforce the same range supported by Illumina encoding ([0,62]) for Sanger. @return -1 if quality is ok. @return If an out-of-range value is found the index of the value is returned.
[ "Verify", "that", "the", "given", "quality", "bytes", "are", "within", "the", "range", "allowed", "for", "the", "specified", "encoding", "." ]
train
https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/SequencedFragment.java#L281-L309
sundrio/sundrio
core/src/main/java/io/sundr/builder/BaseFluent.java
BaseFluent.hasCompatibleVisitMethod
private static <V,F> Boolean hasCompatibleVisitMethod(V visitor, F fluent) { for (Method method : visitor.getClass().getMethods()) { if (!method.getName().equals(VISIT) || method.getParameterTypes().length != 1) { continue; } Class visitorType = method.getParameterTypes()[0]; if (visitorType.isAssignableFrom(fluent.getClass())) { return true; } else { return false; } } return false; }
java
private static <V,F> Boolean hasCompatibleVisitMethod(V visitor, F fluent) { for (Method method : visitor.getClass().getMethods()) { if (!method.getName().equals(VISIT) || method.getParameterTypes().length != 1) { continue; } Class visitorType = method.getParameterTypes()[0]; if (visitorType.isAssignableFrom(fluent.getClass())) { return true; } else { return false; } } return false; }
[ "private", "static", "<", "V", ",", "F", ">", "Boolean", "hasCompatibleVisitMethod", "(", "V", "visitor", ",", "F", "fluent", ")", "{", "for", "(", "Method", "method", ":", "visitor", ".", "getClass", "(", ")", ".", "getMethods", "(", ")", ")", "{", ...
Checks if the specified visitor has a visit method compatible with the specified fluent. @param visitor @param fluent @param <V> @param <F> @return
[ "Checks", "if", "the", "specified", "visitor", "has", "a", "visit", "method", "compatible", "with", "the", "specified", "fluent", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/core/src/main/java/io/sundr/builder/BaseFluent.java#L120-L133
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsADECache.java
CmsADECache.removeCachedContent
private <CONTENT extends CmsXmlContent> void removeCachedContent(CmsResource resource, Map<String, CONTENT> cache) { Iterator<Map.Entry<String, CONTENT>> iterator = cache.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, CONTENT> entry = iterator.next(); CONTENT content = entry.getValue(); CmsResource contentFile = content.getFile(); if (contentFile.getStructureId().equals(resource.getStructureId()) || contentFile.getResourceId().equals(resource.getResourceId())) { iterator.remove(); } } }
java
private <CONTENT extends CmsXmlContent> void removeCachedContent(CmsResource resource, Map<String, CONTENT> cache) { Iterator<Map.Entry<String, CONTENT>> iterator = cache.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, CONTENT> entry = iterator.next(); CONTENT content = entry.getValue(); CmsResource contentFile = content.getFile(); if (contentFile.getStructureId().equals(resource.getStructureId()) || contentFile.getResourceId().equals(resource.getResourceId())) { iterator.remove(); } } }
[ "private", "<", "CONTENT", "extends", "CmsXmlContent", ">", "void", "removeCachedContent", "(", "CmsResource", "resource", ",", "Map", "<", "String", ",", "CONTENT", ">", "cache", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "String", ",", "CONTENT",...
Removes a cached XML content from the cache if it matches a given resource.<p> @param resource the resource for which the cached XML content should be removed @param cache the cache from which to remove the XML content
[ "Removes", "a", "cached", "XML", "content", "from", "the", "cache", "if", "it", "matches", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADECache.java#L420-L433
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseSnnz_compress
public static int cusparseSnnz_compress( cusparseHandle handle, int m, cusparseMatDescr descr, Pointer csrSortedValA, Pointer csrSortedRowPtrA, Pointer nnzPerRow, Pointer nnzC, float tol) { return checkResult(cusparseSnnz_compressNative(handle, m, descr, csrSortedValA, csrSortedRowPtrA, nnzPerRow, nnzC, tol)); }
java
public static int cusparseSnnz_compress( cusparseHandle handle, int m, cusparseMatDescr descr, Pointer csrSortedValA, Pointer csrSortedRowPtrA, Pointer nnzPerRow, Pointer nnzC, float tol) { return checkResult(cusparseSnnz_compressNative(handle, m, descr, csrSortedValA, csrSortedRowPtrA, nnzPerRow, nnzC, tol)); }
[ "public", "static", "int", "cusparseSnnz_compress", "(", "cusparseHandle", "handle", ",", "int", "m", ",", "cusparseMatDescr", "descr", ",", "Pointer", "csrSortedValA", ",", "Pointer", "csrSortedRowPtrA", ",", "Pointer", "nnzPerRow", ",", "Pointer", "nnzC", ",", "...
Description: This routine finds the total number of non-zero elements and the number of non-zero elements per row in a noncompressed csr matrix A.
[ "Description", ":", "This", "routine", "finds", "the", "total", "number", "of", "non", "-", "zero", "elements", "and", "the", "number", "of", "non", "-", "zero", "elements", "per", "row", "in", "a", "noncompressed", "csr", "matrix", "A", "." ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L10946-L10957
jdillon/gshell
gshell-util/src/main/java/com/planet57/gshell/util/converter/Converters.java
Converters.findEditor
private static PropertyEditor findEditor(final Type type) { assert type != null; Class clazz = toClass(type); // try to locate this directly from the editor manager first. PropertyEditor editor = PropertyEditorManager.findEditor(clazz); // we're outta here if we got one. if (editor != null) { return editor; } // it's possible this was a request for an array class. We might not // recognize the array type directly, but the component type might be // resolvable if (clazz.isArray() && !clazz.getComponentType().isArray()) { // do a recursive lookup on the base type editor = findEditor(clazz.getComponentType()); // if we found a suitable editor for the base component type, // wrapper this in an array adaptor for real use if (editor != null) { return new ArrayConverter(clazz, editor); } } // nothing found return null; }
java
private static PropertyEditor findEditor(final Type type) { assert type != null; Class clazz = toClass(type); // try to locate this directly from the editor manager first. PropertyEditor editor = PropertyEditorManager.findEditor(clazz); // we're outta here if we got one. if (editor != null) { return editor; } // it's possible this was a request for an array class. We might not // recognize the array type directly, but the component type might be // resolvable if (clazz.isArray() && !clazz.getComponentType().isArray()) { // do a recursive lookup on the base type editor = findEditor(clazz.getComponentType()); // if we found a suitable editor for the base component type, // wrapper this in an array adaptor for real use if (editor != null) { return new ArrayConverter(clazz, editor); } } // nothing found return null; }
[ "private", "static", "PropertyEditor", "findEditor", "(", "final", "Type", "type", ")", "{", "assert", "type", "!=", "null", ";", "Class", "clazz", "=", "toClass", "(", "type", ")", ";", "// try to locate this directly from the editor manager first.", "PropertyEditor"...
Locate a property editor for given class of object. @param type The target object class of the property. @return The resolved editor, if any. Returns null if a suitable editor could not be located.
[ "Locate", "a", "property", "editor", "for", "given", "class", "of", "object", "." ]
train
https://github.com/jdillon/gshell/blob/b587c1a4672d2e4905871462fa3b38a1f7b94e90/gshell-util/src/main/java/com/planet57/gshell/util/converter/Converters.java#L474-L502
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockInlineChecksumWriter.java
BlockInlineChecksumWriter.computePartialChunkCrc
private void computePartialChunkCrc(long blkoff, int bytesPerChecksum, DataChecksum checksum) throws IOException { // find offset of the beginning of partial chunk. // int sizePartialChunk = (int) (blkoff % bytesPerChecksum); int checksumSize = checksum.getChecksumSize(); long fileOff = BlockInlineChecksumReader.getPosFromBlockOffset(blkoff - sizePartialChunk, bytesPerChecksum, checksumSize); LOG.info("computePartialChunkCrc sizePartialChunk " + sizePartialChunk + " block " + block + " offset in block " + blkoff); // create an input stream from the block file // and read in partial crc chunk into temporary buffer // byte[] buf = new byte[sizePartialChunk]; byte[] crcbuf = new byte[checksumSize]; // FileInputStream dataIn = null; /* RandomAccessFile blockInFile = new RandomAccessFile(blockFile, "r"); dataIn = new FileInputStream(blockInFile.getFD()); if (fileOff > 0) { blockInFile.seek(fileOff); } IOUtils.readFully(dataIn, buf, 0, sizePartialChunk); // open meta file and read in crc value computer earlier IOUtils.readFully(dataIn, crcbuf, 0, crcbuf.length); */ BlockDataFile.Reader blockReader = blockDataFile.getReader(datanode); blockReader.readFully(buf, 0, sizePartialChunk, fileOff, true); blockReader.readFully(crcbuf, 0, crcbuf.length, fileOff + sizePartialChunk, true); // compute crc of partial chunk from data read in the block file. Checksum partialCrc = new CRC32(); partialCrc.update(buf, 0, sizePartialChunk); LOG.info("Read in partial CRC chunk from disk for block " + block); // paranoia! verify that the pre-computed crc matches what we // recalculated just now if (partialCrc.getValue() != FSInputChecker.checksum2long(crcbuf)) { String msg = "Partial CRC " + partialCrc.getValue() + " does not match value computed the " + " last time file was closed " + FSInputChecker.checksum2long(crcbuf); throw new IOException(msg); } partialCrcInt = (int) partialCrc.getValue(); }
java
private void computePartialChunkCrc(long blkoff, int bytesPerChecksum, DataChecksum checksum) throws IOException { // find offset of the beginning of partial chunk. // int sizePartialChunk = (int) (blkoff % bytesPerChecksum); int checksumSize = checksum.getChecksumSize(); long fileOff = BlockInlineChecksumReader.getPosFromBlockOffset(blkoff - sizePartialChunk, bytesPerChecksum, checksumSize); LOG.info("computePartialChunkCrc sizePartialChunk " + sizePartialChunk + " block " + block + " offset in block " + blkoff); // create an input stream from the block file // and read in partial crc chunk into temporary buffer // byte[] buf = new byte[sizePartialChunk]; byte[] crcbuf = new byte[checksumSize]; // FileInputStream dataIn = null; /* RandomAccessFile blockInFile = new RandomAccessFile(blockFile, "r"); dataIn = new FileInputStream(blockInFile.getFD()); if (fileOff > 0) { blockInFile.seek(fileOff); } IOUtils.readFully(dataIn, buf, 0, sizePartialChunk); // open meta file and read in crc value computer earlier IOUtils.readFully(dataIn, crcbuf, 0, crcbuf.length); */ BlockDataFile.Reader blockReader = blockDataFile.getReader(datanode); blockReader.readFully(buf, 0, sizePartialChunk, fileOff, true); blockReader.readFully(crcbuf, 0, crcbuf.length, fileOff + sizePartialChunk, true); // compute crc of partial chunk from data read in the block file. Checksum partialCrc = new CRC32(); partialCrc.update(buf, 0, sizePartialChunk); LOG.info("Read in partial CRC chunk from disk for block " + block); // paranoia! verify that the pre-computed crc matches what we // recalculated just now if (partialCrc.getValue() != FSInputChecker.checksum2long(crcbuf)) { String msg = "Partial CRC " + partialCrc.getValue() + " does not match value computed the " + " last time file was closed " + FSInputChecker.checksum2long(crcbuf); throw new IOException(msg); } partialCrcInt = (int) partialCrc.getValue(); }
[ "private", "void", "computePartialChunkCrc", "(", "long", "blkoff", ",", "int", "bytesPerChecksum", ",", "DataChecksum", "checksum", ")", "throws", "IOException", "{", "// find offset of the beginning of partial chunk.", "//", "int", "sizePartialChunk", "=", "(", "int", ...
reads in the partial crc chunk and computes checksum of pre-existing data in partial chunk.
[ "reads", "in", "the", "partial", "crc", "chunk", "and", "computes", "checksum", "of", "pre", "-", "existing", "data", "in", "partial", "chunk", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/BlockInlineChecksumWriter.java#L326-L378
lotaris/jee-validation
src/main/java/com/lotaris/jee/validation/JsonValidationContext.java
JsonValidationContext.addState
public <T> JsonValidationContext addState(T state, Class<? extends T> stateClass) throws IllegalArgumentException { // only accept one state of each class if (this.states.containsKey(state.getClass())) { throw new IllegalArgumentException("A state object is already registered for class " + state.getClass().getName()); } this.states.put(state.getClass(), state); return this; }
java
public <T> JsonValidationContext addState(T state, Class<? extends T> stateClass) throws IllegalArgumentException { // only accept one state of each class if (this.states.containsKey(state.getClass())) { throw new IllegalArgumentException("A state object is already registered for class " + state.getClass().getName()); } this.states.put(state.getClass(), state); return this; }
[ "public", "<", "T", ">", "JsonValidationContext", "addState", "(", "T", "state", ",", "Class", "<", "?", "extends", "T", ">", "stateClass", ")", "throws", "IllegalArgumentException", "{", "// only accept one state of each class", "if", "(", "this", ".", "states", ...
Adds the specified state object to this validation context. It can be retrieved by passing the identifying class to {@link #getState(java.lang.Class)}. @param <T> the type of state @param state the state object to register @param stateClass the class identifying the state @return this context @throws IllegalArgumentException if a state is already registered for that class
[ "Adds", "the", "specified", "state", "object", "to", "this", "validation", "context", ".", "It", "can", "be", "retrieved", "by", "passing", "the", "identifying", "class", "to", "{", "@link", "#getState", "(", "java", ".", "lang", ".", "Class", ")", "}", ...
train
https://github.com/lotaris/jee-validation/blob/feefff820b5a67c7471a13e08fdaf2d60bb3ad16/src/main/java/com/lotaris/jee/validation/JsonValidationContext.java#L140-L150
twitter/hbc
hbc-core/src/main/java/com/twitter/hbc/common/IOUtils.java
IOUtils.readFully
public static void readFully(Reader reader, char[] buffer, int offset) throws IOException { int originalOffset = offset; int expected = buffer.length - offset; while (offset < buffer.length) { int numRead = reader.read(buffer, offset, buffer.length - offset); if (numRead < 0) { throw new IOException( String.format("Reached end of stream earlier than expected. Expected to read %d bytes. Actual: %d", expected, offset - originalOffset)); } offset += numRead; } }
java
public static void readFully(Reader reader, char[] buffer, int offset) throws IOException { int originalOffset = offset; int expected = buffer.length - offset; while (offset < buffer.length) { int numRead = reader.read(buffer, offset, buffer.length - offset); if (numRead < 0) { throw new IOException( String.format("Reached end of stream earlier than expected. Expected to read %d bytes. Actual: %d", expected, offset - originalOffset)); } offset += numRead; } }
[ "public", "static", "void", "readFully", "(", "Reader", "reader", ",", "char", "[", "]", "buffer", ",", "int", "offset", ")", "throws", "IOException", "{", "int", "originalOffset", "=", "offset", ";", "int", "expected", "=", "buffer", ".", "length", "-", ...
Reads enough chars from the reader to fill the remainder of the buffer (reads length - offset chars). @throws IOException if an I/O error occurs, or if the stream ends before filling the entire buffer.
[ "Reads", "enough", "chars", "from", "the", "reader", "to", "fill", "the", "remainder", "of", "the", "buffer", "(", "reads", "length", "-", "offset", "chars", ")", "." ]
train
https://github.com/twitter/hbc/blob/72a8d0b44ba824a722cf4ee7ed9f9bc34d02d92c/hbc-core/src/main/java/com/twitter/hbc/common/IOUtils.java#L24-L36
Ordinastie/MalisisCore
src/main/java/net/malisis/core/client/gui/element/position/Positions.java
Positions.middleAlignedTo
public static <T extends IPositioned & ISized> IntSupplier middleAlignedTo(ISized owner, T other, int offset) { checkNotNull(other); return () -> { return (int) (other.position().y() + Math.ceil(((float) other.size().height() - owner.size().height()) / 2) + offset); }; }
java
public static <T extends IPositioned & ISized> IntSupplier middleAlignedTo(ISized owner, T other, int offset) { checkNotNull(other); return () -> { return (int) (other.position().y() + Math.ceil(((float) other.size().height() - owner.size().height()) / 2) + offset); }; }
[ "public", "static", "<", "T", "extends", "IPositioned", "&", "ISized", ">", "IntSupplier", "middleAlignedTo", "(", "ISized", "owner", ",", "T", "other", ",", "int", "offset", ")", "{", "checkNotNull", "(", "other", ")", ";", "return", "(", ")", "->", "{"...
Middle aligns the owner to the other. @param <T> the generic type @param other the other @param offset the offset @return the int supplier
[ "Middle", "aligns", "the", "owner", "to", "the", "other", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/element/position/Positions.java#L307-L313
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.supportsConvert
@Override public boolean supportsConvert(int fromType, int toType) throws SQLException { checkClosed(); switch (fromType) { /* * ALL types can be converted to VARCHAR /VoltType.String */ case java.sql.Types.VARCHAR: case java.sql.Types.VARBINARY: case java.sql.Types.TIMESTAMP: case java.sql.Types.OTHER: switch (toType) { case java.sql.Types.VARCHAR: return true; default: return false; } case java.sql.Types.TINYINT: case java.sql.Types.SMALLINT: case java.sql.Types.INTEGER: case java.sql.Types.BIGINT: case java.sql.Types.FLOAT: case java.sql.Types.DECIMAL: switch (toType) { case java.sql.Types.VARCHAR: case java.sql.Types.TINYINT: case java.sql.Types.SMALLINT: case java.sql.Types.INTEGER: case java.sql.Types.BIGINT: case java.sql.Types.FLOAT: case java.sql.Types.DECIMAL: return true; default: return false; } default: return false; } }
java
@Override public boolean supportsConvert(int fromType, int toType) throws SQLException { checkClosed(); switch (fromType) { /* * ALL types can be converted to VARCHAR /VoltType.String */ case java.sql.Types.VARCHAR: case java.sql.Types.VARBINARY: case java.sql.Types.TIMESTAMP: case java.sql.Types.OTHER: switch (toType) { case java.sql.Types.VARCHAR: return true; default: return false; } case java.sql.Types.TINYINT: case java.sql.Types.SMALLINT: case java.sql.Types.INTEGER: case java.sql.Types.BIGINT: case java.sql.Types.FLOAT: case java.sql.Types.DECIMAL: switch (toType) { case java.sql.Types.VARCHAR: case java.sql.Types.TINYINT: case java.sql.Types.SMALLINT: case java.sql.Types.INTEGER: case java.sql.Types.BIGINT: case java.sql.Types.FLOAT: case java.sql.Types.DECIMAL: return true; default: return false; } default: return false; } }
[ "@", "Override", "public", "boolean", "supportsConvert", "(", "int", "fromType", ",", "int", "toType", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "switch", "(", "fromType", ")", "{", "/*\n * ALL types can be converted to VARCHAR /VoltTyp...
Retrieves whether this database supports the JDBC scalar function CONVERT for conversions between the JDBC types fromType and toType.
[ "Retrieves", "whether", "this", "database", "supports", "the", "JDBC", "scalar", "function", "CONVERT", "for", "conversions", "between", "the", "JDBC", "types", "fromType", "and", "toType", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L1206-L1246
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/mappings/BundlePathMappingBuilder.java
BundlePathMappingBuilder.joinPaths
private String joinPaths(String dirName, String folderName, boolean generatedResource) { return PathNormalizer.joinPaths(dirName, folderName, generatedResource); }
java
private String joinPaths(String dirName, String folderName, boolean generatedResource) { return PathNormalizer.joinPaths(dirName, folderName, generatedResource); }
[ "private", "String", "joinPaths", "(", "String", "dirName", ",", "String", "folderName", ",", "boolean", "generatedResource", ")", "{", "return", "PathNormalizer", ".", "joinPaths", "(", "dirName", ",", "folderName", ",", "generatedResource", ")", ";", "}" ]
Normalizes two paths and joins them as a single path. @param prefix the path prefix @param path the path @param generatedResource the flag indicating if the resource has been generated @return the normalized path
[ "Normalizes", "two", "paths", "and", "joins", "them", "as", "a", "single", "path", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/mappings/BundlePathMappingBuilder.java#L333-L336
twilio/twilio-java
src/main/java/com/twilio/rest/flexapi/v1/FlexFlowReader.java
FlexFlowReader.previousPage
@Override public Page<FlexFlow> previousPage(final Page<FlexFlow> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.FLEXAPI.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<FlexFlow> previousPage(final Page<FlexFlow> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.FLEXAPI.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "FlexFlow", ">", "previousPage", "(", "final", "Page", "<", "FlexFlow", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", "...
Retrieve the previous page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Previous Page
[ "Retrieve", "the", "previous", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/flexapi/v1/FlexFlowReader.java#L112-L123
hawkular/hawkular-agent
hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/util/Util.java
Util.copyStream
public static long copyStream(InputStream input, OutputStream output, boolean closeStreams) throws RuntimeException { long numBytesCopied = 0; int bufferSize = BUFFER_SIZE; try { // make sure we buffer the input input = new BufferedInputStream(input, bufferSize); byte[] buffer = new byte[bufferSize]; for (int bytesRead = input.read(buffer); bytesRead != -1; bytesRead = input.read(buffer)) { output.write(buffer, 0, bytesRead); numBytesCopied += bytesRead; } output.flush(); } catch (IOException ioe) { throw new RuntimeException("Stream data cannot be copied", ioe); } finally { if (closeStreams) { try { output.close(); } catch (IOException ioe2) { // what to do? } try { input.close(); } catch (IOException ioe2) { // what to do? } } } return numBytesCopied; }
java
public static long copyStream(InputStream input, OutputStream output, boolean closeStreams) throws RuntimeException { long numBytesCopied = 0; int bufferSize = BUFFER_SIZE; try { // make sure we buffer the input input = new BufferedInputStream(input, bufferSize); byte[] buffer = new byte[bufferSize]; for (int bytesRead = input.read(buffer); bytesRead != -1; bytesRead = input.read(buffer)) { output.write(buffer, 0, bytesRead); numBytesCopied += bytesRead; } output.flush(); } catch (IOException ioe) { throw new RuntimeException("Stream data cannot be copied", ioe); } finally { if (closeStreams) { try { output.close(); } catch (IOException ioe2) { // what to do? } try { input.close(); } catch (IOException ioe2) { // what to do? } } } return numBytesCopied; }
[ "public", "static", "long", "copyStream", "(", "InputStream", "input", ",", "OutputStream", "output", ",", "boolean", "closeStreams", ")", "throws", "RuntimeException", "{", "long", "numBytesCopied", "=", "0", ";", "int", "bufferSize", "=", "BUFFER_SIZE", ";", "...
Copies one stream to another, optionally closing the streams. @param input the data to copy @param output where to copy the data @param closeStreams if true input and output will be closed when the method returns @return the number of bytes copied @throws RuntimeException if the copy failed
[ "Copies", "one", "stream", "to", "another", "optionally", "closing", "the", "streams", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/util/Util.java#L189-L219
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionTypesInner.java
ConnectionTypesInner.get
public ConnectionTypeInner get(String resourceGroupName, String automationAccountName, String connectionTypeName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionTypeName).toBlocking().single().body(); }
java
public ConnectionTypeInner get(String resourceGroupName, String automationAccountName, String connectionTypeName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionTypeName).toBlocking().single().body(); }
[ "public", "ConnectionTypeInner", "get", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "connectionTypeName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "connecti...
Retrieve the connectiontype identified by connectiontype name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param connectionTypeName The name of connectiontype. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ConnectionTypeInner object if successful.
[ "Retrieve", "the", "connectiontype", "identified", "by", "connectiontype", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionTypesInner.java#L189-L191
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Repository.java
Repository.asDocumentRepository
public DocumentRepository asDocumentRepository(EnvironmentType env, String user, String pwd) throws Exception { return (DocumentRepository)new FactoryConverter().convert(type.asFactoryArguments(this, env, true, user, pwd)); }
java
public DocumentRepository asDocumentRepository(EnvironmentType env, String user, String pwd) throws Exception { return (DocumentRepository)new FactoryConverter().convert(type.asFactoryArguments(this, env, true, user, pwd)); }
[ "public", "DocumentRepository", "asDocumentRepository", "(", "EnvironmentType", "env", ",", "String", "user", ",", "String", "pwd", ")", "throws", "Exception", "{", "return", "(", "DocumentRepository", ")", "new", "FactoryConverter", "(", ")", ".", "convert", "(",...
<p>asDocumentRepository.</p> @param env a {@link com.greenpepper.server.domain.EnvironmentType} object. @param user a {@link java.lang.String} object. @param pwd a {@link java.lang.String} object. @return a {@link com.greenpepper.repository.DocumentRepository} object. @throws java.lang.Exception if any.
[ "<p", ">", "asDocumentRepository", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Repository.java#L467-L470
rhuss/jolokia
agent/jvm/src/main/java/org/jolokia/jvmagent/client/command/AbstractBaseCommand.java
AbstractBaseCommand.getProcessDescription
protected String getProcessDescription(OptionsAndArgs pOpts, VirtualMachineHandler pHandler) { if (pOpts.getPid() != null) { return "PID " + pOpts.getPid(); } else if (pOpts.getProcessPattern() != null) { StringBuffer desc = new StringBuffer("process matching \"") .append(pOpts.getProcessPattern().pattern()) .append("\""); try { desc.append(" (PID: ") .append(pHandler.findProcess(pOpts.getProcessPattern()).getId()) .append(")"); } catch (InvocationTargetException e) { // ignored } catch (NoSuchMethodException e) { // ignored } catch (IllegalAccessException e) { // ignored } return desc.toString(); } else { return "(null)"; } }
java
protected String getProcessDescription(OptionsAndArgs pOpts, VirtualMachineHandler pHandler) { if (pOpts.getPid() != null) { return "PID " + pOpts.getPid(); } else if (pOpts.getProcessPattern() != null) { StringBuffer desc = new StringBuffer("process matching \"") .append(pOpts.getProcessPattern().pattern()) .append("\""); try { desc.append(" (PID: ") .append(pHandler.findProcess(pOpts.getProcessPattern()).getId()) .append(")"); } catch (InvocationTargetException e) { // ignored } catch (NoSuchMethodException e) { // ignored } catch (IllegalAccessException e) { // ignored } return desc.toString(); } else { return "(null)"; } }
[ "protected", "String", "getProcessDescription", "(", "OptionsAndArgs", "pOpts", ",", "VirtualMachineHandler", "pHandler", ")", "{", "if", "(", "pOpts", ".", "getPid", "(", ")", "!=", "null", ")", "{", "return", "\"PID \"", "+", "pOpts", ".", "getPid", "(", "...
Get a description of the process attached, either the numeric id only or, if a pattern is given, the pattern and the associated PID @param pOpts options from where to take the PID or pattern @param pHandler handler for looking up the process in case of a pattern lookup @return a description of the process
[ "Get", "a", "description", "of", "the", "process", "attached", "either", "the", "numeric", "id", "only", "or", "if", "a", "pattern", "is", "given", "the", "pattern", "and", "the", "associated", "PID" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/client/command/AbstractBaseCommand.java#L127-L149
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsXmlContentEditor.java
CmsXmlContentEditor.buildElementChoices
public JSONArray buildElementChoices(String elementName, boolean choiceType, boolean checkChoice) { JSONArray choiceElements = new JSONArray(); String choiceName = elementName; I_CmsXmlSchemaType elemType = m_content.getContentDefinition().getSchemaType(elementName); if (checkChoice && elemType.isChoiceOption() && elemType.isChoiceType()) { // the element itself is a choice option and again a choice type, remove the last element to get correct choices choiceName = CmsXmlUtils.removeLastXpathElement(elementName); } // use xpath to get choice information if (m_content.hasChoiceOptions(choiceName, getElementLocale())) { // we have choice options, first add information about type to create JSONObject info = new JSONObject(); try { // put information if element is a choice type info.put("choicetype", choiceType); choiceElements.put(info); // get the available choice options for the choice element List<I_CmsXmlSchemaType> options = m_content.getChoiceOptions(choiceName, getElementLocale()); for (Iterator<I_CmsXmlSchemaType> i = options.iterator(); i.hasNext();) { // add the available element options I_CmsXmlSchemaType type = i.next(); JSONObject option = new JSONObject(); String key = A_CmsWidget.LABEL_PREFIX + type.getContentDefinition().getInnerName() + "." + type.getName(); // add element name, label and help info option.put("name", type.getName()); option.put("label", keyDefault(key, type.getName())); option.put("help", keyDefault(key + A_CmsWidget.HELP_POSTFIX, "")); // add info if the choice itself is a (sub) choice type option.put("subchoice", type.isChoiceType()); choiceElements.put(option); } } catch (JSONException e) { // ignore, should not happen } } return choiceElements; }
java
public JSONArray buildElementChoices(String elementName, boolean choiceType, boolean checkChoice) { JSONArray choiceElements = new JSONArray(); String choiceName = elementName; I_CmsXmlSchemaType elemType = m_content.getContentDefinition().getSchemaType(elementName); if (checkChoice && elemType.isChoiceOption() && elemType.isChoiceType()) { // the element itself is a choice option and again a choice type, remove the last element to get correct choices choiceName = CmsXmlUtils.removeLastXpathElement(elementName); } // use xpath to get choice information if (m_content.hasChoiceOptions(choiceName, getElementLocale())) { // we have choice options, first add information about type to create JSONObject info = new JSONObject(); try { // put information if element is a choice type info.put("choicetype", choiceType); choiceElements.put(info); // get the available choice options for the choice element List<I_CmsXmlSchemaType> options = m_content.getChoiceOptions(choiceName, getElementLocale()); for (Iterator<I_CmsXmlSchemaType> i = options.iterator(); i.hasNext();) { // add the available element options I_CmsXmlSchemaType type = i.next(); JSONObject option = new JSONObject(); String key = A_CmsWidget.LABEL_PREFIX + type.getContentDefinition().getInnerName() + "." + type.getName(); // add element name, label and help info option.put("name", type.getName()); option.put("label", keyDefault(key, type.getName())); option.put("help", keyDefault(key + A_CmsWidget.HELP_POSTFIX, "")); // add info if the choice itself is a (sub) choice type option.put("subchoice", type.isChoiceType()); choiceElements.put(option); } } catch (JSONException e) { // ignore, should not happen } } return choiceElements; }
[ "public", "JSONArray", "buildElementChoices", "(", "String", "elementName", ",", "boolean", "choiceType", ",", "boolean", "checkChoice", ")", "{", "JSONArray", "choiceElements", "=", "new", "JSONArray", "(", ")", ";", "String", "choiceName", "=", "elementName", ";...
Returns the JSON array with information about the choices of a given element.<p> The returned array is only filled if the given element has choice options, otherwise an empty array is returned.<br/> Note: the first array element is an object containing information if the element itself is a choice type, the following elements are the choice option items.<p> @param elementName the element name to check (complete xpath) @param choiceType flag indicating if the given element name represents a choice type or not @param checkChoice flag indicating if the element name should be checked if it is a choice option and choice type @return the JSON array with information about the choices of a given element
[ "Returns", "the", "JSON", "array", "with", "information", "about", "the", "choices", "of", "a", "given", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsXmlContentEditor.java#L730-L770
dbflute-session/tomcat-boot
src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java
BotmReflectionUtil.getAccessibleMethod
public static Method getAccessibleMethod(Class<?> clazz, String methodName, Class<?>[] argTypes) { assertObjectNotNull("clazz", clazz); assertStringNotNullAndNotTrimmedEmpty("methodName", methodName); return findMethod(clazz, methodName, argTypes, VisibilityType.ACCESSIBLE, false); }
java
public static Method getAccessibleMethod(Class<?> clazz, String methodName, Class<?>[] argTypes) { assertObjectNotNull("clazz", clazz); assertStringNotNullAndNotTrimmedEmpty("methodName", methodName); return findMethod(clazz, methodName, argTypes, VisibilityType.ACCESSIBLE, false); }
[ "public", "static", "Method", "getAccessibleMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "[", "]", "argTypes", ")", "{", "assertObjectNotNull", "(", "\"clazz\"", ",", "clazz", ")", ";", "assertStr...
Get the accessible method that means as follows: <pre> o target class's methods = all o superclass's methods = public or protected </pre> @param clazz The type of class that defines the method. (NotNull) @param methodName The name of method. (NotNull) @param argTypes The type of argument. (NotNull) @return The instance of method. (NullAllowed: if null, not found)
[ "Get", "the", "accessible", "method", "that", "means", "as", "follows", ":", "<pre", ">", "o", "target", "class", "s", "methods", "=", "all", "o", "superclass", "s", "methods", "=", "public", "or", "protected", "<", "/", "pre", ">" ]
train
https://github.com/dbflute-session/tomcat-boot/blob/fe941f88b6be083781873126f5b12d4c16bb9073/src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java#L336-L340
alkacon/opencms-core
src/org/opencms/search/CmsSearchSimilarity.java
CmsSearchSimilarity.lengthNorm
private float lengthNorm(FieldInvertState state, int numTerms) { if (state.getName().equals(CmsSearchField.FIELD_CONTENT)) { numTerms = state.getLength() - state.getNumOverlap(); // special length norm for content return (float)(3.0 / (Math.log(1000 + numTerms) / LOG10)); } // all other fields use the default Lucene implementation return (float)(1 / Math.sqrt(numTerms)); }
java
private float lengthNorm(FieldInvertState state, int numTerms) { if (state.getName().equals(CmsSearchField.FIELD_CONTENT)) { numTerms = state.getLength() - state.getNumOverlap(); // special length norm for content return (float)(3.0 / (Math.log(1000 + numTerms) / LOG10)); } // all other fields use the default Lucene implementation return (float)(1 / Math.sqrt(numTerms)); }
[ "private", "float", "lengthNorm", "(", "FieldInvertState", "state", ",", "int", "numTerms", ")", "{", "if", "(", "state", ".", "getName", "(", ")", ".", "equals", "(", "CmsSearchField", ".", "FIELD_CONTENT", ")", ")", "{", "numTerms", "=", "state", ".", ...
Special implementation for "compute norm" to reduce the significance of this factor for the <code>{@link org.opencms.search.fields.CmsLuceneField#FIELD_CONTENT}</code> field, while keeping the Lucene default for all other fields.<p> @param state field invert state @param numTerms number of terms @return the norm as specifically created for OpenCms.
[ "Special", "implementation", "for", "compute", "norm", "to", "reduce", "the", "significance", "of", "this", "factor", "for", "the", "<code", ">", "{", "@link", "org", ".", "opencms", ".", "search", ".", "fields", ".", "CmsLuceneField#FIELD_CONTENT", "}", "<", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchSimilarity.java#L131-L140
JOML-CI/JOML
src/org/joml/AABBd.java
AABBd.setMax
public AABBd setMax(double maxX, double maxY, double maxZ) { this.maxX = maxX; this.maxY = maxY; this.maxZ = maxZ; return this; }
java
public AABBd setMax(double maxX, double maxY, double maxZ) { this.maxX = maxX; this.maxY = maxY; this.maxZ = maxZ; return this; }
[ "public", "AABBd", "setMax", "(", "double", "maxX", ",", "double", "maxY", ",", "double", "maxZ", ")", "{", "this", ".", "maxX", "=", "maxX", ";", "this", ".", "maxY", "=", "maxY", ";", "this", ".", "maxZ", "=", "maxZ", ";", "return", "this", ";", ...
Set the maximum corner coordinates. @param maxX the x coordinate of the maximum corner @param maxY the y coordinate of the maximum corner @param maxZ the z coordinate of the maximum corner @return this
[ "Set", "the", "maximum", "corner", "coordinates", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/AABBd.java#L135-L140
samskivert/pythagoras
src/main/java/pythagoras/d/Matrix3.java
Matrix3.setToRotation
public Matrix3 setToRotation (double angle, IVector3 axis) { return setToRotation(angle, axis.x(), axis.y(), axis.z()); }
java
public Matrix3 setToRotation (double angle, IVector3 axis) { return setToRotation(angle, axis.x(), axis.y(), axis.z()); }
[ "public", "Matrix3", "setToRotation", "(", "double", "angle", ",", "IVector3", "axis", ")", "{", "return", "setToRotation", "(", "angle", ",", "axis", ".", "x", "(", ")", ",", "axis", ".", "y", "(", ")", ",", "axis", ".", "z", "(", ")", ")", ";", ...
Sets this to a rotation matrix. @return a reference to this matrix, for chaining.
[ "Sets", "this", "to", "a", "rotation", "matrix", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix3.java#L166-L168
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java
GeneratedDFactoryDaoImpl.queryByUpdatedDate
public Iterable<DFactory> queryByUpdatedDate(java.util.Date updatedDate) { return queryByField(null, DFactoryMapper.Field.UPDATEDDATE.getFieldName(), updatedDate); }
java
public Iterable<DFactory> queryByUpdatedDate(java.util.Date updatedDate) { return queryByField(null, DFactoryMapper.Field.UPDATEDDATE.getFieldName(), updatedDate); }
[ "public", "Iterable", "<", "DFactory", ">", "queryByUpdatedDate", "(", "java", ".", "util", ".", "Date", "updatedDate", ")", "{", "return", "queryByField", "(", "null", ",", "DFactoryMapper", ".", "Field", ".", "UPDATEDDATE", ".", "getFieldName", "(", ")", "...
query-by method for field updatedDate @param updatedDate the specified attribute @return an Iterable of DFactorys for the specified updatedDate
[ "query", "-", "by", "method", "for", "field", "updatedDate" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java#L124-L126
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
DynamicReportBuilder.addAutoText
public DynamicReportBuilder addAutoText(byte type, byte position, byte alignment, int width, int width2) { HorizontalBandAlignment alignment_ = HorizontalBandAlignment.buildAligment(alignment); AutoText text = new AutoText(type, position, alignment_); text.setWidth(width); text.setWidth2(width2); addAutoText(text); return this; }
java
public DynamicReportBuilder addAutoText(byte type, byte position, byte alignment, int width, int width2) { HorizontalBandAlignment alignment_ = HorizontalBandAlignment.buildAligment(alignment); AutoText text = new AutoText(type, position, alignment_); text.setWidth(width); text.setWidth2(width2); addAutoText(text); return this; }
[ "public", "DynamicReportBuilder", "addAutoText", "(", "byte", "type", ",", "byte", "position", ",", "byte", "alignment", ",", "int", "width", ",", "int", "width2", ")", "{", "HorizontalBandAlignment", "alignment_", "=", "HorizontalBandAlignment", ".", "buildAligment...
Adds an autotext to the Report, this are common texts such us "Page X/Y", "Created on 07/25/2007", etc. <br> The parameters are all constants from the <code>ar.com.fdvs.dj.domain.AutoText</code> class @param type One of these constants: <br>AUTOTEXT_PAGE_X_OF_Y <br> AUTOTEXT_PAGE_X_SLASH_Y <br> AUTOTEXT_PAGE_X, AUTOTEXT_CREATED_ON <br> AUTOTEXT_CUSTOM_MESSAGE @param position POSITION_HEADER or POSITION_FOOTER @param alignment <br>ALIGMENT_LEFT <br> ALIGMENT_CENTER <br> ALIGMENT_RIGHT @return
[ "Adds", "an", "autotext", "to", "the", "Report", "this", "are", "common", "texts", "such", "us", "Page", "X", "/", "Y", "Created", "on", "07", "/", "25", "/", "2007", "etc", ".", "<br", ">", "The", "parameters", "are", "all", "constants", "from", "th...
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L253-L260
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyPairGenerator.java
KeyPairGenerator.getInstance
public static KeyPairGenerator getInstance(String algorithm) throws NoSuchAlgorithmException { List<Service> list = GetInstance.getServices("KeyPairGenerator", algorithm); Iterator<Service> t = list.iterator(); if (t.hasNext() == false) { throw new NoSuchAlgorithmException (algorithm + " KeyPairGenerator not available"); } // find a working Spi or KeyPairGenerator subclass NoSuchAlgorithmException failure = null; do { Service s = t.next(); try { Instance instance = GetInstance.getInstance(s, KeyPairGeneratorSpi.class); if (instance.impl instanceof KeyPairGenerator) { return getInstance(instance, algorithm); } else { return new Delegate(instance, t, algorithm); } } catch (NoSuchAlgorithmException e) { if (failure == null) { failure = e; } } } while (t.hasNext()); throw failure; }
java
public static KeyPairGenerator getInstance(String algorithm) throws NoSuchAlgorithmException { List<Service> list = GetInstance.getServices("KeyPairGenerator", algorithm); Iterator<Service> t = list.iterator(); if (t.hasNext() == false) { throw new NoSuchAlgorithmException (algorithm + " KeyPairGenerator not available"); } // find a working Spi or KeyPairGenerator subclass NoSuchAlgorithmException failure = null; do { Service s = t.next(); try { Instance instance = GetInstance.getInstance(s, KeyPairGeneratorSpi.class); if (instance.impl instanceof KeyPairGenerator) { return getInstance(instance, algorithm); } else { return new Delegate(instance, t, algorithm); } } catch (NoSuchAlgorithmException e) { if (failure == null) { failure = e; } } } while (t.hasNext()); throw failure; }
[ "public", "static", "KeyPairGenerator", "getInstance", "(", "String", "algorithm", ")", "throws", "NoSuchAlgorithmException", "{", "List", "<", "Service", ">", "list", "=", "GetInstance", ".", "getServices", "(", "\"KeyPairGenerator\"", ",", "algorithm", ")", ";", ...
Returns a KeyPairGenerator object that generates public/private key pairs for the specified algorithm. <p> This method traverses the list of registered security Providers, starting with the most preferred Provider. A new KeyPairGenerator object encapsulating the KeyPairGeneratorSpi implementation from the first Provider that supports the specified algorithm is returned. <p> Note that the list of registered providers may be retrieved via the {@link Security#getProviders() Security.getProviders()} method. @param algorithm the standard string name of the algorithm. See the KeyPairGenerator section in the <a href= "{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#KeyPairGenerator"> Java Cryptography Architecture Standard Algorithm Name Documentation</a> for information about standard algorithm names. @return the new KeyPairGenerator object. @exception NoSuchAlgorithmException if no Provider supports a KeyPairGeneratorSpi implementation for the specified algorithm. @see Provider
[ "Returns", "a", "KeyPairGenerator", "object", "that", "generates", "public", "/", "private", "key", "pairs", "for", "the", "specified", "algorithm", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyPairGenerator.java#L240-L268
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java
SystemPropertyUtils.getProperty
public static String getProperty(String key, String defaultValue, String text) { try { String propVal = System.getProperty(key); if (propVal == null) { // Fall back to searching the system environment. propVal = System.getenv(key); } if (propVal == null) { // Try with underscores. String name = key.replace('.', '_'); propVal = System.getenv(name); } if (propVal == null) { // Try uppercase with underscores as well. String name = key.toUpperCase(Locale.ENGLISH).replace('.', '_'); propVal = System.getenv(name); } if (propVal != null) { return propVal; } } catch (Throwable ex) { System.err.println("Could not resolve key '" + key + "' in '" + text + "' as system property or in environment: " + ex); } return defaultValue; }
java
public static String getProperty(String key, String defaultValue, String text) { try { String propVal = System.getProperty(key); if (propVal == null) { // Fall back to searching the system environment. propVal = System.getenv(key); } if (propVal == null) { // Try with underscores. String name = key.replace('.', '_'); propVal = System.getenv(name); } if (propVal == null) { // Try uppercase with underscores as well. String name = key.toUpperCase(Locale.ENGLISH).replace('.', '_'); propVal = System.getenv(name); } if (propVal != null) { return propVal; } } catch (Throwable ex) { System.err.println("Could not resolve key '" + key + "' in '" + text + "' as system property or in environment: " + ex); } return defaultValue; }
[ "public", "static", "String", "getProperty", "(", "String", "key", ",", "String", "defaultValue", ",", "String", "text", ")", "{", "try", "{", "String", "propVal", "=", "System", ".", "getProperty", "(", "key", ")", ";", "if", "(", "propVal", "==", "null...
Search the System properties and environment variables for a value with the provided key. Environment variables in {@code UPPER_CASE} style are allowed where System properties would normally be {@code lower.case}. @param key the key to resolve @param defaultValue the default value @param text optional extra context for an error message if the key resolution fails (e.g. if System properties are not accessible) @return a static property value or null of not found
[ "Search", "the", "System", "properties", "and", "environment", "variables", "for", "a", "value", "with", "the", "provided", "key", ".", "Environment", "variables", "in", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/util/SystemPropertyUtils.java#L179-L205
square/flow
flow/src/main/java/flow/Flow.java
Flow.replaceTop
public void replaceTop(@NonNull final Object key, @NonNull final Direction direction) { setHistory(getHistory().buildUpon().pop(1).push(key).build(), direction); }
java
public void replaceTop(@NonNull final Object key, @NonNull final Direction direction) { setHistory(getHistory().buildUpon().pop(1).push(key).build(), direction); }
[ "public", "void", "replaceTop", "(", "@", "NonNull", "final", "Object", "key", ",", "@", "NonNull", "final", "Direction", "direction", ")", "{", "setHistory", "(", "getHistory", "(", ")", ".", "buildUpon", "(", ")", ".", "pop", "(", "1", ")", ".", "pus...
Replaces the top key of the history with the given key and dispatches in the given direction.
[ "Replaces", "the", "top", "key", "of", "the", "history", "with", "the", "given", "key", "and", "dispatches", "in", "the", "given", "direction", "." ]
train
https://github.com/square/flow/blob/1656288d1cb4a92dfbcff8276f4d7f9e3390419b/flow/src/main/java/flow/Flow.java#L215-L217
cdk/cdk
app/depict/src/main/java/org/openscience/cdk/depict/Abbreviations.java
Abbreviations.matchExact
private IQueryAtom matchExact(final IAtomContainer mol, final IAtom atom) { final IChemObjectBuilder bldr = atom.getBuilder(); int elem = atom.getAtomicNumber(); // attach atom skipped if (elem == 0) return null; int hcnt = atom.getImplicitHydrogenCount(); int val = hcnt; int con = hcnt; for (IBond bond : mol.getConnectedBondsList(atom)) { val += bond.getOrder().numeric(); con++; if (bond.getOther(atom).getAtomicNumber() == 1) hcnt++; } Expr expr = new Expr(Expr.Type.ELEMENT, elem) .and(new Expr(Expr.Type.TOTAL_DEGREE, con)) .and(new Expr(Expr.Type.TOTAL_H_COUNT, hcnt)) .and(new Expr(Expr.Type.VALENCE, val)); return new QueryAtom(expr); }
java
private IQueryAtom matchExact(final IAtomContainer mol, final IAtom atom) { final IChemObjectBuilder bldr = atom.getBuilder(); int elem = atom.getAtomicNumber(); // attach atom skipped if (elem == 0) return null; int hcnt = atom.getImplicitHydrogenCount(); int val = hcnt; int con = hcnt; for (IBond bond : mol.getConnectedBondsList(atom)) { val += bond.getOrder().numeric(); con++; if (bond.getOther(atom).getAtomicNumber() == 1) hcnt++; } Expr expr = new Expr(Expr.Type.ELEMENT, elem) .and(new Expr(Expr.Type.TOTAL_DEGREE, con)) .and(new Expr(Expr.Type.TOTAL_H_COUNT, hcnt)) .and(new Expr(Expr.Type.VALENCE, val)); return new QueryAtom(expr); }
[ "private", "IQueryAtom", "matchExact", "(", "final", "IAtomContainer", "mol", ",", "final", "IAtom", "atom", ")", "{", "final", "IChemObjectBuilder", "bldr", "=", "atom", ".", "getBuilder", "(", ")", ";", "int", "elem", "=", "atom", ".", "getAtomicNumber", "...
Make a query atom that matches atomic number, h count, valence, and connectivity. This effectively provides an exact match for that atom type. @param mol molecule @param atom atom of molecule @return the query atom (null if attachment point)
[ "Make", "a", "query", "atom", "that", "matches", "atomic", "number", "h", "count", "valence", "and", "connectivity", ".", "This", "effectively", "provides", "an", "exact", "match", "for", "that", "atom", "type", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/app/depict/src/main/java/org/openscience/cdk/depict/Abbreviations.java#L693-L718
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java
ProvFactory.newWasEndedBy
public WasEndedBy newWasEndedBy(QualifiedName id, QualifiedName activity, QualifiedName trigger, QualifiedName ender) { WasEndedBy res=newWasEndedBy(id,activity,trigger); res.setEnder(ender); return res; }
java
public WasEndedBy newWasEndedBy(QualifiedName id, QualifiedName activity, QualifiedName trigger, QualifiedName ender) { WasEndedBy res=newWasEndedBy(id,activity,trigger); res.setEnder(ender); return res; }
[ "public", "WasEndedBy", "newWasEndedBy", "(", "QualifiedName", "id", ",", "QualifiedName", "activity", ",", "QualifiedName", "trigger", ",", "QualifiedName", "ender", ")", "{", "WasEndedBy", "res", "=", "newWasEndedBy", "(", "id", ",", "activity", ",", "trigger", ...
A factory method to create an instance of an end {@link WasEndedBy} @param id @param activity an identifier for the ended <a href="http://www.w3.org/TR/prov-dm/#end.activity">activity</a> @param trigger an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#end.trigger">entity triggering</a> the activity ending @param ender an optional identifier for the <a href="http://www.w3.org/TR/prov-dm/#end.ender">activity</a> that generated the (possibly unspecified) entity @return an instance of {@link WasEndedBy}
[ "A", "factory", "method", "to", "create", "an", "instance", "of", "an", "end", "{" ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L1261-L1265
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/source/SourceBuilder.java
SourceBuilder.forEnvironment
public static SourceBuilder forEnvironment(ProcessingEnvironment env, FeatureSet features) { return new SourceBuilder( new CompilerReflection(env.getElementUtils()), Optional.ofNullable(features).orElseGet(() -> new EnvironmentFeatureSet(env))); }
java
public static SourceBuilder forEnvironment(ProcessingEnvironment env, FeatureSet features) { return new SourceBuilder( new CompilerReflection(env.getElementUtils()), Optional.ofNullable(features).orElseGet(() -> new EnvironmentFeatureSet(env))); }
[ "public", "static", "SourceBuilder", "forEnvironment", "(", "ProcessingEnvironment", "env", ",", "FeatureSet", "features", ")", "{", "return", "new", "SourceBuilder", "(", "new", "CompilerReflection", "(", "env", ".", "getElementUtils", "(", ")", ")", ",", "Option...
Returns a {@link SourceBuilder}. {@code env} will be inspected for potential import collisions. If {@code features} is not null, it will be used instead of those deduced from {@code env}.
[ "Returns", "a", "{" ]
train
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/SourceBuilder.java#L58-L62
aws/aws-sdk-java
aws-java-sdk-opensdk/src/main/java/com/amazonaws/opensdk/internal/protocol/ApiGatewayErrorResponseHandler.java
ApiGatewayErrorResponseHandler.createException
private BaseException createException(int httpStatusCode, JsonContent jsonContent) { return unmarshallers.stream() .filter(u -> u.matches(httpStatusCode)) .findFirst() .map(u -> safeUnmarshall(jsonContent, u)) .orElseThrow(this::createUnknownException); }
java
private BaseException createException(int httpStatusCode, JsonContent jsonContent) { return unmarshallers.stream() .filter(u -> u.matches(httpStatusCode)) .findFirst() .map(u -> safeUnmarshall(jsonContent, u)) .orElseThrow(this::createUnknownException); }
[ "private", "BaseException", "createException", "(", "int", "httpStatusCode", ",", "JsonContent", "jsonContent", ")", "{", "return", "unmarshallers", ".", "stream", "(", ")", ".", "filter", "(", "u", "->", "u", ".", "matches", "(", "httpStatusCode", ")", ")", ...
Create an AmazonServiceException using the chain of unmarshallers. This method will never return null, it will always return a valid exception. @param httpStatusCode Http status code to find an appropriate unmarshaller @param jsonContent JsonContent of HTTP response @return Unmarshalled exception
[ "Create", "an", "AmazonServiceException", "using", "the", "chain", "of", "unmarshallers", ".", "This", "method", "will", "never", "return", "null", "it", "will", "always", "return", "a", "valid", "exception", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opensdk/src/main/java/com/amazonaws/opensdk/internal/protocol/ApiGatewayErrorResponseHandler.java#L80-L86
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.divStyle
public static String divStyle(String style, String... content) { return tagStyle(Html.Tag.DIV, style, content); }
java
public static String divStyle(String style, String... content) { return tagStyle(Html.Tag.DIV, style, content); }
[ "public", "static", "String", "divStyle", "(", "String", "style", ",", "String", "...", "content", ")", "{", "return", "tagStyle", "(", "Html", ".", "Tag", ".", "DIV", ",", "style", ",", "content", ")", ";", "}" ]
Build a HTML DIV with given style for a string. Given content does <b>not</b> consists of HTML snippets and as such is being prepared with {@link HtmlBuilder#htmlEncode(String)}. @param style style for div (plain CSS) @param content content string @return HTML DIV element as string
[ "Build", "a", "HTML", "DIV", "with", "given", "style", "for", "a", "string", ".", "Given", "content", "does", "<b", ">", "not<", "/", "b", ">", "consists", "of", "HTML", "snippets", "and", "as", "such", "is", "being", "prepared", "with", "{", "@link", ...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L239-L241
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_GET
public OvhOvhPabxDialplanExtension billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxDialplanExtension.class); }
java
public OvhOvhPabxDialplanExtension billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_GET(String billingAccount, String serviceName, Long dialplanId, Long extensionId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxDialplanExtension.class); }
[ "public", "OvhOvhPabxDialplanExtension", "billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "dialplanId", ",", "Long", "extensionId", ")", "throws", "IOException", "{", ...
Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7034-L7039
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java
SimpleResourceDefinition.registerAddOperation
@Deprecated @SuppressWarnings("deprecation") protected void registerAddOperation(final ManagementResourceRegistration registration, final OperationStepHandler handler, OperationEntry.Flag... flags) { if (handler instanceof DescriptionProvider) { registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD, (DescriptionProvider) handler, OperationEntry.EntryType.PUBLIC,flags) , handler); } else { registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD, new DefaultResourceAddDescriptionProvider(registration, descriptionResolver, orderedChild), OperationEntry.EntryType.PUBLIC, flags) , handler); } }
java
@Deprecated @SuppressWarnings("deprecation") protected void registerAddOperation(final ManagementResourceRegistration registration, final OperationStepHandler handler, OperationEntry.Flag... flags) { if (handler instanceof DescriptionProvider) { registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD, (DescriptionProvider) handler, OperationEntry.EntryType.PUBLIC,flags) , handler); } else { registration.registerOperationHandler(getOperationDefinition(ModelDescriptionConstants.ADD, new DefaultResourceAddDescriptionProvider(registration, descriptionResolver, orderedChild), OperationEntry.EntryType.PUBLIC, flags) , handler); } }
[ "@", "Deprecated", "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "protected", "void", "registerAddOperation", "(", "final", "ManagementResourceRegistration", "registration", ",", "final", "OperationStepHandler", "handler", ",", "OperationEntry", ".", "Flag", "..."...
Registers add operation @param registration resource on which to register @param handler operation handler to register @param flags with flags @deprecated use {@link #registerAddOperation(org.jboss.as.controller.registry.ManagementResourceRegistration, AbstractAddStepHandler, org.jboss.as.controller.registry.OperationEntry.Flag...)}
[ "Registers", "add", "operation" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/SimpleResourceDefinition.java#L415-L430
spring-projects/spring-retry
src/main/java/org/springframework/classify/util/MethodInvokerUtils.java
MethodInvokerUtils.getMethodInvokerByName
public static MethodInvoker getMethodInvokerByName(Object object, String methodName, boolean paramsRequired, Class<?>... paramTypes) { Assert.notNull(object, "Object to invoke must not be null"); Method method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName, paramTypes); if (method == null) { String errorMsg = "no method found with name [" + methodName + "] on class [" + object.getClass().getSimpleName() + "] compatable with the signature [" + getParamTypesString(paramTypes) + "]."; Assert.isTrue(!paramsRequired, errorMsg); // if no method was found for the given parameters, and the // parameters aren't required, then try with no params method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName, new Class[] {}); Assert.notNull(method, errorMsg); } return new SimpleMethodInvoker(object, method); }
java
public static MethodInvoker getMethodInvokerByName(Object object, String methodName, boolean paramsRequired, Class<?>... paramTypes) { Assert.notNull(object, "Object to invoke must not be null"); Method method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName, paramTypes); if (method == null) { String errorMsg = "no method found with name [" + methodName + "] on class [" + object.getClass().getSimpleName() + "] compatable with the signature [" + getParamTypesString(paramTypes) + "]."; Assert.isTrue(!paramsRequired, errorMsg); // if no method was found for the given parameters, and the // parameters aren't required, then try with no params method = ClassUtils.getMethodIfAvailable(object.getClass(), methodName, new Class[] {}); Assert.notNull(method, errorMsg); } return new SimpleMethodInvoker(object, method); }
[ "public", "static", "MethodInvoker", "getMethodInvokerByName", "(", "Object", "object", ",", "String", "methodName", ",", "boolean", "paramsRequired", ",", "Class", "<", "?", ">", "...", "paramTypes", ")", "{", "Assert", ".", "notNull", "(", "object", ",", "\"...
Create a {@link MethodInvoker} using the provided method name to search. @param object to be invoked @param methodName of the method to be invoked @param paramsRequired boolean indicating whether the parameters are required, if false, a no args version of the method will be searched for. @param paramTypes - parameter types of the method to search for. @return MethodInvoker if the method is found, null if it is not.
[ "Create", "a", "{" ]
train
https://github.com/spring-projects/spring-retry/blob/e2b0555f96594c2321990d0deeac45fc44d4f123/src/main/java/org/springframework/classify/util/MethodInvokerUtils.java#L51-L69
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java
ItemsUnion.update
public void update(final Memory srcMem, final ArrayOfItemsSerDe<T> serDe) { final ItemsSketch<T> that = ItemsSketch.getInstance(srcMem, comparator_, serDe); gadget_ = updateLogic(maxK_, comparator_, gadget_, that); }
java
public void update(final Memory srcMem, final ArrayOfItemsSerDe<T> serDe) { final ItemsSketch<T> that = ItemsSketch.getInstance(srcMem, comparator_, serDe); gadget_ = updateLogic(maxK_, comparator_, gadget_, that); }
[ "public", "void", "update", "(", "final", "Memory", "srcMem", ",", "final", "ArrayOfItemsSerDe", "<", "T", ">", "serDe", ")", "{", "final", "ItemsSketch", "<", "T", ">", "that", "=", "ItemsSketch", ".", "getInstance", "(", "srcMem", ",", "comparator_", ","...
Iterative union operation, which means this method can be repeatedly called. Merges the given Memory image of a ItemsSketch into this union object. The given Memory object is not modified and a link to it is not retained. It is required that the ratio of the two K values be a power of 2. This is easily satisfied if each of the K values is already a power of 2. If the given sketch is null or empty it is ignored. <p>It is required that the results of the union operation, which can be obtained at any time, is obtained from {@link #getResult() }.</p> @param srcMem Memory image of sketch to be merged @param serDe an instance of ArrayOfItemsSerDe
[ "Iterative", "union", "operation", "which", "means", "this", "method", "can", "be", "repeatedly", "called", ".", "Merges", "the", "given", "Memory", "image", "of", "a", "ItemsSketch", "into", "this", "union", "object", ".", "The", "given", "Memory", "object", ...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/ItemsUnion.java#L115-L118
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java
TaskOperations.deleteTask
public void deleteTask(String jobId, String taskId) throws BatchErrorException, IOException { deleteTask(jobId, taskId, null); }
java
public void deleteTask(String jobId, String taskId) throws BatchErrorException, IOException { deleteTask(jobId, taskId, null); }
[ "public", "void", "deleteTask", "(", "String", "jobId", ",", "String", "taskId", ")", "throws", "BatchErrorException", ",", "IOException", "{", "deleteTask", "(", "jobId", ",", "taskId", ",", "null", ")", ";", "}" ]
Deletes the specified task. @param jobId The ID of the job containing the task. @param taskId The ID of the task. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Deletes", "the", "specified", "task", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java#L551-L553
erlang/otp
lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNode.java
OtpNode.closeMbox
public void closeMbox(final OtpMbox mbox, final OtpErlangObject reason) { if (mbox != null) { mboxes.remove(mbox); mbox.name = null; mbox.breakLinks(reason); } }
java
public void closeMbox(final OtpMbox mbox, final OtpErlangObject reason) { if (mbox != null) { mboxes.remove(mbox); mbox.name = null; mbox.breakLinks(reason); } }
[ "public", "void", "closeMbox", "(", "final", "OtpMbox", "mbox", ",", "final", "OtpErlangObject", "reason", ")", "{", "if", "(", "mbox", "!=", "null", ")", "{", "mboxes", ".", "remove", "(", "mbox", ")", ";", "mbox", ".", "name", "=", "null", ";", "mb...
Close the specified mailbox with the given reason. @param mbox the mailbox to close. @param reason an Erlang term describing the reason for the termination. <p> After this operation, the mailbox will no longer be able to receive messages. Any delivered but as yet unretrieved messages can still be retrieved however. </p> <p> If there are links from the mailbox to other {@link OtpErlangPid pids}, they will be broken when this method is called and exit signals with the given reason will be sent. </p>
[ "Close", "the", "specified", "mailbox", "with", "the", "given", "reason", "." ]
train
https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpNode.java#L320-L326
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/library/internal/LibraryPackageExporter.java
LibraryPackageExporter.getLibraryExporterRegion
private Region getLibraryExporterRegion(final RegionDigraph digraph, final PackageVisibility visibility) throws BundleException { final String libertyExporterRegionName = getExportFromRegion(visibility); final Region existingLibraryExporter = digraph.getRegion(libertyExporterRegionName); if (existingLibraryExporter == null) { ApiRegion.update(digraph, new Callable<RegionDigraph>() { @Override public RegionDigraph call() throws Exception { RegionDigraph copy = digraph.copy(); Region libraryExporter = copy.getRegion(libertyExporterRegionName); if (libraryExporter != null) { // another thread won creating the region return null; } libraryExporter = copy.createRegion(libertyExporterRegionName); // notice that we assume the exportTo region already exists. // if it does not then we will get an NPE below. Region exportTo = copy.getRegion(getExportToRegion(visibility)); RegionFilterBuilder builder = copy.createRegionFilterBuilder(); // allow all packages into the product hub so that all packages provided by // the library are visible for all liberty feature bundles to use. builder.allowAll(RegionFilter.VISIBLE_PACKAGE_NAMESPACE); exportTo.connectRegion(libraryExporter, builder.build()); return copy; } }); return digraph.getRegion(libertyExporterRegionName); } return existingLibraryExporter; }
java
private Region getLibraryExporterRegion(final RegionDigraph digraph, final PackageVisibility visibility) throws BundleException { final String libertyExporterRegionName = getExportFromRegion(visibility); final Region existingLibraryExporter = digraph.getRegion(libertyExporterRegionName); if (existingLibraryExporter == null) { ApiRegion.update(digraph, new Callable<RegionDigraph>() { @Override public RegionDigraph call() throws Exception { RegionDigraph copy = digraph.copy(); Region libraryExporter = copy.getRegion(libertyExporterRegionName); if (libraryExporter != null) { // another thread won creating the region return null; } libraryExporter = copy.createRegion(libertyExporterRegionName); // notice that we assume the exportTo region already exists. // if it does not then we will get an NPE below. Region exportTo = copy.getRegion(getExportToRegion(visibility)); RegionFilterBuilder builder = copy.createRegionFilterBuilder(); // allow all packages into the product hub so that all packages provided by // the library are visible for all liberty feature bundles to use. builder.allowAll(RegionFilter.VISIBLE_PACKAGE_NAMESPACE); exportTo.connectRegion(libraryExporter, builder.build()); return copy; } }); return digraph.getRegion(libertyExporterRegionName); } return existingLibraryExporter; }
[ "private", "Region", "getLibraryExporterRegion", "(", "final", "RegionDigraph", "digraph", ",", "final", "PackageVisibility", "visibility", ")", "throws", "BundleException", "{", "final", "String", "libertyExporterRegionName", "=", "getExportFromRegion", "(", "visibility", ...
/* Gets or creates the region to install the exporting bundle to. The implementation only uses one of two regions. 1) for all bundles that expose packages to the liberty kernel region 2) for all bundles that expose packages to the osgi applications region for API access
[ "/", "*", "Gets", "or", "creates", "the", "region", "to", "install", "the", "exporting", "bundle", "to", ".", "The", "implementation", "only", "uses", "one", "of", "two", "regions", ".", "1", ")", "for", "all", "bundles", "that", "expose", "packages", "t...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/library/internal/LibraryPackageExporter.java#L192-L220
unbescape/unbescape
src/main/java/org/unbescape/html/HtmlEscape.java
HtmlEscape.escapeHtml4Xml
public static void escapeHtml4Xml(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeHtml(text, offset, len, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
java
public static void escapeHtml4Xml(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeHtml(text, offset, len, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeHtml4Xml", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeHtml", "(", "text", ",", "offset", ...
<p> Perform an HTML 4 level 1 (XML-style) <strong>escape</strong> operation on a <tt>char[]</tt> input. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. It is called <em>XML-style</em> in order to link it with JSP's <tt>escapeXml</tt> attribute in JSTL's <tt>&lt;c:out ... /&gt;</tt> tags. </p> <p> Note this method may <strong>not</strong> produce the same results as {@link #escapeHtml5Xml(char[], int, int, java.io.Writer)} because it will escape the apostrophe as <tt>&amp;#39;</tt>, whereas in HTML5 there is a specific NCR for such character (<tt>&amp;apos;</tt>). </p> <p> This method calls {@link #escapeHtml(char[], int, int, java.io.Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.html.HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li> <li><tt>level</tt>: {@link org.unbescape.html.HtmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be escaped. @param offset the position in <tt>text</tt> at which the escape operation should start. @param len the number of characters in <tt>text</tt> that should be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "an", "HTML", "4", "level", "1", "(", "XML", "-", "style", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L1000-L1004
elki-project/elki
elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java
VectorUtil.minDot
public static double minDot(SpatialComparable v1, SpatialComparable v2) { if(v1 instanceof NumberVector && v2 instanceof NumberVector) { return dot((NumberVector) v1, (NumberVector) v2); } final int dim1 = v1.getDimensionality(), dim2 = v2.getDimensionality(); final int mindim = (dim1 <= dim2) ? dim1 : dim2; // Essentially, we want to compute this: // absmax(v1.transposeTimes(v2)); double s1 = 0, s2 = 0; for(int k = 0; k < mindim; k++) { final double min1 = v1.getMin(k), max1 = v1.getMax(k); final double min2 = v2.getMin(k), max2 = v2.getMax(k); final double p1 = min1 * min2, p2 = min1 * max2; final double p3 = max1 * min2, p4 = max1 * max2; s1 += Math.max(Math.max(p1, p2), Math.max(p3, p4)); s2 += Math.min(Math.min(p1, p2), Math.min(p3, p4)); } return Math.max(Math.abs(s1), Math.abs(s2)); }
java
public static double minDot(SpatialComparable v1, SpatialComparable v2) { if(v1 instanceof NumberVector && v2 instanceof NumberVector) { return dot((NumberVector) v1, (NumberVector) v2); } final int dim1 = v1.getDimensionality(), dim2 = v2.getDimensionality(); final int mindim = (dim1 <= dim2) ? dim1 : dim2; // Essentially, we want to compute this: // absmax(v1.transposeTimes(v2)); double s1 = 0, s2 = 0; for(int k = 0; k < mindim; k++) { final double min1 = v1.getMin(k), max1 = v1.getMax(k); final double min2 = v2.getMin(k), max2 = v2.getMax(k); final double p1 = min1 * min2, p2 = min1 * max2; final double p3 = max1 * min2, p4 = max1 * max2; s1 += Math.max(Math.max(p1, p2), Math.max(p3, p4)); s2 += Math.min(Math.min(p1, p2), Math.min(p3, p4)); } return Math.max(Math.abs(s1), Math.abs(s2)); }
[ "public", "static", "double", "minDot", "(", "SpatialComparable", "v1", ",", "SpatialComparable", "v2", ")", "{", "if", "(", "v1", "instanceof", "NumberVector", "&&", "v2", "instanceof", "NumberVector", ")", "{", "return", "dot", "(", "(", "NumberVector", ")",...
Compute the minimum angle between two rectangles, assuming unit length vectors @param v1 first rectangle @param v2 second rectangle @return Angle
[ "Compute", "the", "minimum", "angle", "between", "two", "rectangles", "assuming", "unit", "length", "vectors" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/data/VectorUtil.java#L432-L450
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java
StringUtils.formatParam
public static String formatParam(Object value, String delimiter) { if (value != null) { if (byte[].class.getSimpleName().equals(value.getClass().getSimpleName())) { return checkSize((byte[]) value, VIEW_SIZE); } String str = value.toString(); if (str.length() > VIEW_SIZE) { return delimiter + str.substring(0, VIEW_SIZE - 3) + "..." + delimiter; } else return delimiter + str + delimiter; } else return "<undefined>"; }
java
public static String formatParam(Object value, String delimiter) { if (value != null) { if (byte[].class.getSimpleName().equals(value.getClass().getSimpleName())) { return checkSize((byte[]) value, VIEW_SIZE); } String str = value.toString(); if (str.length() > VIEW_SIZE) { return delimiter + str.substring(0, VIEW_SIZE - 3) + "..." + delimiter; } else return delimiter + str + delimiter; } else return "<undefined>"; }
[ "public", "static", "String", "formatParam", "(", "Object", "value", ",", "String", "delimiter", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "byte", "[", "]", ".", "class", ".", "getSimpleName", "(", ")", ".", "equals", "(", "val...
format as sql parameter. If value is not null, method will return 'value'. If value is not null, delimiter will be used to delimit return value. Otherwise, defaultValue will be returned, without delimiter. @param value the value @param delimiter the delimiter @return the string
[ "format", "as", "sql", "parameter", ".", "If", "value", "is", "not", "null", "method", "will", "return", "value", ".", "If", "value", "is", "not", "null", "delimiter", "will", "be", "used", "to", "delimit", "return", "value", ".", "Otherwise", "defaultValu...
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java#L140-L154
apache/reef
lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFileEntry.java
LogFileEntry.writeFiles
private void writeFiles(final DataInputStream valueStream, final Writer outputWriter) throws IOException { while (valueStream.available() > 0) { final String strFileName = valueStream.readUTF(); final int entryLength = Integer.parseInt(valueStream.readUTF()); outputWriter.write("=====================================================\n"); outputWriter.write("File Name: " + strFileName + "\n"); outputWriter.write("File Length: " + entryLength + "\n"); outputWriter.write("-----------------------------------------------------\n"); this.write(valueStream, outputWriter, entryLength); outputWriter.write("\n"); } }
java
private void writeFiles(final DataInputStream valueStream, final Writer outputWriter) throws IOException { while (valueStream.available() > 0) { final String strFileName = valueStream.readUTF(); final int entryLength = Integer.parseInt(valueStream.readUTF()); outputWriter.write("=====================================================\n"); outputWriter.write("File Name: " + strFileName + "\n"); outputWriter.write("File Length: " + entryLength + "\n"); outputWriter.write("-----------------------------------------------------\n"); this.write(valueStream, outputWriter, entryLength); outputWriter.write("\n"); } }
[ "private", "void", "writeFiles", "(", "final", "DataInputStream", "valueStream", ",", "final", "Writer", "outputWriter", ")", "throws", "IOException", "{", "while", "(", "valueStream", ".", "available", "(", ")", ">", "0", ")", "{", "final", "String", "strFile...
Writes the logs of the next container to the given writer. Assumes that the valueStream is suitably positioned. @param valueStream @param outputWriter @throws IOException
[ "Writes", "the", "logs", "of", "the", "next", "container", "to", "the", "given", "writer", ".", "Assumes", "that", "the", "valueStream", "is", "suitably", "positioned", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFileEntry.java#L80-L91
Ordinastie/MalisisCore
src/main/java/net/malisis/core/client/gui/component/interaction/UITextField.java
UITextField.setFilter
public void setFilter(Function<String, String> filterFunction) { this.filterFunction = filterFunction; this.text = new StringBuilder(this.filterFunction.apply(this.text.toString())); }
java
public void setFilter(Function<String, String> filterFunction) { this.filterFunction = filterFunction; this.text = new StringBuilder(this.filterFunction.apply(this.text.toString())); }
[ "public", "void", "setFilter", "(", "Function", "<", "String", ",", "String", ">", "filterFunction", ")", "{", "this", ".", "filterFunction", "=", "filterFunction", ";", "this", ".", "text", "=", "new", "StringBuilder", "(", "this", ".", "filterFunction", "....
Sets the function that applies to all incoming text. Immediately applies filter to current text. @param filterFunction the function
[ "Sets", "the", "function", "that", "applies", "to", "all", "incoming", "text", ".", "Immediately", "applies", "filter", "to", "current", "text", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/client/gui/component/interaction/UITextField.java#L379-L383
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShippingMethodPersistenceImpl.java
CommerceShippingMethodPersistenceImpl.findAll
@Override public List<CommerceShippingMethod> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CommerceShippingMethod> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceShippingMethod", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce shipping methods. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceShippingMethodModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce shipping methods @param end the upper bound of the range of commerce shipping methods (not inclusive) @return the range of commerce shipping methods
[ "Returns", "a", "range", "of", "all", "the", "commerce", "shipping", "methods", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShippingMethodPersistenceImpl.java#L2023-L2026
MenoData/Time4J
base/src/main/java/net/time4j/format/expert/ChronoFormatter.java
ChronoFormatter.ofStyle
public static <T extends LocalizedPatternSupport> ChronoFormatter<T> ofStyle( DisplayMode style, Locale locale, Chronology<T> chronology ) { if (LocalizedPatternSupport.class.isAssignableFrom(chronology.getChronoType())) { Builder<T> builder = new Builder<>(chronology, locale); builder.addProcessor(new StyleProcessor<>(style, style)); return builder.build(); // Compiler will not accept the Moment-chronology! // } else if (chronology.equals(Moment.axis())) { // throw new UnsupportedOperationException("Timezone required, use 'ofMomentStyle()' instead."); } else { throw new UnsupportedOperationException("Localized format patterns not available: " + chronology); } }
java
public static <T extends LocalizedPatternSupport> ChronoFormatter<T> ofStyle( DisplayMode style, Locale locale, Chronology<T> chronology ) { if (LocalizedPatternSupport.class.isAssignableFrom(chronology.getChronoType())) { Builder<T> builder = new Builder<>(chronology, locale); builder.addProcessor(new StyleProcessor<>(style, style)); return builder.build(); // Compiler will not accept the Moment-chronology! // } else if (chronology.equals(Moment.axis())) { // throw new UnsupportedOperationException("Timezone required, use 'ofMomentStyle()' instead."); } else { throw new UnsupportedOperationException("Localized format patterns not available: " + chronology); } }
[ "public", "static", "<", "T", "extends", "LocalizedPatternSupport", ">", "ChronoFormatter", "<", "T", ">", "ofStyle", "(", "DisplayMode", "style", ",", "Locale", "locale", ",", "Chronology", "<", "T", ">", "chronology", ")", "{", "if", "(", "LocalizedPatternSu...
/*[deutsch] <p>Konstruiert einen stilbasierten Formatierer f&uuml;r allgemeine Chronologien. </p> @param <T> generic chronological type @param style format style @param locale format locale @param chronology chronology with format pattern support @return new {@code ChronoFormatter}-instance @throws UnsupportedOperationException if given style is not supported @see DisplayMode @since 3.10/4.7
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Konstruiert", "einen", "stilbasierten", "Formatierer", "f&uuml", ";", "r", "allgemeine", "Chronologien", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/format/expert/ChronoFormatter.java#L2641-L2658
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.createConversation
public void createConversation(@NonNull final ConversationCreate request, @Nullable Callback<ComapiResult<ConversationDetails>> callback) { adapter.adapt(createConversation(request), callback); }
java
public void createConversation(@NonNull final ConversationCreate request, @Nullable Callback<ComapiResult<ConversationDetails>> callback) { adapter.adapt(createConversation(request), callback); }
[ "public", "void", "createConversation", "(", "@", "NonNull", "final", "ConversationCreate", "request", ",", "@", "Nullable", "Callback", "<", "ComapiResult", "<", "ConversationDetails", ">", ">", "callback", ")", "{", "adapter", ".", "adapt", "(", "createConversat...
Returns observable to create a conversation. @param request Request with conversation details to create. @param callback Callback to deliver new session instance.
[ "Returns", "observable", "to", "create", "a", "conversation", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L433-L435
salesforce/Argus
ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/NamespaceService.java
NamespaceService.updateNamespace
public Namespace updateNamespace(BigInteger id, Namespace namespace) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + id.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, namespace); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Namespace.class); }
java
public Namespace updateNamespace(BigInteger id, Namespace namespace) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + id.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, namespace); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Namespace.class); }
[ "public", "Namespace", "updateNamespace", "(", "BigInteger", "id", ",", "Namespace", "namespace", ")", "throws", "IOException", ",", "TokenExpiredException", "{", "String", "requestUrl", "=", "RESOURCE", "+", "\"/\"", "+", "id", ".", "toString", "(", ")", ";", ...
Updates a new namespace. @param id The ID of the namespace to update. @param namespace The namespace to update. @return The updated namespace. @throws IOException If the server cannot be reached. @throws TokenExpiredException If the token sent along with the request has expired
[ "Updates", "a", "new", "namespace", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/NamespaceService.java#L113-L119
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/validation/ProjectValidator.java
ProjectValidator.validateProject
public static ProjectValidationResult validateProject( File appDirectory ) { // Determine whether the project is a recipe one. // Since a Roboconf project is not mandatory a Maven project, // we cannot rely on the POM. But we make the hypothesis that // if the project has neither a descriptor file, nor instances, // then it can be considered as a recipe project. // If there is a POM that indicates it is (or not) a recipe // project, then errors will appear during the Maven build. File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); boolean isRecipe = ! new File( appDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ).exists() && (! instancesDir.isDirectory() || Utils.listAllFiles( instancesDir ).isEmpty()); // Validate the project then return validateProject( appDirectory, isRecipe ); }
java
public static ProjectValidationResult validateProject( File appDirectory ) { // Determine whether the project is a recipe one. // Since a Roboconf project is not mandatory a Maven project, // we cannot rely on the POM. But we make the hypothesis that // if the project has neither a descriptor file, nor instances, // then it can be considered as a recipe project. // If there is a POM that indicates it is (or not) a recipe // project, then errors will appear during the Maven build. File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); boolean isRecipe = ! new File( appDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ).exists() && (! instancesDir.isDirectory() || Utils.listAllFiles( instancesDir ).isEmpty()); // Validate the project then return validateProject( appDirectory, isRecipe ); }
[ "public", "static", "ProjectValidationResult", "validateProject", "(", "File", "appDirectory", ")", "{", "// Determine whether the project is a recipe one.", "// Since a Roboconf project is not mandatory a Maven project,", "// we cannot rely on the POM. But we make the hypothesis that", "// ...
Validates a project. <p> Whereas {@link #validateProject(File, boolean)}, this method tries to guess whether the project is a recipe one or not. It assumes that if the project has neither a descriptor file, nor instances, then it can be considered as a recipe project </p> @param appDirectory the application's directory (must exist) @return a non-null list of errors, with the resolved location (sorted by error code)
[ "Validates", "a", "project", ".", "<p", ">", "Whereas", "{", "@link", "#validateProject", "(", "File", "boolean", ")", "}", "this", "method", "tries", "to", "guess", "whether", "the", "project", "is", "a", "recipe", "one", "or", "not", ".", "It", "assume...
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/validation/ProjectValidator.java#L70-L88
Quickhull3d/quickhull3d
src/main/java/com/github/quickhull3d/QuickHull3D.java
QuickHull3D.build
public void build(double[] coords, int nump) throws IllegalArgumentException { if (nump < 4) { throw new IllegalArgumentException("Less than four input points specified"); } if (coords.length / 3 < nump) { throw new IllegalArgumentException("Coordinate array too small for specified number of points"); } initBuffers(nump); setPoints(coords, nump); buildHull(); }
java
public void build(double[] coords, int nump) throws IllegalArgumentException { if (nump < 4) { throw new IllegalArgumentException("Less than four input points specified"); } if (coords.length / 3 < nump) { throw new IllegalArgumentException("Coordinate array too small for specified number of points"); } initBuffers(nump); setPoints(coords, nump); buildHull(); }
[ "public", "void", "build", "(", "double", "[", "]", "coords", ",", "int", "nump", ")", "throws", "IllegalArgumentException", "{", "if", "(", "nump", "<", "4", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Less than four input points specified\"", ...
Constructs the convex hull of a set of points whose coordinates are given by an array of doubles. @param coords x, y, and z coordinates of each input point. The length of this array must be at least three times <code>nump</code>. @param nump number of input points @throws IllegalArgumentException the number of input points is less than four or greater than 1/3 the length of <code>coords</code>, or the points appear to be coincident, colinear, or coplanar.
[ "Constructs", "the", "convex", "hull", "of", "a", "set", "of", "points", "whose", "coordinates", "are", "given", "by", "an", "array", "of", "doubles", "." ]
train
https://github.com/Quickhull3d/quickhull3d/blob/3f80953b86c46385e84730e5d2a1745cbfa12703/src/main/java/com/github/quickhull3d/QuickHull3D.java#L462-L472
Impetus/Kundera
src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBSchemaManager.java
CouchDBSchemaManager.dropDatabase
private void dropDatabase() throws IOException, ClientProtocolException, URISyntaxException { HttpResponse delRes = null; try { URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(), CouchDBConstants.URL_SEPARATOR + databaseName.toLowerCase(), null, null); HttpDelete delete = new HttpDelete(uri); delRes = httpClient.execute(httpHost, delete, CouchDBUtils.getContext(httpHost)); } finally { CouchDBUtils.closeContent(delRes); } }
java
private void dropDatabase() throws IOException, ClientProtocolException, URISyntaxException { HttpResponse delRes = null; try { URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(), CouchDBConstants.URL_SEPARATOR + databaseName.toLowerCase(), null, null); HttpDelete delete = new HttpDelete(uri); delRes = httpClient.execute(httpHost, delete, CouchDBUtils.getContext(httpHost)); } finally { CouchDBUtils.closeContent(delRes); } }
[ "private", "void", "dropDatabase", "(", ")", "throws", "IOException", ",", "ClientProtocolException", ",", "URISyntaxException", "{", "HttpResponse", "delRes", "=", "null", ";", "try", "{", "URI", "uri", "=", "new", "URI", "(", "CouchDBConstants", ".", "PROTOCOL...
Drop database. @throws IOException Signals that an I/O exception has occurred. @throws ClientProtocolException the client protocol exception @throws URISyntaxException the URI syntax exception
[ "Drop", "database", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBSchemaManager.java#L749-L763
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscalepolicy.java
autoscalepolicy.get
public static autoscalepolicy get(nitro_service service, String name) throws Exception{ autoscalepolicy obj = new autoscalepolicy(); obj.set_name(name); autoscalepolicy response = (autoscalepolicy) obj.get_resource(service); return response; }
java
public static autoscalepolicy get(nitro_service service, String name) throws Exception{ autoscalepolicy obj = new autoscalepolicy(); obj.set_name(name); autoscalepolicy response = (autoscalepolicy) obj.get_resource(service); return response; }
[ "public", "static", "autoscalepolicy", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "autoscalepolicy", "obj", "=", "new", "autoscalepolicy", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "aut...
Use this API to fetch autoscalepolicy resource of given name .
[ "Use", "this", "API", "to", "fetch", "autoscalepolicy", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscalepolicy.java#L443-L448
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.executeQuery
public List executeQuery(String jsonClause, EntityMetadata entityMetadata) { List entities = new ArrayList(); try { DBCursor cursor = parseAndScroll(jsonClause, entityMetadata.getTableName()); while (cursor.hasNext()) { DBObject fetchedDocument = cursor.next(); populateEntity(entityMetadata, entities, fetchedDocument); } return entities; } catch (JSONParseException jex) { entities = executeNativeQuery(jsonClause, entityMetadata); List result = new ArrayList(); if (entities.size() > 0 && (entities.get(0) instanceof EnhanceEntity)) { for (Object obj : entities) { result.add(((EnhanceEntity) obj).getEntity()); } return result; } return entities; } }
java
public List executeQuery(String jsonClause, EntityMetadata entityMetadata) { List entities = new ArrayList(); try { DBCursor cursor = parseAndScroll(jsonClause, entityMetadata.getTableName()); while (cursor.hasNext()) { DBObject fetchedDocument = cursor.next(); populateEntity(entityMetadata, entities, fetchedDocument); } return entities; } catch (JSONParseException jex) { entities = executeNativeQuery(jsonClause, entityMetadata); List result = new ArrayList(); if (entities.size() > 0 && (entities.get(0) instanceof EnhanceEntity)) { for (Object obj : entities) { result.add(((EnhanceEntity) obj).getEntity()); } return result; } return entities; } }
[ "public", "List", "executeQuery", "(", "String", "jsonClause", ",", "EntityMetadata", "entityMetadata", ")", "{", "List", "entities", "=", "new", "ArrayList", "(", ")", ";", "try", "{", "DBCursor", "cursor", "=", "parseAndScroll", "(", "jsonClause", ",", "enti...
Execute query. @param jsonClause the json clause @param entityMetadata the entity metadata @return the list
[ "Execute", "query", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L1628-L1658
pravega/pravega
common/src/main/java/io/pravega/common/util/BitConverter.java
BitConverter.readLong
public static long readLong(ArrayView source, int position) { return (long) (source.get(position) & 0xFF) << 56 | (long) (source.get(position + 1) & 0xFF) << 48 | (long) (source.get(position + 2) & 0xFF) << 40 | (long) (source.get(position + 3) & 0xFF) << 32 | (long) (source.get(position + 4) & 0xFF) << 24 | (source.get(position + 5) & 0xFF) << 16 | (source.get(position + 6) & 0xFF) << 8 | (source.get(position + 7) & 0xFF); }
java
public static long readLong(ArrayView source, int position) { return (long) (source.get(position) & 0xFF) << 56 | (long) (source.get(position + 1) & 0xFF) << 48 | (long) (source.get(position + 2) & 0xFF) << 40 | (long) (source.get(position + 3) & 0xFF) << 32 | (long) (source.get(position + 4) & 0xFF) << 24 | (source.get(position + 5) & 0xFF) << 16 | (source.get(position + 6) & 0xFF) << 8 | (source.get(position + 7) & 0xFF); }
[ "public", "static", "long", "readLong", "(", "ArrayView", "source", ",", "int", "position", ")", "{", "return", "(", "long", ")", "(", "source", ".", "get", "(", "position", ")", "&", "0xFF", ")", "<<", "56", "|", "(", "long", ")", "(", "source", "...
Reads a 64-bit long from the given ArrayView starting at the given position. @param source The ArrayView to read from. @param position The position in the ArrayView to start reading at. @return The read number.
[ "Reads", "a", "64", "-", "bit", "long", "from", "the", "given", "ArrayView", "starting", "at", "the", "given", "position", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L242-L251
apereo/cas
support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/DelegatedClientNavigationController.java
DelegatedClientNavigationController.redirectResponseToFlow
@RequestMapping(value = ENDPOINT_RESPONSE, method = {RequestMethod.GET, RequestMethod.POST}) public View redirectResponseToFlow(@PathVariable("clientName") final String clientName, final HttpServletRequest request, final HttpServletResponse response) { return buildRedirectViewBackToFlow(clientName, request); }
java
@RequestMapping(value = ENDPOINT_RESPONSE, method = {RequestMethod.GET, RequestMethod.POST}) public View redirectResponseToFlow(@PathVariable("clientName") final String clientName, final HttpServletRequest request, final HttpServletResponse response) { return buildRedirectViewBackToFlow(clientName, request); }
[ "@", "RequestMapping", "(", "value", "=", "ENDPOINT_RESPONSE", ",", "method", "=", "{", "RequestMethod", ".", "GET", ",", "RequestMethod", ".", "POST", "}", ")", "public", "View", "redirectResponseToFlow", "(", "@", "PathVariable", "(", "\"clientName\"", ")", ...
Redirect response to flow. Receives the CAS, OAuth, OIDC, etc. callback response, adjust it to work with the login webflow, and redirects the requests to the login webflow endpoint. @param clientName the path-based parameter that provider the pac4j client name @param request the request @param response the response @return the view
[ "Redirect", "response", "to", "flow", ".", "Receives", "the", "CAS", "OAuth", "OIDC", "etc", ".", "callback", "response", "adjust", "it", "to", "work", "with", "the", "login", "webflow", "and", "redirects", "the", "requests", "to", "the", "login", "webflow",...
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/DelegatedClientNavigationController.java#L106-L110
gresrun/jesque
src/main/java/net/greghaines/jesque/worker/MapBasedJobFactory.java
MapBasedJobFactory.checkJobTypes
protected void checkJobTypes(final Map<String, ? extends Class<?>> jobTypes) { if (jobTypes == null) { throw new IllegalArgumentException("jobTypes must not be null"); } for (final Entry<String, ? extends Class<?>> entry : jobTypes.entrySet()) { try { checkJobType(entry.getKey(), entry.getValue()); } catch (IllegalArgumentException iae) { throw new IllegalArgumentException("jobTypes contained invalid value", iae); } } }
java
protected void checkJobTypes(final Map<String, ? extends Class<?>> jobTypes) { if (jobTypes == null) { throw new IllegalArgumentException("jobTypes must not be null"); } for (final Entry<String, ? extends Class<?>> entry : jobTypes.entrySet()) { try { checkJobType(entry.getKey(), entry.getValue()); } catch (IllegalArgumentException iae) { throw new IllegalArgumentException("jobTypes contained invalid value", iae); } } }
[ "protected", "void", "checkJobTypes", "(", "final", "Map", "<", "String", ",", "?", "extends", "Class", "<", "?", ">", ">", "jobTypes", ")", "{", "if", "(", "jobTypes", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"jobTypes mu...
Verify the given job types are all valid. @param jobTypes the given job types @throws IllegalArgumentException if any of the job types are invalid @see #checkJobType(String, Class)
[ "Verify", "the", "given", "job", "types", "are", "all", "valid", "." ]
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/worker/MapBasedJobFactory.java#L109-L120
OpenTSDB/opentsdb
src/core/Tags.java
Tags.getTags
static Map<String, String> getTags(final TSDB tsdb, final byte[] row) throws NoSuchUniqueId { try { return getTagsAsync(tsdb, row).joinUninterruptibly(); } catch (DeferredGroupException e) { final Throwable ex = Exceptions.getCause(e); if (ex instanceof NoSuchUniqueId) { throw (NoSuchUniqueId)ex; } throw new RuntimeException("Should never be here", e); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException("Should never be here", e); } }
java
static Map<String, String> getTags(final TSDB tsdb, final byte[] row) throws NoSuchUniqueId { try { return getTagsAsync(tsdb, row).joinUninterruptibly(); } catch (DeferredGroupException e) { final Throwable ex = Exceptions.getCause(e); if (ex instanceof NoSuchUniqueId) { throw (NoSuchUniqueId)ex; } throw new RuntimeException("Should never be here", e); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException("Should never be here", e); } }
[ "static", "Map", "<", "String", ",", "String", ">", "getTags", "(", "final", "TSDB", "tsdb", ",", "final", "byte", "[", "]", "row", ")", "throws", "NoSuchUniqueId", "{", "try", "{", "return", "getTagsAsync", "(", "tsdb", ",", "row", ")", ".", "joinUnin...
Returns the tags stored in the given row key. @param tsdb The TSDB instance to use for Unique ID lookups. @param row The row key from which to extract the tags. @return A map of tag names (keys), tag values (values). @throws NoSuchUniqueId if the row key contained an invalid ID (unlikely).
[ "Returns", "the", "tags", "stored", "in", "the", "given", "row", "key", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Tags.java#L405-L421
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipCall.java
SipCall.waitForCancelResponse
public boolean waitForCancelResponse(SipTransaction siptrans, long timeout) { initErrorInfo(); if (siptrans == null) { returnCode = SipSession.INVALID_OPERATION; errorMessage = (String) SipSession.statusCodeDescription.get(new Integer(returnCode)) + " - no RE-INVITE transaction object given"; return false; } EventObject response_event = parent.waitResponse(siptrans, timeout); if (response_event == null) { setErrorMessage(parent.getErrorMessage()); setException(parent.getException()); setReturnCode(parent.getReturnCode()); return false; } if (response_event instanceof TimeoutEvent) { setReturnCode(SipPhone.TIMEOUT_OCCURRED); setErrorMessage("A Timeout Event was received"); return false; } Response resp = ((ResponseEvent) response_event).getResponse(); receivedResponses.add(new SipResponse((ResponseEvent) response_event)); LOG.info("CANCEL response received: {}", resp.toString()); setReturnCode(resp.getStatusCode()); return true; }
java
public boolean waitForCancelResponse(SipTransaction siptrans, long timeout) { initErrorInfo(); if (siptrans == null) { returnCode = SipSession.INVALID_OPERATION; errorMessage = (String) SipSession.statusCodeDescription.get(new Integer(returnCode)) + " - no RE-INVITE transaction object given"; return false; } EventObject response_event = parent.waitResponse(siptrans, timeout); if (response_event == null) { setErrorMessage(parent.getErrorMessage()); setException(parent.getException()); setReturnCode(parent.getReturnCode()); return false; } if (response_event instanceof TimeoutEvent) { setReturnCode(SipPhone.TIMEOUT_OCCURRED); setErrorMessage("A Timeout Event was received"); return false; } Response resp = ((ResponseEvent) response_event).getResponse(); receivedResponses.add(new SipResponse((ResponseEvent) response_event)); LOG.info("CANCEL response received: {}", resp.toString()); setReturnCode(resp.getStatusCode()); return true; }
[ "public", "boolean", "waitForCancelResponse", "(", "SipTransaction", "siptrans", ",", "long", "timeout", ")", "{", "initErrorInfo", "(", ")", ";", "if", "(", "siptrans", "==", "null", ")", "{", "returnCode", "=", "SipSession", ".", "INVALID_OPERATION", ";", "e...
The waitForCancelResponse() method waits for a response to be received from the network for a sent CANCEL. Call this method after calling sendCancel(). <p> This method blocks until one of the following occurs: 1) A response message has been received. In this case, a value of true is returned. Call the getLastReceivedResponse() method to get the response details. 2) A timeout occurs. A false value is returned in this case. 3) An error occurs. False is returned in this case. <p> Regardless of the outcome, getReturnCode() can be called after this method returns to get the status code: IE, the SIP response code received from the network (defined in SipResponse, along with the corresponding textual equivalent) or a SipUnit internal status/error code (defined in SipSession, along with the corresponding textual equivalent). SipUnit internal codes are in a specially designated range (SipSession.SIPUNIT_INTERNAL_RETURNCODE_MIN and upward). <p> @param siptrans This is the object that was returned by method sendCancel(). It identifies a specific Cancel transaction. @param timeout The maximum amount of time to wait, in milliseconds. Use a value of 0 to wait indefinitely. @return true if a response was received - in that case, call getReturnCode() to get the status code that was contained in the received response, and/or call getLastReceivedResponse() to see the response details. Returns false if timeout or error.
[ "The", "waitForCancelResponse", "()", "method", "waits", "for", "a", "response", "to", "be", "received", "from", "the", "network", "for", "a", "sent", "CANCEL", ".", "Call", "this", "method", "after", "calling", "sendCancel", "()", ".", "<p", ">", "This", ...
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipCall.java#L3388-L3420
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getDeletedCertificateAsync
public Observable<DeletedCertificateBundle> getDeletedCertificateAsync(String vaultBaseUrl, String certificateName) { return getDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName).map(new Func1<ServiceResponse<DeletedCertificateBundle>, DeletedCertificateBundle>() { @Override public DeletedCertificateBundle call(ServiceResponse<DeletedCertificateBundle> response) { return response.body(); } }); }
java
public Observable<DeletedCertificateBundle> getDeletedCertificateAsync(String vaultBaseUrl, String certificateName) { return getDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName).map(new Func1<ServiceResponse<DeletedCertificateBundle>, DeletedCertificateBundle>() { @Override public DeletedCertificateBundle call(ServiceResponse<DeletedCertificateBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DeletedCertificateBundle", ">", "getDeletedCertificateAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ")", "{", "return", "getDeletedCertificateWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ")", ...
Retrieves information about the specified deleted certificate. The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires the certificates/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DeletedCertificateBundle object
[ "Retrieves", "information", "about", "the", "specified", "deleted", "certificate", ".", "The", "GetDeletedCertificate", "operation", "retrieves", "the", "deleted", "certificate", "information", "plus", "its", "attributes", "such", "as", "retention", "interval", "schedul...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8561-L8568
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/ProtectionContainersInner.java
ProtectionContainersInner.inquireAsync
public Observable<Void> inquireAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String filter) { return inquireWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, filter).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> inquireAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String filter) { return inquireWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, filter).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "inquireAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "fabricName", ",", "String", "containerName", ",", "String", "filter", ")", "{", "return", "inquireWithServiceResponseAsync", "("...
Inquires all the protectable item in the given container that can be protected. Inquires all the protectable items that are protectable under the given container. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param fabricName Fabric Name associated with the container. @param containerName Name of the container in which inquiry needs to be triggered. @param filter OData filter options. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Inquires", "all", "the", "protectable", "item", "in", "the", "given", "container", "that", "can", "be", "protected", ".", "Inquires", "all", "the", "protectable", "items", "that", "are", "protectable", "under", "the", "given", "container", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/ProtectionContainersInner.java#L541-L548
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/document/json/JsonObject.java
JsonObject.getAndDecryptBigInteger
public BigInteger getAndDecryptBigInteger(String name, String providerName) throws Exception { return (BigInteger) getAndDecrypt(name, providerName); }
java
public BigInteger getAndDecryptBigInteger(String name, String providerName) throws Exception { return (BigInteger) getAndDecrypt(name, providerName); }
[ "public", "BigInteger", "getAndDecryptBigInteger", "(", "String", "name", ",", "String", "providerName", ")", "throws", "Exception", "{", "return", "(", "BigInteger", ")", "getAndDecrypt", "(", "name", ",", "providerName", ")", ";", "}" ]
Retrieves the decrypted value from the field name and casts it to {@link BigInteger}. Note: Use of the Field Level Encryption functionality provided in the com.couchbase.client.encryption namespace provided by Couchbase is subject to the Couchbase Inc. Enterprise Subscription License Agreement at https://www.couchbase.com/ESLA-11132015. @param name the name of the field. @param providerName crypto provider name for decryption. @return the result or null if it does not exist.
[ "Retrieves", "the", "decrypted", "value", "from", "the", "field", "name", "and", "casts", "it", "to", "{", "@link", "BigInteger", "}", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L912-L914
couchbase/CouchbaseMock
src/main/java/com/couchbase/mock/httpio/HandlerUtil.java
HandlerUtil.makeStringResponse
public static void makeStringResponse(HttpResponse response, String s) { StringEntity entity = new StringEntity(s, ContentType.TEXT_PLAIN); entity.setContentEncoding("utf-8"); response.setEntity(entity); }
java
public static void makeStringResponse(HttpResponse response, String s) { StringEntity entity = new StringEntity(s, ContentType.TEXT_PLAIN); entity.setContentEncoding("utf-8"); response.setEntity(entity); }
[ "public", "static", "void", "makeStringResponse", "(", "HttpResponse", "response", ",", "String", "s", ")", "{", "StringEntity", "entity", "=", "new", "StringEntity", "(", "s", ",", "ContentType", ".", "TEXT_PLAIN", ")", ";", "entity", ".", "setContentEncoding",...
Sets a string as the response @param response The response object @param s The response body
[ "Sets", "a", "string", "as", "the", "response" ]
train
https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/httpio/HandlerUtil.java#L148-L152
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java
PatternBox.controlsExpressionWithConversion
public static Pattern controlsExpressionWithConversion() { Pattern p = new Pattern(SequenceEntityReference.class, "TF ER"); p.add(linkedER(true), "TF ER", "TF generic ER"); p.add(erToPE(), "TF generic ER", "TF SPE"); p.add(linkToComplex(), "TF SPE", "TF PE"); p.add(peToControl(), "TF PE", "Control"); p.add(controlToConv(), "Control", "Conversion"); p.add(new Size(right(), 1, Size.Type.EQUAL), "Conversion"); p.add(new OR(new MappedConst(new Empty(left()), 0), new MappedConst(new ConstraintAdapter(1) { @Override public boolean satisfies(Match match, int... ind) { Conversion cnv = (Conversion) match.get(ind[0]); Set<PhysicalEntity> left = cnv.getLeft(); if (left.size() > 1) return false; if (left.isEmpty()) return true; PhysicalEntity pe = left.iterator().next(); if (pe instanceof NucleicAcid) { PhysicalEntity rPE = cnv.getRight().iterator().next(); return rPE instanceof Protein; } return false; } }, 0)), "Conversion"); p.add(right(), "Conversion", "right PE"); p.add(linkToSpecific(), "right PE", "right SPE"); p.add(new Type(SequenceEntity.class), "right SPE"); p.add(peToER(), "right SPE", "product generic ER"); p.add(linkedER(false), "product generic ER", "product ER"); p.add(equal(false), "TF ER", "product ER"); return p; }
java
public static Pattern controlsExpressionWithConversion() { Pattern p = new Pattern(SequenceEntityReference.class, "TF ER"); p.add(linkedER(true), "TF ER", "TF generic ER"); p.add(erToPE(), "TF generic ER", "TF SPE"); p.add(linkToComplex(), "TF SPE", "TF PE"); p.add(peToControl(), "TF PE", "Control"); p.add(controlToConv(), "Control", "Conversion"); p.add(new Size(right(), 1, Size.Type.EQUAL), "Conversion"); p.add(new OR(new MappedConst(new Empty(left()), 0), new MappedConst(new ConstraintAdapter(1) { @Override public boolean satisfies(Match match, int... ind) { Conversion cnv = (Conversion) match.get(ind[0]); Set<PhysicalEntity> left = cnv.getLeft(); if (left.size() > 1) return false; if (left.isEmpty()) return true; PhysicalEntity pe = left.iterator().next(); if (pe instanceof NucleicAcid) { PhysicalEntity rPE = cnv.getRight().iterator().next(); return rPE instanceof Protein; } return false; } }, 0)), "Conversion"); p.add(right(), "Conversion", "right PE"); p.add(linkToSpecific(), "right PE", "right SPE"); p.add(new Type(SequenceEntity.class), "right SPE"); p.add(peToER(), "right SPE", "product generic ER"); p.add(linkedER(false), "product generic ER", "product ER"); p.add(equal(false), "TF ER", "product ER"); return p; }
[ "public", "static", "Pattern", "controlsExpressionWithConversion", "(", ")", "{", "Pattern", "p", "=", "new", "Pattern", "(", "SequenceEntityReference", ".", "class", ",", "\"TF ER\"", ")", ";", "p", ".", "add", "(", "linkedER", "(", "true", ")", ",", "\"TF ...
Finds the cases where transcription relation is shown using a Conversion instead of a TemplateReaction. @return the pattern
[ "Finds", "the", "cases", "where", "transcription", "relation", "is", "shown", "using", "a", "Conversion", "instead", "of", "a", "TemplateReaction", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L441-L475
abel533/Mapper
core/src/main/java/tk/mybatis/mapper/mapperhelper/EntityHelper.java
EntityHelper.setKeyProperties
public static void setKeyProperties(Set<EntityColumn> pkColumns, MappedStatement ms) { if (pkColumns == null || pkColumns.isEmpty()) { return; } List<String> keyProperties = new ArrayList<String>(pkColumns.size()); for (EntityColumn column : pkColumns) { keyProperties.add(column.getProperty()); } MetaObjectUtil.forObject(ms).setValue("keyProperties", keyProperties.toArray(new String[]{})); }
java
public static void setKeyProperties(Set<EntityColumn> pkColumns, MappedStatement ms) { if (pkColumns == null || pkColumns.isEmpty()) { return; } List<String> keyProperties = new ArrayList<String>(pkColumns.size()); for (EntityColumn column : pkColumns) { keyProperties.add(column.getProperty()); } MetaObjectUtil.forObject(ms).setValue("keyProperties", keyProperties.toArray(new String[]{})); }
[ "public", "static", "void", "setKeyProperties", "(", "Set", "<", "EntityColumn", ">", "pkColumns", ",", "MappedStatement", "ms", ")", "{", "if", "(", "pkColumns", "==", "null", "||", "pkColumns", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "L...
通过反射设置MappedStatement的keyProperties字段值 @param pkColumns 所有的主键字段 @param ms MappedStatement
[ "通过反射设置MappedStatement的keyProperties字段值" ]
train
https://github.com/abel533/Mapper/blob/45c3d716583cba3680e03f1f6790fab5e1f4f668/core/src/main/java/tk/mybatis/mapper/mapperhelper/EntityHelper.java#L192-L203
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/inverse/InvertMatrix.java
InvertMatrix.pLeftInvert
public static INDArray pLeftInvert(INDArray arr, boolean inPlace) { try { final INDArray inv = invert(arr.transpose().mmul(arr), inPlace).mmul(arr.transpose()); if (inPlace) arr.assign(inv); return inv; } catch (SingularMatrixException e) { throw new IllegalArgumentException( "Full column rank condition for left pseudo inverse was not met."); } }
java
public static INDArray pLeftInvert(INDArray arr, boolean inPlace) { try { final INDArray inv = invert(arr.transpose().mmul(arr), inPlace).mmul(arr.transpose()); if (inPlace) arr.assign(inv); return inv; } catch (SingularMatrixException e) { throw new IllegalArgumentException( "Full column rank condition for left pseudo inverse was not met."); } }
[ "public", "static", "INDArray", "pLeftInvert", "(", "INDArray", "arr", ",", "boolean", "inPlace", ")", "{", "try", "{", "final", "INDArray", "inv", "=", "invert", "(", "arr", ".", "transpose", "(", ")", ".", "mmul", "(", "arr", ")", ",", "inPlace", ")"...
Compute the left pseudo inverse. Input matrix must have full column rank. See also: <a href="https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse#Definition">Moore–Penrose inverse</a> @param arr Input matrix @param inPlace Whether to store the result in {@code arr} @return Left pseudo inverse of {@code arr} @exception IllegalArgumentException Input matrix {@code arr} did not have full column rank.
[ "Compute", "the", "left", "pseudo", "inverse", ".", "Input", "matrix", "must", "have", "full", "column", "rank", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/inverse/InvertMatrix.java#L108-L117
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java
LoadJobConfiguration.of
public static LoadJobConfiguration of(TableId destinationTable, String sourceUri) { return of(destinationTable, ImmutableList.of(sourceUri)); }
java
public static LoadJobConfiguration of(TableId destinationTable, String sourceUri) { return of(destinationTable, ImmutableList.of(sourceUri)); }
[ "public", "static", "LoadJobConfiguration", "of", "(", "TableId", "destinationTable", ",", "String", "sourceUri", ")", "{", "return", "of", "(", "destinationTable", ",", "ImmutableList", ".", "of", "(", "sourceUri", ")", ")", ";", "}" ]
Returns a BigQuery Load Job Configuration for the given destination table and source URI.
[ "Returns", "a", "BigQuery", "Load", "Job", "Configuration", "for", "the", "given", "destination", "table", "and", "source", "URI", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L537-L539
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
ID3v2Tag.setTextFrame
public void setTextFrame(String id, String data) { if ((id.charAt(0) == 'T') && !id.equals(ID3v2Frames.USER_DEFINED_TEXT_INFO)) { try { byte[] b = new byte[data.length() + 1]; b[0] = 0; System.arraycopy(data.getBytes(ENC_TYPE), 0, b, 1, data.length()); updateFrameData(id, b); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } }
java
public void setTextFrame(String id, String data) { if ((id.charAt(0) == 'T') && !id.equals(ID3v2Frames.USER_DEFINED_TEXT_INFO)) { try { byte[] b = new byte[data.length() + 1]; b[0] = 0; System.arraycopy(data.getBytes(ENC_TYPE), 0, b, 1, data.length()); updateFrameData(id, b); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } }
[ "public", "void", "setTextFrame", "(", "String", "id", ",", "String", "data", ")", "{", "if", "(", "(", "id", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "&&", "!", "id", ".", "equals", "(", "ID3v2Frames", ".", "USER_DEFINED_TEXT_INFO", ")", ...
Set the data contained in a text frame. This includes all frames with an id that starts with 'T' but excludes "TXXX". If an improper id is passed, then nothing will happen. @param id the id of the frame to set the data for @param data the data for the frame
[ "Set", "the", "data", "contained", "in", "a", "text", "frame", ".", "This", "includes", "all", "frames", "with", "an", "id", "that", "starts", "with", "T", "but", "excludes", "TXXX", ".", "If", "an", "improper", "id", "is", "passed", "then", "nothing", ...
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L299-L317
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java
HttpRequestFactory.buildPostRequest
public HttpRequest buildPostRequest(GenericUrl url, HttpContent content) throws IOException { return buildRequest(HttpMethods.POST, url, content); }
java
public HttpRequest buildPostRequest(GenericUrl url, HttpContent content) throws IOException { return buildRequest(HttpMethods.POST, url, content); }
[ "public", "HttpRequest", "buildPostRequest", "(", "GenericUrl", "url", ",", "HttpContent", "content", ")", "throws", "IOException", "{", "return", "buildRequest", "(", "HttpMethods", ".", "POST", ",", "url", ",", "content", ")", ";", "}" ]
Builds a {@code POST} request for the given URL and content. @param url HTTP request URL or {@code null} for none @param content HTTP request content or {@code null} for none @return new HTTP request
[ "Builds", "a", "{", "@code", "POST", "}", "request", "for", "the", "given", "URL", "and", "content", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java#L127-L129
Azure/azure-sdk-for-java
datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java
FilesInner.createOrUpdate
public ProjectFileInner createOrUpdate(String groupName, String serviceName, String projectName, String fileName, ProjectFileInner parameters) { return createOrUpdateWithServiceResponseAsync(groupName, serviceName, projectName, fileName, parameters).toBlocking().single().body(); }
java
public ProjectFileInner createOrUpdate(String groupName, String serviceName, String projectName, String fileName, ProjectFileInner parameters) { return createOrUpdateWithServiceResponseAsync(groupName, serviceName, projectName, fileName, parameters).toBlocking().single().body(); }
[ "public", "ProjectFileInner", "createOrUpdate", "(", "String", "groupName", ",", "String", "serviceName", ",", "String", "projectName", ",", "String", "fileName", ",", "ProjectFileInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "...
Create a file resource. The PUT method creates a new file or updates an existing one. @param groupName Name of the resource group @param serviceName Name of the service @param projectName Name of the project @param fileName Name of the File @param parameters Information about the file @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ProjectFileInner object if successful.
[ "Create", "a", "file", "resource", ".", "The", "PUT", "method", "creates", "a", "new", "file", "or", "updates", "an", "existing", "one", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java#L354-L356
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java
DiagonalMatrix.setRow
public void setRow(int row, double[] values) { checkIndices(row, values.length - 1); values[row] = values[row]; }
java
public void setRow(int row, double[] values) { checkIndices(row, values.length - 1); values[row] = values[row]; }
[ "public", "void", "setRow", "(", "int", "row", ",", "double", "[", "]", "values", ")", "{", "checkIndices", "(", "row", ",", "values", ".", "length", "-", "1", ")", ";", "values", "[", "row", "]", "=", "values", "[", "row", "]", ";", "}" ]
{@inheritDoc} Note that any values are not on the diagonal are ignored.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java#L187-L191
landawn/AbacusUtil
src/com/landawn/abacus/util/StringUtil.java
StringUtil.replacePattern
public static String replacePattern(final String source, final String regex, final String replacement) { return Pattern.compile(regex, Pattern.DOTALL).matcher(source).replaceAll(replacement); }
java
public static String replacePattern(final String source, final String regex, final String replacement) { return Pattern.compile(regex, Pattern.DOTALL).matcher(source).replaceAll(replacement); }
[ "public", "static", "String", "replacePattern", "(", "final", "String", "source", ",", "final", "String", "regex", ",", "final", "String", "replacement", ")", "{", "return", "Pattern", ".", "compile", "(", "regex", ",", "Pattern", ".", "DOTALL", ")", ".", ...
Replaces each substring of the source String that matches the given regular expression with the given replacement using the {@link Pattern#DOTALL} option. DOTALL is also know as single-line mode in Perl. This call is also equivalent to: <ul> <li>{@code source.replaceAll(&quot;(?s)&quot; + regex, replacement)}</li> <li> {@code Pattern.compile(regex, Pattern.DOTALL).filter(source).replaceAll(replacement)} </li> </ul> @param source the source string @param regex the regular expression to which this string is to be matched @param replacement the string to be substituted for each match @return The resulting {@code String} @see String#replaceAll(String, String) @see Pattern#DOTALL @since 3.2
[ "Replaces", "each", "substring", "of", "the", "source", "String", "that", "matches", "the", "given", "regular", "expression", "with", "the", "given", "replacement", "using", "the", "{", "@link", "Pattern#DOTALL", "}", "option", ".", "DOTALL", "is", "also", "kn...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L1111-L1113
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java
OLAPService.getStatistics
public UNode getStatistics(ApplicationDefinition appDef, String shard, Map<String, String> paramMap) { checkServiceState(); CubeSearcher searcher = m_olap.getSearcher(appDef, shard); String file = paramMap.get("file"); if(file != null) { return OlapStatistics.getFileData(searcher, file); } String sort = paramMap.get("sort"); boolean memStats = !"false".equals(paramMap.get("mem")); return OlapStatistics.getStatistics(searcher, sort, memStats); }
java
public UNode getStatistics(ApplicationDefinition appDef, String shard, Map<String, String> paramMap) { checkServiceState(); CubeSearcher searcher = m_olap.getSearcher(appDef, shard); String file = paramMap.get("file"); if(file != null) { return OlapStatistics.getFileData(searcher, file); } String sort = paramMap.get("sort"); boolean memStats = !"false".equals(paramMap.get("mem")); return OlapStatistics.getStatistics(searcher, sort, memStats); }
[ "public", "UNode", "getStatistics", "(", "ApplicationDefinition", "appDef", ",", "String", "shard", ",", "Map", "<", "String", ",", "String", ">", "paramMap", ")", "{", "checkServiceState", "(", ")", ";", "CubeSearcher", "searcher", "=", "m_olap", ".", "getSea...
Get detailed shard statistics for the given shard. This command is mostly used for development and diagnostics. @param appDef {@link ApplicationDefinition} of application to query. @param shard Name of shard to query. @param paramMap Map of statistic option key/value pairs. @return Root of statistics information as a {@link UNode} tree.
[ "Get", "detailed", "shard", "statistics", "for", "the", "given", "shard", ".", "This", "command", "is", "mostly", "used", "for", "development", "and", "diagnostics", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java#L306-L316
pac4j/pac4j
pac4j-saml/src/main/java/org/pac4j/saml/util/SAML2Utils.java
SAML2Utils.urisEqualAfterPortNormalization
public static boolean urisEqualAfterPortNormalization(final URI uri1, final URI uri2) { if (uri1 == null && uri2 == null) { return true; } if (uri1 == null || uri2 == null) { return false; } try { URI normalizedUri1 = normalizePortNumbersInUri(uri1); URI normalizedUri2 = normalizePortNumbersInUri(uri2); boolean eq = normalizedUri1.equals(normalizedUri2); return eq; } catch (URISyntaxException use) { logger.error("Cannot compare 2 URIs.", use); return false; } }
java
public static boolean urisEqualAfterPortNormalization(final URI uri1, final URI uri2) { if (uri1 == null && uri2 == null) { return true; } if (uri1 == null || uri2 == null) { return false; } try { URI normalizedUri1 = normalizePortNumbersInUri(uri1); URI normalizedUri2 = normalizePortNumbersInUri(uri2); boolean eq = normalizedUri1.equals(normalizedUri2); return eq; } catch (URISyntaxException use) { logger.error("Cannot compare 2 URIs.", use); return false; } }
[ "public", "static", "boolean", "urisEqualAfterPortNormalization", "(", "final", "URI", "uri1", ",", "final", "URI", "uri2", ")", "{", "if", "(", "uri1", "==", "null", "&&", "uri2", "==", "null", ")", "{", "return", "true", ";", "}", "if", "(", "uri1", ...
Compares two URIs for equality, ignoring default port numbers for selected protocols. By default, {@link URI#equals(Object)} doesn't take into account default port numbers, so http://server:80/resource is a different URI than http://server/resource. And URLs should not be used for comparison, as written here: http://stackoverflow.com/questions/3771081/proper-way-to-check-for-url-equality @param uri1 URI 1 to be compared. @param uri2 URI 2 to be compared. @return True if both URIs are equal.
[ "Compares", "two", "URIs", "for", "equality", "ignoring", "default", "port", "numbers", "for", "selected", "protocols", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/util/SAML2Utils.java#L49-L66
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/factory/EventReaderFactory.java
EventReaderFactory.createReader
public EventReader createReader() { return new EventReader(eventsProcessor, sourceFilter, eventFilter, progressReporter, exceptionHandler, sqsManager, s3Manager, config); }
java
public EventReader createReader() { return new EventReader(eventsProcessor, sourceFilter, eventFilter, progressReporter, exceptionHandler, sqsManager, s3Manager, config); }
[ "public", "EventReader", "createReader", "(", ")", "{", "return", "new", "EventReader", "(", "eventsProcessor", ",", "sourceFilter", ",", "eventFilter", ",", "progressReporter", ",", "exceptionHandler", ",", "sqsManager", ",", "s3Manager", ",", "config", ")", ";",...
Create an instance of an {@link EventReader}. @return the {@link EventReader}.
[ "Create", "an", "instance", "of", "an", "{", "@link", "EventReader", "}", "." ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/factory/EventReaderFactory.java#L130-L132
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource_hw.java
xen_health_resource_hw.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_resource_hw_responses result = (xen_health_resource_hw_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_hw_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_resource_hw_response_array); } xen_health_resource_hw[] result_xen_health_resource_hw = new xen_health_resource_hw[result.xen_health_resource_hw_response_array.length]; for(int i = 0; i < result.xen_health_resource_hw_response_array.length; i++) { result_xen_health_resource_hw[i] = result.xen_health_resource_hw_response_array[i].xen_health_resource_hw[0]; } return result_xen_health_resource_hw; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_resource_hw_responses result = (xen_health_resource_hw_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_hw_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_resource_hw_response_array); } xen_health_resource_hw[] result_xen_health_resource_hw = new xen_health_resource_hw[result.xen_health_resource_hw_response_array.length]; for(int i = 0; i < result.xen_health_resource_hw_response_array.length; i++) { result_xen_health_resource_hw[i] = result.xen_health_resource_hw_response_array[i].xen_health_resource_hw[0]; } return result_xen_health_resource_hw; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_health_resource_hw_responses", "result", "=", "(", "xen_health_resource_hw_responses", ")", "service", ".",...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource_hw.java#L173-L190
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/content/CmsElementRename.java
CmsElementRename.writePageAndReport
private void writePageAndReport(CmsXmlPage page, boolean report) throws CmsException { CmsFile file = page.getFile(); byte[] content = page.marshal(); file.setContents(content); // check lock CmsLock lock = getCms().getLock(file); if (lock.isNullLock() || lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) { // lock the page checkLock(getCms().getSitePath(file)); // write the file with the new content getCms().writeFile(file); // unlock the page getCms().unlockResource(getCms().getSitePath(file)); if (report) { m_report.println( Messages.get().container(Messages.RPT_ELEM_RENAME_2, getParamOldElement(), getParamNewElement()), I_CmsReport.FORMAT_OK); } } }
java
private void writePageAndReport(CmsXmlPage page, boolean report) throws CmsException { CmsFile file = page.getFile(); byte[] content = page.marshal(); file.setContents(content); // check lock CmsLock lock = getCms().getLock(file); if (lock.isNullLock() || lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) { // lock the page checkLock(getCms().getSitePath(file)); // write the file with the new content getCms().writeFile(file); // unlock the page getCms().unlockResource(getCms().getSitePath(file)); if (report) { m_report.println( Messages.get().container(Messages.RPT_ELEM_RENAME_2, getParamOldElement(), getParamNewElement()), I_CmsReport.FORMAT_OK); } } }
[ "private", "void", "writePageAndReport", "(", "CmsXmlPage", "page", ",", "boolean", "report", ")", "throws", "CmsException", "{", "CmsFile", "file", "=", "page", ".", "getFile", "(", ")", ";", "byte", "[", "]", "content", "=", "page", ".", "marshal", "(", ...
Writes the given xml page by reporting the result.<p> @param page the xml page @param report if true then some output will be written to the report @throws CmsException if operation failed
[ "Writes", "the", "given", "xml", "page", "by", "reporting", "the", "result", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/content/CmsElementRename.java#L957-L977
xvik/dropwizard-guicey
src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java
ContextTreeRenderer.renderScopeItems
private void renderScopeItems(final ContextTreeConfig config, final TreeNode root, final Class<?> scope) { final List<Class<Object>> items = service.getData() .getItems(Filters.registeredBy(scope).and(Filters.type(ConfigItem.Bundle).negate())); final List<String> markers = Lists.newArrayList(); for (Class<?> item : items) { markers.clear(); final ItemInfo info = service.getData().getInfo(item); if (isHidden(config, info, scope)) { continue; } fillCommonMarkers(info, markers, scope); renderLeaf(root, info.getItemType().name().toLowerCase(), item, markers); } if (!config.isHideDisables()) { final List<Class<Object>> disabled = service.getData().getItems(Filters.disabledBy(scope)); for (Class<?> item : disabled) { renderLeaf(root, "-disable", item, null); } } }
java
private void renderScopeItems(final ContextTreeConfig config, final TreeNode root, final Class<?> scope) { final List<Class<Object>> items = service.getData() .getItems(Filters.registeredBy(scope).and(Filters.type(ConfigItem.Bundle).negate())); final List<String> markers = Lists.newArrayList(); for (Class<?> item : items) { markers.clear(); final ItemInfo info = service.getData().getInfo(item); if (isHidden(config, info, scope)) { continue; } fillCommonMarkers(info, markers, scope); renderLeaf(root, info.getItemType().name().toLowerCase(), item, markers); } if (!config.isHideDisables()) { final List<Class<Object>> disabled = service.getData().getItems(Filters.disabledBy(scope)); for (Class<?> item : disabled) { renderLeaf(root, "-disable", item, null); } } }
[ "private", "void", "renderScopeItems", "(", "final", "ContextTreeConfig", "config", ",", "final", "TreeNode", "root", ",", "final", "Class", "<", "?", ">", "scope", ")", "{", "final", "List", "<", "Class", "<", "Object", ">", ">", "items", "=", "service", ...
Render simple scope items (except bundles) including installer disables. @param config tree config @param root root node @param scope current scope
[ "Render", "simple", "scope", "items", "(", "except", "bundles", ")", "including", "installer", "disables", "." ]
train
https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java#L109-L130
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/ModuleEnvironments.java
ModuleEnvironments.fetchOne
public CMAEnvironment fetchOne(String spaceId, String environmentId) { assertNotNull(spaceId, "spaceId"); assertNotNull(environmentId, "environmentId"); return service.fetchOne(spaceId, environmentId).blockingFirst(); }
java
public CMAEnvironment fetchOne(String spaceId, String environmentId) { assertNotNull(spaceId, "spaceId"); assertNotNull(environmentId, "environmentId"); return service.fetchOne(spaceId, environmentId).blockingFirst(); }
[ "public", "CMAEnvironment", "fetchOne", "(", "String", "spaceId", ",", "String", "environmentId", ")", "{", "assertNotNull", "(", "spaceId", ",", "\"spaceId\"", ")", ";", "assertNotNull", "(", "environmentId", ",", "\"environmentId\"", ")", ";", "return", "service...
Fetch an environment with a given {@code environmentId} and space. <p> This method will override the configuration specified through {@link CMAClient.Builder#setSpaceId(String)}. @param spaceId space ID @param environmentId environment ID @return {@link CMAEnvironment} result instance @throws IllegalArgumentException if space id is null. @throws IllegalArgumentException if environment's id is null.
[ "Fetch", "an", "environment", "with", "a", "given", "{", "@code", "environmentId", "}", "and", "space", ".", "<p", ">", "This", "method", "will", "override", "the", "configuration", "specified", "through", "{", "@link", "CMAClient", ".", "Builder#setSpaceId", ...
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleEnvironments.java#L227-L231
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java
Forward.addActionOutput
public void addActionOutput( String paramName, Object value ) { if ( paramName == null || paramName.length() == 0 ) { throw new IllegalArgumentException( "An action output name may not be null or empty." ); } if ( _actionOutputs == null ) { _actionOutputs = new HashMap(); } // // Throw an exception if this is a redirect, and if there was an action output. Action outputs are carried // in the request, and will be lost on redirects. // if ( _init && getRedirect() ) { String actionPath = _mappingPath != null ? _mappingPath : ""; String descrip = getName() != null ? getName() : getPath(); PageFlowException ex = new IllegalActionOutputException( descrip, actionPath, _flowController, paramName ); InternalUtils.throwPageFlowException( ex ); } _actionOutputs.put( paramName, value ); }
java
public void addActionOutput( String paramName, Object value ) { if ( paramName == null || paramName.length() == 0 ) { throw new IllegalArgumentException( "An action output name may not be null or empty." ); } if ( _actionOutputs == null ) { _actionOutputs = new HashMap(); } // // Throw an exception if this is a redirect, and if there was an action output. Action outputs are carried // in the request, and will be lost on redirects. // if ( _init && getRedirect() ) { String actionPath = _mappingPath != null ? _mappingPath : ""; String descrip = getName() != null ? getName() : getPath(); PageFlowException ex = new IllegalActionOutputException( descrip, actionPath, _flowController, paramName ); InternalUtils.throwPageFlowException( ex ); } _actionOutputs.put( paramName, value ); }
[ "public", "void", "addActionOutput", "(", "String", "paramName", ",", "Object", "value", ")", "{", "if", "(", "paramName", "==", "null", "||", "paramName", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"An...
Adds an action output that will be made available in the request, through {@link PageFlowUtils#getActionOutput}. @param paramName the name of the action output. @param value the action output value.
[ "Adds", "an", "action", "output", "that", "will", "be", "made", "available", "in", "the", "request", "through", "{", "@link", "PageFlowUtils#getActionOutput", "}", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java#L965-L990
molgenis/molgenis
molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java
PostgreSqlRepositoryCollection.updateReadonly
private void updateReadonly(EntityType entityType, Attribute attr, Attribute updatedAttr) { Map<String, Attribute> readonlyTableAttrs = getTableAttributesReadonly(entityType) .collect(toLinkedMap(Attribute::getName, Function.identity())); if (!readonlyTableAttrs.isEmpty()) { dropTableTriggers(entityType); } if (attr.isReadOnly() && !updatedAttr.isReadOnly()) { readonlyTableAttrs.remove(attr.getName()); } else if (!attr.isReadOnly() && updatedAttr.isReadOnly()) { readonlyTableAttrs.put(updatedAttr.getName(), updatedAttr); } if (!readonlyTableAttrs.isEmpty()) { createTableTriggers(entityType, readonlyTableAttrs.values()); } }
java
private void updateReadonly(EntityType entityType, Attribute attr, Attribute updatedAttr) { Map<String, Attribute> readonlyTableAttrs = getTableAttributesReadonly(entityType) .collect(toLinkedMap(Attribute::getName, Function.identity())); if (!readonlyTableAttrs.isEmpty()) { dropTableTriggers(entityType); } if (attr.isReadOnly() && !updatedAttr.isReadOnly()) { readonlyTableAttrs.remove(attr.getName()); } else if (!attr.isReadOnly() && updatedAttr.isReadOnly()) { readonlyTableAttrs.put(updatedAttr.getName(), updatedAttr); } if (!readonlyTableAttrs.isEmpty()) { createTableTriggers(entityType, readonlyTableAttrs.values()); } }
[ "private", "void", "updateReadonly", "(", "EntityType", "entityType", ",", "Attribute", "attr", ",", "Attribute", "updatedAttr", ")", "{", "Map", "<", "String", ",", "Attribute", ">", "readonlyTableAttrs", "=", "getTableAttributesReadonly", "(", "entityType", ")", ...
Updates triggers and functions based on attribute readonly changes. @param entityType entity meta data @param attr current attribute @param updatedAttr updated attribute
[ "Updates", "triggers", "and", "functions", "based", "on", "attribute", "readonly", "changes", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L681-L698
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convertToArray
public static Object convertToArray(Object source, Class<?> target) throws ConversionException { try { Class<?> targetType = target.getComponentType(); if (source.getClass().isArray()) { Object targetInstance = Array.newInstance(targetType, Array.getLength(source)); for (int i = 0; i < Array.getLength(source); i++) { Array.set(targetInstance, i, convert(Array.get(source, i), targetType)); } return targetInstance; } if (source instanceof Collection<?>) { Collection<?> sourceCollection = (Collection<?>) source; Object targetInstance = Array.newInstance(target.getComponentType(), sourceCollection.size()); Iterator<?> it = sourceCollection.iterator(); int i = 0; while (it.hasNext()) { Array.set(targetInstance, i++, convert(it.next(), targetType)); } return targetInstance; } throw new ConversionException("Unable to convert to array"); } catch (Exception ex) { throw new ConversionException("Error converting to array", ex); } }
java
public static Object convertToArray(Object source, Class<?> target) throws ConversionException { try { Class<?> targetType = target.getComponentType(); if (source.getClass().isArray()) { Object targetInstance = Array.newInstance(targetType, Array.getLength(source)); for (int i = 0; i < Array.getLength(source); i++) { Array.set(targetInstance, i, convert(Array.get(source, i), targetType)); } return targetInstance; } if (source instanceof Collection<?>) { Collection<?> sourceCollection = (Collection<?>) source; Object targetInstance = Array.newInstance(target.getComponentType(), sourceCollection.size()); Iterator<?> it = sourceCollection.iterator(); int i = 0; while (it.hasNext()) { Array.set(targetInstance, i++, convert(it.next(), targetType)); } return targetInstance; } throw new ConversionException("Unable to convert to array"); } catch (Exception ex) { throw new ConversionException("Error converting to array", ex); } }
[ "public", "static", "Object", "convertToArray", "(", "Object", "source", ",", "Class", "<", "?", ">", "target", ")", "throws", "ConversionException", "{", "try", "{", "Class", "<", "?", ">", "targetType", "=", "target", ".", "getComponentType", "(", ")", "...
Convert to array @param source Source object @param target Target class @return Converted object @throws ConversionException If object can't be converted
[ "Convert", "to", "array" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L168-L192
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java
JobLauncherFactory.newJobLauncher
public static @Nonnull JobLauncher newJobLauncher(Properties sysProps, Properties jobProps, SharedResourcesBroker<GobblinScopeTypes> instanceBroker, List<? extends Tag<?>> metadataTags) throws Exception { String launcherTypeValue = sysProps.getProperty(ConfigurationKeys.JOB_LAUNCHER_TYPE_KEY, JobLauncherType.LOCAL.name()); return newJobLauncher(sysProps, jobProps, launcherTypeValue, instanceBroker, metadataTags); }
java
public static @Nonnull JobLauncher newJobLauncher(Properties sysProps, Properties jobProps, SharedResourcesBroker<GobblinScopeTypes> instanceBroker, List<? extends Tag<?>> metadataTags) throws Exception { String launcherTypeValue = sysProps.getProperty(ConfigurationKeys.JOB_LAUNCHER_TYPE_KEY, JobLauncherType.LOCAL.name()); return newJobLauncher(sysProps, jobProps, launcherTypeValue, instanceBroker, metadataTags); }
[ "public", "static", "@", "Nonnull", "JobLauncher", "newJobLauncher", "(", "Properties", "sysProps", ",", "Properties", "jobProps", ",", "SharedResourcesBroker", "<", "GobblinScopeTypes", ">", "instanceBroker", ",", "List", "<", "?", "extends", "Tag", "<", "?", ">"...
Create a new {@link JobLauncher}. <p> This method will never return a {@code null}. </p> @param sysProps system configuration properties @param jobProps job configuration properties @param instanceBroker @param metadataTags @return newly created {@link JobLauncher}
[ "Create", "a", "new", "{", "@link", "JobLauncher", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java#L102-L108
geomajas/geomajas-project-client-gwt2
api/src/main/java/org/geomajas/gwt2/client/map/layer/tile/TileConfiguration.java
TileConfiguration.setResolutions
public void setResolutions(List<Double> resolutions) { this.resolutions.clear(); this.resolutions.addAll(resolutions); Collections.sort(this.resolutions, new Comparator<Double>() { @Override public int compare(Double o1, Double o2) { return o2.compareTo(o1); } }); }
java
public void setResolutions(List<Double> resolutions) { this.resolutions.clear(); this.resolutions.addAll(resolutions); Collections.sort(this.resolutions, new Comparator<Double>() { @Override public int compare(Double o1, Double o2) { return o2.compareTo(o1); } }); }
[ "public", "void", "setResolutions", "(", "List", "<", "Double", ">", "resolutions", ")", "{", "this", ".", "resolutions", ".", "clear", "(", ")", ";", "this", ".", "resolutions", ".", "addAll", "(", "resolutions", ")", ";", "Collections", ".", "sort", "(...
Set the list of resolutions for this configuration object. Each should represent a tile level. Know that resolutions passed through this method will be ordered from large values to small values (from zoom out to zoom in). @param resolutions The new list of resolutions.
[ "Set", "the", "list", "of", "resolutions", "for", "this", "configuration", "object", ".", "Each", "should", "represent", "a", "tile", "level", ".", "Know", "that", "resolutions", "passed", "through", "this", "method", "will", "be", "ordered", "from", "large", ...
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/api/src/main/java/org/geomajas/gwt2/client/map/layer/tile/TileConfiguration.java#L155-L165
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java
SeleniumDriverSetup.connectToDriverForOnAt
public boolean connectToDriverForOnAt(String browser, String platformName, String url) throws MalformedURLException { return connectToDriverForVersionOnAt(browser, "", platformName, url); }
java
public boolean connectToDriverForOnAt(String browser, String platformName, String url) throws MalformedURLException { return connectToDriverForVersionOnAt(browser, "", platformName, url); }
[ "public", "boolean", "connectToDriverForOnAt", "(", "String", "browser", ",", "String", "platformName", ",", "String", "url", ")", "throws", "MalformedURLException", "{", "return", "connectToDriverForVersionOnAt", "(", "browser", ",", "\"\"", ",", "platformName", ",",...
Connects SeleniumHelper to a remote web driver, without specifying browser version. @param browser name of browser to connect to. @param platformName platform browser must run on. @param url url to connect to browser. @return true. @throws MalformedURLException if supplied url can not be transformed to URL.
[ "Connects", "SeleniumHelper", "to", "a", "remote", "web", "driver", "without", "specifying", "browser", "version", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java#L124-L127
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseXgebsr2csr
public static int cusparseXgebsr2csr( cusparseHandle handle, int dirA, int mb, int nb, cusparseMatDescr descrA, Pointer bsrSortedRowPtrA, Pointer bsrSortedColIndA, int rowBlockDim, int colBlockDim, cusparseMatDescr descrC, Pointer csrSortedRowPtrC, Pointer csrSortedColIndC) { return checkResult(cusparseXgebsr2csrNative(handle, dirA, mb, nb, descrA, bsrSortedRowPtrA, bsrSortedColIndA, rowBlockDim, colBlockDim, descrC, csrSortedRowPtrC, csrSortedColIndC)); }
java
public static int cusparseXgebsr2csr( cusparseHandle handle, int dirA, int mb, int nb, cusparseMatDescr descrA, Pointer bsrSortedRowPtrA, Pointer bsrSortedColIndA, int rowBlockDim, int colBlockDim, cusparseMatDescr descrC, Pointer csrSortedRowPtrC, Pointer csrSortedColIndC) { return checkResult(cusparseXgebsr2csrNative(handle, dirA, mb, nb, descrA, bsrSortedRowPtrA, bsrSortedColIndA, rowBlockDim, colBlockDim, descrC, csrSortedRowPtrC, csrSortedColIndC)); }
[ "public", "static", "int", "cusparseXgebsr2csr", "(", "cusparseHandle", "handle", ",", "int", "dirA", ",", "int", "mb", ",", "int", "nb", ",", "cusparseMatDescr", "descrA", ",", "Pointer", "bsrSortedRowPtrA", ",", "Pointer", "bsrSortedColIndA", ",", "int", "rowB...
Description: This routine converts a sparse matrix in general block-CSR storage format to a sparse matrix in CSR storage format.
[ "Description", ":", "This", "routine", "converts", "a", "sparse", "matrix", "in", "general", "block", "-", "CSR", "storage", "format", "to", "a", "sparse", "matrix", "in", "CSR", "storage", "format", "." ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L13026-L13041
Stratio/stratio-cassandra
src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
ColumnFamilyMetrics.createColumnFamilyHistogram
protected ColumnFamilyHistogram createColumnFamilyHistogram(String name, Histogram keyspaceHistogram) { Histogram cfHistogram = Metrics.newHistogram(factory.createMetricName(name), true); register(name, cfHistogram); return new ColumnFamilyHistogram(cfHistogram, keyspaceHistogram, Metrics.newHistogram(globalNameFactory.createMetricName(name), true)); }
java
protected ColumnFamilyHistogram createColumnFamilyHistogram(String name, Histogram keyspaceHistogram) { Histogram cfHistogram = Metrics.newHistogram(factory.createMetricName(name), true); register(name, cfHistogram); return new ColumnFamilyHistogram(cfHistogram, keyspaceHistogram, Metrics.newHistogram(globalNameFactory.createMetricName(name), true)); }
[ "protected", "ColumnFamilyHistogram", "createColumnFamilyHistogram", "(", "String", "name", ",", "Histogram", "keyspaceHistogram", ")", "{", "Histogram", "cfHistogram", "=", "Metrics", ".", "newHistogram", "(", "factory", ".", "createMetricName", "(", "name", ")", ","...
Create a histogram-like interface that will register both a CF, keyspace and global level histogram and forward any updates to both
[ "Create", "a", "histogram", "-", "like", "interface", "that", "will", "register", "both", "a", "CF", "keyspace", "and", "global", "level", "histogram", "and", "forward", "any", "updates", "to", "both" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java#L698-L703
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageWritable.java
ResourceStorageWritable.writeEntries
protected void writeEntries(final StorageAwareResource resource, final ZipOutputStream zipOut) throws IOException { final BufferedOutputStream bufferedOutput = new BufferedOutputStream(zipOut); ZipEntry _zipEntry = new ZipEntry("emf-contents"); zipOut.putNextEntry(_zipEntry); try { this.writeContents(resource, bufferedOutput); } finally { bufferedOutput.flush(); zipOut.closeEntry(); } ZipEntry _zipEntry_1 = new ZipEntry("resource-description"); zipOut.putNextEntry(_zipEntry_1); try { this.writeResourceDescription(resource, bufferedOutput); } finally { bufferedOutput.flush(); zipOut.closeEntry(); } if (this.storeNodeModel) { ZipEntry _zipEntry_2 = new ZipEntry("node-model"); zipOut.putNextEntry(_zipEntry_2); try { this.writeNodeModel(resource, bufferedOutput); } finally { bufferedOutput.flush(); zipOut.closeEntry(); } } }
java
protected void writeEntries(final StorageAwareResource resource, final ZipOutputStream zipOut) throws IOException { final BufferedOutputStream bufferedOutput = new BufferedOutputStream(zipOut); ZipEntry _zipEntry = new ZipEntry("emf-contents"); zipOut.putNextEntry(_zipEntry); try { this.writeContents(resource, bufferedOutput); } finally { bufferedOutput.flush(); zipOut.closeEntry(); } ZipEntry _zipEntry_1 = new ZipEntry("resource-description"); zipOut.putNextEntry(_zipEntry_1); try { this.writeResourceDescription(resource, bufferedOutput); } finally { bufferedOutput.flush(); zipOut.closeEntry(); } if (this.storeNodeModel) { ZipEntry _zipEntry_2 = new ZipEntry("node-model"); zipOut.putNextEntry(_zipEntry_2); try { this.writeNodeModel(resource, bufferedOutput); } finally { bufferedOutput.flush(); zipOut.closeEntry(); } } }
[ "protected", "void", "writeEntries", "(", "final", "StorageAwareResource", "resource", ",", "final", "ZipOutputStream", "zipOut", ")", "throws", "IOException", "{", "final", "BufferedOutputStream", "bufferedOutput", "=", "new", "BufferedOutputStream", "(", "zipOut", ")"...
Write entries into the storage. Overriding methods should first delegate to super before adding their own entries.
[ "Write", "entries", "into", "the", "storage", ".", "Overriding", "methods", "should", "first", "delegate", "to", "super", "before", "adding", "their", "own", "entries", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageWritable.java#L61-L89
florent37/DaVinci
davinci/src/main/java/com/github/florent37/davinci/DaVinci.java
DaVinci.loadFromLruCache
private Bitmap loadFromLruCache(final String path, boolean tryFromDisk) { int key = getKey(path); Bitmap bitmap = mImagesCache.get(key); //try to retrieve from lruCache Log.d(TAG, "bitmap " + path + " from lruCache [" + key + "] " + bitmap); if (tryFromDisk && bitmap == null) { bitmap = loadFromDiskLruCache(key); //try to retrieve from disk cache Log.d(TAG, "bitmap " + path + " from diskLruCache " + bitmap); if (bitmap != null) { //if found on disk cache mImagesCache.put(key, bitmap); //save it into lruCache } } return bitmap; }
java
private Bitmap loadFromLruCache(final String path, boolean tryFromDisk) { int key = getKey(path); Bitmap bitmap = mImagesCache.get(key); //try to retrieve from lruCache Log.d(TAG, "bitmap " + path + " from lruCache [" + key + "] " + bitmap); if (tryFromDisk && bitmap == null) { bitmap = loadFromDiskLruCache(key); //try to retrieve from disk cache Log.d(TAG, "bitmap " + path + " from diskLruCache " + bitmap); if (bitmap != null) { //if found on disk cache mImagesCache.put(key, bitmap); //save it into lruCache } } return bitmap; }
[ "private", "Bitmap", "loadFromLruCache", "(", "final", "String", "path", ",", "boolean", "tryFromDisk", ")", "{", "int", "key", "=", "getKey", "(", "path", ")", ";", "Bitmap", "bitmap", "=", "mImagesCache", ".", "get", "(", "key", ")", ";", "//try to retri...
Try to load [path] image from cache @param path Path or Url of the bitmap @return Bitmap from cache if founded
[ "Try", "to", "load", "[", "path", "]", "image", "from", "cache" ]
train
https://github.com/florent37/DaVinci/blob/9c6ce4aa2df8e2288cd6ee8b57d9091b1b770a7a/davinci/src/main/java/com/github/florent37/davinci/DaVinci.java#L452-L470
Shusshu/Android-RecurrencePicker
library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java
Utils.isSunday
public static boolean isSunday(int column, int firstDayOfWeek) { return (firstDayOfWeek == Time.SUNDAY && column == 0) || (firstDayOfWeek == Time.MONDAY && column == 6) || (firstDayOfWeek == Time.SATURDAY && column == 1); }
java
public static boolean isSunday(int column, int firstDayOfWeek) { return (firstDayOfWeek == Time.SUNDAY && column == 0) || (firstDayOfWeek == Time.MONDAY && column == 6) || (firstDayOfWeek == Time.SATURDAY && column == 1); }
[ "public", "static", "boolean", "isSunday", "(", "int", "column", ",", "int", "firstDayOfWeek", ")", "{", "return", "(", "firstDayOfWeek", "==", "Time", ".", "SUNDAY", "&&", "column", "==", "0", ")", "||", "(", "firstDayOfWeek", "==", "Time", ".", "MONDAY",...
Determine whether the column position is Sunday or not. @param column the column position @param firstDayOfWeek the first day of week in android.text.format.Time @return true if the column is Sunday position
[ "Determine", "whether", "the", "column", "position", "is", "Sunday", "or", "not", "." ]
train
https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L447-L451
jenkinsci/jenkins
core/src/main/java/hudson/model/User.java
User.getById
public static @Nullable User getById(String id, boolean create) { return getOrCreateById(id, id, create); }
java
public static @Nullable User getById(String id, boolean create) { return getOrCreateById(id, id, create); }
[ "public", "static", "@", "Nullable", "User", "getById", "(", "String", "id", ",", "boolean", "create", ")", "{", "return", "getOrCreateById", "(", "id", ",", "id", ",", "create", ")", ";", "}" ]
Gets the {@link User} object by its <code>id</code> @param id the id of the user to retrieve and optionally create if it does not exist. @param create If <code>true</code>, this method will never return <code>null</code> for valid input (by creating a new {@link User} object if none exists.) If <code>false</code>, this method will return <code>null</code> if {@link User} object with the given id doesn't exist. @return the a User whose id is <code>id</code>, or <code>null</code> if <code>create</code> is <code>false</code> and the user does not exist. @since 1.651.2 / 2.3
[ "Gets", "the", "{", "@link", "User", "}", "object", "by", "its", "<code", ">", "id<", "/", "code", ">" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/User.java#L613-L616
mbenson/therian
core/src/main/java/therian/TherianContext.java
TherianContext.evalIfSupported
public final synchronized <RESULT, OPERATION extends Operation<RESULT>> RESULT evalIfSupported(OPERATION operation, Hint... hints) { return evalIfSupported(operation, null, hints); }
java
public final synchronized <RESULT, OPERATION extends Operation<RESULT>> RESULT evalIfSupported(OPERATION operation, Hint... hints) { return evalIfSupported(operation, null, hints); }
[ "public", "final", "synchronized", "<", "RESULT", ",", "OPERATION", "extends", "Operation", "<", "RESULT", ">", ">", "RESULT", "evalIfSupported", "(", "OPERATION", "operation", ",", "Hint", "...", "hints", ")", "{", "return", "evalIfSupported", "(", "operation",...
Evaluates {@code operation} if supported; otherwise returns {@code null}. You may distinguish between a {@code null} result and "not supported" by calling {@link #supports(Operation)} and {@link #eval(Operation)} independently. @param operation @param hints @return RESULT or {@code null} @throws NullPointerException on {@code null} input @throws OperationException potentially, via {@link Operation#getResult()}
[ "Evaluates", "{", "@code", "operation", "}", "if", "supported", ";", "otherwise", "returns", "{", "@code", "null", "}", ".", "You", "may", "distinguish", "between", "a", "{", "@code", "null", "}", "result", "and", "not", "supported", "by", "calling", "{", ...
train
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/TherianContext.java#L379-L382
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.cut
public static BufferedImage cut(Image srcImage, int x, int y, int radius) { return Img.from(srcImage).cut(x, y, radius).getImg(); }
java
public static BufferedImage cut(Image srcImage, int x, int y, int radius) { return Img.from(srcImage).cut(x, y, radius).getImg(); }
[ "public", "static", "BufferedImage", "cut", "(", "Image", "srcImage", ",", "int", "x", ",", "int", "y", ",", "int", "radius", ")", "{", "return", "Img", ".", "from", "(", "srcImage", ")", ".", "cut", "(", "x", ",", "y", ",", "radius", ")", ".", "...
图像切割(按指定起点坐标和宽高切割) @param srcImage 源图像 @param x 原图的x坐标起始位置 @param y 原图的y坐标起始位置 @param radius 半径,小于0表示填充满整个图片(直径取长宽最小值) @return {@link BufferedImage} @since 4.1.15
[ "图像切割", "(", "按指定起点坐标和宽高切割", ")" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L358-L360
Alluxio/alluxio
core/common/src/main/java/alluxio/util/io/BufferUtils.java
BufferUtils.sliceByteBuffer
public static ByteBuffer sliceByteBuffer(ByteBuffer buffer, int position, int length) { ByteBuffer slicedBuffer = ((ByteBuffer) buffer.duplicate().position(position)).slice(); slicedBuffer.limit(length); return slicedBuffer; }
java
public static ByteBuffer sliceByteBuffer(ByteBuffer buffer, int position, int length) { ByteBuffer slicedBuffer = ((ByteBuffer) buffer.duplicate().position(position)).slice(); slicedBuffer.limit(length); return slicedBuffer; }
[ "public", "static", "ByteBuffer", "sliceByteBuffer", "(", "ByteBuffer", "buffer", ",", "int", "position", ",", "int", "length", ")", "{", "ByteBuffer", "slicedBuffer", "=", "(", "(", "ByteBuffer", ")", "buffer", ".", "duplicate", "(", ")", ".", "position", "...
Creates a new ByteBuffer sliced from a given ByteBuffer. The new ByteBuffer shares the content of the existing one, but with independent position/mark/limit. After slicing, the new ByteBuffer has position 0, and the input ByteBuffer is unmodified. @param buffer source ByteBuffer to slice @param position position in the source ByteBuffer to slice @param length length of the sliced ByteBuffer @return the sliced ByteBuffer
[ "Creates", "a", "new", "ByteBuffer", "sliced", "from", "a", "given", "ByteBuffer", ".", "The", "new", "ByteBuffer", "shares", "the", "content", "of", "the", "existing", "one", "but", "with", "independent", "position", "/", "mark", "/", "limit", ".", "After",...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/BufferUtils.java#L338-L342
apache/spark
common/network-common/src/main/java/org/apache/spark/network/sasl/SaslServerBootstrap.java
SaslServerBootstrap.doBootstrap
public RpcHandler doBootstrap(Channel channel, RpcHandler rpcHandler) { return new SaslRpcHandler(conf, channel, rpcHandler, secretKeyHolder); }
java
public RpcHandler doBootstrap(Channel channel, RpcHandler rpcHandler) { return new SaslRpcHandler(conf, channel, rpcHandler, secretKeyHolder); }
[ "public", "RpcHandler", "doBootstrap", "(", "Channel", "channel", ",", "RpcHandler", "rpcHandler", ")", "{", "return", "new", "SaslRpcHandler", "(", "conf", ",", "channel", ",", "rpcHandler", ",", "secretKeyHolder", ")", ";", "}" ]
Wrap the given application handler in a SaslRpcHandler that will handle the initial SASL negotiation.
[ "Wrap", "the", "given", "application", "handler", "in", "a", "SaslRpcHandler", "that", "will", "handle", "the", "initial", "SASL", "negotiation", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/sasl/SaslServerBootstrap.java#L45-L47
SonarSource/sonarqube
sonar-core/src/main/java/org/sonar/core/util/Protobuf.java
Protobuf.writeStream
public static <MSG extends Message> void writeStream(Iterable<MSG> messages, File toFile, boolean append) { OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(toFile, append)); writeStream(messages, out); } catch (Exception e) { throw ContextException.of("Unable to write messages", e).addContext("file", toFile); } finally { IOUtils.closeQuietly(out); } }
java
public static <MSG extends Message> void writeStream(Iterable<MSG> messages, File toFile, boolean append) { OutputStream out = null; try { out = new BufferedOutputStream(new FileOutputStream(toFile, append)); writeStream(messages, out); } catch (Exception e) { throw ContextException.of("Unable to write messages", e).addContext("file", toFile); } finally { IOUtils.closeQuietly(out); } }
[ "public", "static", "<", "MSG", "extends", "Message", ">", "void", "writeStream", "(", "Iterable", "<", "MSG", ">", "messages", ",", "File", "toFile", ",", "boolean", "append", ")", "{", "OutputStream", "out", "=", "null", ";", "try", "{", "out", "=", ...
Streams multiple messages to {@code file}. Reading the messages back requires to call methods {@code readStream(...)}. <p> See https://developers.google.com/protocol-buffers/docs/techniques#streaming </p>
[ "Streams", "multiple", "messages", "to", "{" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/Protobuf.java#L92-L102