repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/AbstractResources.java
AbstractResources.attachFile
public <T> Attachment attachFile(String url, T t, String partName, InputStream inputstream, String contentType, String attachmentName) throws SmartsheetException { Util.throwIfNull(inputstream, contentType); Attachment attachment = null; final String boundary = "----" + System.currentTimeMillis() ; CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost uploadFile = createHttpPost(this.getSmartsheet().getBaseURI().resolve(url)); try { uploadFile.setHeader("Content-Type", "multipart/form-data; boundary=" + boundary); } catch (Exception e) { throw new RuntimeException(e); } MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setBoundary(boundary); builder.addTextBody(partName, this.getSmartsheet().getJsonSerializer().serialize(t), ContentType.APPLICATION_JSON); builder.addBinaryBody("file", inputstream, ContentType.create(contentType), attachmentName); org.apache.http.HttpEntity multipart = builder.build(); uploadFile.setEntity(multipart); try { CloseableHttpResponse response = httpClient.execute(uploadFile); org.apache.http.HttpEntity responseEntity = response.getEntity(); attachment = this.getSmartsheet().getJsonSerializer().deserializeResult(Attachment.class, responseEntity.getContent()).getResult(); } catch (Exception e) { throw new RuntimeException(e); } return attachment; }
java
public <T> Attachment attachFile(String url, T t, String partName, InputStream inputstream, String contentType, String attachmentName) throws SmartsheetException { Util.throwIfNull(inputstream, contentType); Attachment attachment = null; final String boundary = "----" + System.currentTimeMillis() ; CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost uploadFile = createHttpPost(this.getSmartsheet().getBaseURI().resolve(url)); try { uploadFile.setHeader("Content-Type", "multipart/form-data; boundary=" + boundary); } catch (Exception e) { throw new RuntimeException(e); } MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setBoundary(boundary); builder.addTextBody(partName, this.getSmartsheet().getJsonSerializer().serialize(t), ContentType.APPLICATION_JSON); builder.addBinaryBody("file", inputstream, ContentType.create(contentType), attachmentName); org.apache.http.HttpEntity multipart = builder.build(); uploadFile.setEntity(multipart); try { CloseableHttpResponse response = httpClient.execute(uploadFile); org.apache.http.HttpEntity responseEntity = response.getEntity(); attachment = this.getSmartsheet().getJsonSerializer().deserializeResult(Attachment.class, responseEntity.getContent()).getResult(); } catch (Exception e) { throw new RuntimeException(e); } return attachment; }
[ "public", "<", "T", ">", "Attachment", "attachFile", "(", "String", "url", ",", "T", "t", ",", "String", "partName", ",", "InputStream", "inputstream", ",", "String", "contentType", ",", "String", "attachmentName", ")", "throws", "SmartsheetException", "{", "U...
Create a multipart upload request. @param url the url @param t the object to create @param partName the name of the part @param inputstream the file inputstream @param contentType the type of the file to be attached @return the http request @throws UnsupportedEncodingException the unsupported encoding exception
[ "Create", "a", "multipart", "upload", "request", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L829-L862
rythmengine/rythmengine
src/main/java/org/rythmengine/RythmEngine.java
RythmEngine.renderStr
public String renderStr(String key, String template, Object... args) { return renderString(key, template, args); }
java
public String renderStr(String key, String template, Object... args) { return renderString(key, template, args); }
[ "public", "String", "renderStr", "(", "String", "key", ",", "String", "template", ",", "Object", "...", "args", ")", "{", "return", "renderString", "(", "key", ",", "template", ",", "args", ")", ";", "}" ]
Render template by string typed inline template content and an array of template args. The render result is returned as a String <p/> <p>See {@link #getTemplate(java.io.File, Object...)} for note on render args</p> @param template the inline template content @param args the render args array @return render result
[ "Render", "template", "by", "string", "typed", "inline", "template", "content", "and", "an", "array", "of", "template", "args", ".", "The", "render", "result", "is", "returned", "as", "a", "String", "<p", "/", ">", "<p", ">", "See", "{", "@link", "#getTe...
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/RythmEngine.java#L1130-L1132
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/TrackMetadata.java
TrackMetadata.buildColorItem
private ColorItem buildColorItem(Message menuItem) { final int colorId = (int) ((NumberField) menuItem.arguments.get(1)).getValue(); final String label = ((StringField) menuItem.arguments.get(3)).getValue(); return buildColorItem(colorId, label); }
java
private ColorItem buildColorItem(Message menuItem) { final int colorId = (int) ((NumberField) menuItem.arguments.get(1)).getValue(); final String label = ((StringField) menuItem.arguments.get(3)).getValue(); return buildColorItem(colorId, label); }
[ "private", "ColorItem", "buildColorItem", "(", "Message", "menuItem", ")", "{", "final", "int", "colorId", "=", "(", "int", ")", "(", "(", "NumberField", ")", "menuItem", ".", "arguments", ".", "get", "(", "1", ")", ")", ".", "getValue", "(", ")", ";",...
Creates a color item that represents a color field found for a track based on a dbserver message. @param menuItem the rendered menu item containing the color metadata field @return the color metadata field
[ "Creates", "a", "color", "item", "that", "represents", "a", "color", "field", "found", "for", "a", "track", "based", "on", "a", "dbserver", "message", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TrackMetadata.java#L168-L172
real-logic/agrona
agrona/src/main/java/org/agrona/collections/ArrayListUtil.java
ArrayListUtil.fastUnorderedRemove
public static <T> void fastUnorderedRemove(final ArrayList<T> list, final int index) { final int lastIndex = list.size() - 1; if (index != lastIndex) { list.set(index, list.remove(lastIndex)); } else { list.remove(index); } }
java
public static <T> void fastUnorderedRemove(final ArrayList<T> list, final int index) { final int lastIndex = list.size() - 1; if (index != lastIndex) { list.set(index, list.remove(lastIndex)); } else { list.remove(index); } }
[ "public", "static", "<", "T", ">", "void", "fastUnorderedRemove", "(", "final", "ArrayList", "<", "T", ">", "list", ",", "final", "int", "index", ")", "{", "final", "int", "lastIndex", "=", "list", ".", "size", "(", ")", "-", "1", ";", "if", "(", "...
Removes element at index, but instead of copying all elements to the left, moves into the same slot the last element. This avoids the copy costs, but spoils the list order. If index is the last element it is just removed. @param list to be modified. @param index to be removed. @param <T> element type. @throws IndexOutOfBoundsException if index is out of bounds.
[ "Removes", "element", "at", "index", "but", "instead", "of", "copying", "all", "elements", "to", "the", "left", "moves", "into", "the", "same", "slot", "the", "last", "element", ".", "This", "avoids", "the", "copy", "costs", "but", "spoils", "the", "list",...
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/collections/ArrayListUtil.java#L34-L45
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitThrows
@Override public R visitThrows(ThrowsTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitThrows(ThrowsTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitThrows", "(", "ThrowsTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L417-L420
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.isRelated
private boolean isRelated(final INode source, final INode target, final char relation) { return relation == defautlMappings.getRelation(source, target); }
java
private boolean isRelated(final INode source, final INode target, final char relation) { return relation == defautlMappings.getRelation(source, target); }
[ "private", "boolean", "isRelated", "(", "final", "INode", "source", ",", "final", "INode", "target", ",", "final", "char", "relation", ")", "{", "return", "relation", "==", "defautlMappings", ".", "getRelation", "(", "source", ",", "target", ")", ";", "}" ]
Checks if the given source and target elements are related considering the defined relation and the temp. @param source source @param target target @param relation relation @return true if the relation holds between source and target, false otherwise.
[ "Checks", "if", "the", "given", "source", "and", "target", "elements", "are", "related", "considering", "the", "defined", "relation", "and", "the", "temp", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L260-L262
opencb/cellbase
cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/CellBaseNormalizerSequenceAdaptor.java
CellBaseNormalizerSequenceAdaptor.query
@Override public String query(String contig, int start, int end) throws Exception { Region region = new Region(contig, start, end); QueryResult<GenomeSequenceFeature> queryResult = genomeDBAdaptor.getSequence(region, QueryOptions.empty()); // This behaviour mimics the behaviour of the org.opencb.biodata.tools.sequence.SamtoolsFastaIndex with one // difference. If contig does not exist, start is under the left bound, start AND end are out of the right // bound, then a RunTime exception will be thrown. HOWEVER: if start is within the bounds BUT end is out of the // right bound, then THIS implementaiton will return available nucleotides while SamtoolsFastaIndex will keep // returning the exception. if (queryResult.getResult().size() > 0 && StringUtils.isNotBlank(queryResult.getResult().get(0).getSequence())) { if (queryResult.getResult().get(0).getSequence().length() < (end - start + 1)) { logger.warn("End coordinate out of the right bound. Returning available nucleotides."); } return queryResult.getResult().get(0).getSequence(); } else { throw new RuntimeException("Unable to find entry for " + region.toString()); } }
java
@Override public String query(String contig, int start, int end) throws Exception { Region region = new Region(contig, start, end); QueryResult<GenomeSequenceFeature> queryResult = genomeDBAdaptor.getSequence(region, QueryOptions.empty()); // This behaviour mimics the behaviour of the org.opencb.biodata.tools.sequence.SamtoolsFastaIndex with one // difference. If contig does not exist, start is under the left bound, start AND end are out of the right // bound, then a RunTime exception will be thrown. HOWEVER: if start is within the bounds BUT end is out of the // right bound, then THIS implementaiton will return available nucleotides while SamtoolsFastaIndex will keep // returning the exception. if (queryResult.getResult().size() > 0 && StringUtils.isNotBlank(queryResult.getResult().get(0).getSequence())) { if (queryResult.getResult().get(0).getSequence().length() < (end - start + 1)) { logger.warn("End coordinate out of the right bound. Returning available nucleotides."); } return queryResult.getResult().get(0).getSequence(); } else { throw new RuntimeException("Unable to find entry for " + region.toString()); } }
[ "@", "Override", "public", "String", "query", "(", "String", "contig", ",", "int", "start", ",", "int", "end", ")", "throws", "Exception", "{", "Region", "region", "=", "new", "Region", "(", "contig", ",", "start", ",", "end", ")", ";", "QueryResult", ...
Returns sequence from contig "contig" in the range [start, end] (1-based, both inclusive). For corner cases mimics the behaviour of the org.opencb.biodata.tools.sequence.SamtoolsFastaIndex with one difference. If chromosome does not exist, start is under the left bound, start AND end are out of the right bound, then a RunTime exception will be thrown. HOWEVER: if start is within the bounds BUT end is out of the right bound, then THIS implementaiton will return available nucleotides while SamtoolsFastaIndex will keep returning the exception. @param contig @param start @param end @return String containing the sequence of contig "contig" in the range [start, end] (1-based, both inclusive). Throws RunTimeException if contig does not exist, or start is under the left bound, or start AND end are out of the right bound. If start is within the bounds BUT end is out of the right bound, then THIS implementaiton will return available nucleotides while SamtoolsFastaIndex will keep returning the exception. @throws Exception @throws RuntimeException
[ "Returns", "sequence", "from", "contig", "contig", "in", "the", "range", "[", "start", "end", "]", "(", "1", "-", "based", "both", "inclusive", ")", ".", "For", "corner", "cases", "mimics", "the", "behaviour", "of", "the", "org", ".", "opencb", ".", "b...
train
https://github.com/opencb/cellbase/blob/70cc3d6ecff747725ade9d051438fc6bf98cae44/cellbase-core/src/main/java/org/opencb/cellbase/core/variant/annotation/CellBaseNormalizerSequenceAdaptor.java#L40-L59
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDAvailabilityEstimatePersistenceImpl.java
CPDAvailabilityEstimatePersistenceImpl.fetchByUUID_G
@Override public CPDAvailabilityEstimate fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); }
java
@Override public CPDAvailabilityEstimate fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); }
[ "@", "Override", "public", "CPDAvailabilityEstimate", "fetchByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "{", "return", "fetchByUUID_G", "(", "uuid", ",", "groupId", ",", "true", ")", ";", "}" ]
Returns the cpd availability estimate where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param uuid the uuid @param groupId the group ID @return the matching cpd availability estimate, or <code>null</code> if a matching cpd availability estimate could not be found
[ "Returns", "the", "cpd", "availability", "estimate", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder...
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDAvailabilityEstimatePersistenceImpl.java#L705-L708
m-m-m/util
scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java
CharSequenceScanner.getTail
protected String getTail() { String tail = ""; if (this.offset < this.limit) { tail = new String(this.buffer, this.offset, this.limit - this.offset + 1); } return tail; }
java
protected String getTail() { String tail = ""; if (this.offset < this.limit) { tail = new String(this.buffer, this.offset, this.limit - this.offset + 1); } return tail; }
[ "protected", "String", "getTail", "(", ")", "{", "String", "tail", "=", "\"\"", ";", "if", "(", "this", ".", "offset", "<", "this", ".", "limit", ")", "{", "tail", "=", "new", "String", "(", "this", ".", "buffer", ",", "this", ".", "offset", ",", ...
This method gets the tail of this scanner without changing the state. @return the tail of this scanner.
[ "This", "method", "gets", "the", "tail", "of", "this", "scanner", "without", "changing", "the", "state", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java#L335-L342
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java
SparkDl4jMultiLayer.scoreExamples
public JavaDoubleRDD scoreExamples(JavaRDD<DataSet> data, boolean includeRegularizationTerms, int batchSize) { return data.mapPartitionsToDouble(new ScoreExamplesFunction(sc.broadcast(network.params()), sc.broadcast(conf.toJson()), includeRegularizationTerms, batchSize)); }
java
public JavaDoubleRDD scoreExamples(JavaRDD<DataSet> data, boolean includeRegularizationTerms, int batchSize) { return data.mapPartitionsToDouble(new ScoreExamplesFunction(sc.broadcast(network.params()), sc.broadcast(conf.toJson()), includeRegularizationTerms, batchSize)); }
[ "public", "JavaDoubleRDD", "scoreExamples", "(", "JavaRDD", "<", "DataSet", ">", "data", ",", "boolean", "includeRegularizationTerms", ",", "int", "batchSize", ")", "{", "return", "data", ".", "mapPartitionsToDouble", "(", "new", "ScoreExamplesFunction", "(", "sc", ...
Score the examples individually, using a specified batch size. Unlike {@link #calculateScore(JavaRDD, boolean)}, this method returns a score for each example separately. If scoring is needed for specific examples use either {@link #scoreExamples(JavaPairRDD, boolean)} or {@link #scoreExamples(JavaPairRDD, boolean, int)} which can have a key for each example. @param data Data to score @param includeRegularizationTerms If true: include the l1/l2 regularization terms with the score (if any) @param batchSize Batch size to use when doing scoring @return A JavaDoubleRDD containing the scores of each example @see MultiLayerNetwork#scoreExamples(DataSet, boolean)
[ "Score", "the", "examples", "individually", "using", "a", "specified", "batch", "size", ".", "Unlike", "{", "@link", "#calculateScore", "(", "JavaRDD", "boolean", ")", "}", "this", "method", "returns", "a", "score", "for", "each", "example", "separately", ".",...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java#L434-L437
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/PullFileLoader.java
PullFileLoader.loadJavaPropsWithFallback
private Config loadJavaPropsWithFallback(Path propertiesPath, Config fallback) throws IOException { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(); try (InputStreamReader inputStreamReader = new InputStreamReader(this.fs.open(propertiesPath), Charsets.UTF_8)) { propertiesConfiguration.setDelimiterParsingDisabled(ConfigUtils.getBoolean(fallback, PROPERTY_DELIMITER_PARSING_ENABLED_KEY, DEFAULT_PROPERTY_DELIMITER_PARSING_ENABLED_KEY)); propertiesConfiguration.load(inputStreamReader); Config configFromProps = ConfigUtils.propertiesToConfig(ConfigurationConverter.getProperties(propertiesConfiguration)); return ConfigFactory.parseMap(ImmutableMap.of(ConfigurationKeys.JOB_CONFIG_FILE_PATH_KEY, PathUtils.getPathWithoutSchemeAndAuthority(propertiesPath).toString())) .withFallback(configFromProps) .withFallback(fallback); } catch (ConfigurationException ce) { throw new IOException(ce); } }
java
private Config loadJavaPropsWithFallback(Path propertiesPath, Config fallback) throws IOException { PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(); try (InputStreamReader inputStreamReader = new InputStreamReader(this.fs.open(propertiesPath), Charsets.UTF_8)) { propertiesConfiguration.setDelimiterParsingDisabled(ConfigUtils.getBoolean(fallback, PROPERTY_DELIMITER_PARSING_ENABLED_KEY, DEFAULT_PROPERTY_DELIMITER_PARSING_ENABLED_KEY)); propertiesConfiguration.load(inputStreamReader); Config configFromProps = ConfigUtils.propertiesToConfig(ConfigurationConverter.getProperties(propertiesConfiguration)); return ConfigFactory.parseMap(ImmutableMap.of(ConfigurationKeys.JOB_CONFIG_FILE_PATH_KEY, PathUtils.getPathWithoutSchemeAndAuthority(propertiesPath).toString())) .withFallback(configFromProps) .withFallback(fallback); } catch (ConfigurationException ce) { throw new IOException(ce); } }
[ "private", "Config", "loadJavaPropsWithFallback", "(", "Path", "propertiesPath", ",", "Config", "fallback", ")", "throws", "IOException", "{", "PropertiesConfiguration", "propertiesConfiguration", "=", "new", "PropertiesConfiguration", "(", ")", ";", "try", "(", "InputS...
Load a {@link Properties} compatible path using fallback as fallback. @return The {@link Config} in path with fallback as fallback. @throws IOException
[ "Load", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/PullFileLoader.java#L279-L298
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/program/jasper/JasperUtil.java
JasperUtil.getJasperDesign
public static JasperDesign getJasperDesign(final Instance _instance) throws EFapsException { final Checkout checkout = new Checkout(_instance); final InputStream source = checkout.execute(); JasperDesign jasperDesign = null; try { JasperUtil.LOG.debug("Loading JasperDesign for :{}", _instance); final DefaultJasperReportsContext reportContext = DefaultJasperReportsContext.getInstance(); final JRXmlLoader loader = new JRXmlLoader(reportContext, JRXmlDigesterFactory.createDigester(reportContext)); jasperDesign = loader.loadXML(source); } catch (final ParserConfigurationException e) { throw new EFapsException(JasperUtil.class, "getJasperDesign", e); } catch (final SAXException e) { throw new EFapsException(JasperUtil.class, "getJasperDesign", e); } catch (final JRException e) { throw new EFapsException(JasperUtil.class, "getJasperDesign", e); } return jasperDesign; }
java
public static JasperDesign getJasperDesign(final Instance _instance) throws EFapsException { final Checkout checkout = new Checkout(_instance); final InputStream source = checkout.execute(); JasperDesign jasperDesign = null; try { JasperUtil.LOG.debug("Loading JasperDesign for :{}", _instance); final DefaultJasperReportsContext reportContext = DefaultJasperReportsContext.getInstance(); final JRXmlLoader loader = new JRXmlLoader(reportContext, JRXmlDigesterFactory.createDigester(reportContext)); jasperDesign = loader.loadXML(source); } catch (final ParserConfigurationException e) { throw new EFapsException(JasperUtil.class, "getJasperDesign", e); } catch (final SAXException e) { throw new EFapsException(JasperUtil.class, "getJasperDesign", e); } catch (final JRException e) { throw new EFapsException(JasperUtil.class, "getJasperDesign", e); } return jasperDesign; }
[ "public", "static", "JasperDesign", "getJasperDesign", "(", "final", "Instance", "_instance", ")", "throws", "EFapsException", "{", "final", "Checkout", "checkout", "=", "new", "Checkout", "(", "_instance", ")", ";", "final", "InputStream", "source", "=", "checkou...
Get a JasperDesign for an instance. @param _instance Instance the JasperDesign is wanted for @return JasperDesign @throws EFapsException on error
[ "Get", "a", "JasperDesign", "for", "an", "instance", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/program/jasper/JasperUtil.java#L66-L86
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
ConstructorBuilder.buildDeprecationInfo
public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) { writer.addDeprecated( (ConstructorDoc) constructors.get(currentConstructorIndex), constructorDocTree); }
java
public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) { writer.addDeprecated( (ConstructorDoc) constructors.get(currentConstructorIndex), constructorDocTree); }
[ "public", "void", "buildDeprecationInfo", "(", "XMLNode", "node", ",", "Content", "constructorDocTree", ")", "{", "writer", ".", "addDeprecated", "(", "(", "ConstructorDoc", ")", "constructors", ".", "get", "(", "currentConstructorIndex", ")", ",", "constructorDocTr...
Build the deprecation information. @param node the XML element that specifies which components to document @param constructorDocTree the content tree to which the documentation will be added
[ "Build", "the", "deprecation", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java#L201-L204
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java
CompactCharArray.setElementAt
@Deprecated public void setElementAt(char index, char value) { if (isCompact) expand(); values[index] = value; touchBlock(index >> BLOCKSHIFT, value); }
java
@Deprecated public void setElementAt(char index, char value) { if (isCompact) expand(); values[index] = value; touchBlock(index >> BLOCKSHIFT, value); }
[ "@", "Deprecated", "public", "void", "setElementAt", "(", "char", "index", ",", "char", "value", ")", "{", "if", "(", "isCompact", ")", "expand", "(", ")", ";", "values", "[", "index", "]", "=", "value", ";", "touchBlock", "(", "index", ">>", "BLOCKSHI...
Set a new value for a Unicode character. Set automatically expands the array if it is compacted. @param index the character to set the mapped value with @param value the new mapped value @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "Set", "a", "new", "value", "for", "a", "Unicode", "character", ".", "Set", "automatically", "expands", "the", "array", "if", "it", "is", "compacted", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java#L152-L159
fracpete/multisearch-weka-package
src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java
PerformanceCache.getID
protected String getID(int cv, Point<Object> values) { String result; int i; result = "" + cv; for (i = 0; i < values.dimensions(); i++) result += "\t" + values.getValue(i); return result; }
java
protected String getID(int cv, Point<Object> values) { String result; int i; result = "" + cv; for (i = 0; i < values.dimensions(); i++) result += "\t" + values.getValue(i); return result; }
[ "protected", "String", "getID", "(", "int", "cv", ",", "Point", "<", "Object", ">", "values", ")", "{", "String", "result", ";", "int", "i", ";", "result", "=", "\"\"", "+", "cv", ";", "for", "(", "i", "=", "0", ";", "i", "<", "values", ".", "d...
returns the ID string for a cache item. @param cv the number of folds in the cross-validation @param values the point in the space @return the ID string
[ "returns", "the", "ID", "string", "for", "a", "cache", "item", "." ]
train
https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java#L50-L60
respoke/respoke-sdk-android
respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java
RespokeClient.getEndpoint
public RespokeEndpoint getEndpoint(String endpointIDToFind, boolean skipCreate) { RespokeEndpoint endpoint = null; if (null != endpointIDToFind) { for (RespokeEndpoint eachEndpoint : knownEndpoints) { if (eachEndpoint.getEndpointID().equals(endpointIDToFind)) { endpoint = eachEndpoint; break; } } if ((null == endpoint) && (!skipCreate)) { endpoint = new RespokeEndpoint(signalingChannel, endpointIDToFind, this); knownEndpoints.add(endpoint); } if (null != endpoint) { queuePresenceRegistration(endpoint.getEndpointID()); } } return endpoint; }
java
public RespokeEndpoint getEndpoint(String endpointIDToFind, boolean skipCreate) { RespokeEndpoint endpoint = null; if (null != endpointIDToFind) { for (RespokeEndpoint eachEndpoint : knownEndpoints) { if (eachEndpoint.getEndpointID().equals(endpointIDToFind)) { endpoint = eachEndpoint; break; } } if ((null == endpoint) && (!skipCreate)) { endpoint = new RespokeEndpoint(signalingChannel, endpointIDToFind, this); knownEndpoints.add(endpoint); } if (null != endpoint) { queuePresenceRegistration(endpoint.getEndpointID()); } } return endpoint; }
[ "public", "RespokeEndpoint", "getEndpoint", "(", "String", "endpointIDToFind", ",", "boolean", "skipCreate", ")", "{", "RespokeEndpoint", "endpoint", "=", "null", ";", "if", "(", "null", "!=", "endpointIDToFind", ")", "{", "for", "(", "RespokeEndpoint", "eachEndpo...
Find an endpoint by id and return it. In most cases, if we don't find it we will create it. This is useful in the case of dynamic endpoints where groups are not in use. Set skipCreate=true to return null if the Endpoint is not already known. @param endpointIDToFind The ID of the endpoint to return @param skipCreate If true, return null if the connection is not already known @return The endpoint whose ID was specified
[ "Find", "an", "endpoint", "by", "id", "and", "return", "it", ".", "In", "most", "cases", "if", "we", "don", "t", "find", "it", "we", "will", "create", "it", ".", "This", "is", "useful", "in", "the", "case", "of", "dynamic", "endpoints", "where", "gro...
train
https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java#L512-L534
codelibs/jcifs
src/main/java/jcifs/smb1/netbios/NbtAddress.java
NbtAddress.getByName
public static NbtAddress getByName( String host, int type, String scope ) throws UnknownHostException { return getByName( host, type, scope, null ); }
java
public static NbtAddress getByName( String host, int type, String scope ) throws UnknownHostException { return getByName( host, type, scope, null ); }
[ "public", "static", "NbtAddress", "getByName", "(", "String", "host", ",", "int", "type", ",", "String", "scope", ")", "throws", "UnknownHostException", "{", "return", "getByName", "(", "host", ",", "type", ",", "scope", ",", "null", ")", ";", "}" ]
Determines the address of a host given it's host name. NetBIOS names also have a <code>type</code>. Types(aka Hex Codes) are used to distiquish the various services on a host. <a href="../../../nbtcodes.html">Here</a> is a fairly complete list of NetBIOS hex codes. Scope is not used but is still functional in other NetBIOS products and so for completeness it has been implemented. A <code>scope</code> of <code>null</code> or <code>""</code> signifies no scope. @param host the name to resolve @param type the hex code of the name @param scope the scope of the name @throws java.net.UnknownHostException if there is an error resolving the name
[ "Determines", "the", "address", "of", "a", "host", "given", "it", "s", "host", "name", ".", "NetBIOS", "names", "also", "have", "a", "<code", ">", "type<", "/", "code", ">", ".", "Types", "(", "aka", "Hex", "Codes", ")", "are", "used", "to", "distiqu...
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/netbios/NbtAddress.java#L399-L405
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.setPerspectiveRect
public Matrix4f setPerspectiveRect(float width, float height, float zNear, float zFar, boolean zZeroToOne) { MemUtil.INSTANCE.zero(this); this._m00((zNear + zNear) / width); this._m11((zNear + zNear) / height); boolean farInf = zFar > 0 && Float.isInfinite(zFar); boolean nearInf = zNear > 0 && Float.isInfinite(zNear); if (farInf) { // See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf) float e = 1E-6f; this._m22(e - 1.0f); this._m32((e - (zZeroToOne ? 1.0f : 2.0f)) * zNear); } else if (nearInf) { float e = 1E-6f; this._m22((zZeroToOne ? 0.0f : 1.0f) - e); this._m32(((zZeroToOne ? 1.0f : 2.0f) - e) * zFar); } else { this._m22((zZeroToOne ? zFar : zFar + zNear) / (zNear - zFar)); this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar)); } this._m23(-1.0f); _properties(PROPERTY_PERSPECTIVE); return this; }
java
public Matrix4f setPerspectiveRect(float width, float height, float zNear, float zFar, boolean zZeroToOne) { MemUtil.INSTANCE.zero(this); this._m00((zNear + zNear) / width); this._m11((zNear + zNear) / height); boolean farInf = zFar > 0 && Float.isInfinite(zFar); boolean nearInf = zNear > 0 && Float.isInfinite(zNear); if (farInf) { // See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf) float e = 1E-6f; this._m22(e - 1.0f); this._m32((e - (zZeroToOne ? 1.0f : 2.0f)) * zNear); } else if (nearInf) { float e = 1E-6f; this._m22((zZeroToOne ? 0.0f : 1.0f) - e); this._m32(((zZeroToOne ? 1.0f : 2.0f) - e) * zFar); } else { this._m22((zZeroToOne ? zFar : zFar + zNear) / (zNear - zFar)); this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar)); } this._m23(-1.0f); _properties(PROPERTY_PERSPECTIVE); return this; }
[ "public", "Matrix4f", "setPerspectiveRect", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "MemUtil", ".", "INSTANCE", ".", "zero", "(", "this", ")", ";", "this", ".", "...
Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range. <p> In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveRect(float, float, float, float, boolean) perspectiveRect()}. @see #perspectiveRect(float, float, float, float, boolean) @param width the width of the near frustum plane @param height the height of the near frustum plane @param zNear near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", ".", "<p", ">", "In", "order", "to", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L9887-L9909
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasLayer.java
KerasLayer.getNInFromConfig
protected long getNInFromConfig(Map<String, ? extends KerasLayer> previousLayers) throws UnsupportedKerasConfigurationException { int size = previousLayers.size(); int count = 0; long nIn; String inboundLayerName = inboundLayerNames.get(0); while (count <= size) { if (previousLayers.containsKey(inboundLayerName)) { KerasLayer inbound = previousLayers.get(inboundLayerName); try { FeedForwardLayer ffLayer = (FeedForwardLayer) inbound.getLayer(); nIn = ffLayer.getNOut(); if (nIn > 0) return nIn; count++; inboundLayerName = inbound.getInboundLayerNames().get(0); } catch (Exception e) { inboundLayerName = inbound.getInboundLayerNames().get(0); } } } throw new UnsupportedKerasConfigurationException("Could not determine number of input channels for" + "depthwise convolution."); }
java
protected long getNInFromConfig(Map<String, ? extends KerasLayer> previousLayers) throws UnsupportedKerasConfigurationException { int size = previousLayers.size(); int count = 0; long nIn; String inboundLayerName = inboundLayerNames.get(0); while (count <= size) { if (previousLayers.containsKey(inboundLayerName)) { KerasLayer inbound = previousLayers.get(inboundLayerName); try { FeedForwardLayer ffLayer = (FeedForwardLayer) inbound.getLayer(); nIn = ffLayer.getNOut(); if (nIn > 0) return nIn; count++; inboundLayerName = inbound.getInboundLayerNames().get(0); } catch (Exception e) { inboundLayerName = inbound.getInboundLayerNames().get(0); } } } throw new UnsupportedKerasConfigurationException("Could not determine number of input channels for" + "depthwise convolution."); }
[ "protected", "long", "getNInFromConfig", "(", "Map", "<", "String", ",", "?", "extends", "KerasLayer", ">", "previousLayers", ")", "throws", "UnsupportedKerasConfigurationException", "{", "int", "size", "=", "previousLayers", ".", "size", "(", ")", ";", "int", "...
Some DL4J layers need explicit specification of number of inputs, which Keras does infer. This method searches through previous layers until a FeedForwardLayer is found. These layers have nOut values that subsequently correspond to the nIn value of this layer. @param previousLayers @return @throws UnsupportedKerasConfigurationException
[ "Some", "DL4J", "layers", "need", "explicit", "specification", "of", "number", "of", "inputs", "which", "Keras", "does", "infer", ".", "This", "method", "searches", "through", "previous", "layers", "until", "a", "FeedForwardLayer", "is", "found", ".", "These", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasLayer.java#L398-L420
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/DBQuery.java
DBQuery.greaterThanEquals
public static Query greaterThanEquals(String field, Object value) { return new Query().greaterThanEquals(field, value); }
java
public static Query greaterThanEquals(String field, Object value) { return new Query().greaterThanEquals(field, value); }
[ "public", "static", "Query", "greaterThanEquals", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "new", "Query", "(", ")", ".", "greaterThanEquals", "(", "field", ",", "value", ")", ";", "}" ]
The field is greater than or equal to the given value @param field The field to compare @param value The value to compare to @return the query
[ "The", "field", "is", "greater", "than", "or", "equal", "to", "the", "given", "value" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBQuery.java#L95-L97
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/AvroFlattener.java
AvroFlattener.flattenRecord
private Schema flattenRecord(Schema schema, boolean shouldPopulateLineage, boolean flattenComplexTypes) { Preconditions.checkNotNull(schema); Preconditions.checkArgument(Schema.Type.RECORD.equals(schema.getType())); Schema flattenedSchema; List<Schema.Field> flattenedFields = new ArrayList<>(); if (schema.getFields().size() > 0) { for (Schema.Field oldField : schema.getFields()) { List<Schema.Field> newFields = flattenField(oldField, ImmutableList.<String>of(), shouldPopulateLineage, flattenComplexTypes, Optional.<Schema>absent()); if (null != newFields && newFields.size() > 0) { flattenedFields.addAll(newFields); } } } flattenedSchema = Schema.createRecord(schema.getName(), schema.getDoc(), schema.getNamespace(), schema.isError()); flattenedSchema.setFields(flattenedFields); return flattenedSchema; }
java
private Schema flattenRecord(Schema schema, boolean shouldPopulateLineage, boolean flattenComplexTypes) { Preconditions.checkNotNull(schema); Preconditions.checkArgument(Schema.Type.RECORD.equals(schema.getType())); Schema flattenedSchema; List<Schema.Field> flattenedFields = new ArrayList<>(); if (schema.getFields().size() > 0) { for (Schema.Field oldField : schema.getFields()) { List<Schema.Field> newFields = flattenField(oldField, ImmutableList.<String>of(), shouldPopulateLineage, flattenComplexTypes, Optional.<Schema>absent()); if (null != newFields && newFields.size() > 0) { flattenedFields.addAll(newFields); } } } flattenedSchema = Schema.createRecord(schema.getName(), schema.getDoc(), schema.getNamespace(), schema.isError()); flattenedSchema.setFields(flattenedFields); return flattenedSchema; }
[ "private", "Schema", "flattenRecord", "(", "Schema", "schema", ",", "boolean", "shouldPopulateLineage", ",", "boolean", "flattenComplexTypes", ")", "{", "Preconditions", ".", "checkNotNull", "(", "schema", ")", ";", "Preconditions", ".", "checkArgument", "(", "Schem...
* Flatten Record schema @param schema Record Schema to flatten @param shouldPopulateLineage If lineage information should be tagged in the field, this is true when we are un-nesting fields @param flattenComplexTypes Flatten complex types recursively other than Record and Option @return Flattened Record Schema
[ "*", "Flatten", "Record", "schema" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroFlattener.java#L239-L261
h2oai/h2o-3
h2o-core/src/main/java/water/parser/ParseSetup.java
ParseSetup.guessSetup
public static ParseSetup guessSetup(Key[] fkeys, boolean singleQuote, int checkHeader) { return guessSetup(fkeys, new ParseSetup(GUESS_INFO, GUESS_SEP, singleQuote, checkHeader, GUESS_COL_CNT, null, new ParseWriter.ParseErr[0])); }
java
public static ParseSetup guessSetup(Key[] fkeys, boolean singleQuote, int checkHeader) { return guessSetup(fkeys, new ParseSetup(GUESS_INFO, GUESS_SEP, singleQuote, checkHeader, GUESS_COL_CNT, null, new ParseWriter.ParseErr[0])); }
[ "public", "static", "ParseSetup", "guessSetup", "(", "Key", "[", "]", "fkeys", ",", "boolean", "singleQuote", ",", "int", "checkHeader", ")", "{", "return", "guessSetup", "(", "fkeys", ",", "new", "ParseSetup", "(", "GUESS_INFO", ",", "GUESS_SEP", ",", "sing...
Used by test harnesses for simple parsing of test data. Presumes auto-detection for file and separator types. @param fkeys Keys to input vectors to be parsed @param singleQuote single quotes quote fields @param checkHeader check for a header @return ParseSetup settings from looking at all files
[ "Used", "by", "test", "harnesses", "for", "simple", "parsing", "of", "test", "data", ".", "Presumes", "auto", "-", "detection", "for", "file", "and", "separator", "types", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/ParseSetup.java#L336-L338
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java
NodeSetDTM.appendNodes
public void appendNodes(NodeVector nodes) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.appendNodes(nodes); }
java
public void appendNodes(NodeVector nodes) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.appendNodes(nodes); }
[ "public", "void", "appendNodes", "(", "NodeVector", "nodes", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESETDTM_NOT_MUTABLE", ",", "null", "...
Append the nodes to the list. @param nodes The nodes to be appended to this node set. @throws RuntimeException thrown if this NodeSetDTM is not of a mutable type.
[ "Append", "the", "nodes", "to", "the", "list", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L929-L936
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container/src/com/ibm/ws/jpa/container/osgi/internal/JPAComponentImpl.java
JPAComponentImpl.processClientModulePersistenceXml
private void processClientModulePersistenceXml(JPAApplInfo applInfo, ContainerInfo module, ClassLoader loader) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "processClientModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); String archiveName = module.getName(); Container clientContainer = module.getContainer(); ClassLoader clientClassLoader = loader; // ------------------------------------------------------------------------ // JPA 2.0 Specification - 8.2 Persistence Unit Packaging // // A persistence unit is defined by a persistence.xml file. The jar file or // directory whose META-INF directory contains the persistence.xml file is // termed the root of the persistence unit. In Java EE environments, the // root of a persistence unit may be one of the following: // // -> an EJB-JAR file // ------------------------------------------------------------------------ // Obtain persistence.xml in META-INF Entry pxml = clientContainer.getEntry("META-INF/persistence.xml"); if (pxml != null) { String appName = applInfo.getApplName(); URL puRoot = getPXmlRootURL(appName, archiveName, pxml); applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, archiveName, JPAPuScope.Client_Scope, puRoot, clientClassLoader, pxml)); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "processClientModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); }
java
private void processClientModulePersistenceXml(JPAApplInfo applInfo, ContainerInfo module, ClassLoader loader) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "processClientModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); String archiveName = module.getName(); Container clientContainer = module.getContainer(); ClassLoader clientClassLoader = loader; // ------------------------------------------------------------------------ // JPA 2.0 Specification - 8.2 Persistence Unit Packaging // // A persistence unit is defined by a persistence.xml file. The jar file or // directory whose META-INF directory contains the persistence.xml file is // termed the root of the persistence unit. In Java EE environments, the // root of a persistence unit may be one of the following: // // -> an EJB-JAR file // ------------------------------------------------------------------------ // Obtain persistence.xml in META-INF Entry pxml = clientContainer.getEntry("META-INF/persistence.xml"); if (pxml != null) { String appName = applInfo.getApplName(); URL puRoot = getPXmlRootURL(appName, archiveName, pxml); applInfo.addPersistenceUnits(new OSGiJPAPXml(applInfo, archiveName, JPAPuScope.Client_Scope, puRoot, clientClassLoader, pxml)); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "processClientModulePersistenceXml : " + applInfo.getApplName() + "#" + module.getName()); }
[ "private", "void", "processClientModulePersistenceXml", "(", "JPAApplInfo", "applInfo", ",", "ContainerInfo", "module", ",", "ClassLoader", "loader", ")", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ";", "if", "...
Locates and processes persistence.xml file in an Application Client module. <p> @param applInfo the application archive information @param module the client module archive information
[ "Locates", "and", "processes", "persistence", ".", "xml", "file", "in", "an", "Application", "Client", "module", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container/src/com/ibm/ws/jpa/container/osgi/internal/JPAComponentImpl.java#L580-L612
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.writeStringToFile
public static void writeStringToFile(String contents, String path, String encoding) throws IOException { OutputStream writer = null; if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(path)); } else { writer = new BufferedOutputStream(new FileOutputStream(path)); } writer.write(contents.getBytes(encoding)); }
java
public static void writeStringToFile(String contents, String path, String encoding) throws IOException { OutputStream writer = null; if (path.endsWith(".gz")) { writer = new GZIPOutputStream(new FileOutputStream(path)); } else { writer = new BufferedOutputStream(new FileOutputStream(path)); } writer.write(contents.getBytes(encoding)); }
[ "public", "static", "void", "writeStringToFile", "(", "String", "contents", ",", "String", "path", ",", "String", "encoding", ")", "throws", "IOException", "{", "OutputStream", "writer", "=", "null", ";", "if", "(", "path", ".", "endsWith", "(", "\".gz\"", "...
Writes a string to a file @param contents The string to write @param path The file path @param encoding The encoding to encode in @throws IOException In case of failure
[ "Writes", "a", "string", "to", "a", "file" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L162-L170
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/base/Json.java
Json.resource_to_string
public String resource_to_string(base_resource resources[], options option, String onerror) { String objecttype = resources[0].get_object_type(); String request = "{"; if ( (option != null && option.get_action() != null) || (!onerror.equals("")) ) { request = request + "\"params\":{"; if (option != null) { if(option.get_action() != null) { request = request + "\"action\":\"" + option.get_action()+"\","; } } if((!onerror.equals(""))) { request = request + "\"onerror\":\"" + onerror + "\""; } request = request + "},"; } request = request + "\"" + objecttype + "\":["; for (int i = 0; i < resources.length ; i++) { String str = this.resource_to_string(resources[i]); request = request + str + ","; } request = request + "]}"; return request; }
java
public String resource_to_string(base_resource resources[], options option, String onerror) { String objecttype = resources[0].get_object_type(); String request = "{"; if ( (option != null && option.get_action() != null) || (!onerror.equals("")) ) { request = request + "\"params\":{"; if (option != null) { if(option.get_action() != null) { request = request + "\"action\":\"" + option.get_action()+"\","; } } if((!onerror.equals(""))) { request = request + "\"onerror\":\"" + onerror + "\""; } request = request + "},"; } request = request + "\"" + objecttype + "\":["; for (int i = 0; i < resources.length ; i++) { String str = this.resource_to_string(resources[i]); request = request + str + ","; } request = request + "]}"; return request; }
[ "public", "String", "resource_to_string", "(", "base_resource", "resources", "[", "]", ",", "options", "option", ",", "String", "onerror", ")", "{", "String", "objecttype", "=", "resources", "[", "0", "]", ".", "get_object_type", "(", ")", ";", "String", "re...
Converts MPS resources to Json string. @param resources nitro resources. @param option options class object. @return returns a String
[ "Converts", "MPS", "resources", "to", "Json", "string", "." ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/Json.java#L135-L167
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/DERBitString.java
DERBitString.getInstance
public static DERBitString getInstance( Object obj) { if (obj == null || obj instanceof DERBitString) { return (DERBitString)obj; } if (obj instanceof ASN1OctetString) { byte[] bytes = ((ASN1OctetString)obj).getOctets(); int padBits = bytes[0]; byte[] data = new byte[bytes.length - 1]; System.arraycopy(bytes, 1, data, 0, bytes.length - 1); return new DERBitString(data, padBits); } if (obj instanceof ASN1TaggedObject) { return getInstance(((ASN1TaggedObject)obj).getObject()); } throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); }
java
public static DERBitString getInstance( Object obj) { if (obj == null || obj instanceof DERBitString) { return (DERBitString)obj; } if (obj instanceof ASN1OctetString) { byte[] bytes = ((ASN1OctetString)obj).getOctets(); int padBits = bytes[0]; byte[] data = new byte[bytes.length - 1]; System.arraycopy(bytes, 1, data, 0, bytes.length - 1); return new DERBitString(data, padBits); } if (obj instanceof ASN1TaggedObject) { return getInstance(((ASN1TaggedObject)obj).getObject()); } throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName()); }
[ "public", "static", "DERBitString", "getInstance", "(", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", "||", "obj", "instanceof", "DERBitString", ")", "{", "return", "(", "DERBitString", ")", "obj", ";", "}", "if", "(", "obj", "instanceof", "...
return a Bit String from the passed in object @exception IllegalArgumentException if the object cannot be converted.
[ "return", "a", "Bit", "String", "from", "the", "passed", "in", "object" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/asn1/DERBitString.java#L107-L132
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java
CmsGalleryController.selectResource
public void selectResource(String resourcePath, CmsUUID structureId, String title, String resourceType) { String provider = getProviderName(resourceType); if (provider == null) { // use {@link org.opencms.ade.galleries.client.preview.CmsBinaryPreviewProvider} as default to select a resource provider = I_CmsBinaryPreviewProvider.PREVIEW_NAME; } if (m_previewFactoryRegistration.containsKey(provider)) { m_previewFactoryRegistration.get(provider).getPreview(m_handler.m_galleryDialog).selectResource( resourcePath, structureId, title); } else { CmsDebugLog.getInstance().printLine("No provider available"); } }
java
public void selectResource(String resourcePath, CmsUUID structureId, String title, String resourceType) { String provider = getProviderName(resourceType); if (provider == null) { // use {@link org.opencms.ade.galleries.client.preview.CmsBinaryPreviewProvider} as default to select a resource provider = I_CmsBinaryPreviewProvider.PREVIEW_NAME; } if (m_previewFactoryRegistration.containsKey(provider)) { m_previewFactoryRegistration.get(provider).getPreview(m_handler.m_galleryDialog).selectResource( resourcePath, structureId, title); } else { CmsDebugLog.getInstance().printLine("No provider available"); } }
[ "public", "void", "selectResource", "(", "String", "resourcePath", ",", "CmsUUID", "structureId", ",", "String", "title", ",", "String", "resourceType", ")", "{", "String", "provider", "=", "getProviderName", "(", "resourceType", ")", ";", "if", "(", "provider",...
Selects the given resource and sets its path into the xml-content field or editor link.<p> @param resourcePath the resource path @param structureId the structure id @param title the resource title @param resourceType the resource type
[ "Selects", "the", "given", "resource", "and", "sets", "its", "path", "into", "the", "xml", "-", "content", "field", "or", "editor", "link", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java#L1246-L1262
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/Manager.java
Manager.getDatabase
@InterfaceAudience.Public public Database getDatabase(String name) throws CouchbaseLiteException { DatabaseOptions options = getDefaultOptions(name); options.setCreate(true); return openDatabase(name, options); }
java
@InterfaceAudience.Public public Database getDatabase(String name) throws CouchbaseLiteException { DatabaseOptions options = getDefaultOptions(name); options.setCreate(true); return openDatabase(name, options); }
[ "@", "InterfaceAudience", ".", "Public", "public", "Database", "getDatabase", "(", "String", "name", ")", "throws", "CouchbaseLiteException", "{", "DatabaseOptions", "options", "=", "getDefaultOptions", "(", "name", ")", ";", "options", ".", "setCreate", "(", "tru...
<p> Returns the database with the given name, or creates it if it doesn't exist. Multiple calls with the same name will return the same {@link Database} instance. <p/> <p> This is equivalent to calling {@link #openDatabase(String, DatabaseOptions)} with a default set of options with the `Create` flag set. </p> <p> NOTE: Database names may not contain capital letters. </p>
[ "<p", ">", "Returns", "the", "database", "with", "the", "given", "name", "or", "creates", "it", "if", "it", "doesn", "t", "exist", ".", "Multiple", "calls", "with", "the", "same", "name", "will", "return", "the", "same", "{" ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/Manager.java#L301-L306
clanie/clanie-core
src/main/java/dk/clanie/collections/CollectionFilters.java
CollectionFilters.removeMatcing
public static <E> void removeMatcing(Collection<E> collection, Matcher<? super E> matcher) { Iterator<E> iter = collection.iterator(); while (iter.hasNext()) { E item = iter.next(); if (matcher.matches(item)) iter.remove(); } }
java
public static <E> void removeMatcing(Collection<E> collection, Matcher<? super E> matcher) { Iterator<E> iter = collection.iterator(); while (iter.hasNext()) { E item = iter.next(); if (matcher.matches(item)) iter.remove(); } }
[ "public", "static", "<", "E", ">", "void", "removeMatcing", "(", "Collection", "<", "E", ">", "collection", ",", "Matcher", "<", "?", "super", "E", ">", "matcher", ")", "{", "Iterator", "<", "E", ">", "iter", "=", "collection", ".", "iterator", "(", ...
Removes matching elements from the supplied Collection. @param <E> @param collection @param matcher
[ "Removes", "matching", "elements", "from", "the", "supplied", "Collection", "." ]
train
https://github.com/clanie/clanie-core/blob/ac8a655b93127f0e281b741c4d53f429be2816ad/src/main/java/dk/clanie/collections/CollectionFilters.java#L41-L47
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/utils/IoUtils.java
IoUtils.copyStream
public static boolean copyStream(InputStream is, OutputStream os, CopyListener listener) throws IOException { return copyStream(is, os, listener, DEFAULT_BUFFER_SIZE); }
java
public static boolean copyStream(InputStream is, OutputStream os, CopyListener listener) throws IOException { return copyStream(is, os, listener, DEFAULT_BUFFER_SIZE); }
[ "public", "static", "boolean", "copyStream", "(", "InputStream", "is", ",", "OutputStream", "os", ",", "CopyListener", "listener", ")", "throws", "IOException", "{", "return", "copyStream", "(", "is", ",", "os", ",", "listener", ",", "DEFAULT_BUFFER_SIZE", ")", ...
Copies stream, fires progress events by listener, can be interrupted by listener. Uses buffer size = {@value #DEFAULT_BUFFER_SIZE} bytes. @param is Input stream @param os Output stream @param listener null-ok; Listener of copying progress and controller of copying interrupting @return <b>true</b> - if stream copied successfully; <b>false</b> - if copying was interrupted by listener @throws IOException
[ "Copies", "stream", "fires", "progress", "events", "by", "listener", "can", "be", "interrupted", "by", "listener", ".", "Uses", "buffer", "size", "=", "{", "@value", "#DEFAULT_BUFFER_SIZE", "}", "bytes", "." ]
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/utils/IoUtils.java#L51-L53
Alluxio/alluxio
core/server/common/src/main/java/alluxio/cli/ValidateEnv.java
ValidateEnv.parseArgsAndOptions
private static CommandLine parseArgsAndOptions(Options options, String... args) throws InvalidArgumentException { CommandLineParser parser = new DefaultParser(); CommandLine cmd; try { cmd = parser.parse(options, args); } catch (ParseException e) { throw new InvalidArgumentException( "Failed to parse args for validateEnv", e); } return cmd; }
java
private static CommandLine parseArgsAndOptions(Options options, String... args) throws InvalidArgumentException { CommandLineParser parser = new DefaultParser(); CommandLine cmd; try { cmd = parser.parse(options, args); } catch (ParseException e) { throw new InvalidArgumentException( "Failed to parse args for validateEnv", e); } return cmd; }
[ "private", "static", "CommandLine", "parseArgsAndOptions", "(", "Options", "options", ",", "String", "...", "args", ")", "throws", "InvalidArgumentException", "{", "CommandLineParser", "parser", "=", "new", "DefaultParser", "(", ")", ";", "CommandLine", "cmd", ";", ...
Parses the command line arguments and options in {@code args}. After successful execution of this method, command line arguments can be retrieved by invoking {@link CommandLine#getArgs()}, and options can be retrieved by calling {@link CommandLine#getOptions()}. @param args command line arguments to parse @return {@link CommandLine} object representing the parsing result @throws InvalidArgumentException if command line contains invalid argument(s)
[ "Parses", "the", "command", "line", "arguments", "and", "options", "in", "{", "@code", "args", "}", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/cli/ValidateEnv.java#L420-L432
pmwmedia/tinylog
tinylog-impl/src/main/java/org/tinylog/path/DynamicPath.java
DynamicPath.parseSegment
private static Segment parseSegment(final String path, final String token) { int separator = token.indexOf(':'); String name; String parameter; if (separator == -1) { name = token.trim(); parameter = null; } else { name = token.substring(0, separator).trim(); parameter = token.substring(separator + 1).trim(); } if ("date".equals(name)) { return new DateSegment(parameter == null ? DEFAULT_DATE_FORMAT_PATTERN : parameter); } else if ("count".equals(name) && parameter == null) { return new CountSegment(); } else if ("pid".equals(name) && parameter == null) { return new ProcessIdSegment(); } else { throw new IllegalArgumentException("Invalid token '" + token + "' in '" + path + "'"); } }
java
private static Segment parseSegment(final String path, final String token) { int separator = token.indexOf(':'); String name; String parameter; if (separator == -1) { name = token.trim(); parameter = null; } else { name = token.substring(0, separator).trim(); parameter = token.substring(separator + 1).trim(); } if ("date".equals(name)) { return new DateSegment(parameter == null ? DEFAULT_DATE_FORMAT_PATTERN : parameter); } else if ("count".equals(name) && parameter == null) { return new CountSegment(); } else if ("pid".equals(name) && parameter == null) { return new ProcessIdSegment(); } else { throw new IllegalArgumentException("Invalid token '" + token + "' in '" + path + "'"); } }
[ "private", "static", "Segment", "parseSegment", "(", "final", "String", "path", ",", "final", "String", "token", ")", "{", "int", "separator", "=", "token", ".", "indexOf", "(", "'", "'", ")", ";", "String", "name", ";", "String", "parameter", ";", "if",...
Parses a token from a pattern as a segment. @param path Full path with patterns @param token Token from a pattern @return Created segment that represents the passed token
[ "Parses", "a", "token", "from", "a", "pattern", "as", "a", "segment", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/path/DynamicPath.java#L221-L244
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/support/IndexRange.java
IndexRange.mergedWith
public IndexRange mergedWith(IndexRange other) { checkArgNotNull(other, "other"); return new IndexRange(Math.min(start, other.start), Math.max(end, other.end)); }
java
public IndexRange mergedWith(IndexRange other) { checkArgNotNull(other, "other"); return new IndexRange(Math.min(start, other.start), Math.max(end, other.end)); }
[ "public", "IndexRange", "mergedWith", "(", "IndexRange", "other", ")", "{", "checkArgNotNull", "(", "other", ",", "\"other\"", ")", ";", "return", "new", "IndexRange", "(", "Math", ".", "min", "(", "start", ",", "other", ".", "start", ")", ",", "Math", "...
Created a new IndexRange that spans all characters between the smallest and the highest index of the two ranges. @param other the other range @return a new IndexRange instance
[ "Created", "a", "new", "IndexRange", "that", "spans", "all", "characters", "between", "the", "smallest", "and", "the", "highest", "index", "of", "the", "two", "ranges", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/IndexRange.java#L112-L115
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java
MetadataService.ensureProjectToken
private static void ensureProjectToken(ProjectMetadata project, String appId) { requireNonNull(project, "project"); requireNonNull(appId, "appId"); checkArgument(project.tokens().containsKey(appId), appId + " is not a token of the project " + project.name()); }
java
private static void ensureProjectToken(ProjectMetadata project, String appId) { requireNonNull(project, "project"); requireNonNull(appId, "appId"); checkArgument(project.tokens().containsKey(appId), appId + " is not a token of the project " + project.name()); }
[ "private", "static", "void", "ensureProjectToken", "(", "ProjectMetadata", "project", ",", "String", "appId", ")", "{", "requireNonNull", "(", "project", ",", "\"project\"", ")", ";", "requireNonNull", "(", "appId", ",", "\"appId\"", ")", ";", "checkArgument", "...
Ensures that the specified {@code appId} is a token of the specified {@code project}.
[ "Ensures", "that", "the", "specified", "{" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L871-L877
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/metadata/BpmPlatformXmlParse.java
BpmPlatformXmlParse.parseRootElement
protected void parseRootElement() { JobExecutorXmlImpl jobExecutor = new JobExecutorXmlImpl(); List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>(); for (Element element : rootElement.elements()) { if(JOB_EXECUTOR.equals(element.getTagName())) { parseJobExecutor(element, jobExecutor); } else if(PROCESS_ENGINE.equals(element.getTagName())) { parseProcessEngine(element, processEngines); } } bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutor, processEngines); }
java
protected void parseRootElement() { JobExecutorXmlImpl jobExecutor = new JobExecutorXmlImpl(); List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>(); for (Element element : rootElement.elements()) { if(JOB_EXECUTOR.equals(element.getTagName())) { parseJobExecutor(element, jobExecutor); } else if(PROCESS_ENGINE.equals(element.getTagName())) { parseProcessEngine(element, processEngines); } } bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutor, processEngines); }
[ "protected", "void", "parseRootElement", "(", ")", "{", "JobExecutorXmlImpl", "jobExecutor", "=", "new", "JobExecutorXmlImpl", "(", ")", ";", "List", "<", "ProcessEngineXml", ">", "processEngines", "=", "new", "ArrayList", "<", "ProcessEngineXml", ">", "(", ")", ...
We know this is a <code>&lt;bpm-platform ../&gt;</code> element
[ "We", "know", "this", "is", "a", "<code", ">", "&lt", ";", "bpm", "-", "platform", "..", "/", "&gt", ";", "<", "/", "code", ">", "element" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/metadata/BpmPlatformXmlParse.java#L59-L77
bwkimmel/jdcp
jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java
FileClassManager.releaseChildClassManager
private void releaseChildClassManager(FileChildClassManager child) { for (int i = 0; i < activeChildren.size(); i++) { FileChildClassManager current = activeChildren.get(i); if (current.childIndex == child.childIndex) { FileUtil.deleteRecursive(child.childDirectory); deprecationPendingList.add(child.childIndex); if (i == 0) { Collections.sort(deprecationPendingList); for (int pendingIndex : deprecationPendingList) { if (pendingIndex > current.childIndex) { break; } File pendingDirectory = new File(deprecatedDirectory, Integer.toString(pendingIndex + 1)); FileUtil.deleteRecursive(pendingDirectory); } } } } }
java
private void releaseChildClassManager(FileChildClassManager child) { for (int i = 0; i < activeChildren.size(); i++) { FileChildClassManager current = activeChildren.get(i); if (current.childIndex == child.childIndex) { FileUtil.deleteRecursive(child.childDirectory); deprecationPendingList.add(child.childIndex); if (i == 0) { Collections.sort(deprecationPendingList); for (int pendingIndex : deprecationPendingList) { if (pendingIndex > current.childIndex) { break; } File pendingDirectory = new File(deprecatedDirectory, Integer.toString(pendingIndex + 1)); FileUtil.deleteRecursive(pendingDirectory); } } } } }
[ "private", "void", "releaseChildClassManager", "(", "FileChildClassManager", "child", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "activeChildren", ".", "size", "(", ")", ";", "i", "++", ")", "{", "FileChildClassManager", "current", "=", "ac...
Releases the resources associated with a child <code>ClassManager</code>. @param child The child <code>ClassManager</code> to release.
[ "Releases", "the", "resources", "associated", "with", "a", "child", "<code", ">", "ClassManager<", "/", "code", ">", "." ]
train
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-server/src/main/java/ca/eandb/jdcp/server/classmanager/FileClassManager.java#L340-L358
google/closure-templates
java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java
SoyNodeCompiler.visitCallDelegateNode
@Override protected Statement visitCallDelegateNode(CallDelegateNode node) { Label reattachPoint = new Label(); Expression variantExpr; if (node.getDelCalleeVariantExpr() == null) { variantExpr = constant(""); } else { variantExpr = exprCompiler.compile(node.getDelCalleeVariantExpr(), reattachPoint).coerceToString(); } Expression calleeExpression = parameterLookup .getRenderContext() .getDeltemplate( node.getDelCalleeName(), variantExpr, node.allowEmptyDefault(), prepareParamsHelper(node, reattachPoint), parameterLookup.getIjRecord()); return renderCallNode(reattachPoint, node, calleeExpression); }
java
@Override protected Statement visitCallDelegateNode(CallDelegateNode node) { Label reattachPoint = new Label(); Expression variantExpr; if (node.getDelCalleeVariantExpr() == null) { variantExpr = constant(""); } else { variantExpr = exprCompiler.compile(node.getDelCalleeVariantExpr(), reattachPoint).coerceToString(); } Expression calleeExpression = parameterLookup .getRenderContext() .getDeltemplate( node.getDelCalleeName(), variantExpr, node.allowEmptyDefault(), prepareParamsHelper(node, reattachPoint), parameterLookup.getIjRecord()); return renderCallNode(reattachPoint, node, calleeExpression); }
[ "@", "Override", "protected", "Statement", "visitCallDelegateNode", "(", "CallDelegateNode", "node", ")", "{", "Label", "reattachPoint", "=", "new", "Label", "(", ")", ";", "Expression", "variantExpr", ";", "if", "(", "node", ".", "getDelCalleeVariantExpr", "(", ...
Given this delcall: {@code {delcall foo.bar variant="$expr" allowemptydefault="true"}} <p>Generate code that looks like: <pre>{@code renderContext.getDeltemplate("foo.bar", <variant-expression>, true) .create(<prepareParameters>, ijParams) .render(appendable, renderContext) }</pre> <p>We share logic with {@link #visitCallBasicNode(CallBasicNode)} around the actual calling convention (setting up detaches, storing the template in a field). As well as the logic for preparing the data record. The only interesting part of delcalls is calculating the {@code variant} and the fact that we have to invoke the {@link RenderContext} runtime to do the deltemplate lookup.
[ "Given", "this", "delcall", ":", "{", "@code", "{", "delcall", "foo", ".", "bar", "variant", "=", "$expr", "allowemptydefault", "=", "true", "}}" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/SoyNodeCompiler.java#L820-L840
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java
EventSubscriptionsInner.createOrUpdate
public EventSubscriptionInner createOrUpdate(String scope, String eventSubscriptionName, EventSubscriptionInner eventSubscriptionInfo) { return createOrUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionInfo).toBlocking().last().body(); }
java
public EventSubscriptionInner createOrUpdate(String scope, String eventSubscriptionName, EventSubscriptionInner eventSubscriptionInfo) { return createOrUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionInfo).toBlocking().last().body(); }
[ "public", "EventSubscriptionInner", "createOrUpdate", "(", "String", "scope", ",", "String", "eventSubscriptionName", ",", "EventSubscriptionInner", "eventSubscriptionInfo", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "scope", ",", "eventSubscriptionName"...
Create or update an event subscription. Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope. @param scope The identifier of the resource to which the event subscription needs to be created or updated. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param eventSubscriptionName Name of the event subscription. Event subscription names must be between 3 and 64 characters in length and should use alphanumeric letters only. @param eventSubscriptionInfo Event subscription properties containing the destination and filter information @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EventSubscriptionInner object if successful.
[ "Create", "or", "update", "an", "event", "subscription", ".", "Asynchronously", "creates", "a", "new", "event", "subscription", "or", "updates", "an", "existing", "event", "subscription", "based", "on", "the", "specified", "scope", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L235-L237
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java
Shape.getOffsetUnsafe
public static long getOffsetUnsafe(DataBuffer shapeInformation, int dim0, int dim1, int dim2) { long offset = 0; int size_0 = sizeUnsafe(shapeInformation, 0); int size_1 = sizeUnsafe(shapeInformation, 1); int size_2 = sizeUnsafe(shapeInformation, 2); if (dim0 >= size_0 || dim1 >= size_1 || dim2 >= size_2) throw new IllegalArgumentException("Invalid indices: cannot get [" + dim0 + "," + dim1 + "," + dim2 + "] from a " + Arrays.toString(shape(shapeInformation)) + " NDArray"); if (size_0 != 1) offset += dim0 * strideUnsafe(shapeInformation, 0, 3); if (size_1 != 1) offset += dim1 * strideUnsafe(shapeInformation, 1, 3); if (size_2 != 1) offset += dim2 * strideUnsafe(shapeInformation, 2, 3); return offset; }
java
public static long getOffsetUnsafe(DataBuffer shapeInformation, int dim0, int dim1, int dim2) { long offset = 0; int size_0 = sizeUnsafe(shapeInformation, 0); int size_1 = sizeUnsafe(shapeInformation, 1); int size_2 = sizeUnsafe(shapeInformation, 2); if (dim0 >= size_0 || dim1 >= size_1 || dim2 >= size_2) throw new IllegalArgumentException("Invalid indices: cannot get [" + dim0 + "," + dim1 + "," + dim2 + "] from a " + Arrays.toString(shape(shapeInformation)) + " NDArray"); if (size_0 != 1) offset += dim0 * strideUnsafe(shapeInformation, 0, 3); if (size_1 != 1) offset += dim1 * strideUnsafe(shapeInformation, 1, 3); if (size_2 != 1) offset += dim2 * strideUnsafe(shapeInformation, 2, 3); return offset; }
[ "public", "static", "long", "getOffsetUnsafe", "(", "DataBuffer", "shapeInformation", ",", "int", "dim0", ",", "int", "dim1", ",", "int", "dim2", ")", "{", "long", "offset", "=", "0", ";", "int", "size_0", "=", "sizeUnsafe", "(", "shapeInformation", ",", "...
Identical to {@link Shape#getOffset(DataBuffer, int, int, int)} but without input validation on array rank
[ "Identical", "to", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L1128-L1145
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.rnnTimeStep
public INDArray[] rnnTimeStep(MemoryWorkspace outputWorkspace, INDArray... inputs){ try{ return rnnTimeStepHelper(outputWorkspace, inputs); } catch (OutOfMemoryError e){ CrashReportingUtil.writeMemoryCrashDump(this, e); throw e; } }
java
public INDArray[] rnnTimeStep(MemoryWorkspace outputWorkspace, INDArray... inputs){ try{ return rnnTimeStepHelper(outputWorkspace, inputs); } catch (OutOfMemoryError e){ CrashReportingUtil.writeMemoryCrashDump(this, e); throw e; } }
[ "public", "INDArray", "[", "]", "rnnTimeStep", "(", "MemoryWorkspace", "outputWorkspace", ",", "INDArray", "...", "inputs", ")", "{", "try", "{", "return", "rnnTimeStepHelper", "(", "outputWorkspace", ",", "inputs", ")", ";", "}", "catch", "(", "OutOfMemoryError...
See {@link #rnnTimeStep(INDArray...)} for details.<br> If no memory workspace is provided, the output will be detached (not in any workspace).<br> If a memory workspace is provided, the output activation array (i.e., the INDArray returned by this method) will be placed in the specified workspace. This workspace must be opened by the user before calling this method - and the user is responsible for (a) closing this workspace, and (b) ensuring the output array is not used out of scope (i.e., not used after closing the workspace to which it belongs - as this is likely to cause either an exception when used, or a crash). @param inputs Input activations @param outputWorkspace Output workspace. May be null @return The output/activations from the network (either detached or in the specified workspace if provided)
[ "See", "{", "@link", "#rnnTimeStep", "(", "INDArray", "...", ")", "}", "for", "details", ".", "<br", ">", "If", "no", "memory", "workspace", "is", "provided", "the", "output", "will", "be", "detached", "(", "not", "in", "any", "workspace", ")", ".", "<...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3418-L3425
Netflix/zeno
src/main/java/com/netflix/zeno/serializer/FrameworkSerializer.java
FrameworkSerializer.serializeSortedMap
public <K, V> void serializeSortedMap(S rec, String fieldName, String keyTypeName, String valueTypeName, SortedMap<K, V> obj) { serializeMap(rec, fieldName, keyTypeName, valueTypeName, obj); }
java
public <K, V> void serializeSortedMap(S rec, String fieldName, String keyTypeName, String valueTypeName, SortedMap<K, V> obj) { serializeMap(rec, fieldName, keyTypeName, valueTypeName, obj); }
[ "public", "<", "K", ",", "V", ">", "void", "serializeSortedMap", "(", "S", "rec", ",", "String", "fieldName", ",", "String", "keyTypeName", ",", "String", "valueTypeName", ",", "SortedMap", "<", "K", ",", "V", ">", "obj", ")", "{", "serializeMap", "(", ...
Serialize sorted map @param rec @param fieldName @param typeName @param obj
[ "Serialize", "sorted", "map" ]
train
https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/main/java/com/netflix/zeno/serializer/FrameworkSerializer.java#L165-L167
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.lastIndex
public SDVariable lastIndex(String name, SDVariable in, Condition condition, boolean keepDims, int... dimensions) { SDVariable ret = f().lastIndex(in, condition, keepDims, dimensions); return updateVariableNameAndReference(ret, name); }
java
public SDVariable lastIndex(String name, SDVariable in, Condition condition, boolean keepDims, int... dimensions) { SDVariable ret = f().lastIndex(in, condition, keepDims, dimensions); return updateVariableNameAndReference(ret, name); }
[ "public", "SDVariable", "lastIndex", "(", "String", "name", ",", "SDVariable", "in", ",", "Condition", "condition", ",", "boolean", "keepDims", ",", "int", "...", "dimensions", ")", "{", "SDVariable", "ret", "=", "f", "(", ")", ".", "lastIndex", "(", "in",...
Last index reduction operation.<br> Returns a variable that contains the index of the last element that matches the specified condition (for each slice along the specified dimensions)<br> Note that if keepDims = true, the output variable has the same rank as the input variable, with the reduced dimensions having size 1. This can be useful for later broadcast operations (such as subtracting the mean along a dimension).<br> Example: if input has shape [a,b,c] and dimensions=[1] then output has shape: keepDims = true: [a,1,c]<br> keepDims = false: [a,c] @param name Name of the output variable @param in Input variable @param condition Condition to check on input variable @param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed @return Reduced array of rank (input rank - num dimensions)
[ "Last", "index", "reduction", "operation", ".", "<br", ">", "Returns", "a", "variable", "that", "contains", "the", "index", "of", "the", "last", "element", "that", "matches", "the", "specified", "condition", "(", "for", "each", "slice", "along", "the", "spec...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L1505-L1508
bignerdranch/expandable-recycler-view
expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java
ExpandableRecyclerAdapter.setParentList
@UiThread public void setParentList(@NonNull List<P> parentList, boolean preserveExpansionState) { mParentList = parentList; notifyParentDataSetChanged(preserveExpansionState); }
java
@UiThread public void setParentList(@NonNull List<P> parentList, boolean preserveExpansionState) { mParentList = parentList; notifyParentDataSetChanged(preserveExpansionState); }
[ "@", "UiThread", "public", "void", "setParentList", "(", "@", "NonNull", "List", "<", "P", ">", "parentList", ",", "boolean", "preserveExpansionState", ")", "{", "mParentList", "=", "parentList", ";", "notifyParentDataSetChanged", "(", "preserveExpansionState", ")",...
Set a new list of parents and notify any registered observers that the data set has changed. <p> This setter does not specify what about the data set has changed, forcing any observers to assume that all existing items and structure may no longer be valid. LayoutManagers will be forced to fully rebind and relayout all visible views.</p> <p> It will always be more efficient to use the more specific change events if you can. Rely on {@code #setParentList(List, boolean)} as a last resort. There will be no animation of changes, unlike the more specific change events listed below. @see #notifyParentInserted(int) @see #notifyParentRemoved(int) @see #notifyParentChanged(int) @see #notifyParentRangeInserted(int, int) @see #notifyChildInserted(int, int) @see #notifyChildRemoved(int, int) @see #notifyChildChanged(int, int) @param preserveExpansionState If true, the adapter will attempt to preserve your parent's last expanded state. This depends on object equality for comparisons of old parents to parents in the new list. If false, only {@link Parent#isInitiallyExpanded()} will be used to determine expanded state.
[ "Set", "a", "new", "list", "of", "parents", "and", "notify", "any", "registered", "observers", "that", "the", "data", "set", "has", "changed", ".", "<p", ">", "This", "setter", "does", "not", "specify", "what", "about", "the", "data", "set", "has", "chan...
train
https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L370-L374
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/collection/ArrayUtils.java
ArrayUtils.concat
public static <T> void concat(T[] sourceFirst, T[] sourceSecond, T[] dest) { System.arraycopy(sourceFirst, 0, dest, 0, sourceFirst.length); System.arraycopy(sourceSecond, 0, dest, sourceFirst.length, sourceSecond.length); }
java
public static <T> void concat(T[] sourceFirst, T[] sourceSecond, T[] dest) { System.arraycopy(sourceFirst, 0, dest, 0, sourceFirst.length); System.arraycopy(sourceSecond, 0, dest, sourceFirst.length, sourceSecond.length); }
[ "public", "static", "<", "T", ">", "void", "concat", "(", "T", "[", "]", "sourceFirst", ",", "T", "[", "]", "sourceSecond", ",", "T", "[", "]", "dest", ")", "{", "System", ".", "arraycopy", "(", "sourceFirst", ",", "0", ",", "dest", ",", "0", ","...
Copies in order {@code sourceFirst} and {@code sourceSecond} into {@code dest}. @param sourceFirst @param sourceSecond @param dest @param <T>
[ "Copies", "in", "order", "{", "@code", "sourceFirst", "}", "and", "{", "@code", "sourceSecond", "}", "into", "{", "@code", "dest", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/collection/ArrayUtils.java#L172-L175
haraldk/TwelveMonkeys
imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java
QuickDrawContext.eraseRoundRect
public void eraseRoundRect(final Rectangle2D pRectangle, int pArcW, int pArcH) { eraseShape(toRoundRect(pRectangle, pArcW, pArcH)); }
java
public void eraseRoundRect(final Rectangle2D pRectangle, int pArcW, int pArcH) { eraseShape(toRoundRect(pRectangle, pArcW, pArcH)); }
[ "public", "void", "eraseRoundRect", "(", "final", "Rectangle2D", "pRectangle", ",", "int", "pArcW", ",", "int", "pArcH", ")", "{", "eraseShape", "(", "toRoundRect", "(", "pRectangle", ",", "pArcW", ",", "pArcH", ")", ")", ";", "}" ]
EraseRoundRect(r,int,int) // fills the rectangle's interior with the background pattern @param pRectangle the rectangle to erase @param pArcW width of the oval defining the rounded corner. @param pArcH height of the oval defining the rounded corner.
[ "EraseRoundRect", "(", "r", "int", "int", ")", "//", "fills", "the", "rectangle", "s", "interior", "with", "the", "background", "pattern" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java#L631-L633
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ManagedExecutorServiceImpl.java
ManagedExecutorServiceImpl.createCallbacks
@SuppressWarnings("unchecked") private <T> Entry<Collection<? extends Callable<T>>, TaskLifeCycleCallback[]> createCallbacks(Collection<? extends Callable<T>> tasks) { int numTasks = tasks.size(); TaskLifeCycleCallback[] callbacks = new TaskLifeCycleCallback[numTasks]; List<Callable<T>> taskUpdates = null; if (numTasks == 1) { Callable<T> task = tasks.iterator().next(); ThreadContextDescriptor contextDescriptor; if (task instanceof ContextualAction) { ContextualAction<Callable<T>> a = (ContextualAction<Callable<T>>) task; contextDescriptor = a.getContextDescriptor(); task = a.getAction(); taskUpdates = Arrays.asList(task); } else { contextDescriptor = getContextService().captureThreadContext(getExecutionProperties(task)); } callbacks[0] = new TaskLifeCycleCallback(this, contextDescriptor); } else { // Thread context capture is expensive, so reuse callbacks when execution properties match Map<Map<String, String>, TaskLifeCycleCallback> execPropsToCallback = new HashMap<Map<String, String>, TaskLifeCycleCallback>(); WSContextService contextSvc = null; int t = 0; for (Callable<T> task : tasks) { if (task instanceof ContextualAction) { ContextualAction<Callable<T>> a = (ContextualAction<Callable<T>>) task; taskUpdates = taskUpdates == null ? new ArrayList<Callable<T>>(tasks) : taskUpdates; taskUpdates.set(t, a.getAction()); callbacks[t++] = new TaskLifeCycleCallback(this, a.getContextDescriptor()); } else { Map<String, String> execProps = getExecutionProperties(task); TaskLifeCycleCallback callback = execPropsToCallback.get(execProps); if (callback == null) { contextSvc = contextSvc == null ? getContextService() : contextSvc; execPropsToCallback.put(execProps, callback = new TaskLifeCycleCallback(this, contextSvc.captureThreadContext(execProps))); } callbacks[t++] = callback; } } } return new SimpleEntry<Collection<? extends Callable<T>>, TaskLifeCycleCallback[]>(taskUpdates == null ? tasks : taskUpdates, callbacks); }
java
@SuppressWarnings("unchecked") private <T> Entry<Collection<? extends Callable<T>>, TaskLifeCycleCallback[]> createCallbacks(Collection<? extends Callable<T>> tasks) { int numTasks = tasks.size(); TaskLifeCycleCallback[] callbacks = new TaskLifeCycleCallback[numTasks]; List<Callable<T>> taskUpdates = null; if (numTasks == 1) { Callable<T> task = tasks.iterator().next(); ThreadContextDescriptor contextDescriptor; if (task instanceof ContextualAction) { ContextualAction<Callable<T>> a = (ContextualAction<Callable<T>>) task; contextDescriptor = a.getContextDescriptor(); task = a.getAction(); taskUpdates = Arrays.asList(task); } else { contextDescriptor = getContextService().captureThreadContext(getExecutionProperties(task)); } callbacks[0] = new TaskLifeCycleCallback(this, contextDescriptor); } else { // Thread context capture is expensive, so reuse callbacks when execution properties match Map<Map<String, String>, TaskLifeCycleCallback> execPropsToCallback = new HashMap<Map<String, String>, TaskLifeCycleCallback>(); WSContextService contextSvc = null; int t = 0; for (Callable<T> task : tasks) { if (task instanceof ContextualAction) { ContextualAction<Callable<T>> a = (ContextualAction<Callable<T>>) task; taskUpdates = taskUpdates == null ? new ArrayList<Callable<T>>(tasks) : taskUpdates; taskUpdates.set(t, a.getAction()); callbacks[t++] = new TaskLifeCycleCallback(this, a.getContextDescriptor()); } else { Map<String, String> execProps = getExecutionProperties(task); TaskLifeCycleCallback callback = execPropsToCallback.get(execProps); if (callback == null) { contextSvc = contextSvc == null ? getContextService() : contextSvc; execPropsToCallback.put(execProps, callback = new TaskLifeCycleCallback(this, contextSvc.captureThreadContext(execProps))); } callbacks[t++] = callback; } } } return new SimpleEntry<Collection<? extends Callable<T>>, TaskLifeCycleCallback[]>(taskUpdates == null ? tasks : taskUpdates, callbacks); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "<", "T", ">", "Entry", "<", "Collection", "<", "?", "extends", "Callable", "<", "T", ">", ">", ",", "TaskLifeCycleCallback", "[", "]", ">", "createCallbacks", "(", "Collection", "<", "?", "ext...
Capture context for a list of tasks and create callbacks that apply context and notify the ManagedTaskListener, if any. Context is not re-captured for any tasks that implement the ContextualAction marker interface. @param tasks collection of tasks. @return entry consisting of a possibly modified copy of the task list (the key) and the list of callbacks (the value).
[ "Capture", "context", "for", "a", "list", "of", "tasks", "and", "create", "callbacks", "that", "apply", "context", "and", "notify", "the", "ManagedTaskListener", "if", "any", ".", "Context", "is", "not", "re", "-", "captured", "for", "any", "tasks", "that", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent/src/com/ibm/ws/concurrent/internal/ManagedExecutorServiceImpl.java#L276-L320
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/TripleCache.java
TripleCache.forceRun
public synchronized void forceRun() throws MarkLogicSesameException { log.debug(String.valueOf(cache.size())); if( !cache.isEmpty()) { try { flush(); } catch (RepositoryException e) { throw new MarkLogicSesameException("Could not flush write cache, encountered repository issue.",e); } catch (MalformedQueryException e) { throw new MarkLogicSesameException("Could not flush write cache, query was malformed.",e); } catch (UpdateExecutionException e) { throw new MarkLogicSesameException("Could not flush write cache, query update failed.",e); } catch (IOException e) { throw new MarkLogicSesameException("Could not flush write cache, encountered IO issue.",e); } } }
java
public synchronized void forceRun() throws MarkLogicSesameException { log.debug(String.valueOf(cache.size())); if( !cache.isEmpty()) { try { flush(); } catch (RepositoryException e) { throw new MarkLogicSesameException("Could not flush write cache, encountered repository issue.",e); } catch (MalformedQueryException e) { throw new MarkLogicSesameException("Could not flush write cache, query was malformed.",e); } catch (UpdateExecutionException e) { throw new MarkLogicSesameException("Could not flush write cache, query update failed.",e); } catch (IOException e) { throw new MarkLogicSesameException("Could not flush write cache, encountered IO issue.",e); } } }
[ "public", "synchronized", "void", "forceRun", "(", ")", "throws", "MarkLogicSesameException", "{", "log", ".", "debug", "(", "String", ".", "valueOf", "(", "cache", ".", "size", "(", ")", ")", ")", ";", "if", "(", "!", "cache", ".", "isEmpty", "(", ")"...
min forces the cache to flush if there is anything in it @throws MarkLogicSesameException
[ "min", "forces", "the", "cache", "to", "flush", "if", "there", "is", "anything", "in", "it" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/TripleCache.java#L160-L175
kiswanij/jk-util
src/main/java/com/jk/util/JKObjectUtil.java
JKObjectUtil.jsonToObject
public static <T> Object jsonToObject(String json, Class<T> clas) { ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(json, clas); } catch (IOException e) { JK.throww(e); return null; } }
java
public static <T> Object jsonToObject(String json, Class<T> clas) { ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(json, clas); } catch (IOException e) { JK.throww(e); return null; } }
[ "public", "static", "<", "T", ">", "Object", "jsonToObject", "(", "String", "json", ",", "Class", "<", "T", ">", "clas", ")", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "try", "{", "return", "mapper", ".", "readValue", "(...
Json to object. @param <T> the generic type @param json the json @param clas the clas @return the object
[ "Json", "to", "object", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKObjectUtil.java#L690-L698
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/lang/gosuc/cli/CommandLineCompiler.java
CommandLineCompiler.summarize
private static boolean summarize( List<String> warnings, List<String> errors, boolean isNoWarn ) { if( isNoWarn ) { System.out.printf( "\ngosuc completed with %d errors. Warnings were disabled.\n", errors.size() ); } else { System.out.printf( "\ngosuc completed with %d warnings and %d errors.\n", warnings.size(), errors.size() ); } return errors.size() > 0; }
java
private static boolean summarize( List<String> warnings, List<String> errors, boolean isNoWarn ) { if( isNoWarn ) { System.out.printf( "\ngosuc completed with %d errors. Warnings were disabled.\n", errors.size() ); } else { System.out.printf( "\ngosuc completed with %d warnings and %d errors.\n", warnings.size(), errors.size() ); } return errors.size() > 0; }
[ "private", "static", "boolean", "summarize", "(", "List", "<", "String", ">", "warnings", ",", "List", "<", "String", ">", "errors", ",", "boolean", "isNoWarn", ")", "{", "if", "(", "isNoWarn", ")", "{", "System", ".", "out", ".", "printf", "(", "\"\\n...
@param warnings List of warnings @param errors List of errors @param isNoWarn true if warnings are disabled @return true if compilation resulted in errors, false otherwise
[ "@param", "warnings", "List", "of", "warnings", "@param", "errors", "List", "of", "errors", "@param", "isNoWarn", "true", "if", "warnings", "are", "disabled" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/gosuc/cli/CommandLineCompiler.java#L95-L107
tomgibara/bits
src/main/java/com/tomgibara/bits/LongBitStore.java
LongBitStore.readBits
static long readBits(ReadStream reader, int count) { long bits = 0L; for (int i = (count - 1) >> 3; i >= 0; i --) { bits <<= 8; bits |= reader.readByte() & 0xff; } return bits; }
java
static long readBits(ReadStream reader, int count) { long bits = 0L; for (int i = (count - 1) >> 3; i >= 0; i --) { bits <<= 8; bits |= reader.readByte() & 0xff; } return bits; }
[ "static", "long", "readBits", "(", "ReadStream", "reader", ",", "int", "count", ")", "{", "long", "bits", "=", "0L", ";", "for", "(", "int", "i", "=", "(", "count", "-", "1", ")", ">>", "3", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "bit...
not does not mask off the returned long - that is responsibility of caller
[ "not", "does", "not", "mask", "off", "the", "returned", "long", "-", "that", "is", "responsibility", "of", "caller" ]
train
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/LongBitStore.java#L65-L72
fuzzylite/jfuzzylite
jfuzzylite/src/main/java/com/fuzzylite/factory/DefuzzifierFactory.java
DefuzzifierFactory.constructDefuzzifier
public Defuzzifier constructDefuzzifier(String key, int resolution) { Defuzzifier result = constructObject(key); if (result instanceof IntegralDefuzzifier) { ((IntegralDefuzzifier) result).setResolution(resolution); } return result; }
java
public Defuzzifier constructDefuzzifier(String key, int resolution) { Defuzzifier result = constructObject(key); if (result instanceof IntegralDefuzzifier) { ((IntegralDefuzzifier) result).setResolution(resolution); } return result; }
[ "public", "Defuzzifier", "constructDefuzzifier", "(", "String", "key", ",", "int", "resolution", ")", "{", "Defuzzifier", "result", "=", "constructObject", "(", "key", ")", ";", "if", "(", "result", "instanceof", "IntegralDefuzzifier", ")", "{", "(", "(", "Int...
Creates a Defuzzifier by executing the registered constructor @param key is the unique name by which constructors are registered @param resolution is the resolution of an IntegralDefuzzifier @return a Defuzzifier by executing the registered constructor and setting its resolution
[ "Creates", "a", "Defuzzifier", "by", "executing", "the", "registered", "constructor" ]
train
https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/factory/DefuzzifierFactory.java#L81-L87
jenkinsci/jenkins
core/src/main/java/hudson/model/DependencyGraph.java
DependencyGraph.putComputationalData
public <T> void putComputationalData(Class<T> key, T value) { this.computationalData.put(key, value); }
java
public <T> void putComputationalData(Class<T> key, T value) { this.computationalData.put(key, value); }
[ "public", "<", "T", ">", "void", "putComputationalData", "(", "Class", "<", "T", ">", "key", ",", "T", "value", ")", "{", "this", ".", "computationalData", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Adds data which is useful for the time when the dependency graph is built up. All this data will be cleaned once the dependency graph creation has finished.
[ "Adds", "data", "which", "is", "useful", "for", "the", "time", "when", "the", "dependency", "graph", "is", "built", "up", ".", "All", "this", "data", "will", "be", "cleaned", "once", "the", "dependency", "graph", "creation", "has", "finished", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/DependencyGraph.java#L163-L165
antopen/alipay-sdk-java
src/main/java/com/alipay/api/internal/util/XmlUtils.java
XmlUtils.appendElement
public static Element appendElement(Element parent, String tagName) { Element child = parent.getOwnerDocument().createElement(tagName); parent.appendChild(child); return child; }
java
public static Element appendElement(Element parent, String tagName) { Element child = parent.getOwnerDocument().createElement(tagName); parent.appendChild(child); return child; }
[ "public", "static", "Element", "appendElement", "(", "Element", "parent", ",", "String", "tagName", ")", "{", "Element", "child", "=", "parent", ".", "getOwnerDocument", "(", ")", ".", "createElement", "(", "tagName", ")", ";", "parent", ".", "appendChild", ...
Appends the child element to the parent element. @param parent the parent element @param tagName the child element name @return the child element added to the parent element
[ "Appends", "the", "child", "element", "to", "the", "parent", "element", "." ]
train
https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L349-L353
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.fromTupleDataSet
public static <K, VV, EV> Graph<K, VV, EV> fromTupleDataSet(DataSet<Tuple2<K, VV>> vertices, DataSet<Tuple3<K, K, EV>> edges, ExecutionEnvironment context) { DataSet<Vertex<K, VV>> vertexDataSet = vertices .map(new Tuple2ToVertexMap<>()) .name("Type conversion"); DataSet<Edge<K, EV>> edgeDataSet = edges .map(new Tuple3ToEdgeMap<>()) .name("Type conversion"); return fromDataSet(vertexDataSet, edgeDataSet, context); }
java
public static <K, VV, EV> Graph<K, VV, EV> fromTupleDataSet(DataSet<Tuple2<K, VV>> vertices, DataSet<Tuple3<K, K, EV>> edges, ExecutionEnvironment context) { DataSet<Vertex<K, VV>> vertexDataSet = vertices .map(new Tuple2ToVertexMap<>()) .name("Type conversion"); DataSet<Edge<K, EV>> edgeDataSet = edges .map(new Tuple3ToEdgeMap<>()) .name("Type conversion"); return fromDataSet(vertexDataSet, edgeDataSet, context); }
[ "public", "static", "<", "K", ",", "VV", ",", "EV", ">", "Graph", "<", "K", ",", "VV", ",", "EV", ">", "fromTupleDataSet", "(", "DataSet", "<", "Tuple2", "<", "K", ",", "VV", ">", ">", "vertices", ",", "DataSet", "<", "Tuple3", "<", "K", ",", "...
Creates a graph from a DataSet of Tuple2 objects for vertices and Tuple3 objects for edges. <p>The first field of the Tuple2 vertex object will become the vertex ID and the second field will become the vertex value. The first field of the Tuple3 object for edges will become the source ID, the second field will become the target ID, and the third field will become the edge value. @param vertices a DataSet of Tuple2 representing the vertices. @param edges a DataSet of Tuple3 representing the edges. @param context the flink execution environment. @return the newly created graph.
[ "Creates", "a", "graph", "from", "a", "DataSet", "of", "Tuple2", "objects", "for", "vertices", "and", "Tuple3", "objects", "for", "edges", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L268-L280
Activiti/Activiti
activiti-process-validation/src/main/java/org/activiti/validation/validator/impl/BpmnModelValidator.java
BpmnModelValidator.validateAtLeastOneExecutable
protected boolean validateAtLeastOneExecutable(BpmnModel bpmnModel, List<ValidationError> errors) { int nrOfExecutableDefinitions = 0; for (Process process : bpmnModel.getProcesses()) { if (process.isExecutable()) { nrOfExecutableDefinitions++; } } if (nrOfExecutableDefinitions == 0) { addError(errors, Problems.ALL_PROCESS_DEFINITIONS_NOT_EXECUTABLE, "All process definition are set to be non-executable (property 'isExecutable' on process). This is not allowed."); } return nrOfExecutableDefinitions > 0; }
java
protected boolean validateAtLeastOneExecutable(BpmnModel bpmnModel, List<ValidationError> errors) { int nrOfExecutableDefinitions = 0; for (Process process : bpmnModel.getProcesses()) { if (process.isExecutable()) { nrOfExecutableDefinitions++; } } if (nrOfExecutableDefinitions == 0) { addError(errors, Problems.ALL_PROCESS_DEFINITIONS_NOT_EXECUTABLE, "All process definition are set to be non-executable (property 'isExecutable' on process). This is not allowed."); } return nrOfExecutableDefinitions > 0; }
[ "protected", "boolean", "validateAtLeastOneExecutable", "(", "BpmnModel", "bpmnModel", ",", "List", "<", "ValidationError", ">", "errors", ")", "{", "int", "nrOfExecutableDefinitions", "=", "0", ";", "for", "(", "Process", "process", ":", "bpmnModel", ".", "getPro...
Returns 'true' if at least one process definition in the {@link BpmnModel} is executable.
[ "Returns", "true", "if", "at", "least", "one", "process", "definition", "in", "the", "{" ]
train
https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-process-validation/src/main/java/org/activiti/validation/validator/impl/BpmnModelValidator.java#L74-L88
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/IO.java
IO.runWithFile
public static <X> X runWithFile(InputStream stream, Function<File, X> function) throws IOException { File f = File.createTempFile("run-with-file", null); try { try (FileOutputStream out = new FileOutputStream(f)) { IOUtils.copy(stream, out); } return function.apply(f); } finally { f.delete(); } }
java
public static <X> X runWithFile(InputStream stream, Function<File, X> function) throws IOException { File f = File.createTempFile("run-with-file", null); try { try (FileOutputStream out = new FileOutputStream(f)) { IOUtils.copy(stream, out); } return function.apply(f); } finally { f.delete(); } }
[ "public", "static", "<", "X", ">", "X", "runWithFile", "(", "InputStream", "stream", ",", "Function", "<", "File", ",", "X", ">", "function", ")", "throws", "IOException", "{", "File", "f", "=", "File", ".", "createTempFile", "(", "\"run-with-file\"", ",",...
Copy the data from the given {@link InputStream} to a temporary file and call the given {@link Function} with it; after the function returns the file is deleted.
[ "Copy", "the", "data", "from", "the", "given", "{" ]
train
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/IO.java#L117-L127
windup/windup
reporting/api/src/main/java/org/jboss/windup/reporting/service/TechnologyTagService.java
TechnologyTagService.removeTagFromFileModel
public void removeTagFromFileModel(FileModel fileModel, String tagName) { Traversable<Vertex, Vertex> q = getGraphContext().getQuery(TechnologyTagModel.class) .traverse(g -> g.has(TechnologyTagModel.NAME, tagName)); TechnologyTagModel technologyTag = super.getUnique(q.getRawTraversal()); if (technologyTag != null) technologyTag.removeFileModel(fileModel); }
java
public void removeTagFromFileModel(FileModel fileModel, String tagName) { Traversable<Vertex, Vertex> q = getGraphContext().getQuery(TechnologyTagModel.class) .traverse(g -> g.has(TechnologyTagModel.NAME, tagName)); TechnologyTagModel technologyTag = super.getUnique(q.getRawTraversal()); if (technologyTag != null) technologyTag.removeFileModel(fileModel); }
[ "public", "void", "removeTagFromFileModel", "(", "FileModel", "fileModel", ",", "String", "tagName", ")", "{", "Traversable", "<", "Vertex", ",", "Vertex", ">", "q", "=", "getGraphContext", "(", ")", ".", "getQuery", "(", "TechnologyTagModel", ".", "class", ")...
Removes the provided tag from the provided {@link FileModel}. If a {@link TechnologyTagModel} cannot be found with the provided name, then this operation will do nothing.
[ "Removes", "the", "provided", "tag", "from", "the", "provided", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/TechnologyTagService.java#L66-L74
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.visitPreOrder
public static void visitPreOrder(Node node, Visitor visitor) { visitPreOrder(node, visitor, Predicates.alwaysTrue()); }
java
public static void visitPreOrder(Node node, Visitor visitor) { visitPreOrder(node, visitor, Predicates.alwaysTrue()); }
[ "public", "static", "void", "visitPreOrder", "(", "Node", "node", ",", "Visitor", "visitor", ")", "{", "visitPreOrder", "(", "node", ",", "visitor", ",", "Predicates", ".", "alwaysTrue", "(", ")", ")", ";", "}" ]
A pre-order traversal, calling Visitor.visit for each decendent.
[ "A", "pre", "-", "order", "traversal", "calling", "Visitor", ".", "visit", "for", "each", "decendent", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L4720-L4722
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java
ClassNameRewriterUtil.convertMethodAnnotation
public static MethodAnnotation convertMethodAnnotation(ClassNameRewriter classNameRewriter, MethodAnnotation annotation) { if (classNameRewriter != IdentityClassNameRewriter.instance()) { annotation = new MethodAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()), annotation.getMethodName(), rewriteMethodSignature(classNameRewriter, annotation.getMethodSignature()), annotation.isStatic()); } return annotation; }
java
public static MethodAnnotation convertMethodAnnotation(ClassNameRewriter classNameRewriter, MethodAnnotation annotation) { if (classNameRewriter != IdentityClassNameRewriter.instance()) { annotation = new MethodAnnotation(classNameRewriter.rewriteClassName(annotation.getClassName()), annotation.getMethodName(), rewriteMethodSignature(classNameRewriter, annotation.getMethodSignature()), annotation.isStatic()); } return annotation; }
[ "public", "static", "MethodAnnotation", "convertMethodAnnotation", "(", "ClassNameRewriter", "classNameRewriter", ",", "MethodAnnotation", "annotation", ")", "{", "if", "(", "classNameRewriter", "!=", "IdentityClassNameRewriter", ".", "instance", "(", ")", ")", "{", "an...
Rewrite a MethodAnnotation to update the class name, and any class names mentioned in the method signature. @param classNameRewriter a ClassNameRewriter @param annotation a MethodAnnotation @return the possibly-rewritten MethodAnnotation
[ "Rewrite", "a", "MethodAnnotation", "to", "update", "the", "class", "name", "and", "any", "class", "names", "mentioned", "in", "the", "method", "signature", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/model/ClassNameRewriterUtil.java#L95-L103
netceteragroup/valdr-bean-validation
valdr-bean-validation/src/main/java/com/github/valdr/thirdparty/spring/AnnotationUtils.java
AnnotationUtils.getAnnotationAttributes
public static Map<String, Object> getAnnotationAttributes(Annotation annotation, boolean classValuesAsString) { return getAnnotationAttributes(annotation, classValuesAsString, false); }
java
public static Map<String, Object> getAnnotationAttributes(Annotation annotation, boolean classValuesAsString) { return getAnnotationAttributes(annotation, classValuesAsString, false); }
[ "public", "static", "Map", "<", "String", ",", "Object", ">", "getAnnotationAttributes", "(", "Annotation", "annotation", ",", "boolean", "classValuesAsString", ")", "{", "return", "getAnnotationAttributes", "(", "annotation", ",", "classValuesAsString", ",", "false",...
Retrieve the given annotation's attributes as a Map. Equivalent to calling {@link #getAnnotationAttributes(java.lang.annotation.Annotation, boolean, boolean)} with the {@code nestedAnnotationsAsMap} parameter set to {@code false}. <p>Note: As of Spring 3.1.1, the returned map is actually an {@code org.springframework.core.annotation.AnnotationAttributes} instance, however the Map signature of this methodhas been preserved for binary compatibility. @param annotation the annotation to retrieve the attributes for @param classValuesAsString whether to turn Class references into Strings (for compatibility with {@code org.springframework.core.type.AnnotationMetadata} or to preserve them as Class references @return the Map of annotation attributes, with attribute names as keys and corresponding attribute values as values
[ "Retrieve", "the", "given", "annotation", "s", "attributes", "as", "a", "Map", ".", "Equivalent", "to", "calling", "{" ]
train
https://github.com/netceteragroup/valdr-bean-validation/blob/3f49f1357c575a11331be2de867cf47809a83823/valdr-bean-validation/src/main/java/com/github/valdr/thirdparty/spring/AnnotationUtils.java#L337-L339
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VFSUtils.java
VFSUtils.writeFile
public static void writeFile(VirtualFile virtualFile, InputStream is) throws IOException { final File file = virtualFile.getPhysicalFile(); file.getParentFile().mkdirs(); final FileOutputStream fos = new FileOutputStream(file); copyStreamAndClose(is, fos); }
java
public static void writeFile(VirtualFile virtualFile, InputStream is) throws IOException { final File file = virtualFile.getPhysicalFile(); file.getParentFile().mkdirs(); final FileOutputStream fos = new FileOutputStream(file); copyStreamAndClose(is, fos); }
[ "public", "static", "void", "writeFile", "(", "VirtualFile", "virtualFile", ",", "InputStream", "is", ")", "throws", "IOException", "{", "final", "File", "file", "=", "virtualFile", ".", "getPhysicalFile", "(", ")", ";", "file", ".", "getParentFile", "(", ")",...
Write the content from the given {@link InputStream} to the given virtual file, replacing its current contents (if any) or creating a new file if one does not exist. @param virtualFile the virtual file to write @param is the input stream @throws IOException if an error occurs
[ "Write", "the", "content", "from", "the", "given", "{", "@link", "InputStream", "}", "to", "the", "given", "virtual", "file", "replacing", "its", "current", "contents", "(", "if", "any", ")", "or", "creating", "a", "new", "file", "if", "one", "does", "no...
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L471-L476
tvesalainen/lpg
src/main/java/org/vesalainen/grammar/Grammar.java
Grammar.addRule
public void addRule(ExecutableElement reducer, String nonterminal, String document, boolean synthetic, List<String> rhs) { Grammar.R rule = new Grammar.R(nonterminal, rhs, reducer, document, synthetic); if (!ruleSet.contains(rule)) { rule.number = ruleNumber++; ruleSet.add(rule); lhsMap.add(nonterminal, rule); if (!nonterminalMap.containsKey(nonterminal)) { Grammar.NT nt = new Grammar.NT(nonterminal); nonterminalMap.put(nonterminal, nt); symbolMap.put(nonterminal, nt); numberMap.put(nt.number, nt); } for (String s : rhs) { if (isAnonymousTerminal(s)) { String expression = s.substring(1, s.length()-1); addAnonymousTerminal(expression); } } } }
java
public void addRule(ExecutableElement reducer, String nonterminal, String document, boolean synthetic, List<String> rhs) { Grammar.R rule = new Grammar.R(nonterminal, rhs, reducer, document, synthetic); if (!ruleSet.contains(rule)) { rule.number = ruleNumber++; ruleSet.add(rule); lhsMap.add(nonterminal, rule); if (!nonterminalMap.containsKey(nonterminal)) { Grammar.NT nt = new Grammar.NT(nonterminal); nonterminalMap.put(nonterminal, nt); symbolMap.put(nonterminal, nt); numberMap.put(nt.number, nt); } for (String s : rhs) { if (isAnonymousTerminal(s)) { String expression = s.substring(1, s.length()-1); addAnonymousTerminal(expression); } } } }
[ "public", "void", "addRule", "(", "ExecutableElement", "reducer", ",", "String", "nonterminal", ",", "String", "document", ",", "boolean", "synthetic", ",", "List", "<", "String", ">", "rhs", ")", "{", "Grammar", ".", "R", "rule", "=", "new", "Grammar", "....
Adds new rule if the same rule doesn't exist already. @param reducer Reducer method. @param nonterminal Left hand side of the rule. @param rhs Strings which are either nonterminal names, terminal names or anonymous terminals. Anonymous terminals are regular expressions inside apostrophes. E.g '[0-9]+'
[ "Adds", "new", "rule", "if", "the", "same", "rule", "doesn", "t", "exist", "already", "." ]
train
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/Grammar.java#L295-L319
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Assert.java
Assert.checkNull
public static void checkNull(Object o, Supplier<String> msg) { if (o != null) error(msg.get()); }
java
public static void checkNull(Object o, Supplier<String> msg) { if (o != null) error(msg.get()); }
[ "public", "static", "void", "checkNull", "(", "Object", "o", ",", "Supplier", "<", "String", ">", "msg", ")", "{", "if", "(", "o", "!=", "null", ")", "error", "(", "msg", ".", "get", "(", ")", ")", ";", "}" ]
Equivalent to assert (o == null) : msg.get(); Note: message string is computed lazily.
[ "Equivalent", "to", "assert", "(", "o", "==", "null", ")", ":", "msg", ".", "get", "()", ";", "Note", ":", "message", "string", "is", "computed", "lazily", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Assert.java#L127-L130
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java
AndroidUtil.createTileCache
public static TileCache createTileCache(Context c, String id, int tileSize, int width, int height, double overdraw, boolean persistent) { int cacheSize = getMinimumCacheSize(tileSize, overdraw, width, height); return createExternalStorageTileCache(c, id, cacheSize, tileSize, persistent); }
java
public static TileCache createTileCache(Context c, String id, int tileSize, int width, int height, double overdraw, boolean persistent) { int cacheSize = getMinimumCacheSize(tileSize, overdraw, width, height); return createExternalStorageTileCache(c, id, cacheSize, tileSize, persistent); }
[ "public", "static", "TileCache", "createTileCache", "(", "Context", "c", ",", "String", "id", ",", "int", "tileSize", ",", "int", "width", ",", "int", "height", ",", "double", "overdraw", ",", "boolean", "persistent", ")", "{", "int", "cacheSize", "=", "ge...
Utility function to create a two-level tile cache with the right size, using the size of the map view. @param c the Android context @param id name for the storage directory @param tileSize tile size @param width the width of the map view @param height the height of the map view @param overdraw overdraw allowance @param persistent whether the cache should be persistent @return a new cache created on the external storage
[ "Utility", "function", "to", "create", "a", "two", "-", "level", "tile", "cache", "with", "the", "right", "size", "using", "the", "size", "of", "the", "map", "view", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L204-L208
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/batikutil/CloneInlineImages.java
CloneInlineImages.inlineThumbnail
protected Node inlineThumbnail(Document doc, ParsedURL urldata, Node eold) { RenderableImage img = ThumbnailRegistryEntry.handleURL(urldata); if(img == null) { LoggingUtil.warning("Image not found in registry: " + urldata.toString()); return null; } ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); Base64EncoderStream encoder = new Base64EncoderStream(os); ImageIO.write(img.createDefaultRendering(), "png", encoder); encoder.close(); } catch(IOException e) { LoggingUtil.exception("Exception serializing image to png", e); return null; } Element i = (Element) super.cloneNode(doc, eold); i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE, os.toString().replaceAll("\\s*[\\r\\n]+\\s*", "")); return i; }
java
protected Node inlineThumbnail(Document doc, ParsedURL urldata, Node eold) { RenderableImage img = ThumbnailRegistryEntry.handleURL(urldata); if(img == null) { LoggingUtil.warning("Image not found in registry: " + urldata.toString()); return null; } ByteArrayOutputStream os = new ByteArrayOutputStream(); try { os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); Base64EncoderStream encoder = new Base64EncoderStream(os); ImageIO.write(img.createDefaultRendering(), "png", encoder); encoder.close(); } catch(IOException e) { LoggingUtil.exception("Exception serializing image to png", e); return null; } Element i = (Element) super.cloneNode(doc, eold); i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE, os.toString().replaceAll("\\s*[\\r\\n]+\\s*", "")); return i; }
[ "protected", "Node", "inlineThumbnail", "(", "Document", "doc", ",", "ParsedURL", "urldata", ",", "Node", "eold", ")", "{", "RenderableImage", "img", "=", "ThumbnailRegistryEntry", ".", "handleURL", "(", "urldata", ")", ";", "if", "(", "img", "==", "null", "...
Inline a referenced thumbnail. @param doc Document (element factory) @param urldata URL @param eold Existing node @return Replacement node, or {@code null}
[ "Inline", "a", "referenced", "thumbnail", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/batikutil/CloneInlineImages.java#L81-L101
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/rules/patterns/CaseConversionHelper.java
CaseConversionHelper.convertCase
public static String convertCase(Match.CaseConversion conversion, String s, String sample, Language lang) { if (StringTools.isEmpty(s)) { return s; } String token = s; switch (conversion) { case NONE: break; case PRESERVE: if (StringTools.startsWithUppercase(sample)) { if (StringTools.isAllUppercase(sample)) { token = token.toUpperCase(Locale.ENGLISH); } else { token = StringTools.uppercaseFirstChar(token, lang); } } break; case STARTLOWER: token = token.substring(0, 1).toLowerCase() + token.substring(1); break; case STARTUPPER: token = StringTools.uppercaseFirstChar(token, lang); break; case ALLUPPER: token = token.toUpperCase(Locale.ENGLISH); break; case ALLLOWER: token = token.toLowerCase(); break; default: break; } return token; }
java
public static String convertCase(Match.CaseConversion conversion, String s, String sample, Language lang) { if (StringTools.isEmpty(s)) { return s; } String token = s; switch (conversion) { case NONE: break; case PRESERVE: if (StringTools.startsWithUppercase(sample)) { if (StringTools.isAllUppercase(sample)) { token = token.toUpperCase(Locale.ENGLISH); } else { token = StringTools.uppercaseFirstChar(token, lang); } } break; case STARTLOWER: token = token.substring(0, 1).toLowerCase() + token.substring(1); break; case STARTUPPER: token = StringTools.uppercaseFirstChar(token, lang); break; case ALLUPPER: token = token.toUpperCase(Locale.ENGLISH); break; case ALLLOWER: token = token.toLowerCase(); break; default: break; } return token; }
[ "public", "static", "String", "convertCase", "(", "Match", ".", "CaseConversion", "conversion", ",", "String", "s", ",", "String", "sample", ",", "Language", "lang", ")", "{", "if", "(", "StringTools", ".", "isEmpty", "(", "s", ")", ")", "{", "return", "...
Converts case of the string token according to match element attributes. @param s Token to be converted. @param sample the sample string used to determine how the original string looks like (used only on case preservation) @return Converted string.
[ "Converts", "case", "of", "the", "string", "token", "according", "to", "match", "element", "attributes", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/patterns/CaseConversionHelper.java#L40-L73
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java
MarkLogicClient.sendAdd
public void sendAdd(File file, String baseURI, RDFFormat dataFormat, Resource... contexts) throws RDFParseException { getClient().performAdd(file, baseURI, dataFormat, this.tx, contexts); }
java
public void sendAdd(File file, String baseURI, RDFFormat dataFormat, Resource... contexts) throws RDFParseException { getClient().performAdd(file, baseURI, dataFormat, this.tx, contexts); }
[ "public", "void", "sendAdd", "(", "File", "file", ",", "String", "baseURI", ",", "RDFFormat", "dataFormat", ",", "Resource", "...", "contexts", ")", "throws", "RDFParseException", "{", "getClient", "(", ")", ".", "performAdd", "(", "file", ",", "baseURI", ",...
add triples from file @param file @param baseURI @param dataFormat @param contexts @throws RDFParseException
[ "add", "triples", "from", "file" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/client/MarkLogicClient.java#L302-L304
stephenc/java-iso-tools
iso9660-writer/src/main/java/com/github/stephenc/javaisotools/iso9660/impl/ISO9660Config.java
ISO9660Config.setInterchangeLevel
public void setInterchangeLevel(int level) throws ConfigException { if (level < 1 || level > 3) { throw new ConfigException(this, "Invalid ISO9660 Interchange Level: " + level); } if (level == 3) { throw new ConfigException(this, "Interchange Level 3 (multiple File Sections per file) is not (yet) supported by this implementation."); } ISO9660NamingConventions.INTERCHANGE_LEVEL = level; }
java
public void setInterchangeLevel(int level) throws ConfigException { if (level < 1 || level > 3) { throw new ConfigException(this, "Invalid ISO9660 Interchange Level: " + level); } if (level == 3) { throw new ConfigException(this, "Interchange Level 3 (multiple File Sections per file) is not (yet) supported by this implementation."); } ISO9660NamingConventions.INTERCHANGE_LEVEL = level; }
[ "public", "void", "setInterchangeLevel", "(", "int", "level", ")", "throws", "ConfigException", "{", "if", "(", "level", "<", "1", "||", "level", ">", "3", ")", "{", "throw", "new", "ConfigException", "(", "this", ",", "\"Invalid ISO9660 Interchange Level: \"", ...
Set Interchange Level<br> 1: Filenames 8+3, directories 8 characters<br> 2: Filenames 30, directories 31 characters<br> 3: multiple File Sections (files > 2 GB) @param level 1, 2 or 3 @throws com.github.stephenc.javaisotools.iso9660.ConfigException Invalid or unsupported Interchange Level
[ "Set", "Interchange", "Level<br", ">", "1", ":", "Filenames", "8", "+", "3", "directories", "8", "characters<br", ">", "2", ":", "Filenames", "30", "directories", "31", "characters<br", ">", "3", ":", "multiple", "File", "Sections", "(", "files", ">", "2",...
train
https://github.com/stephenc/java-iso-tools/blob/828c50b02eb311a14dde0dab43462a0d0c9dfb06/iso9660-writer/src/main/java/com/github/stephenc/javaisotools/iso9660/impl/ISO9660Config.java#L45-L54
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeTreePersistentState.java
InodeTreePersistentState.applyAndJournal
public void applyAndJournal(Supplier<JournalContext> context, UpdateInodeEntry entry) { try { applyUpdateInode(entry); context.get().append(JournalEntry.newBuilder().setUpdateInode(entry).build()); } catch (Throwable t) { ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry); throw t; // fatalError will usually system.exit } }
java
public void applyAndJournal(Supplier<JournalContext> context, UpdateInodeEntry entry) { try { applyUpdateInode(entry); context.get().append(JournalEntry.newBuilder().setUpdateInode(entry).build()); } catch (Throwable t) { ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry); throw t; // fatalError will usually system.exit } }
[ "public", "void", "applyAndJournal", "(", "Supplier", "<", "JournalContext", ">", "context", ",", "UpdateInodeEntry", "entry", ")", "{", "try", "{", "applyUpdateInode", "(", "entry", ")", ";", "context", ".", "get", "(", ")", ".", "append", "(", "JournalEntr...
Updates an inode's state. This is used for state common to both files and directories. @param context journal context supplier @param entry update inode entry
[ "Updates", "an", "inode", "s", "state", ".", "This", "is", "used", "for", "state", "common", "to", "both", "files", "and", "directories", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeTreePersistentState.java#L234-L242
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFormulaConfig.java
CollisionFormulaConfig.exports
public static void exports(Xml root, CollisionFormula formula) { Check.notNull(root); Check.notNull(formula); final Xml node = root.createChild(NODE_FORMULA); node.writeString(ATT_NAME, formula.getName()); CollisionRangeConfig.exports(node, formula.getRange()); CollisionFunctionConfig.exports(node, formula.getFunction()); CollisionConstraintConfig.exports(node, formula.getConstraint()); }
java
public static void exports(Xml root, CollisionFormula formula) { Check.notNull(root); Check.notNull(formula); final Xml node = root.createChild(NODE_FORMULA); node.writeString(ATT_NAME, formula.getName()); CollisionRangeConfig.exports(node, formula.getRange()); CollisionFunctionConfig.exports(node, formula.getFunction()); CollisionConstraintConfig.exports(node, formula.getConstraint()); }
[ "public", "static", "void", "exports", "(", "Xml", "root", ",", "CollisionFormula", "formula", ")", "{", "Check", ".", "notNull", "(", "root", ")", ";", "Check", ".", "notNull", "(", "formula", ")", ";", "final", "Xml", "node", "=", "root", ".", "creat...
Export the current formula data to the formula node. @param root The root node (must not be <code>null</code>). @param formula The formula reference (must not be <code>null</code>). @throws LionEngineException If error on writing.
[ "Export", "the", "current", "formula", "data", "to", "the", "formula", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFormulaConfig.java#L78-L89
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/clustering/criterion/BaseFunction.java
BaseFunction.subtract
protected static DoubleVector subtract(DoubleVector c, DoubleVector v) { DoubleVector newCentroid = new DenseDynamicMagnitudeVector(c.length()); // Special case sparse double vectors so that we don't incure a possibly // log n get operation for each zero value, as that's the common case // for CompactSparseVector. if (v instanceof SparseDoubleVector) { SparseDoubleVector sv = (SparseDoubleVector) v; int[] nonZeros = sv.getNonZeroIndices(); int sparseIndex = 0; for (int i = 0; i < c.length(); ++i) { double value = c.get(i); if (sparseIndex < nonZeros.length && i == nonZeros[sparseIndex]) value -= sv.get(nonZeros[sparseIndex++]); newCentroid.set(i, value); } } else for (int i = 0; i < c.length(); ++i) newCentroid.set(i, c.get(i) - v.get(i)); return newCentroid; }
java
protected static DoubleVector subtract(DoubleVector c, DoubleVector v) { DoubleVector newCentroid = new DenseDynamicMagnitudeVector(c.length()); // Special case sparse double vectors so that we don't incure a possibly // log n get operation for each zero value, as that's the common case // for CompactSparseVector. if (v instanceof SparseDoubleVector) { SparseDoubleVector sv = (SparseDoubleVector) v; int[] nonZeros = sv.getNonZeroIndices(); int sparseIndex = 0; for (int i = 0; i < c.length(); ++i) { double value = c.get(i); if (sparseIndex < nonZeros.length && i == nonZeros[sparseIndex]) value -= sv.get(nonZeros[sparseIndex++]); newCentroid.set(i, value); } } else for (int i = 0; i < c.length(); ++i) newCentroid.set(i, c.get(i) - v.get(i)); return newCentroid; }
[ "protected", "static", "DoubleVector", "subtract", "(", "DoubleVector", "c", ",", "DoubleVector", "v", ")", "{", "DoubleVector", "newCentroid", "=", "new", "DenseDynamicMagnitudeVector", "(", "c", ".", "length", "(", ")", ")", ";", "// Special case sparse double vec...
Returns a {@link DoubleVector} that is equal to {@code c - v}. This method is used instead of the one in {@link VectorMath} so that a {@link DenseDynamicMagnitudeVector} can be used to represent the difference. This vector type is optimized for when many calls to magnitude are interleaved with updates to a few dimensions in the vector.
[ "Returns", "a", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/clustering/criterion/BaseFunction.java#L291-L313
bazaarvoice/emodb
event/src/main/java/com/bazaarvoice/emodb/sortedq/core/PersistentSortedQueue.java
PersistentSortedQueue.moveRecords
private void moveRecords(Segment seg, ByteBuffer max, boolean deleteFromSource) { checkWritesAllowed(); ByteBuffer from = seg.getMin(); ByteBuffer toExclusive = successor(max); int batchSize = scanBatchSize(); Iterator<List<ByteBuffer>> batchIter = Iterators.partition( _dao.scanRecords(seg.getDataId(), from, toExclusive, batchSize, Integer.MAX_VALUE), batchSize); while (batchIter.hasNext()) { List<ByteBuffer> records = batchIter.next(); // Write to the destination. Go through addAll() to update stats, do splitting, etc. addAll(records); // Delete individual records from the source. if (deleteFromSource) { _dao.prepareUpdate(_name).deleteRecords(seg.getDataId(), records).execute(); } } seg.setMin(toExclusive); }
java
private void moveRecords(Segment seg, ByteBuffer max, boolean deleteFromSource) { checkWritesAllowed(); ByteBuffer from = seg.getMin(); ByteBuffer toExclusive = successor(max); int batchSize = scanBatchSize(); Iterator<List<ByteBuffer>> batchIter = Iterators.partition( _dao.scanRecords(seg.getDataId(), from, toExclusive, batchSize, Integer.MAX_VALUE), batchSize); while (batchIter.hasNext()) { List<ByteBuffer> records = batchIter.next(); // Write to the destination. Go through addAll() to update stats, do splitting, etc. addAll(records); // Delete individual records from the source. if (deleteFromSource) { _dao.prepareUpdate(_name).deleteRecords(seg.getDataId(), records).execute(); } } seg.setMin(toExclusive); }
[ "private", "void", "moveRecords", "(", "Segment", "seg", ",", "ByteBuffer", "max", ",", "boolean", "deleteFromSource", ")", "{", "checkWritesAllowed", "(", ")", ";", "ByteBuffer", "from", "=", "seg", ".", "getMin", "(", ")", ";", "ByteBuffer", "toExclusive", ...
Move/copy segment records from a segment that isn't in segmentMap to the segments that are.
[ "Move", "/", "copy", "segment", "records", "from", "a", "segment", "that", "isn", "t", "in", "segmentMap", "to", "the", "segments", "that", "are", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/event/src/main/java/com/bazaarvoice/emodb/sortedq/core/PersistentSortedQueue.java#L588-L610
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getSpecializationInfo
public void getSpecializationInfo(int[] ids, Callback<List<Specialization>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getSpecializationInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getSpecializationInfo(int[] ids, Callback<List<Specialization>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getSpecializationInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getSpecializationInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "Specialization", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", ...
For more info on specializations API go <a href="https://wiki.guildwars2.com/wiki/API:2/specializations">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of specialization id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see Specialization specialization info
[ "For", "more", "info", "on", "specializations", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "specializations", ">", "here<", "/", "a", ">", "<br", "/", ">", "Giv...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2408-L2411
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/client/RESTClient.java
RESTClient.sendRequest
public RESTResponse sendRequest(HttpMethod method, String uri) throws IOException { Map<String, String> headers = new HashMap<>(); return sendRequest(method, uri, headers, null); }
java
public RESTResponse sendRequest(HttpMethod method, String uri) throws IOException { Map<String, String> headers = new HashMap<>(); return sendRequest(method, uri, headers, null); }
[ "public", "RESTResponse", "sendRequest", "(", "HttpMethod", "method", ",", "String", "uri", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "String", ">", "headers", "=", "new", "HashMap", "<>", "(", ")", ";", "return", "sendRequest", "(", "m...
Send a REST command with the given method and URI (but no entityt) to the server and return the response in a {@link RESTResponse} object. @param method HTTP method such as "GET" or "POST". @param uri URI such as "/foo/bar?baz" @return {@link RESTResponse} containing response from server. @throws IOException If an I/O error occurs on the socket.
[ "Send", "a", "REST", "command", "with", "the", "given", "method", "and", "URI", "(", "but", "no", "entityt", ")", "to", "the", "server", "and", "return", "the", "response", "in", "a", "{", "@link", "RESTResponse", "}", "object", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/RESTClient.java#L244-L247
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toTimeZone
public static TimeZone toTimeZone(String strTimeZone, TimeZone defaultValue) { return TimeZoneUtil.toTimeZone(strTimeZone, defaultValue); }
java
public static TimeZone toTimeZone(String strTimeZone, TimeZone defaultValue) { return TimeZoneUtil.toTimeZone(strTimeZone, defaultValue); }
[ "public", "static", "TimeZone", "toTimeZone", "(", "String", "strTimeZone", ",", "TimeZone", "defaultValue", ")", "{", "return", "TimeZoneUtil", ".", "toTimeZone", "(", "strTimeZone", ",", "defaultValue", ")", ";", "}" ]
casts a string to a TimeZone @param strTimeZone @param defaultValue @return TimeZone from String
[ "casts", "a", "string", "to", "a", "TimeZone" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L4255-L4257
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMInputStream.java
JMInputStream.consumeInputStream
public static void consumeInputStream(InputStream inputStream, String charsetName, Consumer<String> consumer) { try (BufferedReader br = new BufferedReader( new InputStreamReader(inputStream, charsetName))) { for (String line = br.readLine(); line != null; line = br.readLine()) consumer.accept(line); } catch (IOException e) { JMExceptionManager.handleExceptionAndThrowRuntimeEx(log, e, "consumeInputStream", inputStream, charsetName, consumer); } }
java
public static void consumeInputStream(InputStream inputStream, String charsetName, Consumer<String> consumer) { try (BufferedReader br = new BufferedReader( new InputStreamReader(inputStream, charsetName))) { for (String line = br.readLine(); line != null; line = br.readLine()) consumer.accept(line); } catch (IOException e) { JMExceptionManager.handleExceptionAndThrowRuntimeEx(log, e, "consumeInputStream", inputStream, charsetName, consumer); } }
[ "public", "static", "void", "consumeInputStream", "(", "InputStream", "inputStream", ",", "String", "charsetName", ",", "Consumer", "<", "String", ">", "consumer", ")", "{", "try", "(", "BufferedReader", "br", "=", "new", "BufferedReader", "(", "new", "InputStre...
Consume input stream. @param inputStream the input stream @param charsetName the charset name @param consumer the consumer
[ "Consume", "input", "stream", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMInputStream.java#L100-L111
opendigitaleducation/web-utils
src/main/java/org/vertx/java/core/http/RouteMatcher.java
RouteMatcher.postWithRegEx
public RouteMatcher postWithRegEx(String regex, Handler<HttpServerRequest> handler) { addRegEx(regex, handler, postBindings); return this; }
java
public RouteMatcher postWithRegEx(String regex, Handler<HttpServerRequest> handler) { addRegEx(regex, handler, postBindings); return this; }
[ "public", "RouteMatcher", "postWithRegEx", "(", "String", "regex", ",", "Handler", "<", "HttpServerRequest", ">", "handler", ")", "{", "addRegEx", "(", "regex", ",", "handler", ",", "postBindings", ")", ";", "return", "this", ";", "}" ]
Specify a handler that will be called for a matching HTTP POST @param regex A regular expression @param handler The handler to call
[ "Specify", "a", "handler", "that", "will", "be", "called", "for", "a", "matching", "HTTP", "POST" ]
train
https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L229-L232
otto-de/edison-microservice
edison-core/src/main/java/de/otto/edison/authentication/configuration/LdapConfiguration.java
LdapConfiguration.ldapAuthenticationFilter
@Bean public FilterRegistrationBean<LdapAuthenticationFilter> ldapAuthenticationFilter(final LdapProperties ldapProperties, final LdapConnectionFactory ldapConnectionFactory) { FilterRegistrationBean<LdapAuthenticationFilter> filterRegistration = new FilterRegistrationBean<>(); filterRegistration.setFilter(new LdapAuthenticationFilter(ldapProperties, ldapConnectionFactory)); filterRegistration.setOrder(Ordered.LOWEST_PRECEDENCE - 1); ldapProperties.getPrefixes().forEach(prefix -> filterRegistration.addUrlPatterns(String.format("%s/*", prefix))); return filterRegistration; }
java
@Bean public FilterRegistrationBean<LdapAuthenticationFilter> ldapAuthenticationFilter(final LdapProperties ldapProperties, final LdapConnectionFactory ldapConnectionFactory) { FilterRegistrationBean<LdapAuthenticationFilter> filterRegistration = new FilterRegistrationBean<>(); filterRegistration.setFilter(new LdapAuthenticationFilter(ldapProperties, ldapConnectionFactory)); filterRegistration.setOrder(Ordered.LOWEST_PRECEDENCE - 1); ldapProperties.getPrefixes().forEach(prefix -> filterRegistration.addUrlPatterns(String.format("%s/*", prefix))); return filterRegistration; }
[ "@", "Bean", "public", "FilterRegistrationBean", "<", "LdapAuthenticationFilter", ">", "ldapAuthenticationFilter", "(", "final", "LdapProperties", "ldapProperties", ",", "final", "LdapConnectionFactory", "ldapConnectionFactory", ")", "{", "FilterRegistrationBean", "<", "LdapA...
Add an authentication filter to the web application context if edison.ldap property is set to {@code enabled}'. All routes starting with the value of the {@code edison.ldap.prefix} property will be secured by LDAP. If no property is set this will default to all routes starting with '/internal'. @param ldapProperties the properties used to configure LDAP @param ldapConnectionFactory the connection factory used to build the LdapAuthenticationFilter @return FilterRegistrationBean
[ "Add", "an", "authentication", "filter", "to", "the", "web", "application", "context", "if", "edison", ".", "ldap", "property", "is", "set", "to", "{", "@code", "enabled", "}", ".", "All", "routes", "starting", "with", "the", "value", "of", "the", "{", "...
train
https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-core/src/main/java/de/otto/edison/authentication/configuration/LdapConfiguration.java#L52-L60
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/AbstractBinaryExternalMerger.java
AbstractBinaryExternalMerger.mergeChannels
private ChannelWithMeta mergeChannels(List<ChannelWithMeta> channelIDs) throws IOException { // the list with the target iterators List<FileIOChannel> openChannels = new ArrayList<>(channelIDs.size()); final BinaryMergeIterator<Entry> mergeIterator = getMergingIterator(channelIDs, openChannels); // create a new channel writer final FileIOChannel.ID mergedChannelID = ioManager.createChannel(); channelManager.addChannel(mergedChannelID); AbstractChannelWriterOutputView output = null; int numBytesInLastBlock; int numBlocksWritten; try { output = FileChannelUtil.createOutputView( ioManager, mergedChannelID, compressionEnable, compressionCodecFactory, compressionBlockSize, pageSize); writeMergingOutput(mergeIterator, output); numBytesInLastBlock = output.close(); numBlocksWritten = output.getBlockCount(); } catch (IOException e) { if (output != null) { output.close(); output.getChannel().deleteChannel(); } throw e; } // remove, close and delete channels for (FileIOChannel channel : openChannels) { channelManager.removeChannel(channel.getChannelID()); try { channel.closeAndDelete(); } catch (Throwable ignored) { } } return new ChannelWithMeta(mergedChannelID, numBlocksWritten, numBytesInLastBlock); }
java
private ChannelWithMeta mergeChannels(List<ChannelWithMeta> channelIDs) throws IOException { // the list with the target iterators List<FileIOChannel> openChannels = new ArrayList<>(channelIDs.size()); final BinaryMergeIterator<Entry> mergeIterator = getMergingIterator(channelIDs, openChannels); // create a new channel writer final FileIOChannel.ID mergedChannelID = ioManager.createChannel(); channelManager.addChannel(mergedChannelID); AbstractChannelWriterOutputView output = null; int numBytesInLastBlock; int numBlocksWritten; try { output = FileChannelUtil.createOutputView( ioManager, mergedChannelID, compressionEnable, compressionCodecFactory, compressionBlockSize, pageSize); writeMergingOutput(mergeIterator, output); numBytesInLastBlock = output.close(); numBlocksWritten = output.getBlockCount(); } catch (IOException e) { if (output != null) { output.close(); output.getChannel().deleteChannel(); } throw e; } // remove, close and delete channels for (FileIOChannel channel : openChannels) { channelManager.removeChannel(channel.getChannelID()); try { channel.closeAndDelete(); } catch (Throwable ignored) { } } return new ChannelWithMeta(mergedChannelID, numBlocksWritten, numBytesInLastBlock); }
[ "private", "ChannelWithMeta", "mergeChannels", "(", "List", "<", "ChannelWithMeta", ">", "channelIDs", ")", "throws", "IOException", "{", "// the list with the target iterators", "List", "<", "FileIOChannel", ">", "openChannels", "=", "new", "ArrayList", "<>", "(", "c...
Merges the sorted runs described by the given Channel IDs into a single sorted run. @param channelIDs The IDs of the runs' channels. @return The ID and number of blocks of the channel that describes the merged run.
[ "Merges", "the", "sorted", "runs", "described", "by", "the", "given", "Channel", "IDs", "into", "a", "single", "sorted", "run", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/sort/AbstractBinaryExternalMerger.java#L160-L198
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/ComparatorCompat.java
ComparatorCompat.comparingDouble
@NotNull public static <T> ComparatorCompat<T> comparingDouble( @NotNull final ToDoubleFunction<? super T> keyExtractor) { Objects.requireNonNull(keyExtractor); return new ComparatorCompat<T>(new Comparator<T>() { @Override public int compare(T t1, T t2) { final double d1 = keyExtractor.applyAsDouble(t1); final double d2 = keyExtractor.applyAsDouble(t2); return Double.compare(d1, d2); } }); }
java
@NotNull public static <T> ComparatorCompat<T> comparingDouble( @NotNull final ToDoubleFunction<? super T> keyExtractor) { Objects.requireNonNull(keyExtractor); return new ComparatorCompat<T>(new Comparator<T>() { @Override public int compare(T t1, T t2) { final double d1 = keyExtractor.applyAsDouble(t1); final double d2 = keyExtractor.applyAsDouble(t2); return Double.compare(d1, d2); } }); }
[ "@", "NotNull", "public", "static", "<", "T", ">", "ComparatorCompat", "<", "T", ">", "comparingDouble", "(", "@", "NotNull", "final", "ToDoubleFunction", "<", "?", "super", "T", ">", "keyExtractor", ")", "{", "Objects", ".", "requireNonNull", "(", "keyExtra...
Returns a comparator that uses a function that extracts a {@code double} sort key to be compared. @param <T> the type of the objects compared by the comparator @param keyExtractor the function that extracts the sort key @return a comparator @throws NullPointerException if {@code keyExtractor} is null
[ "Returns", "a", "comparator", "that", "uses", "a", "function", "that", "extracts", "a", "{", "@code", "double", "}", "sort", "key", "to", "be", "compared", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/ComparatorCompat.java#L210-L223
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java
XpathUtils.asDate
public static Date asDate(String expression, Node node, XPath xpath) throws XPathExpressionException { String dateString = evaluateAsString(expression, node, xpath); if (isEmptyString(dateString)) return null; try { return DateUtils.parseISO8601Date(dateString); } catch (Exception e) { log.warn("Unable to parse date '" + dateString + "': " + e.getMessage(), e); return null; } }
java
public static Date asDate(String expression, Node node, XPath xpath) throws XPathExpressionException { String dateString = evaluateAsString(expression, node, xpath); if (isEmptyString(dateString)) return null; try { return DateUtils.parseISO8601Date(dateString); } catch (Exception e) { log.warn("Unable to parse date '" + dateString + "': " + e.getMessage(), e); return null; } }
[ "public", "static", "Date", "asDate", "(", "String", "expression", ",", "Node", "node", ",", "XPath", "xpath", ")", "throws", "XPathExpressionException", "{", "String", "dateString", "=", "evaluateAsString", "(", "expression", ",", "node", ",", "xpath", ")", "...
Same as {@link #asDate(String, Node)} but allows an xpath to be passed in explicitly for reuse.
[ "Same", "as", "{" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L462-L473
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/BlockChannelWriter.java
BlockChannelWriter.writeBlock
public void writeBlock(MemorySegment segment) throws IOException { // check the error state of this channel checkErroneous(); // write the current buffer and get the next one this.requestsNotReturned.incrementAndGet(); if (this.closed || this.requestQueue.isClosed()) { // if we found ourselves closed after the counter increment, // decrement the counter again and do not forward the request this.requestsNotReturned.decrementAndGet(); throw new IOException("The writer has been closed."); } this.requestQueue.add(new SegmentWriteRequest(this, segment)); }
java
public void writeBlock(MemorySegment segment) throws IOException { // check the error state of this channel checkErroneous(); // write the current buffer and get the next one this.requestsNotReturned.incrementAndGet(); if (this.closed || this.requestQueue.isClosed()) { // if we found ourselves closed after the counter increment, // decrement the counter again and do not forward the request this.requestsNotReturned.decrementAndGet(); throw new IOException("The writer has been closed."); } this.requestQueue.add(new SegmentWriteRequest(this, segment)); }
[ "public", "void", "writeBlock", "(", "MemorySegment", "segment", ")", "throws", "IOException", "{", "// check the error state of this channel", "checkErroneous", "(", ")", ";", "// write the current buffer and get the next one", "this", ".", "requestsNotReturned", ".", "incre...
Issues a asynchronous write request to the writer. @param segment The segment to be written. @throws IOException Thrown, when the writer encounters an I/O error. Due to the asynchronous nature of the writer, the exception thrown here may have been caused by an earlier write request.
[ "Issues", "a", "asynchronous", "write", "request", "to", "the", "writer", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/BlockChannelWriter.java#L64-L78
TGIO/RNCryptorNative
jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptor.java
AES256JNCryptor.decryptV2Data
private byte[] decryptV2Data(AES256v2Ciphertext aesCiphertext, SecretKey decryptionKey, SecretKey hmacKey) throws CryptorException { try { Mac mac = Mac.getInstance(HMAC_ALGORITHM); mac.init(hmacKey); byte[] hmacValue = mac.doFinal(aesCiphertext.getDataToHMAC()); if (!arraysEqual(hmacValue, aesCiphertext.getHmac())) { throw new InvalidHMACException("Incorrect HMAC value."); } Cipher cipher = Cipher.getInstance(AES_CIPHER_ALGORITHM); cipher.init(Cipher.DECRYPT_MODE, decryptionKey, new IvParameterSpec( aesCiphertext.getIv())); return cipher.doFinal(aesCiphertext.getCiphertext()); } catch (InvalidKeyException e) { throw new CryptorException( "Caught InvalidKeyException. Do you have unlimited strength jurisdiction files installed?", e); } catch (GeneralSecurityException e) { throw new CryptorException("Failed to decrypt message.", e); } }
java
private byte[] decryptV2Data(AES256v2Ciphertext aesCiphertext, SecretKey decryptionKey, SecretKey hmacKey) throws CryptorException { try { Mac mac = Mac.getInstance(HMAC_ALGORITHM); mac.init(hmacKey); byte[] hmacValue = mac.doFinal(aesCiphertext.getDataToHMAC()); if (!arraysEqual(hmacValue, aesCiphertext.getHmac())) { throw new InvalidHMACException("Incorrect HMAC value."); } Cipher cipher = Cipher.getInstance(AES_CIPHER_ALGORITHM); cipher.init(Cipher.DECRYPT_MODE, decryptionKey, new IvParameterSpec( aesCiphertext.getIv())); return cipher.doFinal(aesCiphertext.getCiphertext()); } catch (InvalidKeyException e) { throw new CryptorException( "Caught InvalidKeyException. Do you have unlimited strength jurisdiction files installed?", e); } catch (GeneralSecurityException e) { throw new CryptorException("Failed to decrypt message.", e); } }
[ "private", "byte", "[", "]", "decryptV2Data", "(", "AES256v2Ciphertext", "aesCiphertext", ",", "SecretKey", "decryptionKey", ",", "SecretKey", "hmacKey", ")", "throws", "CryptorException", "{", "try", "{", "Mac", "mac", "=", "Mac", ".", "getInstance", "(", "HMAC...
Decrypts data. @param aesCiphertext the ciphertext from the message @param decryptionKey the key to decrypt @param hmacKey the key to recalculate the HMAC @return the decrypted data @throws CryptorException if a JCE error occurs
[ "Decrypts", "data", "." ]
train
https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptor.java#L200-L224
facebookarchive/hadoop-20
src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
AbstractMetricsContext.sum
private Number sum(Number a, Number b) { if (a instanceof Integer) { return Integer.valueOf(a.intValue() + b.intValue()); } else if (a instanceof Float) { return new Float(a.floatValue() + b.floatValue()); } else if (a instanceof Short) { return Short.valueOf((short)(a.shortValue() + b.shortValue())); } else if (a instanceof Byte) { return Byte.valueOf((byte)(a.byteValue() + b.byteValue())); } else if (a instanceof Long) { return Long.valueOf((a.longValue() + b.longValue())); } else { // should never happen throw new MetricsException("Invalid number type"); } }
java
private Number sum(Number a, Number b) { if (a instanceof Integer) { return Integer.valueOf(a.intValue() + b.intValue()); } else if (a instanceof Float) { return new Float(a.floatValue() + b.floatValue()); } else if (a instanceof Short) { return Short.valueOf((short)(a.shortValue() + b.shortValue())); } else if (a instanceof Byte) { return Byte.valueOf((byte)(a.byteValue() + b.byteValue())); } else if (a instanceof Long) { return Long.valueOf((a.longValue() + b.longValue())); } else { // should never happen throw new MetricsException("Invalid number type"); } }
[ "private", "Number", "sum", "(", "Number", "a", ",", "Number", "b", ")", "{", "if", "(", "a", "instanceof", "Integer", ")", "{", "return", "Integer", ".", "valueOf", "(", "a", ".", "intValue", "(", ")", "+", "b", ".", "intValue", "(", ")", ")", "...
Adds two numbers, coercing the second to the type of the first.
[ "Adds", "two", "numbers", "coercing", "the", "second", "to", "the", "type", "of", "the", "first", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java#L378-L399
Stratio/stratio-cassandra
src/java/org/apache/cassandra/auth/DataResource.java
DataResource.fromName
public static DataResource fromName(String name) { String[] parts = StringUtils.split(name, '/'); if (!parts[0].equals(ROOT_NAME) || parts.length > 3) throw new IllegalArgumentException(String.format("%s is not a valid data resource name", name)); if (parts.length == 1) return root(); if (parts.length == 2) return keyspace(parts[1]); return columnFamily(parts[1], parts[2]); }
java
public static DataResource fromName(String name) { String[] parts = StringUtils.split(name, '/'); if (!parts[0].equals(ROOT_NAME) || parts.length > 3) throw new IllegalArgumentException(String.format("%s is not a valid data resource name", name)); if (parts.length == 1) return root(); if (parts.length == 2) return keyspace(parts[1]); return columnFamily(parts[1], parts[2]); }
[ "public", "static", "DataResource", "fromName", "(", "String", "name", ")", "{", "String", "[", "]", "parts", "=", "StringUtils", ".", "split", "(", "name", ",", "'", "'", ")", ";", "if", "(", "!", "parts", "[", "0", "]", ".", "equals", "(", "ROOT_...
Parses a data resource name into a DataResource instance. @param name Name of the data resource. @return DataResource instance matching the name.
[ "Parses", "a", "data", "resource", "name", "into", "a", "DataResource", "instance", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/auth/DataResource.java#L105-L119
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcPreparedStatement.java
WSJdbcPreparedStatement.executeBatch
private Object executeBatch(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "executeBatch", new Object[] { this, args[0] }); if (childWrapper != null) { closeAndRemoveResultSet(); } if (childWrappers != null && !childWrappers.isEmpty()) { closeAndRemoveResultSets(); } enforceStatementProperties(); Object results = method.invoke(implObject, args); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "executeBatch", results instanceof int[] ? Arrays.toString((int[]) results) : results); return results; }
java
private Object executeBatch(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "executeBatch", new Object[] { this, args[0] }); if (childWrapper != null) { closeAndRemoveResultSet(); } if (childWrappers != null && !childWrappers.isEmpty()) { closeAndRemoveResultSets(); } enforceStatementProperties(); Object results = method.invoke(implObject, args); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "executeBatch", results instanceof int[] ? Arrays.toString((int[]) results) : results); return results; }
[ "private", "Object", "executeBatch", "(", "Object", "implObject", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", ",", "SQLException", "{", "final", ...
Invokes executeBatch and after closing any previous result sets and ensuring statement properties are up-to-date. @param implObject the instance on which the operation is invoked. @param method the method that is invoked. @param args the parameters to the method. @throws IllegalAccessException if the method is inaccessible. @throws IllegalArgumentException if the instance does not have the method or if the method arguments are not appropriate. @throws InvocationTargetException if the method raises a checked exception. @throws SQLException if unable to invoke the method for other reasons. @return the result of invoking the method.
[ "Invokes", "executeBatch", "and", "after", "closing", "any", "previous", "result", "sets", "and", "ensuring", "statement", "properties", "are", "up", "-", "to", "-", "date", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcPreparedStatement.java#L430-L453
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java
ReplicationLinksInner.failoverAllowDataLoss
public void failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); }
java
public void failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); }
[ "public", "void", "failoverAllowDataLoss", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "linkId", ")", "{", "failoverAllowDataLossWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",",...
Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database that has the replication link to be failed over. @param linkId The ID of the replication link to be failed over. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Sets", "which", "replica", "database", "is", "primary", "by", "failing", "over", "from", "the", "current", "primary", "replica", "database", ".", "This", "operation", "might", "result", "in", "data", "loss", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java#L480-L482
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java
Requests.createPublishUpdate
public static PublishUpdate createPublishUpdate(Identifier i1, Identifier i2, Document md, MetadataLifetime lifetime) { if (md == null) { throw new NullPointerException("md not allowed to be null"); } List<Document> list = new ArrayList<Document>(1); list.add(md); return createPublishUpdate(i1, i2, list, lifetime); }
java
public static PublishUpdate createPublishUpdate(Identifier i1, Identifier i2, Document md, MetadataLifetime lifetime) { if (md == null) { throw new NullPointerException("md not allowed to be null"); } List<Document> list = new ArrayList<Document>(1); list.add(md); return createPublishUpdate(i1, i2, list, lifetime); }
[ "public", "static", "PublishUpdate", "createPublishUpdate", "(", "Identifier", "i1", ",", "Identifier", "i2", ",", "Document", "md", ",", "MetadataLifetime", "lifetime", ")", "{", "if", "(", "md", "==", "null", ")", "{", "throw", "new", "NullPointerException", ...
Create a new {@link PublishUpdate} instance that is used to publish metadata on a link between two {@link Identifier} instances with a specific {@link MetadataLifetime}. @param i1 the first {@link Identifier} of the link @param i2 the second {@link Identifier} of the link @param md the metadata that shall be published @param lifetime the lifetime of the new metadata @return the new {@link PublishUpdate} instance
[ "Create", "a", "new", "{", "@link", "PublishUpdate", "}", "instance", "that", "is", "used", "to", "publish", "metadata", "on", "a", "link", "between", "two", "{", "@link", "Identifier", "}", "instances", "with", "a", "specific", "{", "@link", "MetadataLifeti...
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java#L375-L385
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.join
public static String join(long[] array, CharSequence conjunction) { if (null == array) { return null; } final StringBuilder sb = new StringBuilder(); boolean isFirst = true; for (long item : array) { if (isFirst) { isFirst = false; } else { sb.append(conjunction); } sb.append(item); } return sb.toString(); }
java
public static String join(long[] array, CharSequence conjunction) { if (null == array) { return null; } final StringBuilder sb = new StringBuilder(); boolean isFirst = true; for (long item : array) { if (isFirst) { isFirst = false; } else { sb.append(conjunction); } sb.append(item); } return sb.toString(); }
[ "public", "static", "String", "join", "(", "long", "[", "]", "array", ",", "CharSequence", "conjunction", ")", "{", "if", "(", "null", "==", "array", ")", "{", "return", "null", ";", "}", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ...
以 conjunction 为分隔符将数组转换为字符串 @param array 数组 @param conjunction 分隔符 @return 连接后的字符串
[ "以", "conjunction", "为分隔符将数组转换为字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2341-L2357
rundeck/rundeck
rundeck-storage/rundeck-storage-api/src/main/java/org/rundeck/storage/api/PathUtil.java
PathUtil.appendPath
public static String appendPath(String prefixPath, String subpath) { return cleanPath(prefixPath) + SEPARATOR + cleanPath(subpath); }
java
public static String appendPath(String prefixPath, String subpath) { return cleanPath(prefixPath) + SEPARATOR + cleanPath(subpath); }
[ "public", "static", "String", "appendPath", "(", "String", "prefixPath", ",", "String", "subpath", ")", "{", "return", "cleanPath", "(", "prefixPath", ")", "+", "SEPARATOR", "+", "cleanPath", "(", "subpath", ")", ";", "}" ]
Append one path to another @param prefixPath prefix @param subpath sub path @return sub path appended to the prefix
[ "Append", "one", "path", "to", "another" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-api/src/main/java/org/rundeck/storage/api/PathUtil.java#L255-L257
allure-framework/allure-java
allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java
AllureLifecycle.updateFixture
public void updateFixture(final String uuid, final Consumer<FixtureResult> update) { final Optional<FixtureResult> found = storage.getFixture(uuid); if (!found.isPresent()) { LOGGER.error("Could not update test fixture: test fixture with uuid {} not found", uuid); return; } final FixtureResult fixture = found.get(); notifier.beforeFixtureUpdate(fixture); update.accept(fixture); notifier.afterFixtureUpdate(fixture); }
java
public void updateFixture(final String uuid, final Consumer<FixtureResult> update) { final Optional<FixtureResult> found = storage.getFixture(uuid); if (!found.isPresent()) { LOGGER.error("Could not update test fixture: test fixture with uuid {} not found", uuid); return; } final FixtureResult fixture = found.get(); notifier.beforeFixtureUpdate(fixture); update.accept(fixture); notifier.afterFixtureUpdate(fixture); }
[ "public", "void", "updateFixture", "(", "final", "String", "uuid", ",", "final", "Consumer", "<", "FixtureResult", ">", "update", ")", "{", "final", "Optional", "<", "FixtureResult", ">", "found", "=", "storage", ".", "getFixture", "(", "uuid", ")", ";", "...
Updates fixture by given uuid. @param uuid the uuid of fixture. @param update the update function.
[ "Updates", "fixture", "by", "given", "uuid", "." ]
train
https://github.com/allure-framework/allure-java/blob/64015ca2b789aa6f7b19c793f1512e2f11d0174e/allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java#L248-L259
impossibl/stencil
engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java
StencilOperands.narrowBigDecimal
protected Number narrowBigDecimal(Object lhs, Object rhs, BigDecimal bigd) { if (isNumberable(lhs) || isNumberable(rhs)) { try { long l = bigd.longValueExact(); // coerce to int when possible (int being so often used in method parms) if (l <= Integer.MAX_VALUE && l >= Integer.MIN_VALUE) { return Integer.valueOf((int) l); } else { return Long.valueOf(l); } } catch (ArithmeticException xa) { // ignore, no exact value possible } } return bigd; }
java
protected Number narrowBigDecimal(Object lhs, Object rhs, BigDecimal bigd) { if (isNumberable(lhs) || isNumberable(rhs)) { try { long l = bigd.longValueExact(); // coerce to int when possible (int being so often used in method parms) if (l <= Integer.MAX_VALUE && l >= Integer.MIN_VALUE) { return Integer.valueOf((int) l); } else { return Long.valueOf(l); } } catch (ArithmeticException xa) { // ignore, no exact value possible } } return bigd; }
[ "protected", "Number", "narrowBigDecimal", "(", "Object", "lhs", ",", "Object", "rhs", ",", "BigDecimal", "bigd", ")", "{", "if", "(", "isNumberable", "(", "lhs", ")", "||", "isNumberable", "(", "rhs", ")", ")", "{", "try", "{", "long", "l", "=", "bigd...
Given a BigDecimal, attempt to narrow it to an Integer or Long if it fits if one of the arguments is a numberable. @param lhs the left hand side operand that lead to the bigd result @param rhs the right hand side operand that lead to the bigd result @param bigd the BigDecimal to narrow @return an Integer or Long if narrowing is possible, the original BigInteger otherwise
[ "Given", "a", "BigDecimal", "attempt", "to", "narrow", "it", "to", "an", "Integer", "or", "Long", "if", "it", "fits", "if", "one", "of", "the", "arguments", "is", "a", "numberable", "." ]
train
https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java#L208-L225
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.multAddTransAB
public static void multAddTransAB(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { if( a.numCols >= EjmlParameters.CMULT_TRANAB_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multAddTransAB_aux(a,b,c,null); } else { MatrixMatrixMult_ZDRM.multAddTransAB(a,b,c); } }
java
public static void multAddTransAB(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { if( a.numCols >= EjmlParameters.CMULT_TRANAB_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multAddTransAB_aux(a,b,c,null); } else { MatrixMatrixMult_ZDRM.multAddTransAB(a,b,c); } }
[ "public", "static", "void", "multAddTransAB", "(", "ZMatrixRMaj", "a", ",", "ZMatrixRMaj", "b", ",", "ZMatrixRMaj", "c", ")", "{", "if", "(", "a", ".", "numCols", ">=", "EjmlParameters", ".", "CMULT_TRANAB_COLUMN_SWITCH", ")", "{", "MatrixMatrixMult_ZDRM", ".", ...
<p> Performs the following operation:<br> <br> c = c + a<sup>H</sup> * b<sup>H</sup><br> c<sub>ij</sub> = c<sub>ij</sub> + &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>jk</sub>} </p> @param a The left matrix in the multiplication operation. Not Modified. @param b The right matrix in the multiplication operation. Not Modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "c", "+", "a<sup", ">", "H<", "/", "sup", ">", "*", "b<sup", ">", "H<", "/", "sup", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "c<...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L668-L675
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java
UnderFileSystemBlockStore.acquireAccess
public boolean acquireAccess(long sessionId, long blockId, Protocol.OpenUfsBlockOptions options) throws BlockAlreadyExistsException { UnderFileSystemBlockMeta blockMeta = new UnderFileSystemBlockMeta(sessionId, blockId, options); try (LockResource lr = new LockResource(mLock)) { Key key = new Key(sessionId, blockId); if (mBlocks.containsKey(key)) { throw new BlockAlreadyExistsException(ExceptionMessage.UFS_BLOCK_ALREADY_EXISTS_FOR_SESSION, blockId, blockMeta.getUnderFileSystemPath(), sessionId); } Set<Long> sessionIds = mBlockIdToSessionIds.get(blockId); if (sessionIds != null && sessionIds.size() >= options.getMaxUfsReadConcurrency()) { return false; } if (sessionIds == null) { sessionIds = new HashSet<>(); mBlockIdToSessionIds.put(blockId, sessionIds); } sessionIds.add(sessionId); mBlocks.put(key, new BlockInfo(blockMeta)); Set<Long> blockIds = mSessionIdToBlockIds.get(sessionId); if (blockIds == null) { blockIds = new HashSet<>(); mSessionIdToBlockIds.put(sessionId, blockIds); } blockIds.add(blockId); } return true; }
java
public boolean acquireAccess(long sessionId, long blockId, Protocol.OpenUfsBlockOptions options) throws BlockAlreadyExistsException { UnderFileSystemBlockMeta blockMeta = new UnderFileSystemBlockMeta(sessionId, blockId, options); try (LockResource lr = new LockResource(mLock)) { Key key = new Key(sessionId, blockId); if (mBlocks.containsKey(key)) { throw new BlockAlreadyExistsException(ExceptionMessage.UFS_BLOCK_ALREADY_EXISTS_FOR_SESSION, blockId, blockMeta.getUnderFileSystemPath(), sessionId); } Set<Long> sessionIds = mBlockIdToSessionIds.get(blockId); if (sessionIds != null && sessionIds.size() >= options.getMaxUfsReadConcurrency()) { return false; } if (sessionIds == null) { sessionIds = new HashSet<>(); mBlockIdToSessionIds.put(blockId, sessionIds); } sessionIds.add(sessionId); mBlocks.put(key, new BlockInfo(blockMeta)); Set<Long> blockIds = mSessionIdToBlockIds.get(sessionId); if (blockIds == null) { blockIds = new HashSet<>(); mSessionIdToBlockIds.put(sessionId, blockIds); } blockIds.add(blockId); } return true; }
[ "public", "boolean", "acquireAccess", "(", "long", "sessionId", ",", "long", "blockId", ",", "Protocol", ".", "OpenUfsBlockOptions", "options", ")", "throws", "BlockAlreadyExistsException", "{", "UnderFileSystemBlockMeta", "blockMeta", "=", "new", "UnderFileSystemBlockMet...
Acquires access for a UFS block given a {@link UnderFileSystemBlockMeta} and the limit on the maximum concurrency on the block. If the number of concurrent readers on this UFS block exceeds a threshold, the token is not granted and this method returns false. @param sessionId the session ID @param blockId maximum concurrency @param options the options @return whether an access token is acquired @throws BlockAlreadyExistsException if the block already exists for a session ID
[ "Acquires", "access", "for", "a", "UFS", "block", "given", "a", "{", "@link", "UnderFileSystemBlockMeta", "}", "and", "the", "limit", "on", "the", "maximum", "concurrency", "on", "the", "block", ".", "If", "the", "number", "of", "concurrent", "readers", "on"...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java#L104-L133
jayantk/jklol
src/com/jayantkrish/jklol/models/DiscreteVariable.java
DiscreteVariable.fromCsvColumn
public static DiscreteVariable fromCsvColumn(String variableName, String filename, String delimiter, int columnNumber) { List<String> values = IoUtils.readColumnFromDelimitedFile(filename, columnNumber, delimiter); return new DiscreteVariable(variableName, values); }
java
public static DiscreteVariable fromCsvColumn(String variableName, String filename, String delimiter, int columnNumber) { List<String> values = IoUtils.readColumnFromDelimitedFile(filename, columnNumber, delimiter); return new DiscreteVariable(variableName, values); }
[ "public", "static", "DiscreteVariable", "fromCsvColumn", "(", "String", "variableName", ",", "String", "filename", ",", "String", "delimiter", ",", "int", "columnNumber", ")", "{", "List", "<", "String", ">", "values", "=", "IoUtils", ".", "readColumnFromDelimited...
Constructs a variable containing all of the values in {@code columnNumber} of the delimited file {@code filename}. {@code delimiter} separates the columns of the file. @param variableName @param filename @param delimiter @param columnNumber @return
[ "Constructs", "a", "variable", "containing", "all", "of", "the", "values", "in", "{", "@code", "columnNumber", "}", "of", "the", "delimited", "file", "{", "@code", "filename", "}", ".", "{", "@code", "delimiter", "}", "separates", "the", "columns", "of", "...
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/DiscreteVariable.java#L69-L73
bbottema/simple-java-mail
modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageProducer.java
MimeMessageProducer.populateMimeMessage
final MimeMessage populateMimeMessage(@Nonnull final Email email, @Nonnull Session session) throws MessagingException, UnsupportedEncodingException { checkArgumentNotEmpty(email, "email is missing"); checkArgumentNotEmpty(session, "session is needed, it cannot be attached later"); final MimeMessage message = new MimeMessage(session) { @Override protected void updateMessageID() throws MessagingException { if (valueNullOrEmpty(email.getId())) { super.updateMessageID(); } else { setHeader("Message-ID", email.getId()); } } @Override public String toString() { try { return "MimeMessage<id:" + super.getMessageID() + ", subject:" + super.getSubject() + ">"; } catch (MessagingException e) { throw new AssertionError("should not reach here"); } } }; // set basic email properties MimeMessageHelper.setSubject(email, message); MimeMessageHelper.setFrom(email, message); MimeMessageHelper.setReplyTo(email, message); MimeMessageHelper.setRecipients(email, message); populateMimeMessageMultipartStructure(message, email); MimeMessageHelper.setHeaders(email, message); message.setSentDate(new Date()); if (!valueNullOrEmpty(email.getDkimSigningDomain())) { return signMessageWithDKIM(message, email); } return message; }
java
final MimeMessage populateMimeMessage(@Nonnull final Email email, @Nonnull Session session) throws MessagingException, UnsupportedEncodingException { checkArgumentNotEmpty(email, "email is missing"); checkArgumentNotEmpty(session, "session is needed, it cannot be attached later"); final MimeMessage message = new MimeMessage(session) { @Override protected void updateMessageID() throws MessagingException { if (valueNullOrEmpty(email.getId())) { super.updateMessageID(); } else { setHeader("Message-ID", email.getId()); } } @Override public String toString() { try { return "MimeMessage<id:" + super.getMessageID() + ", subject:" + super.getSubject() + ">"; } catch (MessagingException e) { throw new AssertionError("should not reach here"); } } }; // set basic email properties MimeMessageHelper.setSubject(email, message); MimeMessageHelper.setFrom(email, message); MimeMessageHelper.setReplyTo(email, message); MimeMessageHelper.setRecipients(email, message); populateMimeMessageMultipartStructure(message, email); MimeMessageHelper.setHeaders(email, message); message.setSentDate(new Date()); if (!valueNullOrEmpty(email.getDkimSigningDomain())) { return signMessageWithDKIM(message, email); } return message; }
[ "final", "MimeMessage", "populateMimeMessage", "(", "@", "Nonnull", "final", "Email", "email", ",", "@", "Nonnull", "Session", "session", ")", "throws", "MessagingException", ",", "UnsupportedEncodingException", "{", "checkArgumentNotEmpty", "(", "email", ",", "\"emai...
Performs a standard population and then delegates multipart specifics to the subclass.
[ "Performs", "a", "standard", "population", "and", "then", "delegates", "multipart", "specifics", "to", "the", "subclass", "." ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageProducer.java#L32-L73
oboehm/jfachwert
src/main/java/de/jfachwert/math/Nummer.java
Nummer.validate
public static String validate(String nummer) { try { return new BigInteger(nummer).toString(); } catch (NumberFormatException nfe) { throw new InvalidValueException(nummer, "number"); } }
java
public static String validate(String nummer) { try { return new BigInteger(nummer).toString(); } catch (NumberFormatException nfe) { throw new InvalidValueException(nummer, "number"); } }
[ "public", "static", "String", "validate", "(", "String", "nummer", ")", "{", "try", "{", "return", "new", "BigInteger", "(", "nummer", ")", ".", "toString", "(", ")", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "throw", "new", "Inva...
Ueberprueft, ob der uebergebene String auch tatsaechlich eine Zahl ist. @param nummer z.B. "4711" @return validierter String zur Weiterverarbeitung
[ "Ueberprueft", "ob", "der", "uebergebene", "String", "auch", "tatsaechlich", "eine", "Zahl", "ist", "." ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/Nummer.java#L148-L154
samskivert/samskivert
src/main/java/com/samskivert/swing/GroupLayout.java
GroupLayout.makeButtonBox
public static JPanel makeButtonBox (Justification justification, Component... buttons) { JPanel box = new JPanel(new HGroupLayout(NONE, justification)); for (Component button : buttons) { box.add(button); box.setOpaque(false); } return box; }
java
public static JPanel makeButtonBox (Justification justification, Component... buttons) { JPanel box = new JPanel(new HGroupLayout(NONE, justification)); for (Component button : buttons) { box.add(button); box.setOpaque(false); } return box; }
[ "public", "static", "JPanel", "makeButtonBox", "(", "Justification", "justification", ",", "Component", "...", "buttons", ")", "{", "JPanel", "box", "=", "new", "JPanel", "(", "new", "HGroupLayout", "(", "NONE", ",", "justification", ")", ")", ";", "for", "(...
Creates a {@link JPanel} that is configured with an {@link HGroupLayout} with a configuration conducive to containing a row of buttons. Any supplied buttons are added to the box.
[ "Creates", "a", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/GroupLayout.java#L320-L328
MaxLeap/SDK-CloudCode-Java
cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java
WebUtils.doDelete
public static String doDelete(String url, Map<String, String> header, Map<String, String> params) throws IOException { return doRequestWithUrl(url, METHOD_DELETE, header, params, DEFAULT_CHARSET); }
java
public static String doDelete(String url, Map<String, String> header, Map<String, String> params) throws IOException { return doRequestWithUrl(url, METHOD_DELETE, header, params, DEFAULT_CHARSET); }
[ "public", "static", "String", "doDelete", "(", "String", "url", ",", "Map", "<", "String", ",", "String", ">", "header", ",", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "IOException", "{", "return", "doRequestWithUrl", "(", "url", ...
执行HTTP DELETE请求。 @param url 请求地址 @param params 请求参数 @return 响应字符串 @throws IOException
[ "执行HTTP", "DELETE请求。" ]
train
https://github.com/MaxLeap/SDK-CloudCode-Java/blob/756064c65dd613919c377bf136cf8710c7507968/cloud-code-sdk/src/main/java/com/maxleap/code/impl/WebUtils.java#L151-L153