repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
alkacon/opencms-core
src/org/opencms/relations/CmsLinkUpdateUtil.java
CmsLinkUpdateUtil.updateXmlForVfsFile
public static void updateXmlForVfsFile(CmsLink link, Element element) { """ Updates the given xml element with this link information.<p> @param link the link to get the information from @param element the &lt;link&gt; element to update """ // if element is not null if (element != null) { // update the type attribute updateAttribute(element, CmsLink.ATTRIBUTE_TYPE, link.getType().getNameForXml()); // update the sub-elements updateXml(link, element, false); } }
java
public static void updateXmlForVfsFile(CmsLink link, Element element) { // if element is not null if (element != null) { // update the type attribute updateAttribute(element, CmsLink.ATTRIBUTE_TYPE, link.getType().getNameForXml()); // update the sub-elements updateXml(link, element, false); } }
[ "public", "static", "void", "updateXmlForVfsFile", "(", "CmsLink", "link", ",", "Element", "element", ")", "{", "// if element is not null", "if", "(", "element", "!=", "null", ")", "{", "// update the type attribute", "updateAttribute", "(", "element", ",", "CmsLink", ".", "ATTRIBUTE_TYPE", ",", "link", ".", "getType", "(", ")", ".", "getNameForXml", "(", ")", ")", ";", "// update the sub-elements", "updateXml", "(", "link", ",", "element", ",", "false", ")", ";", "}", "}" ]
Updates the given xml element with this link information.<p> @param link the link to get the information from @param element the &lt;link&gt; element to update
[ "Updates", "the", "given", "xml", "element", "with", "this", "link", "information", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsLinkUpdateUtil.java#L109-L118
progolden/vraptor-boilerplate
vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/user/UserBS.java
UserBS.retrieveCompanyUser
public CompanyUser retrieveCompanyUser(User user, Company company) { """ Verificar se usuário é de uma determinada instituição. @param user Usuário para verificação. @param company Instituição para verificação. @return CompanyUser Instituição que pertence a determinado usuário. """ Criteria criteria = this.dao.newCriteria(CompanyUser.class); criteria.add(Restrictions.eq("company", company)); criteria.add(Restrictions.eq("user", user)); return (CompanyUser) criteria.uniqueResult(); }
java
public CompanyUser retrieveCompanyUser(User user, Company company) { Criteria criteria = this.dao.newCriteria(CompanyUser.class); criteria.add(Restrictions.eq("company", company)); criteria.add(Restrictions.eq("user", user)); return (CompanyUser) criteria.uniqueResult(); }
[ "public", "CompanyUser", "retrieveCompanyUser", "(", "User", "user", ",", "Company", "company", ")", "{", "Criteria", "criteria", "=", "this", ".", "dao", ".", "newCriteria", "(", "CompanyUser", ".", "class", ")", ";", "criteria", ".", "add", "(", "Restrictions", ".", "eq", "(", "\"company\"", ",", "company", ")", ")", ";", "criteria", ".", "add", "(", "Restrictions", ".", "eq", "(", "\"user\"", ",", "user", ")", ")", ";", "return", "(", "CompanyUser", ")", "criteria", ".", "uniqueResult", "(", ")", ";", "}" ]
Verificar se usuário é de uma determinada instituição. @param user Usuário para verificação. @param company Instituição para verificação. @return CompanyUser Instituição que pertence a determinado usuário.
[ "Verificar", "se", "usuário", "é", "de", "uma", "determinada", "instituição", "." ]
train
https://github.com/progolden/vraptor-boilerplate/blob/3edf45cc0dc5aec61b16ca326b4d72c82d1d3e07/vraptor-boilerplate-usercontrol/src/main/java/br/com/caelum/vraptor/boilerplate/user/UserBS.java#L252-L257
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java
PubSubManager.createNode
public Node createNode(String nodeId, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Creates a node with specified configuration. Note: This is the only way to create a collection node. @param nodeId The name of the node, which must be unique within the pubsub service @param config The configuration for the node @return The node that was created @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException """ PubSub request = PubSub.createPubsubPacket(pubSubService, Type.set, new NodeExtension(PubSubElementType.CREATE, nodeId)); boolean isLeafNode = true; if (config != null) { request.addExtension(new FormNode(FormNodeType.CONFIGURE, config)); FormField nodeTypeField = config.getField(ConfigureNodeFields.node_type.getFieldName()); if (nodeTypeField != null) isLeafNode = nodeTypeField.getValues().get(0).toString().equals(NodeType.leaf.toString()); } // Errors will cause exceptions in getReply, so it only returns // on success. sendPubsubPacket(request); Node newNode = isLeafNode ? new LeafNode(this, nodeId) : new CollectionNode(this, nodeId); nodeMap.put(newNode.getId(), newNode); return newNode; }
java
public Node createNode(String nodeId, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub request = PubSub.createPubsubPacket(pubSubService, Type.set, new NodeExtension(PubSubElementType.CREATE, nodeId)); boolean isLeafNode = true; if (config != null) { request.addExtension(new FormNode(FormNodeType.CONFIGURE, config)); FormField nodeTypeField = config.getField(ConfigureNodeFields.node_type.getFieldName()); if (nodeTypeField != null) isLeafNode = nodeTypeField.getValues().get(0).toString().equals(NodeType.leaf.toString()); } // Errors will cause exceptions in getReply, so it only returns // on success. sendPubsubPacket(request); Node newNode = isLeafNode ? new LeafNode(this, nodeId) : new CollectionNode(this, nodeId); nodeMap.put(newNode.getId(), newNode); return newNode; }
[ "public", "Node", "createNode", "(", "String", "nodeId", ",", "Form", "config", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "PubSub", "request", "=", "PubSub", ".", "createPubsubPacket", "(", "pubSubService", ",", "Type", ".", "set", ",", "new", "NodeExtension", "(", "PubSubElementType", ".", "CREATE", ",", "nodeId", ")", ")", ";", "boolean", "isLeafNode", "=", "true", ";", "if", "(", "config", "!=", "null", ")", "{", "request", ".", "addExtension", "(", "new", "FormNode", "(", "FormNodeType", ".", "CONFIGURE", ",", "config", ")", ")", ";", "FormField", "nodeTypeField", "=", "config", ".", "getField", "(", "ConfigureNodeFields", ".", "node_type", ".", "getFieldName", "(", ")", ")", ";", "if", "(", "nodeTypeField", "!=", "null", ")", "isLeafNode", "=", "nodeTypeField", ".", "getValues", "(", ")", ".", "get", "(", "0", ")", ".", "toString", "(", ")", ".", "equals", "(", "NodeType", ".", "leaf", ".", "toString", "(", ")", ")", ";", "}", "// Errors will cause exceptions in getReply, so it only returns", "// on success.", "sendPubsubPacket", "(", "request", ")", ";", "Node", "newNode", "=", "isLeafNode", "?", "new", "LeafNode", "(", "this", ",", "nodeId", ")", ":", "new", "CollectionNode", "(", "this", ",", "nodeId", ")", ";", "nodeMap", ".", "put", "(", "newNode", ".", "getId", "(", ")", ",", "newNode", ")", ";", "return", "newNode", ";", "}" ]
Creates a node with specified configuration. Note: This is the only way to create a collection node. @param nodeId The name of the node, which must be unique within the pubsub service @param config The configuration for the node @return The node that was created @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Creates", "a", "node", "with", "specified", "configuration", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java#L236-L255
FINRAOS/JTAF-ExtWebDriver
src/main/java/org/finra/jtaf/ewd/session/SessionManager.java
SessionManager.getNewSession
public ExtWebDriver getNewSession(String key, String value, boolean setAsCurrent) throws Exception { """ Create and return a new ExtWebDriver instance. The instance is constructed with default options, with the provided key/value pair overriding the corresponding key and value in the options. This is a convenience method for use when only a single option needs to be overridden. If overriding multiple options, you must use getNewSession(string-string Map, boolean) instead. @param key The key whose default value will be overridden @param value The value to be associated with the provided key @param setAsCurrent set to true if the new session should become the current session for this SessionManager @return A new ExtWebDriver instance @throws Exception """ /** * This is where the clientPropertiesFile is parsed and key-value pairs * are added into the options map */ Map<String, String> options = sessionFactory.get().createDefaultOptions(); options.put(key, value); return getNewSessionDo(options, setAsCurrent); }
java
public ExtWebDriver getNewSession(String key, String value, boolean setAsCurrent) throws Exception { /** * This is where the clientPropertiesFile is parsed and key-value pairs * are added into the options map */ Map<String, String> options = sessionFactory.get().createDefaultOptions(); options.put(key, value); return getNewSessionDo(options, setAsCurrent); }
[ "public", "ExtWebDriver", "getNewSession", "(", "String", "key", ",", "String", "value", ",", "boolean", "setAsCurrent", ")", "throws", "Exception", "{", "/**\n * This is where the clientPropertiesFile is parsed and key-value pairs\n * are added into the options map\n */", "Map", "<", "String", ",", "String", ">", "options", "=", "sessionFactory", ".", "get", "(", ")", ".", "createDefaultOptions", "(", ")", ";", "options", ".", "put", "(", "key", ",", "value", ")", ";", "return", "getNewSessionDo", "(", "options", ",", "setAsCurrent", ")", ";", "}" ]
Create and return a new ExtWebDriver instance. The instance is constructed with default options, with the provided key/value pair overriding the corresponding key and value in the options. This is a convenience method for use when only a single option needs to be overridden. If overriding multiple options, you must use getNewSession(string-string Map, boolean) instead. @param key The key whose default value will be overridden @param value The value to be associated with the provided key @param setAsCurrent set to true if the new session should become the current session for this SessionManager @return A new ExtWebDriver instance @throws Exception
[ "Create", "and", "return", "a", "new", "ExtWebDriver", "instance", ".", "The", "instance", "is", "constructed", "with", "default", "options", "with", "the", "provided", "key", "/", "value", "pair", "overriding", "the", "corresponding", "key", "and", "value", "in", "the", "options", ".", "This", "is", "a", "convenience", "method", "for", "use", "when", "only", "a", "single", "option", "needs", "to", "be", "overridden", ".", "If", "overriding", "multiple", "options", "you", "must", "use", "getNewSession", "(", "string", "-", "string", "Map", "boolean", ")", "instead", "." ]
train
https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/session/SessionManager.java#L293-L304
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java
Node.getAffiliations
public List<Affiliation> getAffiliations(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Get the affiliations of this node. <p> {@code additionalExtensions} can be used e.g. to add a "Result Set Management" extension. {@code returnedExtensions} will be filled with the stanza extensions found in the answer. </p> @param additionalExtensions additional {@code PacketExtensions} add to the request @param returnedExtensions a collection that will be filled with the returned packet extensions @return List of {@link Affiliation} @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException """ return getAffiliations(AffiliationNamespace.basic, additionalExtensions, returnedExtensions); }
java
public List<Affiliation> getAffiliations(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { return getAffiliations(AffiliationNamespace.basic, additionalExtensions, returnedExtensions); }
[ "public", "List", "<", "Affiliation", ">", "getAffiliations", "(", "List", "<", "ExtensionElement", ">", "additionalExtensions", ",", "Collection", "<", "ExtensionElement", ">", "returnedExtensions", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "return", "getAffiliations", "(", "AffiliationNamespace", ".", "basic", ",", "additionalExtensions", ",", "returnedExtensions", ")", ";", "}" ]
Get the affiliations of this node. <p> {@code additionalExtensions} can be used e.g. to add a "Result Set Management" extension. {@code returnedExtensions} will be filled with the stanza extensions found in the answer. </p> @param additionalExtensions additional {@code PacketExtensions} add to the request @param returnedExtensions a collection that will be filled with the returned packet extensions @return List of {@link Affiliation} @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException
[ "Get", "the", "affiliations", "of", "this", "node", ".", "<p", ">", "{", "@code", "additionalExtensions", "}", "can", "be", "used", "e", ".", "g", ".", "to", "add", "a", "Result", "Set", "Management", "extension", ".", "{", "@code", "returnedExtensions", "}", "will", "be", "filled", "with", "the", "stanza", "extensions", "found", "in", "the", "answer", ".", "<", "/", "p", ">" ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L278-L282
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/msg/MsgChecker.java
MsgChecker.checkPointListChild
public void checkPointListChild(ValidationData param, ValidationRule rule, Object bodyObj, Object standardValue) { """ Check point list child. @param param the param @param rule the rule @param bodyObj the body obj @param standardValue the standard value """ ValidationData listParent = param.findListParent(); List list = (List) listParent.getValue(bodyObj); if (list == null || list.isEmpty()) { return; } list.stream().forEach(item -> { this.checkPoint(param, rule, item, standardValue); }); }
java
public void checkPointListChild(ValidationData param, ValidationRule rule, Object bodyObj, Object standardValue) { ValidationData listParent = param.findListParent(); List list = (List) listParent.getValue(bodyObj); if (list == null || list.isEmpty()) { return; } list.stream().forEach(item -> { this.checkPoint(param, rule, item, standardValue); }); }
[ "public", "void", "checkPointListChild", "(", "ValidationData", "param", ",", "ValidationRule", "rule", ",", "Object", "bodyObj", ",", "Object", "standardValue", ")", "{", "ValidationData", "listParent", "=", "param", ".", "findListParent", "(", ")", ";", "List", "list", "=", "(", "List", ")", "listParent", ".", "getValue", "(", "bodyObj", ")", ";", "if", "(", "list", "==", "null", "||", "list", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "list", ".", "stream", "(", ")", ".", "forEach", "(", "item", "->", "{", "this", ".", "checkPoint", "(", "param", ",", "rule", ",", "item", ",", "standardValue", ")", ";", "}", ")", ";", "}" ]
Check point list child. @param param the param @param rule the rule @param bodyObj the body obj @param standardValue the standard value
[ "Check", "point", "list", "child", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/msg/MsgChecker.java#L86-L97
buschmais/jqa-core-framework
report/src/main/java/com/buschmais/jqassistant/core/report/api/ReportHelper.java
ReportHelper.verifyConstraintResults
public int verifyConstraintResults(Severity warnOnSeverity, Severity failOnSeverity, InMemoryReportPlugin inMemoryReportWriter) { """ Verifies the constraint results returned by the {@link InMemoryReportPlugin} . @param warnOnSeverity The severity threshold to warn. @param failOnSeverity The severity threshold to fail. @param inMemoryReportWriter The {@link InMemoryReportPlugin} @return The number of failed concepts, i.e. for breaking the build if higher than 0. """ Collection<Result<Constraint>> constraintResults = inMemoryReportWriter.getConstraintResults().values(); return verifyRuleResults(constraintResults, warnOnSeverity, failOnSeverity, "Constraint", CONSTRAINT_VIOLATION_HEADER, true); }
java
public int verifyConstraintResults(Severity warnOnSeverity, Severity failOnSeverity, InMemoryReportPlugin inMemoryReportWriter) { Collection<Result<Constraint>> constraintResults = inMemoryReportWriter.getConstraintResults().values(); return verifyRuleResults(constraintResults, warnOnSeverity, failOnSeverity, "Constraint", CONSTRAINT_VIOLATION_HEADER, true); }
[ "public", "int", "verifyConstraintResults", "(", "Severity", "warnOnSeverity", ",", "Severity", "failOnSeverity", ",", "InMemoryReportPlugin", "inMemoryReportWriter", ")", "{", "Collection", "<", "Result", "<", "Constraint", ">>", "constraintResults", "=", "inMemoryReportWriter", ".", "getConstraintResults", "(", ")", ".", "values", "(", ")", ";", "return", "verifyRuleResults", "(", "constraintResults", ",", "warnOnSeverity", ",", "failOnSeverity", ",", "\"Constraint\"", ",", "CONSTRAINT_VIOLATION_HEADER", ",", "true", ")", ";", "}" ]
Verifies the constraint results returned by the {@link InMemoryReportPlugin} . @param warnOnSeverity The severity threshold to warn. @param failOnSeverity The severity threshold to fail. @param inMemoryReportWriter The {@link InMemoryReportPlugin} @return The number of failed concepts, i.e. for breaking the build if higher than 0.
[ "Verifies", "the", "constraint", "results", "returned", "by", "the", "{", "@link", "InMemoryReportPlugin", "}", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/api/ReportHelper.java#L79-L82
hal/elemento
core/src/main/java/org/jboss/gwt/elemento/core/Elements.java
Elements.lazyAppend
public static void lazyAppend(Element parent, Element child) { """ Appends the specified element to the parent element if not already present. If parent already contains child, this method does nothing. """ if (!parent.contains(child)) { parent.appendChild(child); } }
java
public static void lazyAppend(Element parent, Element child) { if (!parent.contains(child)) { parent.appendChild(child); } }
[ "public", "static", "void", "lazyAppend", "(", "Element", "parent", ",", "Element", "child", ")", "{", "if", "(", "!", "parent", ".", "contains", "(", "child", ")", ")", "{", "parent", ".", "appendChild", "(", "child", ")", ";", "}", "}" ]
Appends the specified element to the parent element if not already present. If parent already contains child, this method does nothing.
[ "Appends", "the", "specified", "element", "to", "the", "parent", "element", "if", "not", "already", "present", ".", "If", "parent", "already", "contains", "child", "this", "method", "does", "nothing", "." ]
train
https://github.com/hal/elemento/blob/26da2d5a1fe2ec55b779737dbaeda25a942eee61/core/src/main/java/org/jboss/gwt/elemento/core/Elements.java#L648-L652
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java
ProfileSummaryBuilder.buildAnnotationTypeSummary
public void buildAnnotationTypeSummary(XMLNode node, Content packageSummaryContentTree) { """ Build the summary for the annotation type in the package. @param node the XML element that specifies which components to document @param packageSummaryContentTree the tree to which the annotation type summary will be added """ String annotationtypeTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Annotation_Types_Summary"), configuration.getText("doclet.annotationtypes")); String[] annotationtypeTableHeader = new String[] { configuration.getText("doclet.AnnotationType"), configuration.getText("doclet.Description") }; ClassDoc[] annotationTypes = pkg.annotationTypes(); if (annotationTypes.length > 0) { profileWriter.addClassesSummary( annotationTypes, configuration.getText("doclet.Annotation_Types_Summary"), annotationtypeTableSummary, annotationtypeTableHeader, packageSummaryContentTree); } }
java
public void buildAnnotationTypeSummary(XMLNode node, Content packageSummaryContentTree) { String annotationtypeTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Annotation_Types_Summary"), configuration.getText("doclet.annotationtypes")); String[] annotationtypeTableHeader = new String[] { configuration.getText("doclet.AnnotationType"), configuration.getText("doclet.Description") }; ClassDoc[] annotationTypes = pkg.annotationTypes(); if (annotationTypes.length > 0) { profileWriter.addClassesSummary( annotationTypes, configuration.getText("doclet.Annotation_Types_Summary"), annotationtypeTableSummary, annotationtypeTableHeader, packageSummaryContentTree); } }
[ "public", "void", "buildAnnotationTypeSummary", "(", "XMLNode", "node", ",", "Content", "packageSummaryContentTree", ")", "{", "String", "annotationtypeTableSummary", "=", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "configuration", ".", "getText", "(", "\"doclet.Annotation_Types_Summary\"", ")", ",", "configuration", ".", "getText", "(", "\"doclet.annotationtypes\"", ")", ")", ";", "String", "[", "]", "annotationtypeTableHeader", "=", "new", "String", "[", "]", "{", "configuration", ".", "getText", "(", "\"doclet.AnnotationType\"", ")", ",", "configuration", ".", "getText", "(", "\"doclet.Description\"", ")", "}", ";", "ClassDoc", "[", "]", "annotationTypes", "=", "pkg", ".", "annotationTypes", "(", ")", ";", "if", "(", "annotationTypes", ".", "length", ">", "0", ")", "{", "profileWriter", ".", "addClassesSummary", "(", "annotationTypes", ",", "configuration", ".", "getText", "(", "\"doclet.Annotation_Types_Summary\"", ")", ",", "annotationtypeTableSummary", ",", "annotationtypeTableHeader", ",", "packageSummaryContentTree", ")", ";", "}", "}" ]
Build the summary for the annotation type in the package. @param node the XML element that specifies which components to document @param packageSummaryContentTree the tree to which the annotation type summary will be added
[ "Build", "the", "summary", "for", "the", "annotation", "type", "in", "the", "package", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java#L310-L327
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java
SimpleRandomSampling.minimumSampleSizeForGivenDandMaximumRisk
public static int minimumSampleSizeForGivenDandMaximumRisk(double d, double aLevel, double populationStd) { """ Returns the minimum required sample size when we set a predifined limit d and a maximum probability Risk a for infinite population size @param d @param aLevel @param populationStd @return """ return minimumSampleSizeForGivenDandMaximumRisk(d, aLevel, populationStd, Integer.MAX_VALUE); }
java
public static int minimumSampleSizeForGivenDandMaximumRisk(double d, double aLevel, double populationStd) { return minimumSampleSizeForGivenDandMaximumRisk(d, aLevel, populationStd, Integer.MAX_VALUE); }
[ "public", "static", "int", "minimumSampleSizeForGivenDandMaximumRisk", "(", "double", "d", ",", "double", "aLevel", ",", "double", "populationStd", ")", "{", "return", "minimumSampleSizeForGivenDandMaximumRisk", "(", "d", ",", "aLevel", ",", "populationStd", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Returns the minimum required sample size when we set a predifined limit d and a maximum probability Risk a for infinite population size @param d @param aLevel @param populationStd @return
[ "Returns", "the", "minimum", "required", "sample", "size", "when", "we", "set", "a", "predifined", "limit", "d", "and", "a", "maximum", "probability", "Risk", "a", "for", "infinite", "population", "size" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L283-L285
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Table.java
Table.createGSI
public Index createGSI( CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition, AttributeDefinition rangeKeyDefinition) { """ Creates a global secondary index (GSI) with both a hash key and a range key on this table. Involves network calls. This table must be in the <code>ACTIVE</code> state for this operation to succeed. Creating a global secondary index is an asynchronous operation; while executing the operation, the index is in the <code>CREATING</code> state. Once created, the index will be in <code>ACTIVE</code> state. @param create used to specify the details of the index creation @param hashKeyDefinition used to specify the attribute for describing the key schema for the hash key of the GSI to be created for this table. @param rangeKeyDefinition used to specify the attribute for describing the key schema for the range key of the GSI to be created for this table. @return the index being created """ return doCreateGSI(create, hashKeyDefinition, rangeKeyDefinition); }
java
public Index createGSI( CreateGlobalSecondaryIndexAction create, AttributeDefinition hashKeyDefinition, AttributeDefinition rangeKeyDefinition) { return doCreateGSI(create, hashKeyDefinition, rangeKeyDefinition); }
[ "public", "Index", "createGSI", "(", "CreateGlobalSecondaryIndexAction", "create", ",", "AttributeDefinition", "hashKeyDefinition", ",", "AttributeDefinition", "rangeKeyDefinition", ")", "{", "return", "doCreateGSI", "(", "create", ",", "hashKeyDefinition", ",", "rangeKeyDefinition", ")", ";", "}" ]
Creates a global secondary index (GSI) with both a hash key and a range key on this table. Involves network calls. This table must be in the <code>ACTIVE</code> state for this operation to succeed. Creating a global secondary index is an asynchronous operation; while executing the operation, the index is in the <code>CREATING</code> state. Once created, the index will be in <code>ACTIVE</code> state. @param create used to specify the details of the index creation @param hashKeyDefinition used to specify the attribute for describing the key schema for the hash key of the GSI to be created for this table. @param rangeKeyDefinition used to specify the attribute for describing the key schema for the range key of the GSI to be created for this table. @return the index being created
[ "Creates", "a", "global", "secondary", "index", "(", "GSI", ")", "with", "both", "a", "hash", "key", "and", "a", "range", "key", "on", "this", "table", ".", "Involves", "network", "calls", ".", "This", "table", "must", "be", "in", "the", "<code", ">", "ACTIVE<", "/", "code", ">", "state", "for", "this", "operation", "to", "succeed", ".", "Creating", "a", "global", "secondary", "index", "is", "an", "asynchronous", "operation", ";", "while", "executing", "the", "operation", "the", "index", "is", "in", "the", "<code", ">", "CREATING<", "/", "code", ">", "state", ".", "Once", "created", "the", "index", "will", "be", "in", "<code", ">", "ACTIVE<", "/", "code", ">", "state", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Table.java#L416-L421
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyCollection.java
PropertyCollection.getValue
public int getValue(String name, String[] choices) { """ Returns the index of a property value as it occurs in the choice list. @param name Property name. @param choices Array of possible choice values. The first entry is assumed to be the default. @return Index of the property value in the choices array. Returns 0 if not found. """ String val = getValue(name, ""); int index = Arrays.asList(choices).indexOf(val); return index == -1 ? 0 : index; }
java
public int getValue(String name, String[] choices) { String val = getValue(name, ""); int index = Arrays.asList(choices).indexOf(val); return index == -1 ? 0 : index; }
[ "public", "int", "getValue", "(", "String", "name", ",", "String", "[", "]", "choices", ")", "{", "String", "val", "=", "getValue", "(", "name", ",", "\"\"", ")", ";", "int", "index", "=", "Arrays", ".", "asList", "(", "choices", ")", ".", "indexOf", "(", "val", ")", ";", "return", "index", "==", "-", "1", "?", "0", ":", "index", ";", "}" ]
Returns the index of a property value as it occurs in the choice list. @param name Property name. @param choices Array of possible choice values. The first entry is assumed to be the default. @return Index of the property value in the choices array. Returns 0 if not found.
[ "Returns", "the", "index", "of", "a", "property", "value", "as", "it", "occurs", "in", "the", "choice", "list", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/property/PropertyCollection.java#L133-L137
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
Assert.notEmpty
public static <T> Collection<T> notEmpty(Collection<T> collection) throws IllegalArgumentException { """ 断言给定集合非空 <pre class="code"> Assert.notEmpty(collection); </pre> @param <T> 集合元素类型 @param collection 被检查的集合 @return 被检查集合 @throws IllegalArgumentException if the collection is {@code null} or has no elements """ return notEmpty(collection, "[Assertion failed] - this collection must not be empty: it must contain at least 1 element"); }
java
public static <T> Collection<T> notEmpty(Collection<T> collection) throws IllegalArgumentException { return notEmpty(collection, "[Assertion failed] - this collection must not be empty: it must contain at least 1 element"); }
[ "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "notEmpty", "(", "Collection", "<", "T", ">", "collection", ")", "throws", "IllegalArgumentException", "{", "return", "notEmpty", "(", "collection", ",", "\"[Assertion failed] - this collection must not be empty: it must contain at least 1 element\"", ")", ";", "}" ]
断言给定集合非空 <pre class="code"> Assert.notEmpty(collection); </pre> @param <T> 集合元素类型 @param collection 被检查的集合 @return 被检查集合 @throws IllegalArgumentException if the collection is {@code null} or has no elements
[ "断言给定集合非空" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L370-L372
GerdHolz/TOVAL
src/de/invation/code/toval/os/SolarisUtils.java
SolarisUtils.registerFileExtension
@Override public boolean registerFileExtension(String fileTypeName, String fileTypeExtension, String application) throws OSException { """ Registers a new file extension in the operating system. @param fileTypeName Name of the file extension. Must be atomic, e.g. <code>foocorp.fooapp.v1</code>. @param fileTypeExtension File extension with leading dot, e.g. <code>.bar</code>. @param application Path to the application, which should open the new file extension. @return <code>true</code> if registration was successful, <code>false</code> otherwise. @throws OSException """ throw new UnsupportedOperationException("Not supported yet."); }
java
@Override public boolean registerFileExtension(String fileTypeName, String fileTypeExtension, String application) throws OSException { throw new UnsupportedOperationException("Not supported yet."); }
[ "@", "Override", "public", "boolean", "registerFileExtension", "(", "String", "fileTypeName", ",", "String", "fileTypeExtension", ",", "String", "application", ")", "throws", "OSException", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Not supported yet.\"", ")", ";", "}" ]
Registers a new file extension in the operating system. @param fileTypeName Name of the file extension. Must be atomic, e.g. <code>foocorp.fooapp.v1</code>. @param fileTypeExtension File extension with leading dot, e.g. <code>.bar</code>. @param application Path to the application, which should open the new file extension. @return <code>true</code> if registration was successful, <code>false</code> otherwise. @throws OSException
[ "Registers", "a", "new", "file", "extension", "in", "the", "operating", "system", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/os/SolarisUtils.java#L118-L121
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularTools_F64.java
EquirectangularTools_F64.latlonToEqui
public void latlonToEqui(double lat, double lon, Point2D_F64 rect) { """ Convert from latitude-longitude coordinates into equirectangular coordinates @param lat Latitude @param lon Longitude @param rect (Output) equirectangular coordinate """ rect.x = UtilAngle.wrapZeroToOne(lon / GrlConstants.PI2 + 0.5)*width; rect.y = UtilAngle.reflectZeroToOne(lat / GrlConstants.PI + 0.5)*(height-1); }
java
public void latlonToEqui(double lat, double lon, Point2D_F64 rect) { rect.x = UtilAngle.wrapZeroToOne(lon / GrlConstants.PI2 + 0.5)*width; rect.y = UtilAngle.reflectZeroToOne(lat / GrlConstants.PI + 0.5)*(height-1); }
[ "public", "void", "latlonToEqui", "(", "double", "lat", ",", "double", "lon", ",", "Point2D_F64", "rect", ")", "{", "rect", ".", "x", "=", "UtilAngle", ".", "wrapZeroToOne", "(", "lon", "/", "GrlConstants", ".", "PI2", "+", "0.5", ")", "*", "width", ";", "rect", ".", "y", "=", "UtilAngle", ".", "reflectZeroToOne", "(", "lat", "/", "GrlConstants", ".", "PI", "+", "0.5", ")", "*", "(", "height", "-", "1", ")", ";", "}" ]
Convert from latitude-longitude coordinates into equirectangular coordinates @param lat Latitude @param lon Longitude @param rect (Output) equirectangular coordinate
[ "Convert", "from", "latitude", "-", "longitude", "coordinates", "into", "equirectangular", "coordinates" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/spherical/EquirectangularTools_F64.java#L145-L148
apache/fluo-recipes
modules/kryo/src/main/java/org/apache/fluo/recipes/kryo/KryoSimplerSerializer.java
KryoSimplerSerializer.setKryoFactory
public static void setKryoFactory(FluoConfiguration config, String factoryType) { """ Call this to configure a KryoFactory type before initializing Fluo. """ config.getAppConfiguration().setProperty(KRYO_FACTORY_PROP, factoryType); }
java
public static void setKryoFactory(FluoConfiguration config, String factoryType) { config.getAppConfiguration().setProperty(KRYO_FACTORY_PROP, factoryType); }
[ "public", "static", "void", "setKryoFactory", "(", "FluoConfiguration", "config", ",", "String", "factoryType", ")", "{", "config", ".", "getAppConfiguration", "(", ")", ".", "setProperty", "(", "KRYO_FACTORY_PROP", ",", "factoryType", ")", ";", "}" ]
Call this to configure a KryoFactory type before initializing Fluo.
[ "Call", "this", "to", "configure", "a", "KryoFactory", "type", "before", "initializing", "Fluo", "." ]
train
https://github.com/apache/fluo-recipes/blob/24c11234c9654b16d999437ff49ddc3db86665f8/modules/kryo/src/main/java/org/apache/fluo/recipes/kryo/KryoSimplerSerializer.java#L117-L119
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/model/LineSegment.java
LineSegment.intersectsRectangle
public boolean intersectsRectangle(Rectangle r, boolean bias) { """ Returns a fast computation if the line intersects the rectangle or bias if there is no fast way to compute the intersection. @param r retangle to test @param bias the result if no fast computation is possible @return either the fast and correct result or the bias (which might be wrong). """ int codeStart = code(r, this.start); int codeEnd = code(r, this.end); if (0 == (codeStart | codeEnd)) { // both points are inside, trivial case return true; } else if (0 != (codeStart & codeEnd)) { // both points are either below, above, left or right of the box, no intersection return false; } return bias; }
java
public boolean intersectsRectangle(Rectangle r, boolean bias) { int codeStart = code(r, this.start); int codeEnd = code(r, this.end); if (0 == (codeStart | codeEnd)) { // both points are inside, trivial case return true; } else if (0 != (codeStart & codeEnd)) { // both points are either below, above, left or right of the box, no intersection return false; } return bias; }
[ "public", "boolean", "intersectsRectangle", "(", "Rectangle", "r", ",", "boolean", "bias", ")", "{", "int", "codeStart", "=", "code", "(", "r", ",", "this", ".", "start", ")", ";", "int", "codeEnd", "=", "code", "(", "r", ",", "this", ".", "end", ")", ";", "if", "(", "0", "==", "(", "codeStart", "|", "codeEnd", ")", ")", "{", "// both points are inside, trivial case", "return", "true", ";", "}", "else", "if", "(", "0", "!=", "(", "codeStart", "&", "codeEnd", ")", ")", "{", "// both points are either below, above, left or right of the box, no intersection", "return", "false", ";", "}", "return", "bias", ";", "}" ]
Returns a fast computation if the line intersects the rectangle or bias if there is no fast way to compute the intersection. @param r retangle to test @param bias the result if no fast computation is possible @return either the fast and correct result or the bias (which might be wrong).
[ "Returns", "a", "fast", "computation", "if", "the", "line", "intersects", "the", "rectangle", "or", "bias", "if", "there", "is", "no", "fast", "way", "to", "compute", "the", "intersection", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/LineSegment.java#L167-L179
liferay/com-liferay-commerce
commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java
CommerceAccountPersistenceImpl.removeByU_T
@Override public void removeByU_T(long userId, int type) { """ Removes all the commerce accounts where userId = &#63; and type = &#63; from the database. @param userId the user ID @param type the type """ for (CommerceAccount commerceAccount : findByU_T(userId, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceAccount); } }
java
@Override public void removeByU_T(long userId, int type) { for (CommerceAccount commerceAccount : findByU_T(userId, type, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceAccount); } }
[ "@", "Override", "public", "void", "removeByU_T", "(", "long", "userId", ",", "int", "type", ")", "{", "for", "(", "CommerceAccount", "commerceAccount", ":", "findByU_T", "(", "userId", ",", "type", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "commerceAccount", ")", ";", "}", "}" ]
Removes all the commerce accounts where userId = &#63; and type = &#63; from the database. @param userId the user ID @param type the type
[ "Removes", "all", "the", "commerce", "accounts", "where", "userId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java#L1771-L1777
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/trace/SpanId.java
SpanId.fromLowerBase16
public static SpanId fromLowerBase16(CharSequence src, int srcOffset) { """ Returns a {@code SpanId} built from a lowercase base16 representation. @param src the lowercase base16 representation. @param srcOffset the offset in the buffer where the representation of the {@code SpanId} begins. @return a {@code SpanId} built from a lowercase base16 representation. @throws NullPointerException if {@code src} is null. @throws IllegalArgumentException if not enough characters in the {@code src} from the {@code srcOffset}. @since 0.11 """ Utils.checkNotNull(src, "src"); return new SpanId(BigendianEncoding.longFromBase16String(src, srcOffset)); }
java
public static SpanId fromLowerBase16(CharSequence src, int srcOffset) { Utils.checkNotNull(src, "src"); return new SpanId(BigendianEncoding.longFromBase16String(src, srcOffset)); }
[ "public", "static", "SpanId", "fromLowerBase16", "(", "CharSequence", "src", ",", "int", "srcOffset", ")", "{", "Utils", ".", "checkNotNull", "(", "src", ",", "\"src\"", ")", ";", "return", "new", "SpanId", "(", "BigendianEncoding", ".", "longFromBase16String", "(", "src", ",", "srcOffset", ")", ")", ";", "}" ]
Returns a {@code SpanId} built from a lowercase base16 representation. @param src the lowercase base16 representation. @param srcOffset the offset in the buffer where the representation of the {@code SpanId} begins. @return a {@code SpanId} built from a lowercase base16 representation. @throws NullPointerException if {@code src} is null. @throws IllegalArgumentException if not enough characters in the {@code src} from the {@code srcOffset}. @since 0.11
[ "Returns", "a", "{", "@code", "SpanId", "}", "built", "from", "a", "lowercase", "base16", "representation", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/SpanId.java#L123-L126
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PropertyResolverFactory.java
PropertyResolverFactory.createResolver
public static PropertyResolver createResolver(PropertyRetriever instanceRetriever, PropertyRetriever projectRetriever, PropertyRetriever frameworkRetriever) { """ @return Create a resolver from a set of retrievers, possibly null @param instanceRetriever retriever for instance properties @param projectRetriever retriever for project properties @param frameworkRetriever retriever for framework properties """ return new RuntimePropertyResolver(instanceRetriever, projectRetriever, frameworkRetriever); }
java
public static PropertyResolver createResolver(PropertyRetriever instanceRetriever, PropertyRetriever projectRetriever, PropertyRetriever frameworkRetriever) { return new RuntimePropertyResolver(instanceRetriever, projectRetriever, frameworkRetriever); }
[ "public", "static", "PropertyResolver", "createResolver", "(", "PropertyRetriever", "instanceRetriever", ",", "PropertyRetriever", "projectRetriever", ",", "PropertyRetriever", "frameworkRetriever", ")", "{", "return", "new", "RuntimePropertyResolver", "(", "instanceRetriever", ",", "projectRetriever", ",", "frameworkRetriever", ")", ";", "}" ]
@return Create a resolver from a set of retrievers, possibly null @param instanceRetriever retriever for instance properties @param projectRetriever retriever for project properties @param frameworkRetriever retriever for framework properties
[ "@return", "Create", "a", "resolver", "from", "a", "set", "of", "retrievers", "possibly", "null" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/PropertyResolverFactory.java#L206-L209
alkacon/opencms-core
src/org/opencms/db/generic/CmsVfsDriver.java
CmsVfsDriver.internalCreateCounter
protected void internalCreateCounter(CmsDbContext dbc, String name, int value) throws CmsDbSqlException { """ Creates a new counter.<p> @param dbc the database context @param name the name of the counter to create @param value the inital value of the counter @throws CmsDbSqlException if something goes wrong """ PreparedStatement stmt = null; Connection conn = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, CmsProject.ONLINE_PROJECT_ID, "C_CREATE_COUNTER"); stmt.setString(1, name); stmt.setInt(2, value); stmt.executeUpdate(); } catch (SQLException e) { throw wrapException(stmt, e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } }
java
protected void internalCreateCounter(CmsDbContext dbc, String name, int value) throws CmsDbSqlException { PreparedStatement stmt = null; Connection conn = null; try { conn = m_sqlManager.getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, CmsProject.ONLINE_PROJECT_ID, "C_CREATE_COUNTER"); stmt.setString(1, name); stmt.setInt(2, value); stmt.executeUpdate(); } catch (SQLException e) { throw wrapException(stmt, e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } }
[ "protected", "void", "internalCreateCounter", "(", "CmsDbContext", "dbc", ",", "String", "name", ",", "int", "value", ")", "throws", "CmsDbSqlException", "{", "PreparedStatement", "stmt", "=", "null", ";", "Connection", "conn", "=", "null", ";", "try", "{", "conn", "=", "m_sqlManager", ".", "getConnection", "(", "dbc", ")", ";", "stmt", "=", "m_sqlManager", ".", "getPreparedStatement", "(", "conn", ",", "CmsProject", ".", "ONLINE_PROJECT_ID", ",", "\"C_CREATE_COUNTER\"", ")", ";", "stmt", ".", "setString", "(", "1", ",", "name", ")", ";", "stmt", ".", "setInt", "(", "2", ",", "value", ")", ";", "stmt", ".", "executeUpdate", "(", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "wrapException", "(", "stmt", ",", "e", ")", ";", "}", "finally", "{", "m_sqlManager", ".", "closeAll", "(", "dbc", ",", "conn", ",", "stmt", ",", "null", ")", ";", "}", "}" ]
Creates a new counter.<p> @param dbc the database context @param name the name of the counter to create @param value the inital value of the counter @throws CmsDbSqlException if something goes wrong
[ "Creates", "a", "new", "counter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsVfsDriver.java#L3714-L3729
jmurty/java-xmlbuilder
src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java
BaseXMLBuilder.toWriter
public void toWriter(boolean wholeDocument, Writer writer, Properties outputProperties) throws TransformerException { """ Serialize either the specific Element wrapped by this BaseXMLBuilder, or its entire XML document, to the given writer using the default {@link TransformerFactory} and {@link Transformer} classes. If output options are provided, these options are provided to the {@link Transformer} serializer. @param wholeDocument if true the whole XML document (i.e. the document root) is serialized, if false just the current Element and its descendants are serialized. @param writer a writer to which the serialized document is written. @param outputProperties settings for the {@link Transformer} serializer. This parameter may be null or an empty Properties object, in which case the default output properties will be applied. @throws TransformerException """ StreamResult streamResult = new StreamResult(writer); DOMSource domSource = null; if (wholeDocument) { domSource = new DOMSource(getDocument()); } else { domSource = new DOMSource(getElement()); } TransformerFactory tf = TransformerFactory.newInstance(); Transformer serializer = tf.newTransformer(); if (outputProperties != null) { for (Entry<Object, Object> entry: outputProperties.entrySet()) { serializer.setOutputProperty( (String) entry.getKey(), (String) entry.getValue()); } } serializer.transform(domSource, streamResult); }
java
public void toWriter(boolean wholeDocument, Writer writer, Properties outputProperties) throws TransformerException { StreamResult streamResult = new StreamResult(writer); DOMSource domSource = null; if (wholeDocument) { domSource = new DOMSource(getDocument()); } else { domSource = new DOMSource(getElement()); } TransformerFactory tf = TransformerFactory.newInstance(); Transformer serializer = tf.newTransformer(); if (outputProperties != null) { for (Entry<Object, Object> entry: outputProperties.entrySet()) { serializer.setOutputProperty( (String) entry.getKey(), (String) entry.getValue()); } } serializer.transform(domSource, streamResult); }
[ "public", "void", "toWriter", "(", "boolean", "wholeDocument", ",", "Writer", "writer", ",", "Properties", "outputProperties", ")", "throws", "TransformerException", "{", "StreamResult", "streamResult", "=", "new", "StreamResult", "(", "writer", ")", ";", "DOMSource", "domSource", "=", "null", ";", "if", "(", "wholeDocument", ")", "{", "domSource", "=", "new", "DOMSource", "(", "getDocument", "(", ")", ")", ";", "}", "else", "{", "domSource", "=", "new", "DOMSource", "(", "getElement", "(", ")", ")", ";", "}", "TransformerFactory", "tf", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "Transformer", "serializer", "=", "tf", ".", "newTransformer", "(", ")", ";", "if", "(", "outputProperties", "!=", "null", ")", "{", "for", "(", "Entry", "<", "Object", ",", "Object", ">", "entry", ":", "outputProperties", ".", "entrySet", "(", ")", ")", "{", "serializer", ".", "setOutputProperty", "(", "(", "String", ")", "entry", ".", "getKey", "(", ")", ",", "(", "String", ")", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}", "serializer", ".", "transform", "(", "domSource", ",", "streamResult", ")", ";", "}" ]
Serialize either the specific Element wrapped by this BaseXMLBuilder, or its entire XML document, to the given writer using the default {@link TransformerFactory} and {@link Transformer} classes. If output options are provided, these options are provided to the {@link Transformer} serializer. @param wholeDocument if true the whole XML document (i.e. the document root) is serialized, if false just the current Element and its descendants are serialized. @param writer a writer to which the serialized document is written. @param outputProperties settings for the {@link Transformer} serializer. This parameter may be null or an empty Properties object, in which case the default output properties will be applied. @throws TransformerException
[ "Serialize", "either", "the", "specific", "Element", "wrapped", "by", "this", "BaseXMLBuilder", "or", "its", "entire", "XML", "document", "to", "the", "given", "writer", "using", "the", "default", "{", "@link", "TransformerFactory", "}", "and", "{", "@link", "Transformer", "}", "classes", ".", "If", "output", "options", "are", "provided", "these", "options", "are", "provided", "to", "the", "{", "@link", "Transformer", "}", "serializer", "." ]
train
https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java#L1303-L1325
OpenLiberty/open-liberty
dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/IPAddressRange.java
IPAddressRange.aboveRange
public boolean aboveRange(InetAddress ip) { """ Is the given ip address numericaly above the address range? Is it above ipHigher? """ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "aboveRange, ip is " + ip); Tr.debug(tc, "aboveRange, ip is " + ip); } return greaterThan(ip, ipHigher); }
java
public boolean aboveRange(InetAddress ip) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "aboveRange, ip is " + ip); Tr.debug(tc, "aboveRange, ip is " + ip); } return greaterThan(ip, ipHigher); }
[ "public", "boolean", "aboveRange", "(", "InetAddress", "ip", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"aboveRange, ip is \"", "+", "ip", ")", ";", "Tr", ".", "debug", "(", "tc", ",", "\"aboveRange, ip is \"", "+", "ip", ")", ";", "}", "return", "greaterThan", "(", "ip", ",", "ipHigher", ")", ";", "}" ]
Is the given ip address numericaly above the address range? Is it above ipHigher?
[ "Is", "the", "given", "ip", "address", "numericaly", "above", "the", "address", "range?", "Is", "it", "above", "ipHigher?" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.authentication.filter/src/com/ibm/ws/security/authentication/filter/internal/IPAddressRange.java#L233-L239
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java
TraceNLS.getTraceNLS
@Deprecated public static TraceNLS getTraceNLS(String bundleName) { """ Retrieve a TraceNLS instance for the specified ResourceBundle, after first calculating the class of the caller via a stack walk (a direct call passing in the class is preferred). @param bundleName the package-qualified name of the ResourceBundle. The caller MUST guarantee that this is not null. <p> @return a TraceNLS object. Null is never returned. @deprecated Use the signature that includes the class object instead @see #getTraceNLS(Class, String) """ if (resolver == null) resolver = TraceNLSResolver.getInstance(); if (finder == null) finder = StackFinder.getInstance(); Class<?> caller = null; if (finder != null) caller = finder.getCaller(); return new TraceNLS(caller, bundleName); }
java
@Deprecated public static TraceNLS getTraceNLS(String bundleName) { if (resolver == null) resolver = TraceNLSResolver.getInstance(); if (finder == null) finder = StackFinder.getInstance(); Class<?> caller = null; if (finder != null) caller = finder.getCaller(); return new TraceNLS(caller, bundleName); }
[ "@", "Deprecated", "public", "static", "TraceNLS", "getTraceNLS", "(", "String", "bundleName", ")", "{", "if", "(", "resolver", "==", "null", ")", "resolver", "=", "TraceNLSResolver", ".", "getInstance", "(", ")", ";", "if", "(", "finder", "==", "null", ")", "finder", "=", "StackFinder", ".", "getInstance", "(", ")", ";", "Class", "<", "?", ">", "caller", "=", "null", ";", "if", "(", "finder", "!=", "null", ")", "caller", "=", "finder", ".", "getCaller", "(", ")", ";", "return", "new", "TraceNLS", "(", "caller", ",", "bundleName", ")", ";", "}" ]
Retrieve a TraceNLS instance for the specified ResourceBundle, after first calculating the class of the caller via a stack walk (a direct call passing in the class is preferred). @param bundleName the package-qualified name of the ResourceBundle. The caller MUST guarantee that this is not null. <p> @return a TraceNLS object. Null is never returned. @deprecated Use the signature that includes the class object instead @see #getTraceNLS(Class, String)
[ "Retrieve", "a", "TraceNLS", "instance", "for", "the", "specified", "ResourceBundle", "after", "first", "calculating", "the", "class", "of", "the", "caller", "via", "a", "stack", "walk", "(", "a", "direct", "call", "passing", "in", "the", "class", "is", "preferred", ")", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java#L69-L83
m-m-m/util
lang/src/main/java/net/sf/mmm/util/lang/api/BasicHelper.java
BasicHelper.toLowerCase
public static String toLowerCase(String string, Locale locale) { """ Indirection for {@link String#toLowerCase(Locale)}. @param string is the {@link String}. @param locale is the {@link Locale}. @return the result of {@link String#toLowerCase(Locale)}. """ if (locale == null) { return toLowerCase(string, STANDARD_LOCALE); } return string.toLowerCase(locale); }
java
public static String toLowerCase(String string, Locale locale) { if (locale == null) { return toLowerCase(string, STANDARD_LOCALE); } return string.toLowerCase(locale); }
[ "public", "static", "String", "toLowerCase", "(", "String", "string", ",", "Locale", "locale", ")", "{", "if", "(", "locale", "==", "null", ")", "{", "return", "toLowerCase", "(", "string", ",", "STANDARD_LOCALE", ")", ";", "}", "return", "string", ".", "toLowerCase", "(", "locale", ")", ";", "}" ]
Indirection for {@link String#toLowerCase(Locale)}. @param string is the {@link String}. @param locale is the {@link Locale}. @return the result of {@link String#toLowerCase(Locale)}.
[ "Indirection", "for", "{", "@link", "String#toLowerCase", "(", "Locale", ")", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/lang/src/main/java/net/sf/mmm/util/lang/api/BasicHelper.java#L89-L95
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/ValidateXMLInterceptor.java
ValidateXMLInterceptor.paintOriginalXML
private void paintOriginalXML(final String originalXML, final PrintWriter writer) { """ Paint the original XML wrapped in a CDATA Section. @param originalXML the original XML @param writer the output writer """ // Replace any CDATA Sections embedded in XML String xml = originalXML.replaceAll("<!\\[CDATA\\[", "CDATASTART"); xml = xml.replaceAll("\\]\\]>", "CDATAFINISH"); // Paint Output writer.println("<div>"); writer.println("<!-- VALIDATE XML ERROR - START XML -->"); writer.println("<![CDATA["); writer.println(xml); writer.println("]]>"); writer.println("<!-- VALIDATE XML ERROR - END XML -->"); writer.println("</div>"); }
java
private void paintOriginalXML(final String originalXML, final PrintWriter writer) { // Replace any CDATA Sections embedded in XML String xml = originalXML.replaceAll("<!\\[CDATA\\[", "CDATASTART"); xml = xml.replaceAll("\\]\\]>", "CDATAFINISH"); // Paint Output writer.println("<div>"); writer.println("<!-- VALIDATE XML ERROR - START XML -->"); writer.println("<![CDATA["); writer.println(xml); writer.println("]]>"); writer.println("<!-- VALIDATE XML ERROR - END XML -->"); writer.println("</div>"); }
[ "private", "void", "paintOriginalXML", "(", "final", "String", "originalXML", ",", "final", "PrintWriter", "writer", ")", "{", "// Replace any CDATA Sections embedded in XML", "String", "xml", "=", "originalXML", ".", "replaceAll", "(", "\"<!\\\\[CDATA\\\\[\"", ",", "\"CDATASTART\"", ")", ";", "xml", "=", "xml", ".", "replaceAll", "(", "\"\\\\]\\\\]>\"", ",", "\"CDATAFINISH\"", ")", ";", "// Paint Output", "writer", ".", "println", "(", "\"<div>\"", ")", ";", "writer", ".", "println", "(", "\"<!-- VALIDATE XML ERROR - START XML -->\"", ")", ";", "writer", ".", "println", "(", "\"<![CDATA[\"", ")", ";", "writer", ".", "println", "(", "xml", ")", ";", "writer", ".", "println", "(", "\"]]>\"", ")", ";", "writer", ".", "println", "(", "\"<!-- VALIDATE XML ERROR - END XML -->\"", ")", ";", "writer", ".", "println", "(", "\"</div>\"", ")", ";", "}" ]
Paint the original XML wrapped in a CDATA Section. @param originalXML the original XML @param writer the output writer
[ "Paint", "the", "original", "XML", "wrapped", "in", "a", "CDATA", "Section", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/ValidateXMLInterceptor.java#L104-L117
js-lib-com/template.xhtml
src/main/java/js/template/xhtml/Content.java
Content.getValue
private Object getValue(Object object, String propertyPath) throws TemplateException { """ Get content value. This method consider object as a graph of values and property path as a list of path components separated by dots and uses next logic to retrieve requested value: <ul> <li>if property path is anonymous, i.e. is exactly ".", returns given object itself, <li>if property path is absolute, starts with ".", uses content root object and transform the path as relative, <li>split property path and traverse all path components returning last found object. </ul> Value can be about anything: primitives or aggregates. Anyway, there is distinction between not found value and a null one. First condition is known as undefined value and throws content exception; null value denotes an existing one but not initialized. Finally, this method uses {@link #getObjectProperty(Object, String)} to actually process path components in sequence. @param object instance to use if property path is relative, @param propertyPath object property path. @return requested content value or null. @throws TemplateException if requested value is undefined. """ if(this.model == null) { return null; } // anonymous property path has only a dot if(propertyPath.equals(".")) { return object; } Object o = object; if(propertyPath.charAt(0) == '.') { o = this.model; propertyPath = propertyPath.substring(1); } for(String property : propertyPath.split("\\.")) { o = getObjectProperty(o, property); if(o == null) { return null; } } return o; }
java
private Object getValue(Object object, String propertyPath) throws TemplateException { if(this.model == null) { return null; } // anonymous property path has only a dot if(propertyPath.equals(".")) { return object; } Object o = object; if(propertyPath.charAt(0) == '.') { o = this.model; propertyPath = propertyPath.substring(1); } for(String property : propertyPath.split("\\.")) { o = getObjectProperty(o, property); if(o == null) { return null; } } return o; }
[ "private", "Object", "getValue", "(", "Object", "object", ",", "String", "propertyPath", ")", "throws", "TemplateException", "{", "if", "(", "this", ".", "model", "==", "null", ")", "{", "return", "null", ";", "}", "// anonymous property path has only a dot\r", "if", "(", "propertyPath", ".", "equals", "(", "\".\"", ")", ")", "{", "return", "object", ";", "}", "Object", "o", "=", "object", ";", "if", "(", "propertyPath", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "o", "=", "this", ".", "model", ";", "propertyPath", "=", "propertyPath", ".", "substring", "(", "1", ")", ";", "}", "for", "(", "String", "property", ":", "propertyPath", ".", "split", "(", "\"\\\\.\"", ")", ")", "{", "o", "=", "getObjectProperty", "(", "o", ",", "property", ")", ";", "if", "(", "o", "==", "null", ")", "{", "return", "null", ";", "}", "}", "return", "o", ";", "}" ]
Get content value. This method consider object as a graph of values and property path as a list of path components separated by dots and uses next logic to retrieve requested value: <ul> <li>if property path is anonymous, i.e. is exactly ".", returns given object itself, <li>if property path is absolute, starts with ".", uses content root object and transform the path as relative, <li>split property path and traverse all path components returning last found object. </ul> Value can be about anything: primitives or aggregates. Anyway, there is distinction between not found value and a null one. First condition is known as undefined value and throws content exception; null value denotes an existing one but not initialized. Finally, this method uses {@link #getObjectProperty(Object, String)} to actually process path components in sequence. @param object instance to use if property path is relative, @param propertyPath object property path. @return requested content value or null. @throws TemplateException if requested value is undefined.
[ "Get", "content", "value", ".", "This", "method", "consider", "object", "as", "a", "graph", "of", "values", "and", "property", "path", "as", "a", "list", "of", "path", "components", "separated", "by", "dots", "and", "uses", "next", "logic", "to", "retrieve", "requested", "value", ":", "<ul", ">", "<li", ">", "if", "property", "path", "is", "anonymous", "i", ".", "e", ".", "is", "exactly", ".", "returns", "given", "object", "itself", "<li", ">", "if", "property", "path", "is", "absolute", "starts", "with", ".", "uses", "content", "root", "object", "and", "transform", "the", "path", "as", "relative", "<li", ">", "split", "property", "path", "and", "traverse", "all", "path", "components", "returning", "last", "found", "object", ".", "<", "/", "ul", ">", "Value", "can", "be", "about", "anything", ":", "primitives", "or", "aggregates", ".", "Anyway", "there", "is", "distinction", "between", "not", "found", "value", "and", "a", "null", "one", ".", "First", "condition", "is", "known", "as", "undefined", "value", "and", "throws", "content", "exception", ";", "null", "value", "denotes", "an", "existing", "one", "but", "not", "initialized", ".", "Finally", "this", "method", "uses", "{", "@link", "#getObjectProperty", "(", "Object", "String", ")", "}", "to", "actually", "process", "path", "components", "in", "sequence", "." ]
train
https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/Content.java#L313-L336
wigforss/Ka-Commons-Jmx
core/src/main/java/org/kasource/commons/jmx/dynamic/AnnotationDynamicMBeanFactory.java
AnnotationDynamicMBeanFactory.getMBeanFor
@Override public DynamicMBean getMBeanFor(Object object) throws IllegalStateException { """ Returns a DynamicMBean generated for the supplied object @param object Object to create DynamicMBean for. @return The DynamicMBean generated for the supplied object. @throws IllegalStateException if error occurred. """ JmxBean jmxBean = AnnotationUtils.getAnnotation(object.getClass(), JmxBean.class); if (jmxBean == null) { throw new IllegalArgumentException("Could not find annotation " + JmxBean.class + " on " + object.getClass()); } try { ClassIntrospector classIntrospector = new ClassIntrospectorImpl(object.getClass()); DynamicMBeanImpl mbean = new DynamicMBeanImpl(object); mbean.setmBeanInfo(getInfo(object, classIntrospector)); Map<String, Method> getters = new HashMap<String, Method>(); Map<String, Method> setters = new HashMap<String, Method>(); resolveGettersAndSetters(classIntrospector, getters, setters); mbean.setGetters(getters); mbean.setSetters(setters); mbean.setOperations(getOperationsMap(classIntrospector)); return mbean; } catch (Exception e) { throw new IllegalStateException("Could not create DynamicMBean for " + object, e); } }
java
@Override public DynamicMBean getMBeanFor(Object object) throws IllegalStateException { JmxBean jmxBean = AnnotationUtils.getAnnotation(object.getClass(), JmxBean.class); if (jmxBean == null) { throw new IllegalArgumentException("Could not find annotation " + JmxBean.class + " on " + object.getClass()); } try { ClassIntrospector classIntrospector = new ClassIntrospectorImpl(object.getClass()); DynamicMBeanImpl mbean = new DynamicMBeanImpl(object); mbean.setmBeanInfo(getInfo(object, classIntrospector)); Map<String, Method> getters = new HashMap<String, Method>(); Map<String, Method> setters = new HashMap<String, Method>(); resolveGettersAndSetters(classIntrospector, getters, setters); mbean.setGetters(getters); mbean.setSetters(setters); mbean.setOperations(getOperationsMap(classIntrospector)); return mbean; } catch (Exception e) { throw new IllegalStateException("Could not create DynamicMBean for " + object, e); } }
[ "@", "Override", "public", "DynamicMBean", "getMBeanFor", "(", "Object", "object", ")", "throws", "IllegalStateException", "{", "JmxBean", "jmxBean", "=", "AnnotationUtils", ".", "getAnnotation", "(", "object", ".", "getClass", "(", ")", ",", "JmxBean", ".", "class", ")", ";", "if", "(", "jmxBean", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not find annotation \"", "+", "JmxBean", ".", "class", "+", "\" on \"", "+", "object", ".", "getClass", "(", ")", ")", ";", "}", "try", "{", "ClassIntrospector", "classIntrospector", "=", "new", "ClassIntrospectorImpl", "(", "object", ".", "getClass", "(", ")", ")", ";", "DynamicMBeanImpl", "mbean", "=", "new", "DynamicMBeanImpl", "(", "object", ")", ";", "mbean", ".", "setmBeanInfo", "(", "getInfo", "(", "object", ",", "classIntrospector", ")", ")", ";", "Map", "<", "String", ",", "Method", ">", "getters", "=", "new", "HashMap", "<", "String", ",", "Method", ">", "(", ")", ";", "Map", "<", "String", ",", "Method", ">", "setters", "=", "new", "HashMap", "<", "String", ",", "Method", ">", "(", ")", ";", "resolveGettersAndSetters", "(", "classIntrospector", ",", "getters", ",", "setters", ")", ";", "mbean", ".", "setGetters", "(", "getters", ")", ";", "mbean", ".", "setSetters", "(", "setters", ")", ";", "mbean", ".", "setOperations", "(", "getOperationsMap", "(", "classIntrospector", ")", ")", ";", "return", "mbean", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not create DynamicMBean for \"", "+", "object", ",", "e", ")", ";", "}", "}" ]
Returns a DynamicMBean generated for the supplied object @param object Object to create DynamicMBean for. @return The DynamicMBean generated for the supplied object. @throws IllegalStateException if error occurred.
[ "Returns", "a", "DynamicMBean", "generated", "for", "the", "supplied", "object" ]
train
https://github.com/wigforss/Ka-Commons-Jmx/blob/f31ceda37ff55746bb43a059919842cb92405b5d/core/src/main/java/org/kasource/commons/jmx/dynamic/AnnotationDynamicMBeanFactory.java#L62-L82
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/ApplicationProxy.java
ApplicationProxy.createRemoteTask
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException { """ Build a new remote session and initialize it. @return The remote Task. """ try { return new TaskProxy(this, properties); } catch (RemoteException e) { if ((m_strBaseServletPath != null) && (m_strBaseServletPath.length() > 0)) { try { URL url = new URL(m_strBaseServletPath); String path = url.getPath(); if (path.length() > 0) if (m_strBaseServletPath.endsWith(path)) { m_strBaseServletPath = m_strBaseServletPath.substring(0, m_strBaseServletPath.length() - path.length()); return new TaskProxy(this, properties); } } catch (MalformedURLException e1) { // Throw original error if bad URL } } throw e; } }
java
public RemoteTask createRemoteTask(Map<String, Object> properties) throws RemoteException { try { return new TaskProxy(this, properties); } catch (RemoteException e) { if ((m_strBaseServletPath != null) && (m_strBaseServletPath.length() > 0)) { try { URL url = new URL(m_strBaseServletPath); String path = url.getPath(); if (path.length() > 0) if (m_strBaseServletPath.endsWith(path)) { m_strBaseServletPath = m_strBaseServletPath.substring(0, m_strBaseServletPath.length() - path.length()); return new TaskProxy(this, properties); } } catch (MalformedURLException e1) { // Throw original error if bad URL } } throw e; } }
[ "public", "RemoteTask", "createRemoteTask", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "RemoteException", "{", "try", "{", "return", "new", "TaskProxy", "(", "this", ",", "properties", ")", ";", "}", "catch", "(", "RemoteException", "e", ")", "{", "if", "(", "(", "m_strBaseServletPath", "!=", "null", ")", "&&", "(", "m_strBaseServletPath", ".", "length", "(", ")", ">", "0", ")", ")", "{", "try", "{", "URL", "url", "=", "new", "URL", "(", "m_strBaseServletPath", ")", ";", "String", "path", "=", "url", ".", "getPath", "(", ")", ";", "if", "(", "path", ".", "length", "(", ")", ">", "0", ")", "if", "(", "m_strBaseServletPath", ".", "endsWith", "(", "path", ")", ")", "{", "m_strBaseServletPath", "=", "m_strBaseServletPath", ".", "substring", "(", "0", ",", "m_strBaseServletPath", ".", "length", "(", ")", "-", "path", ".", "length", "(", ")", ")", ";", "return", "new", "TaskProxy", "(", "this", ",", "properties", ")", ";", "}", "}", "catch", "(", "MalformedURLException", "e1", ")", "{", "// Throw original error if bad URL", "}", "}", "throw", "e", ";", "}", "}" ]
Build a new remote session and initialize it. @return The remote Task.
[ "Build", "a", "new", "remote", "session", "and", "initialize", "it", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/ApplicationProxy.java#L93-L115
apache/incubator-gobblin
gobblin-modules/gobblin-parquet/src/main/java/org/apache/gobblin/converter/parquet/JsonSchema.java
JsonSchema.getOptionalProperty
private String getOptionalProperty(JsonObject jsonObject, String key) { """ Get optional property from a {@link JsonObject} for a {@link String} key. If key does'nt exists returns {@link #DEFAULT_VALUE_FOR_OPTIONAL_PROPERTY}. @param jsonObject @param key @return """ return jsonObject.has(key) ? jsonObject.get(key).getAsString() : DEFAULT_VALUE_FOR_OPTIONAL_PROPERTY; }
java
private String getOptionalProperty(JsonObject jsonObject, String key) { return jsonObject.has(key) ? jsonObject.get(key).getAsString() : DEFAULT_VALUE_FOR_OPTIONAL_PROPERTY; }
[ "private", "String", "getOptionalProperty", "(", "JsonObject", "jsonObject", ",", "String", "key", ")", "{", "return", "jsonObject", ".", "has", "(", "key", ")", "?", "jsonObject", ".", "get", "(", "key", ")", ".", "getAsString", "(", ")", ":", "DEFAULT_VALUE_FOR_OPTIONAL_PROPERTY", ";", "}" ]
Get optional property from a {@link JsonObject} for a {@link String} key. If key does'nt exists returns {@link #DEFAULT_VALUE_FOR_OPTIONAL_PROPERTY}. @param jsonObject @param key @return
[ "Get", "optional", "property", "from", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-parquet/src/main/java/org/apache/gobblin/converter/parquet/JsonSchema.java#L159-L161
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_scheduler_serviceName_events_POST
public void billingAccount_scheduler_serviceName_events_POST(String billingAccount, String serviceName, OvhSchedulerCategoryEnum category, Date dateEnd, Date dateStart, String description, String title, String uid) throws IOException { """ Add a scheduler event REST: POST /telephony/{billingAccount}/scheduler/{serviceName}/events @param dateEnd [required] The ending date of the event @param category [required] The category of the event @param title [required] The title of the event @param uid [required] The unique ICS event identifier @param dateStart [required] The beginning date of the event @param description [required] The descritpion of the event @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}/events"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "category", category); addBody(o, "dateEnd", dateEnd); addBody(o, "dateStart", dateStart); addBody(o, "description", description); addBody(o, "title", title); addBody(o, "uid", uid); exec(qPath, "POST", sb.toString(), o); }
java
public void billingAccount_scheduler_serviceName_events_POST(String billingAccount, String serviceName, OvhSchedulerCategoryEnum category, Date dateEnd, Date dateStart, String description, String title, String uid) throws IOException { String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}/events"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "category", category); addBody(o, "dateEnd", dateEnd); addBody(o, "dateStart", dateStart); addBody(o, "description", description); addBody(o, "title", title); addBody(o, "uid", uid); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "billingAccount_scheduler_serviceName_events_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhSchedulerCategoryEnum", "category", ",", "Date", "dateEnd", ",", "Date", "dateStart", ",", "String", "description", ",", "String", "title", ",", "String", "uid", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/scheduler/{serviceName}/events\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"category\"", ",", "category", ")", ";", "addBody", "(", "o", ",", "\"dateEnd\"", ",", "dateEnd", ")", ";", "addBody", "(", "o", ",", "\"dateStart\"", ",", "dateStart", ")", ";", "addBody", "(", "o", ",", "\"description\"", ",", "description", ")", ";", "addBody", "(", "o", ",", "\"title\"", ",", "title", ")", ";", "addBody", "(", "o", ",", "\"uid\"", ",", "uid", ")", ";", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "}" ]
Add a scheduler event REST: POST /telephony/{billingAccount}/scheduler/{serviceName}/events @param dateEnd [required] The ending date of the event @param category [required] The category of the event @param title [required] The title of the event @param uid [required] The unique ICS event identifier @param dateStart [required] The beginning date of the event @param description [required] The descritpion of the event @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Add", "a", "scheduler", "event" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L606-L617
carewebframework/carewebframework-core
org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSService.java
JMSService.createObjectMessage
public Message createObjectMessage(Serializable messageData, String sender, String recipients) { """ Creates a message. @param messageData Message data. @param sender Sender client ID. @param recipients Comma-delimited list of recipient client IDs @return The newly created message. """ try { return decorateMessage(getSession().createObjectMessage(messageData), sender, recipients); } catch (JMSException e) { throw MiscUtil.toUnchecked(e); } }
java
public Message createObjectMessage(Serializable messageData, String sender, String recipients) { try { return decorateMessage(getSession().createObjectMessage(messageData), sender, recipients); } catch (JMSException e) { throw MiscUtil.toUnchecked(e); } }
[ "public", "Message", "createObjectMessage", "(", "Serializable", "messageData", ",", "String", "sender", ",", "String", "recipients", ")", "{", "try", "{", "return", "decorateMessage", "(", "getSession", "(", ")", ".", "createObjectMessage", "(", "messageData", ")", ",", "sender", ",", "recipients", ")", ";", "}", "catch", "(", "JMSException", "e", ")", "{", "throw", "MiscUtil", ".", "toUnchecked", "(", "e", ")", ";", "}", "}" ]
Creates a message. @param messageData Message data. @param sender Sender client ID. @param recipients Comma-delimited list of recipient client IDs @return The newly created message.
[ "Creates", "a", "message", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSService.java#L193-L199
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/IOUtil.java
IOUtil.dumpLocationToFile
public static void dumpLocationToFile(PhysicalLocation loc, File inFile, File outFile) throws IOException { """ Dumps the given part of the inFile to outFile. The part to dump is represented by loc. This will read safely from inFile which means locations outside of inFile are written as zero bytes to outFile. outFile must not exist yet. inFile must exist and must not be a directory. @param loc @param file @throws IOException """ Preconditions.checkArgument(!outFile.exists()); Preconditions.checkArgument(inFile.exists(), inFile.isFile()); final int BUFFER_SIZE = 2048; try (RandomAccessFile raf = new RandomAccessFile(inFile, "r"); FileOutputStream out = new FileOutputStream(outFile)) { byte[] buffer; long remainingBytes = loc.size(); long offset = loc.from(); while (remainingBytes >= BUFFER_SIZE) { buffer = loadBytesSafely(offset, BUFFER_SIZE, raf); out.write(buffer); remainingBytes -= BUFFER_SIZE; offset += BUFFER_SIZE; } if (remainingBytes > 0) { buffer = loadBytesSafely(offset, (int) remainingBytes, raf); out.write(buffer); } } }
java
public static void dumpLocationToFile(PhysicalLocation loc, File inFile, File outFile) throws IOException { Preconditions.checkArgument(!outFile.exists()); Preconditions.checkArgument(inFile.exists(), inFile.isFile()); final int BUFFER_SIZE = 2048; try (RandomAccessFile raf = new RandomAccessFile(inFile, "r"); FileOutputStream out = new FileOutputStream(outFile)) { byte[] buffer; long remainingBytes = loc.size(); long offset = loc.from(); while (remainingBytes >= BUFFER_SIZE) { buffer = loadBytesSafely(offset, BUFFER_SIZE, raf); out.write(buffer); remainingBytes -= BUFFER_SIZE; offset += BUFFER_SIZE; } if (remainingBytes > 0) { buffer = loadBytesSafely(offset, (int) remainingBytes, raf); out.write(buffer); } } }
[ "public", "static", "void", "dumpLocationToFile", "(", "PhysicalLocation", "loc", ",", "File", "inFile", ",", "File", "outFile", ")", "throws", "IOException", "{", "Preconditions", ".", "checkArgument", "(", "!", "outFile", ".", "exists", "(", ")", ")", ";", "Preconditions", ".", "checkArgument", "(", "inFile", ".", "exists", "(", ")", ",", "inFile", ".", "isFile", "(", ")", ")", ";", "final", "int", "BUFFER_SIZE", "=", "2048", ";", "try", "(", "RandomAccessFile", "raf", "=", "new", "RandomAccessFile", "(", "inFile", ",", "\"r\"", ")", ";", "FileOutputStream", "out", "=", "new", "FileOutputStream", "(", "outFile", ")", ")", "{", "byte", "[", "]", "buffer", ";", "long", "remainingBytes", "=", "loc", ".", "size", "(", ")", ";", "long", "offset", "=", "loc", ".", "from", "(", ")", ";", "while", "(", "remainingBytes", ">=", "BUFFER_SIZE", ")", "{", "buffer", "=", "loadBytesSafely", "(", "offset", ",", "BUFFER_SIZE", ",", "raf", ")", ";", "out", ".", "write", "(", "buffer", ")", ";", "remainingBytes", "-=", "BUFFER_SIZE", ";", "offset", "+=", "BUFFER_SIZE", ";", "}", "if", "(", "remainingBytes", ">", "0", ")", "{", "buffer", "=", "loadBytesSafely", "(", "offset", ",", "(", "int", ")", "remainingBytes", ",", "raf", ")", ";", "out", ".", "write", "(", "buffer", ")", ";", "}", "}", "}" ]
Dumps the given part of the inFile to outFile. The part to dump is represented by loc. This will read safely from inFile which means locations outside of inFile are written as zero bytes to outFile. outFile must not exist yet. inFile must exist and must not be a directory. @param loc @param file @throws IOException
[ "Dumps", "the", "given", "part", "of", "the", "inFile", "to", "outFile", ".", "The", "part", "to", "dump", "is", "represented", "by", "loc", ".", "This", "will", "read", "safely", "from", "inFile", "which", "means", "locations", "outside", "of", "inFile", "are", "written", "as", "zero", "bytes", "to", "outFile", "." ]
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/IOUtil.java#L91-L115
couchbase/CouchbaseMock
src/main/java/com/couchbase/mock/httpio/HandlerUtil.java
HandlerUtil.makeJsonResponse
public static void makeJsonResponse(HttpResponse response, String encoded) { """ Sets a JSON encoded response. The response's {@code Content-Type} header will be set to {@code application/json} @param response The response object @param encoded The JSON-encoded string """ StringEntity ent = new StringEntity(encoded, ContentType.APPLICATION_JSON); response.setEntity(ent); }
java
public static void makeJsonResponse(HttpResponse response, String encoded) { StringEntity ent = new StringEntity(encoded, ContentType.APPLICATION_JSON); response.setEntity(ent); }
[ "public", "static", "void", "makeJsonResponse", "(", "HttpResponse", "response", ",", "String", "encoded", ")", "{", "StringEntity", "ent", "=", "new", "StringEntity", "(", "encoded", ",", "ContentType", ".", "APPLICATION_JSON", ")", ";", "response", ".", "setEntity", "(", "ent", ")", ";", "}" ]
Sets a JSON encoded response. The response's {@code Content-Type} header will be set to {@code application/json} @param response The response object @param encoded The JSON-encoded string
[ "Sets", "a", "JSON", "encoded", "response", ".", "The", "response", "s", "{" ]
train
https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/httpio/HandlerUtil.java#L179-L182
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
MethodBuilder.buildMethodComments
public void buildMethodComments(XMLNode node, Content methodDocTree) { """ Build the comments for the method. Do nothing if {@link Configuration#nocomment} is set to true. @param node the XML element that specifies which components to document @param methodDocTree the content tree to which the documentation will be added """ if (!configuration.nocomment) { MethodDoc method = (MethodDoc) methods.get(currentMethodIndex); if (method.inlineTags().length == 0) { DocFinder.Output docs = DocFinder.search(configuration, new DocFinder.Input(method)); method = docs.inlineTags != null && docs.inlineTags.length > 0 ? (MethodDoc) docs.holder : method; } //NOTE: When we fix the bug where ClassDoc.interfaceTypes() does // not pass all implemented interfaces, holder will be the // interface type. For now, it is really the erasure. writer.addComments(method.containingClass(), method, methodDocTree); } }
java
public void buildMethodComments(XMLNode node, Content methodDocTree) { if (!configuration.nocomment) { MethodDoc method = (MethodDoc) methods.get(currentMethodIndex); if (method.inlineTags().length == 0) { DocFinder.Output docs = DocFinder.search(configuration, new DocFinder.Input(method)); method = docs.inlineTags != null && docs.inlineTags.length > 0 ? (MethodDoc) docs.holder : method; } //NOTE: When we fix the bug where ClassDoc.interfaceTypes() does // not pass all implemented interfaces, holder will be the // interface type. For now, it is really the erasure. writer.addComments(method.containingClass(), method, methodDocTree); } }
[ "public", "void", "buildMethodComments", "(", "XMLNode", "node", ",", "Content", "methodDocTree", ")", "{", "if", "(", "!", "configuration", ".", "nocomment", ")", "{", "MethodDoc", "method", "=", "(", "MethodDoc", ")", "methods", ".", "get", "(", "currentMethodIndex", ")", ";", "if", "(", "method", ".", "inlineTags", "(", ")", ".", "length", "==", "0", ")", "{", "DocFinder", ".", "Output", "docs", "=", "DocFinder", ".", "search", "(", "configuration", ",", "new", "DocFinder", ".", "Input", "(", "method", ")", ")", ";", "method", "=", "docs", ".", "inlineTags", "!=", "null", "&&", "docs", ".", "inlineTags", ".", "length", ">", "0", "?", "(", "MethodDoc", ")", "docs", ".", "holder", ":", "method", ";", "}", "//NOTE: When we fix the bug where ClassDoc.interfaceTypes() does", "// not pass all implemented interfaces, holder will be the", "// interface type. For now, it is really the erasure.", "writer", ".", "addComments", "(", "method", ".", "containingClass", "(", ")", ",", "method", ",", "methodDocTree", ")", ";", "}", "}" ]
Build the comments for the method. Do nothing if {@link Configuration#nocomment} is set to true. @param node the XML element that specifies which components to document @param methodDocTree the content tree to which the documentation will be added
[ "Build", "the", "comments", "for", "the", "method", ".", "Do", "nothing", "if", "{", "@link", "Configuration#nocomment", "}", "is", "set", "to", "true", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java#L206-L221
chocoteam/choco-graph
src/main/java/org/chocosolver/graphsolver/util/BitOperations.java
BitOperations.binaryLCA
public static int binaryLCA(int x, int y) { """ Get the lowest common ancestor of x and y in a complete binary tree @param x a node @param y a node @return the lowest common ancestor of x and y in a complete binary tree """ if (x == y) { return x; } int xor = x ^ y; int idx = getMaxExp(xor); if (idx == -1) { throw new UnsupportedOperationException(); } return replaceBy1and0sFrom(x, idx); }
java
public static int binaryLCA(int x, int y) { if (x == y) { return x; } int xor = x ^ y; int idx = getMaxExp(xor); if (idx == -1) { throw new UnsupportedOperationException(); } return replaceBy1and0sFrom(x, idx); }
[ "public", "static", "int", "binaryLCA", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "x", "==", "y", ")", "{", "return", "x", ";", "}", "int", "xor", "=", "x", "^", "y", ";", "int", "idx", "=", "getMaxExp", "(", "xor", ")", ";", "if", "(", "idx", "==", "-", "1", ")", "{", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "}", "return", "replaceBy1and0sFrom", "(", "x", ",", "idx", ")", ";", "}" ]
Get the lowest common ancestor of x and y in a complete binary tree @param x a node @param y a node @return the lowest common ancestor of x and y in a complete binary tree
[ "Get", "the", "lowest", "common", "ancestor", "of", "x", "and", "y", "in", "a", "complete", "binary", "tree" ]
train
https://github.com/chocoteam/choco-graph/blob/0a03b0aafc86601977728c7e3fcb5ed376f1fae9/src/main/java/org/chocosolver/graphsolver/util/BitOperations.java#L52-L62
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.enableAsync
public Observable<Void> enableAsync(String jobId) { """ Enables the specified job, allowing new tasks to run. When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. @param jobId The ID of the job to enable. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful. """ return enableWithServiceResponseAsync(jobId).map(new Func1<ServiceResponseWithHeaders<Void, JobEnableHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, JobEnableHeaders> response) { return response.body(); } }); }
java
public Observable<Void> enableAsync(String jobId) { return enableWithServiceResponseAsync(jobId).map(new Func1<ServiceResponseWithHeaders<Void, JobEnableHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, JobEnableHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "enableAsync", "(", "String", "jobId", ")", "{", "return", "enableWithServiceResponseAsync", "(", "jobId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Void", ",", "JobEnableHeaders", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponseWithHeaders", "<", "Void", ",", "JobEnableHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Enables the specified job, allowing new tasks to run. When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run. @param jobId The ID of the job to enable. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Enables", "the", "specified", "job", "allowing", "new", "tasks", "to", "run", ".", "When", "you", "call", "this", "API", "the", "Batch", "service", "sets", "a", "disabled", "job", "to", "the", "enabling", "state", ".", "After", "the", "this", "operation", "is", "completed", "the", "job", "moves", "to", "the", "active", "state", "and", "scheduling", "of", "new", "tasks", "under", "the", "job", "resumes", ".", "The", "Batch", "service", "does", "not", "allow", "a", "task", "to", "remain", "in", "the", "active", "state", "for", "more", "than", "180", "days", ".", "Therefore", "if", "you", "enable", "a", "job", "containing", "active", "tasks", "which", "were", "added", "more", "than", "180", "days", "ago", "those", "tasks", "will", "not", "run", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L1587-L1594
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java
PathManagerService.addPathManagerResources
public final void addPathManagerResources(Resource resource) { """ Add child resources to the given resource, one for each {@link PathEntry} currently associated with this path manager. Used to initialize the model with resources for the standard paths that are not part of the persistent configuration. @param resource the resource to which children should be added. """ synchronized (pathEntries) { for (PathEntry pathEntry : pathEntries.values()) { resource.registerChild(PathElement.pathElement(PATH, pathEntry.getName()), new HardcodedPathResource(PATH, pathEntry)); } } }
java
public final void addPathManagerResources(Resource resource) { synchronized (pathEntries) { for (PathEntry pathEntry : pathEntries.values()) { resource.registerChild(PathElement.pathElement(PATH, pathEntry.getName()), new HardcodedPathResource(PATH, pathEntry)); } } }
[ "public", "final", "void", "addPathManagerResources", "(", "Resource", "resource", ")", "{", "synchronized", "(", "pathEntries", ")", "{", "for", "(", "PathEntry", "pathEntry", ":", "pathEntries", ".", "values", "(", ")", ")", "{", "resource", ".", "registerChild", "(", "PathElement", ".", "pathElement", "(", "PATH", ",", "pathEntry", ".", "getName", "(", ")", ")", ",", "new", "HardcodedPathResource", "(", "PATH", ",", "pathEntry", ")", ")", ";", "}", "}", "}" ]
Add child resources to the given resource, one for each {@link PathEntry} currently associated with this path manager. Used to initialize the model with resources for the standard paths that are not part of the persistent configuration. @param resource the resource to which children should be added.
[ "Add", "child", "resources", "to", "the", "given", "resource", "one", "for", "each", "{" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java#L93-L99
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/media/MediaClient.java
MediaClient.createThumbnailJob
public CreateThumbnailJobResponse createThumbnailJob(CreateThumbnailJobRequest request) { """ Creates a thumbnail job and return job ID. @param request The request object containing all options for creating new water mark. @return the unique ID of the new thumbnail job. """ checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); checkNotNull(request.getSource(), "The parameter source should NOT be null."); checkStringNotEmpty(request.getSource().getKey(), "The parameter source key should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, THUMBNAIL); return invokeHttpClient(internalRequest, CreateThumbnailJobResponse.class); }
java
public CreateThumbnailJobResponse createThumbnailJob(CreateThumbnailJobRequest request) { checkStringNotEmpty(request.getPipelineName(), "The parameter pipelineName should NOT be null or empty string."); checkNotNull(request.getSource(), "The parameter source should NOT be null."); checkStringNotEmpty(request.getSource().getKey(), "The parameter source key should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, THUMBNAIL); return invokeHttpClient(internalRequest, CreateThumbnailJobResponse.class); }
[ "public", "CreateThumbnailJobResponse", "createThumbnailJob", "(", "CreateThumbnailJobRequest", "request", ")", "{", "checkStringNotEmpty", "(", "request", ".", "getPipelineName", "(", ")", ",", "\"The parameter pipelineName should NOT be null or empty string.\"", ")", ";", "checkNotNull", "(", "request", ".", "getSource", "(", ")", ",", "\"The parameter source should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getSource", "(", ")", ".", "getKey", "(", ")", ",", "\"The parameter source key should NOT be null or empty string.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "POST", ",", "request", ",", "THUMBNAIL", ")", ";", "return", "invokeHttpClient", "(", "internalRequest", ",", "CreateThumbnailJobResponse", ".", "class", ")", ";", "}" ]
Creates a thumbnail job and return job ID. @param request The request object containing all options for creating new water mark. @return the unique ID of the new thumbnail job.
[ "Creates", "a", "thumbnail", "job", "and", "return", "job", "ID", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L1255-L1265
ZuInnoTe/hadoopcryptoledger
inputformat/src/main/java/org/zuinnote/hadoop/bitcoin/format/common/BitcoinUtil.java
BitcoinUtil.compareMagics
public static boolean compareMagics (byte[] magic1,byte[] magic2) { """ Compares two Bitcoin magics @param magic1 first magic @param magic2 second magics @return false, if do not match, true if match """ if (magic1.length!=magic2.length) { return false; } for (int i=0;i<magic1.length;i++) { if (magic1[i]!=magic2[i]) { return false; } } return true; }
java
public static boolean compareMagics (byte[] magic1,byte[] magic2) { if (magic1.length!=magic2.length) { return false; } for (int i=0;i<magic1.length;i++) { if (magic1[i]!=magic2[i]) { return false; } } return true; }
[ "public", "static", "boolean", "compareMagics", "(", "byte", "[", "]", "magic1", ",", "byte", "[", "]", "magic2", ")", "{", "if", "(", "magic1", ".", "length", "!=", "magic2", ".", "length", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "magic1", ".", "length", ";", "i", "++", ")", "{", "if", "(", "magic1", "[", "i", "]", "!=", "magic2", "[", "i", "]", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Compares two Bitcoin magics @param magic1 first magic @param magic2 second magics @return false, if do not match, true if match
[ "Compares", "two", "Bitcoin", "magics" ]
train
https://github.com/ZuInnoTe/hadoopcryptoledger/blob/5c9bfb61dd1a82374cd0de8413a7c66391ee4414/inputformat/src/main/java/org/zuinnote/hadoop/bitcoin/format/common/BitcoinUtil.java#L335-L346
RestComm/Restcomm-Connect
restcomm/restcomm.mscontrol.mms/src/main/java/org/restcomm/connect/mscontrol/mms/MmsConferenceController.java
MmsConferenceController.onJoinCall
private void onJoinCall(JoinCall message, ActorRef self, ActorRef sender) { """ /*private void onMediaGroupStateChanged(MediaGroupStateChanged message, ActorRef self, ActorRef sender) throws Exception { switch (message.state()) { case ACTIVE: if (is(creatingMediaGroup)) { fsm.transition(message, gettingCnfMediaResourceController); } break; case INACTIVE: if (is(creatingMediaGroup)) { this.fail = Boolean.TRUE; fsm.transition(message, failed); } else if (is(stopping)) { Stop media group actor this.mediaGroup.tell(new StopObserving(self), self); context().stop(mediaGroup); this.mediaGroup = null; Move to next state if (this.mediaGroup == null && this.cnfEndpoint == null) { this.fsm.transition(message, fail ? failed : inactive); } } break; default: break; } } """ connectionMode = message.getConnectionMode(); // Tell call to join conference by passing reference to the media mixer final JoinConference join = new JoinConference(this.cnfEndpoint, connectionMode, message.getSid()); message.getCall().tell(join, sender); }
java
private void onJoinCall(JoinCall message, ActorRef self, ActorRef sender) { connectionMode = message.getConnectionMode(); // Tell call to join conference by passing reference to the media mixer final JoinConference join = new JoinConference(this.cnfEndpoint, connectionMode, message.getSid()); message.getCall().tell(join, sender); }
[ "private", "void", "onJoinCall", "(", "JoinCall", "message", ",", "ActorRef", "self", ",", "ActorRef", "sender", ")", "{", "connectionMode", "=", "message", ".", "getConnectionMode", "(", ")", ";", "// Tell call to join conference by passing reference to the media mixer", "final", "JoinConference", "join", "=", "new", "JoinConference", "(", "this", ".", "cnfEndpoint", ",", "connectionMode", ",", "message", ".", "getSid", "(", ")", ")", ";", "message", ".", "getCall", "(", ")", ".", "tell", "(", "join", ",", "sender", ")", ";", "}" ]
/*private void onMediaGroupStateChanged(MediaGroupStateChanged message, ActorRef self, ActorRef sender) throws Exception { switch (message.state()) { case ACTIVE: if (is(creatingMediaGroup)) { fsm.transition(message, gettingCnfMediaResourceController); } break; case INACTIVE: if (is(creatingMediaGroup)) { this.fail = Boolean.TRUE; fsm.transition(message, failed); } else if (is(stopping)) { Stop media group actor this.mediaGroup.tell(new StopObserving(self), self); context().stop(mediaGroup); this.mediaGroup = null; Move to next state if (this.mediaGroup == null && this.cnfEndpoint == null) { this.fsm.transition(message, fail ? failed : inactive); } } break; default: break; } }
[ "/", "*", "private", "void", "onMediaGroupStateChanged", "(", "MediaGroupStateChanged", "message", "ActorRef", "self", "ActorRef", "sender", ")", "throws", "Exception", "{", "switch", "(", "message", ".", "state", "()", ")", "{", "case", "ACTIVE", ":", "if", "(", "is", "(", "creatingMediaGroup", "))", "{", "fsm", ".", "transition", "(", "message", "gettingCnfMediaResourceController", ")", ";", "}", "break", ";" ]
train
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.mscontrol.mms/src/main/java/org/restcomm/connect/mscontrol/mms/MmsConferenceController.java#L380-L385
jbundle/osgi
core/src/main/java/org/jbundle/util/osgi/finder/BaseClassFinderService.java
BaseClassFinderService.saveProperties
@Override public boolean saveProperties(String servicePid, Dictionary<String, String> properties) { """ Set the configuration properties for this Pid. @param servicePid The service Pid @param The properties to save. @return True if successful """ try { if (servicePid != null) { ServiceReference caRef = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); if (caRef != null) { ConfigurationAdmin configAdmin = (ConfigurationAdmin)bundleContext.getService(caRef); Configuration config = configAdmin.getConfiguration(servicePid); config.update(properties); return true; } } } catch (IOException e) { e.printStackTrace(); } return false; }
java
@Override public boolean saveProperties(String servicePid, Dictionary<String, String> properties) { try { if (servicePid != null) { ServiceReference caRef = bundleContext.getServiceReference(ConfigurationAdmin.class.getName()); if (caRef != null) { ConfigurationAdmin configAdmin = (ConfigurationAdmin)bundleContext.getService(caRef); Configuration config = configAdmin.getConfiguration(servicePid); config.update(properties); return true; } } } catch (IOException e) { e.printStackTrace(); } return false; }
[ "@", "Override", "public", "boolean", "saveProperties", "(", "String", "servicePid", ",", "Dictionary", "<", "String", ",", "String", ">", "properties", ")", "{", "try", "{", "if", "(", "servicePid", "!=", "null", ")", "{", "ServiceReference", "caRef", "=", "bundleContext", ".", "getServiceReference", "(", "ConfigurationAdmin", ".", "class", ".", "getName", "(", ")", ")", ";", "if", "(", "caRef", "!=", "null", ")", "{", "ConfigurationAdmin", "configAdmin", "=", "(", "ConfigurationAdmin", ")", "bundleContext", ".", "getService", "(", "caRef", ")", ";", "Configuration", "config", "=", "configAdmin", ".", "getConfiguration", "(", "servicePid", ")", ";", "config", ".", "update", "(", "properties", ")", ";", "return", "true", ";", "}", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "false", ";", "}" ]
Set the configuration properties for this Pid. @param servicePid The service Pid @param The properties to save. @return True if successful
[ "Set", "the", "configuration", "properties", "for", "this", "Pid", "." ]
train
https://github.com/jbundle/osgi/blob/beb02aef78736a4f799aaac001c8f0327bf0536c/core/src/main/java/org/jbundle/util/osgi/finder/BaseClassFinderService.java#L871-L891
NessComputing/components-ness-jdbi
src/main/java/com/nesscomputing/jdbi/JdbiMappers.java
JdbiMappers.getEnum
public static <T extends Enum<T>> T getEnum(final ResultSet rs, final Class<T> enumType, final String columnName) throws SQLException { """ Returns an Enum representing the data or null if the input is null. """ final String str = rs.getString(columnName); return (str == null) ? null : Enum.valueOf(enumType, str); }
java
public static <T extends Enum<T>> T getEnum(final ResultSet rs, final Class<T> enumType, final String columnName) throws SQLException { final String str = rs.getString(columnName); return (str == null) ? null : Enum.valueOf(enumType, str); }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "getEnum", "(", "final", "ResultSet", "rs", ",", "final", "Class", "<", "T", ">", "enumType", ",", "final", "String", "columnName", ")", "throws", "SQLException", "{", "final", "String", "str", "=", "rs", ".", "getString", "(", "columnName", ")", ";", "return", "(", "str", "==", "null", ")", "?", "null", ":", "Enum", ".", "valueOf", "(", "enumType", ",", "str", ")", ";", "}" ]
Returns an Enum representing the data or null if the input is null.
[ "Returns", "an", "Enum", "representing", "the", "data", "or", "null", "if", "the", "input", "is", "null", "." ]
train
https://github.com/NessComputing/components-ness-jdbi/blob/d446217b6f29b5409e55c5e72172cf0dbeacfec3/src/main/java/com/nesscomputing/jdbi/JdbiMappers.java#L108-L113
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRenderer.java
WDataTableRenderer.paintColumnHeadings
private void paintColumnHeadings(final WDataTable table, final WebXmlRenderContext renderContext) { """ Paints the column headings for the given table. @param table the table to paint the headings for. @param renderContext the RenderContext to paint to. """ XmlStringBuilder xml = renderContext.getWriter(); int[] columnOrder = table.getColumnOrder(); TableDataModel model = table.getDataModel(); final int columnCount = table.getColumnCount(); xml.appendTagOpen("ui:thead"); xml.appendOptionalAttribute("hidden", !table.isShowColumnHeaders(), "true"); xml.appendClose(); if (table.isShowRowHeaders()) { paintColumnHeading(table.getRowHeaderColumn(), false, renderContext); } for (int i = 0; i < columnCount; i++) { int colIndex = columnOrder == null ? i : columnOrder[i]; WTableColumn col = table.getColumn(colIndex); if (col.isVisible()) { boolean sortable = model.isSortable(colIndex); paintColumnHeading(col, sortable, renderContext); } } xml.appendEndTag("ui:thead"); }
java
private void paintColumnHeadings(final WDataTable table, final WebXmlRenderContext renderContext) { XmlStringBuilder xml = renderContext.getWriter(); int[] columnOrder = table.getColumnOrder(); TableDataModel model = table.getDataModel(); final int columnCount = table.getColumnCount(); xml.appendTagOpen("ui:thead"); xml.appendOptionalAttribute("hidden", !table.isShowColumnHeaders(), "true"); xml.appendClose(); if (table.isShowRowHeaders()) { paintColumnHeading(table.getRowHeaderColumn(), false, renderContext); } for (int i = 0; i < columnCount; i++) { int colIndex = columnOrder == null ? i : columnOrder[i]; WTableColumn col = table.getColumn(colIndex); if (col.isVisible()) { boolean sortable = model.isSortable(colIndex); paintColumnHeading(col, sortable, renderContext); } } xml.appendEndTag("ui:thead"); }
[ "private", "void", "paintColumnHeadings", "(", "final", "WDataTable", "table", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "int", "[", "]", "columnOrder", "=", "table", ".", "getColumnOrder", "(", ")", ";", "TableDataModel", "model", "=", "table", ".", "getDataModel", "(", ")", ";", "final", "int", "columnCount", "=", "table", ".", "getColumnCount", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:thead\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hidden\"", ",", "!", "table", ".", "isShowColumnHeaders", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendClose", "(", ")", ";", "if", "(", "table", ".", "isShowRowHeaders", "(", ")", ")", "{", "paintColumnHeading", "(", "table", ".", "getRowHeaderColumn", "(", ")", ",", "false", ",", "renderContext", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "columnCount", ";", "i", "++", ")", "{", "int", "colIndex", "=", "columnOrder", "==", "null", "?", "i", ":", "columnOrder", "[", "i", "]", ";", "WTableColumn", "col", "=", "table", ".", "getColumn", "(", "colIndex", ")", ";", "if", "(", "col", ".", "isVisible", "(", ")", ")", "{", "boolean", "sortable", "=", "model", ".", "isSortable", "(", "colIndex", ")", ";", "paintColumnHeading", "(", "col", ",", "sortable", ",", "renderContext", ")", ";", "}", "}", "xml", ".", "appendEndTag", "(", "\"ui:thead\"", ")", ";", "}" ]
Paints the column headings for the given table. @param table the table to paint the headings for. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "column", "headings", "for", "the", "given", "table", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRenderer.java#L370-L395
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java
TimeSeriesUtils.reshapeVectorToTimeSeriesMask
public static INDArray reshapeVectorToTimeSeriesMask(INDArray timeSeriesMaskAsVector, int minibatchSize) { """ Reshape time series mask arrays. This should match the assumptions (f order, etc) in RnnOutputLayer @param timeSeriesMaskAsVector Mask array to reshape to a column vector @return Mask array as a column vector """ if (!timeSeriesMaskAsVector.isVector()) throw new IllegalArgumentException("Cannot reshape mask: expected vector"); val timeSeriesLength = timeSeriesMaskAsVector.length() / minibatchSize; return timeSeriesMaskAsVector.reshape('f', minibatchSize, timeSeriesLength); }
java
public static INDArray reshapeVectorToTimeSeriesMask(INDArray timeSeriesMaskAsVector, int minibatchSize) { if (!timeSeriesMaskAsVector.isVector()) throw new IllegalArgumentException("Cannot reshape mask: expected vector"); val timeSeriesLength = timeSeriesMaskAsVector.length() / minibatchSize; return timeSeriesMaskAsVector.reshape('f', minibatchSize, timeSeriesLength); }
[ "public", "static", "INDArray", "reshapeVectorToTimeSeriesMask", "(", "INDArray", "timeSeriesMaskAsVector", ",", "int", "minibatchSize", ")", "{", "if", "(", "!", "timeSeriesMaskAsVector", ".", "isVector", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Cannot reshape mask: expected vector\"", ")", ";", "val", "timeSeriesLength", "=", "timeSeriesMaskAsVector", ".", "length", "(", ")", "/", "minibatchSize", ";", "return", "timeSeriesMaskAsVector", ".", "reshape", "(", "'", "'", ",", "minibatchSize", ",", "timeSeriesLength", ")", ";", "}" ]
Reshape time series mask arrays. This should match the assumptions (f order, etc) in RnnOutputLayer @param timeSeriesMaskAsVector Mask array to reshape to a column vector @return Mask array as a column vector
[ "Reshape", "time", "series", "mask", "arrays", ".", "This", "should", "match", "the", "assumptions", "(", "f", "order", "etc", ")", "in", "RnnOutputLayer" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/TimeSeriesUtils.java#L110-L117
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/util/clhm/ConcurrentLinkedHashMap.java
ConcurrentLinkedHashMap.recordRead
long recordRead(int bufferIndex, Node<K, V> node) { """ Records a read in the buffer and return its write count. @param bufferIndex the index to the chosen read buffer @param node the entry in the page replacement policy @return the number of writes on the chosen read buffer """ // The location in the buffer is chosen in a racy fashion as the increment // is not atomic with the insertion. This means that concurrent reads can // overlap and overwrite one another, resulting in a lossy buffer. final AtomicLong counter = readBufferWriteCount[bufferIndex]; final long writeCount = counter.get(); counter.lazySet(writeCount + 1); final int index = (int) (writeCount & READ_BUFFER_INDEX_MASK); readBuffers[bufferIndex][index].lazySet(node); return writeCount; }
java
long recordRead(int bufferIndex, Node<K, V> node) { // The location in the buffer is chosen in a racy fashion as the increment // is not atomic with the insertion. This means that concurrent reads can // overlap and overwrite one another, resulting in a lossy buffer. final AtomicLong counter = readBufferWriteCount[bufferIndex]; final long writeCount = counter.get(); counter.lazySet(writeCount + 1); final int index = (int) (writeCount & READ_BUFFER_INDEX_MASK); readBuffers[bufferIndex][index].lazySet(node); return writeCount; }
[ "long", "recordRead", "(", "int", "bufferIndex", ",", "Node", "<", "K", ",", "V", ">", "node", ")", "{", "// The location in the buffer is chosen in a racy fashion as the increment", "// is not atomic with the insertion. This means that concurrent reads can", "// overlap and overwrite one another, resulting in a lossy buffer.", "final", "AtomicLong", "counter", "=", "readBufferWriteCount", "[", "bufferIndex", "]", ";", "final", "long", "writeCount", "=", "counter", ".", "get", "(", ")", ";", "counter", ".", "lazySet", "(", "writeCount", "+", "1", ")", ";", "final", "int", "index", "=", "(", "int", ")", "(", "writeCount", "&", "READ_BUFFER_INDEX_MASK", ")", ";", "readBuffers", "[", "bufferIndex", "]", "[", "index", "]", ".", "lazySet", "(", "node", ")", ";", "return", "writeCount", ";", "}" ]
Records a read in the buffer and return its write count. @param bufferIndex the index to the chosen read buffer @param node the entry in the page replacement policy @return the number of writes on the chosen read buffer
[ "Records", "a", "read", "in", "the", "buffer", "and", "return", "its", "write", "count", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/util/clhm/ConcurrentLinkedHashMap.java#L360-L372
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonWriter.java
JsonWriter.writeDurationField
private void writeDurationField(String fieldName, Object value) throws IOException { """ Write a duration field to the JSON file. @param fieldName field name @param value field value """ if (value instanceof String) { m_writer.writeNameValuePair(fieldName + "_text", (String) value); } else { Duration val = (Duration) value; if (val.getDuration() != 0) { Duration minutes = val.convertUnits(TimeUnit.MINUTES, m_projectFile.getProjectProperties()); long seconds = (long) (minutes.getDuration() * 60.0); m_writer.writeNameValuePair(fieldName, seconds); } } }
java
private void writeDurationField(String fieldName, Object value) throws IOException { if (value instanceof String) { m_writer.writeNameValuePair(fieldName + "_text", (String) value); } else { Duration val = (Duration) value; if (val.getDuration() != 0) { Duration minutes = val.convertUnits(TimeUnit.MINUTES, m_projectFile.getProjectProperties()); long seconds = (long) (minutes.getDuration() * 60.0); m_writer.writeNameValuePair(fieldName, seconds); } } }
[ "private", "void", "writeDurationField", "(", "String", "fieldName", ",", "Object", "value", ")", "throws", "IOException", "{", "if", "(", "value", "instanceof", "String", ")", "{", "m_writer", ".", "writeNameValuePair", "(", "fieldName", "+", "\"_text\"", ",", "(", "String", ")", "value", ")", ";", "}", "else", "{", "Duration", "val", "=", "(", "Duration", ")", "value", ";", "if", "(", "val", ".", "getDuration", "(", ")", "!=", "0", ")", "{", "Duration", "minutes", "=", "val", ".", "convertUnits", "(", "TimeUnit", ".", "MINUTES", ",", "m_projectFile", ".", "getProjectProperties", "(", ")", ")", ";", "long", "seconds", "=", "(", "long", ")", "(", "minutes", ".", "getDuration", "(", ")", "*", "60.0", ")", ";", "m_writer", ".", "writeNameValuePair", "(", "fieldName", ",", "seconds", ")", ";", "}", "}", "}" ]
Write a duration field to the JSON file. @param fieldName field name @param value field value
[ "Write", "a", "duration", "field", "to", "the", "JSON", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonWriter.java#L415-L431
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageScaling.java
ImageScaling.scaleFit
public static void scaleFit(Bitmap src, Bitmap dest, int clearColor) { """ Scaling src Bitmap to fit and cenetered in dest bitmap. Method keep aspect ratio. @param src source bitmap @param dest destination bitmap @param clearColor color for clearing dest before drawing """ float ratio = Math.min(dest.getWidth() / (float) src.getWidth(), dest.getHeight() / (float) src.getHeight()); int newW = (int) (src.getWidth() * ratio); int newH = (int) (src.getHeight() * ratio); int paddingTop = (dest.getHeight() - (int) (src.getHeight() * ratio)) / 2; int paddingLeft = (dest.getWidth() - (int) (src.getWidth() * ratio)) / 2; scale(src, dest, clearColor, 0, 0, src.getWidth(), src.getHeight(), paddingLeft, paddingTop, newW + paddingLeft, newH + paddingTop); }
java
public static void scaleFit(Bitmap src, Bitmap dest, int clearColor) { float ratio = Math.min(dest.getWidth() / (float) src.getWidth(), dest.getHeight() / (float) src.getHeight()); int newW = (int) (src.getWidth() * ratio); int newH = (int) (src.getHeight() * ratio); int paddingTop = (dest.getHeight() - (int) (src.getHeight() * ratio)) / 2; int paddingLeft = (dest.getWidth() - (int) (src.getWidth() * ratio)) / 2; scale(src, dest, clearColor, 0, 0, src.getWidth(), src.getHeight(), paddingLeft, paddingTop, newW + paddingLeft, newH + paddingTop); }
[ "public", "static", "void", "scaleFit", "(", "Bitmap", "src", ",", "Bitmap", "dest", ",", "int", "clearColor", ")", "{", "float", "ratio", "=", "Math", ".", "min", "(", "dest", ".", "getWidth", "(", ")", "/", "(", "float", ")", "src", ".", "getWidth", "(", ")", ",", "dest", ".", "getHeight", "(", ")", "/", "(", "float", ")", "src", ".", "getHeight", "(", ")", ")", ";", "int", "newW", "=", "(", "int", ")", "(", "src", ".", "getWidth", "(", ")", "*", "ratio", ")", ";", "int", "newH", "=", "(", "int", ")", "(", "src", ".", "getHeight", "(", ")", "*", "ratio", ")", ";", "int", "paddingTop", "=", "(", "dest", ".", "getHeight", "(", ")", "-", "(", "int", ")", "(", "src", ".", "getHeight", "(", ")", "*", "ratio", ")", ")", "/", "2", ";", "int", "paddingLeft", "=", "(", "dest", ".", "getWidth", "(", ")", "-", "(", "int", ")", "(", "src", ".", "getWidth", "(", ")", "*", "ratio", ")", ")", "/", "2", ";", "scale", "(", "src", ",", "dest", ",", "clearColor", ",", "0", ",", "0", ",", "src", ".", "getWidth", "(", ")", ",", "src", ".", "getHeight", "(", ")", ",", "paddingLeft", ",", "paddingTop", ",", "newW", "+", "paddingLeft", ",", "newH", "+", "paddingTop", ")", ";", "}" ]
Scaling src Bitmap to fit and cenetered in dest bitmap. Method keep aspect ratio. @param src source bitmap @param dest destination bitmap @param clearColor color for clearing dest before drawing
[ "Scaling", "src", "Bitmap", "to", "fit", "and", "cenetered", "in", "dest", "bitmap", ".", "Method", "keep", "aspect", "ratio", "." ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageScaling.java#L90-L100
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteClient.java
RouteClient.insertRoute
@BetaApi public final Operation insertRoute(String project, Route routeResource) { """ Creates a Route resource in the specified project using the data included in the request. <p>Sample code: <pre><code> try (RouteClient routeClient = RouteClient.create()) { ProjectName project = ProjectName.of("[PROJECT]"); Route routeResource = Route.newBuilder().build(); Operation response = routeClient.insertRoute(project.toString(), routeResource); } </code></pre> @param project Project ID for this request. @param routeResource Represents a Route resource. A route specifies how certain packets should be handled by the network. Routes are associated with instances by tags and the set of routes for a particular instance is called its routing table. <p>For each packet leaving an instance, the system searches that instance's routing table for a single best matching route. Routes match packets by destination IP address, preferring smaller or more specific ranges over larger ones. If there is a tie, the system selects the route with the smallest priority value. If there is still a tie, it uses the layer three and four packet headers to select just one of the remaining matching routes. The packet is then forwarded as specified by the nextHop field of the winning route - either to another instance destination, an instance gateway, or a Google Compute Engine-operated gateway. <p>Packets that do not match any route in the sending instance's routing table are dropped. (== resource_for beta.routes ==) (== resource_for v1.routes ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails """ InsertRouteHttpRequest request = InsertRouteHttpRequest.newBuilder() .setProject(project) .setRouteResource(routeResource) .build(); return insertRoute(request); }
java
@BetaApi public final Operation insertRoute(String project, Route routeResource) { InsertRouteHttpRequest request = InsertRouteHttpRequest.newBuilder() .setProject(project) .setRouteResource(routeResource) .build(); return insertRoute(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertRoute", "(", "String", "project", ",", "Route", "routeResource", ")", "{", "InsertRouteHttpRequest", "request", "=", "InsertRouteHttpRequest", ".", "newBuilder", "(", ")", ".", "setProject", "(", "project", ")", ".", "setRouteResource", "(", "routeResource", ")", ".", "build", "(", ")", ";", "return", "insertRoute", "(", "request", ")", ";", "}" ]
Creates a Route resource in the specified project using the data included in the request. <p>Sample code: <pre><code> try (RouteClient routeClient = RouteClient.create()) { ProjectName project = ProjectName.of("[PROJECT]"); Route routeResource = Route.newBuilder().build(); Operation response = routeClient.insertRoute(project.toString(), routeResource); } </code></pre> @param project Project ID for this request. @param routeResource Represents a Route resource. A route specifies how certain packets should be handled by the network. Routes are associated with instances by tags and the set of routes for a particular instance is called its routing table. <p>For each packet leaving an instance, the system searches that instance's routing table for a single best matching route. Routes match packets by destination IP address, preferring smaller or more specific ranges over larger ones. If there is a tie, the system selects the route with the smallest priority value. If there is still a tie, it uses the layer three and four packet headers to select just one of the remaining matching routes. The packet is then forwarded as specified by the nextHop field of the winning route - either to another instance destination, an instance gateway, or a Google Compute Engine-operated gateway. <p>Packets that do not match any route in the sending instance's routing table are dropped. (== resource_for beta.routes ==) (== resource_for v1.routes ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "Route", "resource", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouteClient.java#L419-L428
bozaro/git-lfs-java
gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java
Client.postMeta
@Nullable public ObjectRes postMeta(@NotNull final String hash, final long size) throws IOException { """ Get metadata for object by hash. @param hash Object hash. @param size Object size. @return Object metadata or null, if object not found. @throws IOException """ return postMeta(new Meta(hash, size)); }
java
@Nullable public ObjectRes postMeta(@NotNull final String hash, final long size) throws IOException { return postMeta(new Meta(hash, size)); }
[ "@", "Nullable", "public", "ObjectRes", "postMeta", "(", "@", "NotNull", "final", "String", "hash", ",", "final", "long", "size", ")", "throws", "IOException", "{", "return", "postMeta", "(", "new", "Meta", "(", "hash", ",", "size", ")", ")", ";", "}" ]
Get metadata for object by hash. @param hash Object hash. @param size Object size. @return Object metadata or null, if object not found. @throws IOException
[ "Get", "metadata", "for", "object", "by", "hash", "." ]
train
https://github.com/bozaro/git-lfs-java/blob/ee05bf0472ee61bf362cf93d283e5ee5d44ef685/gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java#L92-L95
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java
NonplanarBonds.hasOnlyPlainBonds
private boolean hasOnlyPlainBonds(int v, IBond allowedDoubleBond) { """ Check that an atom (v:index) is only adjacent to plain single bonds (may be a bold or hashed wedged - e.g. at fat end) with the single exception being the allowed double bond passed as an argument. @param v atom index @param allowedDoubleBond a double bond that is allowed @return the atom is adjacent to one or more plain single bonds """ int count = 0; for (int neighbor : graph[v]) { IBond adjBond = edgeToBond.get(v, neighbor); // non single bonds if (adjBond.getOrder().numeric() > 1) { if (!allowedDoubleBond.equals(adjBond)) { return false; } } // single bonds else { if (adjBond.getStereo() == UP_OR_DOWN || adjBond.getStereo() == UP_OR_DOWN_INVERTED) { return false; } count++; } } return count > 0; }
java
private boolean hasOnlyPlainBonds(int v, IBond allowedDoubleBond) { int count = 0; for (int neighbor : graph[v]) { IBond adjBond = edgeToBond.get(v, neighbor); // non single bonds if (adjBond.getOrder().numeric() > 1) { if (!allowedDoubleBond.equals(adjBond)) { return false; } } // single bonds else { if (adjBond.getStereo() == UP_OR_DOWN || adjBond.getStereo() == UP_OR_DOWN_INVERTED) { return false; } count++; } } return count > 0; }
[ "private", "boolean", "hasOnlyPlainBonds", "(", "int", "v", ",", "IBond", "allowedDoubleBond", ")", "{", "int", "count", "=", "0", ";", "for", "(", "int", "neighbor", ":", "graph", "[", "v", "]", ")", "{", "IBond", "adjBond", "=", "edgeToBond", ".", "get", "(", "v", ",", "neighbor", ")", ";", "// non single bonds", "if", "(", "adjBond", ".", "getOrder", "(", ")", ".", "numeric", "(", ")", ">", "1", ")", "{", "if", "(", "!", "allowedDoubleBond", ".", "equals", "(", "adjBond", ")", ")", "{", "return", "false", ";", "}", "}", "// single bonds", "else", "{", "if", "(", "adjBond", ".", "getStereo", "(", ")", "==", "UP_OR_DOWN", "||", "adjBond", ".", "getStereo", "(", ")", "==", "UP_OR_DOWN_INVERTED", ")", "{", "return", "false", ";", "}", "count", "++", ";", "}", "}", "return", "count", ">", "0", ";", "}" ]
Check that an atom (v:index) is only adjacent to plain single bonds (may be a bold or hashed wedged - e.g. at fat end) with the single exception being the allowed double bond passed as an argument. @param v atom index @param allowedDoubleBond a double bond that is allowed @return the atom is adjacent to one or more plain single bonds
[ "Check", "that", "an", "atom", "(", "v", ":", "index", ")", "is", "only", "adjacent", "to", "plain", "single", "bonds", "(", "may", "be", "a", "bold", "or", "hashed", "wedged", "-", "e", ".", "g", ".", "at", "fat", "end", ")", "with", "the", "single", "exception", "being", "the", "allowed", "double", "bond", "passed", "as", "an", "argument", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/NonplanarBonds.java#L1184-L1203
powermock/powermock
powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java
SuppressCode.suppressMethod
public static synchronized void suppressMethod(Class<?> clazz, String methodName, String... additionalMethodNames) { """ Suppress multiple methods for a class. @param clazz The class whose methods will be suppressed. @param methodName The first method to be suppress in class {@code clazz}. @param additionalMethodNames Additional methods to suppress in class {@code clazz}. """ for (Method method : Whitebox.getMethods(clazz, methodName)) { MockRepository.addMethodToSuppress(method); } if (additionalMethodNames != null && additionalMethodNames.length > 0) { for (Method method : Whitebox.getMethods(clazz, additionalMethodNames)) { MockRepository.addMethodToSuppress(method); } } }
java
public static synchronized void suppressMethod(Class<?> clazz, String methodName, String... additionalMethodNames) { for (Method method : Whitebox.getMethods(clazz, methodName)) { MockRepository.addMethodToSuppress(method); } if (additionalMethodNames != null && additionalMethodNames.length > 0) { for (Method method : Whitebox.getMethods(clazz, additionalMethodNames)) { MockRepository.addMethodToSuppress(method); } } }
[ "public", "static", "synchronized", "void", "suppressMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "String", "...", "additionalMethodNames", ")", "{", "for", "(", "Method", "method", ":", "Whitebox", ".", "getMethods", "(", "clazz", ",", "methodName", ")", ")", "{", "MockRepository", ".", "addMethodToSuppress", "(", "method", ")", ";", "}", "if", "(", "additionalMethodNames", "!=", "null", "&&", "additionalMethodNames", ".", "length", ">", "0", ")", "{", "for", "(", "Method", "method", ":", "Whitebox", ".", "getMethods", "(", "clazz", ",", "additionalMethodNames", ")", ")", "{", "MockRepository", ".", "addMethodToSuppress", "(", "method", ")", ";", "}", "}", "}" ]
Suppress multiple methods for a class. @param clazz The class whose methods will be suppressed. @param methodName The first method to be suppress in class {@code clazz}. @param additionalMethodNames Additional methods to suppress in class {@code clazz}.
[ "Suppress", "multiple", "methods", "for", "a", "class", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java#L185-L194
jenkinsci/jenkins
core/src/main/java/hudson/scm/SCM.java
SCM.calcRevisionsFromBuild
public @CheckForNull SCMRevisionState calcRevisionsFromBuild(@Nonnull Run<?,?> build, @Nullable FilePath workspace, @Nullable Launcher launcher, @Nonnull TaskListener listener) throws IOException, InterruptedException { """ Calculates the {@link SCMRevisionState} that represents the state of the workspace of the given build. <p> The returned object is then fed into the {@link #compareRemoteRevisionWith(AbstractProject, Launcher, FilePath, TaskListener, SCMRevisionState)} method as the baseline {@link SCMRevisionState} to determine if the build is necessary. <p> This method is called after source code is checked out for the given build (that is, after {@link SCM#checkout(Run, Launcher, FilePath, TaskListener, File, SCMRevisionState)} has finished successfully.) <p> The obtained object is added to the build as an {@link Action} for later retrieval. As an optimization, {@link SCM} implementation can choose to compute {@link SCMRevisionState} and add it as an action during check out, in which case this method will not called. @param build The calculated {@link SCMRevisionState} is for the files checked out in this build. If {@link #requiresWorkspaceForPolling()} returns true, Hudson makes sure that the workspace of this build is available and accessible by the callee. @param workspace the location of the checkout; normally not null, since this will normally be called immediately after checkout, though could be null if data is being loaded from a very old version of Jenkins and the SCM declares that it does not require a workspace for polling @param launcher Abstraction of the machine where the polling will take place. Nullness matches that of {@code workspace}. @param listener Logs during the polling should be sent here. @throws InterruptedException interruption is usually caused by the user aborting the computation. this exception should be simply propagated all the way up. @since 1.568 """ if (build instanceof AbstractBuild && Util.isOverridden(SCM.class, getClass(), "calcRevisionsFromBuild", AbstractBuild.class, Launcher.class, TaskListener.class)) { return calcRevisionsFromBuild((AbstractBuild) build, launcher, listener); } else { throw new AbstractMethodError("you must override the new calcRevisionsFromBuild overload"); } }
java
public @CheckForNull SCMRevisionState calcRevisionsFromBuild(@Nonnull Run<?,?> build, @Nullable FilePath workspace, @Nullable Launcher launcher, @Nonnull TaskListener listener) throws IOException, InterruptedException { if (build instanceof AbstractBuild && Util.isOverridden(SCM.class, getClass(), "calcRevisionsFromBuild", AbstractBuild.class, Launcher.class, TaskListener.class)) { return calcRevisionsFromBuild((AbstractBuild) build, launcher, listener); } else { throw new AbstractMethodError("you must override the new calcRevisionsFromBuild overload"); } }
[ "public", "@", "CheckForNull", "SCMRevisionState", "calcRevisionsFromBuild", "(", "@", "Nonnull", "Run", "<", "?", ",", "?", ">", "build", ",", "@", "Nullable", "FilePath", "workspace", ",", "@", "Nullable", "Launcher", "launcher", ",", "@", "Nonnull", "TaskListener", "listener", ")", "throws", "IOException", ",", "InterruptedException", "{", "if", "(", "build", "instanceof", "AbstractBuild", "&&", "Util", ".", "isOverridden", "(", "SCM", ".", "class", ",", "getClass", "(", ")", ",", "\"calcRevisionsFromBuild\"", ",", "AbstractBuild", ".", "class", ",", "Launcher", ".", "class", ",", "TaskListener", ".", "class", ")", ")", "{", "return", "calcRevisionsFromBuild", "(", "(", "AbstractBuild", ")", "build", ",", "launcher", ",", "listener", ")", ";", "}", "else", "{", "throw", "new", "AbstractMethodError", "(", "\"you must override the new calcRevisionsFromBuild overload\"", ")", ";", "}", "}" ]
Calculates the {@link SCMRevisionState} that represents the state of the workspace of the given build. <p> The returned object is then fed into the {@link #compareRemoteRevisionWith(AbstractProject, Launcher, FilePath, TaskListener, SCMRevisionState)} method as the baseline {@link SCMRevisionState} to determine if the build is necessary. <p> This method is called after source code is checked out for the given build (that is, after {@link SCM#checkout(Run, Launcher, FilePath, TaskListener, File, SCMRevisionState)} has finished successfully.) <p> The obtained object is added to the build as an {@link Action} for later retrieval. As an optimization, {@link SCM} implementation can choose to compute {@link SCMRevisionState} and add it as an action during check out, in which case this method will not called. @param build The calculated {@link SCMRevisionState} is for the files checked out in this build. If {@link #requiresWorkspaceForPolling()} returns true, Hudson makes sure that the workspace of this build is available and accessible by the callee. @param workspace the location of the checkout; normally not null, since this will normally be called immediately after checkout, though could be null if data is being loaded from a very old version of Jenkins and the SCM declares that it does not require a workspace for polling @param launcher Abstraction of the machine where the polling will take place. Nullness matches that of {@code workspace}. @param listener Logs during the polling should be sent here. @throws InterruptedException interruption is usually caused by the user aborting the computation. this exception should be simply propagated all the way up. @since 1.568
[ "Calculates", "the", "{", "@link", "SCMRevisionState", "}", "that", "represents", "the", "state", "of", "the", "workspace", "of", "the", "given", "build", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/scm/SCM.java#L331-L337
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.copyOfRange
public static <T> T[] copyOfRange(final T[] original, final int from, final int to, final int step) { """ Copy all the elements in <code>original</code>, through <code>to</code>-<code>from</code>, by <code>step</code>. @param original @param from @param to @param step @return """ return copyOfRange(original, from, to, step, (Class<T[]>) original.getClass()); }
java
public static <T> T[] copyOfRange(final T[] original, final int from, final int to, final int step) { return copyOfRange(original, from, to, step, (Class<T[]>) original.getClass()); }
[ "public", "static", "<", "T", ">", "T", "[", "]", "copyOfRange", "(", "final", "T", "[", "]", "original", ",", "final", "int", "from", ",", "final", "int", "to", ",", "final", "int", "step", ")", "{", "return", "copyOfRange", "(", "original", ",", "from", ",", "to", ",", "step", ",", "(", "Class", "<", "T", "[", "]", ">", ")", "original", ".", "getClass", "(", ")", ")", ";", "}" ]
Copy all the elements in <code>original</code>, through <code>to</code>-<code>from</code>, by <code>step</code>. @param original @param from @param to @param step @return
[ "Copy", "all", "the", "elements", "in", "<code", ">", "original<", "/", "code", ">", "through", "<code", ">", "to<", "/", "code", ">", "-", "<code", ">", "from<", "/", "code", ">", "by", "<code", ">", "step<", "/", "code", ">", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L10941-L10943
netty/netty
handler/src/main/java/io/netty/handler/ssl/SslContext.java
SslContext.newClientContext
@Deprecated public static SslContext newClientContext( SslProvider provider, TrustManagerFactory trustManagerFactory) throws SSLException { """ Creates a new client-side {@link SslContext}. @param provider the {@link SslContext} implementation to use. {@code null} to use the current default one. @param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s that verifies the certificates sent from servers. {@code null} to use the default. @return a new client-side {@link SslContext} @deprecated Replaced by {@link SslContextBuilder} """ return newClientContext(provider, null, trustManagerFactory); }
java
@Deprecated public static SslContext newClientContext( SslProvider provider, TrustManagerFactory trustManagerFactory) throws SSLException { return newClientContext(provider, null, trustManagerFactory); }
[ "@", "Deprecated", "public", "static", "SslContext", "newClientContext", "(", "SslProvider", "provider", ",", "TrustManagerFactory", "trustManagerFactory", ")", "throws", "SSLException", "{", "return", "newClientContext", "(", "provider", ",", "null", ",", "trustManagerFactory", ")", ";", "}" ]
Creates a new client-side {@link SslContext}. @param provider the {@link SslContext} implementation to use. {@code null} to use the current default one. @param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s that verifies the certificates sent from servers. {@code null} to use the default. @return a new client-side {@link SslContext} @deprecated Replaced by {@link SslContextBuilder}
[ "Creates", "a", "new", "client", "-", "side", "{", "@link", "SslContext", "}", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L603-L607
voldemort/voldemort
src/java/voldemort/utils/PartitionBalanceUtils.java
PartitionBalanceUtils.compressedListOfPartitionsInZone
public static String compressedListOfPartitionsInZone(final Cluster cluster, int zoneId) { """ Compress contiguous partitions into format "e-i" instead of "e, f, g, h, i". This helps illustrate contiguous partitions within a zone. @param cluster @param zoneId @return pretty string of partitions per zone """ Map<Integer, Integer> idToRunLength = PartitionBalanceUtils.getMapOfContiguousPartitions(cluster, zoneId); StringBuilder sb = new StringBuilder(); sb.append("["); boolean first = true; Set<Integer> sortedInitPartitionIds = new TreeSet<Integer>(idToRunLength.keySet()); for(int initPartitionId: sortedInitPartitionIds) { if(!first) { sb.append(", "); } else { first = false; } int runLength = idToRunLength.get(initPartitionId); if(runLength == 1) { sb.append(initPartitionId); } else { int endPartitionId = (initPartitionId + runLength - 1) % cluster.getNumberOfPartitions(); sb.append(initPartitionId).append("-").append(endPartitionId); } } sb.append("]"); return sb.toString(); }
java
public static String compressedListOfPartitionsInZone(final Cluster cluster, int zoneId) { Map<Integer, Integer> idToRunLength = PartitionBalanceUtils.getMapOfContiguousPartitions(cluster, zoneId); StringBuilder sb = new StringBuilder(); sb.append("["); boolean first = true; Set<Integer> sortedInitPartitionIds = new TreeSet<Integer>(idToRunLength.keySet()); for(int initPartitionId: sortedInitPartitionIds) { if(!first) { sb.append(", "); } else { first = false; } int runLength = idToRunLength.get(initPartitionId); if(runLength == 1) { sb.append(initPartitionId); } else { int endPartitionId = (initPartitionId + runLength - 1) % cluster.getNumberOfPartitions(); sb.append(initPartitionId).append("-").append(endPartitionId); } } sb.append("]"); return sb.toString(); }
[ "public", "static", "String", "compressedListOfPartitionsInZone", "(", "final", "Cluster", "cluster", ",", "int", "zoneId", ")", "{", "Map", "<", "Integer", ",", "Integer", ">", "idToRunLength", "=", "PartitionBalanceUtils", ".", "getMapOfContiguousPartitions", "(", "cluster", ",", "zoneId", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"[\"", ")", ";", "boolean", "first", "=", "true", ";", "Set", "<", "Integer", ">", "sortedInitPartitionIds", "=", "new", "TreeSet", "<", "Integer", ">", "(", "idToRunLength", ".", "keySet", "(", ")", ")", ";", "for", "(", "int", "initPartitionId", ":", "sortedInitPartitionIds", ")", "{", "if", "(", "!", "first", ")", "{", "sb", ".", "append", "(", "\", \"", ")", ";", "}", "else", "{", "first", "=", "false", ";", "}", "int", "runLength", "=", "idToRunLength", ".", "get", "(", "initPartitionId", ")", ";", "if", "(", "runLength", "==", "1", ")", "{", "sb", ".", "append", "(", "initPartitionId", ")", ";", "}", "else", "{", "int", "endPartitionId", "=", "(", "initPartitionId", "+", "runLength", "-", "1", ")", "%", "cluster", ".", "getNumberOfPartitions", "(", ")", ";", "sb", ".", "append", "(", "initPartitionId", ")", ".", "append", "(", "\"-\"", ")", ".", "append", "(", "endPartitionId", ")", ";", "}", "}", "sb", ".", "append", "(", "\"]\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Compress contiguous partitions into format "e-i" instead of "e, f, g, h, i". This helps illustrate contiguous partitions within a zone. @param cluster @param zoneId @return pretty string of partitions per zone
[ "Compress", "contiguous", "partitions", "into", "format", "e", "-", "i", "instead", "of", "e", "f", "g", "h", "i", ".", "This", "helps", "illustrate", "contiguous", "partitions", "within", "a", "zone", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/PartitionBalanceUtils.java#L54-L81
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/certificatevalidation/crl/CRLVerifier.java
CRLVerifier.downloadCRLFromWeb
protected X509CRL downloadCRLFromWeb(String crlURL) throws IOException, CertificateVerificationException { """ Downloads CRL from the crlUrl. Does not support HTTPS. @param crlURL URL of the CRL distribution point. @return Downloaded CRL. @throws IOException If an error occurs while downloading the CRL from web. @throws CertificateVerificationException If an error occurs in CRL download process. """ URL url = new URL(crlURL); try (InputStream crlStream = url.openStream()) { CertificateFactory cf = CertificateFactory.getInstance(Constants.X_509); return (X509CRL) cf.generateCRL(crlStream); } catch (MalformedURLException e) { throw new CertificateVerificationException("CRL URL is malformed", e); } catch (IOException e) { throw new CertificateVerificationException("Cant reach URI: " + crlURL + " - only support HTTP", e); } catch (CertificateException e) { throw new CertificateVerificationException(e); } catch (CRLException e) { throw new CertificateVerificationException("Cannot generate X509CRL from the stream data", e); } }
java
protected X509CRL downloadCRLFromWeb(String crlURL) throws IOException, CertificateVerificationException { URL url = new URL(crlURL); try (InputStream crlStream = url.openStream()) { CertificateFactory cf = CertificateFactory.getInstance(Constants.X_509); return (X509CRL) cf.generateCRL(crlStream); } catch (MalformedURLException e) { throw new CertificateVerificationException("CRL URL is malformed", e); } catch (IOException e) { throw new CertificateVerificationException("Cant reach URI: " + crlURL + " - only support HTTP", e); } catch (CertificateException e) { throw new CertificateVerificationException(e); } catch (CRLException e) { throw new CertificateVerificationException("Cannot generate X509CRL from the stream data", e); } }
[ "protected", "X509CRL", "downloadCRLFromWeb", "(", "String", "crlURL", ")", "throws", "IOException", ",", "CertificateVerificationException", "{", "URL", "url", "=", "new", "URL", "(", "crlURL", ")", ";", "try", "(", "InputStream", "crlStream", "=", "url", ".", "openStream", "(", ")", ")", "{", "CertificateFactory", "cf", "=", "CertificateFactory", ".", "getInstance", "(", "Constants", ".", "X_509", ")", ";", "return", "(", "X509CRL", ")", "cf", ".", "generateCRL", "(", "crlStream", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "throw", "new", "CertificateVerificationException", "(", "\"CRL URL is malformed\"", ",", "e", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CertificateVerificationException", "(", "\"Cant reach URI: \"", "+", "crlURL", "+", "\" - only support HTTP\"", ",", "e", ")", ";", "}", "catch", "(", "CertificateException", "e", ")", "{", "throw", "new", "CertificateVerificationException", "(", "e", ")", ";", "}", "catch", "(", "CRLException", "e", ")", "{", "throw", "new", "CertificateVerificationException", "(", "\"Cannot generate X509CRL from the stream data\"", ",", "e", ")", ";", "}", "}" ]
Downloads CRL from the crlUrl. Does not support HTTPS. @param crlURL URL of the CRL distribution point. @return Downloaded CRL. @throws IOException If an error occurs while downloading the CRL from web. @throws CertificateVerificationException If an error occurs in CRL download process.
[ "Downloads", "CRL", "from", "the", "crlUrl", ".", "Does", "not", "support", "HTTPS", "." ]
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/certificatevalidation/crl/CRLVerifier.java#L124-L138
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/TotalOrderPartitioner.java
TotalOrderPartitioner.configure
@SuppressWarnings("unchecked") // keytype from conf not static public void configure(JobConf job) { """ Read in the partition file and build indexing data structures. If the keytype is {@link org.apache.hadoop.io.BinaryComparable} and <tt>total.order.partitioner.natural.order</tt> is not false, a trie of the first <tt>total.order.partitioner.max.trie.depth</tt>(2) + 1 bytes will be built. Otherwise, keys will be located using a binary search of the partition keyset using the {@link org.apache.hadoop.io.RawComparator} defined for this job. The input file must be sorted with the same comparator and contain {@link org.apache.hadoop.mapred.JobConf#getNumReduceTasks} - 1 keys. """ try { String parts = getPartitionFile(job); final Path partFile = new Path(parts); final FileSystem fs = (DEFAULT_PATH.equals(parts)) ? FileSystem.getLocal(job) // assume in DistributedCache : partFile.getFileSystem(job); Class<K> keyClass = (Class<K>)job.getMapOutputKeyClass(); K[] splitPoints = readPartitions(fs, partFile, keyClass, job); if (splitPoints.length != job.getNumReduceTasks() - 1) { throw new IOException("Wrong number of partitions in keyset"); } RawComparator<K> comparator = (RawComparator<K>) job.getOutputKeyComparator(); for (int i = 0; i < splitPoints.length - 1; ++i) { if (comparator.compare(splitPoints[i], splitPoints[i+1]) >= 0) { throw new IOException("Split points are out of order"); } } boolean natOrder = job.getBoolean("total.order.partitioner.natural.order", true); if (natOrder && BinaryComparable.class.isAssignableFrom(keyClass)) { partitions = buildTrie((BinaryComparable[])splitPoints, 0, splitPoints.length, new byte[0], job.getInt("total.order.partitioner.max.trie.depth", 2)); } else { partitions = new BinarySearchNode(splitPoints, comparator); } } catch (IOException e) { throw new IllegalArgumentException("Can't read partitions file", e); } }
java
@SuppressWarnings("unchecked") // keytype from conf not static public void configure(JobConf job) { try { String parts = getPartitionFile(job); final Path partFile = new Path(parts); final FileSystem fs = (DEFAULT_PATH.equals(parts)) ? FileSystem.getLocal(job) // assume in DistributedCache : partFile.getFileSystem(job); Class<K> keyClass = (Class<K>)job.getMapOutputKeyClass(); K[] splitPoints = readPartitions(fs, partFile, keyClass, job); if (splitPoints.length != job.getNumReduceTasks() - 1) { throw new IOException("Wrong number of partitions in keyset"); } RawComparator<K> comparator = (RawComparator<K>) job.getOutputKeyComparator(); for (int i = 0; i < splitPoints.length - 1; ++i) { if (comparator.compare(splitPoints[i], splitPoints[i+1]) >= 0) { throw new IOException("Split points are out of order"); } } boolean natOrder = job.getBoolean("total.order.partitioner.natural.order", true); if (natOrder && BinaryComparable.class.isAssignableFrom(keyClass)) { partitions = buildTrie((BinaryComparable[])splitPoints, 0, splitPoints.length, new byte[0], job.getInt("total.order.partitioner.max.trie.depth", 2)); } else { partitions = new BinarySearchNode(splitPoints, comparator); } } catch (IOException e) { throw new IllegalArgumentException("Can't read partitions file", e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// keytype from conf not static", "public", "void", "configure", "(", "JobConf", "job", ")", "{", "try", "{", "String", "parts", "=", "getPartitionFile", "(", "job", ")", ";", "final", "Path", "partFile", "=", "new", "Path", "(", "parts", ")", ";", "final", "FileSystem", "fs", "=", "(", "DEFAULT_PATH", ".", "equals", "(", "parts", ")", ")", "?", "FileSystem", ".", "getLocal", "(", "job", ")", "// assume in DistributedCache", ":", "partFile", ".", "getFileSystem", "(", "job", ")", ";", "Class", "<", "K", ">", "keyClass", "=", "(", "Class", "<", "K", ">", ")", "job", ".", "getMapOutputKeyClass", "(", ")", ";", "K", "[", "]", "splitPoints", "=", "readPartitions", "(", "fs", ",", "partFile", ",", "keyClass", ",", "job", ")", ";", "if", "(", "splitPoints", ".", "length", "!=", "job", ".", "getNumReduceTasks", "(", ")", "-", "1", ")", "{", "throw", "new", "IOException", "(", "\"Wrong number of partitions in keyset\"", ")", ";", "}", "RawComparator", "<", "K", ">", "comparator", "=", "(", "RawComparator", "<", "K", ">", ")", "job", ".", "getOutputKeyComparator", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "splitPoints", ".", "length", "-", "1", ";", "++", "i", ")", "{", "if", "(", "comparator", ".", "compare", "(", "splitPoints", "[", "i", "]", ",", "splitPoints", "[", "i", "+", "1", "]", ")", ">=", "0", ")", "{", "throw", "new", "IOException", "(", "\"Split points are out of order\"", ")", ";", "}", "}", "boolean", "natOrder", "=", "job", ".", "getBoolean", "(", "\"total.order.partitioner.natural.order\"", ",", "true", ")", ";", "if", "(", "natOrder", "&&", "BinaryComparable", ".", "class", ".", "isAssignableFrom", "(", "keyClass", ")", ")", "{", "partitions", "=", "buildTrie", "(", "(", "BinaryComparable", "[", "]", ")", "splitPoints", ",", "0", ",", "splitPoints", ".", "length", ",", "new", "byte", "[", "0", "]", ",", "job", ".", "getInt", "(", "\"total.order.partitioner.max.trie.depth\"", ",", "2", ")", ")", ";", "}", "else", "{", "partitions", "=", "new", "BinarySearchNode", "(", "splitPoints", ",", "comparator", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Can't read partitions file\"", ",", "e", ")", ";", "}", "}" ]
Read in the partition file and build indexing data structures. If the keytype is {@link org.apache.hadoop.io.BinaryComparable} and <tt>total.order.partitioner.natural.order</tt> is not false, a trie of the first <tt>total.order.partitioner.max.trie.depth</tt>(2) + 1 bytes will be built. Otherwise, keys will be located using a binary search of the partition keyset using the {@link org.apache.hadoop.io.RawComparator} defined for this job. The input file must be sorted with the same comparator and contain {@link org.apache.hadoop.mapred.JobConf#getNumReduceTasks} - 1 keys.
[ "Read", "in", "the", "partition", "file", "and", "build", "indexing", "data", "structures", ".", "If", "the", "keytype", "is", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/TotalOrderPartitioner.java#L60-L93
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_scheduler_serviceName_events_uid_DELETE
public void billingAccount_scheduler_serviceName_events_uid_DELETE(String billingAccount, String serviceName, String uid) throws IOException { """ Delete the given scheduler event REST: DELETE /telephony/{billingAccount}/scheduler/{serviceName}/events/{uid} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param uid [required] The unique ICS event identifier """ String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}/events/{uid}"; StringBuilder sb = path(qPath, billingAccount, serviceName, uid); exec(qPath, "DELETE", sb.toString(), null); }
java
public void billingAccount_scheduler_serviceName_events_uid_DELETE(String billingAccount, String serviceName, String uid) throws IOException { String qPath = "/telephony/{billingAccount}/scheduler/{serviceName}/events/{uid}"; StringBuilder sb = path(qPath, billingAccount, serviceName, uid); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "billingAccount_scheduler_serviceName_events_uid_DELETE", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "String", "uid", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/scheduler/{serviceName}/events/{uid}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "uid", ")", ";", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Delete the given scheduler event REST: DELETE /telephony/{billingAccount}/scheduler/{serviceName}/events/{uid} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param uid [required] The unique ICS event identifier
[ "Delete", "the", "given", "scheduler", "event" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L657-L661
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/MapView.java
MapView.getWorldToViewScaling
public Matrix getWorldToViewScaling() { """ Return the world-to-view space translation matrix. @return transformation matrix """ if (viewState.getScale() > 0) { return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), 0, 0); } return new Matrix(1, 0, 0, 1, 0, 0); }
java
public Matrix getWorldToViewScaling() { if (viewState.getScale() > 0) { return new Matrix(viewState.getScale(), 0, 0, -viewState.getScale(), 0, 0); } return new Matrix(1, 0, 0, 1, 0, 0); }
[ "public", "Matrix", "getWorldToViewScaling", "(", ")", "{", "if", "(", "viewState", ".", "getScale", "(", ")", ">", "0", ")", "{", "return", "new", "Matrix", "(", "viewState", ".", "getScale", "(", ")", ",", "0", ",", "0", ",", "-", "viewState", ".", "getScale", "(", ")", ",", "0", ",", "0", ")", ";", "}", "return", "new", "Matrix", "(", "1", ",", "0", ",", "0", ",", "1", ",", "0", ",", "0", ")", ";", "}" ]
Return the world-to-view space translation matrix. @return transformation matrix
[ "Return", "the", "world", "-", "to", "-", "view", "space", "translation", "matrix", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L211-L216
jmxtrans/jmxtrans
jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/StackdriverWriter.java
StackdriverWriter.internalWrite
@Override public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { """ Implementation of the base writing method. Operates in two stages: <br/> First turns the query result into a JSON message in Stackdriver format <br/> Second posts the message to the Stackdriver gateway via HTTP """ String gatewayMessage = getGatewayMessage(results); // message won't be returned if there are no numeric values in the query results if (gatewayMessage != null) { logger.info(gatewayMessage); doSend(gatewayMessage); } }
java
@Override public void internalWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { String gatewayMessage = getGatewayMessage(results); // message won't be returned if there are no numeric values in the query results if (gatewayMessage != null) { logger.info(gatewayMessage); doSend(gatewayMessage); } }
[ "@", "Override", "public", "void", "internalWrite", "(", "Server", "server", ",", "Query", "query", ",", "ImmutableList", "<", "Result", ">", "results", ")", "throws", "Exception", "{", "String", "gatewayMessage", "=", "getGatewayMessage", "(", "results", ")", ";", "// message won't be returned if there are no numeric values in the query results", "if", "(", "gatewayMessage", "!=", "null", ")", "{", "logger", ".", "info", "(", "gatewayMessage", ")", ";", "doSend", "(", "gatewayMessage", ")", ";", "}", "}" ]
Implementation of the base writing method. Operates in two stages: <br/> First turns the query result into a JSON message in Stackdriver format <br/> Second posts the message to the Stackdriver gateway via HTTP
[ "Implementation", "of", "the", "base", "writing", "method", ".", "Operates", "in", "two", "stages", ":", "<br", "/", ">", "First", "turns", "the", "query", "result", "into", "a", "JSON", "message", "in", "Stackdriver", "format", "<br", "/", ">", "Second", "posts", "the", "message", "to", "the", "Stackdriver", "gateway", "via", "HTTP" ]
train
https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-output/jmxtrans-output-core/src/main/java/com/googlecode/jmxtrans/model/output/StackdriverWriter.java#L260-L269
TNG/JGiven
jgiven-junit/src/main/java/com/tngtech/jgiven/junit/JGivenMethodRule.java
JGivenMethodRule.getArgumentsFrom
private static List<Object> getArgumentsFrom( Constructor<?> constructor, Object target ) { """ Searches for all arguments of the given {@link Parameterized} test class by retrieving the values of all non-static instance fields and comparing their types with the constructor arguments. The order of resulting parameters corresponds to the order of the constructor argument types (which is equal to order of the provided data of the method annotated with {@link Parameterized}). If the constructor contains multiple arguments of the same type, the order of {@link ReflectionUtil#getAllNonStaticFieldValuesFrom(Class, Object, String)} is used. @param constructor {@link Constructor} from which argument types should be retrieved @param target {@link Parameterized} test instance from which arguments tried to be retrieved @return the determined arguments, never {@code null} """ Class<?> testClass = target.getClass(); Class<?>[] constructorParamClasses = constructor.getParameterTypes(); List<Object> fieldValues = ReflectionUtil.getAllNonStaticFieldValuesFrom( testClass, target, " Consider writing a bug report." ); return getTypeMatchingValuesInOrderOf( constructorParamClasses, fieldValues ); }
java
private static List<Object> getArgumentsFrom( Constructor<?> constructor, Object target ) { Class<?> testClass = target.getClass(); Class<?>[] constructorParamClasses = constructor.getParameterTypes(); List<Object> fieldValues = ReflectionUtil.getAllNonStaticFieldValuesFrom( testClass, target, " Consider writing a bug report." ); return getTypeMatchingValuesInOrderOf( constructorParamClasses, fieldValues ); }
[ "private", "static", "List", "<", "Object", ">", "getArgumentsFrom", "(", "Constructor", "<", "?", ">", "constructor", ",", "Object", "target", ")", "{", "Class", "<", "?", ">", "testClass", "=", "target", ".", "getClass", "(", ")", ";", "Class", "<", "?", ">", "[", "]", "constructorParamClasses", "=", "constructor", ".", "getParameterTypes", "(", ")", ";", "List", "<", "Object", ">", "fieldValues", "=", "ReflectionUtil", ".", "getAllNonStaticFieldValuesFrom", "(", "testClass", ",", "target", ",", "\" Consider writing a bug report.\"", ")", ";", "return", "getTypeMatchingValuesInOrderOf", "(", "constructorParamClasses", ",", "fieldValues", ")", ";", "}" ]
Searches for all arguments of the given {@link Parameterized} test class by retrieving the values of all non-static instance fields and comparing their types with the constructor arguments. The order of resulting parameters corresponds to the order of the constructor argument types (which is equal to order of the provided data of the method annotated with {@link Parameterized}). If the constructor contains multiple arguments of the same type, the order of {@link ReflectionUtil#getAllNonStaticFieldValuesFrom(Class, Object, String)} is used. @param constructor {@link Constructor} from which argument types should be retrieved @param target {@link Parameterized} test instance from which arguments tried to be retrieved @return the determined arguments, never {@code null}
[ "Searches", "for", "all", "arguments", "of", "the", "given", "{", "@link", "Parameterized", "}", "test", "class", "by", "retrieving", "the", "values", "of", "all", "non", "-", "static", "instance", "fields", "and", "comparing", "their", "types", "with", "the", "constructor", "arguments", ".", "The", "order", "of", "resulting", "parameters", "corresponds", "to", "the", "order", "of", "the", "constructor", "argument", "types", "(", "which", "is", "equal", "to", "order", "of", "the", "provided", "data", "of", "the", "method", "annotated", "with", "{", "@link", "Parameterized", "}", ")", ".", "If", "the", "constructor", "contains", "multiple", "arguments", "of", "the", "same", "type", "the", "order", "of", "{", "@link", "ReflectionUtil#getAllNonStaticFieldValuesFrom", "(", "Class", "Object", "String", ")", "}", "is", "used", "." ]
train
https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-junit/src/main/java/com/tngtech/jgiven/junit/JGivenMethodRule.java#L182-L190
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java
PersonGroupPersonsImpl.addPersonFaceFromUrlWithServiceResponseAsync
public Observable<ServiceResponse<PersistedFace>> addPersonFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url, AddPersonFaceFromUrlOptionalParameter addPersonFaceFromUrlOptionalParameter) { """ Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @param personGroupId Id referencing a particular person group. @param personId Id referencing a particular person. @param url Publicly reachable URL of an image @param addPersonFaceFromUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PersistedFace object """ if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (personGroupId == null) { throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null."); } if (personId == null) { throw new IllegalArgumentException("Parameter personId is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final String userData = addPersonFaceFromUrlOptionalParameter != null ? addPersonFaceFromUrlOptionalParameter.userData() : null; final List<Integer> targetFace = addPersonFaceFromUrlOptionalParameter != null ? addPersonFaceFromUrlOptionalParameter.targetFace() : null; return addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, userData, targetFace); }
java
public Observable<ServiceResponse<PersistedFace>> addPersonFaceFromUrlWithServiceResponseAsync(String personGroupId, UUID personId, String url, AddPersonFaceFromUrlOptionalParameter addPersonFaceFromUrlOptionalParameter) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (personGroupId == null) { throw new IllegalArgumentException("Parameter personGroupId is required and cannot be null."); } if (personId == null) { throw new IllegalArgumentException("Parameter personId is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final String userData = addPersonFaceFromUrlOptionalParameter != null ? addPersonFaceFromUrlOptionalParameter.userData() : null; final List<Integer> targetFace = addPersonFaceFromUrlOptionalParameter != null ? addPersonFaceFromUrlOptionalParameter.targetFace() : null; return addPersonFaceFromUrlWithServiceResponseAsync(personGroupId, personId, url, userData, targetFace); }
[ "public", "Observable", "<", "ServiceResponse", "<", "PersistedFace", ">", ">", "addPersonFaceFromUrlWithServiceResponseAsync", "(", "String", "personGroupId", ",", "UUID", "personId", ",", "String", "url", ",", "AddPersonFaceFromUrlOptionalParameter", "addPersonFaceFromUrlOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "azureRegion", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.azureRegion() is required and cannot be null.\"", ")", ";", "}", "if", "(", "personGroupId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter personGroupId is required and cannot be null.\"", ")", ";", "}", "if", "(", "personId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter personId is required and cannot be null.\"", ")", ";", "}", "if", "(", "url", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter url is required and cannot be null.\"", ")", ";", "}", "final", "String", "userData", "=", "addPersonFaceFromUrlOptionalParameter", "!=", "null", "?", "addPersonFaceFromUrlOptionalParameter", ".", "userData", "(", ")", ":", "null", ";", "final", "List", "<", "Integer", ">", "targetFace", "=", "addPersonFaceFromUrlOptionalParameter", "!=", "null", "?", "addPersonFaceFromUrlOptionalParameter", ".", "targetFace", "(", ")", ":", "null", ";", "return", "addPersonFaceFromUrlWithServiceResponseAsync", "(", "personGroupId", ",", "personId", ",", "url", ",", "userData", ",", "targetFace", ")", ";", "}" ]
Add a representative face to a person for identification. The input face is specified as an image with a targetFace rectangle. @param personGroupId Id referencing a particular person group. @param personId Id referencing a particular person. @param url Publicly reachable URL of an image @param addPersonFaceFromUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PersistedFace object
[ "Add", "a", "representative", "face", "to", "a", "person", "for", "identification", ".", "The", "input", "face", "is", "specified", "as", "an", "image", "with", "a", "targetFace", "rectangle", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/PersonGroupPersonsImpl.java#L1219-L1236
maxirosson/jdroid-android
jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java
StringEntityRepository.replaceStringChildren
public void replaceStringChildren(List<String> strings, String parentId) { """ This method allows to replace all string children of a given parent, it will remove any children which are not in the list, add the new ones and update which are in the list. @param strings string children list to replace. @param parentId id of parent entity. """ ArrayList<StringEntity> entities = new ArrayList<>(); for (String string : strings) { if (string != null) { StringEntity entity = new StringEntity(); entity.setParentId(parentId); entity.setValue(string); entities.add(entity); } } replaceChildren(entities, parentId); }
java
public void replaceStringChildren(List<String> strings, String parentId) { ArrayList<StringEntity> entities = new ArrayList<>(); for (String string : strings) { if (string != null) { StringEntity entity = new StringEntity(); entity.setParentId(parentId); entity.setValue(string); entities.add(entity); } } replaceChildren(entities, parentId); }
[ "public", "void", "replaceStringChildren", "(", "List", "<", "String", ">", "strings", ",", "String", "parentId", ")", "{", "ArrayList", "<", "StringEntity", ">", "entities", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "string", ":", "strings", ")", "{", "if", "(", "string", "!=", "null", ")", "{", "StringEntity", "entity", "=", "new", "StringEntity", "(", ")", ";", "entity", ".", "setParentId", "(", "parentId", ")", ";", "entity", ".", "setValue", "(", "string", ")", ";", "entities", ".", "add", "(", "entity", ")", ";", "}", "}", "replaceChildren", "(", "entities", ",", "parentId", ")", ";", "}" ]
This method allows to replace all string children of a given parent, it will remove any children which are not in the list, add the new ones and update which are in the list. @param strings string children list to replace. @param parentId id of parent entity.
[ "This", "method", "allows", "to", "replace", "all", "string", "children", "of", "a", "given", "parent", "it", "will", "remove", "any", "children", "which", "are", "not", "in", "the", "list", "add", "the", "new", "ones", "and", "update", "which", "are", "in", "the", "list", "." ]
train
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java#L68-L79
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/ClassLoaderHelper.java
ClassLoaderHelper.getResource
@Nullable public static URL getResource (@Nonnull final ClassLoader aClassLoader, @Nonnull @Nonempty final String sPath) { """ Get the URL of the passed resource using the specified class loader only. This is a sanity wrapper around <code>classLoader.getResource (sPath)</code>. @param aClassLoader The class loader to be used. May not be <code>null</code>. @param sPath The path to be resolved. May neither be <code>null</code> nor empty. Internally it is ensured that the provided path does NOT start with a slash. @return <code>null</code> if the path could not be resolved using the specified class loader. """ ValueEnforcer.notNull (aClassLoader, "ClassLoader"); ValueEnforcer.notEmpty (sPath, "Path"); // Ensure the path does NOT starts with a "/" final String sPathWithoutSlash = _getPathWithoutLeadingSlash (sPath); // returns null if not found return aClassLoader.getResource (sPathWithoutSlash); }
java
@Nullable public static URL getResource (@Nonnull final ClassLoader aClassLoader, @Nonnull @Nonempty final String sPath) { ValueEnforcer.notNull (aClassLoader, "ClassLoader"); ValueEnforcer.notEmpty (sPath, "Path"); // Ensure the path does NOT starts with a "/" final String sPathWithoutSlash = _getPathWithoutLeadingSlash (sPath); // returns null if not found return aClassLoader.getResource (sPathWithoutSlash); }
[ "@", "Nullable", "public", "static", "URL", "getResource", "(", "@", "Nonnull", "final", "ClassLoader", "aClassLoader", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sPath", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aClassLoader", ",", "\"ClassLoader\"", ")", ";", "ValueEnforcer", ".", "notEmpty", "(", "sPath", ",", "\"Path\"", ")", ";", "// Ensure the path does NOT starts with a \"/\"", "final", "String", "sPathWithoutSlash", "=", "_getPathWithoutLeadingSlash", "(", "sPath", ")", ";", "// returns null if not found", "return", "aClassLoader", ".", "getResource", "(", "sPathWithoutSlash", ")", ";", "}" ]
Get the URL of the passed resource using the specified class loader only. This is a sanity wrapper around <code>classLoader.getResource (sPath)</code>. @param aClassLoader The class loader to be used. May not be <code>null</code>. @param sPath The path to be resolved. May neither be <code>null</code> nor empty. Internally it is ensured that the provided path does NOT start with a slash. @return <code>null</code> if the path could not be resolved using the specified class loader.
[ "Get", "the", "URL", "of", "the", "passed", "resource", "using", "the", "specified", "class", "loader", "only", ".", "This", "is", "a", "sanity", "wrapper", "around", "<code", ">", "classLoader", ".", "getResource", "(", "sPath", ")", "<", "/", "code", ">", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/ClassLoaderHelper.java#L121-L132
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.classesNotConfigured
public static void classesNotConfigured(Class<?> destination,Class<?> source) { """ Thrown when the xml configuration doesn't exist. @param destination destination class name @param source source class name """ throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException2,destination.getSimpleName(), source.getSimpleName())); }
java
public static void classesNotConfigured(Class<?> destination,Class<?> source){ throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException2,destination.getSimpleName(), source.getSimpleName())); }
[ "public", "static", "void", "classesNotConfigured", "(", "Class", "<", "?", ">", "destination", ",", "Class", "<", "?", ">", "source", ")", "{", "throw", "new", "MappingNotFoundException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "Constants", ".", "mappingNotFoundException2", ",", "destination", ".", "getSimpleName", "(", ")", ",", "source", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown when the xml configuration doesn't exist. @param destination destination class name @param source source class name
[ "Thrown", "when", "the", "xml", "configuration", "doesn", "t", "exist", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L530-L532
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java
JavaUtils.determineMostSpecificType
public static String determineMostSpecificType(final String... types) { """ Determines the type which is most "specific" (i. e. parametrized types are more "specific" than generic types, types which are not {@link Object} are less specific). If no exact statement can be made, the first type is chosen. @param types The types @return The most "specific" type """ switch (types.length) { case 0: throw new IllegalArgumentException("At least one type has to be provided"); case 1: return types[0]; case 2: return determineMostSpecific(types[0], types[1]); default: String currentMostSpecific = determineMostSpecific(types[0], types[1]); for (int i = 2; i < types.length; i++) { currentMostSpecific = determineMostSpecific(currentMostSpecific, types[i]); } return currentMostSpecific; } }
java
public static String determineMostSpecificType(final String... types) { switch (types.length) { case 0: throw new IllegalArgumentException("At least one type has to be provided"); case 1: return types[0]; case 2: return determineMostSpecific(types[0], types[1]); default: String currentMostSpecific = determineMostSpecific(types[0], types[1]); for (int i = 2; i < types.length; i++) { currentMostSpecific = determineMostSpecific(currentMostSpecific, types[i]); } return currentMostSpecific; } }
[ "public", "static", "String", "determineMostSpecificType", "(", "final", "String", "...", "types", ")", "{", "switch", "(", "types", ".", "length", ")", "{", "case", "0", ":", "throw", "new", "IllegalArgumentException", "(", "\"At least one type has to be provided\"", ")", ";", "case", "1", ":", "return", "types", "[", "0", "]", ";", "case", "2", ":", "return", "determineMostSpecific", "(", "types", "[", "0", "]", ",", "types", "[", "1", "]", ")", ";", "default", ":", "String", "currentMostSpecific", "=", "determineMostSpecific", "(", "types", "[", "0", "]", ",", "types", "[", "1", "]", ")", ";", "for", "(", "int", "i", "=", "2", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "currentMostSpecific", "=", "determineMostSpecific", "(", "currentMostSpecific", ",", "types", "[", "i", "]", ")", ";", "}", "return", "currentMostSpecific", ";", "}", "}" ]
Determines the type which is most "specific" (i. e. parametrized types are more "specific" than generic types, types which are not {@link Object} are less specific). If no exact statement can be made, the first type is chosen. @param types The types @return The most "specific" type
[ "Determines", "the", "type", "which", "is", "most", "specific", "(", "i", ".", "e", ".", "parametrized", "types", "are", "more", "specific", "than", "generic", "types", "types", "which", "are", "not", "{", "@link", "Object", "}", "are", "less", "specific", ")", ".", "If", "no", "exact", "statement", "can", "be", "made", "the", "first", "type", "is", "chosen", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java#L89-L104
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/CassandraClientBase.java
CassandraClientBase.onSuperColumn
protected void onSuperColumn(EntityMetadata m, boolean isRelation, List<String> relations, List<Object> entities, List<SuperColumn> superColumns, ByteBuffer key) { """ On super column. @param m the m @param isRelation the is relation @param relations the relations @param entities the entities @param superColumns the super columns @param key the key """ Object e = null; Object id = PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), key.array()); ThriftRow tr = new ThriftRow(id, m.getTableName(), new ArrayList<Column>(0), superColumns, new ArrayList<CounterColumn>(0), new ArrayList<CounterSuperColumn>(0)); e = getDataHandler().populateEntity(tr, m, KunderaCoreUtils.getEntity(e), relations, isRelation); if (log.isInfoEnabled()) { log.info("Populating data for super column family of clazz {} and row key {}.", m.getEntityClazz(), tr.getId()); } if (e != null) { entities.add(e); } }
java
protected void onSuperColumn(EntityMetadata m, boolean isRelation, List<String> relations, List<Object> entities, List<SuperColumn> superColumns, ByteBuffer key) { Object e = null; Object id = PropertyAccessorHelper.getObject(m.getIdAttribute().getJavaType(), key.array()); ThriftRow tr = new ThriftRow(id, m.getTableName(), new ArrayList<Column>(0), superColumns, new ArrayList<CounterColumn>(0), new ArrayList<CounterSuperColumn>(0)); e = getDataHandler().populateEntity(tr, m, KunderaCoreUtils.getEntity(e), relations, isRelation); if (log.isInfoEnabled()) { log.info("Populating data for super column family of clazz {} and row key {}.", m.getEntityClazz(), tr.getId()); } if (e != null) { entities.add(e); } }
[ "protected", "void", "onSuperColumn", "(", "EntityMetadata", "m", ",", "boolean", "isRelation", ",", "List", "<", "String", ">", "relations", ",", "List", "<", "Object", ">", "entities", ",", "List", "<", "SuperColumn", ">", "superColumns", ",", "ByteBuffer", "key", ")", "{", "Object", "e", "=", "null", ";", "Object", "id", "=", "PropertyAccessorHelper", ".", "getObject", "(", "m", ".", "getIdAttribute", "(", ")", ".", "getJavaType", "(", ")", ",", "key", ".", "array", "(", ")", ")", ";", "ThriftRow", "tr", "=", "new", "ThriftRow", "(", "id", ",", "m", ".", "getTableName", "(", ")", ",", "new", "ArrayList", "<", "Column", ">", "(", "0", ")", ",", "superColumns", ",", "new", "ArrayList", "<", "CounterColumn", ">", "(", "0", ")", ",", "new", "ArrayList", "<", "CounterSuperColumn", ">", "(", "0", ")", ")", ";", "e", "=", "getDataHandler", "(", ")", ".", "populateEntity", "(", "tr", ",", "m", ",", "KunderaCoreUtils", ".", "getEntity", "(", "e", ")", ",", "relations", ",", "isRelation", ")", ";", "if", "(", "log", ".", "isInfoEnabled", "(", ")", ")", "{", "log", ".", "info", "(", "\"Populating data for super column family of clazz {} and row key {}.\"", ",", "m", ".", "getEntityClazz", "(", ")", ",", "tr", ".", "getId", "(", ")", ")", ";", "}", "if", "(", "e", "!=", "null", ")", "{", "entities", ".", "add", "(", "e", ")", ";", "}", "}" ]
On super column. @param m the m @param isRelation the is relation @param relations the relations @param entities the entities @param superColumns the super columns @param key the key
[ "On", "super", "column", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/CassandraClientBase.java#L402-L419
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.addAnnotationToPolymer
public final static PolymerNotation addAnnotationToPolymer(final PolymerNotation polymer, final String annotation) { """ method to add an annotation to a PolymerNotation @param polymer PolymerNotation @param annotation new annotation @return PolymerNotation with the annotation """ if (polymer.getAnnotation() != null) { return new PolymerNotation(polymer.getPolymerID(), polymer.getPolymerElements(), polymer.getAnnotation() + " | " + annotation); } return new PolymerNotation(polymer.getPolymerID(), polymer.getPolymerElements(), annotation); }
java
public final static PolymerNotation addAnnotationToPolymer(final PolymerNotation polymer, final String annotation) { if (polymer.getAnnotation() != null) { return new PolymerNotation(polymer.getPolymerID(), polymer.getPolymerElements(), polymer.getAnnotation() + " | " + annotation); } return new PolymerNotation(polymer.getPolymerID(), polymer.getPolymerElements(), annotation); }
[ "public", "final", "static", "PolymerNotation", "addAnnotationToPolymer", "(", "final", "PolymerNotation", "polymer", ",", "final", "String", "annotation", ")", "{", "if", "(", "polymer", ".", "getAnnotation", "(", ")", "!=", "null", ")", "{", "return", "new", "PolymerNotation", "(", "polymer", ".", "getPolymerID", "(", ")", ",", "polymer", ".", "getPolymerElements", "(", ")", ",", "polymer", ".", "getAnnotation", "(", ")", "+", "\" | \"", "+", "annotation", ")", ";", "}", "return", "new", "PolymerNotation", "(", "polymer", ".", "getPolymerID", "(", ")", ",", "polymer", ".", "getPolymerElements", "(", ")", ",", "annotation", ")", ";", "}" ]
method to add an annotation to a PolymerNotation @param polymer PolymerNotation @param annotation new annotation @return PolymerNotation with the annotation
[ "method", "to", "add", "an", "annotation", "to", "a", "PolymerNotation" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L245-L251
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnonymousIndividualImpl_CustomFieldSerializer.java
OWLAnonymousIndividualImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLAnonymousIndividualImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLAnonymousIndividualImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLAnonymousIndividualImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLAnonymousIndividualImpl_CustomFieldSerializer.java#L63-L66
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSplitPaneDividerBackground
public void paintSplitPaneDividerBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { """ Paints the background of the divider of a split pane. This implementation invokes the method of the same name without the orientation. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSplitPane.HORIZONTAL_SPLIT</code> or <code>JSplitPane.VERTICAL_SPLIT</code> """ if (orientation == JSplitPane.HORIZONTAL_SPLIT) { AffineTransform transform = new AffineTransform(); transform.scale(-1, 1); transform.rotate(Math.toRadians(90)); paintBackground(context, g, y, x, h, w, transform); } else { paintBackground(context, g, x, y, w, h, null); } }
java
public void paintSplitPaneDividerBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { if (orientation == JSplitPane.HORIZONTAL_SPLIT) { AffineTransform transform = new AffineTransform(); transform.scale(-1, 1); transform.rotate(Math.toRadians(90)); paintBackground(context, g, y, x, h, w, transform); } else { paintBackground(context, g, x, y, w, h, null); } }
[ "public", "void", "paintSplitPaneDividerBackground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "if", "(", "orientation", "==", "JSplitPane", ".", "HORIZONTAL_SPLIT", ")", "{", "AffineTransform", "transform", "=", "new", "AffineTransform", "(", ")", ";", "transform", ".", "scale", "(", "-", "1", ",", "1", ")", ";", "transform", ".", "rotate", "(", "Math", ".", "toRadians", "(", "90", ")", ")", ";", "paintBackground", "(", "context", ",", "g", ",", "y", ",", "x", ",", "h", ",", "w", ",", "transform", ")", ";", "}", "else", "{", "paintBackground", "(", "context", ",", "g", ",", "x", ",", "y", ",", "w", ",", "h", ",", "null", ")", ";", "}", "}" ]
Paints the background of the divider of a split pane. This implementation invokes the method of the same name without the orientation. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSplitPane.HORIZONTAL_SPLIT</code> or <code>JSplitPane.VERTICAL_SPLIT</code>
[ "Paints", "the", "background", "of", "the", "divider", "of", "a", "split", "pane", ".", "This", "implementation", "invokes", "the", "method", "of", "the", "same", "name", "without", "the", "orientation", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1838-L1848
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/common/Preconditions.java
Preconditions.checkElementIndex
public static int checkElementIndex(int index, int size, String desc) { """ Ensures that {@code index} specifies a valid <i>element</i> in an array, list or string of size {@code size}. An element index may range from zero, inclusive, to {@code size}, exclusive. @param index a user-supplied index identifying an element of an array, list or string @param size the size of that array, list or string @param desc the text to use to describe this index in an error message @return the value of {@code index} @throws IndexOutOfBoundsException if {@code index} is negative or is not less than {@code size} @throws IllegalArgumentException if {@code size} is negative """ // Carefully optimized for execution by hotspot (explanatory comment above) if (index < 0 || index >= size) { throw new IndexOutOfBoundsException(badElementIndex(index, size, desc)); } return index; }
java
public static int checkElementIndex(int index, int size, String desc) { // Carefully optimized for execution by hotspot (explanatory comment above) if (index < 0 || index >= size) { throw new IndexOutOfBoundsException(badElementIndex(index, size, desc)); } return index; }
[ "public", "static", "int", "checkElementIndex", "(", "int", "index", ",", "int", "size", ",", "String", "desc", ")", "{", "// Carefully optimized for execution by hotspot (explanatory comment above)", "if", "(", "index", "<", "0", "||", "index", ">=", "size", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "badElementIndex", "(", "index", ",", "size", ",", "desc", ")", ")", ";", "}", "return", "index", ";", "}" ]
Ensures that {@code index} specifies a valid <i>element</i> in an array, list or string of size {@code size}. An element index may range from zero, inclusive, to {@code size}, exclusive. @param index a user-supplied index identifying an element of an array, list or string @param size the size of that array, list or string @param desc the text to use to describe this index in an error message @return the value of {@code index} @throws IndexOutOfBoundsException if {@code index} is negative or is not less than {@code size} @throws IllegalArgumentException if {@code size} is negative
[ "Ensures", "that", "{", "@code", "index", "}", "specifies", "a", "valid", "<i", ">", "element<", "/", "i", ">", "in", "an", "array", "list", "or", "string", "of", "size", "{", "@code", "size", "}", ".", "An", "element", "index", "may", "range", "from", "zero", "inclusive", "to", "{", "@code", "size", "}", "exclusive", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Preconditions.java#L271-L277
AzureAD/azure-activedirectory-library-for-java
src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java
AuthenticationContext.acquireToken
public Future<AuthenticationResult> acquireToken(final String resource, final String clientId, final String username, final String password, final AuthenticationCallback callback) { """ Acquires a security token from the authority using a username/password flow. @param clientId Name or ID of the client requesting the token. @param resource Identifier of the target resource that is the recipient of the requested token. @param username Username of the managed or federated user. @param password Password of the managed or federated user. If null, integrated authentication will be used. @param callback optional callback object for non-blocking execution. @return A {@link Future} object representing the {@link AuthenticationResult} of the call. It contains Access Token, Refresh Token and the Access Token's expiration time. """ if (StringHelper.isBlank(resource)) { throw new IllegalArgumentException("resource is null or empty"); } if (StringHelper.isBlank(clientId)) { throw new IllegalArgumentException("clientId is null or empty"); } if (StringHelper.isBlank(username)) { throw new IllegalArgumentException("username is null or empty"); } ClientAuthenticationPost clientAuth = new ClientAuthenticationPost(ClientAuthenticationMethod.NONE, new ClientID(clientId)); if (password != null) { return this.acquireToken(new AdalOAuthAuthorizationGrant( new ResourceOwnerPasswordCredentialsGrant(username, new Secret( password)), resource), clientAuth, callback); } else { return this.acquireToken(new AdalIntegratedAuthorizationGrant(username, resource), clientAuth, callback); } }
java
public Future<AuthenticationResult> acquireToken(final String resource, final String clientId, final String username, final String password, final AuthenticationCallback callback) { if (StringHelper.isBlank(resource)) { throw new IllegalArgumentException("resource is null or empty"); } if (StringHelper.isBlank(clientId)) { throw new IllegalArgumentException("clientId is null or empty"); } if (StringHelper.isBlank(username)) { throw new IllegalArgumentException("username is null or empty"); } ClientAuthenticationPost clientAuth = new ClientAuthenticationPost(ClientAuthenticationMethod.NONE, new ClientID(clientId)); if (password != null) { return this.acquireToken(new AdalOAuthAuthorizationGrant( new ResourceOwnerPasswordCredentialsGrant(username, new Secret( password)), resource), clientAuth, callback); } else { return this.acquireToken(new AdalIntegratedAuthorizationGrant(username, resource), clientAuth, callback); } }
[ "public", "Future", "<", "AuthenticationResult", ">", "acquireToken", "(", "final", "String", "resource", ",", "final", "String", "clientId", ",", "final", "String", "username", ",", "final", "String", "password", ",", "final", "AuthenticationCallback", "callback", ")", "{", "if", "(", "StringHelper", ".", "isBlank", "(", "resource", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"resource is null or empty\"", ")", ";", "}", "if", "(", "StringHelper", ".", "isBlank", "(", "clientId", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"clientId is null or empty\"", ")", ";", "}", "if", "(", "StringHelper", ".", "isBlank", "(", "username", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"username is null or empty\"", ")", ";", "}", "ClientAuthenticationPost", "clientAuth", "=", "new", "ClientAuthenticationPost", "(", "ClientAuthenticationMethod", ".", "NONE", ",", "new", "ClientID", "(", "clientId", ")", ")", ";", "if", "(", "password", "!=", "null", ")", "{", "return", "this", ".", "acquireToken", "(", "new", "AdalOAuthAuthorizationGrant", "(", "new", "ResourceOwnerPasswordCredentialsGrant", "(", "username", ",", "new", "Secret", "(", "password", ")", ")", ",", "resource", ")", ",", "clientAuth", ",", "callback", ")", ";", "}", "else", "{", "return", "this", ".", "acquireToken", "(", "new", "AdalIntegratedAuthorizationGrant", "(", "username", ",", "resource", ")", ",", "clientAuth", ",", "callback", ")", ";", "}", "}" ]
Acquires a security token from the authority using a username/password flow. @param clientId Name or ID of the client requesting the token. @param resource Identifier of the target resource that is the recipient of the requested token. @param username Username of the managed or federated user. @param password Password of the managed or federated user. If null, integrated authentication will be used. @param callback optional callback object for non-blocking execution. @return A {@link Future} object representing the {@link AuthenticationResult} of the call. It contains Access Token, Refresh Token and the Access Token's expiration time.
[ "Acquires", "a", "security", "token", "from", "the", "authority", "using", "a", "username", "/", "password", "flow", "." ]
train
https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java#L195-L219
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/URLUtil.java
URLUtil.urlFromSystemId
public static URL urlFromSystemId(String sysId) throws IOException { """ Method that tries to figure out how to create valid URL from a system id, without additional contextual information. If we could use URIs this might be easier to do, but they are part of JDK 1.4, and preferably code should only require 1.2 (or maybe 1.3) """ try { sysId = cleanSystemId(sysId); /* Ok, does it look like a full URL? For one, you need a colon. Also, * to reduce likelihood of collision with Windows paths, let's only * accept it if there are 3 preceding other chars... * Not sure if Mac might be a problem? (it uses ':' as file path * separator, alas, at least prior to MacOS X) */ int ix = sysId.indexOf(':', 0); /* Also, protocols are generally fairly short, usually 3 or 4 * chars (http, ftp, urn); so let's put upper limit of 8 chars too */ if (ix >= 3 && ix <= 8) { return new URL(sysId); } // Ok, let's just assume it's local file reference... /* 24-May-2006, TSa: Amazingly, this single call does show in * profiling, for small docs. The problem is that deep down it * tries to check physical file system, to check if the File * pointed to is a directory: and that is (relatively speaking) * a very expensive call. Since in this particular case it * should never be a dir (and/or doesn't matter), let's just * implement conversion locally */ String absPath = new java.io.File(sysId).getAbsolutePath(); // Need to convert colons/backslashes to regular slashes? { char sep = File.separatorChar; if (sep != '/') { absPath = absPath.replace(sep, '/'); } } if (absPath.length() > 0 && absPath.charAt(0) != '/') { absPath = "/" + absPath; } return new URL("file", "", absPath); } catch (MalformedURLException e) { throwIOException(e, sysId); return null; // never gets here } }
java
public static URL urlFromSystemId(String sysId) throws IOException { try { sysId = cleanSystemId(sysId); /* Ok, does it look like a full URL? For one, you need a colon. Also, * to reduce likelihood of collision with Windows paths, let's only * accept it if there are 3 preceding other chars... * Not sure if Mac might be a problem? (it uses ':' as file path * separator, alas, at least prior to MacOS X) */ int ix = sysId.indexOf(':', 0); /* Also, protocols are generally fairly short, usually 3 or 4 * chars (http, ftp, urn); so let's put upper limit of 8 chars too */ if (ix >= 3 && ix <= 8) { return new URL(sysId); } // Ok, let's just assume it's local file reference... /* 24-May-2006, TSa: Amazingly, this single call does show in * profiling, for small docs. The problem is that deep down it * tries to check physical file system, to check if the File * pointed to is a directory: and that is (relatively speaking) * a very expensive call. Since in this particular case it * should never be a dir (and/or doesn't matter), let's just * implement conversion locally */ String absPath = new java.io.File(sysId).getAbsolutePath(); // Need to convert colons/backslashes to regular slashes? { char sep = File.separatorChar; if (sep != '/') { absPath = absPath.replace(sep, '/'); } } if (absPath.length() > 0 && absPath.charAt(0) != '/') { absPath = "/" + absPath; } return new URL("file", "", absPath); } catch (MalformedURLException e) { throwIOException(e, sysId); return null; // never gets here } }
[ "public", "static", "URL", "urlFromSystemId", "(", "String", "sysId", ")", "throws", "IOException", "{", "try", "{", "sysId", "=", "cleanSystemId", "(", "sysId", ")", ";", "/* Ok, does it look like a full URL? For one, you need a colon. Also,\n * to reduce likelihood of collision with Windows paths, let's only\n * accept it if there are 3 preceding other chars...\n * Not sure if Mac might be a problem? (it uses ':' as file path\n * separator, alas, at least prior to MacOS X)\n */", "int", "ix", "=", "sysId", ".", "indexOf", "(", "'", "'", ",", "0", ")", ";", "/* Also, protocols are generally fairly short, usually 3 or 4\n * chars (http, ftp, urn); so let's put upper limit of 8 chars too\n */", "if", "(", "ix", ">=", "3", "&&", "ix", "<=", "8", ")", "{", "return", "new", "URL", "(", "sysId", ")", ";", "}", "// Ok, let's just assume it's local file reference...", "/* 24-May-2006, TSa: Amazingly, this single call does show in\n * profiling, for small docs. The problem is that deep down it\n * tries to check physical file system, to check if the File\n * pointed to is a directory: and that is (relatively speaking)\n * a very expensive call. Since in this particular case it\n * should never be a dir (and/or doesn't matter), let's just\n * implement conversion locally\n */", "String", "absPath", "=", "new", "java", ".", "io", ".", "File", "(", "sysId", ")", ".", "getAbsolutePath", "(", ")", ";", "// Need to convert colons/backslashes to regular slashes?", "{", "char", "sep", "=", "File", ".", "separatorChar", ";", "if", "(", "sep", "!=", "'", "'", ")", "{", "absPath", "=", "absPath", ".", "replace", "(", "sep", ",", "'", "'", ")", ";", "}", "}", "if", "(", "absPath", ".", "length", "(", ")", ">", "0", "&&", "absPath", ".", "charAt", "(", "0", ")", "!=", "'", "'", ")", "{", "absPath", "=", "\"/\"", "+", "absPath", ";", "}", "return", "new", "URL", "(", "\"file\"", ",", "\"\"", ",", "absPath", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "throwIOException", "(", "e", ",", "sysId", ")", ";", "return", "null", ";", "// never gets here", "}", "}" ]
Method that tries to figure out how to create valid URL from a system id, without additional contextual information. If we could use URIs this might be easier to do, but they are part of JDK 1.4, and preferably code should only require 1.2 (or maybe 1.3)
[ "Method", "that", "tries", "to", "figure", "out", "how", "to", "create", "valid", "URL", "from", "a", "system", "id", "without", "additional", "contextual", "information", ".", "If", "we", "could", "use", "URIs", "this", "might", "be", "easier", "to", "do", "but", "they", "are", "part", "of", "JDK", "1", ".", "4", "and", "preferably", "code", "should", "only", "require", "1", ".", "2", "(", "or", "maybe", "1", ".", "3", ")" ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/URLUtil.java#L23-L65
burberius/eve-esi
src/main/java/net/troja/eve/esi/api/UserInterfaceApi.java
UserInterfaceApi.postUiOpenwindowContract
public void postUiOpenwindowContract(Integer contractId, String datasource, String token) throws ApiException { """ Open Contract Window Open the contract window inside the client --- SSO Scope: esi-ui.open_window.v1 @param contractId The contract to open (required) @param datasource The server name you would like data from (optional, default to tranquility) @param token Access token to use if unable to set a header (optional) @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ postUiOpenwindowContractWithHttpInfo(contractId, datasource, token); }
java
public void postUiOpenwindowContract(Integer contractId, String datasource, String token) throws ApiException { postUiOpenwindowContractWithHttpInfo(contractId, datasource, token); }
[ "public", "void", "postUiOpenwindowContract", "(", "Integer", "contractId", ",", "String", "datasource", ",", "String", "token", ")", "throws", "ApiException", "{", "postUiOpenwindowContractWithHttpInfo", "(", "contractId", ",", "datasource", ",", "token", ")", ";", "}" ]
Open Contract Window Open the contract window inside the client --- SSO Scope: esi-ui.open_window.v1 @param contractId The contract to open (required) @param datasource The server name you would like data from (optional, default to tranquility) @param token Access token to use if unable to set a header (optional) @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Open", "Contract", "Window", "Open", "the", "contract", "window", "inside", "the", "client", "---", "SSO", "Scope", ":", "esi", "-", "ui", ".", "open_window", ".", "v1" ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/UserInterfaceApi.java#L335-L337
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/style/ColorUtils.java
ColorUtils.toColor
public static String toColor(String red, String green, String blue) { """ Convert the hex color values to a hex color @param red red hex color in format RR or R @param green green hex color in format GG or G @param blue blue hex color in format BB or B @return hex color in format #RRGGBB """ return toColorWithAlpha(red, green, blue, null); }
java
public static String toColor(String red, String green, String blue) { return toColorWithAlpha(red, green, blue, null); }
[ "public", "static", "String", "toColor", "(", "String", "red", ",", "String", "green", ",", "String", "blue", ")", "{", "return", "toColorWithAlpha", "(", "red", ",", "green", ",", "blue", ",", "null", ")", ";", "}" ]
Convert the hex color values to a hex color @param red red hex color in format RR or R @param green green hex color in format GG or G @param blue blue hex color in format BB or B @return hex color in format #RRGGBB
[ "Convert", "the", "hex", "color", "values", "to", "a", "hex", "color" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/style/ColorUtils.java#L40-L42
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java
PrimaveraPMFileReader.readActivityCodes
private void readActivityCodes(Task task, List<CodeAssignmentType> codes) { """ Read details of any activity codes assigned to this task. @param task parent task @param codes activity code assignments """ for (CodeAssignmentType assignment : codes) { ActivityCodeValue code = m_activityCodeMap.get(Integer.valueOf(assignment.getValueObjectId())); if (code != null) { task.addActivityCode(code); } } }
java
private void readActivityCodes(Task task, List<CodeAssignmentType> codes) { for (CodeAssignmentType assignment : codes) { ActivityCodeValue code = m_activityCodeMap.get(Integer.valueOf(assignment.getValueObjectId())); if (code != null) { task.addActivityCode(code); } } }
[ "private", "void", "readActivityCodes", "(", "Task", "task", ",", "List", "<", "CodeAssignmentType", ">", "codes", ")", "{", "for", "(", "CodeAssignmentType", "assignment", ":", "codes", ")", "{", "ActivityCodeValue", "code", "=", "m_activityCodeMap", ".", "get", "(", "Integer", ".", "valueOf", "(", "assignment", ".", "getValueObjectId", "(", ")", ")", ")", ";", "if", "(", "code", "!=", "null", ")", "{", "task", ".", "addActivityCode", "(", "code", ")", ";", "}", "}", "}" ]
Read details of any activity codes assigned to this task. @param task parent task @param codes activity code assignments
[ "Read", "details", "of", "any", "activity", "codes", "assigned", "to", "this", "task", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java#L1115-L1125
Azure/azure-sdk-for-java
containerinstance/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_04_01/implementation/StartContainersInner.java
StartContainersInner.launchExecAsync
public Observable<ContainerExecResponseInner> launchExecAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) { """ Starts the exec command for a specific container instance. Starts the exec command for a specified container instance in a specified resource group and container group. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerName The name of the container instance. @param containerExecRequest The request for the exec command. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ContainerExecResponseInner object """ return launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).map(new Func1<ServiceResponse<ContainerExecResponseInner>, ContainerExecResponseInner>() { @Override public ContainerExecResponseInner call(ServiceResponse<ContainerExecResponseInner> response) { return response.body(); } }); }
java
public Observable<ContainerExecResponseInner> launchExecAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) { return launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).map(new Func1<ServiceResponse<ContainerExecResponseInner>, ContainerExecResponseInner>() { @Override public ContainerExecResponseInner call(ServiceResponse<ContainerExecResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ContainerExecResponseInner", ">", "launchExecAsync", "(", "String", "resourceGroupName", ",", "String", "containerGroupName", ",", "String", "containerName", ",", "ContainerExecRequest", "containerExecRequest", ")", "{", "return", "launchExecWithServiceResponseAsync", "(", "resourceGroupName", ",", "containerGroupName", ",", "containerName", ",", "containerExecRequest", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ContainerExecResponseInner", ">", ",", "ContainerExecResponseInner", ">", "(", ")", "{", "@", "Override", "public", "ContainerExecResponseInner", "call", "(", "ServiceResponse", "<", "ContainerExecResponseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Starts the exec command for a specific container instance. Starts the exec command for a specified container instance in a specified resource group and container group. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerName The name of the container instance. @param containerExecRequest The request for the exec command. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ContainerExecResponseInner object
[ "Starts", "the", "exec", "command", "for", "a", "specific", "container", "instance", ".", "Starts", "the", "exec", "command", "for", "a", "specified", "container", "instance", "in", "a", "specified", "resource", "group", "and", "container", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_04_01/implementation/StartContainersInner.java#L107-L114
mapsforge/mapsforge
mapsforge-samples-awt/src/main/java/org/mapsforge/samples/awt/Samples.java
Samples.main
public static void main(String[] args) { """ Starts the {@code Samples}. @param args command line args: expects the map files as multiple parameters with possible SRTM hgt folder as 1st argument. """ // Multithreaded map rendering Parameters.NUMBER_OF_THREADS = 2; // Square frame buffer Parameters.SQUARE_FRAME_BUFFER = false; HillsRenderConfig hillsCfg = null; File demFolder = getDemFolder(args); if (demFolder != null) { MemoryCachingHgtReaderTileSource tileSource = new MemoryCachingHgtReaderTileSource(demFolder, new DiffuseLightShadingAlgorithm(), AwtGraphicFactory.INSTANCE); tileSource.setEnableInterpolationOverlap(true); hillsCfg = new HillsRenderConfig(tileSource); hillsCfg.indexOnThread(); args = Arrays.copyOfRange(args, 1, args.length); } List<File> mapFiles = SHOW_RASTER_MAP ? null : getMapFiles(args); final MapView mapView = createMapView(); final BoundingBox boundingBox = addLayers(mapView, mapFiles, hillsCfg); final PreferencesFacade preferencesFacade = new JavaPreferences(Preferences.userNodeForPackage(Samples.class)); final JFrame frame = new JFrame(); frame.setTitle("Mapsforge Samples"); frame.add(mapView); frame.pack(); frame.setSize(1024, 768); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { int result = JOptionPane.showConfirmDialog(frame, MESSAGE, TITLE, JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { mapView.getModel().save(preferencesFacade); mapView.destroyAll(); AwtGraphicFactory.clearResourceMemoryCache(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } } @Override public void windowOpened(WindowEvent e) { final Model model = mapView.getModel(); model.init(preferencesFacade); if (model.mapViewPosition.getZoomLevel() == 0 || !boundingBox.contains(model.mapViewPosition.getCenter())) { byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), boundingBox, model.displayModel.getTileSize()); model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel)); } } }); frame.setVisible(true); }
java
public static void main(String[] args) { // Multithreaded map rendering Parameters.NUMBER_OF_THREADS = 2; // Square frame buffer Parameters.SQUARE_FRAME_BUFFER = false; HillsRenderConfig hillsCfg = null; File demFolder = getDemFolder(args); if (demFolder != null) { MemoryCachingHgtReaderTileSource tileSource = new MemoryCachingHgtReaderTileSource(demFolder, new DiffuseLightShadingAlgorithm(), AwtGraphicFactory.INSTANCE); tileSource.setEnableInterpolationOverlap(true); hillsCfg = new HillsRenderConfig(tileSource); hillsCfg.indexOnThread(); args = Arrays.copyOfRange(args, 1, args.length); } List<File> mapFiles = SHOW_RASTER_MAP ? null : getMapFiles(args); final MapView mapView = createMapView(); final BoundingBox boundingBox = addLayers(mapView, mapFiles, hillsCfg); final PreferencesFacade preferencesFacade = new JavaPreferences(Preferences.userNodeForPackage(Samples.class)); final JFrame frame = new JFrame(); frame.setTitle("Mapsforge Samples"); frame.add(mapView); frame.pack(); frame.setSize(1024, 768); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { int result = JOptionPane.showConfirmDialog(frame, MESSAGE, TITLE, JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { mapView.getModel().save(preferencesFacade); mapView.destroyAll(); AwtGraphicFactory.clearResourceMemoryCache(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } } @Override public void windowOpened(WindowEvent e) { final Model model = mapView.getModel(); model.init(preferencesFacade); if (model.mapViewPosition.getZoomLevel() == 0 || !boundingBox.contains(model.mapViewPosition.getCenter())) { byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), boundingBox, model.displayModel.getTileSize()); model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel)); } } }); frame.setVisible(true); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "// Multithreaded map rendering", "Parameters", ".", "NUMBER_OF_THREADS", "=", "2", ";", "// Square frame buffer", "Parameters", ".", "SQUARE_FRAME_BUFFER", "=", "false", ";", "HillsRenderConfig", "hillsCfg", "=", "null", ";", "File", "demFolder", "=", "getDemFolder", "(", "args", ")", ";", "if", "(", "demFolder", "!=", "null", ")", "{", "MemoryCachingHgtReaderTileSource", "tileSource", "=", "new", "MemoryCachingHgtReaderTileSource", "(", "demFolder", ",", "new", "DiffuseLightShadingAlgorithm", "(", ")", ",", "AwtGraphicFactory", ".", "INSTANCE", ")", ";", "tileSource", ".", "setEnableInterpolationOverlap", "(", "true", ")", ";", "hillsCfg", "=", "new", "HillsRenderConfig", "(", "tileSource", ")", ";", "hillsCfg", ".", "indexOnThread", "(", ")", ";", "args", "=", "Arrays", ".", "copyOfRange", "(", "args", ",", "1", ",", "args", ".", "length", ")", ";", "}", "List", "<", "File", ">", "mapFiles", "=", "SHOW_RASTER_MAP", "?", "null", ":", "getMapFiles", "(", "args", ")", ";", "final", "MapView", "mapView", "=", "createMapView", "(", ")", ";", "final", "BoundingBox", "boundingBox", "=", "addLayers", "(", "mapView", ",", "mapFiles", ",", "hillsCfg", ")", ";", "final", "PreferencesFacade", "preferencesFacade", "=", "new", "JavaPreferences", "(", "Preferences", ".", "userNodeForPackage", "(", "Samples", ".", "class", ")", ")", ";", "final", "JFrame", "frame", "=", "new", "JFrame", "(", ")", ";", "frame", ".", "setTitle", "(", "\"Mapsforge Samples\"", ")", ";", "frame", ".", "add", "(", "mapView", ")", ";", "frame", ".", "pack", "(", ")", ";", "frame", ".", "setSize", "(", "1024", ",", "768", ")", ";", "frame", ".", "setLocationRelativeTo", "(", "null", ")", ";", "frame", ".", "setDefaultCloseOperation", "(", "WindowConstants", ".", "DO_NOTHING_ON_CLOSE", ")", ";", "frame", ".", "addWindowListener", "(", "new", "WindowAdapter", "(", ")", "{", "@", "Override", "public", "void", "windowClosing", "(", "WindowEvent", "e", ")", "{", "int", "result", "=", "JOptionPane", ".", "showConfirmDialog", "(", "frame", ",", "MESSAGE", ",", "TITLE", ",", "JOptionPane", ".", "YES_NO_OPTION", ")", ";", "if", "(", "result", "==", "JOptionPane", ".", "YES_OPTION", ")", "{", "mapView", ".", "getModel", "(", ")", ".", "save", "(", "preferencesFacade", ")", ";", "mapView", ".", "destroyAll", "(", ")", ";", "AwtGraphicFactory", ".", "clearResourceMemoryCache", "(", ")", ";", "frame", ".", "setDefaultCloseOperation", "(", "WindowConstants", ".", "EXIT_ON_CLOSE", ")", ";", "}", "}", "@", "Override", "public", "void", "windowOpened", "(", "WindowEvent", "e", ")", "{", "final", "Model", "model", "=", "mapView", ".", "getModel", "(", ")", ";", "model", ".", "init", "(", "preferencesFacade", ")", ";", "if", "(", "model", ".", "mapViewPosition", ".", "getZoomLevel", "(", ")", "==", "0", "||", "!", "boundingBox", ".", "contains", "(", "model", ".", "mapViewPosition", ".", "getCenter", "(", ")", ")", ")", "{", "byte", "zoomLevel", "=", "LatLongUtils", ".", "zoomForBounds", "(", "model", ".", "mapViewDimension", ".", "getDimension", "(", ")", ",", "boundingBox", ",", "model", ".", "displayModel", ".", "getTileSize", "(", ")", ")", ";", "model", ".", "mapViewPosition", ".", "setMapPosition", "(", "new", "MapPosition", "(", "boundingBox", ".", "getCenterPoint", "(", ")", ",", "zoomLevel", ")", ")", ";", "}", "}", "}", ")", ";", "frame", ".", "setVisible", "(", "true", ")", ";", "}" ]
Starts the {@code Samples}. @param args command line args: expects the map files as multiple parameters with possible SRTM hgt folder as 1st argument.
[ "Starts", "the", "{", "@code", "Samples", "}", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-samples-awt/src/main/java/org/mapsforge/samples/awt/Samples.java#L78-L131
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/modmessage/ModMessageManager.java
ModMessageManager.checkParameters
private static boolean checkParameters(Method method, Object... data) { """ Checks if parameters passed match the parameteres required for the {@link Method}. @param method the method @param data the data @return true, if successful """ Parameter[] parameters = method.getParameters(); if (ArrayUtils.isEmpty(data) && parameters.length != 0) return false; if (parameters.length != data.length) return false; for (int i = 0; i < parameters.length; i++) { Class<?> paramClass = parameters[i].getType(); if (data[i] != null) { Class<?> dataClass = data[i].getClass(); if (!ClassUtils.isAssignable(dataClass, paramClass, true)) return false; } } return true; }
java
private static boolean checkParameters(Method method, Object... data) { Parameter[] parameters = method.getParameters(); if (ArrayUtils.isEmpty(data) && parameters.length != 0) return false; if (parameters.length != data.length) return false; for (int i = 0; i < parameters.length; i++) { Class<?> paramClass = parameters[i].getType(); if (data[i] != null) { Class<?> dataClass = data[i].getClass(); if (!ClassUtils.isAssignable(dataClass, paramClass, true)) return false; } } return true; }
[ "private", "static", "boolean", "checkParameters", "(", "Method", "method", ",", "Object", "...", "data", ")", "{", "Parameter", "[", "]", "parameters", "=", "method", ".", "getParameters", "(", ")", ";", "if", "(", "ArrayUtils", ".", "isEmpty", "(", "data", ")", "&&", "parameters", ".", "length", "!=", "0", ")", "return", "false", ";", "if", "(", "parameters", ".", "length", "!=", "data", ".", "length", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parameters", ".", "length", ";", "i", "++", ")", "{", "Class", "<", "?", ">", "paramClass", "=", "parameters", "[", "i", "]", ".", "getType", "(", ")", ";", "if", "(", "data", "[", "i", "]", "!=", "null", ")", "{", "Class", "<", "?", ">", "dataClass", "=", "data", "[", "i", "]", ".", "getClass", "(", ")", ";", "if", "(", "!", "ClassUtils", ".", "isAssignable", "(", "dataClass", ",", "paramClass", ",", "true", ")", ")", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Checks if parameters passed match the parameteres required for the {@link Method}. @param method the method @param data the data @return true, if successful
[ "Checks", "if", "parameters", "passed", "match", "the", "parameteres", "required", "for", "the", "{", "@link", "Method", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/modmessage/ModMessageManager.java#L149-L169
alkacon/opencms-core
src/org/opencms/configuration/CmsSetNextRule.java
CmsSetNextRule.finish
public void finish(String namespace, String name) throws Exception { """ Clean up after parsing is complete.<p> @param namespace the namespace URI of the matching element, or an empty string if the parser is not namespace aware or the element has no namespace @param name the local name if the parser is namespace aware, or just the element name otherwise @throws Exception if something goes wrong """ String dummy = name; dummy = namespace; dummy = null; m_bodyText = dummy; }
java
public void finish(String namespace, String name) throws Exception { String dummy = name; dummy = namespace; dummy = null; m_bodyText = dummy; }
[ "public", "void", "finish", "(", "String", "namespace", ",", "String", "name", ")", "throws", "Exception", "{", "String", "dummy", "=", "name", ";", "dummy", "=", "namespace", ";", "dummy", "=", "null", ";", "m_bodyText", "=", "dummy", ";", "}" ]
Clean up after parsing is complete.<p> @param namespace the namespace URI of the matching element, or an empty string if the parser is not namespace aware or the element has no namespace @param name the local name if the parser is namespace aware, or just the element name otherwise @throws Exception if something goes wrong
[ "Clean", "up", "after", "parsing", "is", "complete", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsSetNextRule.java#L365-L371
trellis-ldp/trellis
core/http/src/main/java/org/trellisldp/http/impl/PostHandler.java
PostHandler.createResource
public CompletionStage<ResponseBuilder> createResource(final ResponseBuilder builder) { """ Create a new resource. @param builder the response builder @return the response builder """ LOGGER.debug("Creating resource as {}", getIdentifier()); final TrellisDataset mutable = TrellisDataset.createDataset(); final TrellisDataset immutable = TrellisDataset.createDataset(); return handleResourceCreation(mutable, immutable, builder) .whenComplete((a, b) -> mutable.close()) .whenComplete((a, b) -> immutable.close()); }
java
public CompletionStage<ResponseBuilder> createResource(final ResponseBuilder builder) { LOGGER.debug("Creating resource as {}", getIdentifier()); final TrellisDataset mutable = TrellisDataset.createDataset(); final TrellisDataset immutable = TrellisDataset.createDataset(); return handleResourceCreation(mutable, immutable, builder) .whenComplete((a, b) -> mutable.close()) .whenComplete((a, b) -> immutable.close()); }
[ "public", "CompletionStage", "<", "ResponseBuilder", ">", "createResource", "(", "final", "ResponseBuilder", "builder", ")", "{", "LOGGER", ".", "debug", "(", "\"Creating resource as {}\"", ",", "getIdentifier", "(", ")", ")", ";", "final", "TrellisDataset", "mutable", "=", "TrellisDataset", ".", "createDataset", "(", ")", ";", "final", "TrellisDataset", "immutable", "=", "TrellisDataset", ".", "createDataset", "(", ")", ";", "return", "handleResourceCreation", "(", "mutable", ",", "immutable", ",", "builder", ")", ".", "whenComplete", "(", "(", "a", ",", "b", ")", "->", "mutable", ".", "close", "(", ")", ")", ".", "whenComplete", "(", "(", "a", ",", "b", ")", "->", "immutable", ".", "close", "(", ")", ")", ";", "}" ]
Create a new resource. @param builder the response builder @return the response builder
[ "Create", "a", "new", "resource", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/impl/PostHandler.java#L169-L178
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/collections/CollectionsUtil.java
CollectionsUtil.addAll
public static <T> void addAll(Collection<T> col, Enumeration<T> e) { """ Add all elements of the given enumeration into the given collection. """ while (e.hasMoreElements()) col.add(e.nextElement()); }
java
public static <T> void addAll(Collection<T> col, Enumeration<T> e) { while (e.hasMoreElements()) col.add(e.nextElement()); }
[ "public", "static", "<", "T", ">", "void", "addAll", "(", "Collection", "<", "T", ">", "col", ",", "Enumeration", "<", "T", ">", "e", ")", "{", "while", "(", "e", ".", "hasMoreElements", "(", ")", ")", "col", ".", "add", "(", "e", ".", "nextElement", "(", ")", ")", ";", "}" ]
Add all elements of the given enumeration into the given collection.
[ "Add", "all", "elements", "of", "the", "given", "enumeration", "into", "the", "given", "collection", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/CollectionsUtil.java#L86-L89
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java
Locale.decodeString
private static boolean decodeString(InputStream stream, List<String> lineArray, Charset charset) throws IOException { """ Decode the bytes from the specified input stream according to a charset selection. This function tries to decode a string from the given byte array with the following charsets (in preferred order). <p>This function read the input stream line by line. @param stream is the stream to decode. @param lineArray is the array of lines to fill. @param charset is the charset to use. @return <code>true</code> is the decoding was successful, otherwhise <code>false</code> @throws IOException when the stream cannot be read. """ try { final BufferedReader breader = new BufferedReader( new InputStreamReader(stream, charset.newDecoder())); lineArray.clear(); String line; while ((line = breader.readLine()) != null) { lineArray.add(line); } return true; } catch (CharacterCodingException exception) { // } return false; }
java
private static boolean decodeString(InputStream stream, List<String> lineArray, Charset charset) throws IOException { try { final BufferedReader breader = new BufferedReader( new InputStreamReader(stream, charset.newDecoder())); lineArray.clear(); String line; while ((line = breader.readLine()) != null) { lineArray.add(line); } return true; } catch (CharacterCodingException exception) { // } return false; }
[ "private", "static", "boolean", "decodeString", "(", "InputStream", "stream", ",", "List", "<", "String", ">", "lineArray", ",", "Charset", "charset", ")", "throws", "IOException", "{", "try", "{", "final", "BufferedReader", "breader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "stream", ",", "charset", ".", "newDecoder", "(", ")", ")", ")", ";", "lineArray", ".", "clear", "(", ")", ";", "String", "line", ";", "while", "(", "(", "line", "=", "breader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "lineArray", ".", "add", "(", "line", ")", ";", "}", "return", "true", ";", "}", "catch", "(", "CharacterCodingException", "exception", ")", "{", "//", "}", "return", "false", ";", "}" ]
Decode the bytes from the specified input stream according to a charset selection. This function tries to decode a string from the given byte array with the following charsets (in preferred order). <p>This function read the input stream line by line. @param stream is the stream to decode. @param lineArray is the array of lines to fill. @param charset is the charset to use. @return <code>true</code> is the decoding was successful, otherwhise <code>false</code> @throws IOException when the stream cannot be read.
[ "Decode", "the", "bytes", "from", "the", "specified", "input", "stream", "according", "to", "a", "charset", "selection", ".", "This", "function", "tries", "to", "decode", "a", "string", "from", "the", "given", "byte", "array", "with", "the", "following", "charsets", "(", "in", "preferred", "order", ")", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/locale/Locale.java#L621-L638
tvesalainen/util
util/src/main/java/org/vesalainen/nio/RingBuffer.java
RingBuffer.subSequence
@Override public CharSequence subSequence(int start, int end) { """ Note that implementation uses StringBuilder to create String as CharSequence. @param start @param end @return """ StringBuilder sb = new StringBuilder(); for (int ii=start;ii<end;ii++) { sb.append((char)getAt(ii)); } return sb.toString(); }
java
@Override public CharSequence subSequence(int start, int end) { StringBuilder sb = new StringBuilder(); for (int ii=start;ii<end;ii++) { sb.append((char)getAt(ii)); } return sb.toString(); }
[ "@", "Override", "public", "CharSequence", "subSequence", "(", "int", "start", ",", "int", "end", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "ii", "=", "start", ";", "ii", "<", "end", ";", "ii", "++", ")", "{", "sb", ".", "append", "(", "(", "char", ")", "getAt", "(", "ii", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Note that implementation uses StringBuilder to create String as CharSequence. @param start @param end @return
[ "Note", "that", "implementation", "uses", "StringBuilder", "to", "create", "String", "as", "CharSequence", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/RingBuffer.java#L344-L353
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getCoupon
public Coupon getCoupon(final String couponCode) { """ Get a Coupon <p> @param couponCode The code for the {@link Coupon} @return The {@link Coupon} object as identified by the passed in code """ if (couponCode == null || couponCode.isEmpty()) throw new RuntimeException("couponCode cannot be empty!"); return doGET(Coupon.COUPON_RESOURCE + "/" + couponCode, Coupon.class); }
java
public Coupon getCoupon(final String couponCode) { if (couponCode == null || couponCode.isEmpty()) throw new RuntimeException("couponCode cannot be empty!"); return doGET(Coupon.COUPON_RESOURCE + "/" + couponCode, Coupon.class); }
[ "public", "Coupon", "getCoupon", "(", "final", "String", "couponCode", ")", "{", "if", "(", "couponCode", "==", "null", "||", "couponCode", ".", "isEmpty", "(", ")", ")", "throw", "new", "RuntimeException", "(", "\"couponCode cannot be empty!\"", ")", ";", "return", "doGET", "(", "Coupon", ".", "COUPON_RESOURCE", "+", "\"/\"", "+", "couponCode", ",", "Coupon", ".", "class", ")", ";", "}" ]
Get a Coupon <p> @param couponCode The code for the {@link Coupon} @return The {@link Coupon} object as identified by the passed in code
[ "Get", "a", "Coupon", "<p", ">" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1556-L1561
dwdyer/watchmaker
examples/src/java/main/org/uncommons/watchmaker/examples/monalisa/PolygonColourMutation.java
PolygonColourMutation.mutateColour
private Color mutateColour(Color colour, Random rng) { """ Mutate the specified colour. @param colour The colour to mutate. @param rng A source of randomness. @return The (possibly) mutated colour. """ if (mutationProbability.nextValue().nextEvent(rng)) { return new Color(mutateColourComponent(colour.getRed()), mutateColourComponent(colour.getGreen()), mutateColourComponent(colour.getBlue()), mutateColourComponent(colour.getAlpha())); } else { return colour; } }
java
private Color mutateColour(Color colour, Random rng) { if (mutationProbability.nextValue().nextEvent(rng)) { return new Color(mutateColourComponent(colour.getRed()), mutateColourComponent(colour.getGreen()), mutateColourComponent(colour.getBlue()), mutateColourComponent(colour.getAlpha())); } else { return colour; } }
[ "private", "Color", "mutateColour", "(", "Color", "colour", ",", "Random", "rng", ")", "{", "if", "(", "mutationProbability", ".", "nextValue", "(", ")", ".", "nextEvent", "(", "rng", ")", ")", "{", "return", "new", "Color", "(", "mutateColourComponent", "(", "colour", ".", "getRed", "(", ")", ")", ",", "mutateColourComponent", "(", "colour", ".", "getGreen", "(", ")", ")", ",", "mutateColourComponent", "(", "colour", ".", "getBlue", "(", ")", ")", ",", "mutateColourComponent", "(", "colour", ".", "getAlpha", "(", ")", ")", ")", ";", "}", "else", "{", "return", "colour", ";", "}", "}" ]
Mutate the specified colour. @param colour The colour to mutate. @param rng A source of randomness. @return The (possibly) mutated colour.
[ "Mutate", "the", "specified", "colour", "." ]
train
https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/examples/src/java/main/org/uncommons/watchmaker/examples/monalisa/PolygonColourMutation.java#L86-L99
alkacon/opencms-core
src/org/opencms/ade/contenteditor/CmsContentService.java
CmsContentService.synchronizeLocaleIndependentForEntity
private void synchronizeLocaleIndependentForEntity( CmsFile file, CmsXmlContent content, Collection<String> skipPaths, CmsEntity entity) throws CmsXmlException { """ Synchronizes the locale independent fields for the given entity.<p> @param file the content file @param content the XML content @param skipPaths the paths to skip during locale synchronization @param entity the entity @throws CmsXmlException if something goes wrong """ CmsObject cms = getCmsObject(); String entityId = entity.getId(); Locale contentLocale = CmsLocaleManager.getLocale(CmsContentDefinition.getLocaleFromId(entityId)); CmsContentTypeVisitor visitor = null; CmsEntity originalEntity = null; if (content.getHandler().hasVisibilityHandlers()) { visitor = new CmsContentTypeVisitor(cms, file, contentLocale); visitor.visitTypes(content.getContentDefinition(), getWorkplaceLocale(cms)); } if (content.hasLocale(contentLocale)) { if ((visitor != null) && visitor.hasInvisibleFields()) { // we need to add invisible content values to the entity before saving Element element = content.getLocaleNode(contentLocale); originalEntity = readEntity( content, element, contentLocale, entityId, "", getTypeUri(content.getContentDefinition()), visitor, true, entity); } content.removeLocale(contentLocale); } content.addLocale(cms, contentLocale); if ((visitor != null) && visitor.hasInvisibleFields()) { transferInvisibleValues(originalEntity, entity, visitor); } addEntityAttributes(cms, content, "", entity, contentLocale); content.synchronizeLocaleIndependentValues(cms, skipPaths, contentLocale); }
java
private void synchronizeLocaleIndependentForEntity( CmsFile file, CmsXmlContent content, Collection<String> skipPaths, CmsEntity entity) throws CmsXmlException { CmsObject cms = getCmsObject(); String entityId = entity.getId(); Locale contentLocale = CmsLocaleManager.getLocale(CmsContentDefinition.getLocaleFromId(entityId)); CmsContentTypeVisitor visitor = null; CmsEntity originalEntity = null; if (content.getHandler().hasVisibilityHandlers()) { visitor = new CmsContentTypeVisitor(cms, file, contentLocale); visitor.visitTypes(content.getContentDefinition(), getWorkplaceLocale(cms)); } if (content.hasLocale(contentLocale)) { if ((visitor != null) && visitor.hasInvisibleFields()) { // we need to add invisible content values to the entity before saving Element element = content.getLocaleNode(contentLocale); originalEntity = readEntity( content, element, contentLocale, entityId, "", getTypeUri(content.getContentDefinition()), visitor, true, entity); } content.removeLocale(contentLocale); } content.addLocale(cms, contentLocale); if ((visitor != null) && visitor.hasInvisibleFields()) { transferInvisibleValues(originalEntity, entity, visitor); } addEntityAttributes(cms, content, "", entity, contentLocale); content.synchronizeLocaleIndependentValues(cms, skipPaths, contentLocale); }
[ "private", "void", "synchronizeLocaleIndependentForEntity", "(", "CmsFile", "file", ",", "CmsXmlContent", "content", ",", "Collection", "<", "String", ">", "skipPaths", ",", "CmsEntity", "entity", ")", "throws", "CmsXmlException", "{", "CmsObject", "cms", "=", "getCmsObject", "(", ")", ";", "String", "entityId", "=", "entity", ".", "getId", "(", ")", ";", "Locale", "contentLocale", "=", "CmsLocaleManager", ".", "getLocale", "(", "CmsContentDefinition", ".", "getLocaleFromId", "(", "entityId", ")", ")", ";", "CmsContentTypeVisitor", "visitor", "=", "null", ";", "CmsEntity", "originalEntity", "=", "null", ";", "if", "(", "content", ".", "getHandler", "(", ")", ".", "hasVisibilityHandlers", "(", ")", ")", "{", "visitor", "=", "new", "CmsContentTypeVisitor", "(", "cms", ",", "file", ",", "contentLocale", ")", ";", "visitor", ".", "visitTypes", "(", "content", ".", "getContentDefinition", "(", ")", ",", "getWorkplaceLocale", "(", "cms", ")", ")", ";", "}", "if", "(", "content", ".", "hasLocale", "(", "contentLocale", ")", ")", "{", "if", "(", "(", "visitor", "!=", "null", ")", "&&", "visitor", ".", "hasInvisibleFields", "(", ")", ")", "{", "// we need to add invisible content values to the entity before saving", "Element", "element", "=", "content", ".", "getLocaleNode", "(", "contentLocale", ")", ";", "originalEntity", "=", "readEntity", "(", "content", ",", "element", ",", "contentLocale", ",", "entityId", ",", "\"\"", ",", "getTypeUri", "(", "content", ".", "getContentDefinition", "(", ")", ")", ",", "visitor", ",", "true", ",", "entity", ")", ";", "}", "content", ".", "removeLocale", "(", "contentLocale", ")", ";", "}", "content", ".", "addLocale", "(", "cms", ",", "contentLocale", ")", ";", "if", "(", "(", "visitor", "!=", "null", ")", "&&", "visitor", ".", "hasInvisibleFields", "(", ")", ")", "{", "transferInvisibleValues", "(", "originalEntity", ",", "entity", ",", "visitor", ")", ";", "}", "addEntityAttributes", "(", "cms", ",", "content", ",", "\"\"", ",", "entity", ",", "contentLocale", ")", ";", "content", ".", "synchronizeLocaleIndependentValues", "(", "cms", ",", "skipPaths", ",", "contentLocale", ")", ";", "}" ]
Synchronizes the locale independent fields for the given entity.<p> @param file the content file @param content the XML content @param skipPaths the paths to skip during locale synchronization @param entity the entity @throws CmsXmlException if something goes wrong
[ "Synchronizes", "the", "locale", "independent", "fields", "for", "the", "given", "entity", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentService.java#L2390-L2429
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/LoggingSubsystemParser.java
LoggingSubsystemParser.readValueAttribute
static String readValueAttribute(final XMLExtendedStreamReader reader) throws XMLStreamException { """ Reads the single {@code value} attribute from an element. @param reader the reader to use @return the value of the {@code value} attribute @throws XMLStreamException if the {@code value} attribute is not present, there is more than one attribute on the element or there is content within the element. """ return readStringAttributeElement(reader, Attribute.VALUE.getLocalName()); }
java
static String readValueAttribute(final XMLExtendedStreamReader reader) throws XMLStreamException { return readStringAttributeElement(reader, Attribute.VALUE.getLocalName()); }
[ "static", "String", "readValueAttribute", "(", "final", "XMLExtendedStreamReader", "reader", ")", "throws", "XMLStreamException", "{", "return", "readStringAttributeElement", "(", "reader", ",", "Attribute", ".", "VALUE", ".", "getLocalName", "(", ")", ")", ";", "}" ]
Reads the single {@code value} attribute from an element. @param reader the reader to use @return the value of the {@code value} attribute @throws XMLStreamException if the {@code value} attribute is not present, there is more than one attribute on the element or there is content within the element.
[ "Reads", "the", "single", "{", "@code", "value", "}", "attribute", "from", "an", "element", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/LoggingSubsystemParser.java#L97-L99
thelinmichael/spotify-web-api-java
src/main/java/com/wrapper/spotify/SpotifyApi.java
SpotifyApi.unfollowArtistsOrUsers
public UnfollowArtistsOrUsersRequest.Builder unfollowArtistsOrUsers(ModelObjectType type, String[] ids) { """ Remove the current user as a follower of one or more artists or other Spotify users. @param type The ID type: either artist or user. @param ids A list of the artist or the user Spotify IDs. Maximum: 50 IDs. @return A {@link UnfollowArtistsOrUsersRequest.Builder}. @see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs &amp; IDs</a> """ return new UnfollowArtistsOrUsersRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .type(type) .ids(concat(ids, ',')); }
java
public UnfollowArtistsOrUsersRequest.Builder unfollowArtistsOrUsers(ModelObjectType type, String[] ids) { return new UnfollowArtistsOrUsersRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .type(type) .ids(concat(ids, ',')); }
[ "public", "UnfollowArtistsOrUsersRequest", ".", "Builder", "unfollowArtistsOrUsers", "(", "ModelObjectType", "type", ",", "String", "[", "]", "ids", ")", "{", "return", "new", "UnfollowArtistsOrUsersRequest", ".", "Builder", "(", "accessToken", ")", ".", "setDefaults", "(", "httpManager", ",", "scheme", ",", "host", ",", "port", ")", ".", "type", "(", "type", ")", ".", "ids", "(", "concat", "(", "ids", ",", "'", "'", ")", ")", ";", "}" ]
Remove the current user as a follower of one or more artists or other Spotify users. @param type The ID type: either artist or user. @param ids A list of the artist or the user Spotify IDs. Maximum: 50 IDs. @return A {@link UnfollowArtistsOrUsersRequest.Builder}. @see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs &amp; IDs</a>
[ "Remove", "the", "current", "user", "as", "a", "follower", "of", "one", "or", "more", "artists", "or", "other", "Spotify", "users", "." ]
train
https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L710-L715
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.multTransB
public static void multTransB(double alpha , DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { """ <p> Performs the following operation:<br> <br> c = &alpha; * a * b<sup>T</sup> <br> c<sub>ij</sub> = &alpha; &sum;<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>jk</sub>} </p> @param alpha Scaling factor. @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified. """ // TODO add a matrix vectory multiply here MatrixMatrixMult_DDRM.multTransB(alpha,a,b,c); }
java
public static void multTransB(double alpha , DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { // TODO add a matrix vectory multiply here MatrixMatrixMult_DDRM.multTransB(alpha,a,b,c); }
[ "public", "static", "void", "multTransB", "(", "double", "alpha", ",", "DMatrix1Row", "a", ",", "DMatrix1Row", "b", ",", "DMatrix1Row", "c", ")", "{", "// TODO add a matrix vectory multiply here", "MatrixMatrixMult_DDRM", ".", "multTransB", "(", "alpha", ",", "a", ",", "b", ",", "c", ")", ";", "}" ]
<p> Performs the following operation:<br> <br> c = &alpha; * a * b<sup>T</sup> <br> c<sub>ij</sub> = &alpha; &sum;<sub>k=1:n</sub> { a<sub>ik</sub> * b<sub>jk</sub>} </p> @param alpha Scaling factor. @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "&alpha", ";", "*", "a", "*", "b<sup", ">", "T<", "/", "sup", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&alpha", ";", "&sum", ";", "<sub", ">", "k", "=", "1", ":", "n<", "/", "sub", ">", "{", "a<sub", ">", "ik<", "/", "sub", ">", "*", "b<sub", ">", "jk<", "/", "sub", ">", "}", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L197-L201
instacount/appengine-counter
src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java
ShardedCounterServiceImpl.assertValidExternalCounterStatus
@VisibleForTesting protected void assertValidExternalCounterStatus(final String counterName, final CounterStatus incomingCounterStatus) { """ Helper method to determine if a counter can be put into the {@code incomingCounterStatus} by an external caller. Currently, external callers may only put a Counter into the AVAILABLE or READ_ONLY status. @param counterName The name of the counter. @param incomingCounterStatus The status of an incoming counter that is being updated by an external counter. @return """ Preconditions.checkNotNull(counterName); Preconditions.checkNotNull(incomingCounterStatus); if (incomingCounterStatus != CounterStatus.AVAILABLE && incomingCounterStatus != CounterStatus.READ_ONLY_COUNT) { final String msg = String.format( "This Counter can only be put into the %s or %s status! %s is not allowed.", CounterStatus.AVAILABLE, CounterStatus.READ_ONLY_COUNT, incomingCounterStatus); throw new CounterNotMutableException(counterName, msg); } }
java
@VisibleForTesting protected void assertValidExternalCounterStatus(final String counterName, final CounterStatus incomingCounterStatus) { Preconditions.checkNotNull(counterName); Preconditions.checkNotNull(incomingCounterStatus); if (incomingCounterStatus != CounterStatus.AVAILABLE && incomingCounterStatus != CounterStatus.READ_ONLY_COUNT) { final String msg = String.format( "This Counter can only be put into the %s or %s status! %s is not allowed.", CounterStatus.AVAILABLE, CounterStatus.READ_ONLY_COUNT, incomingCounterStatus); throw new CounterNotMutableException(counterName, msg); } }
[ "@", "VisibleForTesting", "protected", "void", "assertValidExternalCounterStatus", "(", "final", "String", "counterName", ",", "final", "CounterStatus", "incomingCounterStatus", ")", "{", "Preconditions", ".", "checkNotNull", "(", "counterName", ")", ";", "Preconditions", ".", "checkNotNull", "(", "incomingCounterStatus", ")", ";", "if", "(", "incomingCounterStatus", "!=", "CounterStatus", ".", "AVAILABLE", "&&", "incomingCounterStatus", "!=", "CounterStatus", ".", "READ_ONLY_COUNT", ")", "{", "final", "String", "msg", "=", "String", ".", "format", "(", "\"This Counter can only be put into the %s or %s status! %s is not allowed.\"", ",", "CounterStatus", ".", "AVAILABLE", ",", "CounterStatus", ".", "READ_ONLY_COUNT", ",", "incomingCounterStatus", ")", ";", "throw", "new", "CounterNotMutableException", "(", "counterName", ",", "msg", ")", ";", "}", "}" ]
Helper method to determine if a counter can be put into the {@code incomingCounterStatus} by an external caller. Currently, external callers may only put a Counter into the AVAILABLE or READ_ONLY status. @param counterName The name of the counter. @param incomingCounterStatus The status of an incoming counter that is being updated by an external counter. @return
[ "Helper", "method", "to", "determine", "if", "a", "counter", "can", "be", "put", "into", "the", "{", "@code", "incomingCounterStatus", "}", "by", "an", "external", "caller", ".", "Currently", "external", "callers", "may", "only", "put", "a", "Counter", "into", "the", "AVAILABLE", "or", "READ_ONLY", "status", "." ]
train
https://github.com/instacount/appengine-counter/blob/60aa86ab28f173ec1642539926b69924b8bda238/src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java#L1470-L1483
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/render/Renderer.java
Renderer.encodeChildren
public void encodeChildren(FacesContext context, UIComponent component) throws IOException { """ <p>Render the child components of this {@link UIComponent}, following the rules described for <code>encodeBegin()</code> to acquire the appropriate value to be rendered. This method will only be called if the <code>rendersChildren</code> property of this component is <code>true</code>.</p> @param context {@link FacesContext} for the response we are creating @param component {@link UIComponent} whose children are to be rendered @throws IOException if an input/output error occurs while rendering @throws NullPointerException if <code>context</code> or <code>component</code> is <code>null</code> """ if (context == null || component == null) { throw new NullPointerException(); } if (component.getChildCount() > 0) { Iterator<UIComponent> kids = component.getChildren().iterator(); while (kids.hasNext()) { UIComponent kid = kids.next(); kid.encodeAll(context); } } }
java
public void encodeChildren(FacesContext context, UIComponent component) throws IOException { if (context == null || component == null) { throw new NullPointerException(); } if (component.getChildCount() > 0) { Iterator<UIComponent> kids = component.getChildren().iterator(); while (kids.hasNext()) { UIComponent kid = kids.next(); kid.encodeAll(context); } } }
[ "public", "void", "encodeChildren", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "if", "(", "context", "==", "null", "||", "component", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "(", "component", ".", "getChildCount", "(", ")", ">", "0", ")", "{", "Iterator", "<", "UIComponent", ">", "kids", "=", "component", ".", "getChildren", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "kids", ".", "hasNext", "(", ")", ")", "{", "UIComponent", "kid", "=", "kids", ".", "next", "(", ")", ";", "kid", ".", "encodeAll", "(", "context", ")", ";", "}", "}", "}" ]
<p>Render the child components of this {@link UIComponent}, following the rules described for <code>encodeBegin()</code> to acquire the appropriate value to be rendered. This method will only be called if the <code>rendersChildren</code> property of this component is <code>true</code>.</p> @param context {@link FacesContext} for the response we are creating @param component {@link UIComponent} whose children are to be rendered @throws IOException if an input/output error occurs while rendering @throws NullPointerException if <code>context</code> or <code>component</code> is <code>null</code>
[ "<p", ">", "Render", "the", "child", "components", "of", "this", "{", "@link", "UIComponent", "}", "following", "the", "rules", "described", "for", "<code", ">", "encodeBegin", "()", "<", "/", "code", ">", "to", "acquire", "the", "appropriate", "value", "to", "be", "rendered", ".", "This", "method", "will", "only", "be", "called", "if", "the", "<code", ">", "rendersChildren<", "/", "code", ">", "property", "of", "this", "component", "is", "<code", ">", "true<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/render/Renderer.java#L167-L179
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/accounts/CmsUserTransferList.java
CmsUserTransferList.setUserData
protected void setUserData(CmsUser user, CmsListItem item) { """ Sets all needed data of the user into the list item object.<p> @param user the user to set the data for @param item the list item object to set the data into """ item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_NAME, user.getFullName()); item.set(LIST_COLUMN_EMAIL, user.getEmail()); item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin())); }
java
protected void setUserData(CmsUser user, CmsListItem item) { item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_NAME, user.getFullName()); item.set(LIST_COLUMN_EMAIL, user.getEmail()); item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin())); }
[ "protected", "void", "setUserData", "(", "CmsUser", "user", ",", "CmsListItem", "item", ")", "{", "item", ".", "set", "(", "LIST_COLUMN_LOGIN", ",", "user", ".", "getName", "(", ")", ")", ";", "item", ".", "set", "(", "LIST_COLUMN_NAME", ",", "user", ".", "getFullName", "(", ")", ")", ";", "item", ".", "set", "(", "LIST_COLUMN_EMAIL", ",", "user", ".", "getEmail", "(", ")", ")", ";", "item", ".", "set", "(", "LIST_COLUMN_LASTLOGIN", ",", "new", "Date", "(", "user", ".", "getLastlogin", "(", ")", ")", ")", ";", "}" ]
Sets all needed data of the user into the list item object.<p> @param user the user to set the data for @param item the list item object to set the data into
[ "Sets", "all", "needed", "data", "of", "the", "user", "into", "the", "list", "item", "object", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/accounts/CmsUserTransferList.java#L577-L583
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/support/ConnectionPoolSupport.java
ConnectionPoolSupport.createGenericObjectPool
public static <T extends StatefulConnection<?, ?>> GenericObjectPool<T> createGenericObjectPool( Supplier<T> connectionSupplier, GenericObjectPoolConfig<T> config) { """ Creates a new {@link GenericObjectPool} using the {@link Supplier}. Allocated instances are wrapped and must not be returned with {@link ObjectPool#returnObject(Object)}. @param connectionSupplier must not be {@literal null}. @param config must not be {@literal null}. @param <T> connection type. @return the connection pool. """ return createGenericObjectPool(connectionSupplier, config, true); }
java
public static <T extends StatefulConnection<?, ?>> GenericObjectPool<T> createGenericObjectPool( Supplier<T> connectionSupplier, GenericObjectPoolConfig<T> config) { return createGenericObjectPool(connectionSupplier, config, true); }
[ "public", "static", "<", "T", "extends", "StatefulConnection", "<", "?", ",", "?", ">", ">", "GenericObjectPool", "<", "T", ">", "createGenericObjectPool", "(", "Supplier", "<", "T", ">", "connectionSupplier", ",", "GenericObjectPoolConfig", "<", "T", ">", "config", ")", "{", "return", "createGenericObjectPool", "(", "connectionSupplier", ",", "config", ",", "true", ")", ";", "}" ]
Creates a new {@link GenericObjectPool} using the {@link Supplier}. Allocated instances are wrapped and must not be returned with {@link ObjectPool#returnObject(Object)}. @param connectionSupplier must not be {@literal null}. @param config must not be {@literal null}. @param <T> connection type. @return the connection pool.
[ "Creates", "a", "new", "{", "@link", "GenericObjectPool", "}", "using", "the", "{", "@link", "Supplier", "}", ".", "Allocated", "instances", "are", "wrapped", "and", "must", "not", "be", "returned", "with", "{", "@link", "ObjectPool#returnObject", "(", "Object", ")", "}", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/support/ConnectionPoolSupport.java#L92-L95
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/server/data/CreateBicMapConstantsClass.java
CreateBicMapConstantsClass.create
public static BicMapSharedConstants create() { """ Instantiates a class via deferred binding. @return the new instance, which must be cast to the requested class """ if (bicMapConstants == null) { // NOPMD it's thread save! synchronized (BicMapConstantsImpl.class) { if (bicMapConstants == null) { bicMapConstants = new BicMapConstantsImpl(readMapFromProperties("BicMapConstants", "bics")); } } } return bicMapConstants; }
java
public static BicMapSharedConstants create() { if (bicMapConstants == null) { // NOPMD it's thread save! synchronized (BicMapConstantsImpl.class) { if (bicMapConstants == null) { bicMapConstants = new BicMapConstantsImpl(readMapFromProperties("BicMapConstants", "bics")); } } } return bicMapConstants; }
[ "public", "static", "BicMapSharedConstants", "create", "(", ")", "{", "if", "(", "bicMapConstants", "==", "null", ")", "{", "// NOPMD it's thread save!", "synchronized", "(", "BicMapConstantsImpl", ".", "class", ")", "{", "if", "(", "bicMapConstants", "==", "null", ")", "{", "bicMapConstants", "=", "new", "BicMapConstantsImpl", "(", "readMapFromProperties", "(", "\"BicMapConstants\"", ",", "\"bics\"", ")", ")", ";", "}", "}", "}", "return", "bicMapConstants", ";", "}" ]
Instantiates a class via deferred binding. @return the new instance, which must be cast to the requested class
[ "Instantiates", "a", "class", "via", "deferred", "binding", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/server/data/CreateBicMapConstantsClass.java#L35-L45
ogaclejapan/SmartTabLayout
utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java
Bundler.putCharSequenceArrayList
@TargetApi(8) public Bundler putCharSequenceArrayList(String key, ArrayList<CharSequence> value) { """ Inserts an ArrayList<CharSequence> value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value an ArrayList<CharSequence> object, or null @return this """ bundle.putCharSequenceArrayList(key, value); return this; }
java
@TargetApi(8) public Bundler putCharSequenceArrayList(String key, ArrayList<CharSequence> value) { bundle.putCharSequenceArrayList(key, value); return this; }
[ "@", "TargetApi", "(", "8", ")", "public", "Bundler", "putCharSequenceArrayList", "(", "String", "key", ",", "ArrayList", "<", "CharSequence", ">", "value", ")", "{", "bundle", ".", "putCharSequenceArrayList", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts an ArrayList<CharSequence> value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value an ArrayList<CharSequence> object, or null @return this
[ "Inserts", "an", "ArrayList<CharSequence", ">", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L251-L255
cdk/cdk
descriptor/cip/src/main/java/org/openscience/cdk/geometry/cip/CIPTool.java
CIPTool.getLigands
private static ILigand[] getLigands(IAtom atom, IAtomContainer container, IAtom exclude) { """ Obtain the ligands connected to the 'atom' excluding 'exclude'. This is mainly meant as a utility for double-bond labelling. @param atom an atom @param container a structure to which 'atom' belongs @param exclude exclude this atom - can not be null @return the ligands """ List<IAtom> neighbors = container.getConnectedAtomsList(atom); ILigand[] ligands = new ILigand[neighbors.size() - 1]; int i = 0; for (IAtom neighbor : neighbors) { if (!neighbor.equals(exclude)) ligands[i++] = new Ligand(container, new VisitedAtoms(), atom, neighbor); } return ligands; }
java
private static ILigand[] getLigands(IAtom atom, IAtomContainer container, IAtom exclude) { List<IAtom> neighbors = container.getConnectedAtomsList(atom); ILigand[] ligands = new ILigand[neighbors.size() - 1]; int i = 0; for (IAtom neighbor : neighbors) { if (!neighbor.equals(exclude)) ligands[i++] = new Ligand(container, new VisitedAtoms(), atom, neighbor); } return ligands; }
[ "private", "static", "ILigand", "[", "]", "getLigands", "(", "IAtom", "atom", ",", "IAtomContainer", "container", ",", "IAtom", "exclude", ")", "{", "List", "<", "IAtom", ">", "neighbors", "=", "container", ".", "getConnectedAtomsList", "(", "atom", ")", ";", "ILigand", "[", "]", "ligands", "=", "new", "ILigand", "[", "neighbors", ".", "size", "(", ")", "-", "1", "]", ";", "int", "i", "=", "0", ";", "for", "(", "IAtom", "neighbor", ":", "neighbors", ")", "{", "if", "(", "!", "neighbor", ".", "equals", "(", "exclude", ")", ")", "ligands", "[", "i", "++", "]", "=", "new", "Ligand", "(", "container", ",", "new", "VisitedAtoms", "(", ")", ",", "atom", ",", "neighbor", ")", ";", "}", "return", "ligands", ";", "}" ]
Obtain the ligands connected to the 'atom' excluding 'exclude'. This is mainly meant as a utility for double-bond labelling. @param atom an atom @param container a structure to which 'atom' belongs @param exclude exclude this atom - can not be null @return the ligands
[ "Obtain", "the", "ligands", "connected", "to", "the", "atom", "excluding", "exclude", ".", "This", "is", "mainly", "meant", "as", "a", "utility", "for", "double", "-", "bond", "labelling", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/cip/src/main/java/org/openscience/cdk/geometry/cip/CIPTool.java#L206-L218
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/factory/weights/FactoryWeights.java
FactoryWeights.pixel
public static WeightPixel_F32 pixel( WeightType type , boolean safe ) { """ Creates a weight function for the provided distributions. @param type Which type of distribution should be used @param safe If true it will then check the input distance to see if it matches. @return WeightDistance_F32 """ if( safe ) throw new IllegalArgumentException("Safe distributons not implemented yet"); switch( type ) { case GAUSSIAN_SQ: return new WeightPixelGaussian_F32(); case UNIFORM: return new WeightPixelUniform_F32(); } throw new IllegalArgumentException("Unknown type "+type); }
java
public static WeightPixel_F32 pixel( WeightType type , boolean safe ) { if( safe ) throw new IllegalArgumentException("Safe distributons not implemented yet"); switch( type ) { case GAUSSIAN_SQ: return new WeightPixelGaussian_F32(); case UNIFORM: return new WeightPixelUniform_F32(); } throw new IllegalArgumentException("Unknown type "+type); }
[ "public", "static", "WeightPixel_F32", "pixel", "(", "WeightType", "type", ",", "boolean", "safe", ")", "{", "if", "(", "safe", ")", "throw", "new", "IllegalArgumentException", "(", "\"Safe distributons not implemented yet\"", ")", ";", "switch", "(", "type", ")", "{", "case", "GAUSSIAN_SQ", ":", "return", "new", "WeightPixelGaussian_F32", "(", ")", ";", "case", "UNIFORM", ":", "return", "new", "WeightPixelUniform_F32", "(", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Unknown type \"", "+", "type", ")", ";", "}" ]
Creates a weight function for the provided distributions. @param type Which type of distribution should be used @param safe If true it will then check the input distance to see if it matches. @return WeightDistance_F32
[ "Creates", "a", "weight", "function", "for", "the", "provided", "distributions", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/weights/FactoryWeights.java#L62-L76
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/CopyFieldHandler.java
CopyFieldHandler.moveIt
public int moveIt(boolean bDisplayOption, int iMoveMode) { """ Do the physical move operation. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay). """ if (m_convCheckMark != null) if (m_convCheckMark.getState() == false) return DBConstants.NORMAL_RETURN; // If check mark is false (or no check mark), don't move return super.moveIt(bDisplayOption, iMoveMode); }
java
public int moveIt(boolean bDisplayOption, int iMoveMode) { if (m_convCheckMark != null) if (m_convCheckMark.getState() == false) return DBConstants.NORMAL_RETURN; // If check mark is false (or no check mark), don't move return super.moveIt(bDisplayOption, iMoveMode); }
[ "public", "int", "moveIt", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "if", "(", "m_convCheckMark", "!=", "null", ")", "if", "(", "m_convCheckMark", ".", "getState", "(", ")", "==", "false", ")", "return", "DBConstants", ".", "NORMAL_RETURN", ";", "// If check mark is false (or no check mark), don't move", "return", "super", ".", "moveIt", "(", "bDisplayOption", ",", "iMoveMode", ")", ";", "}" ]
Do the physical move operation. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "Do", "the", "physical", "move", "operation", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CopyFieldHandler.java#L110-L115