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
google/closure-compiler
src/com/google/javascript/jscomp/TypeValidator.java
TypeValidator.expectCanAssignTo
boolean expectCanAssignTo(Node n, JSType rightType, JSType leftType, String msg) { if (!rightType.isSubtypeOf(leftType)) { mismatch(n, msg, rightType, leftType); return false; } else if (!rightType.isSubtypeWithoutStructuralTyping(leftType)) { TypeMismatch.recordImplicitInterfaceUses(this.implicitInterfaceUses, n, rightType, leftType); TypeMismatch.recordImplicitUseOfNativeObject(this.mismatches, n, rightType, leftType); } return true; }
java
boolean expectCanAssignTo(Node n, JSType rightType, JSType leftType, String msg) { if (!rightType.isSubtypeOf(leftType)) { mismatch(n, msg, rightType, leftType); return false; } else if (!rightType.isSubtypeWithoutStructuralTyping(leftType)) { TypeMismatch.recordImplicitInterfaceUses(this.implicitInterfaceUses, n, rightType, leftType); TypeMismatch.recordImplicitUseOfNativeObject(this.mismatches, n, rightType, leftType); } return true; }
[ "boolean", "expectCanAssignTo", "(", "Node", "n", ",", "JSType", "rightType", ",", "JSType", "leftType", ",", "String", "msg", ")", "{", "if", "(", "!", "rightType", ".", "isSubtypeOf", "(", "leftType", ")", ")", "{", "mismatch", "(", "n", ",", "msg", ...
Expect that the first type can be assigned to a symbol of the second type. @param t The node traversal. @param n The node to issue warnings on. @param rightType The type on the RHS of the assign. @param leftType The type of the symbol on the LHS of the assign. @param msg An extra message for the mismatch warning, if necessary. @return True if the types matched, false otherwise.
[ "Expect", "that", "the", "first", "type", "can", "be", "assigned", "to", "a", "symbol", "of", "the", "second", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L634-L643
nemerosa/ontrack
ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/PropertyController.java
PropertyController.deleteProperty
@RequestMapping(value = "{entityType}/{id}/{propertyTypeName}/edit", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.ACCEPTED) public Ack deleteProperty(@PathVariable ProjectEntityType entityType, @PathVariable ID id, @PathVariable String propertyTypeName) { return propertyService.deleteProperty( getEntity(entityType, id), propertyTypeName ); }
java
@RequestMapping(value = "{entityType}/{id}/{propertyTypeName}/edit", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.ACCEPTED) public Ack deleteProperty(@PathVariable ProjectEntityType entityType, @PathVariable ID id, @PathVariable String propertyTypeName) { return propertyService.deleteProperty( getEntity(entityType, id), propertyTypeName ); }
[ "@", "RequestMapping", "(", "value", "=", "\"{entityType}/{id}/{propertyTypeName}/edit\"", ",", "method", "=", "RequestMethod", ".", "DELETE", ")", "@", "ResponseStatus", "(", "HttpStatus", ".", "ACCEPTED", ")", "public", "Ack", "deleteProperty", "(", "@", "PathVari...
Deletes the value of a property. @param entityType Type of the entity to edit @param id ID of the entity to edit @param propertyTypeName Fully qualified name of the property to delete
[ "Deletes", "the", "value", "of", "a", "property", "." ]
train
https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/PropertyController.java#L127-L134
tvesalainen/util
util/src/main/java/org/vesalainen/math/LevenbergMarquardt.java
LevenbergMarquardt.adjustParam
private boolean adjustParam(DenseMatrix64F X, DenseMatrix64F Y, double prevCost) { // lambda adjusts how big of a step it takes double lambda = initialLambda; // the difference between the current and previous cost double difference = 1000; for( int iter = 0; iter < iter1 && difference > maxDifference ; iter++ ) { // compute some variables based on the gradient computeDandH(param,X,Y); // try various step sizes and see if any of them improve the // results over what has already been done boolean foundBetter = false; for( int i = 0; i < iter2; i++ ) { computeA(A,H,lambda); if( !solve(A,d,negDelta) ) { return false; } // compute the candidate parameters subtract(param, negDelta, tempParam); double cost = cost(tempParam,X,Y); if( cost < prevCost ) { // the candidate parameters produced better results so use it foundBetter = true; param.set(tempParam); difference = prevCost - cost; prevCost = cost; lambda /= 10.0; } else { lambda *= 10.0; } } // it reached a point where it can't improve so exit if( !foundBetter ) break; } finalCost = prevCost; return true; }
java
private boolean adjustParam(DenseMatrix64F X, DenseMatrix64F Y, double prevCost) { // lambda adjusts how big of a step it takes double lambda = initialLambda; // the difference between the current and previous cost double difference = 1000; for( int iter = 0; iter < iter1 && difference > maxDifference ; iter++ ) { // compute some variables based on the gradient computeDandH(param,X,Y); // try various step sizes and see if any of them improve the // results over what has already been done boolean foundBetter = false; for( int i = 0; i < iter2; i++ ) { computeA(A,H,lambda); if( !solve(A,d,negDelta) ) { return false; } // compute the candidate parameters subtract(param, negDelta, tempParam); double cost = cost(tempParam,X,Y); if( cost < prevCost ) { // the candidate parameters produced better results so use it foundBetter = true; param.set(tempParam); difference = prevCost - cost; prevCost = cost; lambda /= 10.0; } else { lambda *= 10.0; } } // it reached a point where it can't improve so exit if( !foundBetter ) break; } finalCost = prevCost; return true; }
[ "private", "boolean", "adjustParam", "(", "DenseMatrix64F", "X", ",", "DenseMatrix64F", "Y", ",", "double", "prevCost", ")", "{", "// lambda adjusts how big of a step it takes\r", "double", "lambda", "=", "initialLambda", ";", "// the difference between the current and previo...
Iterate until the difference between the costs is insignificant or it iterates too many times
[ "Iterate", "until", "the", "difference", "between", "the", "costs", "is", "insignificant", "or", "it", "iterates", "too", "many", "times" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/LevenbergMarquardt.java#L158-L200
samskivert/samskivert
src/main/java/com/samskivert/util/PrefsConfig.java
PrefsConfig.setValue
public void setValue (String name, boolean value) { Boolean oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { oldValue = Boolean.valueOf(_prefs.getBoolean(name, super.getValue(name, false))); } _prefs.putBoolean(name, value); _propsup.firePropertyChange(name, oldValue, Boolean.valueOf(value)); }
java
public void setValue (String name, boolean value) { Boolean oldValue = null; if (_prefs.get(name, null) != null || _props.getProperty(name) != null) { oldValue = Boolean.valueOf(_prefs.getBoolean(name, super.getValue(name, false))); } _prefs.putBoolean(name, value); _propsup.firePropertyChange(name, oldValue, Boolean.valueOf(value)); }
[ "public", "void", "setValue", "(", "String", "name", ",", "boolean", "value", ")", "{", "Boolean", "oldValue", "=", "null", ";", "if", "(", "_prefs", ".", "get", "(", "name", ",", "null", ")", "!=", "null", "||", "_props", ".", "getProperty", "(", "n...
Sets the value of the specified preference, overriding the value defined in the configuration files shipped with the application.
[ "Sets", "the", "value", "of", "the", "specified", "preference", "overriding", "the", "value", "defined", "in", "the", "configuration", "files", "shipped", "with", "the", "application", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PrefsConfig.java#L114-L123
mangstadt/biweekly
src/main/java/biweekly/util/XmlUtils.java
XmlUtils.toWriter
public static void toWriter(Node node, Writer writer) throws TransformerException { toWriter(node, writer, new HashMap<String, String>()); }
java
public static void toWriter(Node node, Writer writer) throws TransformerException { toWriter(node, writer, new HashMap<String, String>()); }
[ "public", "static", "void", "toWriter", "(", "Node", "node", ",", "Writer", "writer", ")", "throws", "TransformerException", "{", "toWriter", "(", "node", ",", "writer", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Writes an XML node to a writer. @param node the XML node @param writer the writer @throws TransformerException if there's a problem writing to the writer
[ "Writes", "an", "XML", "node", "to", "a", "writer", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/XmlUtils.java#L273-L275
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java
CDKMCS.getSubgraphMaps
public static List<List<CDKRMap>> getSubgraphMaps(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds) throws CDKException { return search(sourceGraph, targetGraph, new BitSet(), getBitSet(targetGraph), true, true, shouldMatchBonds); }
java
public static List<List<CDKRMap>> getSubgraphMaps(IAtomContainer sourceGraph, IAtomContainer targetGraph, boolean shouldMatchBonds) throws CDKException { return search(sourceGraph, targetGraph, new BitSet(), getBitSet(targetGraph), true, true, shouldMatchBonds); }
[ "public", "static", "List", "<", "List", "<", "CDKRMap", ">", ">", "getSubgraphMaps", "(", "IAtomContainer", "sourceGraph", ",", "IAtomContainer", "targetGraph", ",", "boolean", "shouldMatchBonds", ")", "throws", "CDKException", "{", "return", "search", "(", "sour...
Returns all the subgraph 'bondA1 mappings' found for targetGraph in sourceGraph. This is an ArrayList of ArrayLists of CDKRMap objects. @param sourceGraph first molecule. Must not be an IQueryAtomContainer. @param targetGraph second molecule. May be an IQueryAtomContainer. @param shouldMatchBonds @return the list of all the 'mappings' found projected of sourceGraph @throws CDKException
[ "Returns", "all", "the", "subgraph", "bondA1", "mappings", "found", "for", "targetGraph", "in", "sourceGraph", ".", "This", "is", "an", "ArrayList", "of", "ArrayLists", "of", "CDKRMap", "objects", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKMCS.java#L266-L269
j-easy/easy-batch
easybatch-extensions/easybatch-quartz/src/main/java/org/easybatch/extensions/quartz/JobScheduler.java
JobScheduler.scheduleCron
public void scheduleCron(final org.easybatch.core.job.Job job, final String cronExpression) throws JobSchedulerException { checkNotNull(job, "job"); checkNotNull(cronExpression, "cronExpression"); String name = job.getName(); String jobName = JOB_NAME_PREFIX + name; String triggerName = TRIGGER_NAME_PREFIX + name; Trigger trigger = newTrigger() .withIdentity(triggerName) .withSchedule(cronSchedule(cronExpression)) .forJob(jobName) .build(); JobDetail jobDetail = getJobDetail(job, jobName); try { LOGGER.info("Scheduling job ''{}'' with cron expression {}", name, cronExpression); scheduler.scheduleJob(jobDetail, trigger); } catch (SchedulerException e) { throw new JobSchedulerException(format("Unable to schedule job '%s'", name), e); } }
java
public void scheduleCron(final org.easybatch.core.job.Job job, final String cronExpression) throws JobSchedulerException { checkNotNull(job, "job"); checkNotNull(cronExpression, "cronExpression"); String name = job.getName(); String jobName = JOB_NAME_PREFIX + name; String triggerName = TRIGGER_NAME_PREFIX + name; Trigger trigger = newTrigger() .withIdentity(triggerName) .withSchedule(cronSchedule(cronExpression)) .forJob(jobName) .build(); JobDetail jobDetail = getJobDetail(job, jobName); try { LOGGER.info("Scheduling job ''{}'' with cron expression {}", name, cronExpression); scheduler.scheduleJob(jobDetail, trigger); } catch (SchedulerException e) { throw new JobSchedulerException(format("Unable to schedule job '%s'", name), e); } }
[ "public", "void", "scheduleCron", "(", "final", "org", ".", "easybatch", ".", "core", ".", "job", ".", "Job", "job", ",", "final", "String", "cronExpression", ")", "throws", "JobSchedulerException", "{", "checkNotNull", "(", "job", ",", "\"job\"", ")", ";", ...
Schedule a job with a unix-like cron expression. @param job the job to schedule @param cronExpression the cron expression to use. For a complete tutorial about cron expressions, please refer to <a href="http://quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger">quartz reference documentation</a>.
[ "Schedule", "a", "job", "with", "a", "unix", "-", "like", "cron", "expression", "." ]
train
https://github.com/j-easy/easy-batch/blob/46286e1091dae1206674e2a30e0609c31feae36c/easybatch-extensions/easybatch-quartz/src/main/java/org/easybatch/extensions/quartz/JobScheduler.java#L273-L295
GCRC/nunaliit
nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java
PathComputer.computeSiteDesignDir
static public File computeSiteDesignDir(File installDir) { if( null != installDir ) { // Command-line package File templatesDir = new File(installDir, "internal/siteDesign"); if( templatesDir.exists() && templatesDir.isDirectory() ) { return templatesDir; } // Development environment File nunaliit2Dir = computeNunaliitDir(installDir); templatesDir = new File(nunaliit2Dir, "nunaliit2-couch-sdk/src/main/internal/siteDesign"); if( templatesDir.exists() && templatesDir.isDirectory() ) { return templatesDir; } } return null; }
java
static public File computeSiteDesignDir(File installDir) { if( null != installDir ) { // Command-line package File templatesDir = new File(installDir, "internal/siteDesign"); if( templatesDir.exists() && templatesDir.isDirectory() ) { return templatesDir; } // Development environment File nunaliit2Dir = computeNunaliitDir(installDir); templatesDir = new File(nunaliit2Dir, "nunaliit2-couch-sdk/src/main/internal/siteDesign"); if( templatesDir.exists() && templatesDir.isDirectory() ) { return templatesDir; } } return null; }
[ "static", "public", "File", "computeSiteDesignDir", "(", "File", "installDir", ")", "{", "if", "(", "null", "!=", "installDir", ")", "{", "// Command-line package", "File", "templatesDir", "=", "new", "File", "(", "installDir", ",", "\"internal/siteDesign\"", ")",...
Finds the "siteDesign" directory from the installation location and returns it. If the command-line tool is packaged and deployed, then the "siteDesign" directory is found at the root of the installation. If the command-line tool is run from the development environment, then the "siteDesign" directory is found in the SDK sub-project. @param installDir Directory where the command-line tool is run from. @return Directory where the site design document is located or null if not found.
[ "Finds", "the", "siteDesign", "directory", "from", "the", "installation", "location", "and", "returns", "it", ".", "If", "the", "command", "-", "line", "tool", "is", "packaged", "and", "deployed", "then", "the", "siteDesign", "directory", "is", "found", "at", ...
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java#L203-L220
eclipse/xtext-core
org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportUriGlobalScopeProvider.java
ImportUriGlobalScopeProvider.createURICollector
protected IAcceptor<String> createURICollector(Resource resource, Set<URI> collectInto) { ResourceSet resourceSet = resource.getResourceSet(); return new URICollector(resourceSet, collectInto); }
java
protected IAcceptor<String> createURICollector(Resource resource, Set<URI> collectInto) { ResourceSet resourceSet = resource.getResourceSet(); return new URICollector(resourceSet, collectInto); }
[ "protected", "IAcceptor", "<", "String", ">", "createURICollector", "(", "Resource", "resource", ",", "Set", "<", "URI", ">", "collectInto", ")", "{", "ResourceSet", "resourceSet", "=", "resource", ".", "getResourceSet", "(", ")", ";", "return", "new", "URICol...
Provides the acceptor for import URI strings that will populate the given {@link Set set of URIs}. The default implementation creates a new {@link URICollector}. I creates the imported URIs and normalizes potentially given class-path URIs to platform or file URIs. @since 2.5
[ "Provides", "the", "acceptor", "for", "import", "URI", "strings", "that", "will", "populate", "the", "given", "{", "@link", "Set", "set", "of", "URIs", "}", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/scoping/impl/ImportUriGlobalScopeProvider.java#L165-L168
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java
SVGPath.smoothCubicTo
public SVGPath smoothCubicTo(double[] c2xy, double[] xy) { return append(PATH_SMOOTH_CUBIC_TO).append(c2xy[0]).append(c2xy[1]).append(xy[0]).append(xy[1]); }
java
public SVGPath smoothCubicTo(double[] c2xy, double[] xy) { return append(PATH_SMOOTH_CUBIC_TO).append(c2xy[0]).append(c2xy[1]).append(xy[0]).append(xy[1]); }
[ "public", "SVGPath", "smoothCubicTo", "(", "double", "[", "]", "c2xy", ",", "double", "[", "]", "xy", ")", "{", "return", "append", "(", "PATH_SMOOTH_CUBIC_TO", ")", ".", "append", "(", "c2xy", "[", "0", "]", ")", ".", "append", "(", "c2xy", "[", "1"...
Smooth Cubic Bezier line to the given coordinates. @param c2xy second control point @param xy new coordinates @return path object, for compact syntax.
[ "Smooth", "Cubic", "Bezier", "line", "to", "the", "given", "coordinates", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPath.java#L420-L422
CloudSlang/cs-actions
cs-xml/src/main/java/io/cloudslang/content/xml/services/ApplyXslTransformationService.java
ApplyXslTransformationService.readSource
private Source readSource(String xmlDocument, String features) throws Exception { if (xmlDocument.startsWith(Constants.Inputs.HTTP_PREFIX_STRING) || xmlDocument.startsWith(Constants.Inputs.HTTPS_PREFIX_STRING)) { URL xmlUrl = new URL(xmlDocument); InputStream xmlStream = xmlUrl.openStream(); XmlUtils.parseXmlInputStream(xmlStream, features); return new StreamSource(xmlStream); } else { if (new File(xmlDocument).exists()) { XmlUtils.parseXmlFile(xmlDocument, features); return new StreamSource(new FileInputStream(xmlDocument)); } XmlUtils.parseXmlString(xmlDocument, features); return new StreamSource(new StringReader(xmlDocument)); } }
java
private Source readSource(String xmlDocument, String features) throws Exception { if (xmlDocument.startsWith(Constants.Inputs.HTTP_PREFIX_STRING) || xmlDocument.startsWith(Constants.Inputs.HTTPS_PREFIX_STRING)) { URL xmlUrl = new URL(xmlDocument); InputStream xmlStream = xmlUrl.openStream(); XmlUtils.parseXmlInputStream(xmlStream, features); return new StreamSource(xmlStream); } else { if (new File(xmlDocument).exists()) { XmlUtils.parseXmlFile(xmlDocument, features); return new StreamSource(new FileInputStream(xmlDocument)); } XmlUtils.parseXmlString(xmlDocument, features); return new StreamSource(new StringReader(xmlDocument)); } }
[ "private", "Source", "readSource", "(", "String", "xmlDocument", ",", "String", "features", ")", "throws", "Exception", "{", "if", "(", "xmlDocument", ".", "startsWith", "(", "Constants", ".", "Inputs", ".", "HTTP_PREFIX_STRING", ")", "||", "xmlDocument", ".", ...
Reads the xml content from a file, URL or string. @param xmlDocument xml document as String, path or URL @return the resulting xml after validation @throws Exception in case something went wrong
[ "Reads", "the", "xml", "content", "from", "a", "file", "URL", "or", "string", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-xml/src/main/java/io/cloudslang/content/xml/services/ApplyXslTransformationService.java#L74-L89
calimero-project/calimero-core
src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java
KNXNetworkLinkIP.newRoutingLink
public static KNXNetworkLinkIP newRoutingLink(final NetworkInterface netIf, final InetAddress mcGroup, final KNXMediumSettings settings) throws KNXException { return new KNXNetworkLinkIP(ROUTING, new KNXnetIPRouting(netIf, mcGroup), settings); }
java
public static KNXNetworkLinkIP newRoutingLink(final NetworkInterface netIf, final InetAddress mcGroup, final KNXMediumSettings settings) throws KNXException { return new KNXNetworkLinkIP(ROUTING, new KNXnetIPRouting(netIf, mcGroup), settings); }
[ "public", "static", "KNXNetworkLinkIP", "newRoutingLink", "(", "final", "NetworkInterface", "netIf", ",", "final", "InetAddress", "mcGroup", ",", "final", "KNXMediumSettings", "settings", ")", "throws", "KNXException", "{", "return", "new", "KNXNetworkLinkIP", "(", "R...
Creates a new network link using the {@link KNXnetIPRouting} protocol, with the local endpoint specified by a network interface. @param netIf local network interface used to join the multicast group and for sending, use <code>null</code> for the host's default multicast interface @param mcGroup address of the multicast group to join, use {@link #DefaultMulticast} for the default KNX IP multicast address @param settings medium settings defining device and medium specifics needed for communication @return the network link in open state @throws KNXException on failure establishing link using the KNXnet/IP connection
[ "Creates", "a", "new", "network", "link", "using", "the", "{", "@link", "KNXnetIPRouting", "}", "protocol", "with", "the", "local", "endpoint", "specified", "by", "a", "network", "interface", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java#L156-L160
google/closure-compiler
src/com/google/javascript/rhino/jstype/FunctionType.java
FunctionType.setPrototype
final boolean setPrototype(ObjectType prototype, Node propertyNode) { if (prototype == null) { return false; } // getInstanceType fails if the function is not a constructor if (isConstructor() && prototype == getInstanceType()) { return false; } return setPrototypeNoCheck(prototype, propertyNode); }
java
final boolean setPrototype(ObjectType prototype, Node propertyNode) { if (prototype == null) { return false; } // getInstanceType fails if the function is not a constructor if (isConstructor() && prototype == getInstanceType()) { return false; } return setPrototypeNoCheck(prototype, propertyNode); }
[ "final", "boolean", "setPrototype", "(", "ObjectType", "prototype", ",", "Node", "propertyNode", ")", "{", "if", "(", "prototype", "==", "null", ")", "{", "return", "false", ";", "}", "// getInstanceType fails if the function is not a constructor", "if", "(", "isCon...
Sets the prototype. @param prototype the prototype. If this value is {@code null} it will silently be discarded.
[ "Sets", "the", "prototype", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/FunctionType.java#L485-L494
vincentk/joptimizer
src/main/java/com/joptimizer/util/Utils.java
Utils.calculateScaledResidual
public static double calculateScaledResidual(DoubleMatrix2D A, DoubleMatrix1D x, DoubleMatrix1D b){ double residual = -Double.MAX_VALUE; double nix = Algebra.DEFAULT.normInfinity(x); double nib = Algebra.DEFAULT.normInfinity(b); if(Double.compare(nix, 0.)==0 && Double.compare(nib, 0.)==0){ return 0; }else{ double num = Algebra.DEFAULT.normInfinity(ColtUtils.zMult(A, x, b, -1)); double den = Algebra.DEFAULT.normInfinity(A) * nix + nib; residual = num / den; //log.debug("scaled residual: " + residual); return residual; } }
java
public static double calculateScaledResidual(DoubleMatrix2D A, DoubleMatrix1D x, DoubleMatrix1D b){ double residual = -Double.MAX_VALUE; double nix = Algebra.DEFAULT.normInfinity(x); double nib = Algebra.DEFAULT.normInfinity(b); if(Double.compare(nix, 0.)==0 && Double.compare(nib, 0.)==0){ return 0; }else{ double num = Algebra.DEFAULT.normInfinity(ColtUtils.zMult(A, x, b, -1)); double den = Algebra.DEFAULT.normInfinity(A) * nix + nib; residual = num / den; //log.debug("scaled residual: " + residual); return residual; } }
[ "public", "static", "double", "calculateScaledResidual", "(", "DoubleMatrix2D", "A", ",", "DoubleMatrix1D", "x", ",", "DoubleMatrix1D", "b", ")", "{", "double", "residual", "=", "-", "Double", ".", "MAX_VALUE", ";", "double", "nix", "=", "Algebra", ".", "DEFAU...
Calculate the scaled residual <br> ||Ax-b||_oo/( ||A||_oo . ||x||_oo + ||b||_oo ), with <br> ||x||_oo = max(||x[i]||)
[ "Calculate", "the", "scaled", "residual", "<br", ">", "||Ax", "-", "b||_oo", "/", "(", "||A||_oo", ".", "||x||_oo", "+", "||b||_oo", ")", "with", "<br", ">", "||x||_oo", "=", "max", "(", "||x", "[", "i", "]", "||", ")" ]
train
https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/util/Utils.java#L146-L160
apache/incubator-gobblin
gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanAjaxAPIClient.java
AzkabanAjaxAPIClient.authenticateAndGetSessionId
public static String authenticateAndGetSessionId(String username, String password, String azkabanServerUrl) throws IOException, EncoderException { // Create post request Map<String, String> params = Maps.newHashMap(); params.put("action", "login"); params.put("username", username); params.put("password", codec.encode(password)); return executePostRequest(preparePostRequest(azkabanServerUrl, null, params)).get("session.id"); }
java
public static String authenticateAndGetSessionId(String username, String password, String azkabanServerUrl) throws IOException, EncoderException { // Create post request Map<String, String> params = Maps.newHashMap(); params.put("action", "login"); params.put("username", username); params.put("password", codec.encode(password)); return executePostRequest(preparePostRequest(azkabanServerUrl, null, params)).get("session.id"); }
[ "public", "static", "String", "authenticateAndGetSessionId", "(", "String", "username", ",", "String", "password", ",", "String", "azkabanServerUrl", ")", "throws", "IOException", ",", "EncoderException", "{", "// Create post request", "Map", "<", "String", ",", "Stri...
* Authenticate a user and obtain a session.id from response. Once a session.id has been obtained, until the session expires, this id can be used to do any API requests with a proper permission granted. A session expires if user log's out, changes machine, browser or location, if Azkaban is restarted, or if the session expires. The default session timeout is 24 hours (one day). User can re-login irrespective of wheter the session has expired or not. For the same user, a new session will always override the old one. @param username Username. @param password Password. @param azkabanServerUrl Azkaban Server Url. @return Session Id. @throws IOException @throws EncoderException
[ "*", "Authenticate", "a", "user", "and", "obtain", "a", "session", ".", "id", "from", "response", ".", "Once", "a", "session", ".", "id", "has", "been", "obtained", "until", "the", "session", "expires", "this", "id", "can", "be", "used", "to", "do", "a...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanAjaxAPIClient.java#L84-L93
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/ScopeContainer.java
ScopeContainer.registerDestructionCallback
@Override public void registerDestructionCallback(String name, Runnable callback) { synchronized (this) { destructionCallbacks.put(name, callback); } }
java
@Override public void registerDestructionCallback(String name, Runnable callback) { synchronized (this) { destructionCallbacks.put(name, callback); } }
[ "@", "Override", "public", "void", "registerDestructionCallback", "(", "String", "name", ",", "Runnable", "callback", ")", "{", "synchronized", "(", "this", ")", "{", "destructionCallbacks", ".", "put", "(", "name", ",", "callback", ")", ";", "}", "}" ]
Register a bean destruction callback. @param name Bean name. @param callback Callback.
[ "Register", "a", "bean", "destruction", "callback", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/ScopeContainer.java#L79-L84
pravega/pravega
segmentstore/contracts/src/main/java/io/pravega/segmentstore/contracts/tables/TableEntry.java
TableEntry.notExists
public static TableEntry notExists(@NonNull ArrayView key, @NonNull ArrayView value) { return new TableEntry(TableKey.notExists(key), value); }
java
public static TableEntry notExists(@NonNull ArrayView key, @NonNull ArrayView value) { return new TableEntry(TableKey.notExists(key), value); }
[ "public", "static", "TableEntry", "notExists", "(", "@", "NonNull", "ArrayView", "key", ",", "@", "NonNull", "ArrayView", "value", ")", "{", "return", "new", "TableEntry", "(", "TableKey", ".", "notExists", "(", "key", ")", ",", "value", ")", ";", "}" ]
Creates a new instance of the TableEntry class that indicates the Key must not previously exist. @param key The Key. @param value The Value. @return newly created TableEntry if one for the key does not already exist.
[ "Creates", "a", "new", "instance", "of", "the", "TableEntry", "class", "that", "indicates", "the", "Key", "must", "not", "previously", "exist", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/contracts/src/main/java/io/pravega/segmentstore/contracts/tables/TableEntry.java#L55-L57
landawn/AbacusUtil
src/com/landawn/abacus/util/URLEncodedUtil.java
URLEncodedUtil.encUserInfo
static void encUserInfo(final StringBuilder sb, final String content, final Charset charset) { urlEncode(sb, content, charset, USERINFO, false); }
java
static void encUserInfo(final StringBuilder sb, final String content, final Charset charset) { urlEncode(sb, content, charset, USERINFO, false); }
[ "static", "void", "encUserInfo", "(", "final", "StringBuilder", "sb", ",", "final", "String", "content", ",", "final", "Charset", "charset", ")", "{", "urlEncode", "(", "sb", ",", "content", ",", "charset", ",", "USERINFO", ",", "false", ")", ";", "}" ]
Encode a String using the {@link #USERINFO} set of characters. <p> Used by URIBuilder to encode the userinfo segment. @param content the string to encode, does not convert space to '+' @param charset the charset to use @return the encoded string
[ "Encode", "a", "String", "using", "the", "{", "@link", "#USERINFO", "}", "set", "of", "characters", ".", "<p", ">", "Used", "by", "URIBuilder", "to", "encode", "the", "userinfo", "segment", ".", "@param", "content", "the", "string", "to", "encode", "does",...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/URLEncodedUtil.java#L514-L516
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/container/impl/deployment/StartProcessEngineStep.java
StartProcessEngineStep.configurePlugins
protected void configurePlugins(ProcessEngineConfigurationImpl configuration, ProcessEngineXml processEngineXml, ClassLoader classLoader) { for (ProcessEnginePluginXml pluginXml : processEngineXml.getPlugins()) { // create plugin instance Class<? extends ProcessEnginePlugin> pluginClass = loadClass(pluginXml.getPluginClass(), classLoader, ProcessEnginePlugin.class); ProcessEnginePlugin plugin = createInstance(pluginClass); // apply configured properties Map<String, String> properties = pluginXml.getProperties(); PropertyHelper.applyProperties(plugin, properties); // add to configuration configuration.getProcessEnginePlugins().add(plugin); } }
java
protected void configurePlugins(ProcessEngineConfigurationImpl configuration, ProcessEngineXml processEngineXml, ClassLoader classLoader) { for (ProcessEnginePluginXml pluginXml : processEngineXml.getPlugins()) { // create plugin instance Class<? extends ProcessEnginePlugin> pluginClass = loadClass(pluginXml.getPluginClass(), classLoader, ProcessEnginePlugin.class); ProcessEnginePlugin plugin = createInstance(pluginClass); // apply configured properties Map<String, String> properties = pluginXml.getProperties(); PropertyHelper.applyProperties(plugin, properties); // add to configuration configuration.getProcessEnginePlugins().add(plugin); } }
[ "protected", "void", "configurePlugins", "(", "ProcessEngineConfigurationImpl", "configuration", ",", "ProcessEngineXml", "processEngineXml", ",", "ClassLoader", "classLoader", ")", "{", "for", "(", "ProcessEnginePluginXml", "pluginXml", ":", "processEngineXml", ".", "getPl...
<p>Instantiates and applies all {@link ProcessEnginePlugin}s defined in the processEngineXml
[ "<p", ">", "Instantiates", "and", "applies", "all", "{" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/container/impl/deployment/StartProcessEngineStep.java#L133-L148
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/ItemCounter.java
ItemCounter.getAndSet
public long getAndSet(T item, long value) { MutableLong entry = map.get(item); if (entry == null) { entry = MutableLong.valueOf(value); map.put(item, entry); total += value; return 0; } long oldValue = entry.value; total = total - oldValue + value; entry.value = value; return oldValue; }
java
public long getAndSet(T item, long value) { MutableLong entry = map.get(item); if (entry == null) { entry = MutableLong.valueOf(value); map.put(item, entry); total += value; return 0; } long oldValue = entry.value; total = total - oldValue + value; entry.value = value; return oldValue; }
[ "public", "long", "getAndSet", "(", "T", "item", ",", "long", "value", ")", "{", "MutableLong", "entry", "=", "map", ".", "get", "(", "item", ")", ";", "if", "(", "entry", "==", "null", ")", "{", "entry", "=", "MutableLong", ".", "valueOf", "(", "v...
Set counter for item and return previous value @param item @param value @return
[ "Set", "counter", "for", "item", "and", "return", "previous", "value" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/ItemCounter.java#L166-L180
eclecticlogic/pedal-dialect
src/main/java/com/eclecticlogic/pedal/provider/hibernate/ArrayType.java
ArrayType.setArrayValue
protected void setArrayValue(final PreparedStatement statement, final int i, Connection connection, Object[] array) throws SQLException { if (array == null || (isEmptyStoredAsNull() && array.length == 0)) { statement.setNull(i, Types.ARRAY); } else { statement.setArray(i, connection.createArrayOf(getDialectPrimitiveName(), array)); } }
java
protected void setArrayValue(final PreparedStatement statement, final int i, Connection connection, Object[] array) throws SQLException { if (array == null || (isEmptyStoredAsNull() && array.length == 0)) { statement.setNull(i, Types.ARRAY); } else { statement.setArray(i, connection.createArrayOf(getDialectPrimitiveName(), array)); } }
[ "protected", "void", "setArrayValue", "(", "final", "PreparedStatement", "statement", ",", "final", "int", "i", ",", "Connection", "connection", ",", "Object", "[", "]", "array", ")", "throws", "SQLException", "{", "if", "(", "array", "==", "null", "||", "("...
Stores the array conforming to the EMPTY_IS_NULL directive. @see org.hibernate.usertype.UserType#nullSafeSet(java.sql.PreparedStatement, java.lang.Object, int, org.hibernate.engine.spi.SessionImplementor)
[ "Stores", "the", "array", "conforming", "to", "the", "EMPTY_IS_NULL", "directive", "." ]
train
https://github.com/eclecticlogic/pedal-dialect/blob/d92ccff34ef2363ce0db7ae4976302833182115b/src/main/java/com/eclecticlogic/pedal/provider/hibernate/ArrayType.java#L64-L71
alipay/sofa-rpc
core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java
AbstractCluster.selectPinpointProvider
protected ProviderInfo selectPinpointProvider(String targetIP, List<ProviderInfo> providerInfos) { ProviderInfo tp = ProviderHelper.toProviderInfo(targetIP); for (ProviderInfo providerInfo : providerInfos) { if (providerInfo.getHost().equals(tp.getHost()) && StringUtils.equals(providerInfo.getProtocolType(), tp.getProtocolType()) && providerInfo.getPort() == tp.getPort()) { return providerInfo; } } return null; }
java
protected ProviderInfo selectPinpointProvider(String targetIP, List<ProviderInfo> providerInfos) { ProviderInfo tp = ProviderHelper.toProviderInfo(targetIP); for (ProviderInfo providerInfo : providerInfos) { if (providerInfo.getHost().equals(tp.getHost()) && StringUtils.equals(providerInfo.getProtocolType(), tp.getProtocolType()) && providerInfo.getPort() == tp.getPort()) { return providerInfo; } } return null; }
[ "protected", "ProviderInfo", "selectPinpointProvider", "(", "String", "targetIP", ",", "List", "<", "ProviderInfo", ">", "providerInfos", ")", "{", "ProviderInfo", "tp", "=", "ProviderHelper", ".", "toProviderInfo", "(", "targetIP", ")", ";", "for", "(", "Provider...
Select provider. @param targetIP the target ip @return the provider
[ "Select", "provider", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java#L404-L414
alkacon/opencms-core
src/org/opencms/jsp/CmsJspActionElement.java
CmsJspActionElement.includeSilent
public void includeSilent(String target, String element, boolean editable, Map<String, Object> parameterMap) { try { include(target, element, editable, parameterMap); } catch (Throwable t) { // ignore } }
java
public void includeSilent(String target, String element, boolean editable, Map<String, Object> parameterMap) { try { include(target, element, editable, parameterMap); } catch (Throwable t) { // ignore } }
[ "public", "void", "includeSilent", "(", "String", "target", ",", "String", "element", ",", "boolean", "editable", ",", "Map", "<", "String", ",", "Object", ">", "parameterMap", ")", "{", "try", "{", "include", "(", "target", ",", "element", ",", "editable"...
Includes a named sub-element suppressing all Exceptions that occur during the include, otherwise the same as using {@link #include(String, String, Map)}.<p> This is a convenience method that allows to include elements on a page without checking if they exist or not. If the target element does not exist, nothing is printed to the JSP output.<p> @param target the target URI of the file in the OpenCms VFS (can be relative or absolute) @param element the element (template selector) to display from the target @param editable flag to indicate if direct edit should be enabled for the element @param parameterMap a map of the request parameters
[ "Includes", "a", "named", "sub", "-", "element", "suppressing", "all", "Exceptions", "that", "occur", "during", "the", "include", "otherwise", "the", "same", "as", "using", "{", "@link", "#include", "(", "String", "String", "Map", ")", "}", ".", "<p", ">" ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspActionElement.java#L630-L637
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/ParsedAddressGrouping.java
ParsedAddressGrouping.getHostSegmentIndex
public static int getHostSegmentIndex(int networkPrefixLength, int bytesPerSegment, int bitsPerSegment) { if(bytesPerSegment > 1) { if(bytesPerSegment == 2) { return networkPrefixLength >> 4; } return networkPrefixLength / bitsPerSegment; } return networkPrefixLength >> 3; }
java
public static int getHostSegmentIndex(int networkPrefixLength, int bytesPerSegment, int bitsPerSegment) { if(bytesPerSegment > 1) { if(bytesPerSegment == 2) { return networkPrefixLength >> 4; } return networkPrefixLength / bitsPerSegment; } return networkPrefixLength >> 3; }
[ "public", "static", "int", "getHostSegmentIndex", "(", "int", "networkPrefixLength", ",", "int", "bytesPerSegment", ",", "int", "bitsPerSegment", ")", "{", "if", "(", "bytesPerSegment", ">", "1", ")", "{", "if", "(", "bytesPerSegment", "==", "2", ")", "{", "...
Returns the index of the segment containing the first byte outside the network prefix. When networkPrefixLength is null, or it matches or exceeds the bit length, returns the segment count. @param networkPrefixLength @param byteLength @return
[ "Returns", "the", "index", "of", "the", "segment", "containing", "the", "first", "byte", "outside", "the", "network", "prefix", ".", "When", "networkPrefixLength", "is", "null", "or", "it", "matches", "or", "exceeds", "the", "bit", "length", "returns", "the", ...
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/ParsedAddressGrouping.java#L52-L60
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/QuotedStringTokenizer.java
QuotedStringTokenizer.charsMatch
private boolean charsMatch(char[] chars, int pos1, int len1, int pos2, int len2) { if (len1 != len2) { return false; } if (pos1 + len1 > chars.length || pos2 + len2 > chars.length) { return false; } for (int i = 0; i < len1; i++) { if (chars[pos1 + i] != chars[pos2 + i]) { return false; } } return true; }
java
private boolean charsMatch(char[] chars, int pos1, int len1, int pos2, int len2) { if (len1 != len2) { return false; } if (pos1 + len1 > chars.length || pos2 + len2 > chars.length) { return false; } for (int i = 0; i < len1; i++) { if (chars[pos1 + i] != chars[pos2 + i]) { return false; } } return true; }
[ "private", "boolean", "charsMatch", "(", "char", "[", "]", "chars", ",", "int", "pos1", ",", "int", "len1", ",", "int", "pos2", ",", "int", "len2", ")", "{", "if", "(", "len1", "!=", "len2", ")", "{", "return", "false", ";", "}", "if", "(", "pos1...
@return true if two sequences of chars match within the array. @param chars char set @param pos1 pos 1 @param len1 length 1 @param pos2 pos 2 @param len2 length 2
[ "@return", "true", "if", "two", "sequences", "of", "chars", "match", "within", "the", "array", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/QuotedStringTokenizer.java#L200-L213
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java
ImageModerationsImpl.evaluateUrlInputWithServiceResponseAsync
public Observable<ServiceResponse<Evaluate>> evaluateUrlInputWithServiceResponseAsync(String contentType, BodyModelModel imageUrl, EvaluateUrlInputOptionalParameter evaluateUrlInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (contentType == null) { throw new IllegalArgumentException("Parameter contentType is required and cannot be null."); } if (imageUrl == null) { throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null."); } Validator.validate(imageUrl); final Boolean cacheImage = evaluateUrlInputOptionalParameter != null ? evaluateUrlInputOptionalParameter.cacheImage() : null; return evaluateUrlInputWithServiceResponseAsync(contentType, imageUrl, cacheImage); }
java
public Observable<ServiceResponse<Evaluate>> evaluateUrlInputWithServiceResponseAsync(String contentType, BodyModelModel imageUrl, EvaluateUrlInputOptionalParameter evaluateUrlInputOptionalParameter) { if (this.client.baseUrl() == null) { throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null."); } if (contentType == null) { throw new IllegalArgumentException("Parameter contentType is required and cannot be null."); } if (imageUrl == null) { throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null."); } Validator.validate(imageUrl); final Boolean cacheImage = evaluateUrlInputOptionalParameter != null ? evaluateUrlInputOptionalParameter.cacheImage() : null; return evaluateUrlInputWithServiceResponseAsync(contentType, imageUrl, cacheImage); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Evaluate", ">", ">", "evaluateUrlInputWithServiceResponseAsync", "(", "String", "contentType", ",", "BodyModelModel", "imageUrl", ",", "EvaluateUrlInputOptionalParameter", "evaluateUrlInputOptionalParameter", ")", "{", "if...
Returns probabilities of the image containing racy or adult content. @param contentType The content type. @param imageUrl The image url. @param evaluateUrlInputOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Evaluate object
[ "Returns", "probabilities", "of", "the", "image", "containing", "racy", "or", "adult", "content", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1624-L1638
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobsInner.java
JobsInner.listByResourceGroupAsync
public Observable<Page<JobInner>> listByResourceGroupAsync(final String resourceGroupName, final JobsListByResourceGroupOptions jobsListByResourceGroupOptions) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, jobsListByResourceGroupOptions) .map(new Func1<ServiceResponse<Page<JobInner>>, Page<JobInner>>() { @Override public Page<JobInner> call(ServiceResponse<Page<JobInner>> response) { return response.body(); } }); }
java
public Observable<Page<JobInner>> listByResourceGroupAsync(final String resourceGroupName, final JobsListByResourceGroupOptions jobsListByResourceGroupOptions) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, jobsListByResourceGroupOptions) .map(new Func1<ServiceResponse<Page<JobInner>>, Page<JobInner>>() { @Override public Page<JobInner> call(ServiceResponse<Page<JobInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "JobInner", ">", ">", "listByResourceGroupAsync", "(", "final", "String", "resourceGroupName", ",", "final", "JobsListByResourceGroupOptions", "jobsListByResourceGroupOptions", ")", "{", "return", "listByResourceGroupWithServiceRespon...
Gets information about the Batch AI jobs associated within the specified resource group. @param resourceGroupName Name of the resource group to which the resource belongs. @param jobsListByResourceGroupOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;JobInner&gt; object
[ "Gets", "information", "about", "the", "Batch", "AI", "jobs", "associated", "within", "the", "specified", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobsInner.java#L1214-L1222
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.readResources
public List<CmsResource> readResources( CmsDbContext dbc, CmsResource parent, CmsResourceFilter filter, boolean readTree) throws CmsException, CmsDataAccessException { // try to get the sub resources from the cache String cacheKey = getCacheKey( new String[] {dbc.currentUser().getName(), filter.getCacheId(), readTree ? "+" : "-", parent.getRootPath()}, dbc); List<CmsResource> resourceList = m_monitor.getCachedResourceList(cacheKey); if ((resourceList == null) || !dbc.getProjectId().isNullUUID()) { // read the result from the database resourceList = getVfsDriver(dbc).readResourceTree( dbc, dbc.currentProject().getUuid(), (readTree ? parent.getRootPath() : parent.getStructureId().toString()), filter.getType(), filter.getState(), filter.getModifiedAfter(), filter.getModifiedBefore(), filter.getReleaseAfter(), filter.getReleaseBefore(), filter.getExpireAfter(), filter.getExpireBefore(), (readTree ? CmsDriverManager.READMODE_INCLUDE_TREE : CmsDriverManager.READMODE_EXCLUDE_TREE) | (filter.excludeType() ? CmsDriverManager.READMODE_EXCLUDE_TYPE : 0) | (filter.excludeState() ? CmsDriverManager.READMODE_EXCLUDE_STATE : 0) | ((filter.getOnlyFolders() != null) ? (filter.getOnlyFolders().booleanValue() ? CmsDriverManager.READMODE_ONLY_FOLDERS : CmsDriverManager.READMODE_ONLY_FILES) : 0)); // HACK: do not take care of permissions if reading organizational units if (!parent.getRootPath().startsWith("/system/orgunits/")) { // apply permission filter resourceList = filterPermissions(dbc, resourceList, filter); } // store the result in the resourceList cache if (dbc.getProjectId().isNullUUID()) { m_monitor.cacheResourceList(cacheKey, resourceList); } } // we must always apply the result filter and update the context dates return updateContextDates(dbc, resourceList, filter); }
java
public List<CmsResource> readResources( CmsDbContext dbc, CmsResource parent, CmsResourceFilter filter, boolean readTree) throws CmsException, CmsDataAccessException { // try to get the sub resources from the cache String cacheKey = getCacheKey( new String[] {dbc.currentUser().getName(), filter.getCacheId(), readTree ? "+" : "-", parent.getRootPath()}, dbc); List<CmsResource> resourceList = m_monitor.getCachedResourceList(cacheKey); if ((resourceList == null) || !dbc.getProjectId().isNullUUID()) { // read the result from the database resourceList = getVfsDriver(dbc).readResourceTree( dbc, dbc.currentProject().getUuid(), (readTree ? parent.getRootPath() : parent.getStructureId().toString()), filter.getType(), filter.getState(), filter.getModifiedAfter(), filter.getModifiedBefore(), filter.getReleaseAfter(), filter.getReleaseBefore(), filter.getExpireAfter(), filter.getExpireBefore(), (readTree ? CmsDriverManager.READMODE_INCLUDE_TREE : CmsDriverManager.READMODE_EXCLUDE_TREE) | (filter.excludeType() ? CmsDriverManager.READMODE_EXCLUDE_TYPE : 0) | (filter.excludeState() ? CmsDriverManager.READMODE_EXCLUDE_STATE : 0) | ((filter.getOnlyFolders() != null) ? (filter.getOnlyFolders().booleanValue() ? CmsDriverManager.READMODE_ONLY_FOLDERS : CmsDriverManager.READMODE_ONLY_FILES) : 0)); // HACK: do not take care of permissions if reading organizational units if (!parent.getRootPath().startsWith("/system/orgunits/")) { // apply permission filter resourceList = filterPermissions(dbc, resourceList, filter); } // store the result in the resourceList cache if (dbc.getProjectId().isNullUUID()) { m_monitor.cacheResourceList(cacheKey, resourceList); } } // we must always apply the result filter and update the context dates return updateContextDates(dbc, resourceList, filter); }
[ "public", "List", "<", "CmsResource", ">", "readResources", "(", "CmsDbContext", "dbc", ",", "CmsResource", "parent", ",", "CmsResourceFilter", "filter", ",", "boolean", "readTree", ")", "throws", "CmsException", ",", "CmsDataAccessException", "{", "// try to get the ...
Reads all resources below the given path matching the filter criteria, including the full tree below the path only in case the <code>readTree</code> parameter is <code>true</code>.<p> @param dbc the current database context @param parent the parent path to read the resources from @param filter the filter @param readTree <code>true</code> to read all subresources @return a list of <code>{@link CmsResource}</code> objects matching the filter criteria @throws CmsDataAccessException if the bare reading of the resources fails @throws CmsException if security and permission checks for the resources read fail
[ "Reads", "all", "resources", "below", "the", "given", "path", "matching", "the", "filter", "criteria", "including", "the", "full", "tree", "below", "the", "path", "only", "in", "case", "the", "<code", ">", "readTree<", "/", "code", ">", "parameter", "is", ...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7703-L7751
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneSession.java
SaneSession.writePassword
private void writePassword(String resource, String password) throws IOException { String[] resourceParts = resource.split("\\$MD5\\$"); if (resourceParts.length == 1) { // Write in clean outputStream.write(password); } else { outputStream.write("$MD5$" + SanePasswordEncoder.derivePassword(resourceParts[1], password)); } }
java
private void writePassword(String resource, String password) throws IOException { String[] resourceParts = resource.split("\\$MD5\\$"); if (resourceParts.length == 1) { // Write in clean outputStream.write(password); } else { outputStream.write("$MD5$" + SanePasswordEncoder.derivePassword(resourceParts[1], password)); } }
[ "private", "void", "writePassword", "(", "String", "resource", ",", "String", "password", ")", "throws", "IOException", "{", "String", "[", "]", "resourceParts", "=", "resource", ".", "split", "(", "\"\\\\$MD5\\\\$\"", ")", ";", "if", "(", "resourceParts", "."...
Write password to outputstream depending on resource provided by saned. @param resource as provided by sane in authorization request @param password @throws IOException
[ "Write", "password", "to", "outputstream", "depending", "on", "resource", "provided", "by", "saned", "." ]
train
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L375-L383
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/common/StringUtils.java
StringUtils.equalsIgnoreCase
public static boolean equalsIgnoreCase(String str1, String str2) { return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2); }
java
public static boolean equalsIgnoreCase(String str1, String str2) { return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2); }
[ "public", "static", "boolean", "equalsIgnoreCase", "(", "String", "str1", ",", "String", "str2", ")", "{", "return", "str1", "==", "null", "?", "str2", "==", "null", ":", "str1", ".", "equalsIgnoreCase", "(", "str2", ")", ";", "}" ]
<p>Compares two Strings, returning <code>true</code> if they are equal ignoring the case.</p> <p><code>null</code>s are handled without exceptions. Two <code>null</code> references are considered equal. Comparison is case insensitive.</p> <pre> StringUtils.equalsIgnoreCase(null, null) = true StringUtils.equalsIgnoreCase(null, "abc") = false StringUtils.equalsIgnoreCase("abc", null) = false StringUtils.equalsIgnoreCase("abc", "abc") = true StringUtils.equalsIgnoreCase("abc", "ABC") = true </pre> @param str1 the first String, may be null @param str2 the second String, may be null @return <code>true</code> if the Strings are equal, case insensitive, or both <code>null</code>
[ "<p", ">", "Compares", "two", "Strings", "returning", "<code", ">", "true<", "/", "code", ">", "if", "they", "are", "equal", "ignoring", "the", "case", ".", "<", "/", "p", ">", "<p", ">", "<code", ">", "null<", "/", "code", ">", "s", "are", "handle...
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/StringUtils.java#L289-L291
resilience4j/resilience4j
resilience4j-ratelimiter/src/main/java/io/github/resilience4j/ratelimiter/internal/AtomicRateLimiter.java
AtomicRateLimiter.compareAndSet
private boolean compareAndSet(final State current, final State next) { if (state.compareAndSet(current, next)) { return true; } parkNanos(1); // back-off return false; }
java
private boolean compareAndSet(final State current, final State next) { if (state.compareAndSet(current, next)) { return true; } parkNanos(1); // back-off return false; }
[ "private", "boolean", "compareAndSet", "(", "final", "State", "current", ",", "final", "State", "next", ")", "{", "if", "(", "state", ".", "compareAndSet", "(", "current", ",", "next", ")", ")", "{", "return", "true", ";", "}", "parkNanos", "(", "1", "...
Atomically sets the value to the given updated value if the current value {@code ==} the expected value. It differs from {@link AtomicReference#updateAndGet(UnaryOperator)} by constant back off. It means that after one try to {@link AtomicReference#compareAndSet(Object, Object)} this method will wait for a while before try one more time. This technique was originally described in this <a href="https://arxiv.org/abs/1305.5800"> paper</a> and showed great results with {@link AtomicRateLimiter} in benchmark tests. @param current the expected value @param next the new value @return {@code true} if successful. False return indicates that the actual value was not equal to the expected value.
[ "Atomically", "sets", "the", "value", "to", "the", "given", "updated", "value", "if", "the", "current", "value", "{", "@code", "==", "}", "the", "expected", "value", ".", "It", "differs", "from", "{", "@link", "AtomicReference#updateAndGet", "(", "UnaryOperato...
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-ratelimiter/src/main/java/io/github/resilience4j/ratelimiter/internal/AtomicRateLimiter.java#L172-L178
TheHortonMachine/hortonmachine
dbs/src/main/java/jsqlite/Database.java
Database.create_aggregate
public void create_aggregate( String name, int nargs, Function f ) { synchronized (this) { _create_aggregate(name, nargs, f); } }
java
public void create_aggregate( String name, int nargs, Function f ) { synchronized (this) { _create_aggregate(name, nargs, f); } }
[ "public", "void", "create_aggregate", "(", "String", "name", ",", "int", "nargs", ",", "Function", "f", ")", "{", "synchronized", "(", "this", ")", "{", "_create_aggregate", "(", "name", ",", "nargs", ",", "f", ")", ";", "}", "}" ]
Create aggregate function. @param name the name of the new function @param nargs number of arguments to function @param f interface of function
[ "Create", "aggregate", "function", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/jsqlite/Database.java#L469-L473
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/locking/AbstractTxLockingInterceptor.java
AbstractTxLockingInterceptor.lockOrRegisterBackupLock
final KeyAwareLockPromise lockOrRegisterBackupLock(TxInvocationContext<?> ctx, Object key, long lockTimeout) throws InterruptedException { switch (cdl.getCacheTopology().getDistribution(key).writeOwnership()) { case PRIMARY: if (trace) { getLog().tracef("Acquiring locks on %s.", toStr(key)); } return checkPendingAndLockKey(ctx, key, lockTimeout); case BACKUP: if (trace) { getLog().tracef("Acquiring backup locks on %s.", key); } ctx.getCacheTransaction().addBackupLockForKey(key); default: return KeyAwareLockPromise.NO_OP; } }
java
final KeyAwareLockPromise lockOrRegisterBackupLock(TxInvocationContext<?> ctx, Object key, long lockTimeout) throws InterruptedException { switch (cdl.getCacheTopology().getDistribution(key).writeOwnership()) { case PRIMARY: if (trace) { getLog().tracef("Acquiring locks on %s.", toStr(key)); } return checkPendingAndLockKey(ctx, key, lockTimeout); case BACKUP: if (trace) { getLog().tracef("Acquiring backup locks on %s.", key); } ctx.getCacheTransaction().addBackupLockForKey(key); default: return KeyAwareLockPromise.NO_OP; } }
[ "final", "KeyAwareLockPromise", "lockOrRegisterBackupLock", "(", "TxInvocationContext", "<", "?", ">", "ctx", ",", "Object", "key", ",", "long", "lockTimeout", ")", "throws", "InterruptedException", "{", "switch", "(", "cdl", ".", "getCacheTopology", "(", ")", "."...
The backup (non-primary) owners keep a "backup lock" for each key they received in a lock/prepare command. Normally there can be many transactions holding the backup lock at the same time, but when the secondary owner becomes a primary owner a new transaction trying to obtain the "real" lock will have to wait for all backup locks to be released. The backup lock will be released either by a commit/rollback/unlock command or by the originator leaving the cluster (if recovery is disabled).
[ "The", "backup", "(", "non", "-", "primary", ")", "owners", "keep", "a", "backup", "lock", "for", "each", "key", "they", "received", "in", "a", "lock", "/", "prepare", "command", ".", "Normally", "there", "can", "be", "many", "transactions", "holding", "...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/locking/AbstractTxLockingInterceptor.java#L66-L82
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/EditController.java
EditController.disableResponses
@RequestMapping(value = "api/edit/disable", method = RequestMethod.POST) public @ResponseBody String disableResponses(Model model, int path_id, @RequestParam(defaultValue = Constants.PROFILE_CLIENT_DEFAULT_ID) String clientUUID) throws Exception { OverrideService.getInstance().disableAllOverrides(path_id, clientUUID); //TODO also need to disable custom override if there is one of those editService.removeCustomOverride(path_id, clientUUID); return null; }
java
@RequestMapping(value = "api/edit/disable", method = RequestMethod.POST) public @ResponseBody String disableResponses(Model model, int path_id, @RequestParam(defaultValue = Constants.PROFILE_CLIENT_DEFAULT_ID) String clientUUID) throws Exception { OverrideService.getInstance().disableAllOverrides(path_id, clientUUID); //TODO also need to disable custom override if there is one of those editService.removeCustomOverride(path_id, clientUUID); return null; }
[ "@", "RequestMapping", "(", "value", "=", "\"api/edit/disable\"", ",", "method", "=", "RequestMethod", ".", "POST", ")", "public", "@", "ResponseBody", "String", "disableResponses", "(", "Model", "model", ",", "int", "path_id", ",", "@", "RequestParam", "(", "...
disables the responses for a given pathname and user id @param model @param path_id @param clientUUID @return @throws Exception
[ "disables", "the", "responses", "for", "a", "given", "pathname", "and", "user", "id" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/EditController.java#L150-L159
cbeust/jcommander
src/main/java/com/beust/jcommander/DefaultUsageFormatter.java
DefaultUsageFormatter.wrapDescription
public void wrapDescription(StringBuilder out, int indent, int currentLineIndent, String description) { int max = commander.getColumnSize(); String[] words = description.split(" "); int current = currentLineIndent; for (int i = 0; i < words.length; i++) { String word = words[i]; if (word.length() > max || current + 1 + word.length() <= max) { out.append(word); current += word.length(); if (i != words.length - 1) { out.append(" "); current++; } } else { out.append("\n").append(s(indent)).append(word).append(" "); current = indent + word.length() + 1; } } }
java
public void wrapDescription(StringBuilder out, int indent, int currentLineIndent, String description) { int max = commander.getColumnSize(); String[] words = description.split(" "); int current = currentLineIndent; for (int i = 0; i < words.length; i++) { String word = words[i]; if (word.length() > max || current + 1 + word.length() <= max) { out.append(word); current += word.length(); if (i != words.length - 1) { out.append(" "); current++; } } else { out.append("\n").append(s(indent)).append(word).append(" "); current = indent + word.length() + 1; } } }
[ "public", "void", "wrapDescription", "(", "StringBuilder", "out", ",", "int", "indent", ",", "int", "currentLineIndent", ",", "String", "description", ")", "{", "int", "max", "=", "commander", ".", "getColumnSize", "(", ")", ";", "String", "[", "]", "words",...
Wrap a potentially long line to the value obtained by calling {@link JCommander#getColumnSize()} on the underlying commander instance. @param out the output @param indent the indentation in spaces for lines after the first line. @param currentLineIndent the length of the indentation of the initial line @param description the text to wrap. No extra spaces are inserted before {@code description}. If the first line needs to be indented prepend the correct number of spaces to {@code description}.
[ "Wrap", "a", "potentially", "long", "line", "to", "the", "value", "obtained", "by", "calling", "{", "@link", "JCommander#getColumnSize", "()", "}", "on", "the", "underlying", "commander", "instance", "." ]
train
https://github.com/cbeust/jcommander/blob/85cb6f7217e15f62225185ffd97491f34b7b49bb/src/main/java/com/beust/jcommander/DefaultUsageFormatter.java#L320-L341
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/util/TrustEverythingSSLTrustManager.java
TrustEverythingSSLTrustManager.trustAllSSLCertificates
public static void trustAllSSLCertificates(HttpsURLConnection connection) { getTrustingSSLSocketFactory(); connection.setSSLSocketFactory(socketFactory); connection.setHostnameVerifier(new HostnameVerifier() { public boolean verify(String s, SSLSession sslSession) { return true; } }); }
java
public static void trustAllSSLCertificates(HttpsURLConnection connection) { getTrustingSSLSocketFactory(); connection.setSSLSocketFactory(socketFactory); connection.setHostnameVerifier(new HostnameVerifier() { public boolean verify(String s, SSLSession sslSession) { return true; } }); }
[ "public", "static", "void", "trustAllSSLCertificates", "(", "HttpsURLConnection", "connection", ")", "{", "getTrustingSSLSocketFactory", "(", ")", ";", "connection", ".", "setSSLSocketFactory", "(", "socketFactory", ")", ";", "connection", ".", "setHostnameVerifier", "(...
Configures a single HttpsURLConnection to trust all SSL certificates. @param connection an HttpsURLConnection which will be configured to trust all certs
[ "Configures", "a", "single", "HttpsURLConnection", "to", "trust", "all", "SSL", "certificates", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/util/TrustEverythingSSLTrustManager.java#L58-L66
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionAddressId.java
RegionAddressId.of
public static RegionAddressId of(String region, String address) { return new RegionAddressId(null, region, address); }
java
public static RegionAddressId of(String region, String address) { return new RegionAddressId(null, region, address); }
[ "public", "static", "RegionAddressId", "of", "(", "String", "region", ",", "String", "address", ")", "{", "return", "new", "RegionAddressId", "(", "null", ",", "region", ",", "address", ")", ";", "}" ]
Returns a region address identity given the region and address names. The address name must be 1-63 characters long and comply with RFC1035. Specifically, the name must match the regular expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. @see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a>
[ "Returns", "a", "region", "address", "identity", "given", "the", "region", "and", "address", "names", ".", "The", "address", "name", "must", "be", "1", "-", "63", "characters", "long", "and", "comply", "with", "RFC1035", ".", "Specifically", "the", "name", ...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionAddressId.java#L112-L114
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.partialUpdateObject
public JSONObject partialUpdateObject(JSONObject partialObject, String objectID) throws AlgoliaException { return partialUpdateObject(partialObject, objectID, true, RequestOptions.empty); }
java
public JSONObject partialUpdateObject(JSONObject partialObject, String objectID) throws AlgoliaException { return partialUpdateObject(partialObject, objectID, true, RequestOptions.empty); }
[ "public", "JSONObject", "partialUpdateObject", "(", "JSONObject", "partialObject", ",", "String", "objectID", ")", "throws", "AlgoliaException", "{", "return", "partialUpdateObject", "(", "partialObject", ",", "objectID", ",", "true", ",", "RequestOptions", ".", "empt...
Update partially an object (only update attributes passed in argument), create the object if it does not exist @param partialObject the object to override
[ "Update", "partially", "an", "object", "(", "only", "update", "attributes", "passed", "in", "argument", ")", "create", "the", "object", "if", "it", "does", "not", "exist" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L356-L358
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java
ExecutableMemberDocImpl.parameters
public Parameter[] parameters() { // generate the parameters on the fly: they're not cached List<VarSymbol> params = sym.params(); Parameter result[] = new Parameter[params.length()]; int i = 0; for (VarSymbol param : params) { result[i++] = new ParameterImpl(env, param); } return result; }
java
public Parameter[] parameters() { // generate the parameters on the fly: they're not cached List<VarSymbol> params = sym.params(); Parameter result[] = new Parameter[params.length()]; int i = 0; for (VarSymbol param : params) { result[i++] = new ParameterImpl(env, param); } return result; }
[ "public", "Parameter", "[", "]", "parameters", "(", ")", "{", "// generate the parameters on the fly: they're not cached", "List", "<", "VarSymbol", ">", "params", "=", "sym", ".", "params", "(", ")", ";", "Parameter", "result", "[", "]", "=", "new", "Parameter...
Get argument information. @see ParameterImpl @return an array of ParameterImpl, one element per argument in the order the arguments are present.
[ "Get", "argument", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ExecutableMemberDocImpl.java#L187-L197
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java
PageInBrowserStats.getTotalDomLoadTime
public long getTotalDomLoadTime(final String intervalName, final TimeUnit unit) { return unit.transformMillis(totalDomLoadTime.getValueAsLong(intervalName)); }
java
public long getTotalDomLoadTime(final String intervalName, final TimeUnit unit) { return unit.transformMillis(totalDomLoadTime.getValueAsLong(intervalName)); }
[ "public", "long", "getTotalDomLoadTime", "(", "final", "String", "intervalName", ",", "final", "TimeUnit", "unit", ")", "{", "return", "unit", ".", "transformMillis", "(", "totalDomLoadTime", ".", "getValueAsLong", "(", "intervalName", ")", ")", ";", "}" ]
Returns total DOM loads time for given interval and {@link TimeUnit}. @param intervalName name of the interval @param unit {@link TimeUnit} @return total DOM loads time
[ "Returns", "total", "DOM", "loads", "time", "for", "given", "interval", "and", "{", "@link", "TimeUnit", "}", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L164-L166
watson-developer-cloud/java-sdk
examples/src/main/java/com/ibm/watson/assistant/v1/tone_analyzer_integration/ToneDetection.java
ToneDetection.updateSocialTone
@SuppressWarnings("unchecked") public static void updateSocialTone(Map<String, Object> user, List<ToneScore> socialTone, boolean maintainHistory) { List<String> currentSocial = new ArrayList<String>(); Map<String, Object> currentSocialObject = new HashMap<String, Object>(); for (ToneScore tone : socialTone) { if (tone.getScore() >= SOCIAL_HIGH_SCORE_THRESHOLD) { currentSocial.add(tone.getToneName().toLowerCase() + "_high"); currentSocialObject.put("tone_name", tone.getToneName().toLowerCase()); currentSocialObject.put("score", tone.getScore()); currentSocialObject.put("interpretation", "likely high"); } else if (tone.getScore() <= SOCIAL_LOW_SCORE_THRESHOLD) { currentSocial.add(tone.getToneName().toLowerCase() + "_low"); currentSocialObject.put("tone_name", tone.getToneName().toLowerCase()); currentSocialObject.put("score", tone.getScore()); currentSocialObject.put("interpretation", "likely low"); } else { currentSocialObject.put("tone_name", tone.getToneName().toLowerCase()); currentSocialObject.put("score", tone.getScore()); currentSocialObject.put("interpretation", "likely medium"); } } // update user language tone Map<String, Object> social = (Map<String, Object>) ((Map<String, Object>) user.get("tone")).get("social"); social.put("current", currentSocial); // if history needs to be maintained if (maintainHistory) { List<Map<String, Object>> history = new ArrayList<Map<String, Object>>(); if (social.get("history") != null) { history = (List<Map<String, Object>>) social.get("history"); } history.add(currentSocialObject); social.put("history", history); } }
java
@SuppressWarnings("unchecked") public static void updateSocialTone(Map<String, Object> user, List<ToneScore> socialTone, boolean maintainHistory) { List<String> currentSocial = new ArrayList<String>(); Map<String, Object> currentSocialObject = new HashMap<String, Object>(); for (ToneScore tone : socialTone) { if (tone.getScore() >= SOCIAL_HIGH_SCORE_THRESHOLD) { currentSocial.add(tone.getToneName().toLowerCase() + "_high"); currentSocialObject.put("tone_name", tone.getToneName().toLowerCase()); currentSocialObject.put("score", tone.getScore()); currentSocialObject.put("interpretation", "likely high"); } else if (tone.getScore() <= SOCIAL_LOW_SCORE_THRESHOLD) { currentSocial.add(tone.getToneName().toLowerCase() + "_low"); currentSocialObject.put("tone_name", tone.getToneName().toLowerCase()); currentSocialObject.put("score", tone.getScore()); currentSocialObject.put("interpretation", "likely low"); } else { currentSocialObject.put("tone_name", tone.getToneName().toLowerCase()); currentSocialObject.put("score", tone.getScore()); currentSocialObject.put("interpretation", "likely medium"); } } // update user language tone Map<String, Object> social = (Map<String, Object>) ((Map<String, Object>) user.get("tone")).get("social"); social.put("current", currentSocial); // if history needs to be maintained if (maintainHistory) { List<Map<String, Object>> history = new ArrayList<Map<String, Object>>(); if (social.get("history") != null) { history = (List<Map<String, Object>>) social.get("history"); } history.add(currentSocialObject); social.put("history", history); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "void", "updateSocialTone", "(", "Map", "<", "String", ",", "Object", ">", "user", ",", "List", "<", "ToneScore", ">", "socialTone", ",", "boolean", "maintainHistory", ")", "{", "List", ...
updateSocialTone updates the user with the social tones interpreted based on the specified thresholds. @param user a json object representing user information (tone) to be used in conversing with the Assistant Service @param socialTone a json object containing the social tones in the payload returned by the Tone Analyzer @param maintainHistory the maintain history
[ "updateSocialTone", "updates", "the", "user", "with", "the", "social", "tones", "interpreted", "based", "on", "the", "specified", "thresholds", "." ]
train
https://github.com/watson-developer-cloud/java-sdk/blob/c926117afd20e2002b69942537720ab733a914f3/examples/src/main/java/com/ibm/watson/assistant/v1/tone_analyzer_integration/ToneDetection.java#L241-L278
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/crf/CRFClassifier.java
CRFClassifier.printFirstOrderProbs
public void printFirstOrderProbs(String filename, DocumentReaderAndWriter<IN> readerAndWriter) { // only for the OCR data does this matter flags.ocrTrain = false; ObjectBank<List<IN>> docs = makeObjectBankFromFile(filename, readerAndWriter); printFirstOrderProbsDocuments(docs); }
java
public void printFirstOrderProbs(String filename, DocumentReaderAndWriter<IN> readerAndWriter) { // only for the OCR data does this matter flags.ocrTrain = false; ObjectBank<List<IN>> docs = makeObjectBankFromFile(filename, readerAndWriter); printFirstOrderProbsDocuments(docs); }
[ "public", "void", "printFirstOrderProbs", "(", "String", "filename", ",", "DocumentReaderAndWriter", "<", "IN", ">", "readerAndWriter", ")", "{", "// only for the OCR data does this matter\r", "flags", ".", "ocrTrain", "=", "false", ";", "ObjectBank", "<", "List", "<"...
Takes the file, reads it in, and prints out the likelihood of each possible label at each point. This gives a simple way to examine the probability distributions of the CRF. See <code>getCliqueTrees()</code> for more. @param filename The path to the specified file
[ "Takes", "the", "file", "reads", "it", "in", "and", "prints", "out", "the", "likelihood", "of", "each", "possible", "label", "at", "each", "point", ".", "This", "gives", "a", "simple", "way", "to", "examine", "the", "probability", "distributions", "of", "t...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/crf/CRFClassifier.java#L1393-L1399
brianwhu/xillium
base/src/main/java/org/xillium/base/text/Balanced.java
Balanced.indexOf
public static int indexOf(String text, int begin, int end, char target) { return indexOf(text, begin, end, target, null); }
java
public static int indexOf(String text, int begin, int end, char target) { return indexOf(text, begin, end, target, null); }
[ "public", "static", "int", "indexOf", "(", "String", "text", ",", "int", "begin", ",", "int", "end", ",", "char", "target", ")", "{", "return", "indexOf", "(", "text", ",", "begin", ",", "end", ",", "target", ",", "null", ")", ";", "}" ]
Returns the index within a string of the first occurrence of the specified character, similar to String.indexOf(). However, any occurrence of the specified character enclosed between balanced parentheses/brackets/braces is ignored. @param text a String @param begin a begin offset @param end an end offset @param target the character to search for @return the index of the character in the string, or -1 if the specified character is not found
[ "Returns", "the", "index", "within", "a", "string", "of", "the", "first", "occurrence", "of", "the", "specified", "character", "similar", "to", "String", ".", "indexOf", "()", ".", "However", "any", "occurrence", "of", "the", "specified", "character", "enclose...
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/text/Balanced.java#L82-L84
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getAttributeURL
@Pure public static URL getAttributeURL(Node document, boolean caseSensitive, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeURLWithDefault(document, caseSensitive, null, path); }
java
@Pure public static URL getAttributeURL(Node document, boolean caseSensitive, String... path) { assert document != null : AssertMessages.notNullParameter(0); return getAttributeURLWithDefault(document, caseSensitive, null, path); }
[ "@", "Pure", "public", "static", "URL", "getAttributeURL", "(", "Node", "document", ",", "boolean", "caseSensitive", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ")", ";...
Replies the URL that corresponds to the specified attribute's path. <p>The path is an ordered list of tag's names and ended by the name of the attribute. @param document is the XML document to explore. @param caseSensitive indicates of the {@code path}'s components are case sensitive. @param path is the list of and ended by the attribute's name. @return the URL in the specified attribute or <code>null</code> if it was node found in the document
[ "Replies", "the", "URL", "that", "corresponds", "to", "the", "specified", "attribute", "s", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L962-L966
couchbase/CouchbaseMock
src/main/java/com/couchbase/mock/http/Authenticator.java
Authenticator.isAuthorizedForBucket
public boolean isAuthorizedForBucket(AuthContext ctx, Bucket bucket) { if (ctx.getUsername().equals(adminName)) { return ctx.getPassword().equals(adminPass); } if (bucket.getName().equals(ctx.getUsername())) { return bucket.getPassword().equals(ctx.getPassword()); } return bucket.getPassword().isEmpty() && ctx.getPassword().isEmpty(); }
java
public boolean isAuthorizedForBucket(AuthContext ctx, Bucket bucket) { if (ctx.getUsername().equals(adminName)) { return ctx.getPassword().equals(adminPass); } if (bucket.getName().equals(ctx.getUsername())) { return bucket.getPassword().equals(ctx.getPassword()); } return bucket.getPassword().isEmpty() && ctx.getPassword().isEmpty(); }
[ "public", "boolean", "isAuthorizedForBucket", "(", "AuthContext", "ctx", ",", "Bucket", "bucket", ")", "{", "if", "(", "ctx", ".", "getUsername", "(", ")", ".", "equals", "(", "adminName", ")", ")", "{", "return", "ctx", ".", "getPassword", "(", ")", "."...
Determine if the given credentials allow access to the bucket @param ctx The credentials @param bucket The bucket to check against @return true if the credentials match the bucket's credentials, or if the bucket is not password protected, or if the credentials match the administrative credentials
[ "Determine", "if", "the", "given", "credentials", "allow", "access", "to", "the", "bucket" ]
train
https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/http/Authenticator.java#L48-L58
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.setItem
public String setItem(String iid, Map<String, Object> properties, DateTime eventTime) throws ExecutionException, InterruptedException, IOException { return createEvent(setItemAsFuture(iid, properties, eventTime)); }
java
public String setItem(String iid, Map<String, Object> properties, DateTime eventTime) throws ExecutionException, InterruptedException, IOException { return createEvent(setItemAsFuture(iid, properties, eventTime)); }
[ "public", "String", "setItem", "(", "String", "iid", ",", "Map", "<", "String", ",", "Object", ">", "properties", ",", "DateTime", "eventTime", ")", "throws", "ExecutionException", ",", "InterruptedException", ",", "IOException", "{", "return", "createEvent", "(...
Sets properties of a item. Implicitly creates the item if it's not already there. Properties could be empty. @param iid ID of the item @param properties a map of all the properties to be associated with the item, could be empty @param eventTime timestamp of the event @return ID of this event
[ "Sets", "properties", "of", "a", "item", ".", "Implicitly", "creates", "the", "item", "if", "it", "s", "not", "already", "there", ".", "Properties", "could", "be", "empty", "." ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L483-L486
astrapi69/runtime-compiler
src/main/java/de/alpharogroup/runtime/compiler/CompilerExtensions.java
CompilerExtensions.newQualifiedClassName
public static String newQualifiedClassName(final String packageName, final String className) { if (StringUtils.isBlank(packageName)) { return className; } return new StringBuilder().append(packageName).append(SeparatorConstants.DOT) .append(className).toString(); }
java
public static String newQualifiedClassName(final String packageName, final String className) { if (StringUtils.isBlank(packageName)) { return className; } return new StringBuilder().append(packageName).append(SeparatorConstants.DOT) .append(className).toString(); }
[ "public", "static", "String", "newQualifiedClassName", "(", "final", "String", "packageName", ",", "final", "String", "className", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "packageName", ")", ")", "{", "return", "className", ";", "}", "return",...
Factory method for create a qualified class name from the given arguments. @param packageName the package name @param className the class name @return the created qualified class name
[ "Factory", "method", "for", "create", "a", "qualified", "class", "name", "from", "the", "given", "arguments", "." ]
train
https://github.com/astrapi69/runtime-compiler/blob/9aed71f2940ddf30e6930de6cbf509206f3bd7de/src/main/java/de/alpharogroup/runtime/compiler/CompilerExtensions.java#L84-L92
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java
PhotosetsInterface.removePhotos
public void removePhotos(String photosetId, String photoIds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REMOVE_PHOTOS); parameters.put("photoset_id", photosetId); parameters.put("photo_ids", photoIds); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
java
public void removePhotos(String photosetId, String photoIds) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_REMOVE_PHOTOS); parameters.put("photoset_id", photosetId); parameters.put("photo_ids", photoIds); Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } }
[ "public", "void", "removePhotos", "(", "String", "photosetId", ",", "String", "photoIds", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";"...
Remove a photo from the set. @param photosetId The photoset ID @param photoIds The ID's of the photos, in CVS format @throws FlickrException
[ "Remove", "a", "photo", "from", "the", "set", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photosets/PhotosetsInterface.java#L609-L620
radkovo/Pdf2Dom
src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java
CSSBoxTree.createDeclaration
protected Declaration createDeclaration(String property, Term<?> term) { Declaration d = CSSFactory.getRuleFactory().createDeclaration(); d.unlock(); d.setProperty(property); d.add(term); return d; }
java
protected Declaration createDeclaration(String property, Term<?> term) { Declaration d = CSSFactory.getRuleFactory().createDeclaration(); d.unlock(); d.setProperty(property); d.add(term); return d; }
[ "protected", "Declaration", "createDeclaration", "(", "String", "property", ",", "Term", "<", "?", ">", "term", ")", "{", "Declaration", "d", "=", "CSSFactory", ".", "getRuleFactory", "(", ")", ".", "createDeclaration", "(", ")", ";", "d", ".", "unlock", "...
Creates a single property declaration. @param property Property name. @param term Property value. @return The resulting declaration.
[ "Creates", "a", "single", "property", "declaration", "." ]
train
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java#L531-L538
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ClustersInner.java
ClustersInner.beginCreateAsync
public Observable<ClusterInner> beginCreateAsync(String resourceGroupName, String workspaceName, String clusterName, ClusterCreateParameters parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, workspaceName, clusterName, parameters).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() { @Override public ClusterInner call(ServiceResponse<ClusterInner> response) { return response.body(); } }); }
java
public Observable<ClusterInner> beginCreateAsync(String resourceGroupName, String workspaceName, String clusterName, ClusterCreateParameters parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, workspaceName, clusterName, parameters).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() { @Override public ClusterInner call(ServiceResponse<ClusterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ClusterInner", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "workspaceName", ",", "String", "clusterName", ",", "ClusterCreateParameters", "parameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", ...
Creates a Cluster in the given Workspace. @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param clusterName The name of the cluster within the specified resource group. Cluster names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param parameters The parameters to provide for the Cluster creation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterInner object
[ "Creates", "a", "Cluster", "in", "the", "given", "Workspace", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ClustersInner.java#L709-L716
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/query/Predicates.java
Predicates.greaterThan
public static Predicate greaterThan(String attribute, Comparable value) { return new GreaterLessPredicate(attribute, value, false, false); }
java
public static Predicate greaterThan(String attribute, Comparable value) { return new GreaterLessPredicate(attribute, value, false, false); }
[ "public", "static", "Predicate", "greaterThan", "(", "String", "attribute", ",", "Comparable", "value", ")", "{", "return", "new", "GreaterLessPredicate", "(", "attribute", ",", "value", ",", "false", ",", "false", ")", ";", "}" ]
Creates a <b>greater than</b> predicate that will pass items if the value stored under the given item {@code attribute} is greater than the given {@code value}. <p> See also <i>Special Attributes</i>, <i>Attribute Paths</i>, <i>Handling of {@code null}</i> and <i>Implicit Type Conversion</i> sections of {@link Predicates}. @param attribute the left-hand side attribute to fetch the value for comparison from. @param value the right-hand side value to compare the attribute value against. @return the created <b>greater than</b> predicate. @throws IllegalArgumentException if the {@code attribute} does not exist.
[ "Creates", "a", "<b", ">", "greater", "than<", "/", "b", ">", "predicate", "that", "will", "pass", "items", "if", "the", "value", "stored", "under", "the", "given", "item", "{", "@code", "attribute", "}", "is", "greater", "than", "the", "given", "{", "...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/Predicates.java#L344-L346
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/core/DigestAuthHeaderFunction.java
DigestAuthHeaderFunction.getDigestHex
private String getDigestHex(String algorithm, String key) { if (algorithm.equals("md5")) { return DigestUtils.md5Hex(key); } else if (algorithm.equals("sha")) { return DigestUtils.shaHex(key); } throw new CitrusRuntimeException("Unsupported digest algorithm: " + algorithm); }
java
private String getDigestHex(String algorithm, String key) { if (algorithm.equals("md5")) { return DigestUtils.md5Hex(key); } else if (algorithm.equals("sha")) { return DigestUtils.shaHex(key); } throw new CitrusRuntimeException("Unsupported digest algorithm: " + algorithm); }
[ "private", "String", "getDigestHex", "(", "String", "algorithm", ",", "String", "key", ")", "{", "if", "(", "algorithm", ".", "equals", "(", "\"md5\"", ")", ")", "{", "return", "DigestUtils", ".", "md5Hex", "(", "key", ")", ";", "}", "else", "if", "(",...
Generates digest hexadecimal string representation of a key with given algorithm. @param algorithm @param key @return
[ "Generates", "digest", "hexadecimal", "string", "representation", "of", "a", "key", "with", "given", "algorithm", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/core/DigestAuthHeaderFunction.java#L97-L105
graphql-java/graphql-java
src/main/java/graphql/execution/ExecutionStepInfo.java
ExecutionStepInfo.changeTypeWithPreservedNonNull
public ExecutionStepInfo changeTypeWithPreservedNonNull(GraphQLOutputType newType) { assertTrue(!GraphQLTypeUtil.isNonNull(newType), "newType can't be non null"); if (isNonNullType()) { return new ExecutionStepInfo(GraphQLNonNull.nonNull(newType), fieldDefinition, field, path, this.parent, arguments, this.fieldContainer); } else { return new ExecutionStepInfo(newType, fieldDefinition, field, path, this.parent, arguments, this.fieldContainer); } }
java
public ExecutionStepInfo changeTypeWithPreservedNonNull(GraphQLOutputType newType) { assertTrue(!GraphQLTypeUtil.isNonNull(newType), "newType can't be non null"); if (isNonNullType()) { return new ExecutionStepInfo(GraphQLNonNull.nonNull(newType), fieldDefinition, field, path, this.parent, arguments, this.fieldContainer); } else { return new ExecutionStepInfo(newType, fieldDefinition, field, path, this.parent, arguments, this.fieldContainer); } }
[ "public", "ExecutionStepInfo", "changeTypeWithPreservedNonNull", "(", "GraphQLOutputType", "newType", ")", "{", "assertTrue", "(", "!", "GraphQLTypeUtil", ".", "isNonNull", "(", "newType", ")", ",", "\"newType can't be non null\"", ")", ";", "if", "(", "isNonNullType", ...
This allows you to morph a type into a more specialized form yet return the same parent and non-null ness, for example taking a {@link GraphQLInterfaceType} and turning it into a specific {@link graphql.schema.GraphQLObjectType} after type resolution has occurred @param newType the new type to be @return a new type info with the same
[ "This", "allows", "you", "to", "morph", "a", "type", "into", "a", "more", "specialized", "form", "yet", "return", "the", "same", "parent", "and", "non", "-", "null", "ness", "for", "example", "taking", "a", "{", "@link", "GraphQLInterfaceType", "}", "and",...
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/ExecutionStepInfo.java#L169-L176
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java
PersistenceController.deleteConversation
public Observable<Boolean> deleteConversation(String conversationId) { return asObservable(new Executor<Boolean>() { @Override void execute(ChatStore store, Emitter<Boolean> emitter) { store.beginTransaction(); boolean isSuccess = store.deleteConversation(conversationId); store.endTransaction(); emitter.onNext(isSuccess); emitter.onCompleted(); } }); }
java
public Observable<Boolean> deleteConversation(String conversationId) { return asObservable(new Executor<Boolean>() { @Override void execute(ChatStore store, Emitter<Boolean> emitter) { store.beginTransaction(); boolean isSuccess = store.deleteConversation(conversationId); store.endTransaction(); emitter.onNext(isSuccess); emitter.onCompleted(); } }); }
[ "public", "Observable", "<", "Boolean", ">", "deleteConversation", "(", "String", "conversationId", ")", "{", "return", "asObservable", "(", "new", "Executor", "<", "Boolean", ">", "(", ")", "{", "@", "Override", "void", "execute", "(", "ChatStore", "store", ...
Delete conversation from the store. @param conversationId Unique conversation id. @return Observable emitting result.
[ "Delete", "conversation", "from", "the", "store", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java#L545-L557
MTDdk/jawn
jawn-security/src/main/java/net/javapla/jawn/security/JawnRememberMeManager.java
JawnRememberMeManager.rememberSerializedIdentity
@Override protected void rememberSerializedIdentity(Subject subject, byte[] serialized) { if (! (subject instanceof ContextSource)) { // if (log.isDebugEnabled()) { // String msg = "Subject argument is not an HTTP-aware instance. This is required to obtain a servlet " + // "request and response in order to set the rememberMe cookie. Returning immediately and " + // "ignoring rememberMe operation."; // log.debug(msg); // } return; } Context context = ((ContextSource) subject).getContext(); //base 64 encode it and store as a cookie String base64 = Base64.encodeToString(serialized); // could be java.util.Base64 context.addCookie(Cookie.builder(getCookie()).setValue(base64).build()); // save the cookie }
java
@Override protected void rememberSerializedIdentity(Subject subject, byte[] serialized) { if (! (subject instanceof ContextSource)) { // if (log.isDebugEnabled()) { // String msg = "Subject argument is not an HTTP-aware instance. This is required to obtain a servlet " + // "request and response in order to set the rememberMe cookie. Returning immediately and " + // "ignoring rememberMe operation."; // log.debug(msg); // } return; } Context context = ((ContextSource) subject).getContext(); //base 64 encode it and store as a cookie String base64 = Base64.encodeToString(serialized); // could be java.util.Base64 context.addCookie(Cookie.builder(getCookie()).setValue(base64).build()); // save the cookie }
[ "@", "Override", "protected", "void", "rememberSerializedIdentity", "(", "Subject", "subject", ",", "byte", "[", "]", "serialized", ")", "{", "if", "(", "!", "(", "subject", "instanceof", "ContextSource", ")", ")", "{", "// if (log.isDebugEnabled()) {", ...
Base64-encodes the specified serialized byte array and sets that base64-encoded String as the cookie value. <p/> The {@code subject} instance is expected to be a {@link WebSubject} instance with an HTTP Request/Response pair so an HTTP cookie can be set on the outgoing response. If it is not a {@code WebSubject} or that {@code WebSubject} does not have an HTTP Request/Response pair, this implementation does nothing. @param subject the Subject for which the identity is being serialized. @param serialized the serialized bytes to be persisted.
[ "Base64", "-", "encodes", "the", "specified", "serialized", "byte", "array", "and", "sets", "that", "base64", "-", "encoded", "String", "as", "the", "cookie", "value", ".", "<p", "/", ">", "The", "{", "@code", "subject", "}", "instance", "is", "expected", ...
train
https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-security/src/main/java/net/javapla/jawn/security/JawnRememberMeManager.java#L83-L101
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java
StatsConfigHelper.getNlsKey
private static final String getNlsKey(String resourceBundle, Locale locale) { return new StringBuffer(resourceBundle).append("#").append(locale.toString()).toString(); }
java
private static final String getNlsKey(String resourceBundle, Locale locale) { return new StringBuffer(resourceBundle).append("#").append(locale.toString()).toString(); }
[ "private", "static", "final", "String", "getNlsKey", "(", "String", "resourceBundle", ",", "Locale", "locale", ")", "{", "return", "new", "StringBuffer", "(", "resourceBundle", ")", ".", "append", "(", "\"#\"", ")", ".", "append", "(", "locale", ".", "toStri...
234782 - JPM: Create key for NLS based on resource bundle name and locale
[ "234782", "-", "JPM", ":", "Create", "key", "for", "NLS", "based", "on", "resource", "bundle", "name", "and", "locale" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java#L48-L50
auth0/java-jwt
lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java
CryptoHelper.verifySignatureFor
boolean verifySignatureFor(String algorithm, byte[] secretBytes, String header, String payload, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException { return verifySignatureFor(algorithm, secretBytes, header.getBytes(StandardCharsets.UTF_8), payload.getBytes(StandardCharsets.UTF_8), signatureBytes); }
java
boolean verifySignatureFor(String algorithm, byte[] secretBytes, String header, String payload, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException { return verifySignatureFor(algorithm, secretBytes, header.getBytes(StandardCharsets.UTF_8), payload.getBytes(StandardCharsets.UTF_8), signatureBytes); }
[ "boolean", "verifySignatureFor", "(", "String", "algorithm", ",", "byte", "[", "]", "secretBytes", ",", "String", "header", ",", "String", "payload", ",", "byte", "[", "]", "signatureBytes", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeyException", "{...
Verify signature for JWT header and payload. @param algorithm algorithm name. @param secretBytes algorithm secret. @param header JWT header. @param payload JWT payload. @param signatureBytes JWT signature. @return true if signature is valid. @throws NoSuchAlgorithmException if the algorithm is not supported. @throws InvalidKeyException if the given key is inappropriate for initializing the specified algorithm.
[ "Verify", "signature", "for", "JWT", "header", "and", "payload", "." ]
train
https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java#L26-L28
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java
MsgDestEncodingUtilsImpl.setDestinationProperty
final static void setDestinationProperty(JmsDestination dest, String longName, Object longValue) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setDestinationProperty", new Object[]{dest, longName, longValue}); // Let's hope the property is one we know about, as that will be quick & easy PropertyEntry propEntry = propertyMap.get(longName); if (propEntry != null) { if (longValue != null) { // If the value is of the wrong type, the caller screwed up if (!longValue.getClass().equals(propEntry.getType())) { throw (JMSException)JmsErrorUtils.newThrowable(JMSException.class ,"INTERNAL_INVALID_VALUE_CWSIA0361" ,new Object[] {longValue, longName} ,null ,"MsgDestEncodingUtilsImpl.setDestinationProperty#1" ,null ,tc); } } // If everything is OK, go ahead & set it setProperty(dest, longName, propEntry.getIntValue(), longValue); } // We could have a bash at finding a method by reflection, but we think we have // already catered for all known properties (and more), so we will just barf. else { throw (JMSException)JmsErrorUtils.newThrowable(JMSException.class ,"UNKNOWN_PROPERTY_CWSIA0363" ,new Object[] {longName} ,null ,"MsgDestEncodingUtilsImpl.setDestinationProperty#2" ,null ,tc); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "MsgDestEncodingUtilsImpl.setDestinationProperty#2"); }
java
final static void setDestinationProperty(JmsDestination dest, String longName, Object longValue) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setDestinationProperty", new Object[]{dest, longName, longValue}); // Let's hope the property is one we know about, as that will be quick & easy PropertyEntry propEntry = propertyMap.get(longName); if (propEntry != null) { if (longValue != null) { // If the value is of the wrong type, the caller screwed up if (!longValue.getClass().equals(propEntry.getType())) { throw (JMSException)JmsErrorUtils.newThrowable(JMSException.class ,"INTERNAL_INVALID_VALUE_CWSIA0361" ,new Object[] {longValue, longName} ,null ,"MsgDestEncodingUtilsImpl.setDestinationProperty#1" ,null ,tc); } } // If everything is OK, go ahead & set it setProperty(dest, longName, propEntry.getIntValue(), longValue); } // We could have a bash at finding a method by reflection, but we think we have // already catered for all known properties (and more), so we will just barf. else { throw (JMSException)JmsErrorUtils.newThrowable(JMSException.class ,"UNKNOWN_PROPERTY_CWSIA0363" ,new Object[] {longName} ,null ,"MsgDestEncodingUtilsImpl.setDestinationProperty#2" ,null ,tc); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "MsgDestEncodingUtilsImpl.setDestinationProperty#2"); }
[ "final", "static", "void", "setDestinationProperty", "(", "JmsDestination", "dest", ",", "String", "longName", ",", "Object", "longValue", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "is...
/* setDestinationProperty Utility method which the MQRequestReplyUtilsImpl and URIDestinationCreater classes use to sep properties onto a destination object given the name of the property and the value to be set. FRP & RRP are ignored by this method, as they are always set separately. @param dest The JMSDestination to set the property on to @param longName The long name of the property @param longValue The value to set the property to. @exception JMSException Thrown if anything goes wrong.
[ "/", "*", "setDestinationProperty", "Utility", "method", "which", "the", "MQRequestReplyUtilsImpl", "and", "URIDestinationCreater", "classes", "use", "to", "sep", "properties", "onto", "a", "destination", "object", "given", "the", "name", "of", "the", "property", "a...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java#L365-L400
looly/hutool
hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java
SqlConnRunner.insert
public int insert(Connection conn, Entity record) throws SQLException { checkConn(conn); if(CollectionUtil.isEmpty(record)){ throw new SQLException("Empty entity provided!"); } PreparedStatement ps = null; try { ps = dialect.psForInsert(conn, record); return ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
java
public int insert(Connection conn, Entity record) throws SQLException { checkConn(conn); if(CollectionUtil.isEmpty(record)){ throw new SQLException("Empty entity provided!"); } PreparedStatement ps = null; try { ps = dialect.psForInsert(conn, record); return ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
[ "public", "int", "insert", "(", "Connection", "conn", ",", "Entity", "record", ")", "throws", "SQLException", "{", "checkConn", "(", "conn", ")", ";", "if", "(", "CollectionUtil", ".", "isEmpty", "(", "record", ")", ")", "{", "throw", "new", "SQLException"...
插入数据<br> 此方法不会关闭Connection @param conn 数据库连接 @param record 记录 @return 插入行数 @throws SQLException SQL执行异常
[ "插入数据<br", ">", "此方法不会关闭Connection" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L95-L109
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/eviction/EvictionChecker.java
EvictionChecker.toPerPartitionMaxSize
private double toPerPartitionMaxSize(int maxConfiguredSize, String mapName) { int memberCount = clusterService.getSize(DATA_MEMBER_SELECTOR); double translatedPartitionSize = (1D * maxConfiguredSize * memberCount / partitionCount); if (translatedPartitionSize < 1) { translatedPartitionSize = MIN_TRANSLATED_PARTITION_SIZE; logMisconfiguredPerNodeMaxSize(mapName, memberCount); } return translatedPartitionSize; }
java
private double toPerPartitionMaxSize(int maxConfiguredSize, String mapName) { int memberCount = clusterService.getSize(DATA_MEMBER_SELECTOR); double translatedPartitionSize = (1D * maxConfiguredSize * memberCount / partitionCount); if (translatedPartitionSize < 1) { translatedPartitionSize = MIN_TRANSLATED_PARTITION_SIZE; logMisconfiguredPerNodeMaxSize(mapName, memberCount); } return translatedPartitionSize; }
[ "private", "double", "toPerPartitionMaxSize", "(", "int", "maxConfiguredSize", ",", "String", "mapName", ")", "{", "int", "memberCount", "=", "clusterService", ".", "getSize", "(", "DATA_MEMBER_SELECTOR", ")", ";", "double", "translatedPartitionSize", "=", "(", "1D"...
Calculates and returns the expected maximum size of an evicted record-store when {@link com.hazelcast.config.MaxSizeConfig.MaxSizePolicy#PER_NODE PER_NODE} max-size-policy is used.
[ "Calculates", "and", "returns", "the", "expected", "maximum", "size", "of", "an", "evicted", "record", "-", "store", "when", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/eviction/EvictionChecker.java#L114-L124
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_vrack_network_vrackNetworkId_updateFarmId_POST
public OvhVrackNetwork serviceName_vrack_network_vrackNetworkId_updateFarmId_POST(String serviceName, Long vrackNetworkId, Long[] farmId) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId}/updateFarmId"; StringBuilder sb = path(qPath, serviceName, vrackNetworkId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "farmId", farmId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVrackNetwork.class); }
java
public OvhVrackNetwork serviceName_vrack_network_vrackNetworkId_updateFarmId_POST(String serviceName, Long vrackNetworkId, Long[] farmId) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId}/updateFarmId"; StringBuilder sb = path(qPath, serviceName, vrackNetworkId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "farmId", farmId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVrackNetwork.class); }
[ "public", "OvhVrackNetwork", "serviceName_vrack_network_vrackNetworkId_updateFarmId_POST", "(", "String", "serviceName", ",", "Long", "vrackNetworkId", ",", "Long", "[", "]", "farmId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceNa...
Update farm attached to that vrack network id REST: POST /ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId}/updateFarmId @param farmId [required] Farm Id you want to attach to that vrack network @param serviceName [required] The internal name of your IP load balancing @param vrackNetworkId [required] Internal Load Balancer identifier of the vRack private network description API beta
[ "Update", "farm", "attached", "to", "that", "vrack", "network", "id" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1091-L1098
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java
ParseUtils.unexpectedElement
public static XMLStreamException unexpectedElement(final XMLExtendedStreamReader reader, Set<String> possible) { final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.unexpectedElement(reader.getName(), asStringList(possible), reader.getLocation()); return new XMLStreamValidationException(ex.getMessage(), ValidationError.from(ex, ErrorType.UNEXPECTED_ELEMENT) .element(reader.getName()) .alternatives(possible), ex); }
java
public static XMLStreamException unexpectedElement(final XMLExtendedStreamReader reader, Set<String> possible) { final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.unexpectedElement(reader.getName(), asStringList(possible), reader.getLocation()); return new XMLStreamValidationException(ex.getMessage(), ValidationError.from(ex, ErrorType.UNEXPECTED_ELEMENT) .element(reader.getName()) .alternatives(possible), ex); }
[ "public", "static", "XMLStreamException", "unexpectedElement", "(", "final", "XMLExtendedStreamReader", "reader", ",", "Set", "<", "String", ">", "possible", ")", "{", "final", "XMLStreamException", "ex", "=", "ControllerLogger", ".", "ROOT_LOGGER", ".", "unexpectedEl...
Get an exception reporting an unexpected XML element. @param reader the stream reader @return the exception
[ "Get", "an", "exception", "reporting", "an", "unexpected", "XML", "element", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java#L109-L117
google/closure-compiler
src/com/google/javascript/jscomp/PureFunctionIdentifier.java
PureFunctionIdentifier.collectCallableLeavesInternal
private static boolean collectCallableLeavesInternal(Node expr, ArrayList<Node> results) { switch (expr.getToken()) { case FUNCTION: case GETPROP: case NAME: results.add(expr); return true; case SUPER: { // Pretend that `super` is an alias for the superclass reference. Node clazz = checkNotNull(NodeUtil.getEnclosingClass(expr)); Node function = checkNotNull(NodeUtil.getEnclosingFunction(expr)); Node ctorDef = checkNotNull(NodeUtil.getEs6ClassConstructorMemberFunctionDef(clazz)); // The only place SUPER should be a callable expression is in a class ctor. checkState( function.isFirstChildOf(ctorDef), "Unknown SUPER reference: %s", expr.toStringTree()); return collectCallableLeavesInternal(clazz.getSecondChild(), results); } case CLASS: { // Collect the constructor function, or failing that, the superclass reference. @Nullable Node ctorDef = NodeUtil.getEs6ClassConstructorMemberFunctionDef(expr); if (ctorDef != null) { return collectCallableLeavesInternal(ctorDef.getOnlyChild(), results); } else if (expr.getSecondChild().isEmpty()) { return true; // A class an implicit ctor is pure when there is no superclass. } else { return collectCallableLeavesInternal(expr.getSecondChild(), results); } } case AND: case OR: return collectCallableLeavesInternal(expr.getFirstChild(), results) && collectCallableLeavesInternal(expr.getSecondChild(), results); case COMMA: case ASSIGN: return collectCallableLeavesInternal(expr.getSecondChild(), results); case HOOK: return collectCallableLeavesInternal(expr.getChildAtIndex(1), results) && collectCallableLeavesInternal(expr.getChildAtIndex(2), results); case NEW_TARGET: case THIS: // These could be an alias to any function. Treat them as an unknown callable. default: return false; // Unsupported call type. } }
java
private static boolean collectCallableLeavesInternal(Node expr, ArrayList<Node> results) { switch (expr.getToken()) { case FUNCTION: case GETPROP: case NAME: results.add(expr); return true; case SUPER: { // Pretend that `super` is an alias for the superclass reference. Node clazz = checkNotNull(NodeUtil.getEnclosingClass(expr)); Node function = checkNotNull(NodeUtil.getEnclosingFunction(expr)); Node ctorDef = checkNotNull(NodeUtil.getEs6ClassConstructorMemberFunctionDef(clazz)); // The only place SUPER should be a callable expression is in a class ctor. checkState( function.isFirstChildOf(ctorDef), "Unknown SUPER reference: %s", expr.toStringTree()); return collectCallableLeavesInternal(clazz.getSecondChild(), results); } case CLASS: { // Collect the constructor function, or failing that, the superclass reference. @Nullable Node ctorDef = NodeUtil.getEs6ClassConstructorMemberFunctionDef(expr); if (ctorDef != null) { return collectCallableLeavesInternal(ctorDef.getOnlyChild(), results); } else if (expr.getSecondChild().isEmpty()) { return true; // A class an implicit ctor is pure when there is no superclass. } else { return collectCallableLeavesInternal(expr.getSecondChild(), results); } } case AND: case OR: return collectCallableLeavesInternal(expr.getFirstChild(), results) && collectCallableLeavesInternal(expr.getSecondChild(), results); case COMMA: case ASSIGN: return collectCallableLeavesInternal(expr.getSecondChild(), results); case HOOK: return collectCallableLeavesInternal(expr.getChildAtIndex(1), results) && collectCallableLeavesInternal(expr.getChildAtIndex(2), results); case NEW_TARGET: case THIS: // These could be an alias to any function. Treat them as an unknown callable. default: return false; // Unsupported call type. } }
[ "private", "static", "boolean", "collectCallableLeavesInternal", "(", "Node", "expr", ",", "ArrayList", "<", "Node", ">", "results", ")", "{", "switch", "(", "expr", ".", "getToken", "(", ")", ")", "{", "case", "FUNCTION", ":", "case", "GETPROP", ":", "cas...
Traverses an {@code expr} to collect nodes representing potential callables that it may resolve to well known callables. <p>For example: <pre> `a.c || b` => [a.c, b] `x ? a.c : b` => [a.c, b] `(function f() { }) && x || class Foo { constructor() { } }` => [function, x, constructor]` </pre> <p>This function is applicable to finding both assignment aliases and call targets. That is, one way to find the possible callees of an invocation is to pass the complex expression representing the final callee to this method. <p>This function uses a white-list approach. If a node that isn't understood is detected, the entire collection is invalidated. @see {@link #collectCallableLeaves} @param exp A possibly complicated expression. @param results The collection of qualified names and functions. @return {@code true} iff only understood results were discovered.
[ "Traverses", "an", "{", "@code", "expr", "}", "to", "collect", "nodes", "representing", "potential", "callables", "that", "it", "may", "resolve", "to", "well", "known", "callables", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PureFunctionIdentifier.java#L206-L259
codelibs/jcifs
src/main/java/jcifs/smb1/smb1/NtlmAuthenticator.java
NtlmAuthenticator.requestNtlmPasswordAuthentication
public static NtlmPasswordAuthentication requestNtlmPasswordAuthentication( String url, SmbAuthException sae ) { if( auth == null ) { return null; } synchronized( auth ) { auth.url = url; auth.sae = sae; return auth.getNtlmPasswordAuthentication(); } }
java
public static NtlmPasswordAuthentication requestNtlmPasswordAuthentication( String url, SmbAuthException sae ) { if( auth == null ) { return null; } synchronized( auth ) { auth.url = url; auth.sae = sae; return auth.getNtlmPasswordAuthentication(); } }
[ "public", "static", "NtlmPasswordAuthentication", "requestNtlmPasswordAuthentication", "(", "String", "url", ",", "SmbAuthException", "sae", ")", "{", "if", "(", "auth", "==", "null", ")", "{", "return", "null", ";", "}", "synchronized", "(", "auth", ")", "{", ...
Used internally by jCIFS when an <tt>SmbAuthException</tt> is trapped to retrieve new user credentials.
[ "Used", "internally", "by", "jCIFS", "when", "an", "<tt", ">", "SmbAuthException<", "/", "tt", ">", "is", "trapped", "to", "retrieve", "new", "user", "credentials", "." ]
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/NtlmAuthenticator.java#L59-L69
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/embedded/EmbeddedGobblin.java
EmbeddedGobblin.distributeJarWithPriority
public synchronized EmbeddedGobblin distributeJarWithPriority(String jarPath, int priority) { if (this.distributedJars.containsKey(jarPath)) { this.distributedJars.put(jarPath, Math.min(priority, this.distributedJars.get(jarPath))); } else { this.distributedJars.put(jarPath, priority); } return this; }
java
public synchronized EmbeddedGobblin distributeJarWithPriority(String jarPath, int priority) { if (this.distributedJars.containsKey(jarPath)) { this.distributedJars.put(jarPath, Math.min(priority, this.distributedJars.get(jarPath))); } else { this.distributedJars.put(jarPath, priority); } return this; }
[ "public", "synchronized", "EmbeddedGobblin", "distributeJarWithPriority", "(", "String", "jarPath", ",", "int", "priority", ")", "{", "if", "(", "this", ".", "distributedJars", ".", "containsKey", "(", "jarPath", ")", ")", "{", "this", ".", "distributedJars", "....
Specify that the input jar should be added to workers' classpath on distributed mode. Jars with lower priority value will appear first in the classpath. Default priority is 0.
[ "Specify", "that", "the", "input", "jar", "should", "be", "added", "to", "workers", "classpath", "on", "distributed", "mode", ".", "Jars", "with", "lower", "priority", "value", "will", "appear", "first", "in", "the", "classpath", ".", "Default", "priority", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/embedded/EmbeddedGobblin.java#L215-L222
finmath/finmath-lib
src/main/java6/net/finmath/montecarlo/interestrate/modelplugins/AbstractLIBORCovarianceModel.java
AbstractLIBORCovarianceModel.getCovariance
public RandomVariableInterface getCovariance(int timeIndex, int component1, int component2, RandomVariableInterface[] realizationAtTimeIndex) { RandomVariableInterface[] factorLoadingOfComponent1 = getFactorLoading(timeIndex, component1, realizationAtTimeIndex); RandomVariableInterface[] factorLoadingOfComponent2 = getFactorLoading(timeIndex, component2, realizationAtTimeIndex); // Multiply first factor loading (this avoids that we have to init covariance to 0). RandomVariableInterface covariance = factorLoadingOfComponent1[0].mult(factorLoadingOfComponent2[0]); // Add others, if any for(int factorIndex=1; factorIndex<this.getNumberOfFactors(); factorIndex++) { covariance = covariance.addProduct(factorLoadingOfComponent1[factorIndex],factorLoadingOfComponent2[factorIndex]); } return covariance; }
java
public RandomVariableInterface getCovariance(int timeIndex, int component1, int component2, RandomVariableInterface[] realizationAtTimeIndex) { RandomVariableInterface[] factorLoadingOfComponent1 = getFactorLoading(timeIndex, component1, realizationAtTimeIndex); RandomVariableInterface[] factorLoadingOfComponent2 = getFactorLoading(timeIndex, component2, realizationAtTimeIndex); // Multiply first factor loading (this avoids that we have to init covariance to 0). RandomVariableInterface covariance = factorLoadingOfComponent1[0].mult(factorLoadingOfComponent2[0]); // Add others, if any for(int factorIndex=1; factorIndex<this.getNumberOfFactors(); factorIndex++) { covariance = covariance.addProduct(factorLoadingOfComponent1[factorIndex],factorLoadingOfComponent2[factorIndex]); } return covariance; }
[ "public", "RandomVariableInterface", "getCovariance", "(", "int", "timeIndex", ",", "int", "component1", ",", "int", "component2", ",", "RandomVariableInterface", "[", "]", "realizationAtTimeIndex", ")", "{", "RandomVariableInterface", "[", "]", "factorLoadingOfComponent1...
Returns the instantaneous covariance calculated from factor loadings. @param timeIndex The time index at which covariance is requested. @param component1 Index of component <i>i</i>. @param component2 Index of component <i>j</i>. @param realizationAtTimeIndex The realization of the stochastic process. @return The instantaneous covariance between component <i>i</i> and <i>j</i>.
[ "Returns", "the", "instantaneous", "covariance", "calculated", "from", "factor", "loadings", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/modelplugins/AbstractLIBORCovarianceModel.java#L145-L159
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/chess/DetectChessboardCorners.java
DetectChessboardCorners.process
public void process( GrayF32 input ) { // System.out.println("ENTER CHESSBOARD CORNER "+input.width+" x "+input.height); borderImg.setImage(input); gradient.process(input,derivX,derivY); interpX.setImage(derivX); interpY.setImage(derivY); cornerIntensity.process(derivX,derivY,intensity); intensityInterp.setImage(intensity); // adjust intensity value so that its between 0 and levels for OTSU thresholding float featmax = ImageStatistics.max(intensity); PixelMath.multiply(intensity, GRAY_LEVELS /featmax,intensity); // int N = intensity.width*input.height; // for (int i = 0; i < N; i++) { // if( intensity.data[i] <= 2f ) { // intensity.data[i] = 0f; // } // } // convert into a binary image with high feature intensity regions being 1 inputToBinary.process(intensity,binary); // find the small regions. Th se might be where corners are contourFinder.process(binary); corners.reset(); List<ContourPacked> packed = contourFinder.getContours(); // System.out.println(" * features.size = "+packed.size()); for (int i = 0; i < packed.size(); i++) { contourFinder.loadContour(i,contour); ChessboardCorner c = corners.grow(); UtilPoint2D_I32.mean(contour.toList(),c); // compensate for the bias caused by how pixels are counted. // Example: a 4x4 region is expected. Center should be at (2,2) but will instead be (1.5,1.5) c.x += 0.5; c.y += 0.5; computeFeatures(c.x,c.y,c); // System.out.println("radius = "+radius+" angle = "+c.angle); // System.out.println("intensity "+c.intensity); if( c.intensity < cornerIntensityThreshold ) { corners.removeTail(); } else if( useMeanShift ) { meanShiftLocation(c); // TODO does it make sense to use mean shift first? computeFeatures(c.x,c.y,c); } } // System.out.println("Dropped "+dropped+" / "+packed.size()); }
java
public void process( GrayF32 input ) { // System.out.println("ENTER CHESSBOARD CORNER "+input.width+" x "+input.height); borderImg.setImage(input); gradient.process(input,derivX,derivY); interpX.setImage(derivX); interpY.setImage(derivY); cornerIntensity.process(derivX,derivY,intensity); intensityInterp.setImage(intensity); // adjust intensity value so that its between 0 and levels for OTSU thresholding float featmax = ImageStatistics.max(intensity); PixelMath.multiply(intensity, GRAY_LEVELS /featmax,intensity); // int N = intensity.width*input.height; // for (int i = 0; i < N; i++) { // if( intensity.data[i] <= 2f ) { // intensity.data[i] = 0f; // } // } // convert into a binary image with high feature intensity regions being 1 inputToBinary.process(intensity,binary); // find the small regions. Th se might be where corners are contourFinder.process(binary); corners.reset(); List<ContourPacked> packed = contourFinder.getContours(); // System.out.println(" * features.size = "+packed.size()); for (int i = 0; i < packed.size(); i++) { contourFinder.loadContour(i,contour); ChessboardCorner c = corners.grow(); UtilPoint2D_I32.mean(contour.toList(),c); // compensate for the bias caused by how pixels are counted. // Example: a 4x4 region is expected. Center should be at (2,2) but will instead be (1.5,1.5) c.x += 0.5; c.y += 0.5; computeFeatures(c.x,c.y,c); // System.out.println("radius = "+radius+" angle = "+c.angle); // System.out.println("intensity "+c.intensity); if( c.intensity < cornerIntensityThreshold ) { corners.removeTail(); } else if( useMeanShift ) { meanShiftLocation(c); // TODO does it make sense to use mean shift first? computeFeatures(c.x,c.y,c); } } // System.out.println("Dropped "+dropped+" / "+packed.size()); }
[ "public", "void", "process", "(", "GrayF32", "input", ")", "{", "//\t\tSystem.out.println(\"ENTER CHESSBOARD CORNER \"+input.width+\" x \"+input.height);", "borderImg", ".", "setImage", "(", "input", ")", ";", "gradient", ".", "process", "(", "input", ",", "derivX", ","...
Computes chessboard corners inside the image @param input Gray image. Not modified.
[ "Computes", "chessboard", "corners", "inside", "the", "image" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/chess/DetectChessboardCorners.java#L144-L199
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindM2MBuilder.java
BindM2MBuilder.generateDeletes
private void generateDeletes(M2MEntity entity, String packageName) { String idPart = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName); String methodName = ""; String workId = ""; methodName = "deleteBy" + idPart; if (!isMethodAlreadyDefined(entity, methodName)) { // @formatter:off MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC) .addModifiers(Modifier.ABSTRACT) .addAnnotation(AnnotationSpec.builder(BindSqlDelete.class) .addMember("where", "$S", entity.idName + "=" + SqlAnalyzer.PARAM_PREFIX + entity.idName + SqlAnalyzer.PARAM_SUFFIX) .build()) .addParameter(ParameterSpec.builder(entity.propertyPrimaryKey, entity.idName) .addAnnotation(AnnotationSpec.builder(BindSqlParam.class) .addMember("value", "$S", entity.idName).build()) .build()) .returns(Integer.TYPE).build(); // @formatter:on classBuilder.addMethod(methodSpec); } methodName = entity.entity1Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName); workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName); methodName = "deleteBy" + methodName; if (!isMethodAlreadyDefined(entity, methodName)) { // @formatter:off MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC) .addModifiers(Modifier.ABSTRACT) .addAnnotation(AnnotationSpec.builder(BindSqlDelete.class) .addMember("where", "$S", workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX) .build()) .addParameter(ParameterSpec.builder(entity.propertyKey1, workId) .addAnnotation( AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build()) .build()) .returns(Integer.TYPE).build(); // @formatter:on classBuilder.addMethod(methodSpec); } methodName = entity.entity2Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName); workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName); methodName = "deleteBy" + methodName; if (!isMethodAlreadyDefined(entity, methodName)) { // @formatter:off MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC) .addModifiers(Modifier.ABSTRACT) .addAnnotation(AnnotationSpec.builder(BindSqlDelete.class) .addMember("where", "$S", workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX) .build()) .addParameter(ParameterSpec.builder(entity.propertyKey2, workId) .addAnnotation( AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build()) .build()) .returns(Integer.TYPE).build(); // @formatter:on classBuilder.addMethod(methodSpec); } }
java
private void generateDeletes(M2MEntity entity, String packageName) { String idPart = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName); String methodName = ""; String workId = ""; methodName = "deleteBy" + idPart; if (!isMethodAlreadyDefined(entity, methodName)) { // @formatter:off MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC) .addModifiers(Modifier.ABSTRACT) .addAnnotation(AnnotationSpec.builder(BindSqlDelete.class) .addMember("where", "$S", entity.idName + "=" + SqlAnalyzer.PARAM_PREFIX + entity.idName + SqlAnalyzer.PARAM_SUFFIX) .build()) .addParameter(ParameterSpec.builder(entity.propertyPrimaryKey, entity.idName) .addAnnotation(AnnotationSpec.builder(BindSqlParam.class) .addMember("value", "$S", entity.idName).build()) .build()) .returns(Integer.TYPE).build(); // @formatter:on classBuilder.addMethod(methodSpec); } methodName = entity.entity1Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName); workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName); methodName = "deleteBy" + methodName; if (!isMethodAlreadyDefined(entity, methodName)) { // @formatter:off MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC) .addModifiers(Modifier.ABSTRACT) .addAnnotation(AnnotationSpec.builder(BindSqlDelete.class) .addMember("where", "$S", workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX) .build()) .addParameter(ParameterSpec.builder(entity.propertyKey1, workId) .addAnnotation( AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build()) .build()) .returns(Integer.TYPE).build(); // @formatter:on classBuilder.addMethod(methodSpec); } methodName = entity.entity2Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName); workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName); methodName = "deleteBy" + methodName; if (!isMethodAlreadyDefined(entity, methodName)) { // @formatter:off MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC) .addModifiers(Modifier.ABSTRACT) .addAnnotation(AnnotationSpec.builder(BindSqlDelete.class) .addMember("where", "$S", workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX) .build()) .addParameter(ParameterSpec.builder(entity.propertyKey2, workId) .addAnnotation( AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build()) .build()) .returns(Integer.TYPE).build(); // @formatter:on classBuilder.addMethod(methodSpec); } }
[ "private", "void", "generateDeletes", "(", "M2MEntity", "entity", ",", "String", "packageName", ")", "{", "String", "idPart", "=", "CaseFormat", ".", "LOWER_CAMEL", ".", "to", "(", "CaseFormat", ".", "UPPER_CAMEL", ",", "entity", ".", "idName", ")", ";", "St...
Generate deletes. @param entity the entity @param generatedEntity @param packageName the package name
[ "Generate", "deletes", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindM2MBuilder.java#L339-L404
lucee/Lucee
core/src/main/java/lucee/commons/i18n/FormatUtil.java
FormatUtil.getCFMLFormats
public static DateFormat[] getCFMLFormats(TimeZone tz, boolean lenient) { String id = "cfml-" + Locale.ENGLISH.toString() + "-" + tz.getID() + "-" + lenient; DateFormat[] df = formats.get(id); if (df == null) { df = new SimpleDateFormat[] { new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH), new SimpleDateFormat("MMMM dd, yyyy HH:mm:ss a zzz", Locale.ENGLISH), new SimpleDateFormat("MMM dd, yyyy HH:mm:ss a", Locale.ENGLISH), new SimpleDateFormat("MMM dd, yyyy HH:mm:ss", Locale.ENGLISH), new SimpleDateFormat("MMMM d yyyy HH:mm:ssZ", Locale.ENGLISH), new SimpleDateFormat("MMMM d yyyy HH:mm:ss", Locale.ENGLISH), new SimpleDateFormat("MMMM d yyyy HH:mm", Locale.ENGLISH), new SimpleDateFormat("EEE, MMM dd, yyyy HH:mm:ssZ", Locale.ENGLISH), new SimpleDateFormat("EEE, MMM dd, yyyy HH:mm:ss", Locale.ENGLISH), new SimpleDateFormat("EEEE, MMMM dd, yyyy H:mm:ss a zzz", Locale.ENGLISH), new SimpleDateFormat("dd-MMM-yy HH:mm a", Locale.ENGLISH), new SimpleDateFormat("dd-MMMM-yy HH:mm a", Locale.ENGLISH), new SimpleDateFormat("EE, dd-MMM-yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("EE, dd MMM yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("EEE d, MMM yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH), new SimpleDateFormat("MMMM, dd yyyy HH:mm:ssZ", Locale.ENGLISH), new SimpleDateFormat("MMMM, dd yyyy HH:mm:ss", Locale.ENGLISH), new SimpleDateFormat("yyyy/MM/dd HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("dd MMM yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT'ZZ (z)", Locale.ENGLISH), new SimpleDateFormat("dd MMM, yyyy HH:mm:ss", Locale.ENGLISH) // ,new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss",Locale.ENGLISH) }; for (int i = 0; i < df.length; i++) { df[i].setLenient(lenient); df[i].setTimeZone(tz); } formats.put(id, df); } return clone(df); }
java
public static DateFormat[] getCFMLFormats(TimeZone tz, boolean lenient) { String id = "cfml-" + Locale.ENGLISH.toString() + "-" + tz.getID() + "-" + lenient; DateFormat[] df = formats.get(id); if (df == null) { df = new SimpleDateFormat[] { new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH), new SimpleDateFormat("MMMM dd, yyyy HH:mm:ss a zzz", Locale.ENGLISH), new SimpleDateFormat("MMM dd, yyyy HH:mm:ss a", Locale.ENGLISH), new SimpleDateFormat("MMM dd, yyyy HH:mm:ss", Locale.ENGLISH), new SimpleDateFormat("MMMM d yyyy HH:mm:ssZ", Locale.ENGLISH), new SimpleDateFormat("MMMM d yyyy HH:mm:ss", Locale.ENGLISH), new SimpleDateFormat("MMMM d yyyy HH:mm", Locale.ENGLISH), new SimpleDateFormat("EEE, MMM dd, yyyy HH:mm:ssZ", Locale.ENGLISH), new SimpleDateFormat("EEE, MMM dd, yyyy HH:mm:ss", Locale.ENGLISH), new SimpleDateFormat("EEEE, MMMM dd, yyyy H:mm:ss a zzz", Locale.ENGLISH), new SimpleDateFormat("dd-MMM-yy HH:mm a", Locale.ENGLISH), new SimpleDateFormat("dd-MMMM-yy HH:mm a", Locale.ENGLISH), new SimpleDateFormat("EE, dd-MMM-yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("EE, dd MMM yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("EEE d, MMM yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("dd-MMM-yyyy", Locale.ENGLISH), new SimpleDateFormat("MMMM, dd yyyy HH:mm:ssZ", Locale.ENGLISH), new SimpleDateFormat("MMMM, dd yyyy HH:mm:ss", Locale.ENGLISH), new SimpleDateFormat("yyyy/MM/dd HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("dd MMM yyyy HH:mm:ss zz", Locale.ENGLISH), new SimpleDateFormat("EEE MMM dd yyyy HH:mm:ss 'GMT'ZZ (z)", Locale.ENGLISH), new SimpleDateFormat("dd MMM, yyyy HH:mm:ss", Locale.ENGLISH) // ,new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss",Locale.ENGLISH) }; for (int i = 0; i < df.length; i++) { df[i].setLenient(lenient); df[i].setTimeZone(tz); } formats.put(id, df); } return clone(df); }
[ "public", "static", "DateFormat", "[", "]", "getCFMLFormats", "(", "TimeZone", "tz", ",", "boolean", "lenient", ")", "{", "String", "id", "=", "\"cfml-\"", "+", "Locale", ".", "ENGLISH", ".", "toString", "(", ")", "+", "\"-\"", "+", "tz", ".", "getID", ...
CFML Supported LS Formats @param locale @param tz @param lenient @return
[ "CFML", "Supported", "LS", "Formats" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/i18n/FormatUtil.java#L246-L271
samskivert/samskivert
src/main/java/com/samskivert/jdbc/SimpleRepository.java
SimpleRepository.executeUpdate
protected <V> V executeUpdate (Operation<V> op) throws PersistenceException { return execute(op, true, false); }
java
protected <V> V executeUpdate (Operation<V> op) throws PersistenceException { return execute(op, true, false); }
[ "protected", "<", "V", ">", "V", "executeUpdate", "(", "Operation", "<", "V", ">", "op", ")", "throws", "PersistenceException", "{", "return", "execute", "(", "op", ",", "true", ",", "false", ")", ";", "}" ]
Executes the supplied read-write operation. In the event of a transient failure, the repository will attempt to reestablish the database connection and try the operation again. @return whatever value is returned by the invoked operation.
[ "Executes", "the", "supplied", "read", "-", "write", "operation", ".", "In", "the", "event", "of", "a", "transient", "failure", "the", "repository", "will", "attempt", "to", "reestablish", "the", "database", "connection", "and", "try", "the", "operation", "aga...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/SimpleRepository.java#L101-L105
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bcc/BccClient.java
BccClient.bindInstanceToSecurityGroup
public void bindInstanceToSecurityGroup(String instanceId, String securityGroupId) { this.bindInstanceToSecurityGroup(new BindSecurityGroupRequest() .withInstanceId(instanceId).withSecurityGroupId(securityGroupId)); }
java
public void bindInstanceToSecurityGroup(String instanceId, String securityGroupId) { this.bindInstanceToSecurityGroup(new BindSecurityGroupRequest() .withInstanceId(instanceId).withSecurityGroupId(securityGroupId)); }
[ "public", "void", "bindInstanceToSecurityGroup", "(", "String", "instanceId", ",", "String", "securityGroupId", ")", "{", "this", ".", "bindInstanceToSecurityGroup", "(", "new", "BindSecurityGroupRequest", "(", ")", ".", "withInstanceId", "(", "instanceId", ")", ".", ...
Binding the instance to specified securitygroup. @param instanceId The id of the instance. @param securityGroupId The id of the securitygroup.
[ "Binding", "the", "instance", "to", "specified", "securitygroup", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L712-L715
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/SubStringOperation.java
SubStringOperation.getToParameter
private Integer getToParameter(Map<String, String> parameters, Integer defaultValue) throws TransformationOperationException { return getSubStringParameter(parameters, toParam, defaultValue); }
java
private Integer getToParameter(Map<String, String> parameters, Integer defaultValue) throws TransformationOperationException { return getSubStringParameter(parameters, toParam, defaultValue); }
[ "private", "Integer", "getToParameter", "(", "Map", "<", "String", ",", "String", ">", "parameters", ",", "Integer", "defaultValue", ")", "throws", "TransformationOperationException", "{", "return", "getSubStringParameter", "(", "parameters", ",", "toParam", ",", "d...
Get the 'to' parameter from the parameters. If the parameter is not set the defaultValue is taken instead.
[ "Get", "the", "to", "parameter", "from", "the", "parameters", ".", "If", "the", "parameter", "is", "not", "set", "the", "defaultValue", "is", "taken", "instead", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/operation/SubStringOperation.java#L104-L107
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/GridBagLayoutFormBuilder.java
GridBagLayoutFormBuilder.appendLabeledField
public GridBagLayoutFormBuilder appendLabeledField(String propertyName, int colSpan) { return appendLabeledField(propertyName, LabelOrientation.LEFT, colSpan); }
java
public GridBagLayoutFormBuilder appendLabeledField(String propertyName, int colSpan) { return appendLabeledField(propertyName, LabelOrientation.LEFT, colSpan); }
[ "public", "GridBagLayoutFormBuilder", "appendLabeledField", "(", "String", "propertyName", ",", "int", "colSpan", ")", "{", "return", "appendLabeledField", "(", "propertyName", ",", "LabelOrientation", ".", "LEFT", ",", "colSpan", ")", ";", "}" ]
Appends a label and field to the end of the current line. <p /> The label will be to the left of the field, and be right-justified. <br /> The field will "grow" horizontally as space allows. <p /> @param propertyName the name of the property to create the controls for @param colSpan the number of columns the field should span @return "this" to make it easier to string together append calls
[ "Appends", "a", "label", "and", "field", "to", "the", "end", "of", "the", "current", "line", ".", "<p", "/", ">" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/GridBagLayoutFormBuilder.java#L79-L81
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/RegularFile.java
RegularFile.transferTo
public long transferTo(long pos, long count, WritableByteChannel dest) throws IOException { long bytesToRead = bytesToRead(pos, count); if (bytesToRead > 0) { long remaining = bytesToRead; int blockIndex = blockIndex(pos); byte[] block = blocks[blockIndex]; int off = offsetInBlock(pos); ByteBuffer buf = ByteBuffer.wrap(block, off, length(off, remaining)); while (buf.hasRemaining()) { remaining -= dest.write(buf); } buf.clear(); while (remaining > 0) { int index = ++blockIndex; block = blocks[index]; buf = ByteBuffer.wrap(block, 0, length(remaining)); while (buf.hasRemaining()) { remaining -= dest.write(buf); } buf.clear(); } } return Math.max(bytesToRead, 0); // don't return -1 for this method }
java
public long transferTo(long pos, long count, WritableByteChannel dest) throws IOException { long bytesToRead = bytesToRead(pos, count); if (bytesToRead > 0) { long remaining = bytesToRead; int blockIndex = blockIndex(pos); byte[] block = blocks[blockIndex]; int off = offsetInBlock(pos); ByteBuffer buf = ByteBuffer.wrap(block, off, length(off, remaining)); while (buf.hasRemaining()) { remaining -= dest.write(buf); } buf.clear(); while (remaining > 0) { int index = ++blockIndex; block = blocks[index]; buf = ByteBuffer.wrap(block, 0, length(remaining)); while (buf.hasRemaining()) { remaining -= dest.write(buf); } buf.clear(); } } return Math.max(bytesToRead, 0); // don't return -1 for this method }
[ "public", "long", "transferTo", "(", "long", "pos", ",", "long", "count", ",", "WritableByteChannel", "dest", ")", "throws", "IOException", "{", "long", "bytesToRead", "=", "bytesToRead", "(", "pos", ",", "count", ")", ";", "if", "(", "bytesToRead", ">", "...
Transfers up to {@code count} bytes to the given channel starting at position {@code pos} in this file. Returns the number of bytes transferred, possibly 0. Note that unlike all other read methods in this class, this method does not return -1 if {@code pos} is greater than or equal to the current size. This for consistency with {@link FileChannel#transferTo}, which this method is primarily intended as an implementation of.
[ "Transfers", "up", "to", "{" ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/RegularFile.java#L559-L588
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java
ResolvableType.forField
public static ResolvableType forField(Field field, ResolvableType implementationType) { Assert.notNull(field, "Field must not be null"); implementationType = (implementationType == null ? NONE : implementationType); ResolvableType owner = implementationType.as(field.getDeclaringClass()); return forType(null, new FieldTypeProvider(field), owner.asVariableResolver()); }
java
public static ResolvableType forField(Field field, ResolvableType implementationType) { Assert.notNull(field, "Field must not be null"); implementationType = (implementationType == null ? NONE : implementationType); ResolvableType owner = implementationType.as(field.getDeclaringClass()); return forType(null, new FieldTypeProvider(field), owner.asVariableResolver()); }
[ "public", "static", "ResolvableType", "forField", "(", "Field", "field", ",", "ResolvableType", "implementationType", ")", "{", "Assert", ".", "notNull", "(", "field", ",", "\"Field must not be null\"", ")", ";", "implementationType", "=", "(", "implementationType", ...
Return a {@link ResolvableType} for the specified {@link Field} with a given implementation. <p>Use this variant when the class that declares the field includes generic parameter variables that are satisfied by the implementation type. @param field the source field @param implementationType the implementation type @return a {@link ResolvableType} for the specified field @see #forField(Field)
[ "Return", "a", "{" ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java#L953-L958
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
GrailsDomainBinder.bindUnidirectionalOneToMany
protected void bindUnidirectionalOneToMany(org.grails.datastore.mapping.model.types.OneToMany property, InFlightMetadataCollector mappings, Collection collection) { Value v = collection.getElement(); v.createForeignKey(); String entityName; if (v instanceof ManyToOne) { ManyToOne manyToOne = (ManyToOne) v; entityName = manyToOne.getReferencedEntityName(); } else { entityName = ((OneToMany) v).getReferencedEntityName(); } collection.setInverse(false); PersistentClass referenced = mappings.getEntityBinding(entityName); Backref prop = new Backref(); PersistentEntity owner = property.getOwner(); prop.setEntityName(owner.getName()); prop.setName(UNDERSCORE + addUnderscore(owner.getJavaClass().getSimpleName(), property.getName()) + "Backref"); prop.setUpdateable(false); prop.setInsertable(true); prop.setCollectionRole(collection.getRole()); prop.setValue(collection.getKey()); prop.setOptional(true); referenced.addProperty(prop); }
java
protected void bindUnidirectionalOneToMany(org.grails.datastore.mapping.model.types.OneToMany property, InFlightMetadataCollector mappings, Collection collection) { Value v = collection.getElement(); v.createForeignKey(); String entityName; if (v instanceof ManyToOne) { ManyToOne manyToOne = (ManyToOne) v; entityName = manyToOne.getReferencedEntityName(); } else { entityName = ((OneToMany) v).getReferencedEntityName(); } collection.setInverse(false); PersistentClass referenced = mappings.getEntityBinding(entityName); Backref prop = new Backref(); PersistentEntity owner = property.getOwner(); prop.setEntityName(owner.getName()); prop.setName(UNDERSCORE + addUnderscore(owner.getJavaClass().getSimpleName(), property.getName()) + "Backref"); prop.setUpdateable(false); prop.setInsertable(true); prop.setCollectionRole(collection.getRole()); prop.setValue(collection.getKey()); prop.setOptional(true); referenced.addProperty(prop); }
[ "protected", "void", "bindUnidirectionalOneToMany", "(", "org", ".", "grails", ".", "datastore", ".", "mapping", ".", "model", ".", "types", ".", "OneToMany", "property", ",", "InFlightMetadataCollector", "mappings", ",", "Collection", "collection", ")", "{", "Val...
Binds a unidirectional one-to-many creating a psuedo back reference property in the process. @param property @param mappings @param collection
[ "Binds", "a", "unidirectional", "one", "-", "to", "-", "many", "creating", "a", "psuedo", "back", "reference", "property", "in", "the", "process", "." ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L917-L941
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java
DocBookBuilder.buildBook
public HashMap<String, byte[]> buildBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions buildingOptions) throws BuilderCreationException, BuildProcessingException { return buildBook(contentSpec, requester, buildingOptions, new HashMap<String, byte[]>()); }
java
public HashMap<String, byte[]> buildBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions buildingOptions) throws BuilderCreationException, BuildProcessingException { return buildBook(contentSpec, requester, buildingOptions, new HashMap<String, byte[]>()); }
[ "public", "HashMap", "<", "String", ",", "byte", "[", "]", ">", "buildBook", "(", "final", "ContentSpec", "contentSpec", ",", "final", "String", "requester", ",", "final", "DocBookBuildingOptions", "buildingOptions", ")", "throws", "BuilderCreationException", ",", ...
Builds a DocBook Formatted Book using a Content Specification to define the structure and contents of the book. @param contentSpec The content specification to build from. @param requester The user who requested the build. @param buildingOptions The options to be used when building. @return Returns a mapping of file names/locations to files. This HashMap can be used to build a ZIP archive. @throws BuilderCreationException Thrown if the builder is unable to start due to incorrect passed variables. @throws BuildProcessingException Any build issue that should not occur under normal circumstances. Ie a Template can't be converted to a DOM Document.
[ "Builds", "a", "DocBook", "Formatted", "Book", "using", "a", "Content", "Specification", "to", "define", "the", "structure", "and", "contents", "of", "the", "book", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L387-L390
infinispan/infinispan
extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java
StreamSummaryContainer.addPut
public void addPut(Object key, boolean remote) { if (!isEnabled()) { return; } syncOffer(remote ? Stat.REMOTE_PUT : Stat.LOCAL_PUT, key); }
java
public void addPut(Object key, boolean remote) { if (!isEnabled()) { return; } syncOffer(remote ? Stat.REMOTE_PUT : Stat.LOCAL_PUT, key); }
[ "public", "void", "addPut", "(", "Object", "key", ",", "boolean", "remote", ")", "{", "if", "(", "!", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "syncOffer", "(", "remote", "?", "Stat", ".", "REMOTE_PUT", ":", "Stat", ".", "LOCAL_PUT", ",",...
Adds the key to the put top-key. @param remote {@code true} if the key is remote, {@code false} otherwise.
[ "Adds", "the", "key", "to", "the", "put", "top", "-", "key", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java#L114-L120
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/kernelized/OSKL.java
OSKL.setR
public void setR(double R) { if(R <= 0 || Double.isNaN(R) || Double.isInfinite(R)) throw new IllegalArgumentException("R must be positive, not " + R); this.R = R; }
java
public void setR(double R) { if(R <= 0 || Double.isNaN(R) || Double.isInfinite(R)) throw new IllegalArgumentException("R must be positive, not " + R); this.R = R; }
[ "public", "void", "setR", "(", "double", "R", ")", "{", "if", "(", "R", "<=", "0", "||", "Double", ".", "isNaN", "(", "R", ")", "||", "Double", ".", "isInfinite", "(", "R", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"R must be positiv...
Sets the maximum allowed norm of the model. The original paper suggests values in the range 10<sup>x</sup> for <i>x</i> &isin; {0, 1, 2, 3, 4, 5}. @param R the maximum allowed norm for the model
[ "Sets", "the", "maximum", "allowed", "norm", "of", "the", "model", ".", "The", "original", "paper", "suggests", "values", "in", "the", "range", "10<sup", ">", "x<", "/", "sup", ">", "for", "<i", ">", "x<", "/", "i", ">", "&isin", ";", "{", "0", "1"...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/kernelized/OSKL.java#L228-L233
Coveros/selenified
src/main/java/com/coveros/selenified/element/Element.java
Element.isNotPresentEnabledInput
private boolean isNotPresentEnabledInput(String action, String expected) { // wait for element to be present if (isNotPresent(action, expected, Element.CANT_TYPE)) { return true; } // wait for element to be enabled return isNotEnabled(action, expected, Element.CANT_TYPE) || isNotInput(action, expected, Element.CANT_TYPE); }
java
private boolean isNotPresentEnabledInput(String action, String expected) { // wait for element to be present if (isNotPresent(action, expected, Element.CANT_TYPE)) { return true; } // wait for element to be enabled return isNotEnabled(action, expected, Element.CANT_TYPE) || isNotInput(action, expected, Element.CANT_TYPE); }
[ "private", "boolean", "isNotPresentEnabledInput", "(", "String", "action", ",", "String", "expected", ")", "{", "// wait for element to be present", "if", "(", "isNotPresent", "(", "action", ",", "expected", ",", "Element", ".", "CANT_TYPE", ")", ")", "{", "return...
Determines if something is present, enabled, and an input. This returns true if all three are true, otherwise, it returns false @param action - what action is occurring @param expected - what is the expected result @return Boolean: is the element present, enabled, and an input?
[ "Determines", "if", "something", "is", "present", "enabled", "and", "an", "input", ".", "This", "returns", "true", "if", "all", "three", "are", "true", "otherwise", "it", "returns", "false" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/Element.java#L715-L722
box/box-java-sdk
src/main/java/com/box/sdk/BoxFileUploadSession.java
BoxFileUploadSession.listParts
public BoxFileUploadSessionPartList listParts(int offset, int limit) { URL listPartsURL = this.sessionInfo.getSessionEndpoints().getListPartsEndpoint(); URLTemplate template = new URLTemplate(listPartsURL.toString()); QueryStringBuilder builder = new QueryStringBuilder(); builder.appendParam(OFFSET_QUERY_STRING, offset); String queryString = builder.appendParam(LIMIT_QUERY_STRING, limit).toString(); //Template is initalized with the full URL. So empty string for the path. URL url = template.buildWithQuery("", queryString); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, HttpMethod.GET); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject jsonObject = JsonObject.readFrom(response.getJSON()); return new BoxFileUploadSessionPartList(jsonObject); }
java
public BoxFileUploadSessionPartList listParts(int offset, int limit) { URL listPartsURL = this.sessionInfo.getSessionEndpoints().getListPartsEndpoint(); URLTemplate template = new URLTemplate(listPartsURL.toString()); QueryStringBuilder builder = new QueryStringBuilder(); builder.appendParam(OFFSET_QUERY_STRING, offset); String queryString = builder.appendParam(LIMIT_QUERY_STRING, limit).toString(); //Template is initalized with the full URL. So empty string for the path. URL url = template.buildWithQuery("", queryString); BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, HttpMethod.GET); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject jsonObject = JsonObject.readFrom(response.getJSON()); return new BoxFileUploadSessionPartList(jsonObject); }
[ "public", "BoxFileUploadSessionPartList", "listParts", "(", "int", "offset", ",", "int", "limit", ")", "{", "URL", "listPartsURL", "=", "this", ".", "sessionInfo", ".", "getSessionEndpoints", "(", ")", ".", "getListPartsEndpoint", "(", ")", ";", "URLTemplate", "...
Returns a list of all parts that have been uploaded to an upload session. @param offset paging marker for the list of parts. @param limit maximum number of parts to return. @return the list of parts.
[ "Returns", "a", "list", "of", "all", "parts", "that", "have", "been", "uploaded", "to", "an", "upload", "session", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFileUploadSession.java#L305-L321
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/graph/LinkClustering.java
LinkClustering.getConnectionSimilarity
private <E extends Edge> double getConnectionSimilarity( Graph<E> graph, Edge e1, Edge e2) { int e1to = e1.to(); int e1from = e1.from(); int e2to = e2.to(); int e2from = e2.from(); if (e1to == e2to) return getConnectionSimilarity(graph, e1to, e1from, e2from); else if (e1to == e2from) return getConnectionSimilarity(graph, e1to, e1from, e2to); else if (e1from == e2to) return getConnectionSimilarity(graph, e1from, e1to, e2from); else if (e1from == e2from) return getConnectionSimilarity(graph, e1from, e1to, e2to); else return 0; }
java
private <E extends Edge> double getConnectionSimilarity( Graph<E> graph, Edge e1, Edge e2) { int e1to = e1.to(); int e1from = e1.from(); int e2to = e2.to(); int e2from = e2.from(); if (e1to == e2to) return getConnectionSimilarity(graph, e1to, e1from, e2from); else if (e1to == e2from) return getConnectionSimilarity(graph, e1to, e1from, e2to); else if (e1from == e2to) return getConnectionSimilarity(graph, e1from, e1to, e2from); else if (e1from == e2from) return getConnectionSimilarity(graph, e1from, e1to, e2to); else return 0; }
[ "private", "<", "E", "extends", "Edge", ">", "double", "getConnectionSimilarity", "(", "Graph", "<", "E", ">", "graph", ",", "Edge", "e1", ",", "Edge", "e2", ")", "{", "int", "e1to", "=", "e1", ".", "to", "(", ")", ";", "int", "e1from", "=", "e1", ...
Computes the connection similarity for the two edges, first calculating the impost and keystones nodes. If the edges are not connected, returns 0. @see #getConnectionSimilarity(Graph,int,int,int)
[ "Computes", "the", "connection", "similarity", "for", "the", "two", "edges", "first", "calculating", "the", "impost", "and", "keystones", "nodes", ".", "If", "the", "edges", "are", "not", "connected", "returns", "0", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/graph/LinkClustering.java#L967-L983
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java
ParseUtils.missingRequired
public static XMLStreamException missingRequired(final XMLExtendedStreamReader reader, final String... required) { final StringBuilder b = new StringBuilder(); for (int i = 0; i < required.length; i++) { final String o = required[i]; b.append(o); if (required.length > i + 1) { b.append(", "); } } return wrapMissingRequiredAttribute(ControllerLogger.ROOT_LOGGER.missingRequiredAttributes(b, reader.getLocation()), reader, new HashSet<>(Arrays.asList(required))); }
java
public static XMLStreamException missingRequired(final XMLExtendedStreamReader reader, final String... required) { final StringBuilder b = new StringBuilder(); for (int i = 0; i < required.length; i++) { final String o = required[i]; b.append(o); if (required.length > i + 1) { b.append(", "); } } return wrapMissingRequiredAttribute(ControllerLogger.ROOT_LOGGER.missingRequiredAttributes(b, reader.getLocation()), reader, new HashSet<>(Arrays.asList(required))); }
[ "public", "static", "XMLStreamException", "missingRequired", "(", "final", "XMLExtendedStreamReader", "reader", ",", "final", "String", "...", "required", ")", "{", "final", "StringBuilder", "b", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i"...
Get an exception reporting a missing, required XML attribute. @param reader the stream reader @param required a set of enums whose toString method returns the attribute name @return the exception
[ "Get", "an", "exception", "reporting", "a", "missing", "required", "XML", "attribute", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java#L225-L237
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/MapKeyLoader.java
MapKeyLoader.updateLocalKeyLoadStatus
private void updateLocalKeyLoadStatus(Throwable t) { Operation op = new KeyLoadStatusOperation(mapName, t); // This updates the local record store on the partition thread. // If invoked by the SENDER_BACKUP however it's the replica index has to be set to 1, otherwise // it will be a remote call to the SENDER who is the owner of the given partitionId. if (hasBackup && role.is(Role.SENDER_BACKUP)) { opService.createInvocationBuilder(SERVICE_NAME, op, partitionId).setReplicaIndex(1).invoke(); } else { opService.createInvocationBuilder(SERVICE_NAME, op, partitionId).invoke(); } }
java
private void updateLocalKeyLoadStatus(Throwable t) { Operation op = new KeyLoadStatusOperation(mapName, t); // This updates the local record store on the partition thread. // If invoked by the SENDER_BACKUP however it's the replica index has to be set to 1, otherwise // it will be a remote call to the SENDER who is the owner of the given partitionId. if (hasBackup && role.is(Role.SENDER_BACKUP)) { opService.createInvocationBuilder(SERVICE_NAME, op, partitionId).setReplicaIndex(1).invoke(); } else { opService.createInvocationBuilder(SERVICE_NAME, op, partitionId).invoke(); } }
[ "private", "void", "updateLocalKeyLoadStatus", "(", "Throwable", "t", ")", "{", "Operation", "op", "=", "new", "KeyLoadStatusOperation", "(", "mapName", ",", "t", ")", ";", "// This updates the local record store on the partition thread.", "// If invoked by the SENDER_BACKUP ...
Notifies the record store of this map key loader that key loading has completed. @param t an exception that occurred during key loading or {@code null} if there was no exception
[ "Notifies", "the", "record", "store", "of", "this", "map", "key", "loader", "that", "key", "loading", "has", "completed", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapKeyLoader.java#L304-L314
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
MultiIndex.recoveryIndexFromCoordinator
private boolean recoveryIndexFromCoordinator() throws IOException { File indexDirectory = new File(handler.getContext().getIndexDirectory()); try { IndexRecovery indexRecovery = handler.getContext().getIndexRecovery(); // check if index not ready if (!indexRecovery.checkIndexReady()) { return false; } //Switch index offline indexRecovery.setIndexOffline(); for (String filePath : indexRecovery.getIndexList()) { File indexFile = new File(indexDirectory, filePath); if (!PrivilegedFileHelper.exists(indexFile.getParentFile())) { PrivilegedFileHelper.mkdirs(indexFile.getParentFile()); } // transfer file InputStream in = indexRecovery.getIndexFile(filePath); OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile); try { DirectoryHelper.transfer(in, out); } finally { DirectoryHelper.safeClose(in); DirectoryHelper.safeClose(out); } } //Switch index online indexRecovery.setIndexOnline(); return true; } catch (RepositoryException e) { LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing", e); } catch (IOException e) { LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing", e); } LOG.info("Clean up index directory " + indexDirectory.getAbsolutePath()); DirectoryHelper.removeDirectory(indexDirectory); return false; }
java
private boolean recoveryIndexFromCoordinator() throws IOException { File indexDirectory = new File(handler.getContext().getIndexDirectory()); try { IndexRecovery indexRecovery = handler.getContext().getIndexRecovery(); // check if index not ready if (!indexRecovery.checkIndexReady()) { return false; } //Switch index offline indexRecovery.setIndexOffline(); for (String filePath : indexRecovery.getIndexList()) { File indexFile = new File(indexDirectory, filePath); if (!PrivilegedFileHelper.exists(indexFile.getParentFile())) { PrivilegedFileHelper.mkdirs(indexFile.getParentFile()); } // transfer file InputStream in = indexRecovery.getIndexFile(filePath); OutputStream out = PrivilegedFileHelper.fileOutputStream(indexFile); try { DirectoryHelper.transfer(in, out); } finally { DirectoryHelper.safeClose(in); DirectoryHelper.safeClose(out); } } //Switch index online indexRecovery.setIndexOnline(); return true; } catch (RepositoryException e) { LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing", e); } catch (IOException e) { LOG.error("Cannot retrieve the indexes from the coordinator, the indexes will then be created from indexing", e); } LOG.info("Clean up index directory " + indexDirectory.getAbsolutePath()); DirectoryHelper.removeDirectory(indexDirectory); return false; }
[ "private", "boolean", "recoveryIndexFromCoordinator", "(", ")", "throws", "IOException", "{", "File", "indexDirectory", "=", "new", "File", "(", "handler", ".", "getContext", "(", ")", ".", "getIndexDirectory", "(", ")", ")", ";", "try", "{", "IndexRecovery", ...
Retrieves index from other node. @throws IOException if can't clean up directory after retrieving being failed
[ "Retrieves", "index", "from", "other", "node", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java#L3872-L3928
baratine/baratine
framework/src/main/java/com/caucho/v5/ramp/db/DatabaseServiceRamp.java
DatabaseServiceRamp.findAllLocal
@Override public void findAllLocal(String sql, Result<Iterable<Cursor>> result, Object ...args) { _kraken.findAllLocal(sql, args, result); }
java
@Override public void findAllLocal(String sql, Result<Iterable<Cursor>> result, Object ...args) { _kraken.findAllLocal(sql, args, result); }
[ "@", "Override", "public", "void", "findAllLocal", "(", "String", "sql", ",", "Result", "<", "Iterable", "<", "Cursor", ">", ">", "result", ",", "Object", "...", "args", ")", "{", "_kraken", ".", "findAllLocal", "(", "sql", ",", "args", ",", "result", ...
Queries the database, returning an iterator of results. @param sql the select query for the search @param result callback for the result iterator @param args arguments to the sql
[ "Queries", "the", "database", "returning", "an", "iterator", "of", "results", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/ramp/db/DatabaseServiceRamp.java#L144-L148
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/br/br_snmpmanager.java
br_snmpmanager.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { br_snmpmanager_responses result = (br_snmpmanager_responses) service.get_payload_formatter().string_to_resource(br_snmpmanager_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_snmpmanager_response_array); } br_snmpmanager[] result_br_snmpmanager = new br_snmpmanager[result.br_snmpmanager_response_array.length]; for(int i = 0; i < result.br_snmpmanager_response_array.length; i++) { result_br_snmpmanager[i] = result.br_snmpmanager_response_array[i].br_snmpmanager[0]; } return result_br_snmpmanager; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { br_snmpmanager_responses result = (br_snmpmanager_responses) service.get_payload_formatter().string_to_resource(br_snmpmanager_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_snmpmanager_response_array); } br_snmpmanager[] result_br_snmpmanager = new br_snmpmanager[result.br_snmpmanager_response_array.length]; for(int i = 0; i < result.br_snmpmanager_response_array.length; i++) { result_br_snmpmanager[i] = result.br_snmpmanager_response_array[i].br_snmpmanager[0]; } return result_br_snmpmanager; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "br_snmpmanager_responses", "result", "=", "(", "br_snmpmanager_responses", ")", "service", ".", "get_payload_...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_snmpmanager.java#L199-L216
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java
SameDiff.one
public SDVariable one(String name, org.nd4j.linalg.api.buffer.DataType dataType, int... shape) { return var(name, new ConstantInitScheme('f', 1.0), dataType, ArrayUtil.toLongArray(shape)); }
java
public SDVariable one(String name, org.nd4j.linalg.api.buffer.DataType dataType, int... shape) { return var(name, new ConstantInitScheme('f', 1.0), dataType, ArrayUtil.toLongArray(shape)); }
[ "public", "SDVariable", "one", "(", "String", "name", ",", "org", ".", "nd4j", ".", "linalg", ".", "api", ".", "buffer", ".", "DataType", "dataType", ",", "int", "...", "shape", ")", "{", "return", "var", "(", "name", ",", "new", "ConstantInitScheme", ...
Create a new variable with the specified shape, with all values initialized to 1.0 @param name the name of the variable to create @param shape the shape of the array to be created @return the created variable
[ "Create", "a", "new", "variable", "with", "the", "specified", "shape", "with", "all", "values", "initialized", "to", "1", ".", "0" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1946-L1948
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ObjectUtils.java
ObjectUtils.returnValueOrThrowIfNull
public static <T> T returnValueOrThrowIfNull(T value, RuntimeException exception) { Assert.notNull(exception, "RuntimeException must not be null"); return Optional.ofNullable(value).orElseThrow(() -> exception); }
java
public static <T> T returnValueOrThrowIfNull(T value, RuntimeException exception) { Assert.notNull(exception, "RuntimeException must not be null"); return Optional.ofNullable(value).orElseThrow(() -> exception); }
[ "public", "static", "<", "T", ">", "T", "returnValueOrThrowIfNull", "(", "T", "value", ",", "RuntimeException", "exception", ")", "{", "Assert", ".", "notNull", "(", "exception", ",", "\"RuntimeException must not be null\"", ")", ";", "return", "Optional", ".", ...
Returns the given {@code value} if not {@literal null} or throws the given {@link RuntimeException}. @param <T> {@link Class} type of the {@code value}. @param value {@link Object} value to evaluate. @param exception {@link RuntimeException} to throw if {@code value} is {@literal null}. @return the given {@code value} if not {@literal null} or throws the given {@link RuntimeException}. @throws IllegalArgumentException if {@code exception} is {@literal null}. @throws RuntimeException if {@code value} is {@literal null}.
[ "Returns", "the", "given", "{", "@code", "value", "}", "if", "not", "{", "@literal", "null", "}", "or", "throws", "the", "given", "{", "@link", "RuntimeException", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ObjectUtils.java#L231-L236
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java
IteratorExtensions.forEach
public static <T> void forEach(Iterator<T> iterator, Procedure2<? super T, ? super Integer> procedure) { if (procedure == null) throw new NullPointerException("procedure"); int i = 0; while(iterator.hasNext()) { procedure.apply(iterator.next(), i); if (i != Integer.MAX_VALUE) i++; } }
java
public static <T> void forEach(Iterator<T> iterator, Procedure2<? super T, ? super Integer> procedure) { if (procedure == null) throw new NullPointerException("procedure"); int i = 0; while(iterator.hasNext()) { procedure.apply(iterator.next(), i); if (i != Integer.MAX_VALUE) i++; } }
[ "public", "static", "<", "T", ">", "void", "forEach", "(", "Iterator", "<", "T", ">", "iterator", ",", "Procedure2", "<", "?", "super", "T", ",", "?", "super", "Integer", ">", "procedure", ")", "{", "if", "(", "procedure", "==", "null", ")", "throw",...
Applies {@code procedure} for each element of the given iterator. The procedure takes the element and a loop counter. If the counter would overflow, {@link Integer#MAX_VALUE} is returned for all subsequent elements. The first element is at index zero. @param iterator the iterator. May not be <code>null</code>. @param procedure the procedure. May not be <code>null</code>.
[ "Applies", "{", "@code", "procedure", "}", "for", "each", "element", "of", "the", "given", "iterator", ".", "The", "procedure", "takes", "the", "element", "and", "a", "loop", "counter", ".", "If", "the", "counter", "would", "overflow", "{", "@link", "Integ...
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java#L440-L449
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/TableRow.java
TableRow.setRowsSpanned
public void setRowsSpanned(final int rowIndex, final int n) throws IOException { if (n <= 1) return; final TableCell firstCell = this.getOrCreateCell(rowIndex); if (firstCell.isCovered()) return; this.parent.setRowsSpanned(this.rowIndex, rowIndex, n); }
java
public void setRowsSpanned(final int rowIndex, final int n) throws IOException { if (n <= 1) return; final TableCell firstCell = this.getOrCreateCell(rowIndex); if (firstCell.isCovered()) return; this.parent.setRowsSpanned(this.rowIndex, rowIndex, n); }
[ "public", "void", "setRowsSpanned", "(", "final", "int", "rowIndex", ",", "final", "int", "n", ")", "throws", "IOException", "{", "if", "(", "n", "<=", "1", ")", "return", ";", "final", "TableCell", "firstCell", "=", "this", ".", "getOrCreateCell", "(", ...
Add a span across rows @param rowIndex the index of the first row @param n the number of rows in the span @throws IOException if the cells can't be merged
[ "Add", "a", "span", "across", "rows" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableRow.java#L216-L223
belaban/JGroups
src/org/jgroups/protocols/rules/SUPERVISOR.java
SUPERVISOR.installRule
public void installRule(String name, long interval, Rule rule) { rule.supervisor(this).log(log).init(); Future<?> future=timer.scheduleAtFixedRate(rule, interval, interval, TimeUnit.MILLISECONDS); Tuple<Rule,Future<?>> existing=rules.put(name != null? name : rule.name(), new Tuple<>(rule, future)); if(existing != null) existing.getVal2().cancel(true); }
java
public void installRule(String name, long interval, Rule rule) { rule.supervisor(this).log(log).init(); Future<?> future=timer.scheduleAtFixedRate(rule, interval, interval, TimeUnit.MILLISECONDS); Tuple<Rule,Future<?>> existing=rules.put(name != null? name : rule.name(), new Tuple<>(rule, future)); if(existing != null) existing.getVal2().cancel(true); }
[ "public", "void", "installRule", "(", "String", "name", ",", "long", "interval", ",", "Rule", "rule", ")", "{", "rule", ".", "supervisor", "(", "this", ")", ".", "log", "(", "log", ")", ".", "init", "(", ")", ";", "Future", "<", "?", ">", "future",...
Installs a new rule @param name The name of the rule @param interval Number of ms between executions of the rule @param rule The rule
[ "Installs", "a", "new", "rule" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/rules/SUPERVISOR.java#L139-L145
aws/aws-sdk-java
aws-java-sdk-gamelift/src/main/java/com/amazonaws/services/gamelift/model/Player.java
Player.withLatencyInMs
public Player withLatencyInMs(java.util.Map<String, Integer> latencyInMs) { setLatencyInMs(latencyInMs); return this; }
java
public Player withLatencyInMs(java.util.Map<String, Integer> latencyInMs) { setLatencyInMs(latencyInMs); return this; }
[ "public", "Player", "withLatencyInMs", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "Integer", ">", "latencyInMs", ")", "{", "setLatencyInMs", "(", "latencyInMs", ")", ";", "return", "this", ";", "}" ]
<p> Set of values, expressed in milliseconds, indicating the amount of latency that a player experiences when connected to AWS regions. If this property is present, FlexMatch considers placing the match only in regions for which latency is reported. </p> <p> If a matchmaker has a rule that evaluates player latency, players must report latency in order to be matched. If no latency is reported in this scenario, FlexMatch assumes that no regions are available to the player and the ticket is not matchable. </p> @param latencyInMs Set of values, expressed in milliseconds, indicating the amount of latency that a player experiences when connected to AWS regions. If this property is present, FlexMatch considers placing the match only in regions for which latency is reported. </p> <p> If a matchmaker has a rule that evaluates player latency, players must report latency in order to be matched. If no latency is reported in this scenario, FlexMatch assumes that no regions are available to the player and the ticket is not matchable. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Set", "of", "values", "expressed", "in", "milliseconds", "indicating", "the", "amount", "of", "latency", "that", "a", "player", "experiences", "when", "connected", "to", "AWS", "regions", ".", "If", "this", "property", "is", "present", "FlexMatch",...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-gamelift/src/main/java/com/amazonaws/services/gamelift/model/Player.java#L296-L299
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.findMarshaller
public <S, T> ToMarshaller<S, T> findMarshaller(Class<S> source, Class<T> target, Class<? extends Annotation> qualifier) { return findMarshaller(new ConverterKey<S,T>(source, target, qualifier == null ? DefaultBinding.class : qualifier)); }
java
public <S, T> ToMarshaller<S, T> findMarshaller(Class<S> source, Class<T> target, Class<? extends Annotation> qualifier) { return findMarshaller(new ConverterKey<S,T>(source, target, qualifier == null ? DefaultBinding.class : qualifier)); }
[ "public", "<", "S", ",", "T", ">", "ToMarshaller", "<", "S", ",", "T", ">", "findMarshaller", "(", "Class", "<", "S", ">", "source", ",", "Class", "<", "T", ">", "target", ",", "Class", "<", "?", "extends", "Annotation", ">", "qualifier", ")", "{",...
Resolve a Marshaller with the given source and target class. The marshaller is used as follows: Instances of the source can be marshalled into the target class. @param source The source (input) class @param target The target (output) class @param qualifier The qualifier for which the marshaller must be registered
[ "Resolve", "a", "Marshaller", "with", "the", "given", "source", "and", "target", "class", ".", "The", "marshaller", "is", "used", "as", "follows", ":", "Instances", "of", "the", "source", "can", "be", "marshalled", "into", "the", "target", "class", "." ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L953-L955
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java
AssertKripton.assertTrueOfInvalidDefinition
public static void assertTrueOfInvalidDefinition(boolean expression, ModelProperty property, String message) { if (!expression) { String msg = String.format("In class '%s', property '%s' has invalid definition: %s", property.getParent().getElement().asType().toString(), property.getName(), message); throw (new InvalidDefinition(msg)); } }
java
public static void assertTrueOfInvalidDefinition(boolean expression, ModelProperty property, String message) { if (!expression) { String msg = String.format("In class '%s', property '%s' has invalid definition: %s", property.getParent().getElement().asType().toString(), property.getName(), message); throw (new InvalidDefinition(msg)); } }
[ "public", "static", "void", "assertTrueOfInvalidDefinition", "(", "boolean", "expression", ",", "ModelProperty", "property", ",", "String", "message", ")", "{", "if", "(", "!", "expression", ")", "{", "String", "msg", "=", "String", ".", "format", "(", "\"In c...
Assert true of invalid definition. @param expression the expression @param property the property @param message the message
[ "Assert", "true", "of", "invalid", "definition", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/AssertKripton.java#L410-L416
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/model/IndexForVc.java
IndexForVc.getConfigIndex
public static int getConfigIndex(VarSet vars, VarConfig config) { int configIndex = 0; int numStatesProd = 1; for (int v=vars.size()-1; v >= 0; v--) { Var var = vars.get(v); int state = config.getState(var, 0); configIndex += state * numStatesProd; numStatesProd *= var.getNumStates(); } return configIndex; }
java
public static int getConfigIndex(VarSet vars, VarConfig config) { int configIndex = 0; int numStatesProd = 1; for (int v=vars.size()-1; v >= 0; v--) { Var var = vars.get(v); int state = config.getState(var, 0); configIndex += state * numStatesProd; numStatesProd *= var.getNumStates(); } return configIndex; }
[ "public", "static", "int", "getConfigIndex", "(", "VarSet", "vars", ",", "VarConfig", "config", ")", "{", "int", "configIndex", "=", "0", ";", "int", "numStatesProd", "=", "1", ";", "for", "(", "int", "v", "=", "vars", ".", "size", "(", ")", "-", "1"...
Gets the index of the configuration of the variables where all those in config have the specified value, and all other variables in vars have the zero state. @param vars The variable set over which to iterate. @param config An assignment to a subset of vars. @return The configuration index.
[ "Gets", "the", "index", "of", "the", "configuration", "of", "the", "variables", "where", "all", "those", "in", "config", "have", "the", "specified", "value", "and", "all", "other", "variables", "in", "vars", "have", "the", "zero", "state", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/IndexForVc.java#L74-L84
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java
JDBC4PreparedStatement.setDate
@Override public void setDate(int parameterIndex, Date x) throws SQLException { checkParameterBounds(parameterIndex); throw SQLError.noSupport(); }
java
@Override public void setDate(int parameterIndex, Date x) throws SQLException { checkParameterBounds(parameterIndex); throw SQLError.noSupport(); }
[ "@", "Override", "public", "void", "setDate", "(", "int", "parameterIndex", ",", "Date", "x", ")", "throws", "SQLException", "{", "checkParameterBounds", "(", "parameterIndex", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application.
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "java", ".", "sql", ".", "Date", "value", "using", "the", "default", "time", "zone", "of", "the", "virtual", "machine", "that", "is", "running", "the", "application", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L318-L323
geomajas/geomajas-project-client-gwt2
plugin/wms/wms/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsClient.java
WmsClient.createLayer
public WmsLayer createLayer(String title, String crs, TileConfiguration tileConfig, WmsLayerConfiguration layerConfig, WmsLayerInfo layerInfo) { if (layerInfo == null || layerInfo.isQueryable()) { return new FeatureInfoSupportedWmsLayer(title, crs, layerConfig, tileConfig, layerInfo); } else { return new WmsLayerImpl(title, crs, layerConfig, tileConfig, layerInfo); } }
java
public WmsLayer createLayer(String title, String crs, TileConfiguration tileConfig, WmsLayerConfiguration layerConfig, WmsLayerInfo layerInfo) { if (layerInfo == null || layerInfo.isQueryable()) { return new FeatureInfoSupportedWmsLayer(title, crs, layerConfig, tileConfig, layerInfo); } else { return new WmsLayerImpl(title, crs, layerConfig, tileConfig, layerInfo); } }
[ "public", "WmsLayer", "createLayer", "(", "String", "title", ",", "String", "crs", ",", "TileConfiguration", "tileConfig", ",", "WmsLayerConfiguration", "layerConfig", ",", "WmsLayerInfo", "layerInfo", ")", "{", "if", "(", "layerInfo", "==", "null", "||", "layerIn...
Create a new WMS layer. This layer does not support a GetFeatureInfo call! If you need that, you'll have to use the server extension of this plug-in. @param title The layer title. @param crs The CRS for this layer. @param tileConfig The tile configuration object. @param layerConfig The layer configuration object. @param layerInfo The layer info object. Acquired from a WMS GetCapabilities. This object is optional. @return A new WMS layer.
[ "Create", "a", "new", "WMS", "layer", ".", "This", "layer", "does", "not", "support", "a", "GetFeatureInfo", "call!", "If", "you", "need", "that", "you", "ll", "have", "to", "use", "the", "server", "extension", "of", "this", "plug", "-", "in", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/wms/wms/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsClient.java#L94-L101
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/DbEntityManager.java
DbEntityManager.hasOptimisticLockingException
private DbOperation hasOptimisticLockingException(List<DbOperation> operationsToFlush, Throwable cause) { BatchExecutorException batchExecutorException = ExceptionUtil.findBatchExecutorException(cause); if (batchExecutorException != null) { int failedOperationIndex = batchExecutorException.getSuccessfulBatchResults().size(); if (failedOperationIndex < operationsToFlush.size()) { DbOperation failedOperation = operationsToFlush.get(failedOperationIndex); if (isOptimisticLockingException(failedOperation, cause)) { return failedOperation; } } } return null; }
java
private DbOperation hasOptimisticLockingException(List<DbOperation> operationsToFlush, Throwable cause) { BatchExecutorException batchExecutorException = ExceptionUtil.findBatchExecutorException(cause); if (batchExecutorException != null) { int failedOperationIndex = batchExecutorException.getSuccessfulBatchResults().size(); if (failedOperationIndex < operationsToFlush.size()) { DbOperation failedOperation = operationsToFlush.get(failedOperationIndex); if (isOptimisticLockingException(failedOperation, cause)) { return failedOperation; } } } return null; }
[ "private", "DbOperation", "hasOptimisticLockingException", "(", "List", "<", "DbOperation", ">", "operationsToFlush", ",", "Throwable", "cause", ")", "{", "BatchExecutorException", "batchExecutorException", "=", "ExceptionUtil", ".", "findBatchExecutorException", "(", "caus...
An OptimisticLockingException check for batch processing @param operationsToFlush The list of DB operations in which the Exception occurred @param cause the Exception object @return The DbOperation where the OptimisticLockingException has occurred or null if no OptimisticLockingException occurred
[ "An", "OptimisticLockingException", "check", "for", "batch", "processing" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/db/entitymanager/DbEntityManager.java#L379-L395
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/OAuth2Utils.java
OAuth2Utils.containsAll
public static boolean containsAll(Set<String> target, Set<String> members) { target = new HashSet<String>(target); target.retainAll(members); return target.size() == members.size(); }
java
public static boolean containsAll(Set<String> target, Set<String> members) { target = new HashSet<String>(target); target.retainAll(members); return target.size() == members.size(); }
[ "public", "static", "boolean", "containsAll", "(", "Set", "<", "String", ">", "target", ",", "Set", "<", "String", ">", "members", ")", "{", "target", "=", "new", "HashSet", "<", "String", ">", "(", "target", ")", ";", "target", ".", "retainAll", "(", ...
Compare 2 sets and check that one contains all members of the other. @param target set of strings to check @param members the members to compare to @return true if all members are in the target
[ "Compare", "2", "sets", "and", "check", "that", "one", "contains", "all", "members", "of", "the", "other", "." ]
train
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/OAuth2Utils.java#L126-L130