repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
vatbub/common
updater/src/main/java/com/github/vatbub/common/updater/UpdateChecker.java
UpdateChecker.getMavenMetadata
private static Document getMavenMetadata(URL repoBaseURL, String mavenGroupID, String mavenArtifactID) throws JDOMException, IOException { return new SAXBuilder().build(new URL(repoBaseURL.toString() + "/" + mavenGroupID.replace('.', '/') + "/" + mavenArtifactID + "/maven-metadata.xml")); }
java
private static Document getMavenMetadata(URL repoBaseURL, String mavenGroupID, String mavenArtifactID) throws JDOMException, IOException { return new SAXBuilder().build(new URL(repoBaseURL.toString() + "/" + mavenGroupID.replace('.', '/') + "/" + mavenArtifactID + "/maven-metadata.xml")); }
[ "private", "static", "Document", "getMavenMetadata", "(", "URL", "repoBaseURL", ",", "String", "mavenGroupID", ",", "String", "mavenArtifactID", ")", "throws", "JDOMException", ",", "IOException", "{", "return", "new", "SAXBuilder", "(", ")", ".", "build", "(", ...
Get a DOM of mavens {@code maven-metadata.xml}-file of the specified artifact. @param repoBaseURL The base url where the repo can be reached. For Maven Central, this is <a href="http://repo1.maven.org/maven/">http://repo1.maven.org/maven/</a> @param mavenGroupID The groupID of the artifact to be looked up. @param mavenArtifactID The artifactId of the artifact to be looked up. @return A JDOM {@link Document} representation of mavens {@code maven-metadata.xml} @throws JDOMException If mavens {@code maven-metadata.xml} is not parseable (Which will never be the case unless you don't modify it manually). @throws IOException In case mavens {@code maven-metadata.xml} cannot be retrieved for any other reason.
[ "Get", "a", "DOM", "of", "mavens", "{", "@code", "maven", "-", "metadata", ".", "xml", "}", "-", "file", "of", "the", "specified", "artifact", "." ]
train
https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/updater/src/main/java/com/github/vatbub/common/updater/UpdateChecker.java#L369-L373
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRecordBrowser.java
LogRecordBrowser.restartRecordsInProcess
private OnePidRecordListImpl restartRecordsInProcess(final RepositoryPointer after, long max, final IInternalRecordFilter recFilter) { if (!(after instanceof RepositoryPointerImpl)) { throw new IllegalArgumentException("Specified location does not belong to this repository."); } return new OnePidRecordListLocationImpl((RepositoryPointerImpl)after, max, recFilter); }
java
private OnePidRecordListImpl restartRecordsInProcess(final RepositoryPointer after, long max, final IInternalRecordFilter recFilter) { if (!(after instanceof RepositoryPointerImpl)) { throw new IllegalArgumentException("Specified location does not belong to this repository."); } return new OnePidRecordListLocationImpl((RepositoryPointerImpl)after, max, recFilter); }
[ "private", "OnePidRecordListImpl", "restartRecordsInProcess", "(", "final", "RepositoryPointer", "after", ",", "long", "max", ",", "final", "IInternalRecordFilter", "recFilter", ")", "{", "if", "(", "!", "(", "after", "instanceof", "RepositoryPointerImpl", ")", ")", ...
continue the list of the records in the process filtered with <code>recFilter</code>
[ "continue", "the", "list", "of", "the", "records", "in", "the", "process", "filtered", "with", "<code", ">", "recFilter<", "/", "code", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRecordBrowser.java#L172-L177
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/XMLUtils.java
XMLUtils.extractXML
public static String extractXML(Node node, int start, int length) { ExtractHandler handler = null; try { handler = new ExtractHandler(start, length); Transformer xformer = TransformerFactory.newInstance().newTransformer(); xformer.transform(new DOMSource(node), new SAXResult(handler)); return handler.getResult(); } catch (Throwable t) { if (handler != null && handler.isFinished()) { return handler.getResult(); } else { throw new RuntimeException("Failed to extract XML", t); } } }
java
public static String extractXML(Node node, int start, int length) { ExtractHandler handler = null; try { handler = new ExtractHandler(start, length); Transformer xformer = TransformerFactory.newInstance().newTransformer(); xformer.transform(new DOMSource(node), new SAXResult(handler)); return handler.getResult(); } catch (Throwable t) { if (handler != null && handler.isFinished()) { return handler.getResult(); } else { throw new RuntimeException("Failed to extract XML", t); } } }
[ "public", "static", "String", "extractXML", "(", "Node", "node", ",", "int", "start", ",", "int", "length", ")", "{", "ExtractHandler", "handler", "=", "null", ";", "try", "{", "handler", "=", "new", "ExtractHandler", "(", "start", ",", "length", ")", ";...
Extracts a well-formed XML fragment from the given DOM tree. @param node the root of the DOM tree where the extraction takes place @param start the index of the first character @param length the maximum number of characters in text nodes to include in the returned fragment @return a well-formed XML fragment starting at the given character index and having up to the specified length, summing only the characters in text nodes @since 1.6M2
[ "Extracts", "a", "well", "-", "formed", "XML", "fragment", "from", "the", "given", "DOM", "tree", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/XMLUtils.java#L137-L152
HeidelTime/heideltime
src/de/unihd/dbs/uima/annotator/heideltime/ProcessorManager.java
ProcessorManager.registerProcessor
public void registerProcessor(String processor, Priority prio) { this.processorNames.get(prio).add(processor); }
java
public void registerProcessor(String processor, Priority prio) { this.processorNames.get(prio).add(processor); }
[ "public", "void", "registerProcessor", "(", "String", "processor", ",", "Priority", "prio", ")", "{", "this", ".", "processorNames", ".", "get", "(", "prio", ")", ".", "add", "(", "processor", ")", ";", "}" ]
method to register a processor @param processor processor to be registered in the processormanager's list @param p priority for the process to take
[ "method", "to", "register", "a", "processor" ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/annotator/heideltime/ProcessorManager.java#L51-L53
jglobus/JGlobus
gram/src/main/java/org/globus/gram/Gram.java
Gram.jobSignal
public static int jobSignal(GramJob job, int signal, String arg) throws GramException, GSSException { GlobusURL jobURL = job.getID(); GSSCredential cred = getJobCredentials(job); String msg = GRAMProtocol.SIGNAL(jobURL.getURL(), jobURL.getHost(), signal, arg); GatekeeperReply hd = null; hd = jmConnect(cred, jobURL, msg); switch(signal) { case GramJob.SIGNAL_PRIORITY: return hd.failureCode; case GramJob.SIGNAL_STDIO_SIZE: case GramJob.SIGNAL_STDIO_UPDATE: case GramJob.SIGNAL_COMMIT_REQUEST: case GramJob.SIGNAL_COMMIT_EXTEND: case GramJob.SIGNAL_COMMIT_END: case GramJob.SIGNAL_STOP_MANAGER: if (hd.failureCode != 0 && hd.status == GramJob.STATUS_FAILED) { throw new GramException(hd.failureCode); } else if (hd.failureCode == 0 && hd.jobFailureCode != 0) { job.setError( hd.jobFailureCode ); job.setStatus(GramJob.STATUS_FAILED); return hd.failureCode; } else { job.setStatus(hd.status); return 0; } default: job.setStatus( hd.status ); job.setError( hd.failureCode ); return 0; } }
java
public static int jobSignal(GramJob job, int signal, String arg) throws GramException, GSSException { GlobusURL jobURL = job.getID(); GSSCredential cred = getJobCredentials(job); String msg = GRAMProtocol.SIGNAL(jobURL.getURL(), jobURL.getHost(), signal, arg); GatekeeperReply hd = null; hd = jmConnect(cred, jobURL, msg); switch(signal) { case GramJob.SIGNAL_PRIORITY: return hd.failureCode; case GramJob.SIGNAL_STDIO_SIZE: case GramJob.SIGNAL_STDIO_UPDATE: case GramJob.SIGNAL_COMMIT_REQUEST: case GramJob.SIGNAL_COMMIT_EXTEND: case GramJob.SIGNAL_COMMIT_END: case GramJob.SIGNAL_STOP_MANAGER: if (hd.failureCode != 0 && hd.status == GramJob.STATUS_FAILED) { throw new GramException(hd.failureCode); } else if (hd.failureCode == 0 && hd.jobFailureCode != 0) { job.setError( hd.jobFailureCode ); job.setStatus(GramJob.STATUS_FAILED); return hd.failureCode; } else { job.setStatus(hd.status); return 0; } default: job.setStatus( hd.status ); job.setError( hd.failureCode ); return 0; } }
[ "public", "static", "int", "jobSignal", "(", "GramJob", "job", ",", "int", "signal", ",", "String", "arg", ")", "throws", "GramException", ",", "GSSException", "{", "GlobusURL", "jobURL", "=", "job", ".", "getID", "(", ")", ";", "GSSCredential", "cred", "=...
This function sends a signal to a job. @throws GramException if an error occurs during cancel @param job the signaled job @param signal type of the signal @param arg argument of the signal
[ "This", "function", "sends", "a", "signal", "to", "a", "job", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gram/src/main/java/org/globus/gram/Gram.java#L686-L725
GoogleCloudPlatform/bigdata-interop
gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java
GoogleHadoopFileSystemBase.listStatus
@Override public FileStatus[] listStatus(Path hadoopPath) throws IOException { long startTime = System.nanoTime(); Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null"); checkOpen(); logger.atFine().log("GHFS.listStatus: %s", hadoopPath); URI gcsPath = getGcsPath(hadoopPath); List<FileStatus> status; try { List<FileInfo> fileInfos = getGcsFs().listFileInfo(gcsPath); status = new ArrayList<>(fileInfos.size()); String userName = getUgiUserName(); for (FileInfo fileInfo : fileInfos) { status.add(getFileStatus(fileInfo, userName)); } } catch (FileNotFoundException fnfe) { logger.atFine().withCause(fnfe).log("Got fnfe: "); throw new FileNotFoundException(String.format("Path '%s' does not exist.", gcsPath)); } long duration = System.nanoTime() - startTime; increment(Counter.LIST_STATUS); increment(Counter.LIST_STATUS_TIME, duration); return status.toArray(new FileStatus[0]); }
java
@Override public FileStatus[] listStatus(Path hadoopPath) throws IOException { long startTime = System.nanoTime(); Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null"); checkOpen(); logger.atFine().log("GHFS.listStatus: %s", hadoopPath); URI gcsPath = getGcsPath(hadoopPath); List<FileStatus> status; try { List<FileInfo> fileInfos = getGcsFs().listFileInfo(gcsPath); status = new ArrayList<>(fileInfos.size()); String userName = getUgiUserName(); for (FileInfo fileInfo : fileInfos) { status.add(getFileStatus(fileInfo, userName)); } } catch (FileNotFoundException fnfe) { logger.atFine().withCause(fnfe).log("Got fnfe: "); throw new FileNotFoundException(String.format("Path '%s' does not exist.", gcsPath)); } long duration = System.nanoTime() - startTime; increment(Counter.LIST_STATUS); increment(Counter.LIST_STATUS_TIME, duration); return status.toArray(new FileStatus[0]); }
[ "@", "Override", "public", "FileStatus", "[", "]", "listStatus", "(", "Path", "hadoopPath", ")", "throws", "IOException", "{", "long", "startTime", "=", "System", ".", "nanoTime", "(", ")", ";", "Preconditions", ".", "checkArgument", "(", "hadoopPath", "!=", ...
Lists file status. If the given path points to a directory then the status of children is returned, otherwise the status of the given file is returned. @param hadoopPath Given path. @return File status list or null if path does not exist. @throws IOException if an error occurs.
[ "Lists", "file", "status", ".", "If", "the", "given", "path", "points", "to", "a", "directory", "then", "the", "status", "of", "children", "is", "returned", "otherwise", "the", "status", "of", "the", "given", "file", "is", "returned", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L968-L997
meltmedia/cadmium
servlets/src/main/java/com/meltmedia/cadmium/servlets/jersey/error/ErrorUtil.java
ErrorUtil.throwInternalError
public static void throwInternalError(String message, UriInfo uriInfo) { GenericError error = new GenericError( message, ErrorCode.INTERNAL.getCode(), uriInfo.getAbsolutePath().toString()); throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR) .type(MediaType.APPLICATION_JSON_TYPE) .entity(error) .build()); }
java
public static void throwInternalError(String message, UriInfo uriInfo) { GenericError error = new GenericError( message, ErrorCode.INTERNAL.getCode(), uriInfo.getAbsolutePath().toString()); throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR) .type(MediaType.APPLICATION_JSON_TYPE) .entity(error) .build()); }
[ "public", "static", "void", "throwInternalError", "(", "String", "message", ",", "UriInfo", "uriInfo", ")", "{", "GenericError", "error", "=", "new", "GenericError", "(", "message", ",", "ErrorCode", ".", "INTERNAL", ".", "getCode", "(", ")", ",", "uriInfo", ...
Wraps the error as {@link WebApplicationException} with error mapped as JSON Response @param message {@link String} representing internal error @param uriInfo {@link UriInfo} used for forming link
[ "Wraps", "the", "error", "as", "{" ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/jersey/error/ErrorUtil.java#L72-L82
mikepenz/Android-Iconics
library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java
IconicsDrawable.roundedCornersRxDp
@NonNull public IconicsDrawable roundedCornersRxDp(@Dimension(unit = DP) int sizeDp) { return roundedCornersRxPx(Utils.convertDpToPx(mContext, sizeDp)); }
java
@NonNull public IconicsDrawable roundedCornersRxDp(@Dimension(unit = DP) int sizeDp) { return roundedCornersRxPx(Utils.convertDpToPx(mContext, sizeDp)); }
[ "@", "NonNull", "public", "IconicsDrawable", "roundedCornersRxDp", "(", "@", "Dimension", "(", "unit", "=", "DP", ")", "int", "sizeDp", ")", "{", "return", "roundedCornersRxPx", "(", "Utils", ".", "convertDpToPx", "(", "mContext", ",", "sizeDp", ")", ")", ";...
Set rounded corner from dp @return The current IconicsDrawable for chaining.
[ "Set", "rounded", "corner", "from", "dp" ]
train
https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L912-L915
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java
SeleniumHelper.doInCurrentContext
public <R> R doInCurrentContext(Function<SearchContext, ? extends R> function) { try { return function.apply(getCurrentContext()); } catch (WebDriverException e) { if (isStaleElementException(e)) { // current context was no good to search in currentContextIsStale = true; // by getting the context we trigger explicit exception getCurrentContext(); } throw e; } }
java
public <R> R doInCurrentContext(Function<SearchContext, ? extends R> function) { try { return function.apply(getCurrentContext()); } catch (WebDriverException e) { if (isStaleElementException(e)) { // current context was no good to search in currentContextIsStale = true; // by getting the context we trigger explicit exception getCurrentContext(); } throw e; } }
[ "public", "<", "R", ">", "R", "doInCurrentContext", "(", "Function", "<", "SearchContext", ",", "?", "extends", "R", ">", "function", ")", "{", "try", "{", "return", "function", ".", "apply", "(", "getCurrentContext", "(", ")", ")", ";", "}", "catch", ...
Perform action/supplier in current context. @param function function to perform. @param <R> type of result. @return function result. @throws StaleContextException if function threw stale element exception (i.e. current context could not be used)
[ "Perform", "action", "/", "supplier", "in", "current", "context", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/SeleniumHelper.java#L749-L761
mgormley/prim
src/main/java/edu/jhu/prim/util/math/FastMath.java
FastMath.logSubtractExact
public static double logSubtractExact(double x, double y) { if (x < y) { throw new IllegalStateException("x must be >= y. x=" + x + " y=" + y); } // p = 0 or q = 0, where x = log(p), y = log(q) if (Double.NEGATIVE_INFINITY == y) { return x; } else if (Double.NEGATIVE_INFINITY == x) { return y; } else if (x == y) { return Double.NEGATIVE_INFINITY; } // p != 0 && q != 0 //return x + Math.log1p(-FastMath.exp(y - x)); // // The method below is more numerically stable for small differences in x and y. // See paper: http://cran.r-project.org/web/packages/Rmpfr/vignettes/log1mexp-note.pdf return x + log1mexp(x - y); }
java
public static double logSubtractExact(double x, double y) { if (x < y) { throw new IllegalStateException("x must be >= y. x=" + x + " y=" + y); } // p = 0 or q = 0, where x = log(p), y = log(q) if (Double.NEGATIVE_INFINITY == y) { return x; } else if (Double.NEGATIVE_INFINITY == x) { return y; } else if (x == y) { return Double.NEGATIVE_INFINITY; } // p != 0 && q != 0 //return x + Math.log1p(-FastMath.exp(y - x)); // // The method below is more numerically stable for small differences in x and y. // See paper: http://cran.r-project.org/web/packages/Rmpfr/vignettes/log1mexp-note.pdf return x + log1mexp(x - y); }
[ "public", "static", "double", "logSubtractExact", "(", "double", "x", ",", "double", "y", ")", "{", "if", "(", "x", "<", "y", ")", "{", "throw", "new", "IllegalStateException", "(", "\"x must be >= y. x=\"", "+", "x", "+", "\" y=\"", "+", "y", ")", ";", ...
Subtracts two probabilities that are stored as log probabilities. Note that x >= y. @param x log(p) @param y log(q) @return log(p - q) = log(exp(p) - exp(q)) @throws IllegalStateException if x < y
[ "Subtracts", "two", "probabilities", "that", "are", "stored", "as", "log", "probabilities", ".", "Note", "that", "x", ">", "=", "y", "." ]
train
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/util/math/FastMath.java#L82-L102
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/variant/VariantUtils.java
VariantUtils.getVariantKey
public static String getVariantKey(Map<String, String> variants) { String variantKey = ""; if (variants != null) { variantKey = getVariantKey(variants, variants.keySet()); } return variantKey; }
java
public static String getVariantKey(Map<String, String> variants) { String variantKey = ""; if (variants != null) { variantKey = getVariantKey(variants, variants.keySet()); } return variantKey; }
[ "public", "static", "String", "getVariantKey", "(", "Map", "<", "String", ",", "String", ">", "variants", ")", "{", "String", "variantKey", "=", "\"\"", ";", "if", "(", "variants", "!=", "null", ")", "{", "variantKey", "=", "getVariantKey", "(", "variants"...
Returns the variant key from the variants given in parameter @param variants the variants @return the variant key
[ "Returns", "the", "variant", "key", "from", "the", "variants", "given", "in", "parameter" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/variant/VariantUtils.java#L191-L199
powermock/powermock
powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java
Whitebox.setInternalStateFromContext
public static void setInternalStateFromContext(Object instance, Object context, Object... additionalContexts) { WhiteboxImpl.setInternalStateFromContext(instance, context, additionalContexts); }
java
public static void setInternalStateFromContext(Object instance, Object context, Object... additionalContexts) { WhiteboxImpl.setInternalStateFromContext(instance, context, additionalContexts); }
[ "public", "static", "void", "setInternalStateFromContext", "(", "Object", "instance", ",", "Object", "context", ",", "Object", "...", "additionalContexts", ")", "{", "WhiteboxImpl", ".", "setInternalStateFromContext", "(", "instance", ",", "context", ",", "additionalC...
Set the values of multiple instance fields defined in a context using reflection. The values in the context will be assigned to values on the {@code instance}. This method will traverse the class hierarchy when searching for the fields. Example usage: <p> Given: <pre> public class MyContext { private String myString = &quot;myString&quot;; protected int myInt = 9; } public class MyInstance { private String myInstanceString; private int myInstanceInt; } </pre> then <pre> Whitebox.setInternalStateFromContext(new MyInstance(), new MyContext()); </pre> will set the instance variables of {@code myInstance} to the values specified in {@code MyContext}. <p> By default the {@link FieldMatchingStrategy#MATCHING} strategy is used which means that the fields defined in the context but not found in the <code>classOrInstance</code> are silently ignored. @param instance the object whose fields to modify. @param context The context where the fields are defined. @param additionalContexts Optionally more additional contexts.
[ "Set", "the", "values", "of", "multiple", "instance", "fields", "defined", "in", "a", "context", "using", "reflection", ".", "The", "values", "in", "the", "context", "will", "be", "assigned", "to", "values", "on", "the", "{", "@code", "instance", "}", ".",...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L733-L735
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/feature/FeatureSearchServiceImpl.java
FeatureSearchServiceImpl.searchById
public void searchById(final FeaturesSupported layer, final String[] ids, final FeatureArrayCallback callback) { Layer<?> gwtLayer = map.getMapWidget().getMapModel().getLayer(layer.getId()); if (gwtLayer != null && gwtLayer instanceof VectorLayer) { VectorLayer vLayer = (VectorLayer) gwtLayer; SearchCriterion[] criteria = new SearchCriterion[ids.length]; for (int i = 0; i < ids.length; i++) { criteria[i] = new SearchCriterion(SearchFeatureRequest.ID_ATTRIBUTE, "=", ids[i]); } SearchFeatureRequest request = new SearchFeatureRequest(); request.setBooleanOperator("OR"); request.setCrs(map.getMapWidget().getMapModel().getCrs()); request.setLayerId(vLayer.getServerLayerId()); request.setMax(ids.length); request.setFilter(layer.getFilter()); request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL); request.setCriteria(criteria); GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SearchFeatureResponse>() { public void execute(SearchFeatureResponse response) { if (response.getFeatures() != null && response.getFeatures().length > 0) { Feature[] features = new Feature[response.getFeatures().length]; for (int i = 0; i < response.getFeatures().length; i++) { features[i] = new FeatureImpl(response.getFeatures()[i], layer); } callback.execute(new FeatureArrayHolder(features)); } } }); } }
java
public void searchById(final FeaturesSupported layer, final String[] ids, final FeatureArrayCallback callback) { Layer<?> gwtLayer = map.getMapWidget().getMapModel().getLayer(layer.getId()); if (gwtLayer != null && gwtLayer instanceof VectorLayer) { VectorLayer vLayer = (VectorLayer) gwtLayer; SearchCriterion[] criteria = new SearchCriterion[ids.length]; for (int i = 0; i < ids.length; i++) { criteria[i] = new SearchCriterion(SearchFeatureRequest.ID_ATTRIBUTE, "=", ids[i]); } SearchFeatureRequest request = new SearchFeatureRequest(); request.setBooleanOperator("OR"); request.setCrs(map.getMapWidget().getMapModel().getCrs()); request.setLayerId(vLayer.getServerLayerId()); request.setMax(ids.length); request.setFilter(layer.getFilter()); request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_ALL); request.setCriteria(criteria); GwtCommand command = new GwtCommand(SearchFeatureRequest.COMMAND); command.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(command, new AbstractCommandCallback<SearchFeatureResponse>() { public void execute(SearchFeatureResponse response) { if (response.getFeatures() != null && response.getFeatures().length > 0) { Feature[] features = new Feature[response.getFeatures().length]; for (int i = 0; i < response.getFeatures().length; i++) { features[i] = new FeatureImpl(response.getFeatures()[i], layer); } callback.execute(new FeatureArrayHolder(features)); } } }); } }
[ "public", "void", "searchById", "(", "final", "FeaturesSupported", "layer", ",", "final", "String", "[", "]", "ids", ",", "final", "FeatureArrayCallback", "callback", ")", "{", "Layer", "<", "?", ">", "gwtLayer", "=", "map", ".", "getMapWidget", "(", ")", ...
Search features within a certain layer, using the feature IDs. @param layer The features supported layer wherein to search. @param ids The unique IDs of the feature within the layer. @param callback Call-back method executed on return (when the feature has been found).
[ "Search", "features", "within", "a", "certain", "layer", "using", "the", "feature", "IDs", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/feature/FeatureSearchServiceImpl.java#L71-L104
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/FileUtilities.java
FileUtilities.deleteDirContents
public static boolean deleteDirContents(final File dir) { if (dir.isDirectory()) { final String[] children = dir.list(); for (final String aChildren : children) { final File child = new File(dir, aChildren); if (child.isDirectory()) { // Delete the sub directories if (!deleteDir(child)) { return false; } } else { // Delete a single file in the directory if (!child.delete()) { return false; } } } } return true; }
java
public static boolean deleteDirContents(final File dir) { if (dir.isDirectory()) { final String[] children = dir.list(); for (final String aChildren : children) { final File child = new File(dir, aChildren); if (child.isDirectory()) { // Delete the sub directories if (!deleteDir(child)) { return false; } } else { // Delete a single file in the directory if (!child.delete()) { return false; } } } } return true; }
[ "public", "static", "boolean", "deleteDirContents", "(", "final", "File", "dir", ")", "{", "if", "(", "dir", ".", "isDirectory", "(", ")", ")", "{", "final", "String", "[", "]", "children", "=", "dir", ".", "list", "(", ")", ";", "for", "(", "final",...
Delete the contents of a directory and all of its sub directories/files @param dir The directory whose content is to be deleted. @return True if the directories contents were deleted otherwise false if an error occurred.
[ "Delete", "the", "contents", "of", "a", "directory", "and", "all", "of", "its", "sub", "directories", "/", "files" ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/FileUtilities.java#L195-L214
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java
BitfinexApiCallbackListeners.onTickEvent
public Closeable onTickEvent(final BiConsumer<BitfinexTickerSymbol, BitfinexTick> listener) { tickConsumers.offer(listener); return () -> tickConsumers.remove(listener); }
java
public Closeable onTickEvent(final BiConsumer<BitfinexTickerSymbol, BitfinexTick> listener) { tickConsumers.offer(listener); return () -> tickConsumers.remove(listener); }
[ "public", "Closeable", "onTickEvent", "(", "final", "BiConsumer", "<", "BitfinexTickerSymbol", ",", "BitfinexTick", ">", "listener", ")", "{", "tickConsumers", ".", "offer", "(", "listener", ")", ";", "return", "(", ")", "->", "tickConsumers", ".", "remove", "...
registers listener for tick events @param listener of event @return hook of this listener
[ "registers", "listener", "for", "tick", "events" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexApiCallbackListeners.java#L188-L191
aws/aws-sdk-java
aws-java-sdk-codestar/src/main/java/com/amazonaws/services/codestar/model/TagProjectResult.java
TagProjectResult.withTags
public TagProjectResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public TagProjectResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "TagProjectResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags for the project. </p> @param tags The tags for the project. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "for", "the", "project", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-codestar/src/main/java/com/amazonaws/services/codestar/model/TagProjectResult.java#L68-L71
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java
SphereUtil.cosineOrHaversineDeg
public static double cosineOrHaversineDeg(double lat1, double lon1, double lat2, double lon2) { return cosineOrHaversineRad(deg2rad(lat1), deg2rad(lon1), deg2rad(lat2), deg2rad(lon2)); }
java
public static double cosineOrHaversineDeg(double lat1, double lon1, double lat2, double lon2) { return cosineOrHaversineRad(deg2rad(lat1), deg2rad(lon1), deg2rad(lat2), deg2rad(lon2)); }
[ "public", "static", "double", "cosineOrHaversineDeg", "(", "double", "lat1", ",", "double", "lon1", ",", "double", "lat2", ",", "double", "lon2", ")", "{", "return", "cosineOrHaversineRad", "(", "deg2rad", "(", "lat1", ")", ",", "deg2rad", "(", "lon1", ")", ...
Use cosine or haversine dynamically. Complexity: 4-5 trigonometric functions, 1 sqrt. @param lat1 Latitude of first point in degree @param lon1 Longitude of first point in degree @param lat2 Latitude of second point in degree @param lon2 Longitude of second point in degree @return Distance on unit sphere
[ "Use", "cosine", "or", "haversine", "dynamically", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L200-L202
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.incorrectMethodDefinition
public static void incorrectMethodDefinition(String methodName, String className){ throw new DynamicConversionMethodException(MSG.INSTANCE.message(dynamicConversionMethodException,methodName,className)); }
java
public static void incorrectMethodDefinition(String methodName, String className){ throw new DynamicConversionMethodException(MSG.INSTANCE.message(dynamicConversionMethodException,methodName,className)); }
[ "public", "static", "void", "incorrectMethodDefinition", "(", "String", "methodName", ",", "String", "className", ")", "{", "throw", "new", "DynamicConversionMethodException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "dynamicConversionMethodException", ",", "...
Thrown when the method don't respects the convetions beloging to the dynamic conversion implementation. @param methodName method name @param className class name
[ "Thrown", "when", "the", "method", "don", "t", "respects", "the", "convetions", "beloging", "to", "the", "dynamic", "conversion", "implementation", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L222-L224
pravega/pravega
controller/src/main/java/io/pravega/controller/store/stream/records/RecordHelper.java
RecordHelper.validateStreamCut
public static void validateStreamCut(List<Map.Entry<Double, Double>> streamCutSegments) { // verify that stream cut covers the entire range of 0.0 to 1.0 keyspace without overlaps. List<Map.Entry<Double, Double>> reduced = reduce(streamCutSegments); Exceptions.checkArgument(reduced.size() == 1 && reduced.get(0).getKey().equals(0.0) && reduced.get(0).getValue().equals(1.0), "streamCut", " Invalid input, Stream Cut does not cover full key range."); }
java
public static void validateStreamCut(List<Map.Entry<Double, Double>> streamCutSegments) { // verify that stream cut covers the entire range of 0.0 to 1.0 keyspace without overlaps. List<Map.Entry<Double, Double>> reduced = reduce(streamCutSegments); Exceptions.checkArgument(reduced.size() == 1 && reduced.get(0).getKey().equals(0.0) && reduced.get(0).getValue().equals(1.0), "streamCut", " Invalid input, Stream Cut does not cover full key range."); }
[ "public", "static", "void", "validateStreamCut", "(", "List", "<", "Map", ".", "Entry", "<", "Double", ",", "Double", ">", ">", "streamCutSegments", ")", "{", "// verify that stream cut covers the entire range of 0.0 to 1.0 keyspace without overlaps.", "List", "<", "Map",...
Method to validate a given stream Cut. A stream cut is valid if it covers the entire key space without any overlaps in ranges for segments that form the streamcut. It throws {@link IllegalArgumentException} if the supplied stream cut does not satisfy the invariants. @param streamCutSegments supplied stream cut.
[ "Method", "to", "validate", "a", "given", "stream", "Cut", ".", "A", "stream", "cut", "is", "valid", "if", "it", "covers", "the", "entire", "key", "space", "without", "any", "overlaps", "in", "ranges", "for", "segments", "that", "form", "the", "streamcut",...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/records/RecordHelper.java#L174-L180
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.findByUUID_G
@Override public CommerceCountry findByUUID_G(String uuid, long groupId) throws NoSuchCountryException { CommerceCountry commerceCountry = fetchByUUID_G(uuid, groupId); if (commerceCountry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCountryException(msg.toString()); } return commerceCountry; }
java
@Override public CommerceCountry findByUUID_G(String uuid, long groupId) throws NoSuchCountryException { CommerceCountry commerceCountry = fetchByUUID_G(uuid, groupId); if (commerceCountry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCountryException(msg.toString()); } return commerceCountry; }
[ "@", "Override", "public", "CommerceCountry", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCountryException", "{", "CommerceCountry", "commerceCountry", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", "(",...
Returns the commerce country where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCountryException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce country @throws NoSuchCountryException if a matching commerce country could not be found
[ "Returns", "the", "commerce", "country", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCountryException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L666-L692
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/db/record/ODatabaseRecordAbstract.java
ODatabaseRecordAbstract.callbackHooks
public boolean callbackHooks(final TYPE iType, final OIdentifiable id) { if (!OHookThreadLocal.INSTANCE.push(id)) return false; try { final ORecord<?> rec = id.getRecord(); if (rec == null) return false; boolean recordChanged = false; for (ORecordHook hook : hooks) if (hook.onTrigger(iType, rec)) recordChanged = true; return recordChanged; } finally { OHookThreadLocal.INSTANCE.pop(id); } }
java
public boolean callbackHooks(final TYPE iType, final OIdentifiable id) { if (!OHookThreadLocal.INSTANCE.push(id)) return false; try { final ORecord<?> rec = id.getRecord(); if (rec == null) return false; boolean recordChanged = false; for (ORecordHook hook : hooks) if (hook.onTrigger(iType, rec)) recordChanged = true; return recordChanged; } finally { OHookThreadLocal.INSTANCE.pop(id); } }
[ "public", "boolean", "callbackHooks", "(", "final", "TYPE", "iType", ",", "final", "OIdentifiable", "id", ")", "{", "if", "(", "!", "OHookThreadLocal", ".", "INSTANCE", ".", "push", "(", "id", ")", ")", "return", "false", ";", "try", "{", "final", "OReco...
Callback the registeted hooks if any. @param iType @param id Record received in the callback @return True if the input record is changed, otherwise false
[ "Callback", "the", "registeted", "hooks", "if", "any", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/db/record/ODatabaseRecordAbstract.java#L869-L887
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/datastructures/AbstractSearchStructure.java
AbstractSearchStructure.getInternalId
public int getInternalId(String id) { DatabaseEntry key = new DatabaseEntry(); StringBinding.stringToEntry(id, key); DatabaseEntry data = new DatabaseEntry(); // check if the id already exists in id to iid database if ((idToIidDB.get(null, key, data, null) == OperationStatus.SUCCESS)) { return IntegerBinding.entryToInt(data); } else { return -1; } }
java
public int getInternalId(String id) { DatabaseEntry key = new DatabaseEntry(); StringBinding.stringToEntry(id, key); DatabaseEntry data = new DatabaseEntry(); // check if the id already exists in id to iid database if ((idToIidDB.get(null, key, data, null) == OperationStatus.SUCCESS)) { return IntegerBinding.entryToInt(data); } else { return -1; } }
[ "public", "int", "getInternalId", "(", "String", "id", ")", "{", "DatabaseEntry", "key", "=", "new", "DatabaseEntry", "(", ")", ";", "StringBinding", ".", "stringToEntry", "(", "id", ",", "key", ")", ";", "DatabaseEntry", "data", "=", "new", "DatabaseEntry",...
Returns the internal id assigned to the vector with the given id or -1 if the id is not found. Accesses the BDB store! @param id The id of the vector @return The internal id assigned to this vector or -1 if the id is not found.
[ "Returns", "the", "internal", "id", "assigned", "to", "the", "vector", "with", "the", "given", "id", "or", "-", "1", "if", "the", "id", "is", "not", "found", ".", "Accesses", "the", "BDB", "store!" ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/datastructures/AbstractSearchStructure.java#L383-L393
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/config/DefaultMemcachedBucketConfig.java
DefaultMemcachedBucketConfig.calculateKetamaHash
private static long calculateKetamaHash(final byte[] key) { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update(key); byte[] digest = md5.digest(); long rv = ((long) (digest[3] & 0xFF) << 24) | ((long) (digest[2] & 0xFF) << 16) | ((long) (digest[1] & 0xFF) << 8) | (digest[0] & 0xFF); return rv & 0xffffffffL; } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("Could not encode ketama hash.", e); } }
java
private static long calculateKetamaHash(final byte[] key) { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update(key); byte[] digest = md5.digest(); long rv = ((long) (digest[3] & 0xFF) << 24) | ((long) (digest[2] & 0xFF) << 16) | ((long) (digest[1] & 0xFF) << 8) | (digest[0] & 0xFF); return rv & 0xffffffffL; } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("Could not encode ketama hash.", e); } }
[ "private", "static", "long", "calculateKetamaHash", "(", "final", "byte", "[", "]", "key", ")", "{", "try", "{", "MessageDigest", "md5", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "md5", ".", "update", "(", "key", ")", ";", "byte...
Calculates the ketama hash for the given key. @param key the key to calculate. @return the calculated hash.
[ "Calculates", "the", "ketama", "hash", "for", "the", "given", "key", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/config/DefaultMemcachedBucketConfig.java#L144-L157
dihedron/dihedron-commons
src/main/java/org/dihedron/core/reflection/Types.java
Types.isOfClass
public static boolean isOfClass(Type type, Class<?> clazz) { if(isSimple(type)) { logger.trace("simple: {}", ((Class<?>)type)); return ((Class<?>)type) == clazz; } else if(isGeneric(type)) { logger.trace("generic: {}", (((ParameterizedType)type).getRawType())); return (((ParameterizedType)type).getRawType()) == clazz; } return false; }
java
public static boolean isOfClass(Type type, Class<?> clazz) { if(isSimple(type)) { logger.trace("simple: {}", ((Class<?>)type)); return ((Class<?>)type) == clazz; } else if(isGeneric(type)) { logger.trace("generic: {}", (((ParameterizedType)type).getRawType())); return (((ParameterizedType)type).getRawType()) == clazz; } return false; }
[ "public", "static", "boolean", "isOfClass", "(", "Type", "type", ",", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "isSimple", "(", "type", ")", ")", "{", "logger", ".", "trace", "(", "\"simple: {}\"", ",", "(", "(", "Class", "<", "?", ">"...
Checks if the given type and the give class are the same; this check is trivial for simple types (such as <code>java.lang.String</code>), less so for generic types (say, <code>List&lt;String&gt;</code>), whereby the generic (<code>List</code> in the example) is extracted before testing against the other class. @param type the type to be tested. @param clazz the other class.
[ "Checks", "if", "the", "given", "type", "and", "the", "give", "class", "are", "the", "same", ";", "this", "check", "is", "trivial", "for", "simple", "types", "(", "such", "as", "<code", ">", "java", ".", "lang", ".", "String<", "/", "code", ">", ")",...
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/reflection/Types.java#L199-L208
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/xml/XmlIO.java
XmlIO.load
public static AnnotationMappingInfo load(final File file, final String encoding) throws XmlOperateException { ArgUtils.notNull(file, "file"); ArgUtils.notEmpty(encoding, "encoding"); final AnnotationMappingInfo xmlInfo; try(Reader reader = new InputStreamReader(new FileInputStream(file), encoding)) { xmlInfo = load(reader); } catch (IOException e) { throw new XmlOperateException(String.format("fail load xml file '%s'.", file.getPath()), e); } return xmlInfo; }
java
public static AnnotationMappingInfo load(final File file, final String encoding) throws XmlOperateException { ArgUtils.notNull(file, "file"); ArgUtils.notEmpty(encoding, "encoding"); final AnnotationMappingInfo xmlInfo; try(Reader reader = new InputStreamReader(new FileInputStream(file), encoding)) { xmlInfo = load(reader); } catch (IOException e) { throw new XmlOperateException(String.format("fail load xml file '%s'.", file.getPath()), e); } return xmlInfo; }
[ "public", "static", "AnnotationMappingInfo", "load", "(", "final", "File", "file", ",", "final", "String", "encoding", ")", "throws", "XmlOperateException", "{", "ArgUtils", ".", "notNull", "(", "file", ",", "\"file\"", ")", ";", "ArgUtils", ".", "notEmpty", "...
XMLファイルを読み込み、{@link AnnotationMappingInfo}として取得する。 @param file 読み込むファイル @param encoding 読み込むファイルの文字コード @return @throws XmlOperateException XMLの読み込みに失敗した場合。 @throws IllegalArgumentException file is null or encoding is empty.
[ "XMLファイルを読み込み、", "{" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/XmlIO.java#L84-L98
jcustenborder/connect-utils
connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java
ConfigUtils.getAbsoluteFile
public static File getAbsoluteFile(AbstractConfig config, String key) { Preconditions.checkNotNull(config, "config cannot be null"); String path = config.getString(key); File file = new File(path); if (!file.isAbsolute()) { throw new ConfigException( key, path, "Must be an absolute path." ); } return new File(path); }
java
public static File getAbsoluteFile(AbstractConfig config, String key) { Preconditions.checkNotNull(config, "config cannot be null"); String path = config.getString(key); File file = new File(path); if (!file.isAbsolute()) { throw new ConfigException( key, path, "Must be an absolute path." ); } return new File(path); }
[ "public", "static", "File", "getAbsoluteFile", "(", "AbstractConfig", "config", ",", "String", "key", ")", "{", "Preconditions", ".", "checkNotNull", "(", "config", ",", "\"config cannot be null\"", ")", ";", "String", "path", "=", "config", ".", "getString", "(...
Method is used to return a File checking to ensure that it is an absolute path. @param config config to read the value from @param key key for the value @return File for the config value.
[ "Method", "is", "used", "to", "return", "a", "File", "checking", "to", "ensure", "that", "it", "is", "an", "absolute", "path", "." ]
train
https://github.com/jcustenborder/connect-utils/blob/19add138921f59ffcc85282d7aad551eeb582370/connect-utils/src/main/java/com/github/jcustenborder/kafka/connect/utils/config/ConfigUtils.java#L86-L98
librato/metrics-librato
src/main/java/com/librato/metrics/reporter/DeltaTracker.java
DeltaTracker.getDelta
public Long getDelta(String name, long count) { Long previous = lookup.put(name, count); return calculateDelta(name, previous, count); }
java
public Long getDelta(String name, long count) { Long previous = lookup.put(name, count); return calculateDelta(name, previous, count); }
[ "public", "Long", "getDelta", "(", "String", "name", ",", "long", "count", ")", "{", "Long", "previous", "=", "lookup", ".", "put", "(", "name", ",", "count", ")", ";", "return", "calculateDelta", "(", "name", ",", "previous", ",", "count", ")", ";", ...
Calculates the delta. If this is a new value that has not been seen before, zero will be assumed to be the initial value. Updates the internal map with the supplied count. @param name the name of the counter @param count the counter value @return the delta
[ "Calculates", "the", "delta", ".", "If", "this", "is", "a", "new", "value", "that", "has", "not", "been", "seen", "before", "zero", "will", "be", "assumed", "to", "be", "the", "initial", "value", ".", "Updates", "the", "internal", "map", "with", "the", ...
train
https://github.com/librato/metrics-librato/blob/10713643cf7d80e0f9741a7e1e81d1f6d68dc3f6/src/main/java/com/librato/metrics/reporter/DeltaTracker.java#L62-L65
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java
Dj2JrCrosstabBuilder.registerColumns
private void registerColumns() { for (int i = 0; i < cols.length; i++) { DJCrosstabColumn crosstabColumn = cols[i]; JRDesignCrosstabColumnGroup ctColGroup = new JRDesignCrosstabColumnGroup(); ctColGroup.setName(crosstabColumn.getProperty().getProperty()); ctColGroup.setHeight(crosstabColumn.getHeaderHeight()); JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket(); bucket.setValueClassName(crosstabColumn.getProperty().getValueClassName()); JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabColumn.getProperty().getProperty()+"}", crosstabColumn.getProperty().getValueClassName()); bucket.setExpression(bucketExp); ctColGroup.setBucket(bucket); JRDesignCellContents colHeaerContent = new JRDesignCellContents(); JRDesignTextField colTitle = new JRDesignTextField(); JRDesignExpression colTitleExp = new JRDesignExpression(); colTitleExp.setValueClassName(crosstabColumn.getProperty().getValueClassName()); colTitleExp.setText("$V{"+crosstabColumn.getProperty().getProperty()+"}"); colTitle.setExpression(colTitleExp); colTitle.setWidth(crosstabColumn.getWidth()); colTitle.setHeight(crosstabColumn.getHeaderHeight()); //The height can be the sum of the heights of all the columns starting from the current one, up to the inner most one. int auxWidth = calculateRowHeaderMaxWidth(crosstabColumn); colTitle.setWidth(auxWidth); Style headerstyle = crosstabColumn.getHeaderStyle() == null ? this.djcross.getColumnHeaderStyle(): crosstabColumn.getHeaderStyle(); if (headerstyle != null){ layoutManager.applyStyleToElement(headerstyle,colTitle); colHeaerContent.setBackcolor(headerstyle.getBackgroundColor()); } colHeaerContent.addElement(colTitle); colHeaerContent.setMode( ModeEnum.OPAQUE ); boolean fullBorder = i <= 0; //Only outer most will have full border applyCellBorder(colHeaerContent, fullBorder, false); ctColGroup.setHeader(colHeaerContent); if (crosstabColumn.isShowTotals()) createColumTotalHeader(ctColGroup,crosstabColumn,fullBorder); try { jrcross.addColumnGroup(ctColGroup); } catch (JRException e) { log.error(e.getMessage(),e); } } }
java
private void registerColumns() { for (int i = 0; i < cols.length; i++) { DJCrosstabColumn crosstabColumn = cols[i]; JRDesignCrosstabColumnGroup ctColGroup = new JRDesignCrosstabColumnGroup(); ctColGroup.setName(crosstabColumn.getProperty().getProperty()); ctColGroup.setHeight(crosstabColumn.getHeaderHeight()); JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket(); bucket.setValueClassName(crosstabColumn.getProperty().getValueClassName()); JRDesignExpression bucketExp = ExpressionUtils.createExpression("$F{"+crosstabColumn.getProperty().getProperty()+"}", crosstabColumn.getProperty().getValueClassName()); bucket.setExpression(bucketExp); ctColGroup.setBucket(bucket); JRDesignCellContents colHeaerContent = new JRDesignCellContents(); JRDesignTextField colTitle = new JRDesignTextField(); JRDesignExpression colTitleExp = new JRDesignExpression(); colTitleExp.setValueClassName(crosstabColumn.getProperty().getValueClassName()); colTitleExp.setText("$V{"+crosstabColumn.getProperty().getProperty()+"}"); colTitle.setExpression(colTitleExp); colTitle.setWidth(crosstabColumn.getWidth()); colTitle.setHeight(crosstabColumn.getHeaderHeight()); //The height can be the sum of the heights of all the columns starting from the current one, up to the inner most one. int auxWidth = calculateRowHeaderMaxWidth(crosstabColumn); colTitle.setWidth(auxWidth); Style headerstyle = crosstabColumn.getHeaderStyle() == null ? this.djcross.getColumnHeaderStyle(): crosstabColumn.getHeaderStyle(); if (headerstyle != null){ layoutManager.applyStyleToElement(headerstyle,colTitle); colHeaerContent.setBackcolor(headerstyle.getBackgroundColor()); } colHeaerContent.addElement(colTitle); colHeaerContent.setMode( ModeEnum.OPAQUE ); boolean fullBorder = i <= 0; //Only outer most will have full border applyCellBorder(colHeaerContent, fullBorder, false); ctColGroup.setHeader(colHeaerContent); if (crosstabColumn.isShowTotals()) createColumTotalHeader(ctColGroup,crosstabColumn,fullBorder); try { jrcross.addColumnGroup(ctColGroup); } catch (JRException e) { log.error(e.getMessage(),e); } } }
[ "private", "void", "registerColumns", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cols", ".", "length", ";", "i", "++", ")", "{", "DJCrosstabColumn", "crosstabColumn", "=", "cols", "[", "i", "]", ";", "JRDesignCrosstabColumnGroup", ...
Registers the Columngroup Buckets and creates the header cell for the columns
[ "Registers", "the", "Columngroup", "Buckets", "and", "creates", "the", "header", "cell", "for", "the", "columns" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/Dj2JrCrosstabBuilder.java#L864-L923
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/merge/VariantMerger.java
VariantMerger.mergeNew
public Variant mergeNew(Variant template, Collection<Variant> load) { Variant current = createFromTemplate(template); merge(current, load); return current; }
java
public Variant mergeNew(Variant template, Collection<Variant> load) { Variant current = createFromTemplate(template); merge(current, load); return current; }
[ "public", "Variant", "mergeNew", "(", "Variant", "template", ",", "Collection", "<", "Variant", ">", "load", ")", "{", "Variant", "current", "=", "createFromTemplate", "(", "template", ")", ";", "merge", "(", "current", ",", "load", ")", ";", "return", "cu...
Create and returns a new Variant using the target as a position template ONLY and merges the provided variants for this position. <b> The target is not present in the merged output!!!</b> @param template Template for position and study only @param load Variants to merge for position @return Variant new Variant object with merged information
[ "Create", "and", "returns", "a", "new", "Variant", "using", "the", "target", "as", "a", "position", "template", "ONLY", "and", "merges", "the", "provided", "variants", "for", "this", "position", ".", "<b", ">", "The", "target", "is", "not", "present", "in"...
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/merge/VariantMerger.java#L253-L257
audit4j/audit4j-core
src/main/java/org/audit4j/core/handler/file/FileHandlerUtil.java
FileHandlerUtil.addDate
public static Date addDate(final Date date, final Integer different) { final Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, different); return cal.getTime(); }
java
public static Date addDate(final Date date, final Integer different) { final Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, different); return cal.getTime(); }
[ "public", "static", "Date", "addDate", "(", "final", "Date", "date", ",", "final", "Integer", "different", ")", "{", "final", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "date", ")", ";", "cal", "....
Add days. @param date the date @param different the different @return the date
[ "Add", "days", "." ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/handler/file/FileHandlerUtil.java#L196-L201
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/model/VarConfig.java
VarConfig.getState
public int getState(Var var, int defaultState) { Integer state = config.get(var); if (state == null) { return defaultState; } else { return state; } }
java
public int getState(Var var, int defaultState) { Integer state = config.get(var); if (state == null) { return defaultState; } else { return state; } }
[ "public", "int", "getState", "(", "Var", "var", ",", "int", "defaultState", ")", "{", "Integer", "state", "=", "config", ".", "get", "(", "var", ")", ";", "if", "(", "state", "==", "null", ")", "{", "return", "defaultState", ";", "}", "else", "{", ...
Gets the state (in this config) for a given variable if it exists, or the default otherwise.
[ "Gets", "the", "state", "(", "in", "this", "config", ")", "for", "a", "given", "variable", "if", "it", "exists", "or", "the", "default", "otherwise", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/VarConfig.java#L118-L125
calrissian/mango
mango-criteria/src/main/java/org/calrissian/mango/criteria/support/NodeUtils.java
NodeUtils.criteriaFromNode
public static Criteria criteriaFromNode(Node node, Comparator rangeComparator) { return criteriaFromNode(node, rangeComparator, null); }
java
public static Criteria criteriaFromNode(Node node, Comparator rangeComparator) { return criteriaFromNode(node, rangeComparator, null); }
[ "public", "static", "Criteria", "criteriaFromNode", "(", "Node", "node", ",", "Comparator", "rangeComparator", ")", "{", "return", "criteriaFromNode", "(", "node", ",", "rangeComparator", ",", "null", ")", ";", "}" ]
Creates criteria from a node. A Comparator is injected into all nodes which need to determine order or equality.
[ "Creates", "criteria", "from", "a", "node", ".", "A", "Comparator", "is", "injected", "into", "all", "nodes", "which", "need", "to", "determine", "order", "or", "equality", "." ]
train
https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-criteria/src/main/java/org/calrissian/mango/criteria/support/NodeUtils.java#L71-L73
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java
GuildWars2.setInstance
public static void setInstance(OkHttpClient client) throws GuildWars2Exception { if (instance != null) throw new GuildWars2Exception(ErrorCode.Other, "Instance already initialized"); instance = new GuildWars2(client); }
java
public static void setInstance(OkHttpClient client) throws GuildWars2Exception { if (instance != null) throw new GuildWars2Exception(ErrorCode.Other, "Instance already initialized"); instance = new GuildWars2(client); }
[ "public", "static", "void", "setInstance", "(", "OkHttpClient", "client", ")", "throws", "GuildWars2Exception", "{", "if", "(", "instance", "!=", "null", ")", "throw", "new", "GuildWars2Exception", "(", "ErrorCode", ".", "Other", ",", "\"Instance already initialized...
You need to call {@link #setInstance(Cache)} to create instance with custom caching<br/> This method will create instance with your custom Client @param client your custom client
[ "You", "need", "to", "call", "{" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java#L62-L66
Whiley/WhileyCompiler
src/main/java/wyil/check/FlowTypeCheck.java
FlowTypeCheck.checkDoWhile
private Environment checkDoWhile(Stmt.DoWhile stmt, Environment environment, EnclosingScope scope) { // Type check loop body environment = checkBlock(stmt.getBody(), environment, scope); // Type check invariants checkConditions(stmt.getInvariant(), true, environment); // Determine and update modified variables Tuple<Decl.Variable> modified = FlowTypeUtils.determineModifiedVariables(stmt.getBody()); stmt.setModified(stmt.getHeap().allocate(modified)); // Type condition assuming its false to represent the terminated loop. // This is important if the condition contains a type test, as we'll // know that doesn't hold here. return checkCondition(stmt.getCondition(), false, environment); }
java
private Environment checkDoWhile(Stmt.DoWhile stmt, Environment environment, EnclosingScope scope) { // Type check loop body environment = checkBlock(stmt.getBody(), environment, scope); // Type check invariants checkConditions(stmt.getInvariant(), true, environment); // Determine and update modified variables Tuple<Decl.Variable> modified = FlowTypeUtils.determineModifiedVariables(stmt.getBody()); stmt.setModified(stmt.getHeap().allocate(modified)); // Type condition assuming its false to represent the terminated loop. // This is important if the condition contains a type test, as we'll // know that doesn't hold here. return checkCondition(stmt.getCondition(), false, environment); }
[ "private", "Environment", "checkDoWhile", "(", "Stmt", ".", "DoWhile", "stmt", ",", "Environment", "environment", ",", "EnclosingScope", "scope", ")", "{", "// Type check loop body", "environment", "=", "checkBlock", "(", "stmt", ".", "getBody", "(", ")", ",", "...
Type check a do-while statement. @param stmt Statement to type check @param environment Determines the type of all variables immediately going into this block @return @throws ResolveError If a named type within this statement cannot be resolved within the enclosing project.
[ "Type", "check", "a", "do", "-", "while", "statement", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L518-L530
wcm-io/wcm-io-tooling
netbeans/sightly/src/main/java/io/wcm/tooling/netbeans/sightly/completion/classLookup/MemberLookupCompleter.java
MemberLookupCompleter.resolveClass
private Set<String> resolveClass(String variableName, String text, Document document) { Set<String> items = new LinkedHashSet<>(); FileObject fo = getFileObject(document); ClassPath sourcePath = ClassPath.getClassPath(fo, ClassPath.SOURCE); ClassPath compilePath = ClassPath.getClassPath(fo, ClassPath.COMPILE); ClassPath bootPath = ClassPath.getClassPath(fo, ClassPath.BOOT); if (sourcePath == null) { return items; } ClassPath cp = ClassPathSupport.createProxyClassPath(sourcePath, compilePath, bootPath); MemberLookupResolver resolver = new MemberLookupResolver(text, cp); Set<MemberLookupResult> results = resolver.performMemberLookup(StringUtils.defaultString(StringUtils.substringBeforeLast(variableName, "."), variableName)); for (MemberLookupResult result : results) { Matcher m = GETTER_PATTERN.matcher(result.getMethodName()); if (m.matches() && m.groupCount() >= 2) { items.add(result.getVariableName() + "." + WordUtils.uncapitalize(m.group(2))); } else { items.add(result.getVariableName() + "." + WordUtils.uncapitalize(result.getMethodName())); } } return items; }
java
private Set<String> resolveClass(String variableName, String text, Document document) { Set<String> items = new LinkedHashSet<>(); FileObject fo = getFileObject(document); ClassPath sourcePath = ClassPath.getClassPath(fo, ClassPath.SOURCE); ClassPath compilePath = ClassPath.getClassPath(fo, ClassPath.COMPILE); ClassPath bootPath = ClassPath.getClassPath(fo, ClassPath.BOOT); if (sourcePath == null) { return items; } ClassPath cp = ClassPathSupport.createProxyClassPath(sourcePath, compilePath, bootPath); MemberLookupResolver resolver = new MemberLookupResolver(text, cp); Set<MemberLookupResult> results = resolver.performMemberLookup(StringUtils.defaultString(StringUtils.substringBeforeLast(variableName, "."), variableName)); for (MemberLookupResult result : results) { Matcher m = GETTER_PATTERN.matcher(result.getMethodName()); if (m.matches() && m.groupCount() >= 2) { items.add(result.getVariableName() + "." + WordUtils.uncapitalize(m.group(2))); } else { items.add(result.getVariableName() + "." + WordUtils.uncapitalize(result.getMethodName())); } } return items; }
[ "private", "Set", "<", "String", ">", "resolveClass", "(", "String", "variableName", ",", "String", "text", ",", "Document", "document", ")", "{", "Set", "<", "String", ">", "items", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "FileObject", "fo", "...
This method tries to find the class which is defined for the given filter and returns a set with all methods and fields of the class @param variableName @param text @param document @return Set of methods and fields, never null
[ "This", "method", "tries", "to", "find", "the", "class", "which", "is", "defined", "for", "the", "given", "filter", "and", "returns", "a", "set", "with", "all", "methods", "and", "fields", "of", "the", "class" ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/netbeans/sightly/src/main/java/io/wcm/tooling/netbeans/sightly/completion/classLookup/MemberLookupCompleter.java#L117-L139
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/Table.java
Table.sampleX
public Table sampleX(double proportion) { Preconditions.checkArgument(proportion <= 1 && proportion >= 0, "The sample proportion must be between 0 and 1"); int tableSize = (int) Math.round(rowCount() * proportion); return where(selectNRowsAtRandom(tableSize, rowCount())); }
java
public Table sampleX(double proportion) { Preconditions.checkArgument(proportion <= 1 && proportion >= 0, "The sample proportion must be between 0 and 1"); int tableSize = (int) Math.round(rowCount() * proportion); return where(selectNRowsAtRandom(tableSize, rowCount())); }
[ "public", "Table", "sampleX", "(", "double", "proportion", ")", "{", "Preconditions", ".", "checkArgument", "(", "proportion", "<=", "1", "&&", "proportion", ">=", "0", ",", "\"The sample proportion must be between 0 and 1\"", ")", ";", "int", "tableSize", "=", "(...
Returns a table consisting of randomly selected records from this table. The sample size is based on the given proportion @param proportion The proportion to go in the sample
[ "Returns", "a", "table", "consisting", "of", "randomly", "selected", "records", "from", "this", "table", ".", "The", "sample", "size", "is", "based", "on", "the", "given", "proportion" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/Table.java#L464-L470
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java
PnPInfinitesimalPlanePoseEstimation.estimateTranslation
void estimateTranslation( DMatrixRMaj R , List<AssociatedPair> points , Vector3D_F64 T ) { final int N = points.size(); W.reshape(N*2,3); y.reshape(N*2,1); Wty.reshape(3,1); DMatrix3x3 Rtmp = new DMatrix3x3(); ConvertDMatrixStruct.convert(R,Rtmp); int indexY = 0,indexW = 0; for (int i = 0; i < N; i++) { AssociatedPair p = points.get(i); // rotate into camera frame double u1 = Rtmp.a11*p.p1.x + Rtmp.a12*p.p1.y; double u2 = Rtmp.a21*p.p1.x + Rtmp.a22*p.p1.y; double u3 = Rtmp.a31*p.p1.x + Rtmp.a32*p.p1.y; W.data[indexW++] = 1; W.data[indexW++] = 0; W.data[indexW++] = -p.p2.x; W.data[indexW++] = 0; W.data[indexW++] = 1; W.data[indexW++] = -p.p2.y; y.data[indexY++] = p.p2.x*u3 - u1; y.data[indexY++] = p.p2.y*u3 - u2; } //======= Compute Pseudo Inverse // WW = inv(W^T*W) CommonOps_DDRM.multTransA(W,W,WW); CommonOps_DDRM.invert(WW); // W^T*y CommonOps_DDRM.multTransA(W,y,Wty); // translation = inv(W^T*W)*W^T*y W.reshape(3,1); CommonOps_DDRM.mult(WW,Wty,W); T.x = W.data[0]; T.y = W.data[1]; T.z = W.data[2]; }
java
void estimateTranslation( DMatrixRMaj R , List<AssociatedPair> points , Vector3D_F64 T ) { final int N = points.size(); W.reshape(N*2,3); y.reshape(N*2,1); Wty.reshape(3,1); DMatrix3x3 Rtmp = new DMatrix3x3(); ConvertDMatrixStruct.convert(R,Rtmp); int indexY = 0,indexW = 0; for (int i = 0; i < N; i++) { AssociatedPair p = points.get(i); // rotate into camera frame double u1 = Rtmp.a11*p.p1.x + Rtmp.a12*p.p1.y; double u2 = Rtmp.a21*p.p1.x + Rtmp.a22*p.p1.y; double u3 = Rtmp.a31*p.p1.x + Rtmp.a32*p.p1.y; W.data[indexW++] = 1; W.data[indexW++] = 0; W.data[indexW++] = -p.p2.x; W.data[indexW++] = 0; W.data[indexW++] = 1; W.data[indexW++] = -p.p2.y; y.data[indexY++] = p.p2.x*u3 - u1; y.data[indexY++] = p.p2.y*u3 - u2; } //======= Compute Pseudo Inverse // WW = inv(W^T*W) CommonOps_DDRM.multTransA(W,W,WW); CommonOps_DDRM.invert(WW); // W^T*y CommonOps_DDRM.multTransA(W,y,Wty); // translation = inv(W^T*W)*W^T*y W.reshape(3,1); CommonOps_DDRM.mult(WW,Wty,W); T.x = W.data[0]; T.y = W.data[1]; T.z = W.data[2]; }
[ "void", "estimateTranslation", "(", "DMatrixRMaj", "R", ",", "List", "<", "AssociatedPair", ">", "points", ",", "Vector3D_F64", "T", ")", "{", "final", "int", "N", "=", "points", ".", "size", "(", ")", ";", "W", ".", "reshape", "(", "N", "*", "2", ",...
Estimate's the translation given the previously found rotation @param R Rotation matrix @param T (Output) estimated translation
[ "Estimate", "s", "the", "translation", "given", "the", "previously", "found", "rotation" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PnPInfinitesimalPlanePoseEstimation.java#L213-L258
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RepositoryApi.java
RepositoryApi.getRepositoryArchive
public InputStream getRepositoryArchive(Object projectIdOrPath, String sha, String format) throws GitLabApiException { ArchiveFormat archiveFormat = ArchiveFormat.forValue(format); return (getRepositoryArchive(projectIdOrPath, sha, archiveFormat)); }
java
public InputStream getRepositoryArchive(Object projectIdOrPath, String sha, String format) throws GitLabApiException { ArchiveFormat archiveFormat = ArchiveFormat.forValue(format); return (getRepositoryArchive(projectIdOrPath, sha, archiveFormat)); }
[ "public", "InputStream", "getRepositoryArchive", "(", "Object", "projectIdOrPath", ",", "String", "sha", ",", "String", "format", ")", "throws", "GitLabApiException", "{", "ArchiveFormat", "archiveFormat", "=", "ArchiveFormat", ".", "forValue", "(", "format", ")", "...
Get an archive of the complete repository by SHA (optional). <pre><code>GitLab Endpoint: GET /projects/:id/repository/archive</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param sha the SHA of the archive to get @param format The archive format, defaults to "tar.gz" if null @return an input stream that can be used to save as a file or to read the content of the archive @throws GitLabApiException if format is not a valid archive format or any exception occurs
[ "Get", "an", "archive", "of", "the", "complete", "repository", "by", "SHA", "(", "optional", ")", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryApi.java#L537-L540
awin/rabbiteasy
rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/ConsumerContainer.java
ConsumerContainer.addConsumer
public synchronized void addConsumer(Consumer consumer, ConsumerConfiguration configuration, int instances) { for (int i=0; i < instances; i++) { this.consumerHolders.add(new ConsumerHolder(consumer, configuration)); } }
java
public synchronized void addConsumer(Consumer consumer, ConsumerConfiguration configuration, int instances) { for (int i=0; i < instances; i++) { this.consumerHolders.add(new ConsumerHolder(consumer, configuration)); } }
[ "public", "synchronized", "void", "addConsumer", "(", "Consumer", "consumer", ",", "ConsumerConfiguration", "configuration", ",", "int", "instances", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "instances", ";", "i", "++", ")", "{", "this", ...
Adds a consumer to the container and configures it according to the consumer configuration. Does NOT enable the consumer to consume from the message broker until the container is started. <p>Registers the same consumer N times at the queue according to the number of specified instances. Use this for scaling your consumers locally. Be aware that the consumer implementation must be stateless or thread safe.</p> @param consumer The consumer @param configuration The consumer configuration @param instances the amount of consumer instances
[ "Adds", "a", "consumer", "to", "the", "container", "and", "configures", "it", "according", "to", "the", "consumer", "configuration", ".", "Does", "NOT", "enable", "the", "consumer", "to", "consume", "from", "the", "message", "broker", "until", "the", "containe...
train
https://github.com/awin/rabbiteasy/blob/c161efda6c0f7ef319aedf09dfe40a4a90165510/rabbiteasy-core/src/main/java/com/zanox/rabbiteasy/consumer/ConsumerContainer.java#L155-L159
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/JavaTypeAnalyzer.java
JavaTypeAnalyzer.isRelevant
private static boolean isRelevant(final Method method, final XmlAccessType accessType) { if (method.isSynthetic() || !isGetter(method)) return false; final boolean propertyIgnored = ignoredFieldNames.contains(extractPropertyName(method.getName())); if (propertyIgnored || hasIgnoreAnnotation(method) || isTypeIgnored(method.getReturnType())) { return false; } if (isAnnotationPresent(method, XmlElement.class)) return true; if (accessType == XmlAccessType.PROPERTY) return !isAnnotationPresent(method, XmlTransient.class); else if (accessType == XmlAccessType.PUBLIC_MEMBER) return Modifier.isPublic(method.getModifiers()) && !isAnnotationPresent(method, XmlTransient.class); return false; }
java
private static boolean isRelevant(final Method method, final XmlAccessType accessType) { if (method.isSynthetic() || !isGetter(method)) return false; final boolean propertyIgnored = ignoredFieldNames.contains(extractPropertyName(method.getName())); if (propertyIgnored || hasIgnoreAnnotation(method) || isTypeIgnored(method.getReturnType())) { return false; } if (isAnnotationPresent(method, XmlElement.class)) return true; if (accessType == XmlAccessType.PROPERTY) return !isAnnotationPresent(method, XmlTransient.class); else if (accessType == XmlAccessType.PUBLIC_MEMBER) return Modifier.isPublic(method.getModifiers()) && !isAnnotationPresent(method, XmlTransient.class); return false; }
[ "private", "static", "boolean", "isRelevant", "(", "final", "Method", "method", ",", "final", "XmlAccessType", "accessType", ")", "{", "if", "(", "method", ".", "isSynthetic", "(", ")", "||", "!", "isGetter", "(", "method", ")", ")", "return", "false", ";"...
Checks if the method is public and non-static and that the method is a Getter. Does not allow methods with ignored names. Does also not take methods annotated with {@link XmlTransient}. @param method The method @return {@code true} if the method should be analyzed further
[ "Checks", "if", "the", "method", "is", "public", "and", "non", "-", "static", "and", "that", "the", "method", "is", "a", "Getter", ".", "Does", "not", "allow", "methods", "with", "ignored", "names", ".", "Does", "also", "not", "take", "methods", "annotat...
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/JavaTypeAnalyzer.java#L175-L193
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsxmlnamespace.java
nsxmlnamespace.get
public static nsxmlnamespace get(nitro_service service, String prefix) throws Exception{ nsxmlnamespace obj = new nsxmlnamespace(); obj.set_prefix(prefix); nsxmlnamespace response = (nsxmlnamespace) obj.get_resource(service); return response; }
java
public static nsxmlnamespace get(nitro_service service, String prefix) throws Exception{ nsxmlnamespace obj = new nsxmlnamespace(); obj.set_prefix(prefix); nsxmlnamespace response = (nsxmlnamespace) obj.get_resource(service); return response; }
[ "public", "static", "nsxmlnamespace", "get", "(", "nitro_service", "service", ",", "String", "prefix", ")", "throws", "Exception", "{", "nsxmlnamespace", "obj", "=", "new", "nsxmlnamespace", "(", ")", ";", "obj", ".", "set_prefix", "(", "prefix", ")", ";", "...
Use this API to fetch nsxmlnamespace resource of given name .
[ "Use", "this", "API", "to", "fetch", "nsxmlnamespace", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsxmlnamespace.java#L297-L302
lagom/lagom
service/javadsl/server/src/main/java/com/lightbend/lagom/javadsl/server/status/Latency.java
Latency.withPercentile999th
public final Latency withPercentile999th(double value) { double newValue = value; return new Latency(this.median, this.percentile98th, this.percentile99th, newValue, this.mean, this.min, this.max); }
java
public final Latency withPercentile999th(double value) { double newValue = value; return new Latency(this.median, this.percentile98th, this.percentile99th, newValue, this.mean, this.min, this.max); }
[ "public", "final", "Latency", "withPercentile999th", "(", "double", "value", ")", "{", "double", "newValue", "=", "value", ";", "return", "new", "Latency", "(", "this", ".", "median", ",", "this", ".", "percentile98th", ",", "this", ".", "percentile99th", ",...
Copy the current immutable object by setting a value for the {@link AbstractLatency#getPercentile999th() percentile999th} attribute. @param value A new value for percentile999th @return A modified copy of the {@code this} object
[ "Copy", "the", "current", "immutable", "object", "by", "setting", "a", "value", "for", "the", "{" ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/server/src/main/java/com/lightbend/lagom/javadsl/server/status/Latency.java#L157-L160
epam/parso
src/main/java/com/epam/parso/DataWriterUtil.java
DataWriterUtil.getRowValues
public static List<String> getRowValues(List<Column> columns, Object[] row, Map<Integer, Format> columnFormatters) throws IOException { return getRowValues(columns, row, DEFAULT_LOCALE, columnFormatters); }
java
public static List<String> getRowValues(List<Column> columns, Object[] row, Map<Integer, Format> columnFormatters) throws IOException { return getRowValues(columns, row, DEFAULT_LOCALE, columnFormatters); }
[ "public", "static", "List", "<", "String", ">", "getRowValues", "(", "List", "<", "Column", ">", "columns", ",", "Object", "[", "]", "row", ",", "Map", "<", "Integer", ",", "Format", ">", "columnFormatters", ")", "throws", "IOException", "{", "return", "...
The method to convert the Objects array that stores data from the sas7bdat file to list of string. @param columns the {@link Column} class variables list that stores columns description from the sas7bdat file. @param row the Objects arrays that stores data from the sas7bdat file. @param columnFormatters the map that stores (@link Column#id) column identifier and the formatter for converting locale-sensitive values stored in this column into string. @return list of String objects that represent data from sas7bdat file. @throws java.io.IOException appears if the output into writer is impossible.
[ "The", "method", "to", "convert", "the", "Objects", "array", "that", "stores", "data", "from", "the", "sas7bdat", "file", "to", "list", "of", "string", "." ]
train
https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L356-L359
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/restli/GobblinServiceFlowConfigResourceHandler.java
GobblinServiceFlowConfigResourceHandler.updateFlowConfig
@Override public UpdateResponse updateFlowConfig(FlowId flowId, FlowConfig flowConfig) throws FlowConfigLoggedException { String flowName = flowId.getFlowName(); String flowGroup = flowId.getFlowGroup(); if (!flowGroup.equals(flowConfig.getId().getFlowGroup()) || !flowName.equals(flowConfig.getId().getFlowName())) { throw new FlowConfigLoggedException(HttpStatus.S_400_BAD_REQUEST, "flowName and flowGroup cannot be changed in update", null); } checkHelixConnection(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE, flowName, flowGroup); try { if (!jobScheduler.isActive() && helixManager.isPresent()) { if (this.flowCatalogLocalCommit) { // We will handle FS I/O locally for load balance before forwarding to remote node. this.localHandler.updateFlowConfig(flowId, flowConfig, false); } forwardMessage(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE, FlowConfigUtils.serializeFlowConfig(flowConfig), flowName, flowGroup); // Do actual work on remote node, directly return success log.info("Forwarding update flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]"); return new UpdateResponse(HttpStatus.S_200_OK); } else { return this.localHandler.updateFlowConfig(flowId, flowConfig); } } catch (IOException e) { throw new FlowConfigLoggedException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Cannot update flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]", e); } }
java
@Override public UpdateResponse updateFlowConfig(FlowId flowId, FlowConfig flowConfig) throws FlowConfigLoggedException { String flowName = flowId.getFlowName(); String flowGroup = flowId.getFlowGroup(); if (!flowGroup.equals(flowConfig.getId().getFlowGroup()) || !flowName.equals(flowConfig.getId().getFlowName())) { throw new FlowConfigLoggedException(HttpStatus.S_400_BAD_REQUEST, "flowName and flowGroup cannot be changed in update", null); } checkHelixConnection(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE, flowName, flowGroup); try { if (!jobScheduler.isActive() && helixManager.isPresent()) { if (this.flowCatalogLocalCommit) { // We will handle FS I/O locally for load balance before forwarding to remote node. this.localHandler.updateFlowConfig(flowId, flowConfig, false); } forwardMessage(ServiceConfigKeys.HELIX_FLOWSPEC_UPDATE, FlowConfigUtils.serializeFlowConfig(flowConfig), flowName, flowGroup); // Do actual work on remote node, directly return success log.info("Forwarding update flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]"); return new UpdateResponse(HttpStatus.S_200_OK); } else { return this.localHandler.updateFlowConfig(flowId, flowConfig); } } catch (IOException e) { throw new FlowConfigLoggedException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, "Cannot update flowConfig [flowName=" + flowName + " flowGroup=" + flowGroup + "]", e); } }
[ "@", "Override", "public", "UpdateResponse", "updateFlowConfig", "(", "FlowId", "flowId", ",", "FlowConfig", "flowConfig", ")", "throws", "FlowConfigLoggedException", "{", "String", "flowName", "=", "flowId", ".", "getFlowName", "(", ")", ";", "String", "flowGroup",...
Updating {@link FlowConfig} should check if current node is active (master). If current node is active, call {@link FlowConfigResourceLocalHandler#updateFlowConfig(FlowId, FlowConfig)} directly. If current node is standby, forward {@link ServiceConfigKeys#HELIX_FLOWSPEC_UPDATE} to active. The remote active will then call {@link FlowConfigResourceLocalHandler#updateFlowConfig(FlowId, FlowConfig)}. Please refer to {@link org.apache.gobblin.service.modules.core.ControllerUserDefinedMessageHandlerFactory} for remote handling. For better I/O load balance, user can enable {@link GobblinServiceFlowConfigResourceHandler#flowCatalogLocalCommit}. The {@link FlowConfig} will be then persisted to {@link org.apache.gobblin.runtime.spec_catalog.FlowCatalog} first before it is forwarded to active node (if current node is standby) for execution.
[ "Updating", "{", "@link", "FlowConfig", "}", "should", "check", "if", "current", "node", "is", "active", "(", "master", ")", ".", "If", "current", "node", "is", "active", "call", "{", "@link", "FlowConfigResourceLocalHandler#updateFlowConfig", "(", "FlowId", "Fl...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/restli/GobblinServiceFlowConfigResourceHandler.java#L135-L169
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/BaseOutputLayer.java
BaseOutputLayer.computeScoreForExamples
@Override public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) { if (input == null || labels == null) throw new IllegalStateException("Cannot calculate score without input and labels " + layerId()); INDArray preOut = preOutput2d(false, workspaceMgr); ILossFunction lossFunction = layerConf().getLossFn(); INDArray scoreArray = lossFunction.computeScoreArray(getLabels2d(workspaceMgr, ArrayType.FF_WORKING_MEM), preOut, layerConf().getActivationFn(), maskArray); if (fullNetRegTerm != 0.0) { scoreArray.addi(fullNetRegTerm); } return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, scoreArray); }
java
@Override public INDArray computeScoreForExamples(double fullNetRegTerm, LayerWorkspaceMgr workspaceMgr) { if (input == null || labels == null) throw new IllegalStateException("Cannot calculate score without input and labels " + layerId()); INDArray preOut = preOutput2d(false, workspaceMgr); ILossFunction lossFunction = layerConf().getLossFn(); INDArray scoreArray = lossFunction.computeScoreArray(getLabels2d(workspaceMgr, ArrayType.FF_WORKING_MEM), preOut, layerConf().getActivationFn(), maskArray); if (fullNetRegTerm != 0.0) { scoreArray.addi(fullNetRegTerm); } return workspaceMgr.leverageTo(ArrayType.ACTIVATIONS, scoreArray); }
[ "@", "Override", "public", "INDArray", "computeScoreForExamples", "(", "double", "fullNetRegTerm", ",", "LayerWorkspaceMgr", "workspaceMgr", ")", "{", "if", "(", "input", "==", "null", "||", "labels", "==", "null", ")", "throw", "new", "IllegalStateException", "("...
Compute the score for each example individually, after labels and input have been set. @param fullNetRegTerm Regularization score term for the entire network (or, 0.0 to not include regularization) @return A column INDArray of shape [numExamples,1], where entry i is the score of the ith example
[ "Compute", "the", "score", "for", "each", "example", "individually", "after", "labels", "and", "input", "have", "been", "set", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/BaseOutputLayer.java#L104-L118
bazaarvoice/emodb
common/astyanax/src/main/java/com/bazaarvoice/emodb/common/cassandra/nio/BufferUtils.java
BufferUtils.getString
public static String getString(ByteBuffer buf, int offset, int length, Charset encoding) { buf = buf.duplicate(); buf.position(buf.position() + offset); if (buf.hasArray()) { return new String(buf.array(), buf.arrayOffset() + buf.position(), length, encoding); } else { byte[] bytes = new byte[length]; buf.get(bytes); return new String(bytes, encoding); } }
java
public static String getString(ByteBuffer buf, int offset, int length, Charset encoding) { buf = buf.duplicate(); buf.position(buf.position() + offset); if (buf.hasArray()) { return new String(buf.array(), buf.arrayOffset() + buf.position(), length, encoding); } else { byte[] bytes = new byte[length]; buf.get(bytes); return new String(bytes, encoding); } }
[ "public", "static", "String", "getString", "(", "ByteBuffer", "buf", ",", "int", "offset", ",", "int", "length", ",", "Charset", "encoding", ")", "{", "buf", "=", "buf", ".", "duplicate", "(", ")", ";", "buf", ".", "position", "(", "buf", ".", "positio...
Converts the specified number of bytes in the buffer and converts them to a String using the specified encoding. Does not move the buffer position.
[ "Converts", "the", "specified", "number", "of", "bytes", "in", "the", "buffer", "and", "converts", "them", "to", "a", "String", "using", "the", "specified", "encoding", ".", "Does", "not", "move", "the", "buffer", "position", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/astyanax/src/main/java/com/bazaarvoice/emodb/common/cassandra/nio/BufferUtils.java#L22-L32
jenkinsci/jenkins
core/src/main/java/hudson/model/queue/WorkUnitContext.java
WorkUnitContext.synchronizeEnd
public void synchronizeEnd(Executor e, Queue.Executable executable, Throwable problems, long duration) throws InterruptedException { endLatch.synchronize(); // the main thread will send a notification WorkUnit wu = e.getCurrentWorkUnit(); if (wu.isMainWork()) { if (problems == null) { future.set(executable); e.getOwner().taskCompleted(e, task, duration); } else { future.set(problems); e.getOwner().taskCompletedWithProblems(e, task, duration, problems); } } }
java
public void synchronizeEnd(Executor e, Queue.Executable executable, Throwable problems, long duration) throws InterruptedException { endLatch.synchronize(); // the main thread will send a notification WorkUnit wu = e.getCurrentWorkUnit(); if (wu.isMainWork()) { if (problems == null) { future.set(executable); e.getOwner().taskCompleted(e, task, duration); } else { future.set(problems); e.getOwner().taskCompletedWithProblems(e, task, duration, problems); } } }
[ "public", "void", "synchronizeEnd", "(", "Executor", "e", ",", "Queue", ".", "Executable", "executable", ",", "Throwable", "problems", ",", "long", "duration", ")", "throws", "InterruptedException", "{", "endLatch", ".", "synchronize", "(", ")", ";", "// the mai...
All the {@link Executor}s that jointly execute a {@link Task} call this method to synchronize on the end of the task. @throws InterruptedException If any of the member thread is interrupted while waiting for other threads to join, all the member threads will report {@link InterruptedException}.
[ "All", "the", "{", "@link", "Executor", "}", "s", "that", "jointly", "execute", "a", "{", "@link", "Task", "}", "call", "this", "method", "to", "synchronize", "on", "the", "end", "of", "the", "task", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/queue/WorkUnitContext.java#L132-L146
jeremylong/DependencyCheck
cli/src/main/java/org/owasp/dependencycheck/App.java
App.determineReturnCode
private int determineReturnCode(Engine engine, int cvssFailScore) { int retCode = 0; //Set the exit code based on whether we found a high enough vulnerability for (Dependency dep : engine.getDependencies()) { if (!dep.getVulnerabilities().isEmpty()) { for (Vulnerability vuln : dep.getVulnerabilities()) { LOGGER.debug("VULNERABILITY FOUND {}", dep.getDisplayFileName()); if ((vuln.getCvssV2() != null && vuln.getCvssV2().getScore() > cvssFailScore) || (vuln.getCvssV3() != null && vuln.getCvssV3().getBaseScore() > cvssFailScore)) { retCode = 1; } } } } return retCode; }
java
private int determineReturnCode(Engine engine, int cvssFailScore) { int retCode = 0; //Set the exit code based on whether we found a high enough vulnerability for (Dependency dep : engine.getDependencies()) { if (!dep.getVulnerabilities().isEmpty()) { for (Vulnerability vuln : dep.getVulnerabilities()) { LOGGER.debug("VULNERABILITY FOUND {}", dep.getDisplayFileName()); if ((vuln.getCvssV2() != null && vuln.getCvssV2().getScore() > cvssFailScore) || (vuln.getCvssV3() != null && vuln.getCvssV3().getBaseScore() > cvssFailScore)) { retCode = 1; } } } } return retCode; }
[ "private", "int", "determineReturnCode", "(", "Engine", "engine", ",", "int", "cvssFailScore", ")", "{", "int", "retCode", "=", "0", ";", "//Set the exit code based on whether we found a high enough vulnerability", "for", "(", "Dependency", "dep", ":", "engine", ".", ...
Determines the return code based on if one of the dependencies scanned has a vulnerability with a CVSS score above the cvssFailScore. @param engine the engine used during analysis @param cvssFailScore the max allowed CVSS score @return returns <code>1</code> if a severe enough vulnerability is identified; otherwise <code>0</code>
[ "Determines", "the", "return", "code", "based", "on", "if", "one", "of", "the", "dependencies", "scanned", "has", "a", "vulnerability", "with", "a", "CVSS", "score", "above", "the", "cvssFailScore", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/cli/src/main/java/org/owasp/dependencycheck/App.java#L292-L307
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplaceSettings.java
CmsWorkplaceSettings.setLastUsedGallery
public void setLastUsedGallery(String galleryKey, String gallerypath) { m_lastUsedGalleries.put(galleryKey, gallerypath); LOG.info("user=" + m_user.getName() + ": setLastUsedGallery " + galleryKey + " -> " + gallerypath); }
java
public void setLastUsedGallery(String galleryKey, String gallerypath) { m_lastUsedGalleries.put(galleryKey, gallerypath); LOG.info("user=" + m_user.getName() + ": setLastUsedGallery " + galleryKey + " -> " + gallerypath); }
[ "public", "void", "setLastUsedGallery", "(", "String", "galleryKey", ",", "String", "gallerypath", ")", "{", "m_lastUsedGalleries", ".", "put", "(", "galleryKey", ",", "gallerypath", ")", ";", "LOG", ".", "info", "(", "\"user=\"", "+", "m_user", ".", "getName"...
Saves the last gallery for a given key.<p> @param galleryKey the gallery key @param gallerypath the resourcepath of the gallery
[ "Saves", "the", "last", "gallery", "for", "a", "given", "key", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceSettings.java#L669-L673
leancloud/java-sdk-all
android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/push/GetPushStateApi.java
GetPushStateApi.onConnect
@Override public void onConnect(final int rst, final HuaweiApiClient client) { //需要在子线程中执行获取push状态的操作 ThreadUtil.INST.excute(new Runnable() { @Override public void run() { if (client == null || !ApiClientMgr.INST.isConnect(client)) { HMSAgentLog.e("client not connted"); onGetPushStateResult(rst); } else { HuaweiPush.HuaweiPushApi.getPushState(client); onGetPushStateResult(HMSAgent.AgentResultCode.HMSAGENT_SUCCESS); } } }); }
java
@Override public void onConnect(final int rst, final HuaweiApiClient client) { //需要在子线程中执行获取push状态的操作 ThreadUtil.INST.excute(new Runnable() { @Override public void run() { if (client == null || !ApiClientMgr.INST.isConnect(client)) { HMSAgentLog.e("client not connted"); onGetPushStateResult(rst); } else { HuaweiPush.HuaweiPushApi.getPushState(client); onGetPushStateResult(HMSAgent.AgentResultCode.HMSAGENT_SUCCESS); } } }); }
[ "@", "Override", "public", "void", "onConnect", "(", "final", "int", "rst", ",", "final", "HuaweiApiClient", "client", ")", "{", "//需要在子线程中执行获取push状态的操作\r", "ThreadUtil", ".", "INST", ".", "excute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "pu...
HuaweiApiClient 连接结果回调 @param rst 结果码 @param client HuaweiApiClient 实例
[ "HuaweiApiClient", "连接结果回调" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/push/GetPushStateApi.java#L33-L48
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/DefaultReconfigurationProblem.java
DefaultReconfigurationProblem.defaultHeuristic
private void defaultHeuristic() { IntStrategy intStrat = Search.intVarSearch(new FirstFail(csp), new IntDomainMin(), csp.retrieveIntVars(true)); SetStrategy setStrat = new SetStrategy(csp.retrieveSetVars(), new InputOrder<>(csp), new SetDomainMin(), true); RealStrategy realStrat = new RealStrategy(csp.retrieveRealVars(), new Occurrence<>(), new RealDomainMiddle()); solver.setSearch(new StrategiesSequencer(intStrat, realStrat, setStrat)); }
java
private void defaultHeuristic() { IntStrategy intStrat = Search.intVarSearch(new FirstFail(csp), new IntDomainMin(), csp.retrieveIntVars(true)); SetStrategy setStrat = new SetStrategy(csp.retrieveSetVars(), new InputOrder<>(csp), new SetDomainMin(), true); RealStrategy realStrat = new RealStrategy(csp.retrieveRealVars(), new Occurrence<>(), new RealDomainMiddle()); solver.setSearch(new StrategiesSequencer(intStrat, realStrat, setStrat)); }
[ "private", "void", "defaultHeuristic", "(", ")", "{", "IntStrategy", "intStrat", "=", "Search", ".", "intVarSearch", "(", "new", "FirstFail", "(", "csp", ")", ",", "new", "IntDomainMin", "(", ")", ",", "csp", ".", "retrieveIntVars", "(", "true", ")", ")", ...
A naive heuristic to be sure every variables will be instantiated.
[ "A", "naive", "heuristic", "to", "be", "sure", "every", "variables", "will", "be", "instantiated", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/DefaultReconfigurationProblem.java#L324-L329
apache/reef
lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java
YarnContainerManager.onContainerStarted
@Override public void onContainerStarted(final ContainerId containerId, final Map<String, ByteBuffer> stringByteBufferMap) { final Optional<Container> container = this.containers.getOptional(containerId.toString()); if (container.isPresent()) { this.nodeManager.getContainerStatusAsync(containerId, container.get().getNodeId()); } }
java
@Override public void onContainerStarted(final ContainerId containerId, final Map<String, ByteBuffer> stringByteBufferMap) { final Optional<Container> container = this.containers.getOptional(containerId.toString()); if (container.isPresent()) { this.nodeManager.getContainerStatusAsync(containerId, container.get().getNodeId()); } }
[ "@", "Override", "public", "void", "onContainerStarted", "(", "final", "ContainerId", "containerId", ",", "final", "Map", "<", "String", ",", "ByteBuffer", ">", "stringByteBufferMap", ")", "{", "final", "Optional", "<", "Container", ">", "container", "=", "this"...
NM Callback: NM accepts the starting container request. @param containerId ID of a new container being started. @param stringByteBufferMap a Map between the auxiliary service names and their outputs. Not used.
[ "NM", "Callback", ":", "NM", "accepts", "the", "starting", "container", "request", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java#L223-L229
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/ajax/editable/tabs/AjaxAddableTabbedPanel.java
AjaxAddableTabbedPanel.newCloseLink
protected WebMarkupContainer newCloseLink(final String linkId, final int index) { return new AjaxFallbackLink<Void>(linkId) { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget target) { if (target != null) { onRemoveTab(target, index); } onAjaxUpdate(target); } }; }
java
protected WebMarkupContainer newCloseLink(final String linkId, final int index) { return new AjaxFallbackLink<Void>(linkId) { private static final long serialVersionUID = 1L; @Override public void onClick(final AjaxRequestTarget target) { if (target != null) { onRemoveTab(target, index); } onAjaxUpdate(target); } }; }
[ "protected", "WebMarkupContainer", "newCloseLink", "(", "final", "String", "linkId", ",", "final", "int", "index", ")", "{", "return", "new", "AjaxFallbackLink", "<", "Void", ">", "(", "linkId", ")", "{", "private", "static", "final", "long", "serialVersionUID",...
Factory method for links used to close the selected tab. The created component is attached to the following markup. Label component with id: title will be added for you by the tabbed panel. <pre> &lt;a href=&quot;#&quot; wicket:id=&quot;link&quot;&gt;&lt;span wicket:id=&quot;title&quot;&gt;[[tab title]]&lt;/span&gt;&lt;/a&gt; </pre> Example implementation: <pre> protected WebMarkupContainer newCloseLink(String linkId, final int index) { return new Link(linkId) { private static final long serialVersionUID = 1L; public void onClick() { setSelectedTab(index); } }; } </pre> @param linkId component id with which the link should be created @param index index of the tab that should be activated when this link is clicked. See {@link #setSelectedTab(int)}. @return created link component
[ "Factory", "method", "for", "links", "used", "to", "close", "the", "selected", "tab", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/ajax/editable/tabs/AjaxAddableTabbedPanel.java#L392-L409
yanzhenjie/SwipeRecyclerView
x/src/main/java/com/yanzhenjie/recyclerview/SwipeMenuLayout.java
SwipeMenuLayout.getSwipeDuration
private int getSwipeDuration(MotionEvent ev, int velocity) { int sx = getScrollX(); int dx = (int)(ev.getX() - sx); final int width = mSwipeCurrentHorizontal.getMenuWidth(); final int halfWidth = width / 2; final float distanceRatio = Math.min(1f, 1.0f * Math.abs(dx) / width); final float distance = halfWidth + halfWidth * distanceInfluenceForSnapDuration(distanceRatio); int duration; if (velocity > 0) { duration = 4 * Math.round(1000 * Math.abs(distance / velocity)); } else { final float pageDelta = (float)Math.abs(dx) / width; duration = (int)((pageDelta + 1) * 100); } duration = Math.min(duration, mScrollerDuration); return duration; }
java
private int getSwipeDuration(MotionEvent ev, int velocity) { int sx = getScrollX(); int dx = (int)(ev.getX() - sx); final int width = mSwipeCurrentHorizontal.getMenuWidth(); final int halfWidth = width / 2; final float distanceRatio = Math.min(1f, 1.0f * Math.abs(dx) / width); final float distance = halfWidth + halfWidth * distanceInfluenceForSnapDuration(distanceRatio); int duration; if (velocity > 0) { duration = 4 * Math.round(1000 * Math.abs(distance / velocity)); } else { final float pageDelta = (float)Math.abs(dx) / width; duration = (int)((pageDelta + 1) * 100); } duration = Math.min(duration, mScrollerDuration); return duration; }
[ "private", "int", "getSwipeDuration", "(", "MotionEvent", "ev", ",", "int", "velocity", ")", "{", "int", "sx", "=", "getScrollX", "(", ")", ";", "int", "dx", "=", "(", "int", ")", "(", "ev", ".", "getX", "(", ")", "-", "sx", ")", ";", "final", "i...
compute finish duration. @param ev up event. @param velocity velocity x. @return finish duration.
[ "compute", "finish", "duration", "." ]
train
https://github.com/yanzhenjie/SwipeRecyclerView/blob/69aa14d05da09beaeb880240c62f7de6f4f1bb39/x/src/main/java/com/yanzhenjie/recyclerview/SwipeMenuLayout.java#L305-L321
ironjacamar/ironjacamar
rarinfo/src/main/java/org/ironjacamar/rarinfo/Main.java
Main.removeIntrospectedValue
private static void removeIntrospectedValue(Map<String, String> m, String name) { if (m != null) { m.remove(name); if (name.length() == 1) { name = name.toUpperCase(Locale.US); } else { name = name.substring(0, 1).toUpperCase(Locale.US) + name.substring(1); } m.remove(name); if (name.length() == 1) { name = name.toLowerCase(Locale.US); } else { name = name.substring(0, 1).toLowerCase(Locale.US) + name.substring(1); } m.remove(name); } }
java
private static void removeIntrospectedValue(Map<String, String> m, String name) { if (m != null) { m.remove(name); if (name.length() == 1) { name = name.toUpperCase(Locale.US); } else { name = name.substring(0, 1).toUpperCase(Locale.US) + name.substring(1); } m.remove(name); if (name.length() == 1) { name = name.toLowerCase(Locale.US); } else { name = name.substring(0, 1).toLowerCase(Locale.US) + name.substring(1); } m.remove(name); } }
[ "private", "static", "void", "removeIntrospectedValue", "(", "Map", "<", "String", ",", "String", ">", "m", ",", "String", "name", ")", "{", "if", "(", "m", "!=", "null", ")", "{", "m", ".", "remove", "(", "name", ")", ";", "if", "(", "name", ".", ...
Remove introspected value @param m The map @param name The name
[ "Remove", "introspected", "value" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/rarinfo/src/main/java/org/ironjacamar/rarinfo/Main.java#L1389-L1417
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/TextDuplicator.java
TextDuplicator.setupUI
private void setupUI(final String labelText) { WButton dupBtn = new WButton("Duplicate"); dupBtn.setAction(new DuplicateAction()); WButton clrBtn = new WButton("Clear"); clrBtn.setAction(new ClearAction()); add(new WLabel(labelText, textFld)); add(textFld); add(dupBtn); add(clrBtn); add(new WAjaxControl(dupBtn, this)); add(new WAjaxControl(clrBtn, this)); }
java
private void setupUI(final String labelText) { WButton dupBtn = new WButton("Duplicate"); dupBtn.setAction(new DuplicateAction()); WButton clrBtn = new WButton("Clear"); clrBtn.setAction(new ClearAction()); add(new WLabel(labelText, textFld)); add(textFld); add(dupBtn); add(clrBtn); add(new WAjaxControl(dupBtn, this)); add(new WAjaxControl(clrBtn, this)); }
[ "private", "void", "setupUI", "(", "final", "String", "labelText", ")", "{", "WButton", "dupBtn", "=", "new", "WButton", "(", "\"Duplicate\"", ")", ";", "dupBtn", ".", "setAction", "(", "new", "DuplicateAction", "(", ")", ")", ";", "WButton", "clrBtn", "="...
Add the controls to the UI. @param labelText the text to show in the duplicator field's label.
[ "Add", "the", "controls", "to", "the", "UI", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/TextDuplicator.java#L48-L61
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
NodeImpl.checkedOut
public boolean checkedOut() throws UnsupportedRepositoryOperationException, RepositoryException { // this will also check if item is valid NodeData vancestor = getVersionableAncestor(); if (vancestor != null) { PropertyData isCheckedOut = (PropertyData)dataManager.getItemData(vancestor, new QPathEntry(Constants.JCR_ISCHECKEDOUT, 1), ItemType.PROPERTY); return ValueDataUtil.getBoolean(isCheckedOut.getValues().get(0)); } return true; }
java
public boolean checkedOut() throws UnsupportedRepositoryOperationException, RepositoryException { // this will also check if item is valid NodeData vancestor = getVersionableAncestor(); if (vancestor != null) { PropertyData isCheckedOut = (PropertyData)dataManager.getItemData(vancestor, new QPathEntry(Constants.JCR_ISCHECKEDOUT, 1), ItemType.PROPERTY); return ValueDataUtil.getBoolean(isCheckedOut.getValues().get(0)); } return true; }
[ "public", "boolean", "checkedOut", "(", ")", "throws", "UnsupportedRepositoryOperationException", ",", "RepositoryException", "{", "// this will also check if item is valid", "NodeData", "vancestor", "=", "getVersionableAncestor", "(", ")", ";", "if", "(", "vancestor", "!="...
Tell if this node or its nearest versionable ancestor is checked-out. @return boolean @throws UnsupportedRepositoryOperationException if Versionable operations is not supported @throws RepositoryException if error occurs
[ "Tell", "if", "this", "node", "or", "its", "nearest", "versionable", "ancestor", "is", "checked", "-", "out", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java#L433-L447
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsWriter.java
JdepsWriter.toTag
String toTag(Archive source, String name, Archive target) { if (source == target || !target.getModule().isNamed()) { return target.getName(); } Module module = target.getModule(); String pn = name; if ((type == CLASS || type == VERBOSE)) { int i = name.lastIndexOf('.'); pn = i > 0 ? name.substring(0, i) : ""; } // exported API if (module.isExported(pn) && !module.isJDKUnsupported()) { return showProfileOrModule(module); } // JDK internal API if (!source.getModule().isJDK() && module.isJDK()){ return "JDK internal API (" + module.name() + ")"; } // qualified exports or inaccessible boolean isExported = module.isExported(pn, source.getModule().name()); return module.name() + (isExported ? " (qualified)" : " (internal)"); }
java
String toTag(Archive source, String name, Archive target) { if (source == target || !target.getModule().isNamed()) { return target.getName(); } Module module = target.getModule(); String pn = name; if ((type == CLASS || type == VERBOSE)) { int i = name.lastIndexOf('.'); pn = i > 0 ? name.substring(0, i) : ""; } // exported API if (module.isExported(pn) && !module.isJDKUnsupported()) { return showProfileOrModule(module); } // JDK internal API if (!source.getModule().isJDK() && module.isJDK()){ return "JDK internal API (" + module.name() + ")"; } // qualified exports or inaccessible boolean isExported = module.isExported(pn, source.getModule().name()); return module.name() + (isExported ? " (qualified)" : " (internal)"); }
[ "String", "toTag", "(", "Archive", "source", ",", "String", "name", ",", "Archive", "target", ")", "{", "if", "(", "source", "==", "target", "||", "!", "target", ".", "getModule", "(", ")", ".", "isNamed", "(", ")", ")", "{", "return", "target", ".",...
If the given archive is JDK archive, this method returns the profile name only if -profile option is specified; it accesses a private JDK API and the returned value will have "JDK internal API" prefix For non-JDK archives, this method returns the file name of the archive.
[ "If", "the", "given", "archive", "is", "JDK", "archive", "this", "method", "returns", "the", "profile", "name", "only", "if", "-", "profile", "option", "is", "specified", ";", "it", "accesses", "a", "private", "JDK", "API", "and", "the", "returned", "value...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/JdepsWriter.java#L308-L333
zaproxy/zaproxy
src/org/apache/commons/httpclient/HttpMethodBase.java
HttpMethodBase.readResponse
protected void readResponse(HttpState state, HttpConnection conn) throws IOException, HttpException { LOG.trace( "enter HttpMethodBase.readResponse(HttpState, HttpConnection)"); // Status line & line may have already been received // if 'expect - continue' handshake has been used while (this.statusLine == null) { readStatusLine(state, conn); processStatusLine(state, conn); readResponseHeaders(state, conn); processResponseHeaders(state, conn); int status = this.statusLine.getStatusCode(); if ((status >= 100) && (status < 200)) { if (LOG.isInfoEnabled()) { LOG.info("Discarding unexpected response: " + this.statusLine.toString()); } this.statusLine = null; } } readResponseBody(state, conn); processResponseBody(state, conn); }
java
protected void readResponse(HttpState state, HttpConnection conn) throws IOException, HttpException { LOG.trace( "enter HttpMethodBase.readResponse(HttpState, HttpConnection)"); // Status line & line may have already been received // if 'expect - continue' handshake has been used while (this.statusLine == null) { readStatusLine(state, conn); processStatusLine(state, conn); readResponseHeaders(state, conn); processResponseHeaders(state, conn); int status = this.statusLine.getStatusCode(); if ((status >= 100) && (status < 200)) { if (LOG.isInfoEnabled()) { LOG.info("Discarding unexpected response: " + this.statusLine.toString()); } this.statusLine = null; } } readResponseBody(state, conn); processResponseBody(state, conn); }
[ "protected", "void", "readResponse", "(", "HttpState", "state", ",", "HttpConnection", "conn", ")", "throws", "IOException", ",", "HttpException", "{", "LOG", ".", "trace", "(", "\"enter HttpMethodBase.readResponse(HttpState, HttpConnection)\"", ")", ";", "// Status line ...
Reads the response from the given {@link HttpConnection connection}. <p> The response is processed as the following sequence of actions: <ol> <li> {@link #readStatusLine(HttpState,HttpConnection)} is invoked to read the request line. </li> <li> {@link #processStatusLine(HttpState,HttpConnection)} is invoked, allowing the method to process the status line if desired. </li> <li> {@link #readResponseHeaders(HttpState,HttpConnection)} is invoked to read the associated headers. </li> <li> {@link #processResponseHeaders(HttpState,HttpConnection)} is invoked, allowing the method to process the headers if desired. </li> <li> {@link #readResponseBody(HttpState,HttpConnection)} is invoked to read the associated body (if any). </li> <li> {@link #processResponseBody(HttpState,HttpConnection)} is invoked, allowing the method to process the response body if desired. </li> </ol> Subclasses may want to override one or more of the above methods to to customize the processing. (Or they may choose to override this method if dramatically different processing is required.) @param state the {@link HttpState state} information associated with this method @param conn the {@link HttpConnection connection} used to execute this HTTP method @throws IOException if an I/O (transport) error occurs. Some transport exceptions can be recovered from. @throws HttpException if a protocol exception occurs. Usually protocol exceptions cannot be recovered from.
[ "Reads", "the", "response", "from", "the", "given", "{", "@link", "HttpConnection", "connection", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/apache/commons/httpclient/HttpMethodBase.java#L1862-L1884
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java
FilterInvoker.getBooleanMethodParam
protected boolean getBooleanMethodParam(String methodName, String paramKey, boolean defaultValue) { if (CommonUtils.isEmpty(configContext)) { return defaultValue; } Boolean o = (Boolean) configContext.get(buildMethodKey(methodName, paramKey)); if (o == null) { o = (Boolean) configContext.get(paramKey); return o == null ? defaultValue : o; } else { return o; } }
java
protected boolean getBooleanMethodParam(String methodName, String paramKey, boolean defaultValue) { if (CommonUtils.isEmpty(configContext)) { return defaultValue; } Boolean o = (Boolean) configContext.get(buildMethodKey(methodName, paramKey)); if (o == null) { o = (Boolean) configContext.get(paramKey); return o == null ? defaultValue : o; } else { return o; } }
[ "protected", "boolean", "getBooleanMethodParam", "(", "String", "methodName", ",", "String", "paramKey", ",", "boolean", "defaultValue", ")", "{", "if", "(", "CommonUtils", ".", "isEmpty", "(", "configContext", ")", ")", "{", "return", "defaultValue", ";", "}", ...
取得方法的特殊参数配置 @param methodName 方法名 @param paramKey 参数关键字 @param defaultValue 默认值 @return 都找不到为false boolean method param
[ "取得方法的特殊参数配置" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java#L140-L151
apache/incubator-gobblin
gobblin-modules/gobblin-crypto/src/main/java/org/apache/gobblin/crypto/GPGFileDecryptor.java
GPGFileDecryptor.decryptFile
public InputStream decryptFile(InputStream inputStream, InputStream keyIn, String passPhrase) throws IOException { try { PGPEncryptedDataList enc = getPGPEncryptedDataList(inputStream); Iterator it = enc.getEncryptedDataObjects(); PGPPrivateKey sKey = null; PGPPublicKeyEncryptedData pbe = null; PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyIn), new BcKeyFingerprintCalculator()); while (sKey == null && it.hasNext()) { pbe = (PGPPublicKeyEncryptedData) it.next(); sKey = findSecretKey(pgpSec, pbe.getKeyID(), passPhrase); } if (sKey == null) { throw new IllegalArgumentException("secret key for message not found."); } InputStream clear = pbe.getDataStream( new JcePublicKeyDataDecryptorFactoryBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME).build(sKey)); JcaPGPObjectFactory pgpFact = new JcaPGPObjectFactory(clear); return new LazyMaterializeDecryptorInputStream(pgpFact); } catch (PGPException e) { throw new IOException(e); } }
java
public InputStream decryptFile(InputStream inputStream, InputStream keyIn, String passPhrase) throws IOException { try { PGPEncryptedDataList enc = getPGPEncryptedDataList(inputStream); Iterator it = enc.getEncryptedDataObjects(); PGPPrivateKey sKey = null; PGPPublicKeyEncryptedData pbe = null; PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyIn), new BcKeyFingerprintCalculator()); while (sKey == null && it.hasNext()) { pbe = (PGPPublicKeyEncryptedData) it.next(); sKey = findSecretKey(pgpSec, pbe.getKeyID(), passPhrase); } if (sKey == null) { throw new IllegalArgumentException("secret key for message not found."); } InputStream clear = pbe.getDataStream( new JcePublicKeyDataDecryptorFactoryBuilder().setProvider(BouncyCastleProvider.PROVIDER_NAME).build(sKey)); JcaPGPObjectFactory pgpFact = new JcaPGPObjectFactory(clear); return new LazyMaterializeDecryptorInputStream(pgpFact); } catch (PGPException e) { throw new IOException(e); } }
[ "public", "InputStream", "decryptFile", "(", "InputStream", "inputStream", ",", "InputStream", "keyIn", ",", "String", "passPhrase", ")", "throws", "IOException", "{", "try", "{", "PGPEncryptedDataList", "enc", "=", "getPGPEncryptedDataList", "(", "inputStream", ")", ...
Taking in a file inputstream, keyring inputstream and a passPhrase, generate a decrypted file inputstream. @param inputStream file inputstream @param keyIn keyring inputstream. This InputStream is owned by the caller. @param passPhrase passPhrase @return an {@link InputStream} for the decrypted content @throws IOException
[ "Taking", "in", "a", "file", "inputstream", "keyring", "inputstream", "and", "a", "passPhrase", "generate", "a", "decrypted", "file", "inputstream", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-crypto/src/main/java/org/apache/gobblin/crypto/GPGFileDecryptor.java#L89-L115
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/translator/VariableTranslator.java
VariableTranslator.realToString
public static String realToString(Package pkg, String type, Object value) { if (value == null) return ""; com.centurylink.mdw.variable.VariableTranslator trans = getTranslator(pkg, type); if (trans instanceof DocumentReferenceTranslator) return ((DocumentReferenceTranslator)trans).realToString(value); else return trans.toString(value); }
java
public static String realToString(Package pkg, String type, Object value) { if (value == null) return ""; com.centurylink.mdw.variable.VariableTranslator trans = getTranslator(pkg, type); if (trans instanceof DocumentReferenceTranslator) return ((DocumentReferenceTranslator)trans).realToString(value); else return trans.toString(value); }
[ "public", "static", "String", "realToString", "(", "Package", "pkg", ",", "String", "type", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "return", "\"\"", ";", "com", ".", "centurylink", ".", "mdw", ".", "variable", ".", "Va...
Serializes a runtime variable object to its string value. Documents are expanded. @param pkg workflow package @param type variable type @param value object value @return serialized string value
[ "Serializes", "a", "runtime", "variable", "object", "to", "its", "string", "value", ".", "Documents", "are", "expanded", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/translator/VariableTranslator.java#L139-L147
spotbugs/spotbugs
spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/SorterDialog.java
SorterDialog.createSorterPane
private JPanel createSorterPane() { JPanel insidePanel = new JPanel(); insidePanel.setLayout(new GridBagLayout()); preview = new JTableHeader(); Sortables[] sortables = MainFrame.getInstance().getAvailableSortables(); preview.setColumnModel(new SorterTableColumnModel(sortables)); for (Sortables s : sortables) { if (s != Sortables.DIVIDER) { checkBoxSortList.add(new SortableCheckBox(s)); } } setSorterCheckBoxes(); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 1; gbc.insets = new Insets(2,5,2,5); insidePanel.add(new JLabel("<html><h2>1. Choose bug properties"), gbc); insidePanel.add(new CheckBoxList<>(checkBoxSortList.toArray(new JCheckBox[checkBoxSortList.size()])), gbc); JTable t = new JTable(new DefaultTableModel(0, sortables.length)); t.setTableHeader(preview); preview.setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); insidePanel.add(new JLabel("<html><h2>2. Drag and drop to change grouping priority"), gbc); insidePanel.add(createAppropriatelySizedScrollPane(t), gbc); sortApply = new JButton(edu.umd.cs.findbugs.L10N.getLocalString("dlg.apply_btn", "Apply")); sortApply.addActionListener(e -> { MainFrame.getInstance().getSorter().createFrom((SorterTableColumnModel) preview.getColumnModel()); ((BugTreeModel) MainFrame.getInstance().getTree().getModel()).checkSorter(); SorterDialog.this.dispose(); }); gbc.fill = GridBagConstraints.NONE; insidePanel.add(sortApply, gbc); JPanel sorter = new JPanel(); sorter.setLayout(new BorderLayout()); sorter.add(new JScrollPane(insidePanel), BorderLayout.CENTER); return sorter; }
java
private JPanel createSorterPane() { JPanel insidePanel = new JPanel(); insidePanel.setLayout(new GridBagLayout()); preview = new JTableHeader(); Sortables[] sortables = MainFrame.getInstance().getAvailableSortables(); preview.setColumnModel(new SorterTableColumnModel(sortables)); for (Sortables s : sortables) { if (s != Sortables.DIVIDER) { checkBoxSortList.add(new SortableCheckBox(s)); } } setSorterCheckBoxes(); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 1; gbc.insets = new Insets(2,5,2,5); insidePanel.add(new JLabel("<html><h2>1. Choose bug properties"), gbc); insidePanel.add(new CheckBoxList<>(checkBoxSortList.toArray(new JCheckBox[checkBoxSortList.size()])), gbc); JTable t = new JTable(new DefaultTableModel(0, sortables.length)); t.setTableHeader(preview); preview.setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); insidePanel.add(new JLabel("<html><h2>2. Drag and drop to change grouping priority"), gbc); insidePanel.add(createAppropriatelySizedScrollPane(t), gbc); sortApply = new JButton(edu.umd.cs.findbugs.L10N.getLocalString("dlg.apply_btn", "Apply")); sortApply.addActionListener(e -> { MainFrame.getInstance().getSorter().createFrom((SorterTableColumnModel) preview.getColumnModel()); ((BugTreeModel) MainFrame.getInstance().getTree().getModel()).checkSorter(); SorterDialog.this.dispose(); }); gbc.fill = GridBagConstraints.NONE; insidePanel.add(sortApply, gbc); JPanel sorter = new JPanel(); sorter.setLayout(new BorderLayout()); sorter.add(new JScrollPane(insidePanel), BorderLayout.CENTER); return sorter; }
[ "private", "JPanel", "createSorterPane", "(", ")", "{", "JPanel", "insidePanel", "=", "new", "JPanel", "(", ")", ";", "insidePanel", ".", "setLayout", "(", "new", "GridBagLayout", "(", ")", ")", ";", "preview", "=", "new", "JTableHeader", "(", ")", ";", ...
Creates JPanel with checkboxes of different things to sort by. List is: priority, class, package, category, bugcode, status, and type.
[ "Creates", "JPanel", "with", "checkboxes", "of", "different", "things", "to", "sort", "by", ".", "List", "is", ":", "priority", "class", "package", "category", "bugcode", "status", "and", "type", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/SorterDialog.java#L96-L138
sarxos/webcam-capture
webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java
Webcam.setParameters
public void setParameters(Map<String, ?> parameters) { WebcamDevice device = getDevice(); if (device instanceof Configurable) { ((Configurable) device).setParameters(parameters); } else { LOG.debug("Webcam device {} is not configurable", device); } }
java
public void setParameters(Map<String, ?> parameters) { WebcamDevice device = getDevice(); if (device instanceof Configurable) { ((Configurable) device).setParameters(parameters); } else { LOG.debug("Webcam device {} is not configurable", device); } }
[ "public", "void", "setParameters", "(", "Map", "<", "String", ",", "?", ">", "parameters", ")", "{", "WebcamDevice", "device", "=", "getDevice", "(", ")", ";", "if", "(", "device", "instanceof", "Configurable", ")", "{", "(", "(", "Configurable", ")", "d...
If the underlying device implements Configurable interface, specified parameters are passed to it. May be called before the open method or later in dependence of the device implementation. @param parameters - Map of parameters changing device defaults @see Configurable
[ "If", "the", "underlying", "device", "implements", "Configurable", "interface", "specified", "parameters", "are", "passed", "to", "it", ".", "May", "be", "called", "before", "the", "open", "method", "or", "later", "in", "dependence", "of", "the", "device", "im...
train
https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture/src/main/java/com/github/sarxos/webcam/Webcam.java#L796-L803
guardtime/ksi-java-sdk
ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java
HAConfUtil.isSmaller
static boolean isSmaller(Long a, Long b) { return a == null || (b != null && b < a); }
java
static boolean isSmaller(Long a, Long b) { return a == null || (b != null && b < a); }
[ "static", "boolean", "isSmaller", "(", "Long", "a", ",", "Long", "b", ")", "{", "return", "a", "==", "null", "||", "(", "b", "!=", "null", "&&", "b", "<", "a", ")", ";", "}" ]
Is value of b smaller than value of a. @return True, if b is smaller than a. Always true, if value of a is null.
[ "Is", "value", "of", "b", "smaller", "than", "value", "of", "a", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java#L43-L45
Terracotta-OSS/offheap-store
src/main/java/org/terracotta/offheapstore/paging/UpfrontAllocatingPageSource.java
UpfrontAllocatingPageSource.addAllocationThreshold
public synchronized Runnable addAllocationThreshold(ThresholdDirection direction, long threshold, Runnable action) { switch (direction) { case RISING: return risingThresholds.put(threshold, action); case FALLING: return fallingThresholds.put(threshold, action); } throw new AssertionError(); }
java
public synchronized Runnable addAllocationThreshold(ThresholdDirection direction, long threshold, Runnable action) { switch (direction) { case RISING: return risingThresholds.put(threshold, action); case FALLING: return fallingThresholds.put(threshold, action); } throw new AssertionError(); }
[ "public", "synchronized", "Runnable", "addAllocationThreshold", "(", "ThresholdDirection", "direction", ",", "long", "threshold", ",", "Runnable", "action", ")", "{", "switch", "(", "direction", ")", "{", "case", "RISING", ":", "return", "risingThresholds", ".", "...
Adds an allocation threshold action. <p> There can be only a single action associated with each unique direction and threshold combination. If an action is already associated with the supplied combination then the action is replaced by the new action and the old action is returned. <p> Actions are fired on passing through the supplied threshold and are called synchronously with the triggering allocation. This means care must be taken to avoid mutating any map that uses this page source from within the action otherwise deadlocks may result. Exceptions thrown by the action will be caught and logged by the page source and will not be propagated on the allocating thread. @param direction new actions direction @param threshold new actions threshold level @param action fired on breaching the threshold @return the replaced action or {@code null} if no action was present.
[ "Adds", "an", "allocation", "threshold", "action", ".", "<p", ">", "There", "can", "be", "only", "a", "single", "action", "associated", "with", "each", "unique", "direction", "and", "threshold", "combination", ".", "If", "an", "action", "is", "already", "ass...
train
https://github.com/Terracotta-OSS/offheap-store/blob/600486cddb33c0247025c0cb69eff289eb6d7d93/src/main/java/org/terracotta/offheapstore/paging/UpfrontAllocatingPageSource.java#L443-L451
cchantep/acolyte
jdbc-driver/src/main/java/acolyte/jdbc/ParameterMetaData.java
ParameterMetaData.Double
public static ParameterDef Double(final double d) { final BigDecimal bd = new BigDecimal(String.format(Locale.US, "%f", d)). stripTrailingZeros(); return Scaled(Types.DOUBLE, bd.scale()); }
java
public static ParameterDef Double(final double d) { final BigDecimal bd = new BigDecimal(String.format(Locale.US, "%f", d)). stripTrailingZeros(); return Scaled(Types.DOUBLE, bd.scale()); }
[ "public", "static", "ParameterDef", "Double", "(", "final", "double", "d", ")", "{", "final", "BigDecimal", "bd", "=", "new", "BigDecimal", "(", "String", ".", "format", "(", "Locale", ".", "US", ",", "\"%f\"", ",", "d", ")", ")", ".", "stripTrailingZero...
Double constructor. @param d the double precision value for the parameter @return Parameter definition for given double precision value
[ "Double", "constructor", "." ]
train
https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/jdbc-driver/src/main/java/acolyte/jdbc/ParameterMetaData.java#L290-L295
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/ResourceMonitor.java
ResourceMonitor.removeResourceChangeListener
public void removeResourceChangeListener(ResourceChangeListener pListener, Object pResourceId) { synchronized (timerEntries) { removeListenerInternal(getResourceId(pResourceId, pListener)); } }
java
public void removeResourceChangeListener(ResourceChangeListener pListener, Object pResourceId) { synchronized (timerEntries) { removeListenerInternal(getResourceId(pResourceId, pListener)); } }
[ "public", "void", "removeResourceChangeListener", "(", "ResourceChangeListener", "pListener", ",", "Object", "pResourceId", ")", "{", "synchronized", "(", "timerEntries", ")", "{", "removeListenerInternal", "(", "getResourceId", "(", "pResourceId", ",", "pListener", ")"...
Remove the {@code ResourceChangeListener} from the notification list. @param pListener the pListener to be removed. @param pResourceId name of the resource to monitor.
[ "Remove", "the", "{", "@code", "ResourceChangeListener", "}", "from", "the", "notification", "list", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/ResourceMonitor.java#L112-L116
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/util/Util.java
Util.toOutputStream
public static OutputStream toOutputStream(final String s, final OutputStream os) throws IOException { // This needs to be fast. final int length = s.length(); for(int i = 0; i < length; i++) { assert s.charAt(i) < (char)0x100 : s.charAt(i); os.write(s.charAt(i)); } return os; }
java
public static OutputStream toOutputStream(final String s, final OutputStream os) throws IOException { // This needs to be fast. final int length = s.length(); for(int i = 0; i < length; i++) { assert s.charAt(i) < (char)0x100 : s.charAt(i); os.write(s.charAt(i)); } return os; }
[ "public", "static", "OutputStream", "toOutputStream", "(", "final", "String", "s", ",", "final", "OutputStream", "os", ")", "throws", "IOException", "{", "// This needs to be fast.", "final", "int", "length", "=", "s", ".", "length", "(", ")", ";", "for", "(",...
Writes a string to an output stream, discarding higher order bits. <p>This method is significantly faster than those relying on character encoders, and it does not allocate any object. @param s a string. @param os an output stream. @return {@code os}. @throws AssertionError if assertions are enabled and some character of {@code s} does not fit a byte.
[ "Writes", "a", "string", "to", "an", "output", "stream", "discarding", "higher", "order", "bits", "." ]
train
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/Util.java#L211-L220
tvesalainen/lpg
src/main/java/org/vesalainen/grammar/Grammar.java
Grammar.addAnonymousTerminal
public void addAnonymousTerminal(String expression, Option... options) { addTerminal(null, "'"+expression+"'", expression, "", 0, 10, options); }
java
public void addAnonymousTerminal(String expression, Option... options) { addTerminal(null, "'"+expression+"'", expression, "", 0, 10, options); }
[ "public", "void", "addAnonymousTerminal", "(", "String", "expression", ",", "Option", "...", "options", ")", "{", "addTerminal", "(", "null", ",", "\"'\"", "+", "expression", "+", "\"'\"", ",", "expression", ",", "\"\"", ",", "0", ",", "10", ",", "options"...
Adds anonymous terminal. Anonymous terminals name is 'expression' @param expression @param options
[ "Adds", "anonymous", "terminal", ".", "Anonymous", "terminals", "name", "is", "expression" ]
train
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/Grammar.java#L348-L351
zaproxy/zaproxy
src/org/parosproxy/paros/model/SiteMap.java
SiteMap.addPath
public synchronized SiteNode addPath(HistoryReference ref) { if (Constant.isLowMemoryOptionSet()) { throw new InvalidParameterException("SiteMap should not be accessed when the low memory option is set"); } HttpMessage msg = null; try { msg = ref.getHttpMessage(); } catch (Exception e) { // ZAP: Added error log.error(e.getMessage(), e); return null; } return addPath(ref, msg); }
java
public synchronized SiteNode addPath(HistoryReference ref) { if (Constant.isLowMemoryOptionSet()) { throw new InvalidParameterException("SiteMap should not be accessed when the low memory option is set"); } HttpMessage msg = null; try { msg = ref.getHttpMessage(); } catch (Exception e) { // ZAP: Added error log.error(e.getMessage(), e); return null; } return addPath(ref, msg); }
[ "public", "synchronized", "SiteNode", "addPath", "(", "HistoryReference", "ref", ")", "{", "if", "(", "Constant", ".", "isLowMemoryOptionSet", "(", ")", ")", "{", "throw", "new", "InvalidParameterException", "(", "\"SiteMap should not be accessed when the low memory optio...
Add the HistoryReference into the SiteMap. This method will rely on reading message from the History table. Note that this method must only be called on the EventDispatchThread @param ref
[ "Add", "the", "HistoryReference", "into", "the", "SiteMap", ".", "This", "method", "will", "rely", "on", "reading", "message", "from", "the", "History", "table", ".", "Note", "that", "this", "method", "must", "only", "be", "called", "on", "the", "EventDispat...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/model/SiteMap.java#L347-L362
BlueBrain/bluima
modules/bluima_scripting/src/main/java/ch/epfl/bbp/uima/laucher/Launcher.java
Launcher.runPipeline
public static void runPipeline(File scriptFile, List<String> cliArgs) throws IOException, UIMAException, ParseException { if (!scriptFile.exists()) { throw new IOException("Script file does not exist (" + scriptFile.getAbsolutePath() + ")"); } LOG.info("Parsing pipeline script at '{}'", scriptFile.getAbsolutePath() + " \n with CLI parameters: " + join(cliArgs, ", ")); Pipeline pipeline = null; try { pipeline = PipelineScriptParser.parse(scriptFile, cliArgs); } catch (ParseException e) { throw new ParseException("\nERROR parsing '" + scriptFile.getName() + "'\n" + e.getMessage() + "\n(see the README.txt for the pipeline script format)", e.getErrorOffset()); } LOG.info("Successfully parsed pipeline script, now starting pipeline..."); LOG.info("*************************************************************"); pipeline.run(); // will be printed if no exception. // used in pipeline tests, do not change System.out.println(OK_MESSAGE); }
java
public static void runPipeline(File scriptFile, List<String> cliArgs) throws IOException, UIMAException, ParseException { if (!scriptFile.exists()) { throw new IOException("Script file does not exist (" + scriptFile.getAbsolutePath() + ")"); } LOG.info("Parsing pipeline script at '{}'", scriptFile.getAbsolutePath() + " \n with CLI parameters: " + join(cliArgs, ", ")); Pipeline pipeline = null; try { pipeline = PipelineScriptParser.parse(scriptFile, cliArgs); } catch (ParseException e) { throw new ParseException("\nERROR parsing '" + scriptFile.getName() + "'\n" + e.getMessage() + "\n(see the README.txt for the pipeline script format)", e.getErrorOffset()); } LOG.info("Successfully parsed pipeline script, now starting pipeline..."); LOG.info("*************************************************************"); pipeline.run(); // will be printed if no exception. // used in pipeline tests, do not change System.out.println(OK_MESSAGE); }
[ "public", "static", "void", "runPipeline", "(", "File", "scriptFile", ",", "List", "<", "String", ">", "cliArgs", ")", "throws", "IOException", ",", "UIMAException", ",", "ParseException", "{", "if", "(", "!", "scriptFile", ".", "exists", "(", ")", ")", "{...
Parse this pipeline and run it @return true if no error during processing @throws ParseException
[ "Parse", "this", "pipeline", "and", "run", "it" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_scripting/src/main/java/ch/epfl/bbp/uima/laucher/Launcher.java#L174-L200
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/modules/notifications/NotificationsActor.java
NotificationsActor.onMessagesRead
public void onMessagesRead(Peer peer, long fromDate) { // Filtering obsolete read events if (fromDate < getLastReadDate(peer)) { return; } // Removing read messages from pending storage getNotifications().clear(); pendingStorage.setMessagesCount(0); pendingStorage.setDialogsCount(0); allPendingNotifications.clear(); saveStorage(); updateNotification(); // Setting last read date setLastReadDate(peer, fromDate); }
java
public void onMessagesRead(Peer peer, long fromDate) { // Filtering obsolete read events if (fromDate < getLastReadDate(peer)) { return; } // Removing read messages from pending storage getNotifications().clear(); pendingStorage.setMessagesCount(0); pendingStorage.setDialogsCount(0); allPendingNotifications.clear(); saveStorage(); updateNotification(); // Setting last read date setLastReadDate(peer, fromDate); }
[ "public", "void", "onMessagesRead", "(", "Peer", "peer", ",", "long", "fromDate", ")", "{", "// Filtering obsolete read events", "if", "(", "fromDate", "<", "getLastReadDate", "(", "peer", ")", ")", "{", "return", ";", "}", "// Removing read messages from pending st...
Processing event about messages read @param peer peer @param fromDate read from date
[ "Processing", "event", "about", "messages", "read" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/modules/notifications/NotificationsActor.java#L240-L257
jhunters/jprotobuf
android/src/main/java/com/baidu/bjf/remoting/protobuf/utils/StringUtils.java
StringUtils.splitByWholeSeparator
public static String[] splitByWholeSeparator(String str, String separator) { return splitByWholeSeparatorWorker(str, separator, -1, false); }
java
public static String[] splitByWholeSeparator(String str, String separator) { return splitByWholeSeparatorWorker(str, separator, -1, false); }
[ "public", "static", "String", "[", "]", "splitByWholeSeparator", "(", "String", "str", ",", "String", "separator", ")", "{", "return", "splitByWholeSeparatorWorker", "(", "str", ",", "separator", ",", "-", "1", ",", "false", ")", ";", "}" ]
<p> Splits the provided text into an array, separator string specified. </p> <p> The separator(s) will not be included in the returned String array. Adjacent separators are treated as one separator. </p> <p> A <code>null</code> input String returns <code>null</code>. A <code>null</code> separator splits on whitespace. </p> <pre> StringUtils.splitByWholeSeparator(null, *) = null StringUtils.splitByWholeSeparator("", *) = [] StringUtils.splitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"] StringUtils.splitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"] StringUtils.splitByWholeSeparator("ab:cd:ef", ":") = ["ab", "cd", "ef"] StringUtils.splitByWholeSeparator("ab-!-cd-!-ef", "-!-") = ["ab", "cd", "ef"] </pre> @param str the String to parse, may be null @param separator String containing the String to be used as a delimiter, <code>null</code> splits on whitespace @return an array of parsed Strings, <code>null</code> if null String was input
[ "<p", ">", "Splits", "the", "provided", "text", "into", "an", "array", "separator", "string", "specified", ".", "<", "/", "p", ">" ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/android/src/main/java/com/baidu/bjf/remoting/protobuf/utils/StringUtils.java#L1016-L1018
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentItemPersistenceImpl.java
CommerceShipmentItemPersistenceImpl.findByGroupId
@Override public List<CommerceShipmentItem> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
java
@Override public List<CommerceShipmentItem> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceShipmentItem", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}...
Returns a range of all the commerce shipment items where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceShipmentItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of commerce shipment items @param end the upper bound of the range of commerce shipment items (not inclusive) @return the range of matching commerce shipment items
[ "Returns", "a", "range", "of", "all", "the", "commerce", "shipment", "items", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentItemPersistenceImpl.java#L139-L143
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.withHours
public Period withHours(int hours) { int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.HOUR_INDEX, values, hours); return new Period(values, getPeriodType()); }
java
public Period withHours(int hours) { int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.HOUR_INDEX, values, hours); return new Period(values, getPeriodType()); }
[ "public", "Period", "withHours", "(", "int", "hours", ")", "{", "int", "[", "]", "values", "=", "getValues", "(", ")", ";", "// cloned", "getPeriodType", "(", ")", ".", "setIndexedField", "(", "this", ",", "PeriodType", ".", "HOUR_INDEX", ",", "values", ...
Returns a new period with the specified number of hours. <p> This period instance is immutable and unaffected by this method call. @param hours the amount of hours to add, may be negative @return the new period with the increased hours @throws UnsupportedOperationException if the field is not supported
[ "Returns", "a", "new", "period", "with", "the", "specified", "number", "of", "hours", ".", "<p", ">", "This", "period", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L974-L978
zaproxy/zaproxy
src/org/zaproxy/zap/spider/SpiderController.java
SpiderController.createURI
private URI createURI(String uri) { URI uriV = null; try { // Try to see if we can create the URI, considering it's encoded. uriV = new URI(uri, true); } catch (URIException e) { // An error occurred, so try to create the URI considering it's not encoded. try { log.debug("Second try..."); uriV = new URI(uri, false); } catch (Exception ex) { log.error("Error while converting to uri: " + uri, ex); return null; } // A non URIException occurred, so just ignore the URI } catch (Exception e) { log.error("Error while converting to uri: " + uri, e); return null; } return uriV; }
java
private URI createURI(String uri) { URI uriV = null; try { // Try to see if we can create the URI, considering it's encoded. uriV = new URI(uri, true); } catch (URIException e) { // An error occurred, so try to create the URI considering it's not encoded. try { log.debug("Second try..."); uriV = new URI(uri, false); } catch (Exception ex) { log.error("Error while converting to uri: " + uri, ex); return null; } // A non URIException occurred, so just ignore the URI } catch (Exception e) { log.error("Error while converting to uri: " + uri, e); return null; } return uriV; }
[ "private", "URI", "createURI", "(", "String", "uri", ")", "{", "URI", "uriV", "=", "null", ";", "try", "{", "// Try to see if we can create the URI, considering it's encoded.", "uriV", "=", "new", "URI", "(", "uri", ",", "true", ")", ";", "}", "catch", "(", ...
Creates the {@link URI} starting from the uri string. First it tries to convert it into a String considering it's already encoded and, if it fails, tries to create it considering it's not encoded. @param uri the string of the uri @return the URI, or null if an error occurred and the URI could not be constructed.
[ "Creates", "the", "{", "@link", "URI", "}", "starting", "from", "the", "uri", "string", ".", "First", "it", "tries", "to", "convert", "it", "into", "a", "String", "considering", "it", "s", "already", "encoded", "and", "if", "it", "fails", "tries", "to", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/SpiderController.java#L379-L399
aws/aws-sdk-java
aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/StepFactory.java
StepFactory.newInstallHiveStep
public HadoopJarStepConfig newInstallHiveStep(HiveVersion... hiveVersions) { if (hiveVersions.length > 0) { String[] versionStrings = new String[hiveVersions.length]; for (int i = 0; i < hiveVersions.length; i++) { versionStrings[i] = hiveVersions[i].toString(); } return newInstallHiveStep(versionStrings); } return newHivePigStep("hive", "--install-hive", "--hive-versions", "latest"); }
java
public HadoopJarStepConfig newInstallHiveStep(HiveVersion... hiveVersions) { if (hiveVersions.length > 0) { String[] versionStrings = new String[hiveVersions.length]; for (int i = 0; i < hiveVersions.length; i++) { versionStrings[i] = hiveVersions[i].toString(); } return newInstallHiveStep(versionStrings); } return newHivePigStep("hive", "--install-hive", "--hive-versions", "latest"); }
[ "public", "HadoopJarStepConfig", "newInstallHiveStep", "(", "HiveVersion", "...", "hiveVersions", ")", "{", "if", "(", "hiveVersions", ".", "length", ">", "0", ")", "{", "String", "[", "]", "versionStrings", "=", "new", "String", "[", "hiveVersions", ".", "len...
Step that installs the specified versions of Hive on your job flow. @param hiveVersions the versions of Hive to install @return HadoopJarStepConfig that can be passed to your job flow.
[ "Step", "that", "installs", "the", "specified", "versions", "of", "Hive", "on", "your", "job", "flow", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/StepFactory.java#L159-L168
citiususc/hipster
hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java
Maze2D.getStringMazeFilled
public String getStringMazeFilled(Collection<Point> points, char symbol) { Map<Point, Character> replacements = new HashMap<Point, Character>(); for (Point p : points) { replacements.put(p, symbol); } return getReplacedMazeString(Collections.singletonList(replacements)); }
java
public String getStringMazeFilled(Collection<Point> points, char symbol) { Map<Point, Character> replacements = new HashMap<Point, Character>(); for (Point p : points) { replacements.put(p, symbol); } return getReplacedMazeString(Collections.singletonList(replacements)); }
[ "public", "String", "getStringMazeFilled", "(", "Collection", "<", "Point", ">", "points", ",", "char", "symbol", ")", "{", "Map", "<", "Point", ",", "Character", ">", "replacements", "=", "new", "HashMap", "<", "Point", ",", "Character", ">", "(", ")", ...
Generates a string representation of this maze, with the indicated points replaced with the symbol provided. @param points points of the maze. @param symbol symbol to be inserted in each point. @return the string representation of the maze with the points changed.
[ "Generates", "a", "string", "representation", "of", "this", "maze", "with", "the", "indicated", "points", "replaced", "with", "the", "symbol", "provided", "." ]
train
https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L341-L347
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java
Activator.preInvokeActivateBean
public BeanO preInvokeActivateBean(EJBThreadData threadData, ContainerTx tx, BeanId beanId) // d641259 throws RemoteException { return beanId.getActivationStrategy().atActivate(threadData, tx, beanId); }
java
public BeanO preInvokeActivateBean(EJBThreadData threadData, ContainerTx tx, BeanId beanId) // d641259 throws RemoteException { return beanId.getActivationStrategy().atActivate(threadData, tx, beanId); }
[ "public", "BeanO", "preInvokeActivateBean", "(", "EJBThreadData", "threadData", ",", "ContainerTx", "tx", ",", "BeanId", "beanId", ")", "// d641259", "throws", "RemoteException", "{", "return", "beanId", ".", "getActivationStrategy", "(", ")", ".", "atActivate", "("...
Activate a bean in the context of a transaction. If an instance of the bean is already active in the transaction, that instance is returned. Otherwise, one of several strategies is used to activate an instance depending on what the bean supports. <p> If this method completes normally, it must be balanced with a call to one of the following methods: removeBean, commitBean, rollbackBean. If this method throws an exception, any partial work has already been undone, and there should be no balancing method call. <p> If this method returns successfully, {@link EJBThreadData#pushCallbackBeanO} will have been called, and the caller is responsible for calling {@link EJBThreadData#popCallbackBeanO}. <p> @param threadData the EJB thread data for the currently executing thread @param tx the transaction context in which the bean instance should be activated. @param beanId the <code>BeanId</code> identifying the bean to activate. @return a fully-activated bean instance.
[ "Activate", "a", "bean", "in", "the", "context", "of", "a", "transaction", ".", "If", "an", "instance", "of", "the", "bean", "is", "already", "active", "in", "the", "transaction", "that", "instance", "is", "returned", ".", "Otherwise", "one", "of", "severa...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L260-L264
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/trustregion/UnconMinTrustRegionBFGS_F64.java
UnconMinTrustRegionBFGS_F64.wolfeCondition
protected boolean wolfeCondition( DMatrixRMaj s , DMatrixRMaj y , DMatrixRMaj g_k) { double left = CommonOps_DDRM.dot(y,s); double g_s = CommonOps_DDRM.dot(g_k,s); double right = (c2-1)*g_s; if( left >= right ) { return (fx-f_prev) <= c1*g_s; } return false; }
java
protected boolean wolfeCondition( DMatrixRMaj s , DMatrixRMaj y , DMatrixRMaj g_k) { double left = CommonOps_DDRM.dot(y,s); double g_s = CommonOps_DDRM.dot(g_k,s); double right = (c2-1)*g_s; if( left >= right ) { return (fx-f_prev) <= c1*g_s; } return false; }
[ "protected", "boolean", "wolfeCondition", "(", "DMatrixRMaj", "s", ",", "DMatrixRMaj", "y", ",", "DMatrixRMaj", "g_k", ")", "{", "double", "left", "=", "CommonOps_DDRM", ".", "dot", "(", "y", ",", "s", ")", ";", "double", "g_s", "=", "CommonOps_DDRM", ".",...
Indicates if there's sufficient decrease and curvature. If the Wolfe condition is meet then the Hessian will be positive definite. @param s change in state (new - old) @param y change in gradient (new - old) @param g_k Gradient at step k. @return
[ "Indicates", "if", "there", "s", "sufficient", "decrease", "and", "curvature", ".", "If", "the", "Wolfe", "condition", "is", "meet", "then", "the", "Hessian", "will", "be", "positive", "definite", "." ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/trustregion/UnconMinTrustRegionBFGS_F64.java#L139-L147
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java
SphereUtil.haversineFormulaRad
@Reference(authors = "R. W. Sinnott", // title = "Virtues of the Haversine", // booktitle = "Sky and Telescope 68(2)", // bibkey = "journals/skytelesc/Sinnott84") public static double haversineFormulaRad(double lat1, double lon1, double lat2, double lon2) { if(lat1 == lat2 && lon1 == lon2) { return 0.; } // Haversine formula, higher precision at < 1 meters but maybe issues at // antipodal points with asin, atan2 is supposedly better (but slower). final double slat = sin((lat1 - lat2) * .5), slon = sin((lon1 - lon2) * .5); double a = slat * slat + slon * slon * cos(lat1) * cos(lat2); return a < .9 ? 2 * asin(sqrt(a)) : a < 1 ? 2 * atan2(sqrt(a), sqrt(1 - a)) : Math.PI; }
java
@Reference(authors = "R. W. Sinnott", // title = "Virtues of the Haversine", // booktitle = "Sky and Telescope 68(2)", // bibkey = "journals/skytelesc/Sinnott84") public static double haversineFormulaRad(double lat1, double lon1, double lat2, double lon2) { if(lat1 == lat2 && lon1 == lon2) { return 0.; } // Haversine formula, higher precision at < 1 meters but maybe issues at // antipodal points with asin, atan2 is supposedly better (but slower). final double slat = sin((lat1 - lat2) * .5), slon = sin((lon1 - lon2) * .5); double a = slat * slat + slon * slon * cos(lat1) * cos(lat2); return a < .9 ? 2 * asin(sqrt(a)) : a < 1 ? 2 * atan2(sqrt(a), sqrt(1 - a)) : Math.PI; }
[ "@", "Reference", "(", "authors", "=", "\"R. W. Sinnott\"", ",", "//", "title", "=", "\"Virtues of the Haversine\"", ",", "//", "booktitle", "=", "\"Sky and Telescope 68(2)\"", ",", "//", "bibkey", "=", "\"journals/skytelesc/Sinnott84\"", ")", "public", "static", "dou...
Compute the approximate great-circle distance of two points using the Haversine formula <p> Complexity: 5 trigonometric functions, 1-2 sqrt. <p> Reference: <p> R. W. Sinnott,<br> Virtues of the Haversine<br> Sky and Telescope 68(2) @param lat1 Latitude of first point in degree @param lon1 Longitude of first point in degree @param lat2 Latitude of second point in degree @param lon2 Longitude of second point in degree @return Distance on unit sphere
[ "Compute", "the", "approximate", "great", "-", "circle", "distance", "of", "two", "points", "using", "the", "Haversine", "formula", "<p", ">", "Complexity", ":", "5", "trigonometric", "functions", "1", "-", "2", "sqrt", ".", "<p", ">", "Reference", ":", "<...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L174-L187
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java
BusItinerary.insertBusHaltAfter
public BusItineraryHalt insertBusHaltAfter(BusItineraryHalt afterHalt, UUID id, BusItineraryHaltType type) { return insertBusHaltAfter(afterHalt, id, null, type); }
java
public BusItineraryHalt insertBusHaltAfter(BusItineraryHalt afterHalt, UUID id, BusItineraryHaltType type) { return insertBusHaltAfter(afterHalt, id, null, type); }
[ "public", "BusItineraryHalt", "insertBusHaltAfter", "(", "BusItineraryHalt", "afterHalt", ",", "UUID", "id", ",", "BusItineraryHaltType", "type", ")", "{", "return", "insertBusHaltAfter", "(", "afterHalt", ",", "id", ",", "null", ",", "type", ")", ";", "}" ]
Insert newHalt after afterHalt in the ordered list of {@link BusItineraryHalt}. @param afterHalt the halt where insert the new halt @param id id of the new halt @param type the type of bus halt @return the added bus halt, otherwise <code>null</code>
[ "Insert", "newHalt", "after", "afterHalt", "in", "the", "ordered", "list", "of", "{", "@link", "BusItineraryHalt", "}", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1162-L1164
pac4j/pac4j
pac4j-saml/src/main/java/org/pac4j/saml/sso/impl/SAML2AuthnResponseValidator.java
SAML2AuthnResponseValidator.decryptEncryptedAssertions
protected final void decryptEncryptedAssertions(final Response response, final Decrypter decrypter) { for (final EncryptedAssertion encryptedAssertion : response.getEncryptedAssertions()) { try { final Assertion decryptedAssertion = decrypter.decrypt(encryptedAssertion); response.getAssertions().add(decryptedAssertion); } catch (final DecryptionException e) { logger.error("Decryption of assertion failed, continue with the next one", e); } } }
java
protected final void decryptEncryptedAssertions(final Response response, final Decrypter decrypter) { for (final EncryptedAssertion encryptedAssertion : response.getEncryptedAssertions()) { try { final Assertion decryptedAssertion = decrypter.decrypt(encryptedAssertion); response.getAssertions().add(decryptedAssertion); } catch (final DecryptionException e) { logger.error("Decryption of assertion failed, continue with the next one", e); } } }
[ "protected", "final", "void", "decryptEncryptedAssertions", "(", "final", "Response", "response", ",", "final", "Decrypter", "decrypter", ")", "{", "for", "(", "final", "EncryptedAssertion", "encryptedAssertion", ":", "response", ".", "getEncryptedAssertions", "(", ")...
Decrypt encrypted assertions and add them to the assertions list of the response. @param response the response @param decrypter the decrypter
[ "Decrypt", "encrypted", "assertions", "and", "add", "them", "to", "the", "assertions", "list", "of", "the", "response", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/sso/impl/SAML2AuthnResponseValidator.java#L294-L305
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.buildUri
protected URI buildUri(final String path, final List<NameValuePair> queryStringParams) { final StringBuilder sb = new StringBuilder(); sb.append(path); if (queryStringParams != null && queryStringParams.size() > 0) { sb.append("?").append(URLEncodedUtils.format(queryStringParams, "UTF-8")); } try { return new URI(sb.toString()); } catch (final URISyntaxException e) { throw new IllegalStateException("Invalid uri", e); } }
java
protected URI buildUri(final String path, final List<NameValuePair> queryStringParams) { final StringBuilder sb = new StringBuilder(); sb.append(path); if (queryStringParams != null && queryStringParams.size() > 0) { sb.append("?").append(URLEncodedUtils.format(queryStringParams, "UTF-8")); } try { return new URI(sb.toString()); } catch (final URISyntaxException e) { throw new IllegalStateException("Invalid uri", e); } }
[ "protected", "URI", "buildUri", "(", "final", "String", "path", ",", "final", "List", "<", "NameValuePair", ">", "queryStringParams", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "path", ")...
Helper method to return URI query parameters @param path the path. @param queryStringParams the query string parameters. @return the URI object.
[ "Helper", "method", "to", "return", "URI", "query", "parameters" ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L687-L700
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItemData
public ItemData getItemData(QPath path) throws RepositoryException { NodeData parent = (NodeData)getItemData(Constants.ROOT_UUID); if (path.equals(Constants.ROOT_PATH)) { return parent; } QPathEntry[] relPathEntries = path.getRelPath(path.getDepth()); return getItemData(parent, relPathEntries, ItemType.UNKNOWN); }
java
public ItemData getItemData(QPath path) throws RepositoryException { NodeData parent = (NodeData)getItemData(Constants.ROOT_UUID); if (path.equals(Constants.ROOT_PATH)) { return parent; } QPathEntry[] relPathEntries = path.getRelPath(path.getDepth()); return getItemData(parent, relPathEntries, ItemType.UNKNOWN); }
[ "public", "ItemData", "getItemData", "(", "QPath", "path", ")", "throws", "RepositoryException", "{", "NodeData", "parent", "=", "(", "NodeData", ")", "getItemData", "(", "Constants", ".", "ROOT_UUID", ")", ";", "if", "(", "path", ".", "equals", "(", "Consta...
Return item data by internal <b>qpath</b> in this transient storage then in workspace container. @param path - absolute path @return existed item data or null if not found @throws RepositoryException @see org.exoplatform.services.jcr.dataflow.ItemDataConsumer#getItemData(String)
[ "Return", "item", "data", "by", "internal", "<b", ">", "qpath<", "/", "b", ">", "in", "this", "transient", "storage", "then", "in", "workspace", "container", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L152-L165
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/util/ByteUtils.java
ByteUtils.toExtendedASCIIs
public static String toExtendedASCIIs(byte[] bytes, int n, ByteOrder bo) { RubyArray<String> ra = Ruby.Array.create(); if (bo == LITTLE_ENDIAN) { for (int i = 0; i < n; i++) { if (i >= bytes.length) { ra.push("\0"); continue; } byte b = bytes[i]; ra.push(toASCII8Bit(b)); } return ra.join(); } else { for (int i = bytes.length - 1; n > 0; i--) { if (i < 0) { ra.unshift("\0"); n--; continue; } byte b = bytes[i]; ra.unshift(toASCII8Bit(b)); n--; } return ra.join(); } }
java
public static String toExtendedASCIIs(byte[] bytes, int n, ByteOrder bo) { RubyArray<String> ra = Ruby.Array.create(); if (bo == LITTLE_ENDIAN) { for (int i = 0; i < n; i++) { if (i >= bytes.length) { ra.push("\0"); continue; } byte b = bytes[i]; ra.push(toASCII8Bit(b)); } return ra.join(); } else { for (int i = bytes.length - 1; n > 0; i--) { if (i < 0) { ra.unshift("\0"); n--; continue; } byte b = bytes[i]; ra.unshift(toASCII8Bit(b)); n--; } return ra.join(); } }
[ "public", "static", "String", "toExtendedASCIIs", "(", "byte", "[", "]", "bytes", ",", "int", "n", ",", "ByteOrder", "bo", ")", "{", "RubyArray", "<", "String", ">", "ra", "=", "Ruby", ".", "Array", ".", "create", "(", ")", ";", "if", "(", "bo", "=...
Converts a byte array into an ASCII String. @param bytes used to be converted @param n length of ASCII String @param bo a ByteOrder @return ASCII String
[ "Converts", "a", "byte", "array", "into", "an", "ASCII", "String", "." ]
train
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/util/ByteUtils.java#L398-L423
jbundle/jbundle
main/screen/src/main/java/org/jbundle/main/screen/BaseFolderGridScreen.java
BaseFolderGridScreen.doCommand
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL)) { // Make sure if the use wants to select a record to re-connect the selection Record targetRecord = null; int iMode = ScreenConstants.DETAIL_MODE; OnSelectHandler listener = (OnSelectHandler)this.getMainRecord().getListener(OnSelectHandler.class); if (listener != null) { targetRecord = listener.getRecordToSync(); this.getMainRecord().removeListener(listener, false); iMode = iMode | ScreenConstants.SELECT_MODE; } BasePanel screen = this.onForm(null, iMode, true, iCommandOptions, null); if (targetRecord != null) screen.setSelectQuery(targetRecord, false); return true; } else return super.doCommand(strCommand, sourceSField, iCommandOptions); }
java
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL)) { // Make sure if the use wants to select a record to re-connect the selection Record targetRecord = null; int iMode = ScreenConstants.DETAIL_MODE; OnSelectHandler listener = (OnSelectHandler)this.getMainRecord().getListener(OnSelectHandler.class); if (listener != null) { targetRecord = listener.getRecordToSync(); this.getMainRecord().removeListener(listener, false); iMode = iMode | ScreenConstants.SELECT_MODE; } BasePanel screen = this.onForm(null, iMode, true, iCommandOptions, null); if (targetRecord != null) screen.setSelectQuery(targetRecord, false); return true; } else return super.doCommand(strCommand, sourceSField, iCommandOptions); }
[ "public", "boolean", "doCommand", "(", "String", "strCommand", ",", "ScreenField", "sourceSField", ",", "int", "iCommandOptions", ")", "{", "if", "(", "strCommand", ".", "equalsIgnoreCase", "(", "MenuConstants", ".", "FORMDETAIL", ")", ")", "{", "// Make sure if t...
Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success.
[ "Process", "the", "command", ".", "<br", "/", ">", "Step", "1", "-", "Process", "the", "command", "if", "possible", "and", "return", "true", "if", "processed", ".", "<br", "/", ">", "Step", "2", "-", "If", "I", "can", "t", "process", "pass", "to", ...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/screen/BaseFolderGridScreen.java#L123-L143
geomajas/geomajas-project-client-gwt
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/action/toolbar/MultiLayerFeatureInfoModalAction.java
MultiLayerFeatureInfoModalAction.setFeaturesListLabels
public void setFeaturesListLabels(Map<String, String> featuresListLabels) { this.featuresListLabels = featuresListLabels; controller.setFeaturesListLabels(featuresListLabels); }
java
public void setFeaturesListLabels(Map<String, String> featuresListLabels) { this.featuresListLabels = featuresListLabels; controller.setFeaturesListLabels(featuresListLabels); }
[ "public", "void", "setFeaturesListLabels", "(", "Map", "<", "String", ",", "String", ">", "featuresListLabels", ")", "{", "this", ".", "featuresListLabels", "=", "featuresListLabels", ";", "controller", ".", "setFeaturesListLabels", "(", "featuresListLabels", ")", "...
Set labels for feature lists. @param featuresListLabels the featuresListLabels to set
[ "Set", "labels", "for", "feature", "lists", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/action/toolbar/MultiLayerFeatureInfoModalAction.java#L131-L134
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/PluginGroup.java
PluginGroup.loadPlugins
@Nullable static PluginGroup loadPlugins(PluginTarget target, CentralDogmaConfig config) { return loadPlugins(PluginGroup.class.getClassLoader(), target, config); }
java
@Nullable static PluginGroup loadPlugins(PluginTarget target, CentralDogmaConfig config) { return loadPlugins(PluginGroup.class.getClassLoader(), target, config); }
[ "@", "Nullable", "static", "PluginGroup", "loadPlugins", "(", "PluginTarget", "target", ",", "CentralDogmaConfig", "config", ")", "{", "return", "loadPlugins", "(", "PluginGroup", ".", "class", ".", "getClassLoader", "(", ")", ",", "target", ",", "config", ")", ...
Returns a new {@link PluginGroup} which holds the {@link Plugin}s loaded from the classpath. {@code null} is returned if there is no {@link Plugin} whose target equals to the specified {@code target}. @param target the {@link PluginTarget} which would be loaded
[ "Returns", "a", "new", "{", "@link", "PluginGroup", "}", "which", "holds", "the", "{", "@link", "Plugin", "}", "s", "loaded", "from", "the", "classpath", ".", "{", "@code", "null", "}", "is", "returned", "if", "there", "is", "no", "{", "@link", "Plugin...
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/PluginGroup.java#L62-L65
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4Connection.java
JDBC4Connection.prepareStatement
@Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { if ((resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE || resultSetType == ResultSet.TYPE_FORWARD_ONLY) && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY) { return prepareStatement(sql); } checkClosed(); throw SQLError.noSupport(); }
java
@Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { if ((resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE || resultSetType == ResultSet.TYPE_FORWARD_ONLY) && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY) { return prepareStatement(sql); } checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "PreparedStatement", "prepareStatement", "(", "String", "sql", ",", "int", "resultSetType", ",", "int", "resultSetConcurrency", ")", "throws", "SQLException", "{", "if", "(", "(", "resultSetType", "==", "ResultSet", ".", "TYPE_SCROLL_INSEN...
Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency.
[ "Creates", "a", "PreparedStatement", "object", "that", "will", "generate", "ResultSet", "objects", "with", "the", "given", "type", "and", "concurrency", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Connection.java#L386-L395
aspectran/aspectran
core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java
BasicResponseAdapter.addHeader
@Override public void addHeader(String name, String value) { touchHeaders().add(name, value); }
java
@Override public void addHeader(String name, String value) { touchHeaders().add(name, value); }
[ "@", "Override", "public", "void", "addHeader", "(", "String", "name", ",", "String", "value", ")", "{", "touchHeaders", "(", ")", ".", "add", "(", "name", ",", "value", ")", ";", "}" ]
Add the given single header value to the current list of values for the given header. @param name the header name @param value the header value to be added
[ "Add", "the", "given", "single", "header", "value", "to", "the", "current", "list", "of", "values", "for", "the", "given", "header", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java#L136-L139
VoltDB/voltdb
src/frontend/org/voltdb/exportclient/ExportRow.java
ExportRow.decodeRow
public static ExportRow decodeRow(ExportRow previous, int partition, long startTS, ByteBuffer bb) throws IOException { final int partitionColIndex = bb.getInt(); final int columnCount = bb.getInt(); assert(columnCount <= DDLCompiler.MAX_COLUMNS); boolean[] is_null = extractNullFlags(bb, columnCount); assert(previous != null); if (previous == null) { throw new IOException("Export block with no schema found without prior block with schema."); } final long generation = previous.generation; final String tableName = previous.tableName; final List<String> colNames = previous.names; final List<VoltType> colTypes = previous.types; final List<Integer> colLengths = previous.lengths; Object[] retval = new Object[colNames.size()]; Object pval = null; for (int i = 0; i < colNames.size(); ++i) { if (is_null[i]) { retval[i] = null; } else { retval[i] = decodeNextColumn(bb, colTypes.get(i)); } if (i == partitionColIndex) { pval = retval[i]; } } return new ExportRow(tableName, colNames, colTypes, colLengths, retval, (pval == null ? partition : pval), partitionColIndex, partition, generation); }
java
public static ExportRow decodeRow(ExportRow previous, int partition, long startTS, ByteBuffer bb) throws IOException { final int partitionColIndex = bb.getInt(); final int columnCount = bb.getInt(); assert(columnCount <= DDLCompiler.MAX_COLUMNS); boolean[] is_null = extractNullFlags(bb, columnCount); assert(previous != null); if (previous == null) { throw new IOException("Export block with no schema found without prior block with schema."); } final long generation = previous.generation; final String tableName = previous.tableName; final List<String> colNames = previous.names; final List<VoltType> colTypes = previous.types; final List<Integer> colLengths = previous.lengths; Object[] retval = new Object[colNames.size()]; Object pval = null; for (int i = 0; i < colNames.size(); ++i) { if (is_null[i]) { retval[i] = null; } else { retval[i] = decodeNextColumn(bb, colTypes.get(i)); } if (i == partitionColIndex) { pval = retval[i]; } } return new ExportRow(tableName, colNames, colTypes, colLengths, retval, (pval == null ? partition : pval), partitionColIndex, partition, generation); }
[ "public", "static", "ExportRow", "decodeRow", "(", "ExportRow", "previous", ",", "int", "partition", ",", "long", "startTS", ",", "ByteBuffer", "bb", ")", "throws", "IOException", "{", "final", "int", "partitionColIndex", "=", "bb", ".", "getInt", "(", ")", ...
Decode a byte array of row data into ExportRow @param previous previous row for schema purposes. @param partition partition of this data @param startTS start time for this export data source @param rowData row data to decode. @return ExportRow row data with metadata @throws IOException
[ "Decode", "a", "byte", "array", "of", "row", "data", "into", "ExportRow" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/exportclient/ExportRow.java#L106-L136
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLInverseFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.java
OWLInverseFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLInverseFunctionalObjectPropertyAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLInverseFunctionalObjectPropertyAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLInverseFunctionalObjectPropertyAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";...
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLInverseFunctionalObjectPropertyAxiomImpl_CustomFieldSerializer.java#L74-L77
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java
MultiUserChatLightManager.unblockRoom
public void unblockRoom(DomainBareJid mucLightService, Jid roomJid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { HashMap<Jid, Boolean> rooms = new HashMap<>(); rooms.put(roomJid, true); sendUnblockRooms(mucLightService, rooms); }
java
public void unblockRoom(DomainBareJid mucLightService, Jid roomJid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { HashMap<Jid, Boolean> rooms = new HashMap<>(); rooms.put(roomJid, true); sendUnblockRooms(mucLightService, rooms); }
[ "public", "void", "unblockRoom", "(", "DomainBareJid", "mucLightService", ",", "Jid", "roomJid", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "HashMap", "<", "Jid", ",", "Boolean", ">"...
Unblock a room. @param mucLightService @param roomJid @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException
[ "Unblock", "a", "room", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java#L340-L345
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.drawImage
public void drawImage (final PDImageXObject image, final float x, final float y, final float width, final float height) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: drawImage is not allowed within a text block."); } saveGraphicsState (); final AffineTransform transform = new AffineTransform (width, 0, 0, height, x, y); transform (new Matrix (transform)); writeOperand (resources.add (image)); writeOperator ((byte) 'D', (byte) 'o'); restoreGraphicsState (); }
java
public void drawImage (final PDImageXObject image, final float x, final float y, final float width, final float height) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: drawImage is not allowed within a text block."); } saveGraphicsState (); final AffineTransform transform = new AffineTransform (width, 0, 0, height, x, y); transform (new Matrix (transform)); writeOperand (resources.add (image)); writeOperator ((byte) 'D', (byte) 'o'); restoreGraphicsState (); }
[ "public", "void", "drawImage", "(", "final", "PDImageXObject", "image", ",", "final", "float", "x", ",", "final", "float", "y", ",", "final", "float", "width", ",", "final", "float", "height", ")", "throws", "IOException", "{", "if", "(", "inTextMode", ")"...
Draw an image at the x,y coordinates, with the given size. @param image The image to draw. @param x The x-coordinate to draw the image. @param y The y-coordinate to draw the image. @param width The width to draw the image. @param height The height to draw the image. @throws IOException If there is an error writing to the stream. @throws IllegalStateException If the method was called within a text block.
[ "Draw", "an", "image", "at", "the", "x", "y", "coordinates", "with", "the", "given", "size", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L510-L530
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.multTransA
public static void multTransA(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { if( a.numCols >= EjmlParameters.CMULT_COLUMN_SWITCH || b.numCols >= EjmlParameters.CMULT_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multTransA_reorder(a, b, c); } else { MatrixMatrixMult_ZDRM.multTransA_small(a, b, c); } }
java
public static void multTransA(ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj c ) { if( a.numCols >= EjmlParameters.CMULT_COLUMN_SWITCH || b.numCols >= EjmlParameters.CMULT_COLUMN_SWITCH ) { MatrixMatrixMult_ZDRM.multTransA_reorder(a, b, c); } else { MatrixMatrixMult_ZDRM.multTransA_small(a, b, c); } }
[ "public", "static", "void", "multTransA", "(", "ZMatrixRMaj", "a", ",", "ZMatrixRMaj", "b", ",", "ZMatrixRMaj", "c", ")", "{", "if", "(", "a", ".", "numCols", ">=", "EjmlParameters", ".", "CMULT_COLUMN_SWITCH", "||", "b", ".", "numCols", ">=", "EjmlParameter...
<p>Performs the following operation:<br> <br> c = a<sup>H</sup> * b <br> <br> c<sub>ij</sub> = &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>kj</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", "=", "a<sup", ">", "H<", "/", "sup", ">", "*", "b", "<br", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&sum", ";", "<sub", ">", "k", "=...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L454-L462
strator-dev/greenpepper-open
extensions-external/fit/src/main/java/com/greenpepper/extensions/fit/Fit.java
Fit.isATimedActionFitInterpreter
public static boolean isATimedActionFitInterpreter(SystemUnderDevelopment sud, String name) { try { Object target = sud.getFixture(name).getTarget(); if (target instanceof TimedActionFixture) return true; } catch (Throwable t) { } return false; }
java
public static boolean isATimedActionFitInterpreter(SystemUnderDevelopment sud, String name) { try { Object target = sud.getFixture(name).getTarget(); if (target instanceof TimedActionFixture) return true; } catch (Throwable t) { } return false; }
[ "public", "static", "boolean", "isATimedActionFitInterpreter", "(", "SystemUnderDevelopment", "sud", ",", "String", "name", ")", "{", "try", "{", "Object", "target", "=", "sud", ".", "getFixture", "(", "name", ")", ".", "getTarget", "(", ")", ";", "if", "(",...
<p>isATimedActionFitInterpreter.</p> @param sud a {@link com.greenpepper.systemunderdevelopment.SystemUnderDevelopment} object. @param name a {@link java.lang.String} object. @return a boolean.
[ "<p", ">", "isATimedActionFitInterpreter", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/extensions-external/fit/src/main/java/com/greenpepper/extensions/fit/Fit.java#L29-L42
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java
DynamicReportBuilder.setColspan
public DynamicReportBuilder setColspan(int colNumber, int colQuantity, String colspanTitle) { this.setColspan(colNumber, colQuantity, colspanTitle, null); return this; }
java
public DynamicReportBuilder setColspan(int colNumber, int colQuantity, String colspanTitle) { this.setColspan(colNumber, colQuantity, colspanTitle, null); return this; }
[ "public", "DynamicReportBuilder", "setColspan", "(", "int", "colNumber", ",", "int", "colQuantity", ",", "String", "colspanTitle", ")", "{", "this", ".", "setColspan", "(", "colNumber", ",", "colQuantity", ",", "colspanTitle", ",", "null", ")", ";", "return", ...
Set a colspan in a group of columns. First add the cols to the report @param colNumber the index of the col @param colQuantity the number of cols how i will take @param colspanTitle colspan title @return a Dynamic Report Builder @throws ColumnBuilderException When the index of the cols is out of bounds.
[ "Set", "a", "colspan", "in", "a", "group", "of", "columns", ".", "First", "add", "the", "cols", "to", "the", "report" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L1645-L1650
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/JsonUtils.java
JsonUtils.renderException
private static void renderException(final Map model, final HttpServletResponse response) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); model.put("status", HttpServletResponse.SC_BAD_REQUEST); render(model, response); }
java
private static void renderException(final Map model, final HttpServletResponse response) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); model.put("status", HttpServletResponse.SC_BAD_REQUEST); render(model, response); }
[ "private", "static", "void", "renderException", "(", "final", "Map", "model", ",", "final", "HttpServletResponse", "response", ")", "{", "response", ".", "setStatus", "(", "HttpServletResponse", ".", "SC_BAD_REQUEST", ")", ";", "model", ".", "put", "(", "\"statu...
Render exceptions. Sets the response status accordingly to note bad requests. @param model the model @param response the response
[ "Render", "exceptions", ".", "Sets", "the", "response", "status", "accordingly", "to", "note", "bad", "requests", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/JsonUtils.java#L67-L71