repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
jayantk/jklol | src/com/jayantkrish/jklol/cfg/CfgParseChart.java | CfgParseChart.getOutsideEntries | public Factor getOutsideEntries(int spanStart, int spanEnd) {
Tensor entries = new DenseTensor(parentVar.getVariableNumsArray(),
parentVar.getVariableSizes(), outsideChart[spanStart][spanEnd]);
return new TableFactor(parentVar, entries);
} | java | public Factor getOutsideEntries(int spanStart, int spanEnd) {
Tensor entries = new DenseTensor(parentVar.getVariableNumsArray(),
parentVar.getVariableSizes(), outsideChart[spanStart][spanEnd]);
return new TableFactor(parentVar, entries);
} | [
"public",
"Factor",
"getOutsideEntries",
"(",
"int",
"spanStart",
",",
"int",
"spanEnd",
")",
"{",
"Tensor",
"entries",
"=",
"new",
"DenseTensor",
"(",
"parentVar",
".",
"getVariableNumsArray",
"(",
")",
",",
"parentVar",
".",
"getVariableSizes",
"(",
")",
","... | Get the outside unnormalized probabilities over productions at a particular
span in the tree. | [
"Get",
"the",
"outside",
"unnormalized",
"probabilities",
"over",
"productions",
"at",
"a",
"particular",
"span",
"in",
"the",
"tree",
"."
] | d27532ca83e212d51066cf28f52621acc3fd44cc | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cfg/CfgParseChart.java#L267-L271 | train |
jayantk/jklol | src/com/jayantkrish/jklol/cfg/CfgParseChart.java | CfgParseChart.getMarginalEntries | public Factor getMarginalEntries(int spanStart, int spanEnd) {
return getOutsideEntries(spanStart, spanEnd).product(getInsideEntries(spanStart, spanEnd));
} | java | public Factor getMarginalEntries(int spanStart, int spanEnd) {
return getOutsideEntries(spanStart, spanEnd).product(getInsideEntries(spanStart, spanEnd));
} | [
"public",
"Factor",
"getMarginalEntries",
"(",
"int",
"spanStart",
",",
"int",
"spanEnd",
")",
"{",
"return",
"getOutsideEntries",
"(",
"spanStart",
",",
"spanEnd",
")",
".",
"product",
"(",
"getInsideEntries",
"(",
"spanStart",
",",
"spanEnd",
")",
")",
";",
... | Get the marginal unnormalized probabilities over productions at a
particular node in the tree. | [
"Get",
"the",
"marginal",
"unnormalized",
"probabilities",
"over",
"productions",
"at",
"a",
"particular",
"node",
"in",
"the",
"tree",
"."
] | d27532ca83e212d51066cf28f52621acc3fd44cc | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cfg/CfgParseChart.java#L277-L279 | train |
jayantk/jklol | src/com/jayantkrish/jklol/cfg/CfgParseChart.java | CfgParseChart.getBestParseTree | public CfgParseTree getBestParseTree() {
Factor rootMarginal = getMarginalEntries(0, chartSize() - 1);
Assignment bestAssignment = rootMarginal.getMostLikelyAssignments(1).get(0);
return getBestParseTree(bestAssignment.getOnlyValue());
} | java | public CfgParseTree getBestParseTree() {
Factor rootMarginal = getMarginalEntries(0, chartSize() - 1);
Assignment bestAssignment = rootMarginal.getMostLikelyAssignments(1).get(0);
return getBestParseTree(bestAssignment.getOnlyValue());
} | [
"public",
"CfgParseTree",
"getBestParseTree",
"(",
")",
"{",
"Factor",
"rootMarginal",
"=",
"getMarginalEntries",
"(",
"0",
",",
"chartSize",
"(",
")",
"-",
"1",
")",
";",
"Assignment",
"bestAssignment",
"=",
"rootMarginal",
".",
"getMostLikelyAssignments",
"(",
... | Gets the best parse tree spanning the entire sentence.
@return | [
"Gets",
"the",
"best",
"parse",
"tree",
"spanning",
"the",
"entire",
"sentence",
"."
] | d27532ca83e212d51066cf28f52621acc3fd44cc | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cfg/CfgParseChart.java#L290-L294 | train |
jayantk/jklol | src/com/jayantkrish/jklol/cfg/CfgParseChart.java | CfgParseChart.getBestParseTreeWithSpan | public CfgParseTree getBestParseTreeWithSpan(Object root, int spanStart,
int spanEnd) {
Preconditions.checkState(!sumProduct);
Assignment rootAssignment = parentVar.outcomeArrayToAssignment(root);
int rootNonterminalNum = parentVar.assignmentToIntArray(rootAssignment)[0];
double prob = insideChart[spanStart][spanEnd][rootNonterminalNum]
* outsideChart[spanStart][spanEnd][rootNonterminalNum];
if (prob == 0.0) {
return null;
}
int splitInd = splitBackpointers[spanStart][spanEnd][rootNonterminalNum];
if (splitInd < 0) {
long terminalKey = backpointers[spanStart][spanEnd][rootNonterminalNum];
int positiveSplitInd = (-1 * splitInd) - 1;
int terminalSpanStart = positiveSplitInd / numTerminals;
int terminalSpanEnd = positiveSplitInd % numTerminals;
// This is a really sucky way to transform the keys back to objects.
VariableNumMap vars = parentVar.union(ruleTypeVar);
int[] dimKey = TableFactor.zero(vars).getWeights().keyNumToDimKey(terminalKey);
Assignment a = vars.intArrayToAssignment(dimKey);
Object ruleType = a.getValue(ruleTypeVar.getOnlyVariableNum());
List<Object> terminalList = Lists.newArrayList();
terminalList.addAll(terminals.subList(terminalSpanStart, terminalSpanEnd + 1));
return new CfgParseTree(root, ruleType, terminalList, prob, spanStart, spanEnd);
} else {
long binaryRuleKey = backpointers[spanStart][spanEnd][rootNonterminalNum];
int[] binaryRuleComponents = binaryRuleDistribution.coerceToDiscrete()
.getWeights().keyNumToDimKey(binaryRuleKey);
Assignment best = binaryRuleDistribution.getVars().intArrayToAssignment(binaryRuleComponents);
Object leftRoot = best.getValue(leftVar.getOnlyVariableNum());
Object rightRoot = best.getValue(rightVar.getOnlyVariableNum());
Object ruleType = best.getValue(ruleTypeVar.getOnlyVariableNum());
Preconditions.checkArgument(spanStart + splitInd != spanEnd,
"CFG parse decoding error: %s %s %s", spanStart, spanEnd, splitInd);
CfgParseTree leftTree = getBestParseTreeWithSpan(leftRoot, spanStart, spanStart + splitInd);
CfgParseTree rightTree = getBestParseTreeWithSpan(rightRoot, spanStart + splitInd + 1, spanEnd);
Preconditions.checkState(leftTree != null);
Preconditions.checkState(rightTree != null);
return new CfgParseTree(root, ruleType, leftTree, rightTree, prob);
}
} | java | public CfgParseTree getBestParseTreeWithSpan(Object root, int spanStart,
int spanEnd) {
Preconditions.checkState(!sumProduct);
Assignment rootAssignment = parentVar.outcomeArrayToAssignment(root);
int rootNonterminalNum = parentVar.assignmentToIntArray(rootAssignment)[0];
double prob = insideChart[spanStart][spanEnd][rootNonterminalNum]
* outsideChart[spanStart][spanEnd][rootNonterminalNum];
if (prob == 0.0) {
return null;
}
int splitInd = splitBackpointers[spanStart][spanEnd][rootNonterminalNum];
if (splitInd < 0) {
long terminalKey = backpointers[spanStart][spanEnd][rootNonterminalNum];
int positiveSplitInd = (-1 * splitInd) - 1;
int terminalSpanStart = positiveSplitInd / numTerminals;
int terminalSpanEnd = positiveSplitInd % numTerminals;
// This is a really sucky way to transform the keys back to objects.
VariableNumMap vars = parentVar.union(ruleTypeVar);
int[] dimKey = TableFactor.zero(vars).getWeights().keyNumToDimKey(terminalKey);
Assignment a = vars.intArrayToAssignment(dimKey);
Object ruleType = a.getValue(ruleTypeVar.getOnlyVariableNum());
List<Object> terminalList = Lists.newArrayList();
terminalList.addAll(terminals.subList(terminalSpanStart, terminalSpanEnd + 1));
return new CfgParseTree(root, ruleType, terminalList, prob, spanStart, spanEnd);
} else {
long binaryRuleKey = backpointers[spanStart][spanEnd][rootNonterminalNum];
int[] binaryRuleComponents = binaryRuleDistribution.coerceToDiscrete()
.getWeights().keyNumToDimKey(binaryRuleKey);
Assignment best = binaryRuleDistribution.getVars().intArrayToAssignment(binaryRuleComponents);
Object leftRoot = best.getValue(leftVar.getOnlyVariableNum());
Object rightRoot = best.getValue(rightVar.getOnlyVariableNum());
Object ruleType = best.getValue(ruleTypeVar.getOnlyVariableNum());
Preconditions.checkArgument(spanStart + splitInd != spanEnd,
"CFG parse decoding error: %s %s %s", spanStart, spanEnd, splitInd);
CfgParseTree leftTree = getBestParseTreeWithSpan(leftRoot, spanStart, spanStart + splitInd);
CfgParseTree rightTree = getBestParseTreeWithSpan(rightRoot, spanStart + splitInd + 1, spanEnd);
Preconditions.checkState(leftTree != null);
Preconditions.checkState(rightTree != null);
return new CfgParseTree(root, ruleType, leftTree, rightTree, prob);
}
} | [
"public",
"CfgParseTree",
"getBestParseTreeWithSpan",
"(",
"Object",
"root",
",",
"int",
"spanStart",
",",
"int",
"spanEnd",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"sumProduct",
")",
";",
"Assignment",
"rootAssignment",
"=",
"parentVar",
".",
"o... | If this tree contains max-marginals, recover the best parse subtree for a
given symbol with the specified span. | [
"If",
"this",
"tree",
"contains",
"max",
"-",
"marginals",
"recover",
"the",
"best",
"parse",
"subtree",
"for",
"a",
"given",
"symbol",
"with",
"the",
"specified",
"span",
"."
] | d27532ca83e212d51066cf28f52621acc3fd44cc | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/cfg/CfgParseChart.java#L308-L358 | train |
mgormley/prim | src/main/java_generated/edu/jhu/prim/vector/LongIntVectorSlice.java | LongIntVectorSlice.get | public int get(long idx) {
if (idx < 0 || idx >= size) {
return 0;
}
return elements[SafeCast.safeLongToInt(idx + start)];
} | java | public int get(long idx) {
if (idx < 0 || idx >= size) {
return 0;
}
return elements[SafeCast.safeLongToInt(idx + start)];
} | [
"public",
"int",
"get",
"(",
"long",
"idx",
")",
"{",
"if",
"(",
"idx",
"<",
"0",
"||",
"idx",
">=",
"size",
")",
"{",
"return",
"0",
";",
"}",
"return",
"elements",
"[",
"SafeCast",
".",
"safeLongToInt",
"(",
"idx",
"+",
"start",
")",
"]",
";",
... | Gets the idx'th entry in the vector.
@param idx The index of the element to get.
@return The value of the element to get. | [
"Gets",
"the",
"idx",
"th",
"entry",
"in",
"the",
"vector",
"."
] | 5dce5e1ae94a9ae558a6262fc246e1a24f56686c | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/vector/LongIntVectorSlice.java#L72-L77 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java | BaseXmlParser.findTag | protected Element findTag(String tagName, Element element) {
Node result = element.getFirstChild();
while (result != null) {
if (result instanceof Element
&& (tagName.equals(((Element) result).getNodeName()) || tagName
.equals(((Element) result).getLocalName()))) {
break;
}
result = result.getNextSibling();
}
return (Element) result;
} | java | protected Element findTag(String tagName, Element element) {
Node result = element.getFirstChild();
while (result != null) {
if (result instanceof Element
&& (tagName.equals(((Element) result).getNodeName()) || tagName
.equals(((Element) result).getLocalName()))) {
break;
}
result = result.getNextSibling();
}
return (Element) result;
} | [
"protected",
"Element",
"findTag",
"(",
"String",
"tagName",
",",
"Element",
"element",
")",
"{",
"Node",
"result",
"=",
"element",
".",
"getFirstChild",
"(",
")",
";",
"while",
"(",
"result",
"!=",
"null",
")",
"{",
"if",
"(",
"result",
"instanceof",
"E... | Find the child element whose tag matches the specified tag name.
@param tagName Tag name to locate.
@param element Parent element whose children are to be searched.
@return The matching node (first occurrence only) or null if not found. | [
"Find",
"the",
"child",
"element",
"whose",
"tag",
"matches",
"the",
"specified",
"tag",
"name",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java#L60-L73 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java | BaseXmlParser.getTagChildren | protected NodeList getTagChildren(String tagName, Element element) {
return element.getNamespaceURI() == null ? element.getElementsByTagName(tagName) : element.getElementsByTagNameNS(
element.getNamespaceURI(), tagName);
} | java | protected NodeList getTagChildren(String tagName, Element element) {
return element.getNamespaceURI() == null ? element.getElementsByTagName(tagName) : element.getElementsByTagNameNS(
element.getNamespaceURI(), tagName);
} | [
"protected",
"NodeList",
"getTagChildren",
"(",
"String",
"tagName",
",",
"Element",
"element",
")",
"{",
"return",
"element",
".",
"getNamespaceURI",
"(",
")",
"==",
"null",
"?",
"element",
".",
"getElementsByTagName",
"(",
"tagName",
")",
":",
"element",
"."... | Returns the children under the specified tag. Compensates for namespace usage.
@param tagName Name of tag whose children are sought.
@param element Element to search for tag.
@return Node list containing children of tag. | [
"Returns",
"the",
"children",
"under",
"the",
"specified",
"tag",
".",
"Compensates",
"for",
"namespace",
"usage",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java#L82-L85 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java | BaseXmlParser.addProperties | protected void addProperties(Element element, BeanDefinitionBuilder builder) {
NamedNodeMap attributes = element.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node node = attributes.item(i);
String attrName = getNodeName(node);
attrName = "class".equals(attrName) ? "clazz" : attrName;
builder.addPropertyValue(attrName, node.getNodeValue());
}
} | java | protected void addProperties(Element element, BeanDefinitionBuilder builder) {
NamedNodeMap attributes = element.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
Node node = attributes.item(i);
String attrName = getNodeName(node);
attrName = "class".equals(attrName) ? "clazz" : attrName;
builder.addPropertyValue(attrName, node.getNodeValue());
}
} | [
"protected",
"void",
"addProperties",
"(",
"Element",
"element",
",",
"BeanDefinitionBuilder",
"builder",
")",
"{",
"NamedNodeMap",
"attributes",
"=",
"element",
".",
"getAttributes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"attribute... | Adds all attributes of the specified elements as properties in the current builder.
@param element Element whose attributes are to be added.
@param builder Target builder. | [
"Adds",
"all",
"attributes",
"of",
"the",
"specified",
"elements",
"as",
"properties",
"in",
"the",
"current",
"builder",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java#L93-L102 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java | BaseXmlParser.getNodeName | protected String getNodeName(Node node) {
String result = node.getLocalName();
return result == null ? node.getNodeName() : result;
} | java | protected String getNodeName(Node node) {
String result = node.getLocalName();
return result == null ? node.getNodeName() : result;
} | [
"protected",
"String",
"getNodeName",
"(",
"Node",
"node",
")",
"{",
"String",
"result",
"=",
"node",
".",
"getLocalName",
"(",
")",
";",
"return",
"result",
"==",
"null",
"?",
"node",
".",
"getNodeName",
"(",
")",
":",
"result",
";",
"}"
] | Returns the node name. First tries local name. If this is null, returns instead the full node
name.
@param node DOM node to examine.
@return Name of the node. | [
"Returns",
"the",
"node",
"name",
".",
"First",
"tries",
"local",
"name",
".",
"If",
"this",
"is",
"null",
"returns",
"instead",
"the",
"full",
"node",
"name",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java#L111-L114 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java | BaseXmlParser.fromXml | protected Object fromXml(String xml, String tagName) throws Exception {
Document document = XMLUtil.parseXMLFromString(xml);
NodeList nodeList = document.getElementsByTagName(tagName);
if (nodeList == null || nodeList.getLength() != 1) {
throw new DOMException(DOMException.NOT_FOUND_ERR, "Top level tag '" + tagName + "' was not found.");
}
Element element = (Element) nodeList.item(0);
Class<?> beanClass = getBeanClass(element);
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(beanClass);
doParse(element, builder);
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
factory.setParentBeanFactory(SpringUtil.getAppContext());
AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
factory.registerBeanDefinition(tagName, beanDefinition);
return factory.getBean(tagName);
} | java | protected Object fromXml(String xml, String tagName) throws Exception {
Document document = XMLUtil.parseXMLFromString(xml);
NodeList nodeList = document.getElementsByTagName(tagName);
if (nodeList == null || nodeList.getLength() != 1) {
throw new DOMException(DOMException.NOT_FOUND_ERR, "Top level tag '" + tagName + "' was not found.");
}
Element element = (Element) nodeList.item(0);
Class<?> beanClass = getBeanClass(element);
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(beanClass);
doParse(element, builder);
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
factory.setParentBeanFactory(SpringUtil.getAppContext());
AbstractBeanDefinition beanDefinition = builder.getBeanDefinition();
factory.registerBeanDefinition(tagName, beanDefinition);
return factory.getBean(tagName);
} | [
"protected",
"Object",
"fromXml",
"(",
"String",
"xml",
",",
"String",
"tagName",
")",
"throws",
"Exception",
"{",
"Document",
"document",
"=",
"XMLUtil",
".",
"parseXMLFromString",
"(",
"xml",
")",
";",
"NodeList",
"nodeList",
"=",
"document",
".",
"getElemen... | Parses an xml extension from an xml string.
@param xml XML containing the extension.
@param tagName The top level tag name.
@return Result of the parsed extension.
@throws Exception Unspecified exception. | [
"Parses",
"an",
"xml",
"extension",
"from",
"an",
"xml",
"string",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java#L124-L141 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java | BaseXmlParser.getResourcePath | protected String getResourcePath(ParserContext parserContext) {
if (parserContext != null) {
try {
Resource resource = parserContext.getReaderContext().getResource();
return resource == null ? null : resource.getURL().getPath();
} catch (IOException e) {}
}
return null;
} | java | protected String getResourcePath(ParserContext parserContext) {
if (parserContext != null) {
try {
Resource resource = parserContext.getReaderContext().getResource();
return resource == null ? null : resource.getURL().getPath();
} catch (IOException e) {}
}
return null;
} | [
"protected",
"String",
"getResourcePath",
"(",
"ParserContext",
"parserContext",
")",
"{",
"if",
"(",
"parserContext",
"!=",
"null",
")",
"{",
"try",
"{",
"Resource",
"resource",
"=",
"parserContext",
".",
"getReaderContext",
"(",
")",
".",
"getResource",
"(",
... | Return the path of the resource being parsed.
@param parserContext The current parser context.
@return The resource being parsed, or null if cannot be determined. | [
"Return",
"the",
"path",
"of",
"the",
"resource",
"being",
"parsed",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java#L149-L158 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionListener.java | ActionListener.removeAction | protected void removeAction() {
component.removeEventListener(eventName, this);
if (component.getAttribute(attrName) == this) {
component.removeAttribute(attrName);
}
} | java | protected void removeAction() {
component.removeEventListener(eventName, this);
if (component.getAttribute(attrName) == this) {
component.removeAttribute(attrName);
}
} | [
"protected",
"void",
"removeAction",
"(",
")",
"{",
"component",
".",
"removeEventListener",
"(",
"eventName",
",",
"this",
")",
";",
"if",
"(",
"component",
".",
"getAttribute",
"(",
"attrName",
")",
"==",
"this",
")",
"{",
"component",
".",
"removeAttribut... | Remove this listener from its associated component. | [
"Remove",
"this",
"listener",
"from",
"its",
"associated",
"component",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionListener.java#L88-L94 | train |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/SourceLoader.java | SourceLoader.isHelpSetFile | public boolean isHelpSetFile(String fileName) {
if (helpSetFilter == null) {
helpSetFilter = new WildcardFileFilter(helpSetPattern);
}
return helpSetFilter.accept(new File(fileName));
} | java | public boolean isHelpSetFile(String fileName) {
if (helpSetFilter == null) {
helpSetFilter = new WildcardFileFilter(helpSetPattern);
}
return helpSetFilter.accept(new File(fileName));
} | [
"public",
"boolean",
"isHelpSetFile",
"(",
"String",
"fileName",
")",
"{",
"if",
"(",
"helpSetFilter",
"==",
"null",
")",
"{",
"helpSetFilter",
"=",
"new",
"WildcardFileFilter",
"(",
"helpSetPattern",
")",
";",
"}",
"return",
"helpSetFilter",
".",
"accept",
"(... | Returns true if the file name matches the pattern specified for the main help set file.
@param fileName File name to check.
@return True if this is the main help set file. | [
"Returns",
"true",
"if",
"the",
"file",
"name",
"matches",
"the",
"pattern",
"specified",
"for",
"the",
"main",
"help",
"set",
"file",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/SourceLoader.java#L98-L104 | train |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/SourceLoader.java | SourceLoader.load | public IResourceIterator load(String archiveName) throws Exception {
File file = new File(archiveName);
if (file.isDirectory()) {
return new DirectoryIterator(file);
}
return iteratorClass.getConstructor(String.class).newInstance(archiveName);
} | java | public IResourceIterator load(String archiveName) throws Exception {
File file = new File(archiveName);
if (file.isDirectory()) {
return new DirectoryIterator(file);
}
return iteratorClass.getConstructor(String.class).newInstance(archiveName);
} | [
"public",
"IResourceIterator",
"load",
"(",
"String",
"archiveName",
")",
"throws",
"Exception",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"archiveName",
")",
";",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"new",
"DirectoryIt... | Returns a resource iterator instance for the given archive name.
@param archiveName Name of the archive file.
@return A resource iterator instance.
@throws Exception Unspecified exception. | [
"Returns",
"a",
"resource",
"iterator",
"instance",
"for",
"the",
"given",
"archive",
"name",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/SourceLoader.java#L113-L121 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementFrame.java | ElementFrame.setUrl | public void setUrl(String url) {
this.url = url;
if (child != null) {
child.destroy();
child = null;
}
if (url.startsWith("http") || !url.endsWith(".fsp")) {
child = new Iframe();
((Iframe) child).setSrc(url);
} else {
child = new Import();
((Import) child).setSrc(url);
}
fullSize(child);
root.addChild(child);
} | java | public void setUrl(String url) {
this.url = url;
if (child != null) {
child.destroy();
child = null;
}
if (url.startsWith("http") || !url.endsWith(".fsp")) {
child = new Iframe();
((Iframe) child).setSrc(url);
} else {
child = new Import();
((Import) child).setSrc(url);
}
fullSize(child);
root.addChild(child);
} | [
"public",
"void",
"setUrl",
"(",
"String",
"url",
")",
"{",
"this",
".",
"url",
"=",
"url",
";",
"if",
"(",
"child",
"!=",
"null",
")",
"{",
"child",
".",
"destroy",
"(",
")",
";",
"child",
"=",
"null",
";",
"}",
"if",
"(",
"url",
".",
"startsW... | Sets the URL of the content to be retrieved. If the URL starts with "http", it is fetched
into an iframe. Otherwise, an include component is created and used to fetch the content.
@param url Content URL. | [
"Sets",
"the",
"URL",
"of",
"the",
"content",
"to",
"be",
"retrieved",
".",
"If",
"the",
"URL",
"starts",
"with",
"http",
"it",
"is",
"fetched",
"into",
"an",
"iframe",
".",
"Otherwise",
"an",
"include",
"component",
"is",
"created",
"and",
"used",
"to",... | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementFrame.java#L61-L79 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextSerializerRegistry.java | ContextSerializerRegistry.get | @Override
public ISerializer<?> get(Class<?> clazz) {
ISerializer<?> contextSerializer = super.get(clazz);
if (contextSerializer != null) {
return contextSerializer;
}
for (ISerializer<?> item : this) {
if (item.getType().isAssignableFrom(clazz)) {
return item;
}
}
return null;
} | java | @Override
public ISerializer<?> get(Class<?> clazz) {
ISerializer<?> contextSerializer = super.get(clazz);
if (contextSerializer != null) {
return contextSerializer;
}
for (ISerializer<?> item : this) {
if (item.getType().isAssignableFrom(clazz)) {
return item;
}
}
return null;
} | [
"@",
"Override",
"public",
"ISerializer",
"<",
"?",
">",
"get",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"ISerializer",
"<",
"?",
">",
"contextSerializer",
"=",
"super",
".",
"get",
"(",
"clazz",
")",
";",
"if",
"(",
"contextSerializer",
"!=",
... | Returns the item associated with the specified key, or null if not found.
@param clazz The class whose serializer is sought.
@return The context serializer. | [
"Returns",
"the",
"item",
"associated",
"with",
"the",
"specified",
"key",
"or",
"null",
"if",
"not",
"found",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextSerializerRegistry.java#L62-L77 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java | Layout.materialize | public ElementUI materialize(ElementUI parent) {
boolean isDesktop = parent instanceof ElementDesktop;
if (isDesktop) {
parent.getDefinition().initElement(parent, root);
}
materializeChildren(parent, root, !isDesktop);
ElementUI element = parent.getLastVisibleChild();
if (element != null) {
element.getRoot().activate(true);
}
return element;
} | java | public ElementUI materialize(ElementUI parent) {
boolean isDesktop = parent instanceof ElementDesktop;
if (isDesktop) {
parent.getDefinition().initElement(parent, root);
}
materializeChildren(parent, root, !isDesktop);
ElementUI element = parent.getLastVisibleChild();
if (element != null) {
element.getRoot().activate(true);
}
return element;
} | [
"public",
"ElementUI",
"materialize",
"(",
"ElementUI",
"parent",
")",
"{",
"boolean",
"isDesktop",
"=",
"parent",
"instanceof",
"ElementDesktop",
";",
"if",
"(",
"isDesktop",
")",
"{",
"parent",
".",
"getDefinition",
"(",
")",
".",
"initElement",
"(",
"parent... | Materializes the layout, under the specified parent, starting from the layout origin.
@param parent Parent UI element at this level of the hierarchy. May be null.
@return The UI element created during this pass. | [
"Materializes",
"the",
"layout",
"under",
"the",
"specified",
"parent",
"starting",
"from",
"the",
"layout",
"origin",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java#L76-L91 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java | Layout.materializeChildren | private void materializeChildren(ElementBase parent, LayoutElement node, boolean ignoreInternal) {
for (LayoutNode child : node.getChildren()) {
PluginDefinition def = child.getDefinition();
ElementBase element = ignoreInternal && def.isInternal() ? null : createElement(parent, child);
if (element != null) {
materializeChildren(element, (LayoutElement) child, false);
}
}
for (LayoutTrigger trigger : node.getTriggers()) {
ElementTrigger trg = new ElementTrigger();
trg.addTarget((ElementUI) parent);
createElement(trg, trigger.getChild(LayoutTriggerCondition.class));
createElement(trg, trigger.getChild(LayoutTriggerAction.class));
((ElementUI) parent).addTrigger(trg);
}
} | java | private void materializeChildren(ElementBase parent, LayoutElement node, boolean ignoreInternal) {
for (LayoutNode child : node.getChildren()) {
PluginDefinition def = child.getDefinition();
ElementBase element = ignoreInternal && def.isInternal() ? null : createElement(parent, child);
if (element != null) {
materializeChildren(element, (LayoutElement) child, false);
}
}
for (LayoutTrigger trigger : node.getTriggers()) {
ElementTrigger trg = new ElementTrigger();
trg.addTarget((ElementUI) parent);
createElement(trg, trigger.getChild(LayoutTriggerCondition.class));
createElement(trg, trigger.getChild(LayoutTriggerAction.class));
((ElementUI) parent).addTrigger(trg);
}
} | [
"private",
"void",
"materializeChildren",
"(",
"ElementBase",
"parent",
",",
"LayoutElement",
"node",
",",
"boolean",
"ignoreInternal",
")",
"{",
"for",
"(",
"LayoutNode",
"child",
":",
"node",
".",
"getChildren",
"(",
")",
")",
"{",
"PluginDefinition",
"def",
... | Materializes the layout, under the specified parent.
@param parent Parent UI element at this level of the hierarchy. May be null.
@param node The current layout element.
@param ignoreInternal Ignore internal elements. | [
"Materializes",
"the",
"layout",
"under",
"the",
"specified",
"parent",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java#L100-L117 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java | Layout.setName | public void setName(String value) {
layoutName = value;
if (root != null) {
root.getAttributes().put("name", value);
}
} | java | public void setName(String value) {
layoutName = value;
if (root != null) {
root.getAttributes().put("name", value);
}
} | [
"public",
"void",
"setName",
"(",
"String",
"value",
")",
"{",
"layoutName",
"=",
"value",
";",
"if",
"(",
"root",
"!=",
"null",
")",
"{",
"root",
".",
"getAttributes",
"(",
")",
".",
"put",
"(",
"\"name\"",
",",
"value",
")",
";",
"}",
"}"
] | Sets the name of the current layout.
@param value New name for the layout. | [
"Sets",
"the",
"name",
"of",
"the",
"current",
"layout",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java#L137-L143 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java | Layout.saveToProperty | public boolean saveToProperty(LayoutIdentifier layoutId) {
setName(layoutId.name);
try {
LayoutUtil.saveLayout(layoutId, toString());
} catch (Exception e) {
log.error("Error saving application layout.", e);
return false;
}
return true;
} | java | public boolean saveToProperty(LayoutIdentifier layoutId) {
setName(layoutId.name);
try {
LayoutUtil.saveLayout(layoutId, toString());
} catch (Exception e) {
log.error("Error saving application layout.", e);
return false;
}
return true;
} | [
"public",
"boolean",
"saveToProperty",
"(",
"LayoutIdentifier",
"layoutId",
")",
"{",
"setName",
"(",
"layoutId",
".",
"name",
")",
";",
"try",
"{",
"LayoutUtil",
".",
"saveLayout",
"(",
"layoutId",
",",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
... | Saves the layout as a property value using the specified identifier.
@param layoutId Layout identifier
@return True if operation succeeded. | [
"Saves",
"the",
"layout",
"as",
"a",
"property",
"value",
"using",
"the",
"specified",
"identifier",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java#L169-L180 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java | Layout.getRootClass | public Class<? extends ElementBase> getRootClass() {
LayoutElement top = root == null ? null : root.getChild(LayoutElement.class);
return top == null ? null : top.getDefinition().getClazz();
} | java | public Class<? extends ElementBase> getRootClass() {
LayoutElement top = root == null ? null : root.getChild(LayoutElement.class);
return top == null ? null : top.getDefinition().getClazz();
} | [
"public",
"Class",
"<",
"?",
"extends",
"ElementBase",
">",
"getRootClass",
"(",
")",
"{",
"LayoutElement",
"top",
"=",
"root",
"==",
"null",
"?",
"null",
":",
"root",
".",
"getChild",
"(",
"LayoutElement",
".",
"class",
")",
";",
"return",
"top",
"==",
... | Returns the class of the element at the root of the layout.
@return Class of the element at the root of the layout, or null if none. | [
"Returns",
"the",
"class",
"of",
"the",
"element",
"at",
"the",
"root",
"of",
"the",
"layout",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java#L187-L190 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java | Layout.fromClipboard | @Override
public Layout fromClipboard(String data) {
init(LayoutParser.parseText(data).root);
return this;
} | java | @Override
public Layout fromClipboard(String data) {
init(LayoutParser.parseText(data).root);
return this;
} | [
"@",
"Override",
"public",
"Layout",
"fromClipboard",
"(",
"String",
"data",
")",
"{",
"init",
"(",
"LayoutParser",
".",
"parseText",
"(",
"data",
")",
".",
"root",
")",
";",
"return",
"this",
";",
"}"
] | Converts from clipboard format. | [
"Converts",
"from",
"clipboard",
"format",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/layout/Layout.java#L257-L261 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/ProducerService.java | ProducerService.publish | public boolean publish(String channel, Message message, Recipient... recipients) {
boolean result = false;
prepare(channel, message, recipients);
for (IMessageProducer producer : producers) {
result |= producer.publish(channel, message);
}
return result;
} | java | public boolean publish(String channel, Message message, Recipient... recipients) {
boolean result = false;
prepare(channel, message, recipients);
for (IMessageProducer producer : producers) {
result |= producer.publish(channel, message);
}
return result;
} | [
"public",
"boolean",
"publish",
"(",
"String",
"channel",
",",
"Message",
"message",
",",
"Recipient",
"...",
"recipients",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"prepare",
"(",
"channel",
",",
"message",
",",
"recipients",
")",
";",
"for",
"("... | Publish a message.
@param channel The channel on which to publish the message.
@param message Message to publish.
@param recipients Optional list of targeted recipients.
@return True if successfully published. | [
"Publish",
"a",
"message",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/ProducerService.java#L88-L97 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/ProducerService.java | ProducerService.publish | private boolean publish(String channel, Message message, IMessageProducer producer, Recipient[] recipients) {
if (producer != null) {
prepare(channel, message, recipients);
return producer.publish(channel, message);
}
return false;
} | java | private boolean publish(String channel, Message message, IMessageProducer producer, Recipient[] recipients) {
if (producer != null) {
prepare(channel, message, recipients);
return producer.publish(channel, message);
}
return false;
} | [
"private",
"boolean",
"publish",
"(",
"String",
"channel",
",",
"Message",
"message",
",",
"IMessageProducer",
"producer",
",",
"Recipient",
"[",
"]",
"recipients",
")",
"{",
"if",
"(",
"producer",
"!=",
"null",
")",
"{",
"prepare",
"(",
"channel",
",",
"m... | Publish a message to the specified producer. Use this only when publishing to a single
producer.
@param channel The channel on which to publish the message.
@param message Message to publish.
@param producer The message producer.
@param recipients Optional list of targeted recipients.
@return True if successfully published. | [
"Publish",
"a",
"message",
"to",
"the",
"specified",
"producer",
".",
"Use",
"this",
"only",
"when",
"publishing",
"to",
"a",
"single",
"producer",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/ProducerService.java#L142-L149 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/ProducerService.java | ProducerService.findRegisteredProducer | private IMessageProducer findRegisteredProducer(Class<?> clazz) {
for (IMessageProducer producer : producers) {
if (clazz.isInstance(producer)) {
return producer;
}
}
return null;
} | java | private IMessageProducer findRegisteredProducer(Class<?> clazz) {
for (IMessageProducer producer : producers) {
if (clazz.isInstance(producer)) {
return producer;
}
}
return null;
} | [
"private",
"IMessageProducer",
"findRegisteredProducer",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"for",
"(",
"IMessageProducer",
"producer",
":",
"producers",
")",
"{",
"if",
"(",
"clazz",
".",
"isInstance",
"(",
"producer",
")",
")",
"{",
"return",
... | Returns a producer of the specified class.
@param clazz Class of the producer sought.
@return The producer, or null if not found. | [
"Returns",
"a",
"producer",
"of",
"the",
"specified",
"class",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/ProducerService.java#L157-L165 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/ProducerService.java | ProducerService.prepare | private Message prepare(String channel, Message message, Recipient[] recipients) {
message.setMetadata("cwf.pub.node", nodeId);
message.setMetadata("cwf.pub.channel", channel);
message.setMetadata("cwf.pub.event", UUID.randomUUID().toString());
message.setMetadata("cwf.pub.when", System.currentTimeMillis());
message.setMetadata("cwf.pub.recipients", recipients);
return message;
} | java | private Message prepare(String channel, Message message, Recipient[] recipients) {
message.setMetadata("cwf.pub.node", nodeId);
message.setMetadata("cwf.pub.channel", channel);
message.setMetadata("cwf.pub.event", UUID.randomUUID().toString());
message.setMetadata("cwf.pub.when", System.currentTimeMillis());
message.setMetadata("cwf.pub.recipients", recipients);
return message;
} | [
"private",
"Message",
"prepare",
"(",
"String",
"channel",
",",
"Message",
"message",
",",
"Recipient",
"[",
"]",
"recipients",
")",
"{",
"message",
".",
"setMetadata",
"(",
"\"cwf.pub.node\"",
",",
"nodeId",
")",
";",
"message",
".",
"setMetadata",
"(",
"\"... | Adds publication-specific metadata to the message.
@param channel The message channel.
@param message The message.
@param recipients The message recipients.
@return The original message. | [
"Adds",
"publication",
"-",
"specific",
"metadata",
"to",
"the",
"message",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/ProducerService.java#L175-L182 | train |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java | DefaultSegmentedClient.replaceFinalComponent | protected Interest replaceFinalComponent(Interest interest, long segmentNumber, byte marker) {
Interest copied = new Interest(interest);
Component lastComponent = Component.fromNumberWithMarker(segmentNumber, marker);
Name newName = (SegmentationHelper.isSegmented(copied.getName(), marker))
? copied.getName().getPrefix(-1)
: new Name(copied.getName());
copied.setName(newName.append(lastComponent));
return copied;
} | java | protected Interest replaceFinalComponent(Interest interest, long segmentNumber, byte marker) {
Interest copied = new Interest(interest);
Component lastComponent = Component.fromNumberWithMarker(segmentNumber, marker);
Name newName = (SegmentationHelper.isSegmented(copied.getName(), marker))
? copied.getName().getPrefix(-1)
: new Name(copied.getName());
copied.setName(newName.append(lastComponent));
return copied;
} | [
"protected",
"Interest",
"replaceFinalComponent",
"(",
"Interest",
"interest",
",",
"long",
"segmentNumber",
",",
"byte",
"marker",
")",
"{",
"Interest",
"copied",
"=",
"new",
"Interest",
"(",
"interest",
")",
";",
"Component",
"lastComponent",
"=",
"Component",
... | Replace the final component of an interest name with a segmented component;
if the interest name does not have a segmented component, this will add
one.
@param interest the request
@param segmentNumber a segment number
@param marker a marker to use for segmenting the packet
@return a segmented interest (a copy of the passed interest) | [
"Replace",
"the",
"final",
"component",
"of",
"an",
"interest",
"name",
"with",
"a",
"segmented",
"component",
";",
"if",
"the",
"interest",
"name",
"does",
"not",
"have",
"a",
"segmented",
"component",
"this",
"will",
"add",
"one",
"."
] | 7f670b259484c35d51a6c5acce5715b0573faedd | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/client/impl/DefaultSegmentedClient.java#L81-L89 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/DateTimeUtil.java | DateTimeUtil.setTime | public static void setTime(Datebox datebox, Timebox timebox, Date value) {
value = value == null ? new Date() : value;
datebox.setValue(DateUtil.stripTime(value));
timebox.setValue(value);
} | java | public static void setTime(Datebox datebox, Timebox timebox, Date value) {
value = value == null ? new Date() : value;
datebox.setValue(DateUtil.stripTime(value));
timebox.setValue(value);
} | [
"public",
"static",
"void",
"setTime",
"(",
"Datebox",
"datebox",
",",
"Timebox",
"timebox",
",",
"Date",
"value",
")",
"{",
"value",
"=",
"value",
"==",
"null",
"?",
"new",
"Date",
"(",
")",
":",
"value",
";",
"datebox",
".",
"setValue",
"(",
"DateUti... | Sets the UI to reflect the specified time.
@param datebox The date box.
@param timebox The time box.
@param value Time value to set. | [
"Sets",
"the",
"UI",
"to",
"reflect",
"the",
"specified",
"time",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/DateTimeUtil.java#L68-L72 | train |
intel/jndn-utils | src/main/java/com/intel/jndn/utils/repository/impl/ForLoopRepository.java | ForLoopRepository.isFresh | private boolean isFresh(Record record) {
double period = record.data.getMetaInfo().getFreshnessPeriod();
return period < 0 || record.addedAt + (long) period > System.currentTimeMillis();
} | java | private boolean isFresh(Record record) {
double period = record.data.getMetaInfo().getFreshnessPeriod();
return period < 0 || record.addedAt + (long) period > System.currentTimeMillis();
} | [
"private",
"boolean",
"isFresh",
"(",
"Record",
"record",
")",
"{",
"double",
"period",
"=",
"record",
".",
"data",
".",
"getMetaInfo",
"(",
")",
".",
"getFreshnessPeriod",
"(",
")",
";",
"return",
"period",
"<",
"0",
"||",
"record",
".",
"addedAt",
"+",... | Check if a record is fresh.
@param record the record to check
@return true if the record is fresh | [
"Check",
"if",
"a",
"record",
"is",
"fresh",
"."
] | 7f670b259484c35d51a6c5acce5715b0573faedd | https://github.com/intel/jndn-utils/blob/7f670b259484c35d51a6c5acce5715b0573faedd/src/main/java/com/intel/jndn/utils/repository/impl/ForLoopRepository.java#L120-L123 | train |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpHistory.java | HelpHistory.sameTopic | private boolean sameTopic(HelpTopic topic1, HelpTopic topic2) {
return topic1 == topic2 || (topic1 != null && topic2 != null && topic1.equals(topic2));
} | java | private boolean sameTopic(HelpTopic topic1, HelpTopic topic2) {
return topic1 == topic2 || (topic1 != null && topic2 != null && topic1.equals(topic2));
} | [
"private",
"boolean",
"sameTopic",
"(",
"HelpTopic",
"topic1",
",",
"HelpTopic",
"topic2",
")",
"{",
"return",
"topic1",
"==",
"topic2",
"||",
"(",
"topic1",
"!=",
"null",
"&&",
"topic2",
"!=",
"null",
"&&",
"topic1",
".",
"equals",
"(",
"topic2",
")",
"... | Because the HelpTopic class does not implement its own equals method, have to implement
equality test here. Two topics are considered equal if the are the same instance or if their
targets are equal.
@param topic1 First topic to compare.
@param topic2 Second topic to compare.
@return True if topics are equal. | [
"Because",
"the",
"HelpTopic",
"class",
"does",
"not",
"implement",
"its",
"own",
"equals",
"method",
"have",
"to",
"implement",
"equality",
"test",
"here",
".",
"Two",
"topics",
"are",
"considered",
"equal",
"if",
"the",
"are",
"the",
"same",
"instance",
"o... | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpHistory.java#L116-L118 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.lookupItemName | private String lookupItemName(String itemName, boolean autoAdd) {
String indexedName = index.get(itemName.toLowerCase());
if (indexedName == null && autoAdd) {
index.put(itemName.toLowerCase(), itemName);
}
return indexedName == null ? itemName : indexedName;
} | java | private String lookupItemName(String itemName, boolean autoAdd) {
String indexedName = index.get(itemName.toLowerCase());
if (indexedName == null && autoAdd) {
index.put(itemName.toLowerCase(), itemName);
}
return indexedName == null ? itemName : indexedName;
} | [
"private",
"String",
"lookupItemName",
"(",
"String",
"itemName",
",",
"boolean",
"autoAdd",
")",
"{",
"String",
"indexedName",
"=",
"index",
".",
"get",
"(",
"itemName",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"indexedName",
"==",
"null",
"&&",... | Performs a case-insensitive lookup of the item name in the index.
@param itemName Item name
@param autoAdd If true and item name not in index, add it.
@return Item name as stored internally. If not already stored, returns the item name as it
was specified in itemName. | [
"Performs",
"a",
"case",
"-",
"insensitive",
"lookup",
"of",
"the",
"item",
"name",
"in",
"the",
"index",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L67-L75 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.lookupItemName | private String lookupItemName(String itemName, String suffix, boolean autoAdd) {
return lookupItemName(itemName + "." + suffix, autoAdd);
} | java | private String lookupItemName(String itemName, String suffix, boolean autoAdd) {
return lookupItemName(itemName + "." + suffix, autoAdd);
} | [
"private",
"String",
"lookupItemName",
"(",
"String",
"itemName",
",",
"String",
"suffix",
",",
"boolean",
"autoAdd",
")",
"{",
"return",
"lookupItemName",
"(",
"itemName",
"+",
"\".\"",
"+",
"suffix",
",",
"autoAdd",
")",
";",
"}"
] | Performs a case-insensitive lookup of the item name + suffix in the index.
@param itemName Item name
@param suffix Item suffix
@param autoAdd If true and item name not in index, add it.
@return Item name with suffix as stored internally | [
"Performs",
"a",
"case",
"-",
"insensitive",
"lookup",
"of",
"the",
"item",
"name",
"+",
"suffix",
"in",
"the",
"index",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L85-L87 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.removeSubject | public void removeSubject(String subject) {
String prefix = normalizePrefix(subject);
for (String suffix : getSuffixes(prefix).keySet()) {
setItem(prefix + suffix, null);
}
} | java | public void removeSubject(String subject) {
String prefix = normalizePrefix(subject);
for (String suffix : getSuffixes(prefix).keySet()) {
setItem(prefix + suffix, null);
}
} | [
"public",
"void",
"removeSubject",
"(",
"String",
"subject",
")",
"{",
"String",
"prefix",
"=",
"normalizePrefix",
"(",
"subject",
")",
";",
"for",
"(",
"String",
"suffix",
":",
"getSuffixes",
"(",
"prefix",
")",
".",
"keySet",
"(",
")",
")",
"{",
"setIt... | Remove all context items for the specified subject.
@param subject Prefix whose items are to be removed. | [
"Remove",
"all",
"context",
"items",
"for",
"the",
"specified",
"subject",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L102-L108 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.getSuffixes | private Map<String, String> getSuffixes(String prefix, Boolean firstOnly) {
HashMap<String, String> matches = new HashMap<>();
prefix = normalizePrefix(prefix);
int i = prefix.length();
for (String itemName : index.keySet()) {
if (itemName.startsWith(prefix)) {
String suffix = lookupItemName(itemName, false).substring(i);
matches.put(suffix, getItem(itemName));
if (firstOnly) {
break;
}
}
}
return matches;
} | java | private Map<String, String> getSuffixes(String prefix, Boolean firstOnly) {
HashMap<String, String> matches = new HashMap<>();
prefix = normalizePrefix(prefix);
int i = prefix.length();
for (String itemName : index.keySet()) {
if (itemName.startsWith(prefix)) {
String suffix = lookupItemName(itemName, false).substring(i);
matches.put(suffix, getItem(itemName));
if (firstOnly) {
break;
}
}
}
return matches;
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"getSuffixes",
"(",
"String",
"prefix",
",",
"Boolean",
"firstOnly",
")",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"matches",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"prefix",
"=",
"nor... | Returns a map consisting of suffixes of context items that match the specified prefix.
@param prefix Item name less any suffix.
@param firstOnly If true, only the first match is returned. Otherwise, all matches are
returned.
@return Map of suffixes whose prefix matches the specified value. The value of each map entry
is the value of the original context item. | [
"Returns",
"a",
"map",
"consisting",
"of",
"suffixes",
"of",
"context",
"items",
"that",
"match",
"the",
"specified",
"prefix",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L139-L156 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.getItem | public String getItem(String itemName, String suffix) {
return items.get(lookupItemName(itemName, suffix, false));
} | java | public String getItem(String itemName, String suffix) {
return items.get(lookupItemName(itemName, suffix, false));
} | [
"public",
"String",
"getItem",
"(",
"String",
"itemName",
",",
"String",
"suffix",
")",
"{",
"return",
"items",
".",
"get",
"(",
"lookupItemName",
"(",
"itemName",
",",
"suffix",
",",
"false",
")",
")",
";",
"}"
] | Retrieves a context item qualified by a suffix.
@param itemName Item name
@param suffix Item suffix
@return Item value | [
"Retrieves",
"a",
"context",
"item",
"qualified",
"by",
"a",
"suffix",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L195-L197 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.getItem | @SuppressWarnings("unchecked")
public <T> T getItem(String itemName, Class<T> clazz) throws ContextException {
String item = getItem(itemName);
if (item == null || item.isEmpty()) {
return null;
}
ISerializer<?> contextSerializer = ContextSerializerRegistry.getInstance().get(clazz);
if (contextSerializer == null) {
throw new ContextException("No serializer found for type " + clazz.getName());
}
return (T) contextSerializer.deserialize(item);
} | java | @SuppressWarnings("unchecked")
public <T> T getItem(String itemName, Class<T> clazz) throws ContextException {
String item = getItem(itemName);
if (item == null || item.isEmpty()) {
return null;
}
ISerializer<?> contextSerializer = ContextSerializerRegistry.getInstance().get(clazz);
if (contextSerializer == null) {
throw new ContextException("No serializer found for type " + clazz.getName());
}
return (T) contextSerializer.deserialize(item);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getItem",
"(",
"String",
"itemName",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"ContextException",
"{",
"String",
"item",
"=",
"getItem",
"(",
"itemName",
")",
... | Returns an object of the specified class. The class must have an associated context
serializer registered.
@param <T> The item's class.
@param itemName Item name
@param clazz Class of item to be returned.
@return Deserialized item of specified class.
@throws ContextException If no context serializer found. | [
"Returns",
"an",
"object",
"of",
"the",
"specified",
"class",
".",
"The",
"class",
"must",
"have",
"an",
"associated",
"context",
"serializer",
"registered",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L209-L224 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.setItem | public void setItem(String itemName, String value, String suffix) {
itemName = lookupItemName(itemName, suffix, value != null);
items.put(itemName, value);
} | java | public void setItem(String itemName, String value, String suffix) {
itemName = lookupItemName(itemName, suffix, value != null);
items.put(itemName, value);
} | [
"public",
"void",
"setItem",
"(",
"String",
"itemName",
",",
"String",
"value",
",",
"String",
"suffix",
")",
"{",
"itemName",
"=",
"lookupItemName",
"(",
"itemName",
",",
"suffix",
",",
"value",
"!=",
"null",
")",
";",
"items",
".",
"put",
"(",
"itemNam... | Sets a context item value, qualified with the specified suffix.
@param itemName Item name
@param value Item value
@param suffix Item suffix | [
"Sets",
"a",
"context",
"item",
"value",
"qualified",
"with",
"the",
"specified",
"suffix",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L273-L276 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.setDate | public void setDate(String itemName, Date date) {
if (date == null) {
setItem(itemName, null);
} else {
setItem(itemName, DateUtil.toHL7(date));
}
} | java | public void setDate(String itemName, Date date) {
if (date == null) {
setItem(itemName, null);
} else {
setItem(itemName, DateUtil.toHL7(date));
}
} | [
"public",
"void",
"setDate",
"(",
"String",
"itemName",
",",
"Date",
"date",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"setItem",
"(",
"itemName",
",",
"null",
")",
";",
"}",
"else",
"{",
"setItem",
"(",
"itemName",
",",
"DateUtil",
".",
... | Saves a date item object as a context item.
@param itemName Item name
@param date Date value | [
"Saves",
"a",
"date",
"item",
"object",
"as",
"a",
"context",
"item",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L284-L290 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.getDate | public Date getDate(String itemName) {
try {
return DateUtil.parseDate(getItem(itemName));
} catch (Exception e) {
return null;
}
} | java | public Date getDate(String itemName) {
try {
return DateUtil.parseDate(getItem(itemName));
} catch (Exception e) {
return null;
}
} | [
"public",
"Date",
"getDate",
"(",
"String",
"itemName",
")",
"{",
"try",
"{",
"return",
"DateUtil",
".",
"parseDate",
"(",
"getItem",
"(",
"itemName",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Returns a date item associated with the specified item name.
@param itemName Item name
@return Date value | [
"Returns",
"a",
"date",
"item",
"associated",
"with",
"the",
"specified",
"item",
"name",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L298-L304 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.addItems | public void addItems(String values) throws Exception {
for (String line : values.split("[\\r\\n]")) {
String[] pcs = line.split("\\=", 2);
if (pcs.length == 2) {
setItem(pcs[0], pcs[1]);
}
}
} | java | public void addItems(String values) throws Exception {
for (String line : values.split("[\\r\\n]")) {
String[] pcs = line.split("\\=", 2);
if (pcs.length == 2) {
setItem(pcs[0], pcs[1]);
}
}
} | [
"public",
"void",
"addItems",
"(",
"String",
"values",
")",
"throws",
"Exception",
"{",
"for",
"(",
"String",
"line",
":",
"values",
".",
"split",
"(",
"\"[\\\\r\\\\n]\"",
")",
")",
"{",
"String",
"[",
"]",
"pcs",
"=",
"line",
".",
"split",
"(",
"\"\\\... | Adds context items from a serialized string.
@param values Serialized context items to add.
@throws Exception Unspecified exception. | [
"Adds",
"context",
"items",
"from",
"a",
"serialized",
"string",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L312-L320 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.addItems | private void addItems(Map<String, String> values) {
for (String itemName : values.keySet()) {
setItem(itemName, values.get(itemName));
}
} | java | private void addItems(Map<String, String> values) {
for (String itemName : values.keySet()) {
setItem(itemName, values.get(itemName));
}
} | [
"private",
"void",
"addItems",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"values",
")",
"{",
"for",
"(",
"String",
"itemName",
":",
"values",
".",
"keySet",
"(",
")",
")",
"{",
"setItem",
"(",
"itemName",
",",
"values",
".",
"get",
"(",
"itemNam... | Adds property values to the context item list.
@param values Values to add. | [
"Adds",
"property",
"values",
"to",
"the",
"context",
"item",
"list",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L336-L340 | train |
xiaosunzhu/resource-utils | src/main/java/net/sunyijun/resource/library/BaseUtil.java | BaseUtil.getLibraryPaths | public static String[] getLibraryPaths() {
String libraryPathString = System.getProperty("java.library.path");
String pathSeparator = System.getProperty("path.separator");
return libraryPathString.split(pathSeparator);
} | java | public static String[] getLibraryPaths() {
String libraryPathString = System.getProperty("java.library.path");
String pathSeparator = System.getProperty("path.separator");
return libraryPathString.split(pathSeparator);
} | [
"public",
"static",
"String",
"[",
"]",
"getLibraryPaths",
"(",
")",
"{",
"String",
"libraryPathString",
"=",
"System",
".",
"getProperty",
"(",
"\"java.library.path\"",
")",
";",
"String",
"pathSeparator",
"=",
"System",
".",
"getProperty",
"(",
"\"path.separator... | Get "java.library.path" in system property.
@return all library paths array. | [
"Get",
"java",
".",
"library",
".",
"path",
"in",
"system",
"property",
"."
] | 4f2bf3f36df10195a978f122ed682ba1eb0462b5 | https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/library/BaseUtil.java#L31-L35 | train |
microfocus-idol/java-idol-indexing-api | src/main/java/com/autonomy/nonaci/indexing/impl/IndexCommandImpl.java | IndexCommandImpl.put | public String put(final String key, final String Value) {
return parameters.put(key, Value);
} | java | public String put(final String key, final String Value) {
return parameters.put(key, Value);
} | [
"public",
"String",
"put",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"Value",
")",
"{",
"return",
"parameters",
".",
"put",
"(",
"key",
",",
"Value",
")",
";",
"}"
] | Convenience method for adding a parameter to the command.
@param key The parameter key
@param Value The parameter value
@return previous value associated with specified key, or <tt>null</tt> if there was no mapping for key. | [
"Convenience",
"method",
"for",
"adding",
"a",
"parameter",
"to",
"the",
"command",
"."
] | 178ea844da501318d8d797a35b2f72ff40786b8c | https://github.com/microfocus-idol/java-idol-indexing-api/blob/178ea844da501318d8d797a35b2f72ff40786b8c/src/main/java/com/autonomy/nonaci/indexing/impl/IndexCommandImpl.java#L53-L55 | train |
mgormley/prim | src/main/java/edu/jhu/prim/arrays/LongArrays.java | LongArrays.insertEntry | public static long[] insertEntry(long[] a, int idx, long val) {
long[] b = new long[a.length + 1];
for (int i = 0; i < b.length; i++) {
if (i < idx) {
b[i] = a[i];
} else if (i == idx) {
b[idx] = val;
} else {
b[i] = a[i - 1];
}
}
return b;
} | java | public static long[] insertEntry(long[] a, int idx, long val) {
long[] b = new long[a.length + 1];
for (int i = 0; i < b.length; i++) {
if (i < idx) {
b[i] = a[i];
} else if (i == idx) {
b[idx] = val;
} else {
b[i] = a[i - 1];
}
}
return b;
} | [
"public",
"static",
"long",
"[",
"]",
"insertEntry",
"(",
"long",
"[",
"]",
"a",
",",
"int",
"idx",
",",
"long",
"val",
")",
"{",
"long",
"[",
"]",
"b",
"=",
"new",
"long",
"[",
"a",
".",
"length",
"+",
"1",
"]",
";",
"for",
"(",
"int",
"i",
... | Gets a copy of the array with an entry inserted.
@param a The input array.
@param idx The position at which to insert.
@param val The value to insert.
@return A new array with the inserted value. | [
"Gets",
"a",
"copy",
"of",
"the",
"array",
"with",
"an",
"entry",
"inserted",
"."
] | 5dce5e1ae94a9ae558a6262fc246e1a24f56686c | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/LongArrays.java#L267-L279 | train |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpTopicNode.java | HelpTopicNode.getIndex | public int getIndex() {
if (parent != null) {
for (int i = 0; i < parent.children.size(); i++) {
if (parent.children.get(i) == this) {
return i;
}
}
}
return -1;
} | java | public int getIndex() {
if (parent != null) {
for (int i = 0; i < parent.children.size(); i++) {
if (parent.children.get(i) == this) {
return i;
}
}
}
return -1;
} | [
"public",
"int",
"getIndex",
"(",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parent",
".",
"children",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"parent",
".",
... | Returns the position of this node among its siblings.
@return Node position, or -1 if the node has no parent. | [
"Returns",
"the",
"position",
"of",
"this",
"node",
"among",
"its",
"siblings",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpTopicNode.java#L87-L97 | train |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpTopicNode.java | HelpTopicNode.getNextSibling | public HelpTopicNode getNextSibling() {
int i = getIndex() + 1;
return i == 0 || i == parent.children.size() ? null : parent.children.get(i);
} | java | public HelpTopicNode getNextSibling() {
int i = getIndex() + 1;
return i == 0 || i == parent.children.size() ? null : parent.children.get(i);
} | [
"public",
"HelpTopicNode",
"getNextSibling",
"(",
")",
"{",
"int",
"i",
"=",
"getIndex",
"(",
")",
"+",
"1",
";",
"return",
"i",
"==",
"0",
"||",
"i",
"==",
"parent",
".",
"children",
".",
"size",
"(",
")",
"?",
"null",
":",
"parent",
".",
"childre... | Returns the first sibling node after this one.
@return Next sibling node (may be null). | [
"Returns",
"the",
"first",
"sibling",
"node",
"after",
"this",
"one",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpTopicNode.java#L122-L125 | train |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpTopicNode.java | HelpTopicNode.getPreviousSibling | public HelpTopicNode getPreviousSibling() {
int i = getIndex() - 1;
return i < 0 ? null : parent.children.get(i);
} | java | public HelpTopicNode getPreviousSibling() {
int i = getIndex() - 1;
return i < 0 ? null : parent.children.get(i);
} | [
"public",
"HelpTopicNode",
"getPreviousSibling",
"(",
")",
"{",
"int",
"i",
"=",
"getIndex",
"(",
")",
"-",
"1",
";",
"return",
"i",
"<",
"0",
"?",
"null",
":",
"parent",
".",
"children",
".",
"get",
"(",
"i",
")",
";",
"}"
] | Returns the first sibling node before this one.
@return Previous sibling node (may be null). | [
"Returns",
"the",
"first",
"sibling",
"node",
"before",
"this",
"one",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpTopicNode.java#L132-L135 | train |
carewebframework/carewebframework-core | org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpTopicNode.java | HelpTopicNode.addChild | public void addChild(HelpTopicNode node, int index) {
node.detach();
node.parent = this;
if (index < 0) {
children.add(node);
} else {
children.add(index, node);
}
} | java | public void addChild(HelpTopicNode node, int index) {
node.detach();
node.parent = this;
if (index < 0) {
children.add(node);
} else {
children.add(index, node);
}
} | [
"public",
"void",
"addChild",
"(",
"HelpTopicNode",
"node",
",",
"int",
"index",
")",
"{",
"node",
".",
"detach",
"(",
")",
";",
"node",
".",
"parent",
"=",
"this",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"children",
".",
"add",
"(",
"node",
... | Inserts a child node at the specified position.
@param node Child node to insert.
@param index Insertion position (-1 to append). | [
"Inserts",
"a",
"child",
"node",
"at",
"the",
"specified",
"position",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpTopicNode.java#L152-L161 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DialogControl.java | DialogControl.create | public static DialogControl<String> create(String message, String title, String styles, String responses,
String excludeResponses, String defaultResponse, String saveResponseId,
IPromptCallback<String> callback) {
return new DialogControl<>(message, title, styles, toList(responses), toList(excludeResponses), defaultResponse,
saveResponseId, callback);
} | java | public static DialogControl<String> create(String message, String title, String styles, String responses,
String excludeResponses, String defaultResponse, String saveResponseId,
IPromptCallback<String> callback) {
return new DialogControl<>(message, title, styles, toList(responses), toList(excludeResponses), defaultResponse,
saveResponseId, callback);
} | [
"public",
"static",
"DialogControl",
"<",
"String",
">",
"create",
"(",
"String",
"message",
",",
"String",
"title",
",",
"String",
"styles",
",",
"String",
"responses",
",",
"String",
"excludeResponses",
",",
"String",
"defaultResponse",
",",
"String",
"saveRes... | Parameters for the dialog.
@param message Text message
@param title Title of dialog
@param styles Style classes for icon, message text, and panel (pipe-delimited)
@param responses Button captions separated by vertical bars
@param excludeResponses Only applies if saveResponseId is specified. This is a list of
responses that will not be saved and is specified in the same format as the
buttonCaptions parameter.
@param defaultResponse Caption of button to have initial focus
@param saveResponseId Uniquely identifies this response for purposes of saving and retrieving
the last response. If not specified (null or empty), the response is not saved.
Otherwise, if a saved response exists, it is returned without displaying the
dialog. If a saved response does not exist, the user is prompted in the normal
manner with the addition of a check box on the dialog asking if the response is to
be saved. If this box is checked, the user's response is then saved as a user
preference.
@param callback Callback to receive response.
@return DialogParameters instance. | [
"Parameters",
"for",
"the",
"dialog",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DialogControl.java#L62-L67 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DialogControl.java | DialogControl.getLastResponse | public DialogResponse<T> getLastResponse() {
String saved = saveResponseId == null ? null : PropertyUtil.getValue(SAVED_RESPONSE_PROP_NAME, saveResponseId);
int i = NumberUtils.toInt(saved, -1);
DialogResponse<T> response = i < 0 || i >= responses.size() ? null : responses.get(i);
return response == null || response.isExcluded() ? null : response;
} | java | public DialogResponse<T> getLastResponse() {
String saved = saveResponseId == null ? null : PropertyUtil.getValue(SAVED_RESPONSE_PROP_NAME, saveResponseId);
int i = NumberUtils.toInt(saved, -1);
DialogResponse<T> response = i < 0 || i >= responses.size() ? null : responses.get(i);
return response == null || response.isExcluded() ? null : response;
} | [
"public",
"DialogResponse",
"<",
"T",
">",
"getLastResponse",
"(",
")",
"{",
"String",
"saved",
"=",
"saveResponseId",
"==",
"null",
"?",
"null",
":",
"PropertyUtil",
".",
"getValue",
"(",
"SAVED_RESPONSE_PROP_NAME",
",",
"saveResponseId",
")",
";",
"int",
"i"... | Returns the last saved response for this dialog.
@return The response, or null if none found. | [
"Returns",
"the",
"last",
"saved",
"response",
"for",
"this",
"dialog",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DialogControl.java#L196-L201 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DialogControl.java | DialogControl.saveLastResponse | public void saveLastResponse(DialogResponse<T> response) {
if (saveResponseId != null && (response == null || !response.isExcluded())) {
int index = response == null ? -1 : responses.indexOf(response);
PropertyUtil.saveValue(SAVED_RESPONSE_PROP_NAME, saveResponseId, false,
index < 0 ? null : Integer.toString(index));
}
} | java | public void saveLastResponse(DialogResponse<T> response) {
if (saveResponseId != null && (response == null || !response.isExcluded())) {
int index = response == null ? -1 : responses.indexOf(response);
PropertyUtil.saveValue(SAVED_RESPONSE_PROP_NAME, saveResponseId, false,
index < 0 ? null : Integer.toString(index));
}
} | [
"public",
"void",
"saveLastResponse",
"(",
"DialogResponse",
"<",
"T",
">",
"response",
")",
"{",
"if",
"(",
"saveResponseId",
"!=",
"null",
"&&",
"(",
"response",
"==",
"null",
"||",
"!",
"response",
".",
"isExcluded",
"(",
")",
")",
")",
"{",
"int",
... | Saves the last response under the named responseId.
@param response The response to save. A null value will delete any saved response. | [
"Saves",
"the",
"last",
"response",
"under",
"the",
"named",
"responseId",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DialogControl.java#L208-L214 | train |
mgormley/prim | src/main/java/edu/jhu/prim/list/LongArrayList.java | LongArrayList.uniq | public void uniq() {
if (size <= 1) { return; }
int cursor = 0;
for (int i=1; i<size; i++) {
if (elements[cursor] != elements[i]) {
cursor++;
elements[cursor] = elements[i];
}
}
size = cursor+1;
} | java | public void uniq() {
if (size <= 1) { return; }
int cursor = 0;
for (int i=1; i<size; i++) {
if (elements[cursor] != elements[i]) {
cursor++;
elements[cursor] = elements[i];
}
}
size = cursor+1;
} | [
"public",
"void",
"uniq",
"(",
")",
"{",
"if",
"(",
"size",
"<=",
"1",
")",
"{",
"return",
";",
"}",
"int",
"cursor",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"if",
"(",
"elements",
... | Removes all identical neighboring elements, resizing the array list accordingly. | [
"Removes",
"all",
"identical",
"neighboring",
"elements",
"resizing",
"the",
"array",
"list",
"accordingly",
"."
] | 5dce5e1ae94a9ae558a6262fc246e1a24f56686c | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/list/LongArrayList.java#L220-L230 | train |
strator-dev/greenpepper | greenpepper/core/src/main/java/com/greenpepper/TypeConversion.java | TypeConversion.selfConvert | private static Object selfConvert( String parsingMethod, String value, Class<?> type )
{
try
{
Method method = type.getMethod( parsingMethod, String.class );
return method.invoke( null, value );
}
catch (InvocationTargetException e)
{
throw new IllegalArgumentException( "Can't convert " + value + " to " + type.getName(), e.getCause() );
}
catch (Exception e)
{
throw new IllegalArgumentException( "Can't convert " + value + " to " + type.getName(), e );
}
} | java | private static Object selfConvert( String parsingMethod, String value, Class<?> type )
{
try
{
Method method = type.getMethod( parsingMethod, String.class );
return method.invoke( null, value );
}
catch (InvocationTargetException e)
{
throw new IllegalArgumentException( "Can't convert " + value + " to " + type.getName(), e.getCause() );
}
catch (Exception e)
{
throw new IllegalArgumentException( "Can't convert " + value + " to " + type.getName(), e );
}
} | [
"private",
"static",
"Object",
"selfConvert",
"(",
"String",
"parsingMethod",
",",
"String",
"value",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"try",
"{",
"Method",
"method",
"=",
"type",
".",
"getMethod",
"(",
"parsingMethod",
",",
"String",
".",
... | SelfConversion implies that if a class has the given static method named
that receive a String and that returns a instance of the
class, then it can serve for conversion purpose. | [
"SelfConversion",
"implies",
"that",
"if",
"a",
"class",
"has",
"the",
"given",
"static",
"method",
"named",
"that",
"receive",
"a",
"String",
"and",
"that",
"returns",
"a",
"instance",
"of",
"the",
"class",
"then",
"it",
"can",
"serve",
"for",
"conversion",... | 2a61e6c179b74085babcc559d677490b0cad2d30 | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/TypeConversion.java#L152-L167 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/datetime/S2SDateTimeServiceImpl.java | S2SDateTimeServiceImpl.convertDateToCalendar | @Override
public Calendar convertDateToCalendar(java.util.Date date) {
Calendar calendar = null;
if (date != null) {
calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.clear(Calendar.ZONE_OFFSET);
calendar.clear(Calendar.DST_OFFSET);
}
return calendar;
} | java | @Override
public Calendar convertDateToCalendar(java.util.Date date) {
Calendar calendar = null;
if (date != null) {
calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.clear(Calendar.ZONE_OFFSET);
calendar.clear(Calendar.DST_OFFSET);
}
return calendar;
} | [
"@",
"Override",
"public",
"Calendar",
"convertDateToCalendar",
"(",
"java",
".",
"util",
".",
"Date",
"date",
")",
"{",
"Calendar",
"calendar",
"=",
"null",
";",
"if",
"(",
"date",
"!=",
"null",
")",
"{",
"calendar",
"=",
"Calendar",
".",
"getInstance",
... | This method is used to get Calendar date for the corresponding date object.
@param date(Date) date for which Calendar value has to be found.
@return calendar value corresponding to the date. | [
"This",
"method",
"is",
"used",
"to",
"get",
"Calendar",
"date",
"for",
"the",
"corresponding",
"date",
"object",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/datetime/S2SDateTimeServiceImpl.java#L134-L144 | train |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/HelpConverterMojo.java | HelpConverterMojo.execute | @Override
public void execute() throws MojoExecutionException {
if (StringUtils.isEmpty(moduleSource) && ignoreMissingSource) {
getLog().info("No help module source specified.");
return;
}
init("help", moduleBase);
registerLoader(new SourceLoader("javahelp", "*.hs", ZipIterator.class));
registerLoader(new SourceLoader("ohj", "*.hs", ZipIterator.class));
registerLoader(new ChmSourceLoader());
registerExternalLoaders();
SourceLoader loader = sourceLoaders.get(moduleFormat);
if (loader == null) {
throw new MojoExecutionException("No source loader found for format " + moduleFormat);
}
try {
String sourceFilename = FileUtils.normalize(baseDirectory + "/" + moduleSource);
HelpProcessor processor = new HelpProcessor(this, sourceFilename, loader);
processor.transform();
addConfigEntry("help", moduleId, processor.getHelpSetFile(), moduleName, getModuleVersion(), moduleFormat,
moduleLocale);
assembleArchive();
} catch (Exception e) {
throw new MojoExecutionException("Unexpected error.", e);
}
} | java | @Override
public void execute() throws MojoExecutionException {
if (StringUtils.isEmpty(moduleSource) && ignoreMissingSource) {
getLog().info("No help module source specified.");
return;
}
init("help", moduleBase);
registerLoader(new SourceLoader("javahelp", "*.hs", ZipIterator.class));
registerLoader(new SourceLoader("ohj", "*.hs", ZipIterator.class));
registerLoader(new ChmSourceLoader());
registerExternalLoaders();
SourceLoader loader = sourceLoaders.get(moduleFormat);
if (loader == null) {
throw new MojoExecutionException("No source loader found for format " + moduleFormat);
}
try {
String sourceFilename = FileUtils.normalize(baseDirectory + "/" + moduleSource);
HelpProcessor processor = new HelpProcessor(this, sourceFilename, loader);
processor.transform();
addConfigEntry("help", moduleId, processor.getHelpSetFile(), moduleName, getModuleVersion(), moduleFormat,
moduleLocale);
assembleArchive();
} catch (Exception e) {
throw new MojoExecutionException("Unexpected error.", e);
}
} | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"moduleSource",
")",
"&&",
"ignoreMissingSource",
")",
"{",
"getLog",
"(",
")",
".",
"info",
"(",
"\"No help module ... | Main execution entry point for plug-in. | [
"Main",
"execution",
"entry",
"point",
"for",
"plug",
"-",
"in",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/HelpConverterMojo.java#L129-L158 | train |
carewebframework/carewebframework-core | org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/HelpConverterMojo.java | HelpConverterMojo.registerExternalLoaders | private void registerExternalLoaders() throws MojoExecutionException {
if (archiveLoaders != null) {
for (String entry : archiveLoaders) {
try {
SourceLoader loader = (SourceLoader) Class.forName(entry).newInstance();
registerLoader(loader);
} catch (Exception e) {
throw new MojoExecutionException("Error registering archive loader for class: " + entry, e);
}
}
}
} | java | private void registerExternalLoaders() throws MojoExecutionException {
if (archiveLoaders != null) {
for (String entry : archiveLoaders) {
try {
SourceLoader loader = (SourceLoader) Class.forName(entry).newInstance();
registerLoader(loader);
} catch (Exception e) {
throw new MojoExecutionException("Error registering archive loader for class: " + entry, e);
}
}
}
} | [
"private",
"void",
"registerExternalLoaders",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"archiveLoaders",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"entry",
":",
"archiveLoaders",
")",
"{",
"try",
"{",
"SourceLoader",
"loader",
"=",
"("... | Adds any additional source loaders specified in configuration.
@throws MojoExecutionException Error registering external loader. | [
"Adds",
"any",
"additional",
"source",
"loaders",
"specified",
"in",
"configuration",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.helpconverter/src/main/java/org/carewebframework/maven/plugin/help/HelpConverterMojo.java#L165-L176 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/DigitalSignature.java | DigitalSignature.verify | public boolean verify(String base64Signature, String content, String timestamp) throws Exception {
return verify(base64Signature, content, timestamp, keyName);
} | java | public boolean verify(String base64Signature, String content, String timestamp) throws Exception {
return verify(base64Signature, content, timestamp, keyName);
} | [
"public",
"boolean",
"verify",
"(",
"String",
"base64Signature",
",",
"String",
"content",
",",
"String",
"timestamp",
")",
"throws",
"Exception",
"{",
"return",
"verify",
"(",
"base64Signature",
",",
"content",
",",
"timestamp",
",",
"keyName",
")",
";",
"}"
... | Verifies the validity of the digital signature using stored key name.
@param base64Signature The digital signature.
@param content The authorization string to which the signature was applied.
@param timestamp The timestamp of the digital signature.
@return True if the signature is valid.
@throws Exception Unspecified exception. | [
"Verifies",
"the",
"validity",
"of",
"the",
"digital",
"signature",
"using",
"stored",
"key",
"name",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/DigitalSignature.java#L87-L89 | train |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionController.java | SessionController.create | protected static SessionController create(String sessionId, boolean originator) {
Map<String, Object> args = new HashMap<>();
args.put("id", sessionId);
args.put("title", StrUtil.formatMessage("@cwf.chat.session.title"));
args.put("originator", originator ? true : null);
Window dlg = PopupDialog.show(DIALOG, args, true, true, false, null);
return (SessionController) FrameworkController.getController(dlg);
} | java | protected static SessionController create(String sessionId, boolean originator) {
Map<String, Object> args = new HashMap<>();
args.put("id", sessionId);
args.put("title", StrUtil.formatMessage("@cwf.chat.session.title"));
args.put("originator", originator ? true : null);
Window dlg = PopupDialog.show(DIALOG, args, true, true, false, null);
return (SessionController) FrameworkController.getController(dlg);
} | [
"protected",
"static",
"SessionController",
"create",
"(",
"String",
"sessionId",
",",
"boolean",
"originator",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"args",
".",
"put",
"(",
"\"id\"",
","... | Creates a chat session bound to the specified session id.
@param sessionId The chat session id.
@param originator If true, this user is originating the chat session.
@return The controller for the chat session. | [
"Creates",
"a",
"chat",
"session",
"bound",
"to",
"the",
"specified",
"session",
"id",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionController.java#L90-L97 | train |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionController.java | SessionController.afterInitialized | @Override
public void afterInitialized(BaseComponent comp) {
super.afterInitialized(comp);
window = (Window) comp;
sessionId = (String) comp.getAttribute("id");
lstParticipants.setRenderer(new ParticipantRenderer(chatService.getSelf(), null));
model.add(chatService.getSelf());
lstParticipants.setModel(model);
clearMessage();
if (comp.getAttribute("originator") != null) {
invite((result) -> {
if (!result) {
close();
} else {
initSession();
}
});
} | java | @Override
public void afterInitialized(BaseComponent comp) {
super.afterInitialized(comp);
window = (Window) comp;
sessionId = (String) comp.getAttribute("id");
lstParticipants.setRenderer(new ParticipantRenderer(chatService.getSelf(), null));
model.add(chatService.getSelf());
lstParticipants.setModel(model);
clearMessage();
if (comp.getAttribute("originator") != null) {
invite((result) -> {
if (!result) {
close();
} else {
initSession();
}
});
} | [
"@",
"Override",
"public",
"void",
"afterInitialized",
"(",
"BaseComponent",
"comp",
")",
"{",
"super",
".",
"afterInitialized",
"(",
"comp",
")",
";",
"window",
"=",
"(",
"Window",
")",
"comp",
";",
"sessionId",
"=",
"(",
"String",
")",
"comp",
".",
"ge... | Initialize the dialog. | [
"Initialize",
"the",
"dialog",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.chat/src/main/java/org/carewebframework/plugin/chat/SessionController.java#L102-L120 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DateRangeChooser.java | DateRangeChooser.findMatchingItem | public Listitem findMatchingItem(String label) {
for (Listitem item : getChildren(Listitem.class)) {
if (label.equalsIgnoreCase(item.getLabel())) {
return item;
}
}
return null;
} | java | public Listitem findMatchingItem(String label) {
for (Listitem item : getChildren(Listitem.class)) {
if (label.equalsIgnoreCase(item.getLabel())) {
return item;
}
}
return null;
} | [
"public",
"Listitem",
"findMatchingItem",
"(",
"String",
"label",
")",
"{",
"for",
"(",
"Listitem",
"item",
":",
"getChildren",
"(",
"Listitem",
".",
"class",
")",
")",
"{",
"if",
"(",
"label",
".",
"equalsIgnoreCase",
"(",
"item",
".",
"getLabel",
"(",
... | Searches for a Listitem that has a label that matches the specified value. The search is case
insensitive.
@param label Label text to find.
@return A Listitem with a matching label., or null if not found. | [
"Searches",
"for",
"a",
"Listitem",
"that",
"has",
"a",
"label",
"that",
"matches",
"the",
"specified",
"value",
".",
"The",
"search",
"is",
"case",
"insensitive",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DateRangeChooser.java#L166-L174 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DateRangeChooser.java | DateRangeChooser.getStartDate | public Date getStartDate() {
DateRange range = getSelectedRange();
return range == null ? null : range.getStartDate();
} | java | public Date getStartDate() {
DateRange range = getSelectedRange();
return range == null ? null : range.getStartDate();
} | [
"public",
"Date",
"getStartDate",
"(",
")",
"{",
"DateRange",
"range",
"=",
"getSelectedRange",
"(",
")",
";",
"return",
"range",
"==",
"null",
"?",
"null",
":",
"range",
".",
"getStartDate",
"(",
")",
";",
"}"
] | Returns the selected start date. This may be null if there is no active selection or if the
selected date range has no start date.
@return Starting date of range, or null. | [
"Returns",
"the",
"selected",
"start",
"date",
".",
"This",
"may",
"be",
"null",
"if",
"there",
"is",
"no",
"active",
"selection",
"or",
"if",
"the",
"selected",
"date",
"range",
"has",
"no",
"start",
"date",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DateRangeChooser.java#L231-L234 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DateRangeChooser.java | DateRangeChooser.getEndDate | public Date getEndDate() {
DateRange range = getSelectedRange();
return range == null ? null : range.getEndDate();
} | java | public Date getEndDate() {
DateRange range = getSelectedRange();
return range == null ? null : range.getEndDate();
} | [
"public",
"Date",
"getEndDate",
"(",
")",
"{",
"DateRange",
"range",
"=",
"getSelectedRange",
"(",
")",
";",
"return",
"range",
"==",
"null",
"?",
"null",
":",
"range",
".",
"getEndDate",
"(",
")",
";",
"}"
] | Returns the selected end date. This may be null if there is no active selection or if the
selected date range has no end date.
@return Ending date of range, or null. | [
"Returns",
"the",
"selected",
"end",
"date",
".",
"This",
"may",
"be",
"null",
"if",
"there",
"is",
"no",
"active",
"selection",
"or",
"if",
"the",
"selected",
"date",
"range",
"has",
"no",
"end",
"date",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/dialog/DateRangeChooser.java#L242-L245 | train |
strator-dev/greenpepper | greenpepper-maven-plugin/src/main/java/com/greenpepper/maven/plugin/utils/CompilationFailureException.java | CompilationFailureException.shortMessage | public static String shortMessage( List<CompilerError> messages )
{
StringBuffer sb = new StringBuffer();
sb.append( "Compilation failure" );
if ( messages.size() == 1 )
{
sb.append( LS );
CompilerError compilerError = (CompilerError) messages.get( 0 );
sb.append( compilerError ).append( LS );
}
return sb.toString();
} | java | public static String shortMessage( List<CompilerError> messages )
{
StringBuffer sb = new StringBuffer();
sb.append( "Compilation failure" );
if ( messages.size() == 1 )
{
sb.append( LS );
CompilerError compilerError = (CompilerError) messages.get( 0 );
sb.append( compilerError ).append( LS );
}
return sb.toString();
} | [
"public",
"static",
"String",
"shortMessage",
"(",
"List",
"<",
"CompilerError",
">",
"messages",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"Compilation failure\"",
")",
";",
"if",
"(",
"messages",... | Short message will have the error message if there's only one, useful for errors forking the compiler
@param messages a {@link java.util.List} object.
@return the short error message
@since 2.0.2 | [
"Short",
"message",
"will",
"have",
"the",
"error",
"message",
"if",
"there",
"s",
"only",
"one",
"useful",
"for",
"errors",
"forking",
"the",
"compiler"
] | 2a61e6c179b74085babcc559d677490b0cad2d30 | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-maven-plugin/src/main/java/com/greenpepper/maven/plugin/utils/CompilationFailureException.java#L79-L95 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/S2SBaseFormGenerator.java | S2SBaseFormGenerator.sortAttachments | public void sortAttachments(ByteArrayInputStream byteArrayInputStream) {
List<String> attachmentNameList = new ArrayList<>();
List<AttachmentData> attacmentList = getAttachments();
List<AttachmentData> tempAttacmentList = new ArrayList<>();
try{
DocumentBuilderFactory domParserFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder domParser = domParserFactory.newDocumentBuilder();
Document document = domParser.parse(byteArrayInputStream);
byteArrayInputStream.close();
NodeList fileLocationList = document.getElementsByTagName(NARRATIVE_ATTACHMENT_FILE_LOCATION);
for(int itemLocation=0;itemLocation<fileLocationList.getLength();itemLocation++){
String attachmentName =fileLocationList.item(itemLocation).getAttributes().item(0).getNodeValue();
String[] name = attachmentName.split(KEY_VALUE_SEPARATOR);
String fileName =name[name.length-1];
attachmentNameList.add(fileName);
}
}catch (Exception e) {
LOG.error(e.getMessage(), e);
}
for(String attachmentName :attachmentNameList){
for(AttachmentData attachment : attacmentList){
String[] names = attachment.getContentId().split(KEY_VALUE_SEPARATOR);
String fileName =names[names.length-1];
if(fileName.equalsIgnoreCase(attachmentName)){
tempAttacmentList.add(attachment);
}
}
}
if(tempAttacmentList.size() > 0){
attachments.clear();
for(AttachmentData tempAttachment :tempAttacmentList){
attachments.add(tempAttachment);
}
}
} | java | public void sortAttachments(ByteArrayInputStream byteArrayInputStream) {
List<String> attachmentNameList = new ArrayList<>();
List<AttachmentData> attacmentList = getAttachments();
List<AttachmentData> tempAttacmentList = new ArrayList<>();
try{
DocumentBuilderFactory domParserFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder domParser = domParserFactory.newDocumentBuilder();
Document document = domParser.parse(byteArrayInputStream);
byteArrayInputStream.close();
NodeList fileLocationList = document.getElementsByTagName(NARRATIVE_ATTACHMENT_FILE_LOCATION);
for(int itemLocation=0;itemLocation<fileLocationList.getLength();itemLocation++){
String attachmentName =fileLocationList.item(itemLocation).getAttributes().item(0).getNodeValue();
String[] name = attachmentName.split(KEY_VALUE_SEPARATOR);
String fileName =name[name.length-1];
attachmentNameList.add(fileName);
}
}catch (Exception e) {
LOG.error(e.getMessage(), e);
}
for(String attachmentName :attachmentNameList){
for(AttachmentData attachment : attacmentList){
String[] names = attachment.getContentId().split(KEY_VALUE_SEPARATOR);
String fileName =names[names.length-1];
if(fileName.equalsIgnoreCase(attachmentName)){
tempAttacmentList.add(attachment);
}
}
}
if(tempAttacmentList.size() > 0){
attachments.clear();
for(AttachmentData tempAttachment :tempAttacmentList){
attachments.add(tempAttachment);
}
}
} | [
"public",
"void",
"sortAttachments",
"(",
"ByteArrayInputStream",
"byteArrayInputStream",
")",
"{",
"List",
"<",
"String",
">",
"attachmentNameList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"AttachmentData",
">",
"attacmentList",
"=",
"getAttach... | Sort the attachments. | [
"Sort",
"the",
"attachments",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/S2SBaseFormGenerator.java#L439-L476 | train |
mgormley/prim | src/main/java/edu/jhu/prim/vector/LongDoubleUnsortedVector.java | LongDoubleUnsortedVector.hasBadValues | public boolean hasBadValues() {
for(int i=0; i<top; i++) {
double v = vals[i];
boolean bad = Double.isNaN(v) || Double.isInfinite(v);
if(bad) return true;
}
return false;
} | java | public boolean hasBadValues() {
for(int i=0; i<top; i++) {
double v = vals[i];
boolean bad = Double.isNaN(v) || Double.isInfinite(v);
if(bad) return true;
}
return false;
} | [
"public",
"boolean",
"hasBadValues",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"top",
";",
"i",
"++",
")",
"{",
"double",
"v",
"=",
"vals",
"[",
"i",
"]",
";",
"boolean",
"bad",
"=",
"Double",
".",
"isNaN",
"(",
"v",
")"... | returns true if any values are NaN or Inf | [
"returns",
"true",
"if",
"any",
"values",
"are",
"NaN",
"or",
"Inf"
] | 5dce5e1ae94a9ae558a6262fc246e1a24f56686c | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/vector/LongDoubleUnsortedVector.java#L255-L262 | train |
microfocus-idol/java-idol-indexing-api | src/main/java/com/autonomy/nonaci/ServerDetails.java | ServerDetails.setCharsetName | public void setCharsetName(final String charsetName) {
if(Charset.isSupported(charsetName)) {
this.charsetName = charsetName;
}
else {
throw new UnsupportedCharsetException("No support for, " + charsetName + ", is available in this instance of the JVM");
}
} | java | public void setCharsetName(final String charsetName) {
if(Charset.isSupported(charsetName)) {
this.charsetName = charsetName;
}
else {
throw new UnsupportedCharsetException("No support for, " + charsetName + ", is available in this instance of the JVM");
}
} | [
"public",
"void",
"setCharsetName",
"(",
"final",
"String",
"charsetName",
")",
"{",
"if",
"(",
"Charset",
".",
"isSupported",
"(",
"charsetName",
")",
")",
"{",
"this",
".",
"charsetName",
"=",
"charsetName",
";",
"}",
"else",
"{",
"throw",
"new",
"Unsupp... | Setter for property charsetName.
@param charsetName The name of the requested charset; may be either a canonical name or an alias
@throws java.lang.IllegalArgumentException If <tt>charsetName</tt> is null
@throws java.nio.charset.IllegalCharsetNameException If the given charset name is illegal
@throws java.nio.charset.UnsupportedCharsetException If no support for the named charset is available in this
instance of the Java virtual machine | [
"Setter",
"for",
"property",
"charsetName",
"."
] | 178ea844da501318d8d797a35b2f72ff40786b8c | https://github.com/microfocus-idol/java-idol-indexing-api/blob/178ea844da501318d8d797a35b2f72ff40786b8c/src/main/java/com/autonomy/nonaci/ServerDetails.java#L216-L223 | train |
DDTH/ddth-queue | ddth-queue-core/src/main/java/com/github/ddth/pubsub/impl/AbstractPubSubHub.java | AbstractPubSubHub.serialize | protected byte[] serialize(IMessage<ID, DATA> msg) {
return msg != null ? SerializationUtils.toByteArray(msg) : null;
} | java | protected byte[] serialize(IMessage<ID, DATA> msg) {
return msg != null ? SerializationUtils.toByteArray(msg) : null;
} | [
"protected",
"byte",
"[",
"]",
"serialize",
"(",
"IMessage",
"<",
"ID",
",",
"DATA",
">",
"msg",
")",
"{",
"return",
"msg",
"!=",
"null",
"?",
"SerializationUtils",
".",
"toByteArray",
"(",
"msg",
")",
":",
"null",
";",
"}"
] | Serialize a queue message to store in Redis.
@param msg
@return | [
"Serialize",
"a",
"queue",
"message",
"to",
"store",
"in",
"Redis",
"."
] | b20776850d23111d3d71fc8ed6023c590bc3621f | https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/pubsub/impl/AbstractPubSubHub.java#L92-L94 | train |
DDTH/ddth-queue | ddth-queue-core/src/main/java/com/github/ddth/pubsub/impl/AbstractPubSubHub.java | AbstractPubSubHub.deserialize | protected <T extends IMessage<ID, DATA>> T deserialize(byte[] msgData, Class<T> clazz) {
return msgData != null ? SerializationUtils.fromByteArray(msgData, clazz) : null;
} | java | protected <T extends IMessage<ID, DATA>> T deserialize(byte[] msgData, Class<T> clazz) {
return msgData != null ? SerializationUtils.fromByteArray(msgData, clazz) : null;
} | [
"protected",
"<",
"T",
"extends",
"IMessage",
"<",
"ID",
",",
"DATA",
">",
">",
"T",
"deserialize",
"(",
"byte",
"[",
"]",
"msgData",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"msgData",
"!=",
"null",
"?",
"SerializationUtils",
".",
"... | Deserialize a message.
@param msgData
@return | [
"Deserialize",
"a",
"message",
"."
] | b20776850d23111d3d71fc8ed6023c590bc3621f | https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/pubsub/impl/AbstractPubSubHub.java#L113-L115 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/query/FilteredQueryService.java | FilteredQueryService.filteredResult | private IQueryResult<T> filteredResult(IQueryResult<T> unfilteredResult) {
List<T> unfilteredList = unfilteredResult.getResults();
List<T> filteredList = unfilteredList == null ? null : filters.filter(unfilteredList);
Map<String, Object> metadata = Collections.<String, Object> singletonMap("unfiltered", unfilteredResult);
return QueryUtil.packageResult(filteredList, unfilteredResult.getStatus(), metadata);
} | java | private IQueryResult<T> filteredResult(IQueryResult<T> unfilteredResult) {
List<T> unfilteredList = unfilteredResult.getResults();
List<T> filteredList = unfilteredList == null ? null : filters.filter(unfilteredList);
Map<String, Object> metadata = Collections.<String, Object> singletonMap("unfiltered", unfilteredResult);
return QueryUtil.packageResult(filteredList, unfilteredResult.getStatus(), metadata);
} | [
"private",
"IQueryResult",
"<",
"T",
">",
"filteredResult",
"(",
"IQueryResult",
"<",
"T",
">",
"unfilteredResult",
")",
"{",
"List",
"<",
"T",
">",
"unfilteredList",
"=",
"unfilteredResult",
".",
"getResults",
"(",
")",
";",
"List",
"<",
"T",
">",
"filter... | Repackages the query result as the filtered result with the unfiltered version stored in the
metadata under the "unfiltered" key.
@param unfilteredResult The unfiltered query result.
@return The filtered query result. | [
"Repackages",
"the",
"query",
"result",
"as",
"the",
"filtered",
"result",
"with",
"the",
"unfiltered",
"version",
"stored",
"in",
"the",
"metadata",
"under",
"the",
"unfiltered",
"key",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/query/FilteredQueryService.java#L86-L91 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/SpringContextUtils.java | SpringContextUtils.contextMergedBeans | public static ApplicationContext contextMergedBeans(String xmlPath, Map<String, ?> extraBeans) {
final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory(extraBeans);
//loads the xml and add definitions in the context
GenericApplicationContext parentContext = new GenericApplicationContext(parentBeanFactory);
XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(parentContext);
xmlReader.loadBeanDefinitions(xmlPath);
//refreshed the context to create class and make autowires
parentContext.refresh();
//return the created context
return parentContext;
} | java | public static ApplicationContext contextMergedBeans(String xmlPath, Map<String, ?> extraBeans) {
final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory(extraBeans);
//loads the xml and add definitions in the context
GenericApplicationContext parentContext = new GenericApplicationContext(parentBeanFactory);
XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(parentContext);
xmlReader.loadBeanDefinitions(xmlPath);
//refreshed the context to create class and make autowires
parentContext.refresh();
//return the created context
return parentContext;
} | [
"public",
"static",
"ApplicationContext",
"contextMergedBeans",
"(",
"String",
"xmlPath",
",",
"Map",
"<",
"String",
",",
"?",
">",
"extraBeans",
")",
"{",
"final",
"DefaultListableBeanFactory",
"parentBeanFactory",
"=",
"buildListableBeanFactory",
"(",
"extraBeans",
... | Loads a context from a XML and inject all objects in the Map
@param xmlPath Path for the xml applicationContext
@param extraBeans Extra beans for being injected
@return ApplicationContext generated | [
"Loads",
"a",
"context",
"from",
"a",
"XML",
"and",
"inject",
"all",
"objects",
"in",
"the",
"Map"
] | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L31-L44 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/SpringContextUtils.java | SpringContextUtils.contextMergedBeans | public static ApplicationContext contextMergedBeans(Map<String, ?> extraBeans, Class<?> config) {
final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory(extraBeans);
//loads the annotation classes and add definitions in the context
GenericApplicationContext parentContext = new GenericApplicationContext(parentBeanFactory);
AnnotatedBeanDefinitionReader annotationReader = new AnnotatedBeanDefinitionReader(parentContext);
annotationReader.registerBean(config);
//refreshed the context to create class and make autowires
parentContext.refresh();
//return the created context
return parentContext;
} | java | public static ApplicationContext contextMergedBeans(Map<String, ?> extraBeans, Class<?> config) {
final DefaultListableBeanFactory parentBeanFactory = buildListableBeanFactory(extraBeans);
//loads the annotation classes and add definitions in the context
GenericApplicationContext parentContext = new GenericApplicationContext(parentBeanFactory);
AnnotatedBeanDefinitionReader annotationReader = new AnnotatedBeanDefinitionReader(parentContext);
annotationReader.registerBean(config);
//refreshed the context to create class and make autowires
parentContext.refresh();
//return the created context
return parentContext;
} | [
"public",
"static",
"ApplicationContext",
"contextMergedBeans",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"extraBeans",
",",
"Class",
"<",
"?",
">",
"config",
")",
"{",
"final",
"DefaultListableBeanFactory",
"parentBeanFactory",
"=",
"buildListableBeanFactory",
"(",... | Loads a context from the annotations config and inject all objects in the Map
@param extraBeans Extra beans for being injected
@param config Configuration class
@return ApplicationContext generated | [
"Loads",
"a",
"context",
"from",
"the",
"annotations",
"config",
"and",
"inject",
"all",
"objects",
"in",
"the",
"Map"
] | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L53-L66 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/SpringContextUtils.java | SpringContextUtils.setProperties | private static void setProperties(GenericApplicationContext newContext, Properties properties) {
PropertiesPropertySource pps = new PropertiesPropertySource("external-props", properties);
newContext.getEnvironment().getPropertySources().addFirst(pps);
} | java | private static void setProperties(GenericApplicationContext newContext, Properties properties) {
PropertiesPropertySource pps = new PropertiesPropertySource("external-props", properties);
newContext.getEnvironment().getPropertySources().addFirst(pps);
} | [
"private",
"static",
"void",
"setProperties",
"(",
"GenericApplicationContext",
"newContext",
",",
"Properties",
"properties",
")",
"{",
"PropertiesPropertySource",
"pps",
"=",
"new",
"PropertiesPropertySource",
"(",
"\"external-props\"",
",",
"properties",
")",
";",
"n... | Set properties into the context.
@param newContext new context to add properties
@param properties properties to add to the context | [
"Set",
"properties",
"into",
"the",
"context",
"."
] | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L100-L103 | train |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/SpringContextUtils.java | SpringContextUtils.buildListableBeanFactory | private static DefaultListableBeanFactory buildListableBeanFactory(Map<String, ?> extraBeans) {
//new empty context
final DefaultListableBeanFactory parentBeanFactory = new DefaultListableBeanFactory();
//Injection of the new beans in the context
for (String key : extraBeans.keySet()) {
parentBeanFactory.registerSingleton(key, extraBeans.get(key));
}
return parentBeanFactory;
} | java | private static DefaultListableBeanFactory buildListableBeanFactory(Map<String, ?> extraBeans) {
//new empty context
final DefaultListableBeanFactory parentBeanFactory = new DefaultListableBeanFactory();
//Injection of the new beans in the context
for (String key : extraBeans.keySet()) {
parentBeanFactory.registerSingleton(key, extraBeans.get(key));
}
return parentBeanFactory;
} | [
"private",
"static",
"DefaultListableBeanFactory",
"buildListableBeanFactory",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"extraBeans",
")",
"{",
"//new empty context",
"final",
"DefaultListableBeanFactory",
"parentBeanFactory",
"=",
"new",
"DefaultListableBeanFactory",
"(",... | Builds a listable bean factory with the given beans.
@param extraBeans
@return new Created BeanFactory | [
"Builds",
"a",
"listable",
"bean",
"factory",
"with",
"the",
"given",
"beans",
"."
] | f5382474d46a6048d58707fc64e7936277e8b2ce | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L112-L121 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetBaseGenerator.java | RRFedNonFedBudgetBaseGenerator.validateBudgetForForm | protected boolean validateBudgetForForm(ProposalDevelopmentDocumentContract pdDoc) throws S2SException {
boolean valid = true;
ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal());
if(budget != null) {
for (BudgetPeriodContract period : budget.getBudgetPeriods()) {
List<String> participantSupportCode = new ArrayList<>();
participantSupportCode.add(s2sBudgetCalculatorService.getParticipantSupportCategoryCode());
List<? extends BudgetLineItemContract> participantSupportLineItems =
s2sBudgetCalculatorService.getMatchingLineItems(period.getBudgetLineItems(), participantSupportCode);
int numberOfParticipants = period.getNumberOfParticipants() == null ? 0 : period.getNumberOfParticipants();
if (!participantSupportLineItems.isEmpty() && numberOfParticipants == 0) {
AuditError auditError= s2SErrorHandlerService.getError(PARTICIPANT_COUNT_REQUIRED, getFormName());
AuditError error= new AuditError(auditError.getErrorKey(),
auditError.getMessageKey()+period.getBudgetPeriod(),auditError.getLink());
getAuditErrors().add(error);
valid = false;
} else if (numberOfParticipants > 0 && participantSupportLineItems.isEmpty()) {
getAuditErrors().add(s2SErrorHandlerService.getError(PARTICIPANT_COSTS_REQUIRED, getFormName()));
valid = false;
}
}
}
return valid;
} | java | protected boolean validateBudgetForForm(ProposalDevelopmentDocumentContract pdDoc) throws S2SException {
boolean valid = true;
ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService.getBudget(pdDoc.getDevelopmentProposal());
if(budget != null) {
for (BudgetPeriodContract period : budget.getBudgetPeriods()) {
List<String> participantSupportCode = new ArrayList<>();
participantSupportCode.add(s2sBudgetCalculatorService.getParticipantSupportCategoryCode());
List<? extends BudgetLineItemContract> participantSupportLineItems =
s2sBudgetCalculatorService.getMatchingLineItems(period.getBudgetLineItems(), participantSupportCode);
int numberOfParticipants = period.getNumberOfParticipants() == null ? 0 : period.getNumberOfParticipants();
if (!participantSupportLineItems.isEmpty() && numberOfParticipants == 0) {
AuditError auditError= s2SErrorHandlerService.getError(PARTICIPANT_COUNT_REQUIRED, getFormName());
AuditError error= new AuditError(auditError.getErrorKey(),
auditError.getMessageKey()+period.getBudgetPeriod(),auditError.getLink());
getAuditErrors().add(error);
valid = false;
} else if (numberOfParticipants > 0 && participantSupportLineItems.isEmpty()) {
getAuditErrors().add(s2SErrorHandlerService.getError(PARTICIPANT_COSTS_REQUIRED, getFormName()));
valid = false;
}
}
}
return valid;
} | [
"protected",
"boolean",
"validateBudgetForForm",
"(",
"ProposalDevelopmentDocumentContract",
"pdDoc",
")",
"throws",
"S2SException",
"{",
"boolean",
"valid",
"=",
"true",
";",
"ProposalDevelopmentBudgetExtContract",
"budget",
"=",
"s2SCommonBudgetService",
".",
"getBudget",
... | Perform manual validations on the budget. Similarly done in RRBudgetBaseGenerator. | [
"Perform",
"manual",
"validations",
"on",
"the",
"budget",
".",
"Similarly",
"done",
"in",
"RRBudgetBaseGenerator",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetBaseGenerator.java#L111-L135 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/StopWatchFactory.java | StopWatchFactory.create | public static IStopWatch create() {
if (factory == null) {
throw new IllegalStateException("No stopwatch factory registered.");
}
try {
return factory.clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException("Could not create stopwatch instance.", e);
}
} | java | public static IStopWatch create() {
if (factory == null) {
throw new IllegalStateException("No stopwatch factory registered.");
}
try {
return factory.clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException("Could not create stopwatch instance.", e);
}
} | [
"public",
"static",
"IStopWatch",
"create",
"(",
")",
"{",
"if",
"(",
"factory",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No stopwatch factory registered.\"",
")",
";",
"}",
"try",
"{",
"return",
"factory",
".",
"clazz",
".",
... | Returns an uninitialized stopwatch instance.
@return An uninitialized stopwatch instance. Will be null if the factory has not been
initialized. | [
"Returns",
"an",
"uninitialized",
"stopwatch",
"instance",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/StopWatchFactory.java#L91-L101 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/StopWatchFactory.java | StopWatchFactory.create | public static IStopWatch create(String tag, Map<String, Object> data) {
IStopWatch sw = create();
sw.init(tag, data);
return sw;
} | java | public static IStopWatch create(String tag, Map<String, Object> data) {
IStopWatch sw = create();
sw.init(tag, data);
return sw;
} | [
"public",
"static",
"IStopWatch",
"create",
"(",
"String",
"tag",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"{",
"IStopWatch",
"sw",
"=",
"create",
"(",
")",
";",
"sw",
".",
"init",
"(",
"tag",
",",
"data",
")",
";",
"return",
"sw... | Returns a stopwatch instance initialized with the specified tag and data.
@param tag Tag to identify the interval being timed.
@param data Arbitrary metadata.
@return An initialized stopwatch instance. Will be null if the factory has not been
initialized. | [
"Returns",
"a",
"stopwatch",
"instance",
"initialized",
"with",
"the",
"specified",
"tag",
"and",
"data",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/StopWatchFactory.java#L111-L115 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetV1_0Generator.java | RRFedNonFedBudgetV1_0Generator.getCumulativeTravels | private CumulativeTravels getCumulativeTravels(BudgetSummaryDto budgetSummaryData) {
CumulativeTravels cumulativeTravels = CumulativeTravels.Factory.newInstance();
SummaryDataType summary = SummaryDataType.Factory.newInstance();
if (budgetSummaryData != null) {
if (budgetSummaryData.getCumTravel() != null) {
summary.setFederalSummary(budgetSummaryData.getCumTravel().bigDecimalValue());
}
if (budgetSummaryData.getCumTravelNonFund() != null) {
summary.setNonFederalSummary(budgetSummaryData.getCumTravelNonFund().bigDecimalValue());
if (budgetSummaryData.getCumTravel() != null) {
summary.setTotalFedNonFedSummary(budgetSummaryData.getCumTravel().add(budgetSummaryData.getCumTravelNonFund())
.bigDecimalValue());
}
else {
summary.setTotalFedNonFedSummary(budgetSummaryData.getCumTravelNonFund().bigDecimalValue());
}
}
TotalDataType totalDomestic = TotalDataType.Factory.newInstance();
if (budgetSummaryData.getCumDomesticTravel() != null) {
totalDomestic.setFederal(budgetSummaryData.getCumDomesticTravel().bigDecimalValue());
}
if (budgetSummaryData.getCumDomesticTravelNonFund() != null) {
totalDomestic.setNonFederal(budgetSummaryData.getCumDomesticTravelNonFund().bigDecimalValue());
if (budgetSummaryData.getCumDomesticTravel() != null) {
totalDomestic.setTotalFedNonFed(budgetSummaryData.getCumDomesticTravel().add(
budgetSummaryData.getCumDomesticTravelNonFund()).bigDecimalValue());
}
else {
totalDomestic.setTotalFedNonFed(budgetSummaryData.getCumDomesticTravelNonFund().bigDecimalValue());
}
}
cumulativeTravels.setCumulativeDomesticTravelCosts(totalDomestic);
TotalDataType totalForeign = TotalDataType.Factory.newInstance();
if (budgetSummaryData.getCumForeignTravel() != null) {
totalForeign.setFederal(budgetSummaryData.getCumForeignTravel().bigDecimalValue());
}
if (budgetSummaryData.getCumForeignTravelNonFund() != null) {
totalForeign.setNonFederal(budgetSummaryData.getCumForeignTravelNonFund().bigDecimalValue());
if (budgetSummaryData.getCumForeignTravel() != null) {
totalForeign.setTotalFedNonFed(budgetSummaryData.getCumForeignTravel().add(
budgetSummaryData.getCumForeignTravelNonFund()).bigDecimalValue());
}
else {
totalForeign.setTotalFedNonFed(budgetSummaryData.getCumForeignTravelNonFund().bigDecimalValue());
}
}
cumulativeTravels.setCumulativeForeignTravelCosts(totalForeign);
}
cumulativeTravels.setCumulativeTotalFundsRequestedTravel(summary);
return cumulativeTravels;
} | java | private CumulativeTravels getCumulativeTravels(BudgetSummaryDto budgetSummaryData) {
CumulativeTravels cumulativeTravels = CumulativeTravels.Factory.newInstance();
SummaryDataType summary = SummaryDataType.Factory.newInstance();
if (budgetSummaryData != null) {
if (budgetSummaryData.getCumTravel() != null) {
summary.setFederalSummary(budgetSummaryData.getCumTravel().bigDecimalValue());
}
if (budgetSummaryData.getCumTravelNonFund() != null) {
summary.setNonFederalSummary(budgetSummaryData.getCumTravelNonFund().bigDecimalValue());
if (budgetSummaryData.getCumTravel() != null) {
summary.setTotalFedNonFedSummary(budgetSummaryData.getCumTravel().add(budgetSummaryData.getCumTravelNonFund())
.bigDecimalValue());
}
else {
summary.setTotalFedNonFedSummary(budgetSummaryData.getCumTravelNonFund().bigDecimalValue());
}
}
TotalDataType totalDomestic = TotalDataType.Factory.newInstance();
if (budgetSummaryData.getCumDomesticTravel() != null) {
totalDomestic.setFederal(budgetSummaryData.getCumDomesticTravel().bigDecimalValue());
}
if (budgetSummaryData.getCumDomesticTravelNonFund() != null) {
totalDomestic.setNonFederal(budgetSummaryData.getCumDomesticTravelNonFund().bigDecimalValue());
if (budgetSummaryData.getCumDomesticTravel() != null) {
totalDomestic.setTotalFedNonFed(budgetSummaryData.getCumDomesticTravel().add(
budgetSummaryData.getCumDomesticTravelNonFund()).bigDecimalValue());
}
else {
totalDomestic.setTotalFedNonFed(budgetSummaryData.getCumDomesticTravelNonFund().bigDecimalValue());
}
}
cumulativeTravels.setCumulativeDomesticTravelCosts(totalDomestic);
TotalDataType totalForeign = TotalDataType.Factory.newInstance();
if (budgetSummaryData.getCumForeignTravel() != null) {
totalForeign.setFederal(budgetSummaryData.getCumForeignTravel().bigDecimalValue());
}
if (budgetSummaryData.getCumForeignTravelNonFund() != null) {
totalForeign.setNonFederal(budgetSummaryData.getCumForeignTravelNonFund().bigDecimalValue());
if (budgetSummaryData.getCumForeignTravel() != null) {
totalForeign.setTotalFedNonFed(budgetSummaryData.getCumForeignTravel().add(
budgetSummaryData.getCumForeignTravelNonFund()).bigDecimalValue());
}
else {
totalForeign.setTotalFedNonFed(budgetSummaryData.getCumForeignTravelNonFund().bigDecimalValue());
}
}
cumulativeTravels.setCumulativeForeignTravelCosts(totalForeign);
}
cumulativeTravels.setCumulativeTotalFundsRequestedTravel(summary);
return cumulativeTravels;
} | [
"private",
"CumulativeTravels",
"getCumulativeTravels",
"(",
"BudgetSummaryDto",
"budgetSummaryData",
")",
"{",
"CumulativeTravels",
"cumulativeTravels",
"=",
"CumulativeTravels",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"SummaryDataType",
"summary",
"=",
"Summa... | This method gets CumulativeTravels details,CumulativeTotalFundsRequestedTravel,CumulativeDomesticTravelCosts and
CumulativeForeignTravelCosts based on BudgetSummaryInfo for the RRFedNonFedBudget.
@param budgetSummaryData (BudgetSummaryInfo) budget summary entry.
@return CumulativeTravels cost details corresponding to the BudgetSummaryInfo object. | [
"This",
"method",
"gets",
"CumulativeTravels",
"details",
"CumulativeTotalFundsRequestedTravel",
"CumulativeDomesticTravelCosts",
"and",
"CumulativeForeignTravelCosts",
"based",
"on",
"BudgetSummaryInfo",
"for",
"the",
"RRFedNonFedBudget",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetV1_0Generator.java#L516-L567 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetV1_0Generator.java | RRFedNonFedBudgetV1_0Generator.getGraduateStudents | private GraduateStudents getGraduateStudents(OtherPersonnelDto otherPersonnel) {
GraduateStudents graduate = GraduateStudents.Factory.newInstance();
if (otherPersonnel != null) {
graduate.setNumberOfPersonnel(otherPersonnel.getNumberPersonnel());
graduate.setProjectRole(otherPersonnel.getRole());
graduate.setCompensation(getSectBCompensationDataType(otherPersonnel.getCompensation()));
}
return graduate;
} | java | private GraduateStudents getGraduateStudents(OtherPersonnelDto otherPersonnel) {
GraduateStudents graduate = GraduateStudents.Factory.newInstance();
if (otherPersonnel != null) {
graduate.setNumberOfPersonnel(otherPersonnel.getNumberPersonnel());
graduate.setProjectRole(otherPersonnel.getRole());
graduate.setCompensation(getSectBCompensationDataType(otherPersonnel.getCompensation()));
}
return graduate;
} | [
"private",
"GraduateStudents",
"getGraduateStudents",
"(",
"OtherPersonnelDto",
"otherPersonnel",
")",
"{",
"GraduateStudents",
"graduate",
"=",
"GraduateStudents",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"otherPersonnel",
"!=",
"null",
")",
"{... | This method gets the GraduateStudents details,ProjectRole, NumberOfPersonnel,Compensation based on OtherPersonnelInfo for the
RRFedNonFedBudget, if it is a GraduateStudents type.
@param otherPersonnel (OtherPersonnelInfo) other personnel info entry.
@return GraduateStudents details corresponding to the OtherPersonnelInfo object. | [
"This",
"method",
"gets",
"the",
"GraduateStudents",
"details",
"ProjectRole",
"NumberOfPersonnel",
"Compensation",
"based",
"on",
"OtherPersonnelInfo",
"for",
"the",
"RRFedNonFedBudget",
"if",
"it",
"is",
"a",
"GraduateStudents",
"type",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetV1_0Generator.java#L919-L928 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetV1_0Generator.java | RRFedNonFedBudgetV1_0Generator.getUndergraduateStudents | private UndergraduateStudents getUndergraduateStudents(OtherPersonnelDto otherPersonnel) {
UndergraduateStudents undergraduate = UndergraduateStudents.Factory.newInstance();
if (otherPersonnel != null) {
undergraduate.setNumberOfPersonnel(otherPersonnel.getNumberPersonnel());
undergraduate.setProjectRole(otherPersonnel.getRole());
undergraduate.setCompensation(getSectBCompensationDataType(otherPersonnel.getCompensation()));
}
return undergraduate;
} | java | private UndergraduateStudents getUndergraduateStudents(OtherPersonnelDto otherPersonnel) {
UndergraduateStudents undergraduate = UndergraduateStudents.Factory.newInstance();
if (otherPersonnel != null) {
undergraduate.setNumberOfPersonnel(otherPersonnel.getNumberPersonnel());
undergraduate.setProjectRole(otherPersonnel.getRole());
undergraduate.setCompensation(getSectBCompensationDataType(otherPersonnel.getCompensation()));
}
return undergraduate;
} | [
"private",
"UndergraduateStudents",
"getUndergraduateStudents",
"(",
"OtherPersonnelDto",
"otherPersonnel",
")",
"{",
"UndergraduateStudents",
"undergraduate",
"=",
"UndergraduateStudents",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"otherPersonnel",
"!... | This method is to get the UndergraduateStudents details,ProjectRole, NumberOfPersonnel,Compensation based on
OtherPersonnelInfo for the RRFedNonFedBudget,if it is a UndergraduateStudents type.
@param otherPersonnel (OtherPersonnelInfo) other personnel info entry.
@return UndergraduateStudents details corresponding to the OtherPersonnelInfo object. | [
"This",
"method",
"is",
"to",
"get",
"the",
"UndergraduateStudents",
"details",
"ProjectRole",
"NumberOfPersonnel",
"Compensation",
"based",
"on",
"OtherPersonnelInfo",
"for",
"the",
"RRFedNonFedBudget",
"if",
"it",
"is",
"a",
"UndergraduateStudents",
"type",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetV1_0Generator.java#L937-L946 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetV1_0Generator.java | RRFedNonFedBudgetV1_0Generator.getOthersForOtherDirectCosts | private Others getOthersForOtherDirectCosts(BudgetPeriodDto periodInfo) {
Others othersDirect = Others.Factory.newInstance();
if (periodInfo != null && periodInfo.getOtherDirectCosts() != null) {
Others.Other otherArray[] = new Others.Other[periodInfo.getOtherDirectCosts().size()];
int Otherscount = 0;
Others.Other other = Others.Other.Factory.newInstance();
for (OtherDirectCostInfoDto otherDirectCostInfo : periodInfo.getOtherDirectCosts()) {
TotalDataType total = TotalDataType.Factory.newInstance();
if (otherDirectCostInfo.getOtherCosts() != null && otherDirectCostInfo.getOtherCosts().size() > 0) {
total.setFederal(new BigDecimal(otherDirectCostInfo.getOtherCosts().get(0).get(CostConstants.KEY_COST)));
total
.setNonFederal(new BigDecimal(otherDirectCostInfo.getOtherCosts().get(0).get(
CostConstants.KEY_COSTSHARING)));
if (otherDirectCostInfo.getOtherCosts().get(0).get(CostConstants.KEY_COST) != null) {
total.setTotalFedNonFed(new BigDecimal(otherDirectCostInfo.getOtherCosts().get(0)
.get(CostConstants.KEY_COST)).add(new BigDecimal(otherDirectCostInfo.getOtherCosts().get(0).get(
CostConstants.KEY_COSTSHARING))));
}
else {
total.setTotalFedNonFed(new BigDecimal(otherDirectCostInfo.getOtherCosts().get(0).get(
CostConstants.KEY_COSTSHARING)));
}
}
other.setCost(total);
other.setDescription(OTHERCOST_DESCRIPTION);
otherArray[Otherscount] = other;
Otherscount++;
}
othersDirect.setOtherArray(otherArray);
}
return othersDirect;
} | java | private Others getOthersForOtherDirectCosts(BudgetPeriodDto periodInfo) {
Others othersDirect = Others.Factory.newInstance();
if (periodInfo != null && periodInfo.getOtherDirectCosts() != null) {
Others.Other otherArray[] = new Others.Other[periodInfo.getOtherDirectCosts().size()];
int Otherscount = 0;
Others.Other other = Others.Other.Factory.newInstance();
for (OtherDirectCostInfoDto otherDirectCostInfo : periodInfo.getOtherDirectCosts()) {
TotalDataType total = TotalDataType.Factory.newInstance();
if (otherDirectCostInfo.getOtherCosts() != null && otherDirectCostInfo.getOtherCosts().size() > 0) {
total.setFederal(new BigDecimal(otherDirectCostInfo.getOtherCosts().get(0).get(CostConstants.KEY_COST)));
total
.setNonFederal(new BigDecimal(otherDirectCostInfo.getOtherCosts().get(0).get(
CostConstants.KEY_COSTSHARING)));
if (otherDirectCostInfo.getOtherCosts().get(0).get(CostConstants.KEY_COST) != null) {
total.setTotalFedNonFed(new BigDecimal(otherDirectCostInfo.getOtherCosts().get(0)
.get(CostConstants.KEY_COST)).add(new BigDecimal(otherDirectCostInfo.getOtherCosts().get(0).get(
CostConstants.KEY_COSTSHARING))));
}
else {
total.setTotalFedNonFed(new BigDecimal(otherDirectCostInfo.getOtherCosts().get(0).get(
CostConstants.KEY_COSTSHARING)));
}
}
other.setCost(total);
other.setDescription(OTHERCOST_DESCRIPTION);
otherArray[Otherscount] = other;
Otherscount++;
}
othersDirect.setOtherArray(otherArray);
}
return othersDirect;
} | [
"private",
"Others",
"getOthersForOtherDirectCosts",
"(",
"BudgetPeriodDto",
"periodInfo",
")",
"{",
"Others",
"othersDirect",
"=",
"Others",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"periodInfo",
"!=",
"null",
"&&",
"periodInfo",
".",
"getO... | This method is to get Other type description and total cost OtherDirectCosts details in BudgetYearDataType based on
BudgetPeriodInfo for the RRFedNonFedBudget.
@param periodInfo (BudgetPeriodInfo) budget period entry.
@return Other others for other direct costs corresponding to the BudgetPeriodInfo object. | [
"This",
"method",
"is",
"to",
"get",
"Other",
"type",
"description",
"and",
"total",
"cost",
"OtherDirectCosts",
"details",
"in",
"BudgetYearDataType",
"based",
"on",
"BudgetPeriodInfo",
"for",
"the",
"RRFedNonFedBudget",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetV1_0Generator.java#L1484-L1516 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/ThemeUtil.java | ThemeUtil.applyThemeClass | public static void applyThemeClass(BaseUIComponent component, IThemeClass... themeClasses) {
StringBuilder sb = new StringBuilder();
for (IThemeClass themeClass : themeClasses) {
String cls = themeClass == null ? null : themeClass.getThemeClass();
if (cls != null) {
sb.append(sb.length() > 0 ? " " : "").append(themeClass.getThemeClass());
}
}
component.addClass(sb.toString());
} | java | public static void applyThemeClass(BaseUIComponent component, IThemeClass... themeClasses) {
StringBuilder sb = new StringBuilder();
for (IThemeClass themeClass : themeClasses) {
String cls = themeClass == null ? null : themeClass.getThemeClass();
if (cls != null) {
sb.append(sb.length() > 0 ? " " : "").append(themeClass.getThemeClass());
}
}
component.addClass(sb.toString());
} | [
"public",
"static",
"void",
"applyThemeClass",
"(",
"BaseUIComponent",
"component",
",",
"IThemeClass",
"...",
"themeClasses",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"IThemeClass",
"themeClass",
":",
"themeClasses"... | Applies one or more theme classes to a component.
@param component Component to receive the theme classes.
@param themeClasses A list of theme classes to apply. | [
"Applies",
"one",
"or",
"more",
"theme",
"classes",
"to",
"a",
"component",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/ThemeUtil.java#L46-L58 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java | PluginDefinition.setUrl | public void setUrl(String url) {
this.url = url;
if (clazz == null && url != null) {
setClazz(ElementPlugin.class);
}
} | java | public void setUrl(String url) {
this.url = url;
if (clazz == null && url != null) {
setClazz(ElementPlugin.class);
}
} | [
"public",
"void",
"setUrl",
"(",
"String",
"url",
")",
"{",
"this",
".",
"url",
"=",
"url",
";",
"if",
"(",
"clazz",
"==",
"null",
"&&",
"url",
"!=",
"null",
")",
"{",
"setClazz",
"(",
"ElementPlugin",
".",
"class",
")",
";",
"}",
"}"
] | Sets the URL of the principal cwf page for the plugin.
@param url The URL of the principal cwf page. | [
"Sets",
"the",
"URL",
"of",
"the",
"principal",
"cwf",
"page",
"for",
"the",
"plugin",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java#L226-L232 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java | PluginDefinition.getResources | @SuppressWarnings("unchecked")
public <E extends IPluginResource> List<E> getResources(Class<E> clazz) {
List<E> list = new ArrayList<>();
for (IPluginResource resource : resources) {
if (clazz.isInstance(resource)) {
list.add((E) resource);
}
}
return list;
} | java | @SuppressWarnings("unchecked")
public <E extends IPluginResource> List<E> getResources(Class<E> clazz) {
List<E> list = new ArrayList<>();
for (IPluginResource resource : resources) {
if (clazz.isInstance(resource)) {
list.add((E) resource);
}
}
return list;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"E",
"extends",
"IPluginResource",
">",
"List",
"<",
"E",
">",
"getResources",
"(",
"Class",
"<",
"E",
">",
"clazz",
")",
"{",
"List",
"<",
"E",
">",
"list",
"=",
"new",
"ArrayList",
"<... | Returns the list of plugin resources belonging to the specified resource class. Never null.
@param <E> A subclass of PluginResource.
@param clazz The resource class being sought.
@return List of associated resources. | [
"Returns",
"the",
"list",
"of",
"plugin",
"resources",
"belonging",
"to",
"the",
"specified",
"resource",
"class",
".",
"Never",
"null",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java#L296-L307 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java | PluginDefinition.setClazz | public void setClazz(Class<? extends ElementBase> clazz) {
this.clazz = clazz;
try {
// Force execution of static initializers
Class.forName(clazz.getName());
} catch (ClassNotFoundException e) {
MiscUtil.toUnchecked(e);
}
} | java | public void setClazz(Class<? extends ElementBase> clazz) {
this.clazz = clazz;
try {
// Force execution of static initializers
Class.forName(clazz.getName());
} catch (ClassNotFoundException e) {
MiscUtil.toUnchecked(e);
}
} | [
"public",
"void",
"setClazz",
"(",
"Class",
"<",
"?",
"extends",
"ElementBase",
">",
"clazz",
")",
"{",
"this",
".",
"clazz",
"=",
"clazz",
";",
"try",
"{",
"// Force execution of static initializers",
"Class",
".",
"forName",
"(",
"clazz",
".",
"getName",
"... | Sets the UI element class associated with this definition.
@param clazz The associated class. | [
"Sets",
"the",
"UI",
"element",
"class",
"associated",
"with",
"this",
"definition",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java#L368-L377 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java | PluginDefinition.isForbidden | public boolean isForbidden() {
if (authorities.size() == 0) {
return false; // If no restrictions, return false
}
boolean result = true;
for (Authority priv : authorities) {
result = !SecurityUtil.isGranted(priv.name);
if (requiresAll == result) {
break;
}
}
return result;
} | java | public boolean isForbidden() {
if (authorities.size() == 0) {
return false; // If no restrictions, return false
}
boolean result = true;
for (Authority priv : authorities) {
result = !SecurityUtil.isGranted(priv.name);
if (requiresAll == result) {
break;
}
}
return result;
} | [
"public",
"boolean",
"isForbidden",
"(",
")",
"{",
"if",
"(",
"authorities",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"// If no restrictions, return false",
"}",
"boolean",
"result",
"=",
"true",
";",
"for",
"(",
"Authority",
"pr... | Returns true if access to the plugin is restricted.
@return True if access to the plugin is restricted. | [
"Returns",
"true",
"if",
"access",
"to",
"the",
"plugin",
"is",
"restricted",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java#L540-L556 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java | PluginDefinition.setPath | public void setPath(String path) {
if (path != null) {
manifest = ManifestIterator.getInstance().findByPath(path);
}
} | java | public void setPath(String path) {
if (path != null) {
manifest = ManifestIterator.getInstance().findByPath(path);
}
} | [
"public",
"void",
"setPath",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"!=",
"null",
")",
"{",
"manifest",
"=",
"ManifestIterator",
".",
"getInstance",
"(",
")",
".",
"findByPath",
"(",
"path",
")",
";",
"}",
"}"
] | Sets the path of the resource containing the plugin definition. This is used to locate the
manifest entry from which version and source information can be extracted.
@param path Path of the resource containing this plugin definition. | [
"Sets",
"the",
"path",
"of",
"the",
"resource",
"containing",
"the",
"plugin",
"definition",
".",
"This",
"is",
"used",
"to",
"locate",
"the",
"manifest",
"entry",
"from",
"which",
"version",
"and",
"source",
"information",
"can",
"be",
"extracted",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java#L579-L583 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java | PluginDefinition.getValueWithDefault | private String getValueWithDefault(String value, String manifestKey) {
if (StringUtils.isEmpty(value) && manifest != null) {
value = manifest.getMainAttributes().getValue(manifestKey);
}
return value;
} | java | private String getValueWithDefault(String value, String manifestKey) {
if (StringUtils.isEmpty(value) && manifest != null) {
value = manifest.getMainAttributes().getValue(manifestKey);
}
return value;
} | [
"private",
"String",
"getValueWithDefault",
"(",
"String",
"value",
",",
"String",
"manifestKey",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"value",
")",
"&&",
"manifest",
"!=",
"null",
")",
"{",
"value",
"=",
"manifest",
".",
"getMainAttribut... | Returns a value's default if the initial value is null or empty.
@param value The initial value.
@param manifestKey The manifest key from which to obtain the default value.
@return The initial value or, if it was null or empty, the default value. | [
"Returns",
"a",
"value",
"s",
"default",
"if",
"the",
"initial",
"value",
"is",
"null",
"or",
"empty",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java#L592-L598 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java | PluginDefinition.createElement | public ElementBase createElement(ElementBase parent, IPropertyProvider propertyProvider, boolean deserializing) {
try {
ElementBase element = null;
if (isForbidden()) {
log.info("Access to plugin " + getName() + " is restricted.");
} else if (isDisabled()) {
log.info("Plugin " + getName() + " has been disabled.");
} else {
Class<? extends ElementBase> clazz = getClazz();
if (isInternal()) {
element = parent.getChild(clazz, null);
} else {
element = clazz.newInstance();
}
if (element == null) {
CWFException.raise("Failed to create UI element " + id + ".");
}
element.setDefinition(this);
element.beforeInitialize(deserializing);
initElement(element, propertyProvider);
if (parent != null) {
element.setParent(parent);
}
element.afterInitialize(deserializing);
}
return element;
} catch (Exception e) {
throw MiscUtil.toUnchecked(e);
}
} | java | public ElementBase createElement(ElementBase parent, IPropertyProvider propertyProvider, boolean deserializing) {
try {
ElementBase element = null;
if (isForbidden()) {
log.info("Access to plugin " + getName() + " is restricted.");
} else if (isDisabled()) {
log.info("Plugin " + getName() + " has been disabled.");
} else {
Class<? extends ElementBase> clazz = getClazz();
if (isInternal()) {
element = parent.getChild(clazz, null);
} else {
element = clazz.newInstance();
}
if (element == null) {
CWFException.raise("Failed to create UI element " + id + ".");
}
element.setDefinition(this);
element.beforeInitialize(deserializing);
initElement(element, propertyProvider);
if (parent != null) {
element.setParent(parent);
}
element.afterInitialize(deserializing);
}
return element;
} catch (Exception e) {
throw MiscUtil.toUnchecked(e);
}
} | [
"public",
"ElementBase",
"createElement",
"(",
"ElementBase",
"parent",
",",
"IPropertyProvider",
"propertyProvider",
",",
"boolean",
"deserializing",
")",
"{",
"try",
"{",
"ElementBase",
"element",
"=",
"null",
";",
"if",
"(",
"isForbidden",
"(",
")",
")",
"{",... | Creates an instance of the element based on its definition. If a property source is
specified, the source is used to initialize properties on the newly created element.
@param parent Parent element (may be null).
@param propertyProvider Property source for initializing element properties (may be null).
@param deserializing If true, we are deserializing a layout.
@return Newly created element (may be null if access is restricted or plugin has been
disabled). | [
"Creates",
"an",
"instance",
"of",
"the",
"element",
"based",
"on",
"its",
"definition",
".",
"If",
"a",
"property",
"source",
"is",
"specified",
"the",
"source",
"is",
"used",
"to",
"initialize",
"properties",
"on",
"the",
"newly",
"created",
"element",
"."... | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java#L610-L647 | train |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java | PluginDefinition.initElement | public void initElement(ElementBase element, IPropertyProvider propertyProvider) {
if (propertyProvider != null) {
for (PropertyInfo propInfo : getProperties()) {
String key = propInfo.getId();
if (propertyProvider.hasProperty(key)) {
String value = propertyProvider.getProperty(key);
propInfo.setPropertyValue(element, value);
}
}
}
} | java | public void initElement(ElementBase element, IPropertyProvider propertyProvider) {
if (propertyProvider != null) {
for (PropertyInfo propInfo : getProperties()) {
String key = propInfo.getId();
if (propertyProvider.hasProperty(key)) {
String value = propertyProvider.getProperty(key);
propInfo.setPropertyValue(element, value);
}
}
}
} | [
"public",
"void",
"initElement",
"(",
"ElementBase",
"element",
",",
"IPropertyProvider",
"propertyProvider",
")",
"{",
"if",
"(",
"propertyProvider",
"!=",
"null",
")",
"{",
"for",
"(",
"PropertyInfo",
"propInfo",
":",
"getProperties",
"(",
")",
")",
"{",
"St... | Initialize the element's properties using the specified property provider.
@param element Element to initialize.
@param propertyProvider Provider of property values. | [
"Initialize",
"the",
"element",
"s",
"properties",
"using",
"the",
"specified",
"property",
"provider",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/plugins/PluginDefinition.java#L655-L666 | train |
tomdcc/sham | sham-core/src/main/java/org/shamdata/person/PersonGenerator.java | PersonGenerator.nextPerson | public Person nextPerson() {
if(!initialized) { init(); }
Person person = new Person();
Gender gender = this.gender == null ? (random.nextBoolean() ? Gender.FEMALE : Gender.MALE) : this.gender;
person.setGender(gender);
List<String> givenNamesPool = gender == Gender.FEMALE ? givenFemaleNames : givenMaleNames;
List<String> givenNames = new ArrayList<String>(2);
givenNames.add(getNameWord(givenNamesPool));
givenNames.add(getNameWord(givenNamesPool));
person.setGivenNames(givenNames);
person.setLastName(getNameWord(lastNames));
generateDOB(person);
Map<String, Object> spewDetails = generateSpewDetails(person);
person.setUsername(usernameGenerator.nextLine(spewDetails));
spewDetails.put("USERNAME", person.getUsername());
person.setEmail(emailGenerator.nextLine(spewDetails));
person.setTwitterUsername(random.nextInt(2) == 1 ? "@" + usernameGenerator.nextLine(spewDetails) : null);
return person;
} | java | public Person nextPerson() {
if(!initialized) { init(); }
Person person = new Person();
Gender gender = this.gender == null ? (random.nextBoolean() ? Gender.FEMALE : Gender.MALE) : this.gender;
person.setGender(gender);
List<String> givenNamesPool = gender == Gender.FEMALE ? givenFemaleNames : givenMaleNames;
List<String> givenNames = new ArrayList<String>(2);
givenNames.add(getNameWord(givenNamesPool));
givenNames.add(getNameWord(givenNamesPool));
person.setGivenNames(givenNames);
person.setLastName(getNameWord(lastNames));
generateDOB(person);
Map<String, Object> spewDetails = generateSpewDetails(person);
person.setUsername(usernameGenerator.nextLine(spewDetails));
spewDetails.put("USERNAME", person.getUsername());
person.setEmail(emailGenerator.nextLine(spewDetails));
person.setTwitterUsername(random.nextInt(2) == 1 ? "@" + usernameGenerator.nextLine(spewDetails) : null);
return person;
} | [
"public",
"Person",
"nextPerson",
"(",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"init",
"(",
")",
";",
"}",
"Person",
"person",
"=",
"new",
"Person",
"(",
")",
";",
"Gender",
"gender",
"=",
"this",
".",
"gender",
"==",
"null",
"?",
"(",
... | Returns a randomly generated person.
@return next randomly generated person. | [
"Returns",
"a",
"randomly",
"generated",
"person",
"."
] | 33ede5e7130888736d6c84368e16a56e9e31e033 | https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/person/PersonGenerator.java#L85-L104 | train |
tomdcc/sham | sham-core/src/main/java/org/shamdata/person/PersonGenerator.java | PersonGenerator.nextPeople | public List<Person> nextPeople(int num) {
List<Person> names = new ArrayList<Person>(num);
for(int i = 0; i < num; i++) {
names.add(nextPerson());
}
return names;
} | java | public List<Person> nextPeople(int num) {
List<Person> names = new ArrayList<Person>(num);
for(int i = 0; i < num; i++) {
names.add(nextPerson());
}
return names;
} | [
"public",
"List",
"<",
"Person",
">",
"nextPeople",
"(",
"int",
"num",
")",
"{",
"List",
"<",
"Person",
">",
"names",
"=",
"new",
"ArrayList",
"<",
"Person",
">",
"(",
"num",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"num",
";"... | Will generate the given number of random people
@param num the number of people to generate
@return a list of the generated people | [
"Will",
"generate",
"the",
"given",
"number",
"of",
"random",
"people"
] | 33ede5e7130888736d6c84368e16a56e9e31e033 | https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/person/PersonGenerator.java#L146-L152 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextMarshaller.java | ContextMarshaller.marshal | public String marshal(ContextItems contextItems) {
SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyyMMddHHmmssz");
contextItems.setItem(PROPNAME_TIME, timestampFormat.format(new Date()));
contextItems.setItem(PROPNAME_KEY, signer.getKeyName());
return contextItems.toString();
} | java | public String marshal(ContextItems contextItems) {
SimpleDateFormat timestampFormat = new SimpleDateFormat("yyyyMMddHHmmssz");
contextItems.setItem(PROPNAME_TIME, timestampFormat.format(new Date()));
contextItems.setItem(PROPNAME_KEY, signer.getKeyName());
return contextItems.toString();
} | [
"public",
"String",
"marshal",
"(",
"ContextItems",
"contextItems",
")",
"{",
"SimpleDateFormat",
"timestampFormat",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyyMMddHHmmssz\"",
")",
";",
"contextItems",
".",
"setItem",
"(",
"PROPNAME_TIME",
",",
"timestampFormat",
"."... | Marshals the current context as a string.
@param contextItems The context items to marshal.
@return The marshaled context. | [
"Marshals",
"the",
"current",
"context",
"as",
"a",
"string",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextMarshaller.java#L55-L60 | train |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextMarshaller.java | ContextMarshaller.unmarshal | public ContextItems unmarshal(String marshaledContext, String authSignature) throws Exception {
ContextItems contextItems = new ContextItems();
contextItems.addItems(marshaledContext);
String whichKey = contextItems.getItem(PROPNAME_KEY);
String timestamp = contextItems.getItem(PROPNAME_TIME);
if (authSignature != null && !signer.verify(authSignature, marshaledContext, timestamp, whichKey)) {
throw new MarshalException("Invalid digital signature");
}
return contextItems;
} | java | public ContextItems unmarshal(String marshaledContext, String authSignature) throws Exception {
ContextItems contextItems = new ContextItems();
contextItems.addItems(marshaledContext);
String whichKey = contextItems.getItem(PROPNAME_KEY);
String timestamp = contextItems.getItem(PROPNAME_TIME);
if (authSignature != null && !signer.verify(authSignature, marshaledContext, timestamp, whichKey)) {
throw new MarshalException("Invalid digital signature");
}
return contextItems;
} | [
"public",
"ContextItems",
"unmarshal",
"(",
"String",
"marshaledContext",
",",
"String",
"authSignature",
")",
"throws",
"Exception",
"{",
"ContextItems",
"contextItems",
"=",
"new",
"ContextItems",
"(",
")",
";",
"contextItems",
".",
"addItems",
"(",
"marshaledCont... | Unmarshals the marshaled context. Performs digital signature verification, then returns the
unmarshaled context items.
@param marshaledContext Marshaled context
@param authSignature If set, the digital signature is verified.
@return The unmarshaled context.
@throws Exception Unspecified exception. | [
"Unmarshals",
"the",
"marshaled",
"context",
".",
"Performs",
"digital",
"signature",
"verification",
"then",
"returns",
"the",
"unmarshaled",
"context",
"items",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextMarshaller.java#L82-L93 | train |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetV1_1Generator.java | RRFedNonFedBudgetV1_1Generator.getTravel | private Travel getTravel(BudgetPeriodDto periodInfo) {
Travel travel = Travel.Factory.newInstance();
if (periodInfo != null) {
TotalDataType total = TotalDataType.Factory.newInstance();
if (periodInfo.getDomesticTravelCost() != null) {
total.setFederal(periodInfo.getDomesticTravelCost().bigDecimalValue());
}
if (periodInfo.getDomesticTravelCostSharing() != null) {
total.setNonFederal(periodInfo.getDomesticTravelCostSharing().bigDecimalValue());
if (periodInfo.getDomesticTravelCost() != null) {
total.setTotalFedNonFed(periodInfo.getDomesticTravelCost().add(periodInfo.getDomesticTravelCostSharing())
.bigDecimalValue());
}
else {
total.setTotalFedNonFed(periodInfo.getDomesticTravelCostSharing().bigDecimalValue());
}
}
travel.setDomesticTravelCost(total);
TotalDataType totalForeign = TotalDataType.Factory.newInstance();
if (periodInfo.getForeignTravelCost() != null) {
totalForeign.setFederal(periodInfo.getForeignTravelCost().bigDecimalValue());
}
if (periodInfo.getForeignTravelCostSharing() != null) {
totalForeign.setNonFederal(periodInfo.getForeignTravelCostSharing().bigDecimalValue());
if (periodInfo.getForeignTravelCost() != null) {
totalForeign.setTotalFedNonFed(periodInfo.getForeignTravelCost().add(periodInfo.getForeignTravelCostSharing())
.bigDecimalValue());
}
else {
totalForeign.setTotalFedNonFed(periodInfo.getForeignTravelCostSharing().bigDecimalValue());
}
}
travel.setForeignTravelCost(totalForeign);
SummaryDataType summary = SummaryDataType.Factory.newInstance();
if (periodInfo.getTotalTravelCost() != null) {
summary.setFederalSummary(periodInfo.getTotalTravelCost().bigDecimalValue());
}
if (periodInfo.getTotalTravelCostSharing() != null) {
summary.setNonFederalSummary(periodInfo.getTotalTravelCostSharing().bigDecimalValue());
if (periodInfo.getTotalTravelCost() != null) {
summary.setTotalFedNonFedSummary(periodInfo.getTotalTravelCost().add(periodInfo.getTotalTravelCostSharing())
.bigDecimalValue());
}
else {
summary.setTotalFedNonFedSummary(periodInfo.getTotalTravelCostSharing().bigDecimalValue());
}
}
travel.setTotalTravelCost(summary);
}
return travel;
} | java | private Travel getTravel(BudgetPeriodDto periodInfo) {
Travel travel = Travel.Factory.newInstance();
if (periodInfo != null) {
TotalDataType total = TotalDataType.Factory.newInstance();
if (periodInfo.getDomesticTravelCost() != null) {
total.setFederal(periodInfo.getDomesticTravelCost().bigDecimalValue());
}
if (periodInfo.getDomesticTravelCostSharing() != null) {
total.setNonFederal(periodInfo.getDomesticTravelCostSharing().bigDecimalValue());
if (periodInfo.getDomesticTravelCost() != null) {
total.setTotalFedNonFed(periodInfo.getDomesticTravelCost().add(periodInfo.getDomesticTravelCostSharing())
.bigDecimalValue());
}
else {
total.setTotalFedNonFed(periodInfo.getDomesticTravelCostSharing().bigDecimalValue());
}
}
travel.setDomesticTravelCost(total);
TotalDataType totalForeign = TotalDataType.Factory.newInstance();
if (periodInfo.getForeignTravelCost() != null) {
totalForeign.setFederal(periodInfo.getForeignTravelCost().bigDecimalValue());
}
if (periodInfo.getForeignTravelCostSharing() != null) {
totalForeign.setNonFederal(periodInfo.getForeignTravelCostSharing().bigDecimalValue());
if (periodInfo.getForeignTravelCost() != null) {
totalForeign.setTotalFedNonFed(periodInfo.getForeignTravelCost().add(periodInfo.getForeignTravelCostSharing())
.bigDecimalValue());
}
else {
totalForeign.setTotalFedNonFed(periodInfo.getForeignTravelCostSharing().bigDecimalValue());
}
}
travel.setForeignTravelCost(totalForeign);
SummaryDataType summary = SummaryDataType.Factory.newInstance();
if (periodInfo.getTotalTravelCost() != null) {
summary.setFederalSummary(periodInfo.getTotalTravelCost().bigDecimalValue());
}
if (periodInfo.getTotalTravelCostSharing() != null) {
summary.setNonFederalSummary(periodInfo.getTotalTravelCostSharing().bigDecimalValue());
if (periodInfo.getTotalTravelCost() != null) {
summary.setTotalFedNonFedSummary(periodInfo.getTotalTravelCost().add(periodInfo.getTotalTravelCostSharing())
.bigDecimalValue());
}
else {
summary.setTotalFedNonFedSummary(periodInfo.getTotalTravelCostSharing().bigDecimalValue());
}
}
travel.setTotalTravelCost(summary);
}
return travel;
} | [
"private",
"Travel",
"getTravel",
"(",
"BudgetPeriodDto",
"periodInfo",
")",
"{",
"Travel",
"travel",
"=",
"Travel",
".",
"Factory",
".",
"newInstance",
"(",
")",
";",
"if",
"(",
"periodInfo",
"!=",
"null",
")",
"{",
"TotalDataType",
"total",
"=",
"TotalData... | This method gets Travel cost information including DomesticTravelCost,ForeignTravelCost and TotalTravelCost in the
BudgetYearDataType based on BudgetPeriodInfo for the RRFedNonFedBudget.
@param periodInfo (BudgetPeriodInfo) budget period entry.
@return Travel cost details corresponding to the BudgetPeriodInfo object. | [
"This",
"method",
"gets",
"Travel",
"cost",
"information",
"including",
"DomesticTravelCost",
"ForeignTravelCost",
"and",
"TotalTravelCost",
"in",
"the",
"BudgetYearDataType",
"based",
"on",
"BudgetPeriodInfo",
"for",
"the",
"RRFedNonFedBudget",
"."
] | 2886380e1e3cb8bdd732ba99b2afa6ffc630bb37 | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRFedNonFedBudgetV1_1Generator.java#L1463-L1514 | train |
mgormley/prim | src/main/java_generated/edu/jhu/prim/arrays/IntArrays.java | IntArrays.count | public static int count(int[] array, int value) {
int count = 0;
for (int i = 0; i < array.length; i++) {
if (array[i] == value) {
count++;
}
}
return count;
} | java | public static int count(int[] array, int value) {
int count = 0;
for (int i = 0; i < array.length; i++) {
if (array[i] == value) {
count++;
}
}
return count;
} | [
"public",
"static",
"int",
"count",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"value",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"... | Counts the number of times value appears in array. | [
"Counts",
"the",
"number",
"of",
"times",
"value",
"appears",
"in",
"array",
"."
] | 5dce5e1ae94a9ae558a6262fc246e1a24f56686c | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/arrays/IntArrays.java#L151-L159 | train |
mgormley/prim | src/main/java_generated/edu/jhu/prim/arrays/IntArrays.java | IntArrays.reorder | public static void reorder(int[] array, int[] order) {
int[] original = copyOf(array);
for (int i = 0; i < array.length; i++) {
array[i] = original[order[i]];
}
} | java | public static void reorder(int[] array, int[] order) {
int[] original = copyOf(array);
for (int i = 0; i < array.length; i++) {
array[i] = original[order[i]];
}
} | [
"public",
"static",
"void",
"reorder",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"[",
"]",
"order",
")",
"{",
"int",
"[",
"]",
"original",
"=",
"copyOf",
"(",
"array",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
... | Reorder array in place.
Letting A denote the original array and B the reordered version, we will
have B[i] = A[order[i]].
@param array The array to reorder.
@param order The order to apply. | [
"Reorder",
"array",
"in",
"place",
"."
] | 5dce5e1ae94a9ae558a6262fc246e1a24f56686c | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/arrays/IntArrays.java#L170-L175 | train |
mgormley/prim | src/main/java_generated/edu/jhu/prim/arrays/IntArrays.java | IntArrays.countUnique | public static int countUnique(int[] indices1, int[] indices2) {
int numUniqueIndices = 0;
int i = 0;
int j = 0;
while (i < indices1.length && j < indices2.length) {
if (indices1[i] < indices2[j]) {
numUniqueIndices++;
i++;
} else if (indices2[j] < indices1[i]) {
numUniqueIndices++;
j++;
} else {
// Equal indices.
i++;
j++;
}
}
for (; i < indices1.length; i++) {
numUniqueIndices++;
}
for (; j < indices2.length; j++) {
numUniqueIndices++;
}
return numUniqueIndices;
} | java | public static int countUnique(int[] indices1, int[] indices2) {
int numUniqueIndices = 0;
int i = 0;
int j = 0;
while (i < indices1.length && j < indices2.length) {
if (indices1[i] < indices2[j]) {
numUniqueIndices++;
i++;
} else if (indices2[j] < indices1[i]) {
numUniqueIndices++;
j++;
} else {
// Equal indices.
i++;
j++;
}
}
for (; i < indices1.length; i++) {
numUniqueIndices++;
}
for (; j < indices2.length; j++) {
numUniqueIndices++;
}
return numUniqueIndices;
} | [
"public",
"static",
"int",
"countUnique",
"(",
"int",
"[",
"]",
"indices1",
",",
"int",
"[",
"]",
"indices2",
")",
"{",
"int",
"numUniqueIndices",
"=",
"0",
";",
"int",
"i",
"=",
"0",
";",
"int",
"j",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"indic... | Counts the number of unique indices in two arrays.
@param indices1 Sorted array of indices.
@param indices2 Sorted array of indices. | [
"Counts",
"the",
"number",
"of",
"unique",
"indices",
"in",
"two",
"arrays",
"."
] | 5dce5e1ae94a9ae558a6262fc246e1a24f56686c | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/arrays/IntArrays.java#L183-L207 | train |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionTypeRegistry.java | ActionTypeRegistry.getType | public static IActionType<?> getType(String script) {
for (IActionType<?> actionType : instance) {
if (actionType.matches(script)) {
return actionType;
}
}
throw new IllegalArgumentException("Script type was not recognized: " + script);
} | java | public static IActionType<?> getType(String script) {
for (IActionType<?> actionType : instance) {
if (actionType.matches(script)) {
return actionType;
}
}
throw new IllegalArgumentException("Script type was not recognized: " + script);
} | [
"public",
"static",
"IActionType",
"<",
"?",
">",
"getType",
"(",
"String",
"script",
")",
"{",
"for",
"(",
"IActionType",
"<",
"?",
">",
"actionType",
":",
"instance",
")",
"{",
"if",
"(",
"actionType",
".",
"matches",
"(",
"script",
")",
")",
"{",
... | Returns the action type given a script.
@param script The action script.
@return The action type, or an exception if a matching action was not found. | [
"Returns",
"the",
"action",
"type",
"given",
"a",
"script",
"."
] | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/action/ActionTypeRegistry.java#L48-L56 | train |
DDTH/ddth-queue | ddth-queue-core/src/main/java/com/github/ddth/queue/utils/MongoUtils.java | MongoUtils.collectionExists | public static boolean collectionExists(MongoDatabase db, String collectionName) {
return db.listCollections().filter(Filters.eq("name", collectionName)).first() != null;
} | java | public static boolean collectionExists(MongoDatabase db, String collectionName) {
return db.listCollections().filter(Filters.eq("name", collectionName)).first() != null;
} | [
"public",
"static",
"boolean",
"collectionExists",
"(",
"MongoDatabase",
"db",
",",
"String",
"collectionName",
")",
"{",
"return",
"db",
".",
"listCollections",
"(",
")",
".",
"filter",
"(",
"Filters",
".",
"eq",
"(",
"\"name\"",
",",
"collectionName",
")",
... | Check if a collection exists.
@param db
@param collectionName
@return | [
"Check",
"if",
"a",
"collection",
"exists",
"."
] | b20776850d23111d3d71fc8ed6023c590bc3621f | https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/utils/MongoUtils.java#L35-L37 | train |
DDTH/ddth-queue | ddth-queue-core/src/main/java/com/github/ddth/queue/utils/MongoUtils.java | MongoUtils.createCollection | public static MongoCollection<Document> createCollection(MongoDatabase db,
String collectionName, CreateCollectionOptions options) {
db.createCollection(collectionName, options);
return db.getCollection(collectionName);
} | java | public static MongoCollection<Document> createCollection(MongoDatabase db,
String collectionName, CreateCollectionOptions options) {
db.createCollection(collectionName, options);
return db.getCollection(collectionName);
} | [
"public",
"static",
"MongoCollection",
"<",
"Document",
">",
"createCollection",
"(",
"MongoDatabase",
"db",
",",
"String",
"collectionName",
",",
"CreateCollectionOptions",
"options",
")",
"{",
"db",
".",
"createCollection",
"(",
"collectionName",
",",
"options",
"... | Create a new collection.
@param db
@param collectionName
@param options
@return | [
"Create",
"a",
"new",
"collection",
"."
] | b20776850d23111d3d71fc8ed6023c590bc3621f | https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/utils/MongoUtils.java#L47-L51 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.