repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
dmak/jaxb-xew-plugin
src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java
XmlElementWrapperPlugin.moveClassLevelUp
private void moveClassLevelUp(Outline outline, JDefinedClass clazz) { // Modify the container so it now refers the class. Container can be a class or package. JDefinedClass parent = (JDefinedClass) clazz.parentContainer(); JClassContainer grandParent = parent.parentContainer(); Map<String, JDefinedClass> classes; // FIXME: Pending https://java.net/jira/browse/JAXB-957 if (grandParent.isClass()) { // Element class should be added as its container child: JDefinedClass grandParentClass = (JDefinedClass) grandParent; writeSummary("\tMoving inner class " + clazz.fullName() + " to class " + grandParentClass.fullName()); classes = getPrivateField(grandParentClass, "classes"); } else { JPackage grandParentPackage = (JPackage) grandParent; writeSummary("\tMoving inner class " + clazz.fullName() + " to package " + grandParentPackage.name()); classes = getPrivateField(grandParentPackage, "classes"); // In this scenario class should have "static" modifier reset otherwise it won't compile: setPrivateField(clazz.mods(), "mods", Integer.valueOf(clazz.mods().getValue() & ~JMod.STATIC)); for (ClassOutline classOutline : outline.getClasses()) { if (classOutline.implClass == clazz) { XSComponent sc = classOutline.target.getSchemaComponent(); // FIXME: Inner class is always a local declaration. assert (sc instanceof XSDeclaration && ((XSDeclaration) sc).isLocal()); setPrivateField(sc, "anonymous", Boolean.FALSE); break; } } } if (classes.containsKey(clazz.name())) { writeSummary("\tRenaming class " + clazz.fullName() + " to class " + parent.name() + clazz.name()); setPrivateField(clazz, "name", parent.name() + clazz.name()); } classes.put(clazz.name(), clazz); // Finally modify the class so that it refers back the container: setPrivateField(clazz, "outer", grandParent); }
java
private void moveClassLevelUp(Outline outline, JDefinedClass clazz) { // Modify the container so it now refers the class. Container can be a class or package. JDefinedClass parent = (JDefinedClass) clazz.parentContainer(); JClassContainer grandParent = parent.parentContainer(); Map<String, JDefinedClass> classes; // FIXME: Pending https://java.net/jira/browse/JAXB-957 if (grandParent.isClass()) { // Element class should be added as its container child: JDefinedClass grandParentClass = (JDefinedClass) grandParent; writeSummary("\tMoving inner class " + clazz.fullName() + " to class " + grandParentClass.fullName()); classes = getPrivateField(grandParentClass, "classes"); } else { JPackage grandParentPackage = (JPackage) grandParent; writeSummary("\tMoving inner class " + clazz.fullName() + " to package " + grandParentPackage.name()); classes = getPrivateField(grandParentPackage, "classes"); // In this scenario class should have "static" modifier reset otherwise it won't compile: setPrivateField(clazz.mods(), "mods", Integer.valueOf(clazz.mods().getValue() & ~JMod.STATIC)); for (ClassOutline classOutline : outline.getClasses()) { if (classOutline.implClass == clazz) { XSComponent sc = classOutline.target.getSchemaComponent(); // FIXME: Inner class is always a local declaration. assert (sc instanceof XSDeclaration && ((XSDeclaration) sc).isLocal()); setPrivateField(sc, "anonymous", Boolean.FALSE); break; } } } if (classes.containsKey(clazz.name())) { writeSummary("\tRenaming class " + clazz.fullName() + " to class " + parent.name() + clazz.name()); setPrivateField(clazz, "name", parent.name() + clazz.name()); } classes.put(clazz.name(), clazz); // Finally modify the class so that it refers back the container: setPrivateField(clazz, "outer", grandParent); }
[ "private", "void", "moveClassLevelUp", "(", "Outline", "outline", ",", "JDefinedClass", "clazz", ")", "{", "// Modify the container so it now refers the class. Container can be a class or package.", "JDefinedClass", "parent", "=", "(", "JDefinedClass", ")", "clazz", ".", "par...
Move the given class to his grandparent (either class or package). The given {@code clazz} should be inner class.
[ "Move", "the", "given", "class", "to", "his", "grandparent", "(", "either", "class", "or", "package", ")", ".", "The", "given", "{" ]
train
https://github.com/dmak/jaxb-xew-plugin/blob/d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3/src/main/java/com/sun/tools/xjc/addon/xew/XmlElementWrapperPlugin.java#L875-L923
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/hints/HintRule.java
HintRule.addGivenVersion
public void addGivenVersion(String source, String name, String value, boolean regex, Confidence confidence) { givenVersion.add(new EvidenceMatcher(source, name, value, regex, confidence)); }
java
public void addGivenVersion(String source, String name, String value, boolean regex, Confidence confidence) { givenVersion.add(new EvidenceMatcher(source, name, value, regex, confidence)); }
[ "public", "void", "addGivenVersion", "(", "String", "source", ",", "String", "name", ",", "String", "value", ",", "boolean", "regex", ",", "Confidence", "confidence", ")", "{", "givenVersion", ".", "add", "(", "new", "EvidenceMatcher", "(", "source", ",", "n...
Adds a given version to the list of evidence to match. @param source the source of the evidence @param name the name of the evidence @param value the value of the evidence @param regex whether value is a regex @param confidence the confidence of the evidence
[ "Adds", "a", "given", "version", "to", "the", "list", "of", "evidence", "to", "match", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/hints/HintRule.java#L273-L275
prestodb/presto
presto-main/src/main/java/com/facebook/presto/util/DateTimeUtils.java
DateTimeUtils.parseTimestampWithoutTimeZone
@Deprecated public static long parseTimestampWithoutTimeZone(TimeZoneKey timeZoneKey, String value) { return TIMESTAMP_WITH_OR_WITHOUT_TIME_ZONE_FORMATTER.withChronology(getChronology(timeZoneKey)).parseMillis(value); }
java
@Deprecated public static long parseTimestampWithoutTimeZone(TimeZoneKey timeZoneKey, String value) { return TIMESTAMP_WITH_OR_WITHOUT_TIME_ZONE_FORMATTER.withChronology(getChronology(timeZoneKey)).parseMillis(value); }
[ "@", "Deprecated", "public", "static", "long", "parseTimestampWithoutTimeZone", "(", "TimeZoneKey", "timeZoneKey", ",", "String", "value", ")", "{", "return", "TIMESTAMP_WITH_OR_WITHOUT_TIME_ZONE_FORMATTER", ".", "withChronology", "(", "getChronology", "(", "timeZoneKey", ...
Parse a string (optionally containing a zone) as a value of TIMESTAMP type. If the string doesn't specify a zone, it is interpreted in {@code timeZoneKey} zone. @return stack representation of legacy TIMESTAMP type
[ "Parse", "a", "string", "(", "optionally", "containing", "a", "zone", ")", "as", "a", "value", "of", "TIMESTAMP", "type", ".", "If", "the", "string", "doesn", "t", "specify", "a", "zone", "it", "is", "interpreted", "in", "{", "@code", "timeZoneKey", "}",...
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/util/DateTimeUtils.java#L226-L230
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java
ReflectionFragment.getParameterValue
private Object getParameterValue(ControlBeanContext context, Method method, Object[] args) { Object value; try { value = context.getParameterValue(method, _nameQualifiers[0], args); } catch (IllegalArgumentException iae) { throw new ControlException("Invalid argument name in SQL statement: " + _nameQualifiers[0], iae); } for (int i = 1; i < _nameQualifiers.length; i++) { // handle maps, properties, and fields... value = extractValue(value, _nameQualifiers[i - 1], _nameQualifiers[i]); } return value; }
java
private Object getParameterValue(ControlBeanContext context, Method method, Object[] args) { Object value; try { value = context.getParameterValue(method, _nameQualifiers[0], args); } catch (IllegalArgumentException iae) { throw new ControlException("Invalid argument name in SQL statement: " + _nameQualifiers[0], iae); } for (int i = 1; i < _nameQualifiers.length; i++) { // handle maps, properties, and fields... value = extractValue(value, _nameQualifiers[i - 1], _nameQualifiers[i]); } return value; }
[ "private", "Object", "getParameterValue", "(", "ControlBeanContext", "context", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "{", "Object", "value", ";", "try", "{", "value", "=", "context", ".", "getParameterValue", "(", "method", ",", "_n...
Get the value from the method param. @param method @param args @return Value of reflected method param.
[ "Get", "the", "value", "from", "the", "method", "param", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java#L177-L190
jenkinsci/jenkins
core/src/main/java/hudson/os/solaris/ZFSInstaller.java
ZFSInstaller.createZfsFileSystem
private String createZfsFileSystem(final TaskListener listener, String rootUsername, String rootPassword) throws IOException, InterruptedException, ZFSException { // capture the UID that Hudson runs under // so that we can allow this user to do everything on this new partition final int uid = LIBC.geteuid(); final int gid = LIBC.getegid(); passwd pwd = LIBC.getpwuid(uid); if(pwd==null) throw new IOException("Failed to obtain the current user information for "+uid); final String userName = pwd.pw_name; final File home = Jenkins.getInstance().getRootDir(); // this is the actual creation of the file system. // return true indicating a success return SU.execute(listener, rootUsername, rootPassword, new Create(listener, home, uid, gid, userName)); }
java
private String createZfsFileSystem(final TaskListener listener, String rootUsername, String rootPassword) throws IOException, InterruptedException, ZFSException { // capture the UID that Hudson runs under // so that we can allow this user to do everything on this new partition final int uid = LIBC.geteuid(); final int gid = LIBC.getegid(); passwd pwd = LIBC.getpwuid(uid); if(pwd==null) throw new IOException("Failed to obtain the current user information for "+uid); final String userName = pwd.pw_name; final File home = Jenkins.getInstance().getRootDir(); // this is the actual creation of the file system. // return true indicating a success return SU.execute(listener, rootUsername, rootPassword, new Create(listener, home, uid, gid, userName)); }
[ "private", "String", "createZfsFileSystem", "(", "final", "TaskListener", "listener", ",", "String", "rootUsername", ",", "String", "rootPassword", ")", "throws", "IOException", ",", "InterruptedException", ",", "ZFSException", "{", "// capture the UID that Hudson runs unde...
Creates a ZFS file system to migrate the data to. <p> This has to be done while we still have an interactive access with the user, since it involves the password. <p> An exception will be thrown if the operation fails. A normal completion means a success. @return The ZFS dataset name to migrate the data to.
[ "Creates", "a", "ZFS", "file", "system", "to", "migrate", "the", "data", "to", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/os/solaris/ZFSInstaller.java#L158-L173
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/parser/JSONParserReader.java
JSONParserReader.parse
public Object parse(Reader in) throws ParseException { return parse(in, JSONValue.defaultReader.DEFAULT); }
java
public Object parse(Reader in) throws ParseException { return parse(in, JSONValue.defaultReader.DEFAULT); }
[ "public", "Object", "parse", "(", "Reader", "in", ")", "throws", "ParseException", "{", "return", "parse", "(", "in", ",", "JSONValue", ".", "defaultReader", ".", "DEFAULT", ")", ";", "}" ]
use to return Primitive Type, or String, Or JsonObject or JsonArray generated by a ContainerFactory
[ "use", "to", "return", "Primitive", "Type", "or", "String", "Or", "JsonObject", "or", "JsonArray", "generated", "by", "a", "ContainerFactory" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParserReader.java#L43-L45
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/support/PageFactory.java
PageFactory.initElements
public static <T> T initElements(WebDriver driver, Class<T> pageClassToProxy) { T page = instantiatePage(driver, pageClassToProxy); initElements(driver, page); return page; }
java
public static <T> T initElements(WebDriver driver, Class<T> pageClassToProxy) { T page = instantiatePage(driver, pageClassToProxy); initElements(driver, page); return page; }
[ "public", "static", "<", "T", ">", "T", "initElements", "(", "WebDriver", "driver", ",", "Class", "<", "T", ">", "pageClassToProxy", ")", "{", "T", "page", "=", "instantiatePage", "(", "driver", ",", "pageClassToProxy", ")", ";", "initElements", "(", "driv...
Instantiate an instance of the given class, and set a lazy proxy for each of the WebElement and List&lt;WebElement&gt; fields that have been declared, assuming that the field name is also the HTML element's "id" or "name". This means that for the class: <code> public class Page { private WebElement submit; } </code> there will be an element that can be located using the xpath expression "//*[@id='submit']" or "//*[@name='submit']" By default, the element or the list is looked up each and every time a method is called upon it. To change this behaviour, simply annotate the field with the {@link CacheLookup}. To change how the element is located, use the {@link FindBy} annotation. This method will attempt to instantiate the class given to it, preferably using a constructor which takes a WebDriver instance as its only argument or falling back on a no-arg constructor. An exception will be thrown if the class cannot be instantiated. @param driver The driver that will be used to look up the elements @param pageClassToProxy A class which will be initialised. @param <T> Class of the PageObject @return An instantiated instance of the class with WebElement and List&lt;WebElement&gt; fields proxied @see FindBy @see CacheLookup
[ "Instantiate", "an", "instance", "of", "the", "given", "class", "and", "set", "a", "lazy", "proxy", "for", "each", "of", "the", "WebElement", "and", "List&lt", ";", "WebElement&gt", ";", "fields", "that", "have", "been", "declared", "assuming", "that", "the"...
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/PageFactory.java#L62-L66
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionOperationId.java
RegionOperationId.of
public static RegionOperationId of(String project, String region, String operation) { return new RegionOperationId(project, region, operation); }
java
public static RegionOperationId of(String project, String region, String operation) { return new RegionOperationId(project, region, operation); }
[ "public", "static", "RegionOperationId", "of", "(", "String", "project", ",", "String", "region", ",", "String", "operation", ")", "{", "return", "new", "RegionOperationId", "(", "project", ",", "region", ",", "operation", ")", ";", "}" ]
Returns a region operation identity given project, region and operation names.
[ "Returns", "a", "region", "operation", "identity", "given", "project", "region", "and", "operation", "names", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/RegionOperationId.java#L101-L103
OpenLiberty/open-liberty
dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java
RecoveryDirectorImpl.serialRecoveryComplete
@Override public void serialRecoveryComplete(RecoveryAgent recoveryAgent, FailureScope failureScope) throws InvalidFailureScopeException { if (tc.isEntryEnabled()) Tr.entry(tc, "serialRecoveryComplete", new Object[] { recoveryAgent, failureScope, this }); final boolean removed = removeInitializationRecord(recoveryAgent, failureScope); if (!removed) { if (tc.isEventEnabled()) Tr.event(tc, "The supplied FailureScope was not recognized as outstaning work for this RecoveryAgent"); if (tc.isEntryEnabled()) Tr.exit(tc, "serialRecoveryComplete", "InvalidFailureScopeException"); throw new InvalidFailureScopeException(null); } _eventListeners.clientRecoveryComplete(failureScope, recoveryAgent.clientIdentifier()); if (tc.isEntryEnabled()) Tr.exit(tc, "serialRecoveryComplete"); }
java
@Override public void serialRecoveryComplete(RecoveryAgent recoveryAgent, FailureScope failureScope) throws InvalidFailureScopeException { if (tc.isEntryEnabled()) Tr.entry(tc, "serialRecoveryComplete", new Object[] { recoveryAgent, failureScope, this }); final boolean removed = removeInitializationRecord(recoveryAgent, failureScope); if (!removed) { if (tc.isEventEnabled()) Tr.event(tc, "The supplied FailureScope was not recognized as outstaning work for this RecoveryAgent"); if (tc.isEntryEnabled()) Tr.exit(tc, "serialRecoveryComplete", "InvalidFailureScopeException"); throw new InvalidFailureScopeException(null); } _eventListeners.clientRecoveryComplete(failureScope, recoveryAgent.clientIdentifier()); if (tc.isEntryEnabled()) Tr.exit(tc, "serialRecoveryComplete"); }
[ "@", "Override", "public", "void", "serialRecoveryComplete", "(", "RecoveryAgent", "recoveryAgent", ",", "FailureScope", "failureScope", ")", "throws", "InvalidFailureScopeException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", ...
<p> Invoked by a client service to indicate that a unit of recovery, identified by FailureScope has been completed. The client service supplies its RecoveryAgent reference to identify itself. </p> <p> When recovery events occur, each client services RecoveryAgent callback object has its initiateRecovery() method invoked. As a result of this call, the client services has an opportunity to perform any SERIAL recovery processing for that failure scope. Once this is complete, the client calls the serialRecoveryComplete method to give the next client service to handle recovery processing. Recovery processing as a whole may or may not be complete before this call is issued - it may continue afterwards on a parrallel thread if required. The latter design is prefereable in an HA-enabled environment as controll must be passed back as quickly as possible to avoid the HA framework shutting down the JVM. </p> <p> Regardless of the style adopted, once the recovery process has performed as much processing as can be conducted without any failed resources becoming available again (eg a failed database), the initialRecoveryComplete call must be issued to indicate this fact. This call is used by the RLS to optomize its interactions with the HA framework. </p> <p> The RecoveryDirector will then pass the recovery request on to other registered client services. </p> @param recoveryAgent The client services RecoveryAgent instance. @param failureScope The unit of recovery that is completed. @exception InvalidFailureScope The supplied FailureScope was not recognized as outstanding unit of recovery for the client service.
[ "<p", ">", "Invoked", "by", "a", "client", "service", "to", "indicate", "that", "a", "unit", "of", "recovery", "identified", "by", "FailureScope", "has", "been", "completed", ".", "The", "client", "service", "supplies", "its", "RecoveryAgent", "reference", "to...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java#L507-L526
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java
BpmnParseUtil.findCamundaExtensionElement
public static Element findCamundaExtensionElement(Element element, String extensionElementName) { Element extensionElements = element.element("extensionElements"); if(extensionElements != null) { return extensionElements.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, extensionElementName); } else { return null; } }
java
public static Element findCamundaExtensionElement(Element element, String extensionElementName) { Element extensionElements = element.element("extensionElements"); if(extensionElements != null) { return extensionElements.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, extensionElementName); } else { return null; } }
[ "public", "static", "Element", "findCamundaExtensionElement", "(", "Element", "element", ",", "String", "extensionElementName", ")", "{", "Element", "extensionElements", "=", "element", ".", "element", "(", "\"extensionElements\"", ")", ";", "if", "(", "extensionEleme...
Returns the camunda extension element in the camunda namespace and the given name. @param element the parent element of the extension element @param extensionElementName the name of the extension element to find @return the extension element or null if not found
[ "Returns", "the", "camunda", "extension", "element", "in", "the", "camunda", "namespace", "and", "the", "given", "name", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java#L53-L60
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/XMLProperties.java
XMLProperties.setProperties
public Properties setProperties(String pGroupKey, Properties pProperties) { XMLProperties old = new XMLProperties(); String groupKey = pGroupKey; if (groupKey.charAt(groupKey.length()) != '.') { groupKey += "."; } Iterator iterator = pProperties.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); String key = (String) entry.getKey(); Object obj = setPropertyValue(groupKey + key, entry.getValue()); // Return removed entries if (obj != null) { old.setPropertyValue(groupKey + key, entry.getValue()); } } return ((old.size() > 0) ? old : null); }
java
public Properties setProperties(String pGroupKey, Properties pProperties) { XMLProperties old = new XMLProperties(); String groupKey = pGroupKey; if (groupKey.charAt(groupKey.length()) != '.') { groupKey += "."; } Iterator iterator = pProperties.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry) iterator.next(); String key = (String) entry.getKey(); Object obj = setPropertyValue(groupKey + key, entry.getValue()); // Return removed entries if (obj != null) { old.setPropertyValue(groupKey + key, entry.getValue()); } } return ((old.size() > 0) ? old : null); }
[ "public", "Properties", "setProperties", "(", "String", "pGroupKey", ",", "Properties", "pProperties", ")", "{", "XMLProperties", "old", "=", "new", "XMLProperties", "(", ")", ";", "String", "groupKey", "=", "pGroupKey", ";", "if", "(", "groupKey", ".", "charA...
Sets the properties in the given properties group. Existing properties in the same group, will not be removed, unless they are replaced by new values. Any existing properties in the same group that was replaced, are returned. If no properties are replaced, <CODE>null<CODE> is returned. @param pGroupKey the group key @param pProperties the properties to set into this group @return Any existing properties in the same group that was replaced. If no properties are replaced, <CODE>null<CODE> is returned.
[ "Sets", "the", "properties", "in", "the", "given", "properties", "group", ".", "Existing", "properties", "in", "the", "same", "group", "will", "not", "be", "removed", "unless", "they", "are", "replaced", "by", "new", "values", ".", "Any", "existing", "proper...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/XMLProperties.java#L954-L974
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java
EvaluatorManager.onEvaluatorException
public void onEvaluatorException(final EvaluatorException exception) { synchronized (this.evaluatorDescriptor) { if (this.stateManager.isCompleted()) { LOG.log(Level.FINE, "Ignoring an exception received for Evaluator {0} which is already in state {1}.", new Object[] {this.getId(), this.stateManager}); return; } LOG.log(Level.WARNING, "Failed evaluator: " + getId(), exception); try { final List<FailedContext> failedContextList = this.contextRepresenters.getFailedContextsForEvaluatorFailure(); final Optional<FailedTask> failedTaskOptional; if (this.task.isPresent()) { final String taskId = this.task.get().getId(); final Optional<ActiveContext> evaluatorContext = Optional.empty(); final Optional<byte[]> bytes = Optional.empty(); final Optional<Throwable> taskException = Optional.<Throwable>of(new Exception("Evaluator crash")); final String message = "Evaluator crash"; final Optional<String> description = Optional.empty(); final FailedTask failedTask = new FailedTask(taskId, message, description, taskException, bytes, evaluatorContext); failedTaskOptional = Optional.of(failedTask); } else { failedTaskOptional = Optional.empty(); } final FailedEvaluator failedEvaluator = new FailedEvaluatorImpl( exception, failedContextList, failedTaskOptional, this.evaluatorId); if (driverRestartManager.getEvaluatorRestartState(evaluatorId).isFailedOrExpired()) { this.messageDispatcher.onDriverRestartEvaluatorFailed(failedEvaluator); } else { this.messageDispatcher.onEvaluatorFailed(failedEvaluator); } } catch (final Exception e) { LOG.log(Level.SEVERE, "Exception while handling FailedEvaluator", e); } finally { this.stateManager.setFailed(); this.close(); } } }
java
public void onEvaluatorException(final EvaluatorException exception) { synchronized (this.evaluatorDescriptor) { if (this.stateManager.isCompleted()) { LOG.log(Level.FINE, "Ignoring an exception received for Evaluator {0} which is already in state {1}.", new Object[] {this.getId(), this.stateManager}); return; } LOG.log(Level.WARNING, "Failed evaluator: " + getId(), exception); try { final List<FailedContext> failedContextList = this.contextRepresenters.getFailedContextsForEvaluatorFailure(); final Optional<FailedTask> failedTaskOptional; if (this.task.isPresent()) { final String taskId = this.task.get().getId(); final Optional<ActiveContext> evaluatorContext = Optional.empty(); final Optional<byte[]> bytes = Optional.empty(); final Optional<Throwable> taskException = Optional.<Throwable>of(new Exception("Evaluator crash")); final String message = "Evaluator crash"; final Optional<String> description = Optional.empty(); final FailedTask failedTask = new FailedTask(taskId, message, description, taskException, bytes, evaluatorContext); failedTaskOptional = Optional.of(failedTask); } else { failedTaskOptional = Optional.empty(); } final FailedEvaluator failedEvaluator = new FailedEvaluatorImpl( exception, failedContextList, failedTaskOptional, this.evaluatorId); if (driverRestartManager.getEvaluatorRestartState(evaluatorId).isFailedOrExpired()) { this.messageDispatcher.onDriverRestartEvaluatorFailed(failedEvaluator); } else { this.messageDispatcher.onEvaluatorFailed(failedEvaluator); } } catch (final Exception e) { LOG.log(Level.SEVERE, "Exception while handling FailedEvaluator", e); } finally { this.stateManager.setFailed(); this.close(); } } }
[ "public", "void", "onEvaluatorException", "(", "final", "EvaluatorException", "exception", ")", "{", "synchronized", "(", "this", ".", "evaluatorDescriptor", ")", "{", "if", "(", "this", ".", "stateManager", ".", "isCompleted", "(", ")", ")", "{", "LOG", ".", ...
EvaluatorException will trigger is FailedEvaluator and state transition to FAILED. @param exception on the EvaluatorRuntime
[ "EvaluatorException", "will", "trigger", "is", "FailedEvaluator", "and", "state", "transition", "to", "FAILED", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/evaluator/EvaluatorManager.java#L334-L383
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageHeader.java
BaseMessageHeader.createMessageHeader
public static BaseMessageHeader createMessageHeader(String strMessageHeaderClassName, String strQueueName, String strQueueType, Object source, Map<String,Object> properties) { BaseMessageHeader messageHeader = (BaseMessageHeader)ClassServiceUtility.getClassService().makeObjectFromClassName(strMessageHeaderClassName); if (messageHeader != null) messageHeader.init(strQueueName, strQueueType, source, properties); return messageHeader; }
java
public static BaseMessageHeader createMessageHeader(String strMessageHeaderClassName, String strQueueName, String strQueueType, Object source, Map<String,Object> properties) { BaseMessageHeader messageHeader = (BaseMessageHeader)ClassServiceUtility.getClassService().makeObjectFromClassName(strMessageHeaderClassName); if (messageHeader != null) messageHeader.init(strQueueName, strQueueType, source, properties); return messageHeader; }
[ "public", "static", "BaseMessageHeader", "createMessageHeader", "(", "String", "strMessageHeaderClassName", ",", "String", "strQueueName", ",", "String", "strQueueType", ",", "Object", "source", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", ...
Setup this message given this internal data structure. @param data The data in an intermediate format.
[ "Setup", "this", "message", "given", "this", "internal", "data", "structure", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageHeader.java#L361-L367
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java
SecurityDomainJBossASClient.securityDomainHasLoginModule
public boolean securityDomainHasLoginModule(String domainName, String moduleName) throws Exception { Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, domainName); addr.add(AUTHENTICATION, CLASSIC); addr.add(LOGIN_MODULE, moduleName); ModelNode request = createRequest("read-resource", addr); ModelNode response = execute(request); return isSuccess(response); }
java
public boolean securityDomainHasLoginModule(String domainName, String moduleName) throws Exception { Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, domainName); addr.add(AUTHENTICATION, CLASSIC); addr.add(LOGIN_MODULE, moduleName); ModelNode request = createRequest("read-resource", addr); ModelNode response = execute(request); return isSuccess(response); }
[ "public", "boolean", "securityDomainHasLoginModule", "(", "String", "domainName", ",", "String", "moduleName", ")", "throws", "Exception", "{", "Address", "addr", "=", "Address", ".", "root", "(", ")", ".", "add", "(", "SUBSYSTEM", ",", "SUBSYSTEM_SECURITY", ","...
Check if a certain login module is present inside the passed security domain @param domainName Name of the security domain @param moduleName Name of the Login module - wich usually is it FQCN @return True if the module is present @throws Exception any error
[ "Check", "if", "a", "certain", "login", "module", "is", "present", "inside", "the", "passed", "security", "domain" ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SecurityDomainJBossASClient.java#L406-L413
sarl/sarl
main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/MavenImportUtils.java
MavenImportUtils.forceSimplePom
static void forceSimplePom(File projectDir, IProgressMonitor monitor) throws IOException { final File pomFile = new File(projectDir, POM_FILE); if (pomFile.exists()) { final SubMonitor submon = SubMonitor.convert(monitor, 4); final File savedPomFile = new File(projectDir, POM_BACKUP_FILE); if (savedPomFile.exists()) { savedPomFile.delete(); } submon.worked(1); Files.copy(pomFile, savedPomFile); submon.worked(1); final StringBuilder content = new StringBuilder(); try (BufferedReader stream = new BufferedReader(new FileReader(pomFile))) { String line = stream.readLine(); while (line != null) { line = line.replaceAll("<extensions>\\s*true\\s*</extensions>", ""); //$NON-NLS-1$ //$NON-NLS-2$ content.append(line).append("\n"); //$NON-NLS-1$ line = stream.readLine(); } } submon.worked(1); Files.write(content.toString().getBytes(), pomFile); submon.worked(1); } }
java
static void forceSimplePom(File projectDir, IProgressMonitor monitor) throws IOException { final File pomFile = new File(projectDir, POM_FILE); if (pomFile.exists()) { final SubMonitor submon = SubMonitor.convert(monitor, 4); final File savedPomFile = new File(projectDir, POM_BACKUP_FILE); if (savedPomFile.exists()) { savedPomFile.delete(); } submon.worked(1); Files.copy(pomFile, savedPomFile); submon.worked(1); final StringBuilder content = new StringBuilder(); try (BufferedReader stream = new BufferedReader(new FileReader(pomFile))) { String line = stream.readLine(); while (line != null) { line = line.replaceAll("<extensions>\\s*true\\s*</extensions>", ""); //$NON-NLS-1$ //$NON-NLS-2$ content.append(line).append("\n"); //$NON-NLS-1$ line = stream.readLine(); } } submon.worked(1); Files.write(content.toString().getBytes(), pomFile); submon.worked(1); } }
[ "static", "void", "forceSimplePom", "(", "File", "projectDir", ",", "IProgressMonitor", "monitor", ")", "throws", "IOException", "{", "final", "File", "pomFile", "=", "new", "File", "(", "projectDir", ",", "POM_FILE", ")", ";", "if", "(", "pomFile", ".", "ex...
Force the pom file of a project to be "simple". @param projectDir the folder in which the pom file is located. @param monitor the progress monitor. @throws IOException if the pom file cannot be changed.
[ "Force", "the", "pom", "file", "of", "a", "project", "to", "be", "simple", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/MavenImportUtils.java#L186-L210
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/MpscGrowableArrayQueue.java
BaseMpscLinkedArrayQueue.offerSlowPath
private int offerSlowPath(long mask, long pIndex, long producerLimit) { int result; final long cIndex = lvConsumerIndex(); long bufferCapacity = getCurrentBufferCapacity(mask); result = 0;// 0 - goto pIndex CAS if (cIndex + bufferCapacity > pIndex) { if (!casProducerLimit(producerLimit, cIndex + bufferCapacity)) { result = 1;// retry from top } } // full and cannot grow else if (availableInQueue(pIndex, cIndex) <= 0) { result = 2;// -> return false; } // grab index for resize -> set lower bit else if (casProducerIndex(pIndex, pIndex + 1)) { result = 3;// -> resize } else { result = 1;// failed resize attempt, retry from top } return result; }
java
private int offerSlowPath(long mask, long pIndex, long producerLimit) { int result; final long cIndex = lvConsumerIndex(); long bufferCapacity = getCurrentBufferCapacity(mask); result = 0;// 0 - goto pIndex CAS if (cIndex + bufferCapacity > pIndex) { if (!casProducerLimit(producerLimit, cIndex + bufferCapacity)) { result = 1;// retry from top } } // full and cannot grow else if (availableInQueue(pIndex, cIndex) <= 0) { result = 2;// -> return false; } // grab index for resize -> set lower bit else if (casProducerIndex(pIndex, pIndex + 1)) { result = 3;// -> resize } else { result = 1;// failed resize attempt, retry from top } return result; }
[ "private", "int", "offerSlowPath", "(", "long", "mask", ",", "long", "pIndex", ",", "long", "producerLimit", ")", "{", "int", "result", ";", "final", "long", "cIndex", "=", "lvConsumerIndex", "(", ")", ";", "long", "bufferCapacity", "=", "getCurrentBufferCapac...
We do not inline resize into this method because we do not resize on fill.
[ "We", "do", "not", "inline", "resize", "into", "this", "method", "because", "we", "do", "not", "resize", "on", "fill", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/MpscGrowableArrayQueue.java#L268-L289
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CostRateTableFactory.java
CostRateTableFactory.process
public void process(Resource resource, int index, byte[] data) { CostRateTable result = new CostRateTable(); if (data != null) { for (int i = 16; i + 44 <= data.length; i += 44) { Rate standardRate = new Rate(MPPUtility.getDouble(data, i), TimeUnit.HOURS); TimeUnit standardRateFormat = getFormat(MPPUtility.getShort(data, i + 8)); Rate overtimeRate = new Rate(MPPUtility.getDouble(data, i + 16), TimeUnit.HOURS); TimeUnit overtimeRateFormat = getFormat(MPPUtility.getShort(data, i + 24)); Double costPerUse = NumberHelper.getDouble(MPPUtility.getDouble(data, i + 32) / 100.0); Date endDate = MPPUtility.getTimestampFromTenths(data, i + 40); CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate); result.add(entry); } Collections.sort(result); } else { // // MS Project economises by not actually storing the first cost rate // table if it doesn't need to, so we take this into account here. // if (index == 0) { Rate standardRate = resource.getStandardRate(); Rate overtimeRate = resource.getOvertimeRate(); Number costPerUse = resource.getCostPerUse(); CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRate.getUnits(), overtimeRate, overtimeRate.getUnits(), costPerUse, CostRateTableEntry.DEFAULT_ENTRY.getEndDate()); result.add(entry); } else { result.add(CostRateTableEntry.DEFAULT_ENTRY); } } resource.setCostRateTable(index, result); }
java
public void process(Resource resource, int index, byte[] data) { CostRateTable result = new CostRateTable(); if (data != null) { for (int i = 16; i + 44 <= data.length; i += 44) { Rate standardRate = new Rate(MPPUtility.getDouble(data, i), TimeUnit.HOURS); TimeUnit standardRateFormat = getFormat(MPPUtility.getShort(data, i + 8)); Rate overtimeRate = new Rate(MPPUtility.getDouble(data, i + 16), TimeUnit.HOURS); TimeUnit overtimeRateFormat = getFormat(MPPUtility.getShort(data, i + 24)); Double costPerUse = NumberHelper.getDouble(MPPUtility.getDouble(data, i + 32) / 100.0); Date endDate = MPPUtility.getTimestampFromTenths(data, i + 40); CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate); result.add(entry); } Collections.sort(result); } else { // // MS Project economises by not actually storing the first cost rate // table if it doesn't need to, so we take this into account here. // if (index == 0) { Rate standardRate = resource.getStandardRate(); Rate overtimeRate = resource.getOvertimeRate(); Number costPerUse = resource.getCostPerUse(); CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRate.getUnits(), overtimeRate, overtimeRate.getUnits(), costPerUse, CostRateTableEntry.DEFAULT_ENTRY.getEndDate()); result.add(entry); } else { result.add(CostRateTableEntry.DEFAULT_ENTRY); } } resource.setCostRateTable(index, result); }
[ "public", "void", "process", "(", "Resource", "resource", ",", "int", "index", ",", "byte", "[", "]", "data", ")", "{", "CostRateTable", "result", "=", "new", "CostRateTable", "(", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "for", "(", "int...
Creates a CostRateTable instance from a block of data. @param resource parent resource @param index cost rate table index @param data data block
[ "Creates", "a", "CostRateTable", "instance", "from", "a", "block", "of", "data", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CostRateTableFactory.java#L48-L88
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/AccountsInner.java
AccountsInner.createAsync
public Observable<DataLakeStoreAccountInner> createAsync(String resourceGroupName, String accountName, CreateDataLakeStoreAccountParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<DataLakeStoreAccountInner>, DataLakeStoreAccountInner>() { @Override public DataLakeStoreAccountInner call(ServiceResponse<DataLakeStoreAccountInner> response) { return response.body(); } }); }
java
public Observable<DataLakeStoreAccountInner> createAsync(String resourceGroupName, String accountName, CreateDataLakeStoreAccountParameters parameters) { return createWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<DataLakeStoreAccountInner>, DataLakeStoreAccountInner>() { @Override public DataLakeStoreAccountInner call(ServiceResponse<DataLakeStoreAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataLakeStoreAccountInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "CreateDataLakeStoreAccountParameters", "parameters", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroup...
Creates the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Store account. @param parameters Parameters supplied to create the Data Lake Store account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "the", "specified", "Data", "Lake", "Store", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/AccountsInner.java#L666-L673
wisdom-framework/wisdom
extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java
CSRFServiceImpl.compareTokens
@Override public boolean compareTokens(String a, String b) { if (isSignedToken()) { return crypto.compareSignedTokens(a, b); } else { return crypto.constantTimeEquals(a, b); } }
java
@Override public boolean compareTokens(String a, String b) { if (isSignedToken()) { return crypto.compareSignedTokens(a, b); } else { return crypto.constantTimeEquals(a, b); } }
[ "@", "Override", "public", "boolean", "compareTokens", "(", "String", "a", ",", "String", "b", ")", "{", "if", "(", "isSignedToken", "(", ")", ")", "{", "return", "crypto", ".", "compareSignedTokens", "(", "a", ",", "b", ")", ";", "}", "else", "{", "...
Compares to token. @param a the first token @param b the second token @return {@code true} if the token are equal, {@code false} otherwise
[ "Compares", "to", "token", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java#L218-L225
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/schema/SchemaService.java
SchemaService.getApplication
public ApplicationDefinition getApplication(String appName) { checkServiceState(); Tenant tenant = TenantService.instance().getDefaultTenant(); return getApplicationDefinition(tenant, appName); }
java
public ApplicationDefinition getApplication(String appName) { checkServiceState(); Tenant tenant = TenantService.instance().getDefaultTenant(); return getApplicationDefinition(tenant, appName); }
[ "public", "ApplicationDefinition", "getApplication", "(", "String", "appName", ")", "{", "checkServiceState", "(", ")", ";", "Tenant", "tenant", "=", "TenantService", ".", "instance", "(", ")", ".", "getDefaultTenant", "(", ")", ";", "return", "getApplicationDefin...
Return the {@link ApplicationDefinition} for the application in the default tenant. Null is returned if no application is found with the given name in the default tenant. @return The {@link ApplicationDefinition} for the given application or null if no no application such application is defined in the default tenant. @deprecated This method only works for the default tenant. Use {@link #getApplication(Tenant, String)} instead.
[ "Return", "the", "{", "@link", "ApplicationDefinition", "}", "for", "the", "application", "in", "the", "default", "tenant", ".", "Null", "is", "returned", "if", "no", "application", "is", "found", "with", "the", "given", "name", "in", "the", "default", "tena...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/schema/SchemaService.java#L165-L169
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java
FileUtils.loadMap
public static <K, V> ImmutableMap<K, V> loadMap(final File file, final Function<String, K> keyFunction, final Function<String, V> valueFunction) throws IOException { return loadMap(Files.asCharSource(file, Charsets.UTF_8), keyFunction, valueFunction); }
java
public static <K, V> ImmutableMap<K, V> loadMap(final File file, final Function<String, K> keyFunction, final Function<String, V> valueFunction) throws IOException { return loadMap(Files.asCharSource(file, Charsets.UTF_8), keyFunction, valueFunction); }
[ "public", "static", "<", "K", ",", "V", ">", "ImmutableMap", "<", "K", ",", "V", ">", "loadMap", "(", "final", "File", "file", ",", "final", "Function", "<", "String", ",", "K", ">", "keyFunction", ",", "final", "Function", "<", "String", ",", "V", ...
Reads an {@link ImmutableMap} from a {@link File}, where each line is a key, a tab character ("\t"), and a value. Blank lines and lines beginning with "#" are ignored.
[ "Reads", "an", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L329-L333
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java
AbstractParser.elementAsBoolean
protected Boolean elementAsBoolean(XMLStreamReader reader, String key, Map<String, String> expressions) throws XMLStreamException, ParserException { String elementtext = rawElementText(reader); if (key != null && expressions != null && elementtext != null && elementtext.indexOf("${") != -1) expressions.put(key, elementtext); String stringValue = getSubstitutionValue(elementtext); if (StringUtils.isEmpty(stringValue) || stringValue.trim().equalsIgnoreCase("true") || stringValue.trim().equalsIgnoreCase("false")) { return StringUtils.isEmpty(stringValue) ? Boolean.TRUE : Boolean.valueOf(stringValue.trim()); } else { throw new ParserException(bundle.elementAsBoolean(elementtext, reader.getLocalName())); } }
java
protected Boolean elementAsBoolean(XMLStreamReader reader, String key, Map<String, String> expressions) throws XMLStreamException, ParserException { String elementtext = rawElementText(reader); if (key != null && expressions != null && elementtext != null && elementtext.indexOf("${") != -1) expressions.put(key, elementtext); String stringValue = getSubstitutionValue(elementtext); if (StringUtils.isEmpty(stringValue) || stringValue.trim().equalsIgnoreCase("true") || stringValue.trim().equalsIgnoreCase("false")) { return StringUtils.isEmpty(stringValue) ? Boolean.TRUE : Boolean.valueOf(stringValue.trim()); } else { throw new ParserException(bundle.elementAsBoolean(elementtext, reader.getLocalName())); } }
[ "protected", "Boolean", "elementAsBoolean", "(", "XMLStreamReader", "reader", ",", "String", "key", ",", "Map", "<", "String", ",", "String", ">", "expressions", ")", "throws", "XMLStreamException", ",", "ParserException", "{", "String", "elementtext", "=", "rawEl...
convert an xml element in boolean value. Empty elements results with true (tag presence is sufficient condition) @param reader the StAX reader @param key The key @param expressions The expressions @return the boolean representing element @throws XMLStreamException StAX exception @throws ParserException in case of non valid boolean for given element value
[ "convert", "an", "xml", "element", "in", "boolean", "value", ".", "Empty", "elements", "results", "with", "true", "(", "tag", "presence", "is", "sufficient", "condition", ")" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java#L97-L115
restfb/restfb
src/main/java/com/restfb/util/DateUtils.java
DateUtils.toDateWithFormatString
private static Date toDateWithFormatString(String date, String format) { if (date == null) { return null; } try { return strategy.formatFor(format).parse(date); } catch (ParseException e) { UTILS_LOGGER.trace("Unable to parse date '{}' using format string '{}': {}", date, format, e); return null; } }
java
private static Date toDateWithFormatString(String date, String format) { if (date == null) { return null; } try { return strategy.formatFor(format).parse(date); } catch (ParseException e) { UTILS_LOGGER.trace("Unable to parse date '{}' using format string '{}': {}", date, format, e); return null; } }
[ "private", "static", "Date", "toDateWithFormatString", "(", "String", "date", ",", "String", "format", ")", "{", "if", "(", "date", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "return", "strategy", ".", "formatFor", "(", "format", ")"...
Returns a Java representation of a {@code date} string. @param date Date in string format. @return Java date representation of the given {@code date} string or {@code null} if {@code date} is {@code null} or invalid.
[ "Returns", "a", "Java", "representation", "of", "a", "{", "@code", "date", "}", "string", "." ]
train
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/DateUtils.java#L181-L193
google/closure-compiler
src/com/google/javascript/jscomp/TypeValidator.java
TypeValidator.expectAutoboxesToIterable
boolean expectAutoboxesToIterable(Node n, JSType type, String msg) { // Note: we don't just use JSType.autobox() here because that removes null and undefined. // We want to keep null and undefined around. if (type.isUnionType()) { for (JSType alt : type.toMaybeUnionType().getAlternates()) { alt = alt.isBoxableScalar() ? alt.autoboxesTo() : alt; if (!alt.isSubtypeOf(getNativeType(ITERABLE_TYPE))) { mismatch(n, msg, type, ITERABLE_TYPE); return false; } } } else { JSType autoboxedType = type.isBoxableScalar() ? type.autoboxesTo() : type; if (!autoboxedType.isSubtypeOf(getNativeType(ITERABLE_TYPE))) { mismatch(n, msg, type, ITERABLE_TYPE); return false; } } return true; }
java
boolean expectAutoboxesToIterable(Node n, JSType type, String msg) { // Note: we don't just use JSType.autobox() here because that removes null and undefined. // We want to keep null and undefined around. if (type.isUnionType()) { for (JSType alt : type.toMaybeUnionType().getAlternates()) { alt = alt.isBoxableScalar() ? alt.autoboxesTo() : alt; if (!alt.isSubtypeOf(getNativeType(ITERABLE_TYPE))) { mismatch(n, msg, type, ITERABLE_TYPE); return false; } } } else { JSType autoboxedType = type.isBoxableScalar() ? type.autoboxesTo() : type; if (!autoboxedType.isSubtypeOf(getNativeType(ITERABLE_TYPE))) { mismatch(n, msg, type, ITERABLE_TYPE); return false; } } return true; }
[ "boolean", "expectAutoboxesToIterable", "(", "Node", "n", ",", "JSType", "type", ",", "String", "msg", ")", "{", "// Note: we don't just use JSType.autobox() here because that removes null and undefined.", "// We want to keep null and undefined around.", "if", "(", "type", ".", ...
Expect the type to autobox to be an Iterable. @return True if there was no warning, false if there was a mismatch.
[ "Expect", "the", "type", "to", "autobox", "to", "be", "an", "Iterable", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L282-L302
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.startAt
@Nonnull public Query startAt(@Nonnull DocumentSnapshot snapshot) { QueryOptions newOptions = new QueryOptions(options); newOptions.fieldOrders = createImplicitOrderBy(); newOptions.startCursor = createCursor(newOptions.fieldOrders, snapshot, true); return new Query(firestore, path, newOptions); }
java
@Nonnull public Query startAt(@Nonnull DocumentSnapshot snapshot) { QueryOptions newOptions = new QueryOptions(options); newOptions.fieldOrders = createImplicitOrderBy(); newOptions.startCursor = createCursor(newOptions.fieldOrders, snapshot, true); return new Query(firestore, path, newOptions); }
[ "@", "Nonnull", "public", "Query", "startAt", "(", "@", "Nonnull", "DocumentSnapshot", "snapshot", ")", "{", "QueryOptions", "newOptions", "=", "new", "QueryOptions", "(", "options", ")", ";", "newOptions", ".", "fieldOrders", "=", "createImplicitOrderBy", "(", ...
Creates and returns a new Query that starts at the provided document (inclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of this query. @param snapshot The snapshot of the document to start at. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "that", "starts", "at", "the", "provided", "document", "(", "inclusive", ")", ".", "The", "starting", "position", "is", "relative", "to", "the", "order", "of", "the", "query", ".", "The", "document", "must"...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L706-L712
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/resolution/UnresolvedBindingValidator.java
UnresolvedBindingValidator.validate
public boolean validate(DependencyExplorerOutput output, InvalidKeys invalidKeys) { Collection<Map.Entry<Key<?>, String>> invalidRequiredKeys = invalidKeys.getInvalidRequiredKeys(); for (Map.Entry<Key<?>, String> error : invalidRequiredKeys) { reportError(output, error.getKey(), error.getValue()); } return !cycleFinder.findAndReportCycles(output.getGraph()) && invalidRequiredKeys.isEmpty(); }
java
public boolean validate(DependencyExplorerOutput output, InvalidKeys invalidKeys) { Collection<Map.Entry<Key<?>, String>> invalidRequiredKeys = invalidKeys.getInvalidRequiredKeys(); for (Map.Entry<Key<?>, String> error : invalidRequiredKeys) { reportError(output, error.getKey(), error.getValue()); } return !cycleFinder.findAndReportCycles(output.getGraph()) && invalidRequiredKeys.isEmpty(); }
[ "public", "boolean", "validate", "(", "DependencyExplorerOutput", "output", ",", "InvalidKeys", "invalidKeys", ")", "{", "Collection", "<", "Map", ".", "Entry", "<", "Key", "<", "?", ">", ",", "String", ">", ">", "invalidRequiredKeys", "=", "invalidKeys", ".",...
Returns true if the graph is valid (does not have any cycles or problems creating required keys). If there are any errors, they will be reported to the global {@link ErrorManager}.
[ "Returns", "true", "if", "the", "graph", "is", "valid", "(", "does", "not", "have", "any", "cycles", "or", "problems", "creating", "required", "keys", ")", ".", "If", "there", "are", "any", "errors", "they", "will", "be", "reported", "to", "the", "global...
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/resolution/UnresolvedBindingValidator.java#L96-L104
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/dump/MetricQueryService.java
MetricQueryService.replaceInvalidChars
private static String replaceInvalidChars(String str) { char[] chars = null; final int strLen = str.length(); int pos = 0; for (int i = 0; i < strLen; i++) { final char c = str.charAt(i); switch (c) { case ' ': case '.': case ':': case ',': if (chars == null) { chars = str.toCharArray(); } chars[pos++] = '_'; break; default: if (chars != null) { chars[pos] = c; } pos++; } } return chars == null ? str : new String(chars, 0, pos); }
java
private static String replaceInvalidChars(String str) { char[] chars = null; final int strLen = str.length(); int pos = 0; for (int i = 0; i < strLen; i++) { final char c = str.charAt(i); switch (c) { case ' ': case '.': case ':': case ',': if (chars == null) { chars = str.toCharArray(); } chars[pos++] = '_'; break; default: if (chars != null) { chars[pos] = c; } pos++; } } return chars == null ? str : new String(chars, 0, pos); }
[ "private", "static", "String", "replaceInvalidChars", "(", "String", "str", ")", "{", "char", "[", "]", "chars", "=", "null", ";", "final", "int", "strLen", "=", "str", ".", "length", "(", ")", ";", "int", "pos", "=", "0", ";", "for", "(", "int", "...
Lightweight method to replace unsupported characters. If the string does not contain any unsupported characters, this method creates no new string (and in fact no new objects at all). <p>Replacements: <ul> <li>{@code space : . ,} are replaced by {@code _} (underscore)</li> </ul>
[ "Lightweight", "method", "to", "replace", "unsupported", "characters", ".", "If", "the", "string", "does", "not", "contain", "any", "unsupported", "characters", "this", "method", "creates", "no", "new", "string", "(", "and", "in", "fact", "no", "new", "objects...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/dump/MetricQueryService.java#L208-L234
Azure/azure-sdk-for-java
redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java
RedisInner.importDataAsync
public Observable<Void> importDataAsync(String resourceGroupName, String name, ImportRDBParameters parameters) { return importDataWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> importDataAsync(String resourceGroupName, String name, ImportRDBParameters parameters) { return importDataWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "importDataAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "ImportRDBParameters", "parameters", ")", "{", "return", "importDataWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "par...
Import data into Redis cache. @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param parameters Parameters for Redis import operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Import", "data", "into", "Redis", "cache", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L1364-L1371
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java
NetworkInterfacesInner.getByResourceGroupAsync
public Observable<NetworkInterfaceInner> getByResourceGroupAsync(String resourceGroupName, String networkInterfaceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkInterfaceName).map(new Func1<ServiceResponse<NetworkInterfaceInner>, NetworkInterfaceInner>() { @Override public NetworkInterfaceInner call(ServiceResponse<NetworkInterfaceInner> response) { return response.body(); } }); }
java
public Observable<NetworkInterfaceInner> getByResourceGroupAsync(String resourceGroupName, String networkInterfaceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkInterfaceName).map(new Func1<ServiceResponse<NetworkInterfaceInner>, NetworkInterfaceInner>() { @Override public NetworkInterfaceInner call(ServiceResponse<NetworkInterfaceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NetworkInterfaceInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "networkInterfaceName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkInterfaceNam...
Gets information about the specified network interface. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the NetworkInterfaceInner object
[ "Gets", "information", "about", "the", "specified", "network", "interface", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L351-L358
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java
Invariants.checkInvariantL
public static long checkInvariantL( final long value, final LongPredicate predicate, final LongFunction<String> describer) { final boolean ok; try { ok = predicate.test(value); } catch (final Throwable e) { final Violations violations = singleViolation(failedPredicate(e)); throw new InvariantViolationException( failedMessage(Long.valueOf(value), violations), e, violations.count()); } return innerCheckInvariantL(value, ok, describer); }
java
public static long checkInvariantL( final long value, final LongPredicate predicate, final LongFunction<String> describer) { final boolean ok; try { ok = predicate.test(value); } catch (final Throwable e) { final Violations violations = singleViolation(failedPredicate(e)); throw new InvariantViolationException( failedMessage(Long.valueOf(value), violations), e, violations.count()); } return innerCheckInvariantL(value, ok, describer); }
[ "public", "static", "long", "checkInvariantL", "(", "final", "long", "value", ",", "final", "LongPredicate", "predicate", ",", "final", "LongFunction", "<", "String", ">", "describer", ")", "{", "final", "boolean", "ok", ";", "try", "{", "ok", "=", "predicat...
A {@code long} specialized version of {@link #checkInvariant(Object, Predicate, Function)} @param value The value @param predicate The predicate @param describer The describer of the predicate @return value @throws InvariantViolationException If the predicate is false
[ "A", "{", "@code", "long", "}", "specialized", "version", "of", "{", "@link", "#checkInvariant", "(", "Object", "Predicate", "Function", ")", "}" ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java#L450-L465
google/identity-toolkit-java-client
src/main/java/com/google/identitytoolkit/RpcHelper.java
RpcHelper.getAccountInfo
public JSONObject getAccountInfo(String idToken) throws GitkitClientException, GitkitServerException { try { // Uses idToken to make the server call to GITKit JSONObject params = new JSONObject().put("idToken", idToken); return invokeGoogle2LegOauthApi("getAccountInfo", params); } catch (JSONException e) { throw new GitkitServerException("OAuth API failed"); } }
java
public JSONObject getAccountInfo(String idToken) throws GitkitClientException, GitkitServerException { try { // Uses idToken to make the server call to GITKit JSONObject params = new JSONObject().put("idToken", idToken); return invokeGoogle2LegOauthApi("getAccountInfo", params); } catch (JSONException e) { throw new GitkitServerException("OAuth API failed"); } }
[ "public", "JSONObject", "getAccountInfo", "(", "String", "idToken", ")", "throws", "GitkitClientException", ",", "GitkitServerException", "{", "try", "{", "// Uses idToken to make the server call to GITKit", "JSONObject", "params", "=", "new", "JSONObject", "(", ")", ".",...
Uses idToken to retrieve the user account information from GITkit service. @param idToken
[ "Uses", "idToken", "to", "retrieve", "the", "user", "account", "information", "from", "GITkit", "service", "." ]
train
https://github.com/google/identity-toolkit-java-client/blob/61dda1aabbd541ad5e431e840fd266bfca5f8a4a/src/main/java/com/google/identitytoolkit/RpcHelper.java#L129-L138
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java
MarkLogicRepositoryConnection.prepareQuery
@Override public Query prepareQuery(String queryString, String baseURI) throws RepositoryException, MalformedQueryException { return prepareQuery(QueryLanguage.SPARQL, queryString, baseURI); }
java
@Override public Query prepareQuery(String queryString, String baseURI) throws RepositoryException, MalformedQueryException { return prepareQuery(QueryLanguage.SPARQL, queryString, baseURI); }
[ "@", "Override", "public", "Query", "prepareQuery", "(", "String", "queryString", ",", "String", "baseURI", ")", "throws", "RepositoryException", ",", "MalformedQueryException", "{", "return", "prepareQuery", "(", "QueryLanguage", ".", "SPARQL", ",", "queryString", ...
overload for prepareQuery @param queryString @param baseURI @return MarkLogicQuery @throws RepositoryException @throws MalformedQueryException
[ "overload", "for", "prepareQuery" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L164-L167
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java
EnglishEnums.valueOf
public static <T extends Enum<T>> T valueOf(final Class<T> enumType, final String name) { return valueOf(enumType, name, null); }
java
public static <T extends Enum<T>> T valueOf(final Class<T> enumType, final String name) { return valueOf(enumType, name, null); }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "valueOf", "(", "final", "Class", "<", "T", ">", "enumType", ",", "final", "String", "name", ")", "{", "return", "valueOf", "(", "enumType", ",", "name", ",", "null", ")", ";...
Returns the Result for the given string. <p> The {@code name} is converted internally to upper case with the {@linkplain Locale#ENGLISH ENGLISH} locale to avoid problems on the Turkish locale. Do not use with Turkish enum values. </p> @param enumType The Class of the enum. @param name The enum name, case-insensitive. If null, returns {@code defaultValue}. @param <T> The type of the enum. @return an enum value or null if {@code name} is null.
[ "Returns", "the", "Result", "for", "the", "given", "string", ".", "<p", ">", "The", "{", "@code", "name", "}", "is", "converted", "internally", "to", "upper", "case", "with", "the", "{", "@linkplain", "Locale#ENGLISH", "ENGLISH", "}", "locale", "to", "avoi...
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/EnglishEnums.java#L49-L51
getsentry/sentry-java
sentry/src/main/java/io/sentry/connection/AsyncConnection.java
AsyncConnection.send
@Override public void send(Event event) { if (!closed) { executorService.execute(new EventSubmitter(event, MDC.getCopyOfContextMap())); } }
java
@Override public void send(Event event) { if (!closed) { executorService.execute(new EventSubmitter(event, MDC.getCopyOfContextMap())); } }
[ "@", "Override", "public", "void", "send", "(", "Event", "event", ")", "{", "if", "(", "!", "closed", ")", "{", "executorService", ".", "execute", "(", "new", "EventSubmitter", "(", "event", ",", "MDC", ".", "getCopyOfContextMap", "(", ")", ")", ")", "...
{@inheritDoc} <p> The event will be added to a queue and will be handled by a separate {@code Thread} later on.
[ "{" ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/connection/AsyncConnection.java#L93-L98
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
NodeIndexer.addNameValue
protected void addNameValue(Document doc, String fieldName, Object internalValue) { doc.add(createFieldWithoutNorms(fieldName, internalValue.toString(), PropertyType.NAME)); }
java
protected void addNameValue(Document doc, String fieldName, Object internalValue) { doc.add(createFieldWithoutNorms(fieldName, internalValue.toString(), PropertyType.NAME)); }
[ "protected", "void", "addNameValue", "(", "Document", "doc", ",", "String", "fieldName", ",", "Object", "internalValue", ")", "{", "doc", ".", "add", "(", "createFieldWithoutNorms", "(", "fieldName", ",", "internalValue", ".", "toString", "(", ")", ",", "Prope...
Adds the name value to the document as the named field. The name value is converted to an indexable string treating the internal value as a qualified name and mapping the name space using the name space mappings with which this class has been created. @param doc The document to which to add the field @param fieldName The name of the field to add @param internalValue The value for the field to add to the document.
[ "Adds", "the", "name", "value", "to", "the", "document", "as", "the", "named", "field", ".", "The", "name", "value", "is", "converted", "to", "an", "indexable", "string", "treating", "the", "internal", "value", "as", "a", "qualified", "name", "and", "mappi...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L894-L897
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arrays/IntegerArrayQuickSort.java
IntegerArrayQuickSort.insertionSort
private static void insertionSort(int[] data, final int start, final int end, IntComparator comp) { // Classic insertion sort. for(int i = start + 1; i < end; i++) { final int cur = data[i]; int j = i - 1; while(j >= start) { final int pre = data[j]; if(comp.compare(cur, pre) >= 0) { break; } data[j + 1] = pre; --j; } data[j + 1] = cur; } }
java
private static void insertionSort(int[] data, final int start, final int end, IntComparator comp) { // Classic insertion sort. for(int i = start + 1; i < end; i++) { final int cur = data[i]; int j = i - 1; while(j >= start) { final int pre = data[j]; if(comp.compare(cur, pre) >= 0) { break; } data[j + 1] = pre; --j; } data[j + 1] = cur; } }
[ "private", "static", "void", "insertionSort", "(", "int", "[", "]", "data", ",", "final", "int", "start", ",", "final", "int", "end", ",", "IntComparator", "comp", ")", "{", "// Classic insertion sort.", "for", "(", "int", "i", "=", "start", "+", "1", ";...
Insertion sort, for short arrays. @param data Data to sort @param start First index @param end Last index (exclusive!) @param comp Comparator
[ "Insertion", "sort", "for", "short", "arrays", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arrays/IntegerArrayQuickSort.java#L193-L208
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/XPathHelper.java
XPathHelper.peekDom
public Object peekDom(org.w3c.dom.Document doc, String xpathExpr) throws Exception { XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); xpath.setNamespaceContext(new UniversalNamespaceCache(doc, false)); XPathExpression expr = xpath.compile(xpathExpr); NodeList nodeList = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); if (nodeList == null || nodeList.getLength() == 0) { return null; } else if (nodeList.getLength() == 1) { Node node = nodeList.item(0); if (node instanceof Attr) return ((Attr) node).getValue(); else return node.getChildNodes().item(0).getNodeValue(); } else { List<XPathHelper> childDocs = new ArrayList<XPathHelper>(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); Document docVO = new Document(); docVO.setObject(DomHelper.toDomDocument(node)); docVO.setDocumentType(Document.class.getName()); childDocs.add(new XPathHelper(docVO, this)); } return childDocs; } }
java
public Object peekDom(org.w3c.dom.Document doc, String xpathExpr) throws Exception { XPathFactory xPathfactory = XPathFactory.newInstance(); XPath xpath = xPathfactory.newXPath(); xpath.setNamespaceContext(new UniversalNamespaceCache(doc, false)); XPathExpression expr = xpath.compile(xpathExpr); NodeList nodeList = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); if (nodeList == null || nodeList.getLength() == 0) { return null; } else if (nodeList.getLength() == 1) { Node node = nodeList.item(0); if (node instanceof Attr) return ((Attr) node).getValue(); else return node.getChildNodes().item(0).getNodeValue(); } else { List<XPathHelper> childDocs = new ArrayList<XPathHelper>(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); Document docVO = new Document(); docVO.setObject(DomHelper.toDomDocument(node)); docVO.setDocumentType(Document.class.getName()); childDocs.add(new XPathHelper(docVO, this)); } return childDocs; } }
[ "public", "Object", "peekDom", "(", "org", ".", "w3c", ".", "dom", ".", "Document", "doc", ",", "String", "xpathExpr", ")", "throws", "Exception", "{", "XPathFactory", "xPathfactory", "=", "XPathFactory", ".", "newInstance", "(", ")", ";", "XPath", "xpath", ...
Retrieves the value of a document element or attribute as a String. If multiple matches are found or the match has children, will return a List <XPathHelper>. @param xpath the expression indicating the document location @return a String, List<XPathHelper>, or null depending on how many matches are found
[ "Retrieves", "the", "value", "of", "a", "document", "element", "or", "attribute", "as", "a", "String", ".", "If", "multiple", "matches", "are", "found", "or", "the", "match", "has", "children", "will", "return", "a", "List", "<XPathHelper", ">", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/XPathHelper.java#L110-L137
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/Window.java
Window.writeActiveWindowToMapset
public static void writeActiveWindowToMapset( String mapsetPath, Window window ) throws IOException { writeWindowFile(mapsetPath + File.separator + GrassLegacyConstans.WIND, window); }
java
public static void writeActiveWindowToMapset( String mapsetPath, Window window ) throws IOException { writeWindowFile(mapsetPath + File.separator + GrassLegacyConstans.WIND, window); }
[ "public", "static", "void", "writeActiveWindowToMapset", "(", "String", "mapsetPath", ",", "Window", "window", ")", "throws", "IOException", "{", "writeWindowFile", "(", "mapsetPath", "+", "File", ".", "separator", "+", "GrassLegacyConstans", ".", "WIND", ",", "wi...
Write active region window to the mapset @param mapsetPath the path to the mapset folder @param the active Window object @throws IOException
[ "Write", "active", "region", "window", "to", "the", "mapset" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/Window.java#L480-L482
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java
GrailsHibernateUtil.getAssociationProxy
public static HibernateProxy getAssociationProxy(Object obj, String associationName) { return proxyHandler.getAssociationProxy(obj, associationName); }
java
public static HibernateProxy getAssociationProxy(Object obj, String associationName) { return proxyHandler.getAssociationProxy(obj, associationName); }
[ "public", "static", "HibernateProxy", "getAssociationProxy", "(", "Object", "obj", ",", "String", "associationName", ")", "{", "return", "proxyHandler", ".", "getAssociationProxy", "(", "obj", ",", "associationName", ")", ";", "}" ]
Returns the proxy for a given association or null if it is not proxied @param obj The object @param associationName The named assoication @return A proxy
[ "Returns", "the", "proxy", "for", "a", "given", "association", "or", "null", "if", "it", "is", "not", "proxied" ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java#L389-L391
apache/reef
lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/common/grpc/GRPCUtils.java
GRPCUtils.toContextInfo
public static ContextInfo toContextInfo(final ContextBase context, final ExceptionInfo error) { final ContextInfo.Builder builder = ContextInfo.newBuilder() .setContextId(context.getId()) .setEvaluatorId(context.getEvaluatorId()) .setParentId(context.getParentId().orElse("")) .setEvaluatorDescriptorInfo(toEvaluatorDescriptorInfo( context.getEvaluatorDescriptor())); if (error != null) { builder.setException(error); } return builder.build(); }
java
public static ContextInfo toContextInfo(final ContextBase context, final ExceptionInfo error) { final ContextInfo.Builder builder = ContextInfo.newBuilder() .setContextId(context.getId()) .setEvaluatorId(context.getEvaluatorId()) .setParentId(context.getParentId().orElse("")) .setEvaluatorDescriptorInfo(toEvaluatorDescriptorInfo( context.getEvaluatorDescriptor())); if (error != null) { builder.setException(error); } return builder.build(); }
[ "public", "static", "ContextInfo", "toContextInfo", "(", "final", "ContextBase", "context", ",", "final", "ExceptionInfo", "error", ")", "{", "final", "ContextInfo", ".", "Builder", "builder", "=", "ContextInfo", ".", "newBuilder", "(", ")", ".", "setContextId", ...
Create a context info from a context object with an error. @param context object @param error info @return context info
[ "Create", "a", "context", "info", "from", "a", "context", "object", "with", "an", "error", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/common/grpc/GRPCUtils.java#L116-L127
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/cli/CommandLineParser.java
CommandLineParser.processSystemArg
protected void processSystemArg(DefaultCommandLine cl, String arg) { int i = arg.indexOf("="); String name = arg.substring(2, i); String value = arg.substring(i + 1, arg.length()); cl.addSystemProperty(name, value); }
java
protected void processSystemArg(DefaultCommandLine cl, String arg) { int i = arg.indexOf("="); String name = arg.substring(2, i); String value = arg.substring(i + 1, arg.length()); cl.addSystemProperty(name, value); }
[ "protected", "void", "processSystemArg", "(", "DefaultCommandLine", "cl", ",", "String", "arg", ")", "{", "int", "i", "=", "arg", ".", "indexOf", "(", "\"=\"", ")", ";", "String", "name", "=", "arg", ".", "substring", "(", "2", ",", "i", ")", ";", "S...
Process System property arg. @param cl cl @param arg system arg
[ "Process", "System", "property", "arg", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/cli/CommandLineParser.java#L192-L197
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java
MappingUtils.callGetter
public static Object callGetter(Object target, PropertyDescriptor prop) { Object result = null; Method getter = prop.getReadMethod(); if (getter == null) { throw new RuntimeException("No read method for bean property " + target.getClass() + " " + prop.getName()); } try { result = getter.invoke(target, new Object[0]); } catch (InvocationTargetException e) { throw new RuntimeException("Couldn't invoke method: " + getter, e); } catch (IllegalArgumentException e) { throw new RuntimeException( "Couldn't invoke method with 0 arguments: " + getter, e); } catch (IllegalAccessException e) { throw new RuntimeException("Couldn't invoke method: " + getter, e); } return result; }
java
public static Object callGetter(Object target, PropertyDescriptor prop) { Object result = null; Method getter = prop.getReadMethod(); if (getter == null) { throw new RuntimeException("No read method for bean property " + target.getClass() + " " + prop.getName()); } try { result = getter.invoke(target, new Object[0]); } catch (InvocationTargetException e) { throw new RuntimeException("Couldn't invoke method: " + getter, e); } catch (IllegalArgumentException e) { throw new RuntimeException( "Couldn't invoke method with 0 arguments: " + getter, e); } catch (IllegalAccessException e) { throw new RuntimeException("Couldn't invoke method: " + getter, e); } return result; }
[ "public", "static", "Object", "callGetter", "(", "Object", "target", ",", "PropertyDescriptor", "prop", ")", "{", "Object", "result", "=", "null", ";", "Method", "getter", "=", "prop", ".", "getReadMethod", "(", ")", ";", "if", "(", "getter", "==", "null",...
Invokes Property Descriptor Getter and returns value returned by that function. @param target Object Getter of which would be executed @param prop Property Descriptor which would be used to invoke Getter @return Value returned from Getter
[ "Invokes", "Property", "Descriptor", "Getter", "and", "returns", "value", "returned", "by", "that", "function", "." ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L120-L143
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/Algorithms.java
Algorithms.findAll
public Collection findAll(Iterator it, Constraint constraint) { ElementGenerator finder = new IteratorTemplate(it).findAll(constraint); final Collection results = new ArrayList(); finder.run(new Block() { protected void handle(Object element) { results.add(element); } }); return results; }
java
public Collection findAll(Iterator it, Constraint constraint) { ElementGenerator finder = new IteratorTemplate(it).findAll(constraint); final Collection results = new ArrayList(); finder.run(new Block() { protected void handle(Object element) { results.add(element); } }); return results; }
[ "public", "Collection", "findAll", "(", "Iterator", "it", ",", "Constraint", "constraint", ")", "{", "ElementGenerator", "finder", "=", "new", "IteratorTemplate", "(", "it", ")", ".", "findAll", "(", "constraint", ")", ";", "final", "Collection", "results", "=...
Find all the elements in the collection that match the specified constraint. @param it the iterator @param constraint the constraint @return The objects that match, or a empty collection if none match
[ "Find", "all", "the", "elements", "in", "the", "collection", "that", "match", "the", "specified", "constraint", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/closure/support/Algorithms.java#L147-L156
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.acceptSessionFromEntityPathAsync
public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings) { return acceptSessionFromEntityPathAsync(namespaceName, entityPath, sessionId, clientSettings, DEFAULTRECEIVEMODE); }
java
public static CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings) { return acceptSessionFromEntityPathAsync(namespaceName, entityPath, sessionId, clientSettings, DEFAULTRECEIVEMODE); }
[ "public", "static", "CompletableFuture", "<", "IMessageSession", ">", "acceptSessionFromEntityPathAsync", "(", "String", "namespaceName", ",", "String", "entityPath", ",", "String", "sessionId", ",", "ClientSettings", "clientSettings", ")", "{", "return", "acceptSessionFr...
Asynchronously accepts a session in PeekLock mode from service bus using the client settings. Session Id can be null, if null, service will return the first available session. @param namespaceName namespace of entity @param entityPath path of entity @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session @param clientSettings client settings @return a CompletableFuture representing the pending session accepting
[ "Asynchronously", "accepts", "a", "session", "in", "PeekLock", "mode", "from", "service", "bus", "using", "the", "client", "settings", ".", "Session", "Id", "can", "be", "null", "if", "null", "service", "will", "return", "the", "first", "available", "session",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L671-L673
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java
EventSubscriptionsInner.listRegionalByResourceGroupAsync
public Observable<List<EventSubscriptionInner>> listRegionalByResourceGroupAsync(String resourceGroupName, String location) { return listRegionalByResourceGroupWithServiceResponseAsync(resourceGroupName, location).map(new Func1<ServiceResponse<List<EventSubscriptionInner>>, List<EventSubscriptionInner>>() { @Override public List<EventSubscriptionInner> call(ServiceResponse<List<EventSubscriptionInner>> response) { return response.body(); } }); }
java
public Observable<List<EventSubscriptionInner>> listRegionalByResourceGroupAsync(String resourceGroupName, String location) { return listRegionalByResourceGroupWithServiceResponseAsync(resourceGroupName, location).map(new Func1<ServiceResponse<List<EventSubscriptionInner>>, List<EventSubscriptionInner>>() { @Override public List<EventSubscriptionInner> call(ServiceResponse<List<EventSubscriptionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "EventSubscriptionInner", ">", ">", "listRegionalByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "location", ")", "{", "return", "listRegionalByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName"...
List all regional event subscriptions under an Azure subscription and resource group. List all event subscriptions from the given location under a specific Azure subscription and resource group. @param resourceGroupName The name of the resource group within the user's subscription. @param location Name of the location @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;EventSubscriptionInner&gt; object
[ "List", "all", "regional", "event", "subscriptions", "under", "an", "Azure", "subscription", "and", "resource", "group", ".", "List", "all", "event", "subscriptions", "from", "the", "given", "location", "under", "a", "specific", "Azure", "subscription", "and", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L1299-L1306
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/NumericUtil.java
NumericUtil.isCNNumericString
public static boolean isCNNumericString(String str , int sIdx, int eIdx) { for ( int i = sIdx; i < eIdx; i++ ) { if ( ! cnNumeric.containsKey(str.charAt(i)) ) { return false; } } return true; }
java
public static boolean isCNNumericString(String str , int sIdx, int eIdx) { for ( int i = sIdx; i < eIdx; i++ ) { if ( ! cnNumeric.containsKey(str.charAt(i)) ) { return false; } } return true; }
[ "public", "static", "boolean", "isCNNumericString", "(", "String", "str", ",", "int", "sIdx", ",", "int", "eIdx", ")", "{", "for", "(", "int", "i", "=", "sIdx", ";", "i", "<", "eIdx", ";", "i", "++", ")", "{", "if", "(", "!", "cnNumeric", ".", "c...
check if the specified string is a Chinese numeric string @param str @return boolean
[ "check", "if", "the", "specified", "string", "is", "a", "Chinese", "numeric", "string" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/NumericUtil.java#L67-L75
Stratio/bdt
src/main/java/com/stratio/qa/specs/SeleniumSpec.java
SeleniumSpec.seleniumDelete
@When("^I delete the text '(.+?)' on the element on index '(\\d+?)'( and replace it for '(.+?)')?$") public void seleniumDelete(String text, Integer index, String foo, String replacement) { assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required") .hasAtLeast(index); Actions actions = new Actions(commonspec.getDriver()); actions.moveToElement(commonspec.getPreviousWebElements().getPreviousWebElements().get(index), (text.length() / 2), 0); for (int i = 0; i < (text.length() / 2); i++) { actions.sendKeys(Keys.ARROW_LEFT); actions.build().perform(); } for (int i = 0; i < text.length(); i++) { actions.sendKeys(Keys.DELETE); actions.build().perform(); } if (replacement != null && replacement.length() != 0) { actions.sendKeys(replacement); actions.build().perform(); } }
java
@When("^I delete the text '(.+?)' on the element on index '(\\d+?)'( and replace it for '(.+?)')?$") public void seleniumDelete(String text, Integer index, String foo, String replacement) { assertThat(this.commonspec, commonspec.getPreviousWebElements()).as("There are less found elements than required") .hasAtLeast(index); Actions actions = new Actions(commonspec.getDriver()); actions.moveToElement(commonspec.getPreviousWebElements().getPreviousWebElements().get(index), (text.length() / 2), 0); for (int i = 0; i < (text.length() / 2); i++) { actions.sendKeys(Keys.ARROW_LEFT); actions.build().perform(); } for (int i = 0; i < text.length(); i++) { actions.sendKeys(Keys.DELETE); actions.build().perform(); } if (replacement != null && replacement.length() != 0) { actions.sendKeys(replacement); actions.build().perform(); } }
[ "@", "When", "(", "\"^I delete the text '(.+?)' on the element on index '(\\\\d+?)'( and replace it for '(.+?)')?$\"", ")", "public", "void", "seleniumDelete", "(", "String", "text", ",", "Integer", "index", ",", "String", "foo", ",", "String", "replacement", ")", "{", "a...
Delete or replace the text on a numbered {@code index} previously found element. @param index
[ "Delete", "or", "replace", "the", "text", "on", "a", "numbered", "{", "@code", "index", "}", "previously", "found", "element", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/SeleniumSpec.java#L254-L273
aws/aws-sdk-java
aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/GetDocumentVersionResult.java
GetDocumentVersionResult.withCustomMetadata
public GetDocumentVersionResult withCustomMetadata(java.util.Map<String, String> customMetadata) { setCustomMetadata(customMetadata); return this; }
java
public GetDocumentVersionResult withCustomMetadata(java.util.Map<String, String> customMetadata) { setCustomMetadata(customMetadata); return this; }
[ "public", "GetDocumentVersionResult", "withCustomMetadata", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "customMetadata", ")", "{", "setCustomMetadata", "(", "customMetadata", ")", ";", "return", "this", ";", "}" ]
<p> The custom metadata on the document version. </p> @param customMetadata The custom metadata on the document version. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "custom", "metadata", "on", "the", "document", "version", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/GetDocumentVersionResult.java#L114-L117
alibaba/canal
client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESTemplate.java
ESTemplate.getESDataFromDmlData
public Object getESDataFromDmlData(ESMapping mapping, Map<String, Object> dmlData, Map<String, Object> esFieldData) { SchemaItem schemaItem = mapping.getSchemaItem(); String idFieldName = mapping.get_id() == null ? mapping.getPk() : mapping.get_id(); Object resultIdVal = null; for (FieldItem fieldItem : schemaItem.getSelectFields().values()) { String columnName = fieldItem.getColumnItems().iterator().next().getColumnName(); Object value = getValFromData(mapping, dmlData, fieldItem.getFieldName(), columnName); if (fieldItem.getFieldName().equals(idFieldName)) { resultIdVal = value; } if (!fieldItem.getFieldName().equals(mapping.get_id()) && !mapping.getSkips().contains(fieldItem.getFieldName())) { esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), value); } } // 添加父子文档关联信息 putRelationData(mapping, schemaItem, dmlData, esFieldData); return resultIdVal; }
java
public Object getESDataFromDmlData(ESMapping mapping, Map<String, Object> dmlData, Map<String, Object> esFieldData) { SchemaItem schemaItem = mapping.getSchemaItem(); String idFieldName = mapping.get_id() == null ? mapping.getPk() : mapping.get_id(); Object resultIdVal = null; for (FieldItem fieldItem : schemaItem.getSelectFields().values()) { String columnName = fieldItem.getColumnItems().iterator().next().getColumnName(); Object value = getValFromData(mapping, dmlData, fieldItem.getFieldName(), columnName); if (fieldItem.getFieldName().equals(idFieldName)) { resultIdVal = value; } if (!fieldItem.getFieldName().equals(mapping.get_id()) && !mapping.getSkips().contains(fieldItem.getFieldName())) { esFieldData.put(Util.cleanColumn(fieldItem.getFieldName()), value); } } // 添加父子文档关联信息 putRelationData(mapping, schemaItem, dmlData, esFieldData); return resultIdVal; }
[ "public", "Object", "getESDataFromDmlData", "(", "ESMapping", "mapping", ",", "Map", "<", "String", ",", "Object", ">", "dmlData", ",", "Map", "<", "String", ",", "Object", ">", "esFieldData", ")", "{", "SchemaItem", "schemaItem", "=", "mapping", ".", "getSc...
将dml的data转换为es的data @param mapping 配置mapping @param dmlData dml data @param esFieldData es data @return 返回 id 值
[ "将dml的data转换为es的data" ]
train
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESTemplate.java#L371-L393
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/listeners/JobChainingJobListener.java
JobChainingJobListener.addJobChainLink
public void addJobChainLink (final JobKey firstJob, final JobKey secondJob) { ValueEnforcer.notNull (firstJob, "FirstJob"); ValueEnforcer.notNull (firstJob.getName (), "FirstJob.Name"); ValueEnforcer.notNull (secondJob, "SecondJob"); ValueEnforcer.notNull (secondJob.getName (), "SecondJob.Name"); m_aChainLinks.put (firstJob, secondJob); }
java
public void addJobChainLink (final JobKey firstJob, final JobKey secondJob) { ValueEnforcer.notNull (firstJob, "FirstJob"); ValueEnforcer.notNull (firstJob.getName (), "FirstJob.Name"); ValueEnforcer.notNull (secondJob, "SecondJob"); ValueEnforcer.notNull (secondJob.getName (), "SecondJob.Name"); m_aChainLinks.put (firstJob, secondJob); }
[ "public", "void", "addJobChainLink", "(", "final", "JobKey", "firstJob", ",", "final", "JobKey", "secondJob", ")", "{", "ValueEnforcer", ".", "notNull", "(", "firstJob", ",", "\"FirstJob\"", ")", ";", "ValueEnforcer", ".", "notNull", "(", "firstJob", ".", "get...
Add a chain mapping - when the Job identified by the first key completes the job identified by the second key will be triggered. @param firstJob a JobKey with the name and group of the first job @param secondJob a JobKey with the name and group of the follow-up job
[ "Add", "a", "chain", "mapping", "-", "when", "the", "Job", "identified", "by", "the", "first", "key", "completes", "the", "job", "identified", "by", "the", "second", "key", "will", "be", "triggered", "." ]
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/listeners/JobChainingJobListener.java#L87-L95
Alluxio/alluxio
core/common/src/main/java/alluxio/util/io/FileUtils.java
FileUtils.createBlockPath
public static void createBlockPath(String path, String workerDataFolderPermissions) throws IOException { try { createStorageDirPath(PathUtils.getParent(path), workerDataFolderPermissions); } catch (InvalidPathException e) { throw new IOException("Failed to create block path, get parent path of " + path + "failed", e); } catch (IOException e) { throw new IOException("Failed to create block path " + path, e); } }
java
public static void createBlockPath(String path, String workerDataFolderPermissions) throws IOException { try { createStorageDirPath(PathUtils.getParent(path), workerDataFolderPermissions); } catch (InvalidPathException e) { throw new IOException("Failed to create block path, get parent path of " + path + "failed", e); } catch (IOException e) { throw new IOException("Failed to create block path " + path, e); } }
[ "public", "static", "void", "createBlockPath", "(", "String", "path", ",", "String", "workerDataFolderPermissions", ")", "throws", "IOException", "{", "try", "{", "createStorageDirPath", "(", "PathUtils", ".", "getParent", "(", "path", ")", ",", "workerDataFolderPer...
Creates the local block path and all the parent directories. Also, sets the appropriate permissions. @param path the path of the block @param workerDataFolderPermissions The permissions to set on the worker's data folder
[ "Creates", "the", "local", "block", "path", "and", "all", "the", "parent", "directories", ".", "Also", "sets", "the", "appropriate", "permissions", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/FileUtils.java#L187-L197
apereo/cas
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java
OAuth20HandlerInterceptorAdapter.isAccessTokenRequest
protected boolean isAccessTokenRequest(final HttpServletRequest request, final HttpServletResponse response) { val requestPath = request.getRequestURI(); val pattern = String.format("(%s|%s)", OAuth20Constants.ACCESS_TOKEN_URL, OAuth20Constants.TOKEN_URL); return doesUriMatchPattern(requestPath, pattern); }
java
protected boolean isAccessTokenRequest(final HttpServletRequest request, final HttpServletResponse response) { val requestPath = request.getRequestURI(); val pattern = String.format("(%s|%s)", OAuth20Constants.ACCESS_TOKEN_URL, OAuth20Constants.TOKEN_URL); return doesUriMatchPattern(requestPath, pattern); }
[ "protected", "boolean", "isAccessTokenRequest", "(", "final", "HttpServletRequest", "request", ",", "final", "HttpServletResponse", "response", ")", "{", "val", "requestPath", "=", "request", ".", "getRequestURI", "(", ")", ";", "val", "pattern", "=", "String", "....
Is access token request request. @param request the request @param response the response @return the boolean
[ "Is", "access", "token", "request", "request", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java#L62-L66
GwtMaterialDesign/gwt-material-table
src/main/java/gwt/material/design/client/ui/table/cell/FrozenProperties.java
FrozenProperties.setHeaderStyleProperty
public FrozenProperties setHeaderStyleProperty(StyleName styleName, String value) { headerStyleProps.put(styleName, value); return this; }
java
public FrozenProperties setHeaderStyleProperty(StyleName styleName, String value) { headerStyleProps.put(styleName, value); return this; }
[ "public", "FrozenProperties", "setHeaderStyleProperty", "(", "StyleName", "styleName", ",", "String", "value", ")", "{", "headerStyleProps", ".", "put", "(", "styleName", ",", "value", ")", ";", "return", "this", ";", "}" ]
Set a header style property using its name as the key. Please ensure the style name and value are appropriately configured or it may result in unexpected behavior. @param styleName the style name as seen here {@link Style#STYLE_Z_INDEX} for example. @param value the string value required for the given style property.
[ "Set", "a", "header", "style", "property", "using", "its", "name", "as", "the", "key", ".", "Please", "ensure", "the", "style", "name", "and", "value", "are", "appropriately", "configured", "or", "it", "may", "result", "in", "unexpected", "behavior", "." ]
train
https://github.com/GwtMaterialDesign/gwt-material-table/blob/1352cafdcbff747bc1f302e709ed376df6642ef5/src/main/java/gwt/material/design/client/ui/table/cell/FrozenProperties.java#L104-L107
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_enable_POST
public OvhTask serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_enable_POST(String serviceName, Long datacenterId, String localVraNetwork, String ovhEndpointIp, String remoteVraNetwork) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/enable"; StringBuilder sb = path(qPath, serviceName, datacenterId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "localVraNetwork", localVraNetwork); addBody(o, "ovhEndpointIp", ovhEndpointIp); addBody(o, "remoteVraNetwork", remoteVraNetwork); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_enable_POST(String serviceName, Long datacenterId, String localVraNetwork, String ovhEndpointIp, String remoteVraNetwork) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/enable"; StringBuilder sb = path(qPath, serviceName, datacenterId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "localVraNetwork", localVraNetwork); addBody(o, "ovhEndpointIp", ovhEndpointIp); addBody(o, "remoteVraNetwork", remoteVraNetwork); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_datacenter_datacenterId_disasterRecovery_zertoSingle_enable_POST", "(", "String", "serviceName", ",", "Long", "datacenterId", ",", "String", "localVraNetwork", ",", "String", "ovhEndpointIp", ",", "String", "remoteVraNetwork", ")", "throws", ...
Enable Zerto replication between your OVH Private Cloud and your onsite infrastructure REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/disasterRecovery/zertoSingle/enable @param ovhEndpointIp [required] Your OVH Private Cloud public IP for the secured replication data tunnel endpoint @param remoteVraNetwork [required] Internal zerto subnet of your onsite infrastructure (ip/cidr) @param localVraNetwork [required] Internal zerto subnet for your OVH Private Cloud (ip/cidr) @param serviceName [required] Domain of the service @param datacenterId [required] API beta
[ "Enable", "Zerto", "replication", "between", "your", "OVH", "Private", "Cloud", "and", "your", "onsite", "infrastructure" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1881-L1890
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java
CommsByteBuffer.putMap
public void putMap (Map<String,String> map) { //SIB0163.comms.1 if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putMap", "map="+map); if (map != null) { final Set<String> keys = map.keySet(); putShort(keys.size()); // Number of entries for (String k: keys) { putString(k); putString(map.get(k)); } } else { putShort(0); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putMap"); }
java
public void putMap (Map<String,String> map) { //SIB0163.comms.1 if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "putMap", "map="+map); if (map != null) { final Set<String> keys = map.keySet(); putShort(keys.size()); // Number of entries for (String k: keys) { putString(k); putString(map.get(k)); } } else { putShort(0); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "putMap"); }
[ "public", "void", "putMap", "(", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "//SIB0163.comms.1", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "...
Put a <String,String> Map object into the transmission buffer
[ "Put", "a", "<String", "String", ">", "Map", "object", "into", "the", "transmission", "buffer" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L688-L703
TNG/ArchUnit
archunit/src/main/java/com/tngtech/archunit/library/dependencies/Slice.java
Slice.as
@Override @PublicAPI(usage = ACCESS) public Slice as(String pattern) { return new Slice(sliceAssignment, matchingGroups, new Description(pattern), classes); }
java
@Override @PublicAPI(usage = ACCESS) public Slice as(String pattern) { return new Slice(sliceAssignment, matchingGroups, new Description(pattern), classes); }
[ "@", "Override", "@", "PublicAPI", "(", "usage", "=", "ACCESS", ")", "public", "Slice", "as", "(", "String", "pattern", ")", "{", "return", "new", "Slice", "(", "sliceAssignment", ",", "matchingGroups", ",", "new", "Description", "(", "pattern", ")", ",", ...
The pattern can be a description with references to the matching groups by '$' and position. E.g. slices are created by 'some.svc.(*).sub.(*)', and the pattern is "the module $2 of service $1", and we match 'some.svc.foo.module.bar', then the resulting description will be "the module bar of service foo". @param pattern The description pattern with numbered references of the form $i @return Same slice with different description
[ "The", "pattern", "can", "be", "a", "description", "with", "references", "to", "the", "matching", "groups", "by", "$", "and", "position", ".", "E", ".", "g", ".", "slices", "are", "created", "by", "some", ".", "svc", ".", "(", "*", ")", ".", "sub", ...
train
https://github.com/TNG/ArchUnit/blob/024c5d2502e91de6cb586b86c7084dbd12f3ef37/archunit/src/main/java/com/tngtech/archunit/library/dependencies/Slice.java#L98-L102
gallandarakhneorg/afc
advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/HeapAttributeCollection.java
HeapAttributeCollection.getStoredAttributeValue
@Pure protected AttributeValue getStoredAttributeValue(String name, AttributeType expectedType) { Object val = this.heap.get(name); if (val != null) { final AttributeType currentType = AttributeType.fromValue(val); val = unprotectNull(val); final AttributeValue attr = new AttributeValueImpl(name); if (expectedType == null) { attr.castAndSet(currentType, val); } else { attr.castAndSet(expectedType, val); } return attr; } return null; }
java
@Pure protected AttributeValue getStoredAttributeValue(String name, AttributeType expectedType) { Object val = this.heap.get(name); if (val != null) { final AttributeType currentType = AttributeType.fromValue(val); val = unprotectNull(val); final AttributeValue attr = new AttributeValueImpl(name); if (expectedType == null) { attr.castAndSet(currentType, val); } else { attr.castAndSet(expectedType, val); } return attr; } return null; }
[ "@", "Pure", "protected", "AttributeValue", "getStoredAttributeValue", "(", "String", "name", ",", "AttributeType", "expectedType", ")", "{", "Object", "val", "=", "this", ".", "heap", ".", "get", "(", "name", ")", ";", "if", "(", "val", "!=", "null", ")",...
Replies the attribute with the given name. @param name is the name of the attribute to retreive @param expectedType is the expected type for the attribute. @return the value or <code>null</code>
[ "Replies", "the", "attribute", "with", "the", "given", "name", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/HeapAttributeCollection.java#L274-L289
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java
ObjectEnvelopeOrdering.buildPotential11Edge
protected Edge buildPotential11Edge(Vertex vertex1, Vertex vertex2, boolean fkToRef) { ModificationState state1 = vertex1.getEnvelope().getModificationState(); ModificationState state2 = vertex2.getEnvelope().getModificationState(); if (state1.needsUpdate() || state1.needsDelete()) { if (state2.needsDelete()) { // old version of (1) might point to (2) return new Edge(vertex1, vertex2, fkToRef ? POTENTIAL_EDGE_WEIGHT_WITH_FK : POTENTIAL_EDGE_WEIGHT); } } return null; }
java
protected Edge buildPotential11Edge(Vertex vertex1, Vertex vertex2, boolean fkToRef) { ModificationState state1 = vertex1.getEnvelope().getModificationState(); ModificationState state2 = vertex2.getEnvelope().getModificationState(); if (state1.needsUpdate() || state1.needsDelete()) { if (state2.needsDelete()) { // old version of (1) might point to (2) return new Edge(vertex1, vertex2, fkToRef ? POTENTIAL_EDGE_WEIGHT_WITH_FK : POTENTIAL_EDGE_WEIGHT); } } return null; }
[ "protected", "Edge", "buildPotential11Edge", "(", "Vertex", "vertex1", ",", "Vertex", "vertex2", ",", "boolean", "fkToRef", ")", "{", "ModificationState", "state1", "=", "vertex1", ".", "getEnvelope", "(", ")", ".", "getModificationState", "(", ")", ";", "Modifi...
Checks if the database operations associated with two object envelopes that might have been related via an 1:1 (or n:1) reference before the current transaction needs to be performed in a particular order and if so builds and returns a corresponding directed edge weighted with <code>POTENTIAL_EDGE_WEIGHT</code>. The following cases are considered (* means object needs update, + means object needs insert, - means object needs to be deleted): <table> <tr><td>(1)* -(1:1)-&gt; (2)*</td><td>no edge</td></tr> <tr><td>(1)* -(1:1)-&gt; (2)+</td><td>no edge</td></tr> <tr><td>(1)* -(1:1)-&gt; (2)-</td><td>(1)-&gt;(2) edge</td></tr> <tr><td>(1)+ -(1:1)-&gt; (2)*</td><td>no edge</td></tr> <tr><td>(1)+ -(1:1)-&gt; (2)+</td><td>no edge</td></tr> <tr><td>(1)+ -(1:1)-&gt; (2)-</td><td>no edge</td></tr> <tr><td>(1)- -(1:1)-&gt; (2)*</td><td>no edge</td></tr> <tr><td>(1)- -(1:1)-&gt; (2)+</td><td>no edge</td></tr> <tr><td>(1)- -(1:1)-&gt; (2)-</td><td>(1)-&gt;(2) edge</td></tr> <table> @param vertex1 object envelope vertex of the object that might have hold the reference @param vertex2 object envelope vertex of the potentially referenced object @return an Edge object or null if the two database operations can be performed in any order
[ "Checks", "if", "the", "database", "operations", "associated", "with", "two", "object", "envelopes", "that", "might", "have", "been", "related", "via", "an", "1", ":", "1", "(", "or", "n", ":", "1", ")", "reference", "before", "the", "current", "transactio...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java#L473-L486
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java
VirtualCdj.sendFaderStartCommand
public void sendFaderStartCommand(Set<Integer> deviceNumbersToStart, Set<Integer> deviceNumbersToStop) throws IOException { ensureRunning(); byte[] payload = new byte[FADER_START_PAYLOAD.length]; System.arraycopy(FADER_START_PAYLOAD, 0, payload, 0, FADER_START_PAYLOAD.length); payload[2] = getDeviceNumber(); for (int i = 1; i <= 4; i++) { if (deviceNumbersToStart.contains(i)) { payload[i + 4] = 0; } if (deviceNumbersToStop.contains(i)) { payload[i + 4] = 1; } } assembleAndSendPacket(Util.PacketType.FADER_START_COMMAND, payload, getBroadcastAddress(), BeatFinder.BEAT_PORT); }
java
public void sendFaderStartCommand(Set<Integer> deviceNumbersToStart, Set<Integer> deviceNumbersToStop) throws IOException { ensureRunning(); byte[] payload = new byte[FADER_START_PAYLOAD.length]; System.arraycopy(FADER_START_PAYLOAD, 0, payload, 0, FADER_START_PAYLOAD.length); payload[2] = getDeviceNumber(); for (int i = 1; i <= 4; i++) { if (deviceNumbersToStart.contains(i)) { payload[i + 4] = 0; } if (deviceNumbersToStop.contains(i)) { payload[i + 4] = 1; } } assembleAndSendPacket(Util.PacketType.FADER_START_COMMAND, payload, getBroadcastAddress(), BeatFinder.BEAT_PORT); }
[ "public", "void", "sendFaderStartCommand", "(", "Set", "<", "Integer", ">", "deviceNumbersToStart", ",", "Set", "<", "Integer", ">", "deviceNumbersToStop", ")", "throws", "IOException", "{", "ensureRunning", "(", ")", ";", "byte", "[", "]", "payload", "=", "ne...
Broadcast a packet that tells some players to start playing and others to stop. If a player number is in both sets, it will be told to stop. Numbers outside the range 1 to 4 are ignored. @param deviceNumbersToStart the players that should start playing if they aren't already @param deviceNumbersToStop the players that should stop playing @throws IOException if there is a problem broadcasting the command to the players @throws IllegalStateException if the {@code VirtualCdj} is not active
[ "Broadcast", "a", "packet", "that", "tells", "some", "players", "to", "start", "playing", "and", "others", "to", "stop", ".", "If", "a", "player", "number", "is", "in", "both", "sets", "it", "will", "be", "told", "to", "stop", ".", "Numbers", "outside", ...
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/VirtualCdj.java#L1234-L1250
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/BatchDeleteConnectionResult.java
BatchDeleteConnectionResult.withErrors
public BatchDeleteConnectionResult withErrors(java.util.Map<String, ErrorDetail> errors) { setErrors(errors); return this; }
java
public BatchDeleteConnectionResult withErrors(java.util.Map<String, ErrorDetail> errors) { setErrors(errors); return this; }
[ "public", "BatchDeleteConnectionResult", "withErrors", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "ErrorDetail", ">", "errors", ")", "{", "setErrors", "(", "errors", ")", ";", "return", "this", ";", "}" ]
<p> A map of the names of connections that were not successfully deleted to error details. </p> @param errors A map of the names of connections that were not successfully deleted to error details. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "of", "the", "names", "of", "connections", "that", "were", "not", "successfully", "deleted", "to", "error", "details", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/BatchDeleteConnectionResult.java#L144-L147
code4everything/util
src/main/java/com/zhazhapan/util/office/MsWordUtils.java
MsWordUtils.setStyle
public static void setStyle(XWPFRun run, Map<String, Object> styles) { if (Checker.isNotEmpty(styles)) { styles.forEach((key, value) -> { String methodName = "set" + key.substring(0, 1).toUpperCase() + key.substring(1); try { ReflectUtils.invokeMethodUseBasicType(run, methodName, new Object[]{value}); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { logger.error("set property " + key + " failed use method " + methodName + ", " + e.getMessage()); } }); } }
java
public static void setStyle(XWPFRun run, Map<String, Object> styles) { if (Checker.isNotEmpty(styles)) { styles.forEach((key, value) -> { String methodName = "set" + key.substring(0, 1).toUpperCase() + key.substring(1); try { ReflectUtils.invokeMethodUseBasicType(run, methodName, new Object[]{value}); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { logger.error("set property " + key + " failed use method " + methodName + ", " + e.getMessage()); } }); } }
[ "public", "static", "void", "setStyle", "(", "XWPFRun", "run", ",", "Map", "<", "String", ",", "Object", ">", "styles", ")", "{", "if", "(", "Checker", ".", "isNotEmpty", "(", "styles", ")", ")", "{", "styles", ".", "forEach", "(", "(", "key", ",", ...
设置XWPFRun样式<br><br> <p> 样式接受的参数:<br> property: italic, type: boolean<br> property: underline, type: class org.apache.poi.xwpf.usermodel.UnderlinePatterns<br> property: strikeThrough, type: boolean<br> property: strike, type: boolean<br> property: doubleStrikethrough, type: boolean<br> property: smallCaps, type: boolean<br> property: capitalized, type: boolean<br> property: shadow, type: boolean<br> property: imprinted, type: boolean<br> property: embossed, type: boolean<br> property: subscript, type: class org.apache.poi.xwpf.usermodel.VerticalAlign<br> property: kerning, type: int<br> property: characterSpacing, type: int<br> property: fontFamily, type: class java.lang.String<br> property: fontSize, type: int<br> property: textPosition, type: int<br> property: text, type: class java.lang.String<br> property: bold, type: boolean<br> property: color, type: class java.lang.String<br> @param run XWPFRun对象 @param styles 样式
[ "设置XWPFRun样式<br", ">", "<br", ">", "<p", ">", "样式接受的参数:<br", ">", "property", ":", "italic", "type", ":", "boolean<br", ">", "property", ":", "underline", "type", ":", "class", "org", ".", "apache", ".", "poi", ".", "xwpf", ".", "usermodel", ".", "Underl...
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/office/MsWordUtils.java#L282-L293
foundation-runtime/configuration
configuration-lib/src/main/java/com/cisco/oss/foundation/configuration/InfraPropertyPlaceholderConfigurer.java
InfraPropertyPlaceholderConfigurer.resolvePlaceholder
@Override protected String resolvePlaceholder(String placeholder, Properties props) { String resolvedPlaceholder = super.resolvePlaceholder(placeholder, props); if (null == resolvedPlaceholder) { LOGGER.trace("could not resolve place holder for key: " + placeholder + ". Please check your configuration files."); return resolvedPlaceholder; } else { return resolvedPlaceholder.trim(); } }
java
@Override protected String resolvePlaceholder(String placeholder, Properties props) { String resolvedPlaceholder = super.resolvePlaceholder(placeholder, props); if (null == resolvedPlaceholder) { LOGGER.trace("could not resolve place holder for key: " + placeholder + ". Please check your configuration files."); return resolvedPlaceholder; } else { return resolvedPlaceholder.trim(); } }
[ "@", "Override", "protected", "String", "resolvePlaceholder", "(", "String", "placeholder", ",", "Properties", "props", ")", "{", "String", "resolvedPlaceholder", "=", "super", ".", "resolvePlaceholder", "(", "placeholder", ",", "props", ")", ";", "if", "(", "nu...
trim the string value before it is returned to the caller method. @see org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#resolvePlaceholder(String, java.util.Properties)
[ "trim", "the", "string", "value", "before", "it", "is", "returned", "to", "the", "caller", "method", "." ]
train
https://github.com/foundation-runtime/configuration/blob/c5bd171a2cca0dc1c8d568f987843ca47c6d1eed/configuration-lib/src/main/java/com/cisco/oss/foundation/configuration/InfraPropertyPlaceholderConfigurer.java#L42-L52
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/GridRansacLineDetector.java
GridRansacLineDetector.convertToLineSegment
private LineSegment2D_F32 convertToLineSegment(List<Edgel> matchSet, LinePolar2D_F32 model) { float minT = Float.MAX_VALUE; float maxT = -Float.MAX_VALUE; LineParametric2D_F32 line = UtilLine2D_F32.convert(model,(LineParametric2D_F32)null); Point2D_F32 p = new Point2D_F32(); for( Edgel e : matchSet ) { p.set(e.x,e.y); float t = ClosestPoint2D_F32.closestPointT(line,e); if( minT > t ) minT = t; if( maxT < t ) maxT = t; } LineSegment2D_F32 segment = new LineSegment2D_F32(); segment.a.x = line.p.x + line.slope.x * minT; segment.a.y = line.p.y + line.slope.y * minT; segment.b.x = line.p.x + line.slope.x * maxT; segment.b.y = line.p.y + line.slope.y * maxT; return segment; }
java
private LineSegment2D_F32 convertToLineSegment(List<Edgel> matchSet, LinePolar2D_F32 model) { float minT = Float.MAX_VALUE; float maxT = -Float.MAX_VALUE; LineParametric2D_F32 line = UtilLine2D_F32.convert(model,(LineParametric2D_F32)null); Point2D_F32 p = new Point2D_F32(); for( Edgel e : matchSet ) { p.set(e.x,e.y); float t = ClosestPoint2D_F32.closestPointT(line,e); if( minT > t ) minT = t; if( maxT < t ) maxT = t; } LineSegment2D_F32 segment = new LineSegment2D_F32(); segment.a.x = line.p.x + line.slope.x * minT; segment.a.y = line.p.y + line.slope.y * minT; segment.b.x = line.p.x + line.slope.x * maxT; segment.b.y = line.p.y + line.slope.y * maxT; return segment; }
[ "private", "LineSegment2D_F32", "convertToLineSegment", "(", "List", "<", "Edgel", ">", "matchSet", ",", "LinePolar2D_F32", "model", ")", "{", "float", "minT", "=", "Float", ".", "MAX_VALUE", ";", "float", "maxT", "=", "-", "Float", ".", "MAX_VALUE", ";", "L...
Lines are found in polar form and this coverts them into line segments by finding the extreme points of points on the line. @param matchSet Set of points belonging to the line. @param model Detected line. @return Line segement.
[ "Lines", "are", "found", "in", "polar", "form", "and", "this", "coverts", "them", "into", "line", "segments", "by", "finding", "the", "extreme", "points", "of", "points", "on", "the", "line", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/GridRansacLineDetector.java#L190-L214
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/URLConnectionTools.java
URLConnectionTools.openURLConnection
public static URLConnection openURLConnection(URL url, int timeout) throws IOException { URLConnection huc = url.openConnection(); huc.setReadTimeout(timeout); huc.setConnectTimeout(timeout); return huc; }
java
public static URLConnection openURLConnection(URL url, int timeout) throws IOException { URLConnection huc = url.openConnection(); huc.setReadTimeout(timeout); huc.setConnectTimeout(timeout); return huc; }
[ "public", "static", "URLConnection", "openURLConnection", "(", "URL", "url", ",", "int", "timeout", ")", "throws", "IOException", "{", "URLConnection", "huc", "=", "url", ".", "openConnection", "(", ")", ";", "huc", ".", "setReadTimeout", "(", "timeout", ")", ...
Open HttpURLConnection. Recommended way to open URL connections in Java 1.7 and 1.8. https://eventuallyconsistent.net/2011/08/02/working-with-urlconnection-and-timeouts/ @param url URL to open @param timeout timeout in milli seconds @throws IOException an error in opening the URL
[ "Open", "HttpURLConnection", ".", "Recommended", "way", "to", "open", "URL", "connections", "in", "Java", "1", ".", "7", "and", "1", ".", "8", ".", "https", ":", "//", "eventuallyconsistent", ".", "net", "/", "2011", "/", "08", "/", "02", "/", "working...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/URLConnectionTools.java#L57-L62
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/xml/DOMCloner.java
DOMCloner.cloneNode
public Node cloneNode(Document doc, Node eold) { return doc.importNode(eold, true); }
java
public Node cloneNode(Document doc, Node eold) { return doc.importNode(eold, true); }
[ "public", "Node", "cloneNode", "(", "Document", "doc", ",", "Node", "eold", ")", "{", "return", "doc", ".", "importNode", "(", "eold", ",", "true", ")", ";", "}" ]
Clone an existing node. @param doc Document @param eold Existing node @return Cloned node
[ "Clone", "an", "existing", "node", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/xml/DOMCloner.java#L87-L89
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.curveTo
public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) { content.append(x1).append(' ').append(y1).append(' ').append(x2).append(' ').append(y2).append(' ').append(x3).append(' ').append(y3).append(" c").append_i(separator); }
java
public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) { content.append(x1).append(' ').append(y1).append(' ').append(x2).append(' ').append(y2).append(' ').append(x3).append(' ').append(y3).append(" c").append_i(separator); }
[ "public", "void", "curveTo", "(", "float", "x1", ",", "float", "y1", ",", "float", "x2", ",", "float", "y2", ",", "float", "x3", ",", "float", "y3", ")", "{", "content", ".", "append", "(", "x1", ")", ".", "append", "(", "'", "'", ")", ".", "ap...
Appends a B&#xea;zier curve to the path, starting from the current point. @param x1 x-coordinate of the first control point @param y1 y-coordinate of the first control point @param x2 x-coordinate of the second control point @param y2 y-coordinate of the second control point @param x3 x-coordinate of the ending point (= new current point) @param y3 y-coordinate of the ending point (= new current point)
[ "Appends", "a", "B&#xea", ";", "zier", "curve", "to", "the", "path", "starting", "from", "the", "current", "point", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L729-L731
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/DisambiguationPatternRuleReplacer.java
DisambiguationPatternRuleReplacer.skipMaxTokens
@Override protected int skipMaxTokens(AnalyzedTokenReadings[] tokens, PatternTokenMatcher matcher, int firstMatchToken, int prevSkipNext, PatternTokenMatcher prevElement, int m, int remainingElems) throws IOException { int maxSkip = 0; int maxOccurrences = matcher.getPatternToken().getMaxOccurrence() == -1 ? Integer.MAX_VALUE : matcher.getPatternToken().getMaxOccurrence(); for (int j = 1; j < maxOccurrences && m+j < tokens.length - remainingElems; j++) { boolean nextAllElementsMatch = testAllReadings(tokens, matcher, prevElement, m+j, firstMatchToken, prevSkipNext); if (nextAllElementsMatch) { maxSkip++; } else { break; } } return maxSkip; }
java
@Override protected int skipMaxTokens(AnalyzedTokenReadings[] tokens, PatternTokenMatcher matcher, int firstMatchToken, int prevSkipNext, PatternTokenMatcher prevElement, int m, int remainingElems) throws IOException { int maxSkip = 0; int maxOccurrences = matcher.getPatternToken().getMaxOccurrence() == -1 ? Integer.MAX_VALUE : matcher.getPatternToken().getMaxOccurrence(); for (int j = 1; j < maxOccurrences && m+j < tokens.length - remainingElems; j++) { boolean nextAllElementsMatch = testAllReadings(tokens, matcher, prevElement, m+j, firstMatchToken, prevSkipNext); if (nextAllElementsMatch) { maxSkip++; } else { break; } } return maxSkip; }
[ "@", "Override", "protected", "int", "skipMaxTokens", "(", "AnalyzedTokenReadings", "[", "]", "tokens", ",", "PatternTokenMatcher", "matcher", ",", "int", "firstMatchToken", ",", "int", "prevSkipNext", ",", "PatternTokenMatcher", "prevElement", ",", "int", "m", ",",...
/* (non-Javadoc) @see org.languagetool.rules.patterns.AbstractPatternRulePerformer#skipMaxTokens(org.languagetool.AnalyzedTokenReadings[], org.languagetool.rules.patterns.PatternTokenMatcher, int, int, org.languagetool.rules.patterns.PatternTokenMatcher, int, int)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/DisambiguationPatternRuleReplacer.java#L198-L211
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java
IntegrationAccountsInner.listKeyVaultKeys
public List<KeyVaultKeyInner> listKeyVaultKeys(String resourceGroupName, String integrationAccountName, ListKeyVaultKeysDefinition listKeyVaultKeys) { return listKeyVaultKeysWithServiceResponseAsync(resourceGroupName, integrationAccountName, listKeyVaultKeys).toBlocking().single().body(); }
java
public List<KeyVaultKeyInner> listKeyVaultKeys(String resourceGroupName, String integrationAccountName, ListKeyVaultKeysDefinition listKeyVaultKeys) { return listKeyVaultKeysWithServiceResponseAsync(resourceGroupName, integrationAccountName, listKeyVaultKeys).toBlocking().single().body(); }
[ "public", "List", "<", "KeyVaultKeyInner", ">", "listKeyVaultKeys", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "ListKeyVaultKeysDefinition", "listKeyVaultKeys", ")", "{", "return", "listKeyVaultKeysWithServiceResponseAsync", "(", "resour...
Gets the integration account's Key Vault keys. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param listKeyVaultKeys The key vault parameters. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;KeyVaultKeyInner&gt; object if successful.
[ "Gets", "the", "integration", "account", "s", "Key", "Vault", "keys", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java#L1032-L1034
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.hasBeenEnhancedForFeature
public static Boolean hasBeenEnhancedForFeature(final Class<?> controllerClass, final String featureName) { boolean hasBeenEnhanced = false; final Enhanced enhancedAnnotation = controllerClass.getAnnotation(Enhanced.class); if(enhancedAnnotation != null) { final String[] enhancedFor = enhancedAnnotation.enhancedFor(); if(enhancedFor != null) { hasBeenEnhanced = GrailsArrayUtils.contains(enhancedFor, featureName); } } return hasBeenEnhanced; }
java
public static Boolean hasBeenEnhancedForFeature(final Class<?> controllerClass, final String featureName) { boolean hasBeenEnhanced = false; final Enhanced enhancedAnnotation = controllerClass.getAnnotation(Enhanced.class); if(enhancedAnnotation != null) { final String[] enhancedFor = enhancedAnnotation.enhancedFor(); if(enhancedFor != null) { hasBeenEnhanced = GrailsArrayUtils.contains(enhancedFor, featureName); } } return hasBeenEnhanced; }
[ "public", "static", "Boolean", "hasBeenEnhancedForFeature", "(", "final", "Class", "<", "?", ">", "controllerClass", ",", "final", "String", "featureName", ")", "{", "boolean", "hasBeenEnhanced", "=", "false", ";", "final", "Enhanced", "enhancedAnnotation", "=", "...
Checks to see if a class is marked with @grails.artefact.Enhanced and if the enhancedFor attribute of the annotation contains a specific feature name @param controllerClass The class to inspect @param featureName The name of a feature to check for @return true if controllerClass is marked with Enhanced and the enhancedFor attribute includes featureName, otherwise returns false @see Enhanced @see Enhanced#enhancedFor()
[ "Checks", "to", "see", "if", "a", "class", "is", "marked", "with", "@grails", ".", "artefact", ".", "Enhanced", "and", "if", "the", "enhancedFor", "attribute", "of", "the", "annotation", "contains", "a", "specific", "feature", "name" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L990-L1000
jwtk/jjwt
api/src/main/java/io/jsonwebtoken/lang/Strings.java
Strings.arrayToDelimitedString
public static String arrayToDelimitedString(Object[] arr, String delim) { if (Objects.isEmpty(arr)) { return ""; } if (arr.length == 1) { return Objects.nullSafeToString(arr[0]); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < arr.length; i++) { if (i > 0) { sb.append(delim); } sb.append(arr[i]); } return sb.toString(); }
java
public static String arrayToDelimitedString(Object[] arr, String delim) { if (Objects.isEmpty(arr)) { return ""; } if (arr.length == 1) { return Objects.nullSafeToString(arr[0]); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < arr.length; i++) { if (i > 0) { sb.append(delim); } sb.append(arr[i]); } return sb.toString(); }
[ "public", "static", "String", "arrayToDelimitedString", "(", "Object", "[", "]", "arr", ",", "String", "delim", ")", "{", "if", "(", "Objects", ".", "isEmpty", "(", "arr", ")", ")", "{", "return", "\"\"", ";", "}", "if", "(", "arr", ".", "length", "=...
Convenience method to return a String array as a delimited (e.g. CSV) String. E.g. useful for <code>toString()</code> implementations. @param arr the array to display @param delim the delimiter to use (probably a ",") @return the delimited String
[ "Convenience", "method", "to", "return", "a", "String", "array", "as", "a", "delimited", "(", "e", ".", "g", ".", "CSV", ")", "String", ".", "E", ".", "g", ".", "useful", "for", "<code", ">", "toString", "()", "<", "/", "code", ">", "implementations"...
train
https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Strings.java#L1119-L1134
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/model/SQLiteEntity.java
SQLiteEntity.buildTableName
private String buildTableName(Elements elementUtils, SQLiteDatabaseSchema schema) { tableName = getSimpleName(); tableName = schema.classNameConverter.convert(tableName); String temp = AnnotationUtility.extractAsString(getElement(), BindSqlType.class, AnnotationAttributeType.NAME); if (StringUtils.hasText(temp)) { tableName = temp; } return tableName; }
java
private String buildTableName(Elements elementUtils, SQLiteDatabaseSchema schema) { tableName = getSimpleName(); tableName = schema.classNameConverter.convert(tableName); String temp = AnnotationUtility.extractAsString(getElement(), BindSqlType.class, AnnotationAttributeType.NAME); if (StringUtils.hasText(temp)) { tableName = temp; } return tableName; }
[ "private", "String", "buildTableName", "(", "Elements", "elementUtils", ",", "SQLiteDatabaseSchema", "schema", ")", "{", "tableName", "=", "getSimpleName", "(", ")", ";", "tableName", "=", "schema", ".", "classNameConverter", ".", "convert", "(", "tableName", ")",...
Builds the table name. @param elementUtils the element utils @param schema the schema @return the string
[ "Builds", "the", "table", "name", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/model/SQLiteEntity.java#L136-L147
oboehm/jfachwert
src/main/java/de/jfachwert/math/internal/ToNumberSerializer.java
ToNumberSerializer.serialize
@Override public void serialize(AbstractNumber number, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeNumber(number.toBigDecimal()); }
java
@Override public void serialize(AbstractNumber number, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeNumber(number.toBigDecimal()); }
[ "@", "Override", "public", "void", "serialize", "(", "AbstractNumber", "number", ",", "JsonGenerator", "jgen", ",", "SerializerProvider", "provider", ")", "throws", "IOException", "{", "jgen", ".", "writeNumber", "(", "number", ".", "toBigDecimal", "(", ")", ")"...
Fuer die Serialisierung wird die uebergebene Nummer in eine {@link java.math.BigDecimal} gewandelt. @param number uebergebene Nummer @param jgen Json-Generator @param provider Provider @throws IOException sollte nicht auftreten
[ "Fuer", "die", "Serialisierung", "wird", "die", "uebergebene", "Nummer", "in", "eine", "{", "@link", "java", ".", "math", ".", "BigDecimal", "}", "gewandelt", "." ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/math/internal/ToNumberSerializer.java#L45-L48
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/link/FeatureTileTableCoreLinker.java
FeatureTileTableCoreLinker.getLink
public FeatureTileLink getLink(String featureTable, String tileTable) { FeatureTileLink link = null; if (featureTileLinksActive()) { FeatureTileLinkKey id = new FeatureTileLinkKey(featureTable, tileTable); try { link = featureTileLinkDao.queryForId(id); } catch (SQLException e) { throw new GeoPackageException( "Failed to get feature tile link for GeoPackage: " + geoPackage.getName() + ", Feature Table: " + featureTable + ", Tile Table: " + tileTable, e); } } return link; }
java
public FeatureTileLink getLink(String featureTable, String tileTable) { FeatureTileLink link = null; if (featureTileLinksActive()) { FeatureTileLinkKey id = new FeatureTileLinkKey(featureTable, tileTable); try { link = featureTileLinkDao.queryForId(id); } catch (SQLException e) { throw new GeoPackageException( "Failed to get feature tile link for GeoPackage: " + geoPackage.getName() + ", Feature Table: " + featureTable + ", Tile Table: " + tileTable, e); } } return link; }
[ "public", "FeatureTileLink", "getLink", "(", "String", "featureTable", ",", "String", "tileTable", ")", "{", "FeatureTileLink", "link", "=", "null", ";", "if", "(", "featureTileLinksActive", "(", ")", ")", "{", "FeatureTileLinkKey", "id", "=", "new", "FeatureTil...
Get the feature and tile table link if it exists @param featureTable feature table @param tileTable tile table @return link or null
[ "Get", "the", "feature", "and", "tile", "table", "link", "if", "it", "exists" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/link/FeatureTileTableCoreLinker.java#L136-L154
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java
ICUResourceBundle.getResPathKeys
private static void getResPathKeys(String path, int num, String[] keys, int start) { if (num == 0) { return; } if (num == 1) { keys[start] = path; return; } int i = 0; for (;;) { int j = path.indexOf(RES_PATH_SEP_CHAR, i); assert j >= i; keys[start++] = path.substring(i, j); if (num == 2) { assert path.indexOf(RES_PATH_SEP_CHAR, j + 1) < 0; keys[start] = path.substring(j + 1); break; } else { i = j + 1; --num; } } }
java
private static void getResPathKeys(String path, int num, String[] keys, int start) { if (num == 0) { return; } if (num == 1) { keys[start] = path; return; } int i = 0; for (;;) { int j = path.indexOf(RES_PATH_SEP_CHAR, i); assert j >= i; keys[start++] = path.substring(i, j); if (num == 2) { assert path.indexOf(RES_PATH_SEP_CHAR, j + 1) < 0; keys[start] = path.substring(j + 1); break; } else { i = j + 1; --num; } } }
[ "private", "static", "void", "getResPathKeys", "(", "String", "path", ",", "int", "num", ",", "String", "[", "]", "keys", ",", "int", "start", ")", "{", "if", "(", "num", "==", "0", ")", "{", "return", ";", "}", "if", "(", "num", "==", "1", ")", ...
Fills some of the keys array (from start) with the num keys from the path string. @param path path string @param num must be {@link #countPathKeys(String)} @param keys @param start index where the first path key is stored
[ "Fills", "some", "of", "the", "keys", "array", "(", "from", "start", ")", "with", "the", "num", "keys", "from", "the", "path", "string", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L1006-L1028
stagemonitor/stagemonitor
stagemonitor-core/src/main/java/org/stagemonitor/core/StagemonitorCoreConfigurationSourceInitializer.java
StagemonitorCoreConfigurationSourceInitializer.assertRemotePropertiesServerIsAvailable
private void assertRemotePropertiesServerIsAvailable(final URL configUrl) { new HttpClient().send( "HEAD", configUrl.toExternalForm(), new HashMap<String, String>(), null, new HttpClient.ResponseHandler<Void>() { @Override public Void handleResponse(HttpRequest<?> httpRequest, InputStream is, Integer statusCode, IOException e) throws IOException { if (e != null || statusCode != 200) { throw new IllegalStateException("Remote properties are not available at " + configUrl + ", http status code: " + statusCode, e); } return null; } } ); }
java
private void assertRemotePropertiesServerIsAvailable(final URL configUrl) { new HttpClient().send( "HEAD", configUrl.toExternalForm(), new HashMap<String, String>(), null, new HttpClient.ResponseHandler<Void>() { @Override public Void handleResponse(HttpRequest<?> httpRequest, InputStream is, Integer statusCode, IOException e) throws IOException { if (e != null || statusCode != 200) { throw new IllegalStateException("Remote properties are not available at " + configUrl + ", http status code: " + statusCode, e); } return null; } } ); }
[ "private", "void", "assertRemotePropertiesServerIsAvailable", "(", "final", "URL", "configUrl", ")", "{", "new", "HttpClient", "(", ")", ".", "send", "(", "\"HEAD\"", ",", "configUrl", ".", "toExternalForm", "(", ")", ",", "new", "HashMap", "<", "String", ",",...
Does a simple HEAD request to a configuration endpoint to check if it's reachable. If not an IllegalStateException is thrown @param configUrl Full qualified configuration url
[ "Does", "a", "simple", "HEAD", "request", "to", "a", "configuration", "endpoint", "to", "check", "if", "it", "s", "reachable", ".", "If", "not", "an", "IllegalStateException", "is", "thrown" ]
train
https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-core/src/main/java/org/stagemonitor/core/StagemonitorCoreConfigurationSourceInitializer.java#L103-L120
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java
Util.createLocalStoredFile
public static StoredFile createLocalStoredFile(InputStream is, String sourceUrl, String localFilePath, String mimeType) { if (is == null) { return null; } // Copy the file contents over. CountingOutputStream cos = null; BufferedOutputStream bos = null; FileOutputStream fos = null; try { File localFile = new File(localFilePath); /* Local cache file name may not be unique, and can be reused, in which case, the previously created * cache file need to be deleted before it is being copied over. */ if (localFile.exists()) { localFile.delete(); } fos = new FileOutputStream(localFile); bos = new BufferedOutputStream(fos); cos = new CountingOutputStream(bos); byte[] buf = new byte[2048]; int count; while ((count = is.read(buf, 0, 2048)) != -1) { cos.write(buf, 0, count); } ApptentiveLog.v(UTIL, "File saved, size = " + (cos.getBytesWritten() / 1024) + "k"); } catch (IOException e) { ApptentiveLog.e(UTIL, "Error creating local copy of file attachment."); logException(e); return null; } finally { Util.ensureClosed(cos); Util.ensureClosed(bos); Util.ensureClosed(fos); } // Create a StoredFile database entry for this locally saved file. StoredFile storedFile = new StoredFile(); storedFile.setSourceUriOrPath(sourceUrl); storedFile.setLocalFilePath(localFilePath); storedFile.setMimeType(mimeType); return storedFile; }
java
public static StoredFile createLocalStoredFile(InputStream is, String sourceUrl, String localFilePath, String mimeType) { if (is == null) { return null; } // Copy the file contents over. CountingOutputStream cos = null; BufferedOutputStream bos = null; FileOutputStream fos = null; try { File localFile = new File(localFilePath); /* Local cache file name may not be unique, and can be reused, in which case, the previously created * cache file need to be deleted before it is being copied over. */ if (localFile.exists()) { localFile.delete(); } fos = new FileOutputStream(localFile); bos = new BufferedOutputStream(fos); cos = new CountingOutputStream(bos); byte[] buf = new byte[2048]; int count; while ((count = is.read(buf, 0, 2048)) != -1) { cos.write(buf, 0, count); } ApptentiveLog.v(UTIL, "File saved, size = " + (cos.getBytesWritten() / 1024) + "k"); } catch (IOException e) { ApptentiveLog.e(UTIL, "Error creating local copy of file attachment."); logException(e); return null; } finally { Util.ensureClosed(cos); Util.ensureClosed(bos); Util.ensureClosed(fos); } // Create a StoredFile database entry for this locally saved file. StoredFile storedFile = new StoredFile(); storedFile.setSourceUriOrPath(sourceUrl); storedFile.setLocalFilePath(localFilePath); storedFile.setMimeType(mimeType); return storedFile; }
[ "public", "static", "StoredFile", "createLocalStoredFile", "(", "InputStream", "is", ",", "String", "sourceUrl", ",", "String", "localFilePath", ",", "String", "mimeType", ")", "{", "if", "(", "is", "==", "null", ")", "{", "return", "null", ";", "}", "// Cop...
This method creates a cached file copy from the source input stream. @param is the source input stream @param sourceUrl the source file path or uri string @param localFilePath the cache file path string @param mimeType the mimeType of the source inputstream @return null if failed, otherwise a StoredFile object
[ "This", "method", "creates", "a", "cached", "file", "copy", "from", "the", "source", "input", "stream", "." ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L943-L985
virgo47/javasimon
core/src/main/java/org/javasimon/NullSimon.java
NullSimon.getAttribute
@Override public <T> T getAttribute(String name, Class<T> clazz) { return null; }
java
@Override public <T> T getAttribute(String name, Class<T> clazz) { return null; }
[ "@", "Override", "public", "<", "T", ">", "T", "getAttribute", "(", "String", "name", ",", "Class", "<", "T", ">", "clazz", ")", "{", "return", "null", ";", "}" ]
Returns {@code null}. @param name ignored @param clazz ignored @return {@code null}
[ "Returns", "{", "@code", "null", "}", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/NullSimon.java#L141-L144
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeTree.java
InodeTree.lockFullInodePath
public LockedInodePath lockFullInodePath(AlluxioURI uri, LockPattern lockPattern) throws InvalidPathException, FileDoesNotExistException { LockedInodePath inodePath = lockInodePath(uri, lockPattern); if (!inodePath.fullPathExists()) { inodePath.close(); throw new FileDoesNotExistException(ExceptionMessage.PATH_DOES_NOT_EXIST.getMessage(uri)); } return inodePath; }
java
public LockedInodePath lockFullInodePath(AlluxioURI uri, LockPattern lockPattern) throws InvalidPathException, FileDoesNotExistException { LockedInodePath inodePath = lockInodePath(uri, lockPattern); if (!inodePath.fullPathExists()) { inodePath.close(); throw new FileDoesNotExistException(ExceptionMessage.PATH_DOES_NOT_EXIST.getMessage(uri)); } return inodePath; }
[ "public", "LockedInodePath", "lockFullInodePath", "(", "AlluxioURI", "uri", ",", "LockPattern", "lockPattern", ")", "throws", "InvalidPathException", ",", "FileDoesNotExistException", "{", "LockedInodePath", "inodePath", "=", "lockInodePath", "(", "uri", ",", "lockPattern...
Locks a path and throws an exception if the path does not exist. @param uri a uri to lock @param lockPattern the pattern to lock with @return a locked inode path for the uri
[ "Locks", "a", "path", "and", "throws", "an", "exception", "if", "the", "path", "does", "not", "exist", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeTree.java#L372-L380
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbLists.java
TmdbLists.getList
public ListItem<MovieInfo> getList(String listId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, listId); URL url = new ApiUrl(apiKey, MethodBase.LIST).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, new TypeReference<ListItem<MovieInfo>>() { }); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get list", url, ex); } }
java
public ListItem<MovieInfo> getList(String listId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, listId); URL url = new ApiUrl(apiKey, MethodBase.LIST).buildUrl(parameters); String webpage = httpTools.getRequest(url); try { return MAPPER.readValue(webpage, new TypeReference<ListItem<MovieInfo>>() { }); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get list", url, ex); } }
[ "public", "ListItem", "<", "MovieInfo", ">", "getList", "(", "String", "listId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "lis...
Get a list by its ID @param listId @return The list and its items @throws MovieDbException
[ "Get", "a", "list", "by", "its", "ID" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbLists.java#L66-L79
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/store/Store.java
Store.getResource
public Resource getResource(final Instance _instance) throws EFapsException { Resource ret = null; try { Store.LOG.debug("Getting resource for: {} with properties: {}", this.resource, this.resourceProperties); ret = (Resource) Class.forName(this.resource).newInstance(); ret.initialize(_instance, this); } catch (final InstantiationException e) { throw new EFapsException(Store.class, "getResource.InstantiationException", e, this.resource); } catch (final IllegalAccessException e) { throw new EFapsException(Store.class, "getResource.IllegalAccessException", e, this.resource); } catch (final ClassNotFoundException e) { throw new EFapsException(Store.class, "getResource.ClassNotFoundException", e, this.resource); } return ret; }
java
public Resource getResource(final Instance _instance) throws EFapsException { Resource ret = null; try { Store.LOG.debug("Getting resource for: {} with properties: {}", this.resource, this.resourceProperties); ret = (Resource) Class.forName(this.resource).newInstance(); ret.initialize(_instance, this); } catch (final InstantiationException e) { throw new EFapsException(Store.class, "getResource.InstantiationException", e, this.resource); } catch (final IllegalAccessException e) { throw new EFapsException(Store.class, "getResource.IllegalAccessException", e, this.resource); } catch (final ClassNotFoundException e) { throw new EFapsException(Store.class, "getResource.ClassNotFoundException", e, this.resource); } return ret; }
[ "public", "Resource", "getResource", "(", "final", "Instance", "_instance", ")", "throws", "EFapsException", "{", "Resource", "ret", "=", "null", ";", "try", "{", "Store", ".", "LOG", ".", "debug", "(", "\"Getting resource for: {} with properties: {}\"", ",", "thi...
Method to get a instance of the resource. @param _instance instance the resource is wanted for @return Resource @throws EFapsException on error
[ "Method", "to", "get", "a", "instance", "of", "the", "resource", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/Store.java#L160-L176
protostuff/protostuff
protostuff-msgpack/src/main/java/io/protostuff/MsgpackXIOUtil.java
MsgpackXIOUtil.writeTo
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException { if (buffer.start != buffer.offset) { throw new IllegalArgumentException("Buffer previously used and had not been reset."); } MsgpackXOutput output = new MsgpackXOutput(buffer, numeric, schema); LinkedBuffer objectHeader = output.writeStartObject(); schema.writeTo(output, message); if (output.isLastRepeated()) { output.writeEndArray(); } output.writeEndObject(objectHeader); LinkedBuffer.writeTo(out, buffer); }
java
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema, boolean numeric, LinkedBuffer buffer) throws IOException { if (buffer.start != buffer.offset) { throw new IllegalArgumentException("Buffer previously used and had not been reset."); } MsgpackXOutput output = new MsgpackXOutput(buffer, numeric, schema); LinkedBuffer objectHeader = output.writeStartObject(); schema.writeTo(output, message); if (output.isLastRepeated()) { output.writeEndArray(); } output.writeEndObject(objectHeader); LinkedBuffer.writeTo(out, buffer); }
[ "public", "static", "<", "T", ">", "void", "writeTo", "(", "OutputStream", "out", ",", "T", "message", ",", "Schema", "<", "T", ">", "schema", ",", "boolean", "numeric", ",", "LinkedBuffer", "buffer", ")", "throws", "IOException", "{", "if", "(", "buffer...
Serializes the {@code message} into an {@link OutputStream} via {@link JsonXOutput} using the given {@code schema}.
[ "Serializes", "the", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-msgpack/src/main/java/io/protostuff/MsgpackXIOUtil.java#L111-L132
performancecopilot/parfait
parfait-agent/src/main/java/io/pcp/parfait/ParfaitAgent.java
ParfaitAgent.setupProperties
public static void setupProperties(String propertyAndValue, String separator) { String[] tokens = propertyAndValue.split(separator, 2); if (tokens.length == 2) { String name = MonitoringViewProperties.PARFAIT + "." + tokens[0]; String value = tokens[1]; System.setProperty(name, value); } }
java
public static void setupProperties(String propertyAndValue, String separator) { String[] tokens = propertyAndValue.split(separator, 2); if (tokens.length == 2) { String name = MonitoringViewProperties.PARFAIT + "." + tokens[0]; String value = tokens[1]; System.setProperty(name, value); } }
[ "public", "static", "void", "setupProperties", "(", "String", "propertyAndValue", ",", "String", "separator", ")", "{", "String", "[", "]", "tokens", "=", "propertyAndValue", ".", "split", "(", "separator", ",", "2", ")", ";", "if", "(", "tokens", ".", "le...
extract properties from arguments, properties files, or intuition
[ "extract", "properties", "from", "arguments", "properties", "files", "or", "intuition" ]
train
https://github.com/performancecopilot/parfait/blob/33ed3aaa96ee3e0ab4c45791a7bd3e5cd443e94b/parfait-agent/src/main/java/io/pcp/parfait/ParfaitAgent.java#L57-L64
scaleset/scaleset-geo
src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java
GoogleMapsTileMath.lngLatToMeters
public Coordinate lngLatToMeters(double lng, double lat) { double mx = lng * originShift / 180.0; double my = Math.log(Math.tan((90 + lat) * Math.PI / 360.0)) / (Math.PI / 180.0); my *= originShift / 180.0; return new Coordinate(mx, my); }
java
public Coordinate lngLatToMeters(double lng, double lat) { double mx = lng * originShift / 180.0; double my = Math.log(Math.tan((90 + lat) * Math.PI / 360.0)) / (Math.PI / 180.0); my *= originShift / 180.0; return new Coordinate(mx, my); }
[ "public", "Coordinate", "lngLatToMeters", "(", "double", "lng", ",", "double", "lat", ")", "{", "double", "mx", "=", "lng", "*", "originShift", "/", "180.0", ";", "double", "my", "=", "Math", ".", "log", "(", "Math", ".", "tan", "(", "(", "90", "+", ...
Converts given coordinate in WGS84 Datum to XY in Spherical Mercator EPSG:3857 @param lng the longitude of the coordinate @param lat the latitude of the coordinate @return The coordinate transformed to EPSG:3857
[ "Converts", "given", "coordinate", "in", "WGS84", "Datum", "to", "XY", "in", "Spherical", "Mercator", "EPSG", ":", "3857" ]
train
https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L79-L86
Netflix/servo
servo-core/src/main/java/com/netflix/servo/monitor/TimedInterface.java
TimedInterface.newProxy
public static <T> T newProxy(Class<T> ctype, T concrete) { return newProxy(ctype, concrete, null); }
java
public static <T> T newProxy(Class<T> ctype, T concrete) { return newProxy(ctype, concrete, null); }
[ "public", "static", "<", "T", ">", "T", "newProxy", "(", "Class", "<", "T", ">", "ctype", ",", "T", "concrete", ")", "{", "return", "newProxy", "(", "ctype", ",", "concrete", ",", "null", ")", ";", "}" ]
Creates a new TimedInterface for a given interface <code>ctype</code> with a concrete class <code>concrete</code>.
[ "Creates", "a", "new", "TimedInterface", "for", "a", "given", "interface", "<code", ">", "ctype<", "/", "code", ">", "with", "a", "concrete", "class", "<code", ">", "concrete<", "/", "code", ">", "." ]
train
https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/TimedInterface.java#L147-L149
appium/java-client
src/main/java/io/appium/java_client/ScreenshotState.java
ScreenshotState.verifyChanged
public ScreenshotState verifyChanged(Duration timeout, double minScore) { return checkState((x) -> x < minScore, timeout); }
java
public ScreenshotState verifyChanged(Duration timeout, double minScore) { return checkState((x) -> x < minScore, timeout); }
[ "public", "ScreenshotState", "verifyChanged", "(", "Duration", "timeout", ",", "double", "minScore", ")", "{", "return", "checkState", "(", "(", "x", ")", "-", ">", "x", "<", "minScore", ",", "timeout", ")", ";", "}" ]
Verifies whether the state of the screenshot provided by stateProvider lambda function is changed within the given timeout. @param timeout timeout value @param minScore the value in range (0.0, 1.0) @return self instance for chaining @throws ScreenshotComparisonTimeout if the calculated score is still greater or equal to the given score after timeout happens @throws ScreenshotComparisonError if {@link #remember()} method has not been invoked yet
[ "Verifies", "whether", "the", "state", "of", "the", "screenshot", "provided", "by", "stateProvider", "lambda", "function", "is", "changed", "within", "the", "given", "timeout", "." ]
train
https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/ScreenshotState.java#L186-L188
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/managers/GuildController.java
GuildController.createVoiceChannel
@CheckReturnValue public ChannelAction createVoiceChannel(String name) { checkPermission(Permission.MANAGE_CHANNEL); Checks.notBlank(name, "Name"); name = name.trim(); Checks.check(name.length() > 0 && name.length() <= 100, "Provided name must be 1 - 100 characters in length"); Route.CompiledRoute route = Route.Guilds.CREATE_CHANNEL.compile(getGuild().getId()); return new ChannelAction(route, name, getGuild(), ChannelType.VOICE); }
java
@CheckReturnValue public ChannelAction createVoiceChannel(String name) { checkPermission(Permission.MANAGE_CHANNEL); Checks.notBlank(name, "Name"); name = name.trim(); Checks.check(name.length() > 0 && name.length() <= 100, "Provided name must be 1 - 100 characters in length"); Route.CompiledRoute route = Route.Guilds.CREATE_CHANNEL.compile(getGuild().getId()); return new ChannelAction(route, name, getGuild(), ChannelType.VOICE); }
[ "@", "CheckReturnValue", "public", "ChannelAction", "createVoiceChannel", "(", "String", "name", ")", "{", "checkPermission", "(", "Permission", ".", "MANAGE_CHANNEL", ")", ";", "Checks", ".", "notBlank", "(", "name", ",", "\"Name\"", ")", ";", "name", "=", "n...
Creates a new {@link net.dv8tion.jda.core.entities.VoiceChannel VoiceChannel} in this Guild. For this to be successful, the logged in account has to have the {@link net.dv8tion.jda.core.Permission#MANAGE_CHANNEL MANAGE_CHANNEL} Permission. <p>Possible {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} caused by the returned {@link net.dv8tion.jda.core.requests.RestAction RestAction} include the following: <ul> <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} <br>The channel could not be created due to a permission discrepancy</li> <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} <br>We were removed from the Guild before finishing the task</li> </ul> @param name The name of the VoiceChannel to create @throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException If the logged in account does not have the {@link net.dv8tion.jda.core.Permission#MANAGE_CHANNEL} permission @throws IllegalArgumentException If the provided name is {@code null} or empty or greater than 100 characters in length @return A specific {@link net.dv8tion.jda.core.requests.restaction.ChannelAction ChannelAction} <br>This action allows to set fields for the new VoiceChannel before creating it
[ "Creates", "a", "new", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "VoiceChannel", "VoiceChannel", "}", "in", "this", "Guild", ".", "For", "this", "to", "be", "successful", "the", "logged", "in", "account", "has", ...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/managers/GuildController.java#L1797-L1808
OpenVidu/openvidu
openvidu-server/src/main/java/io/openvidu/server/core/SessionManager.java
SessionManager.getParticipant
public Participant getParticipant(String sessionId, String participantPrivateId) throws OpenViduException { Session session = sessions.get(sessionId); if (session == null) { throw new OpenViduException(Code.ROOM_NOT_FOUND_ERROR_CODE, "Session '" + sessionId + "' not found"); } Participant participant = session.getParticipantByPrivateId(participantPrivateId); if (participant == null) { throw new OpenViduException(Code.USER_NOT_FOUND_ERROR_CODE, "Participant '" + participantPrivateId + "' not found in session '" + sessionId + "'"); } return participant; }
java
public Participant getParticipant(String sessionId, String participantPrivateId) throws OpenViduException { Session session = sessions.get(sessionId); if (session == null) { throw new OpenViduException(Code.ROOM_NOT_FOUND_ERROR_CODE, "Session '" + sessionId + "' not found"); } Participant participant = session.getParticipantByPrivateId(participantPrivateId); if (participant == null) { throw new OpenViduException(Code.USER_NOT_FOUND_ERROR_CODE, "Participant '" + participantPrivateId + "' not found in session '" + sessionId + "'"); } return participant; }
[ "public", "Participant", "getParticipant", "(", "String", "sessionId", ",", "String", "participantPrivateId", ")", "throws", "OpenViduException", "{", "Session", "session", "=", "sessions", ".", "get", "(", "sessionId", ")", ";", "if", "(", "session", "==", "nul...
Returns a participant in a session @param sessionId identifier of the session @param participantPrivateId private identifier of the participant @return {@link Participant} @throws OpenViduException in case the session doesn't exist or the participant doesn't belong to it
[ "Returns", "a", "participant", "in", "a", "session" ]
train
https://github.com/OpenVidu/openvidu/blob/89db47dd37949ceab29e5228371a8fcab04d8d55/openvidu-server/src/main/java/io/openvidu/server/core/SessionManager.java#L188-L199
ralscha/wampspring
src/main/java/ch/rasc/wampspring/EventMessenger.java
EventMessenger.sendToDirect
public void sendToDirect(String topicURI, Object event, Set<String> webSocketSessionIds) { if (webSocketSessionIds != null) { for (String webSocketSessionId : webSocketSessionIds) { EventMessage eventMessage = new EventMessage(topicURI, event); eventMessage.setWebSocketSessionId(webSocketSessionId); sendDirect(eventMessage); } } }
java
public void sendToDirect(String topicURI, Object event, Set<String> webSocketSessionIds) { if (webSocketSessionIds != null) { for (String webSocketSessionId : webSocketSessionIds) { EventMessage eventMessage = new EventMessage(topicURI, event); eventMessage.setWebSocketSessionId(webSocketSessionId); sendDirect(eventMessage); } } }
[ "public", "void", "sendToDirect", "(", "String", "topicURI", ",", "Object", "event", ",", "Set", "<", "String", ">", "webSocketSessionIds", ")", "{", "if", "(", "webSocketSessionIds", "!=", "null", ")", "{", "for", "(", "String", "webSocketSessionId", ":", "...
Send an EventMessage directly to each client listed in the webSocketSessionId set parameter. If parameter webSocketSessionIds is null or empty no messages are sent. <p> In contrast to {@link #sendTo(String, Object, Set)} this method does not check if the receivers are subscribed to the destination. The {@link SimpleBrokerMessageHandler} is not involved in sending these messages. @param topicURI the name of the topic @param event the payload of the {@link EventMessage} @param webSocketSessionIds list of receivers for the EVENT message
[ "Send", "an", "EventMessage", "directly", "to", "each", "client", "listed", "in", "the", "webSocketSessionId", "set", "parameter", ".", "If", "parameter", "webSocketSessionIds", "is", "null", "or", "empty", "no", "messages", "are", "sent", ".", "<p", ">", "In"...
train
https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/EventMessenger.java#L149-L158
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/timeseries/Smoothing.java
Smoothing.simpleMovingAverageQuick
public static double simpleMovingAverageQuick(double Yt, double YtminusN, double Ft, int N) { double SMA=(Yt-YtminusN)/N+Ft; return SMA; }
java
public static double simpleMovingAverageQuick(double Yt, double YtminusN, double Ft, int N) { double SMA=(Yt-YtminusN)/N+Ft; return SMA; }
[ "public", "static", "double", "simpleMovingAverageQuick", "(", "double", "Yt", ",", "double", "YtminusN", ",", "double", "Ft", ",", "int", "N", ")", "{", "double", "SMA", "=", "(", "Yt", "-", "YtminusN", ")", "/", "N", "+", "Ft", ";", "return", "SMA", ...
Simple Moving Average: Calculates Ft+1 by using previous results. A quick version of the simpleMovingAverage @param Yt @param YtminusN @param Ft @param N @return
[ "Simple", "Moving", "Average", ":", "Calculates", "Ft", "+", "1", "by", "using", "previous", "results", ".", "A", "quick", "version", "of", "the", "simpleMovingAverage" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/timeseries/Smoothing.java#L61-L65
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java
QrCodeUtil.generate
public static File generate(String content, int width, int height, File targetFile) { final BufferedImage image = generate(content, width, height); ImgUtil.write(image, targetFile); return targetFile; }
java
public static File generate(String content, int width, int height, File targetFile) { final BufferedImage image = generate(content, width, height); ImgUtil.write(image, targetFile); return targetFile; }
[ "public", "static", "File", "generate", "(", "String", "content", ",", "int", "width", ",", "int", "height", ",", "File", "targetFile", ")", "{", "final", "BufferedImage", "image", "=", "generate", "(", "content", ",", "width", ",", "height", ")", ";", "...
生成二维码到文件,二维码图片格式取决于文件的扩展名 @param content 文本内容 @param width 宽度 @param height 高度 @param targetFile 目标文件,扩展名决定输出格式 @return 目标文件
[ "生成二维码到文件,二维码图片格式取决于文件的扩展名" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L76-L80
devcon5io/common
classutils/src/main/java/io/devcon5/classutils/ResourceResolver.java
ResourceResolver.resolvePath
private String resolvePath(final String resource, final Class consumer) { if(resource.startsWith("/")) { //absolute path return resource; } final StringBuilder buf = new StringBuilder(32); buf.append('/').append(consumer.getPackage().getName().replaceAll("\\.", "/")) .append('/').append(resource); return buf.toString(); }
java
private String resolvePath(final String resource, final Class consumer) { if(resource.startsWith("/")) { //absolute path return resource; } final StringBuilder buf = new StringBuilder(32); buf.append('/').append(consumer.getPackage().getName().replaceAll("\\.", "/")) .append('/').append(resource); return buf.toString(); }
[ "private", "String", "resolvePath", "(", "final", "String", "resource", ",", "final", "Class", "consumer", ")", "{", "if", "(", "resource", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "//absolute path", "return", "resource", ";", "}", "final", "StringBui...
Resolves a resource relative to a consumer class. If the resource path starts with a '/', it will be used as is, because it does not denote a relative path. If the resource path is a relative path, it will be resolved relative to the package of the consumer class. @param resource the path to the resource to resolve. It may be absolute or relative. @param consumer the consumer that denotes the base to resolve a relative path. @return an absolute path to the resource
[ "Resolves", "a", "resource", "relative", "to", "a", "consumer", "class", ".", "If", "the", "resource", "path", "starts", "with", "a", "/", "it", "will", "be", "used", "as", "is", "because", "it", "does", "not", "denote", "a", "relative", "path", ".", "...
train
https://github.com/devcon5io/common/blob/363688e0dc904d559682bf796bd6c836b4e0efc7/classutils/src/main/java/io/devcon5/classutils/ResourceResolver.java#L100-L110
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/util/OgnlUtil.java
OgnlUtil.parseExpression
public static Object parseExpression(String expression, String path, int lineNumber) { try { return Ognl.parseExpression(expression); } catch (Exception ex) { throw new OgnlRuntimeException(ex, path, lineNumber); } }
java
public static Object parseExpression(String expression, String path, int lineNumber) { try { return Ognl.parseExpression(expression); } catch (Exception ex) { throw new OgnlRuntimeException(ex, path, lineNumber); } }
[ "public", "static", "Object", "parseExpression", "(", "String", "expression", ",", "String", "path", ",", "int", "lineNumber", ")", "{", "try", "{", "return", "Ognl", ".", "parseExpression", "(", "expression", ")", ";", "}", "catch", "(", "Exception", "ex", ...
Parses an OGNL expression. @param expression the expression @param path the path @param lineNumber the line number @return a tree representation of the OGNL expression @throws OgnlRuntimeException when a {@link ognl.OgnlException} occurs
[ "Parses", "an", "OGNL", "expression", "." ]
train
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/OgnlUtil.java#L132-L138
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.optionalBooleanAttribute
public static boolean optionalBooleanAttribute( final XMLStreamReader reader, final String localName, final boolean defaultValue) { return optionalBooleanAttribute(reader, null, localName, defaultValue); }
java
public static boolean optionalBooleanAttribute( final XMLStreamReader reader, final String localName, final boolean defaultValue) { return optionalBooleanAttribute(reader, null, localName, defaultValue); }
[ "public", "static", "boolean", "optionalBooleanAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ",", "final", "boolean", "defaultValue", ")", "{", "return", "optionalBooleanAttribute", "(", "reader", ",", "null", ",", "loca...
Returns the value of an attribute as a boolean. If the attribute is empty, this method returns the default value provided. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @param defaultValue default value @return value of attribute, or the default value if the attribute is empty.
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "boolean", ".", "If", "the", "attribute", "is", "empty", "this", "method", "returns", "the", "default", "value", "provided", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L561-L566
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSupport.java
CompiledFEELSupport.compiledError
public static CompiledFEELExpression compiledError(String expression, String msg) { return new CompilerBytecodeLoader() .makeFromJPExpression( expression, compiledErrorExpression(msg), Collections.emptySet()); }
java
public static CompiledFEELExpression compiledError(String expression, String msg) { return new CompilerBytecodeLoader() .makeFromJPExpression( expression, compiledErrorExpression(msg), Collections.emptySet()); }
[ "public", "static", "CompiledFEELExpression", "compiledError", "(", "String", "expression", ",", "String", "msg", ")", "{", "return", "new", "CompilerBytecodeLoader", "(", ")", ".", "makeFromJPExpression", "(", "expression", ",", "compiledErrorExpression", "(", "msg",...
Generates a compilable class that reports a (compile-time) error at runtime
[ "Generates", "a", "compilable", "class", "that", "reports", "a", "(", "compile", "-", "time", ")", "error", "at", "runtime" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSupport.java#L464-L470
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseLibraryVisitor.java
ElmBaseLibraryVisitor.visitElement
@Override public T visitElement(Element elm, C context) { if (elm instanceof IncludeDef) return visitIncludeDef((IncludeDef)elm, context); else if (elm instanceof Library) return visitLibrary((Library)elm, context); else if (elm instanceof UsingDef) return visitUsingDef((UsingDef)elm, context); else return super.visitElement(elm, context); }
java
@Override public T visitElement(Element elm, C context) { if (elm instanceof IncludeDef) return visitIncludeDef((IncludeDef)elm, context); else if (elm instanceof Library) return visitLibrary((Library)elm, context); else if (elm instanceof UsingDef) return visitUsingDef((UsingDef)elm, context); else return super.visitElement(elm, context); }
[ "@", "Override", "public", "T", "visitElement", "(", "Element", "elm", ",", "C", "context", ")", "{", "if", "(", "elm", "instanceof", "IncludeDef", ")", "return", "visitIncludeDef", "(", "(", "IncludeDef", ")", "elm", ",", "context", ")", ";", "else", "i...
Visit an Element in an ELM tree. This method will be called for every node in the tree that is a descendant of the Element type. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "an", "Element", "in", "an", "ELM", "tree", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "descendant", "of", "the", "Element", "type", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseLibraryVisitor.java#L21-L27
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java
AptControlInterface.initEventSets
private ArrayList<AptEventSet> initEventSets() { ArrayList<AptEventSet> eventSets = new ArrayList<AptEventSet>(); if ( _intfDecl == null || _intfDecl.getNestedTypes() == null ) return eventSets; for (TypeDeclaration innerDecl : _intfDecl.getNestedTypes()) { // HACKHACK: There appear to be mirror API bugs where calling getAnnotation() // on certain entity types will result in an endless loop. For now, work around // this by a priori filtering... but this mechanism will drop errors that appear // on an inapropriate type (see check below) if (! (innerDecl instanceof InterfaceDeclaration)) continue; if (innerDecl.getAnnotation(EventSet.class) != null) { if (! (innerDecl instanceof InterfaceDeclaration)) { _ap.printError( innerDecl, "eventset.illegal.usage" ); } else { eventSets.add( new AptEventSet(this, (InterfaceDeclaration)innerDecl, _ap)); } } } return eventSets; }
java
private ArrayList<AptEventSet> initEventSets() { ArrayList<AptEventSet> eventSets = new ArrayList<AptEventSet>(); if ( _intfDecl == null || _intfDecl.getNestedTypes() == null ) return eventSets; for (TypeDeclaration innerDecl : _intfDecl.getNestedTypes()) { // HACKHACK: There appear to be mirror API bugs where calling getAnnotation() // on certain entity types will result in an endless loop. For now, work around // this by a priori filtering... but this mechanism will drop errors that appear // on an inapropriate type (see check below) if (! (innerDecl instanceof InterfaceDeclaration)) continue; if (innerDecl.getAnnotation(EventSet.class) != null) { if (! (innerDecl instanceof InterfaceDeclaration)) { _ap.printError( innerDecl, "eventset.illegal.usage" ); } else { eventSets.add( new AptEventSet(this, (InterfaceDeclaration)innerDecl, _ap)); } } } return eventSets; }
[ "private", "ArrayList", "<", "AptEventSet", ">", "initEventSets", "(", ")", "{", "ArrayList", "<", "AptEventSet", ">", "eventSets", "=", "new", "ArrayList", "<", "AptEventSet", ">", "(", ")", ";", "if", "(", "_intfDecl", "==", "null", "||", "_intfDecl", "....
Initializes the list of EventSets declared by this AptControlInterface
[ "Initializes", "the", "list", "of", "EventSets", "declared", "by", "this", "AptControlInterface" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L496-L527
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/ProjectiveInitializeAllCommon.java
ProjectiveInitializeAllCommon.initializeProjective3
private void initializeProjective3(FastQueue<AssociatedTriple> associated , FastQueue<AssociatedTripleIndex> associatedIdx , int totalViews, View viewA , View viewB , View viewC , int idxViewB , int idxViewC ) { ransac.process(associated.toList()); List<AssociatedTriple> inliers = ransac.getMatchSet(); TrifocalTensor model = ransac.getModelParameters(); if( verbose != null ) verbose.println("Remaining after RANSAC "+inliers.size()+" / "+associated.size()); // projective camera matrices for each view DMatrixRMaj P1 = CommonOps_DDRM.identity(3,4); DMatrixRMaj P2 = new DMatrixRMaj(3,4); DMatrixRMaj P3 = new DMatrixRMaj(3,4); MultiViewOps.extractCameraMatrices(model,P2,P3); // Initialize the 3D scene structure, stored in a format understood by bundle adjustment structure.initialize(totalViews,inliers.size()); // specify the found projective camera matrices db.lookupShape(viewA.id,shape); // The first view is assumed to be the coordinate system's origin and is identity by definition structure.setView(0,true, P1,shape.width,shape.height); db.lookupShape(viewB.id,shape); structure.setView(idxViewB,false,P2,shape.width,shape.height); db.lookupShape(viewC.id,shape); structure.setView(idxViewC,false,P3,shape.width,shape.height); // triangulate homogenous coordinates for each point in the inlier set triangulateFeatures(inliers, P1, P2, P3); // Update the list of common features by pruning features not in the inlier set seedToStructure.resize(viewA.totalFeatures); seedToStructure.fill(-1); // -1 indicates no match inlierToSeed.resize(inliers.size()); for (int i = 0; i < inliers.size(); i++) { int inputIdx = ransac.getInputIndex(i); // table to go from inlier list into seed feature index inlierToSeed.data[i] = matchesTripleIdx.get(inputIdx).a; // seed feature index into the ouptut structure index seedToStructure.data[inlierToSeed.data[i]] = i; } }
java
private void initializeProjective3(FastQueue<AssociatedTriple> associated , FastQueue<AssociatedTripleIndex> associatedIdx , int totalViews, View viewA , View viewB , View viewC , int idxViewB , int idxViewC ) { ransac.process(associated.toList()); List<AssociatedTriple> inliers = ransac.getMatchSet(); TrifocalTensor model = ransac.getModelParameters(); if( verbose != null ) verbose.println("Remaining after RANSAC "+inliers.size()+" / "+associated.size()); // projective camera matrices for each view DMatrixRMaj P1 = CommonOps_DDRM.identity(3,4); DMatrixRMaj P2 = new DMatrixRMaj(3,4); DMatrixRMaj P3 = new DMatrixRMaj(3,4); MultiViewOps.extractCameraMatrices(model,P2,P3); // Initialize the 3D scene structure, stored in a format understood by bundle adjustment structure.initialize(totalViews,inliers.size()); // specify the found projective camera matrices db.lookupShape(viewA.id,shape); // The first view is assumed to be the coordinate system's origin and is identity by definition structure.setView(0,true, P1,shape.width,shape.height); db.lookupShape(viewB.id,shape); structure.setView(idxViewB,false,P2,shape.width,shape.height); db.lookupShape(viewC.id,shape); structure.setView(idxViewC,false,P3,shape.width,shape.height); // triangulate homogenous coordinates for each point in the inlier set triangulateFeatures(inliers, P1, P2, P3); // Update the list of common features by pruning features not in the inlier set seedToStructure.resize(viewA.totalFeatures); seedToStructure.fill(-1); // -1 indicates no match inlierToSeed.resize(inliers.size()); for (int i = 0; i < inliers.size(); i++) { int inputIdx = ransac.getInputIndex(i); // table to go from inlier list into seed feature index inlierToSeed.data[i] = matchesTripleIdx.get(inputIdx).a; // seed feature index into the ouptut structure index seedToStructure.data[inlierToSeed.data[i]] = i; } }
[ "private", "void", "initializeProjective3", "(", "FastQueue", "<", "AssociatedTriple", ">", "associated", ",", "FastQueue", "<", "AssociatedTripleIndex", ">", "associatedIdx", ",", "int", "totalViews", ",", "View", "viewA", ",", "View", "viewB", ",", "View", "view...
Initializes projective reconstruction from 3-views. 1) RANSAC to fit a trifocal tensor 2) Extract camera matrices that have a common projective space 3) Triangulate location of 3D homogenous points @param associated List of associated pixels @param associatedIdx List of associated feature indexes
[ "Initializes", "projective", "reconstruction", "from", "3", "-", "views", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/ProjectiveInitializeAllCommon.java#L331-L377
hankcs/HanLP
src/main/java/com/hankcs/hanlp/seg/common/CWSEvaluator.java
CWSEvaluator.evaluate
public static CWSEvaluator.Result evaluate(Segment segment, String outputPath, String goldFile, String dictPath) throws IOException { IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(goldFile); BufferedWriter bw = IOUtil.newBufferedWriter(outputPath); for (String line : lineIterator) { List<Term> termList = segment.seg(line.replaceAll("\\s+", "")); // 一些testFile与goldFile根本不匹配,比如MSR的testFile有些行缺少单词,所以用goldFile去掉空格代替 int i = 0; for (Term term : termList) { bw.write(term.word); if (++i != termList.size()) bw.write(" "); } bw.newLine(); } bw.close(); CWSEvaluator.Result result = CWSEvaluator.evaluate(goldFile, outputPath, dictPath); return result; }
java
public static CWSEvaluator.Result evaluate(Segment segment, String outputPath, String goldFile, String dictPath) throws IOException { IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(goldFile); BufferedWriter bw = IOUtil.newBufferedWriter(outputPath); for (String line : lineIterator) { List<Term> termList = segment.seg(line.replaceAll("\\s+", "")); // 一些testFile与goldFile根本不匹配,比如MSR的testFile有些行缺少单词,所以用goldFile去掉空格代替 int i = 0; for (Term term : termList) { bw.write(term.word); if (++i != termList.size()) bw.write(" "); } bw.newLine(); } bw.close(); CWSEvaluator.Result result = CWSEvaluator.evaluate(goldFile, outputPath, dictPath); return result; }
[ "public", "static", "CWSEvaluator", ".", "Result", "evaluate", "(", "Segment", "segment", ",", "String", "outputPath", ",", "String", "goldFile", ",", "String", "dictPath", ")", "throws", "IOException", "{", "IOUtil", ".", "LineIterator", "lineIterator", "=", "n...
标准化评测分词器 @param segment 分词器 @param outputPath 分词预测输出文件 @param goldFile 测试集segmented file @param dictPath 训练集单词列表 @return 一个储存准确率的结构 @throws IOException
[ "标准化评测分词器" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/seg/common/CWSEvaluator.java#L191-L210
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/message/analytics/GenericAnalyticsRequest.java
GenericAnalyticsRequest.jsonQuery
public static GenericAnalyticsRequest jsonQuery(String jsonQuery, String bucket, String username, String password, int priority) { return new GenericAnalyticsRequest(jsonQuery, true, bucket, username, password, null, priority); }
java
public static GenericAnalyticsRequest jsonQuery(String jsonQuery, String bucket, String username, String password, int priority) { return new GenericAnalyticsRequest(jsonQuery, true, bucket, username, password, null, priority); }
[ "public", "static", "GenericAnalyticsRequest", "jsonQuery", "(", "String", "jsonQuery", ",", "String", "bucket", ",", "String", "username", ",", "String", "password", ",", "int", "priority", ")", "{", "return", "new", "GenericAnalyticsRequest", "(", "jsonQuery", "...
Create a {@link GenericAnalyticsRequest} and mark it as containing a full Analytics query in Json form (including additional query parameters). The simplest form of such a query is a single statement encapsulated in a json query object: <pre>{"statement":"SELECT * FROM default"}</pre>. @param jsonQuery the Analytics query in json form. @param bucket the bucket on which to perform the query. @param password the password for the target bucket. @return a {@link GenericAnalyticsRequest} for this full query.
[ "Create", "a", "{", "@link", "GenericAnalyticsRequest", "}", "and", "mark", "it", "as", "containing", "a", "full", "Analytics", "query", "in", "Json", "form", "(", "including", "additional", "query", "parameters", ")", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/analytics/GenericAnalyticsRequest.java#L116-L118
finmath/finmath-lib
src/main/java/net/finmath/fouriermethod/products/smile/EuropeanOptionSmile.java
EuropeanOptionSmile.getDescriptor
public SingleAssetEuropeanOptionProductDescriptor getDescriptor(LocalDate referenceDate, int index) throws ArrayIndexOutOfBoundsException{ LocalDate maturityDate = FloatingpointDate.getDateFromFloatingPointDate(referenceDate, maturity); if(index >= strikes.length) { throw new ArrayIndexOutOfBoundsException("Strike index out of bounds"); }else { return new SingleAssetEuropeanOptionProductDescriptor(underlyingName, maturityDate, strikes[index]); } }
java
public SingleAssetEuropeanOptionProductDescriptor getDescriptor(LocalDate referenceDate, int index) throws ArrayIndexOutOfBoundsException{ LocalDate maturityDate = FloatingpointDate.getDateFromFloatingPointDate(referenceDate, maturity); if(index >= strikes.length) { throw new ArrayIndexOutOfBoundsException("Strike index out of bounds"); }else { return new SingleAssetEuropeanOptionProductDescriptor(underlyingName, maturityDate, strikes[index]); } }
[ "public", "SingleAssetEuropeanOptionProductDescriptor", "getDescriptor", "(", "LocalDate", "referenceDate", ",", "int", "index", ")", "throws", "ArrayIndexOutOfBoundsException", "{", "LocalDate", "maturityDate", "=", "FloatingpointDate", ".", "getDateFromFloatingPointDate", "("...
Return a product descriptor for a specific strike. @param referenceDate The reference date (translating the maturity floating point date to dates. @param index The index corresponding to the strike grid. @return a product descriptor for a specific strike. @throws ArrayIndexOutOfBoundsException Thrown if index is out of bound.
[ "Return", "a", "product", "descriptor", "for", "a", "specific", "strike", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/fouriermethod/products/smile/EuropeanOptionSmile.java#L109-L116