code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public Collection<String> nearestLabels(INDArray labelVector, int topN) {
if (labelsMatrix == null || labelsList == null || labelsList.isEmpty())
extractLabels();
List<BasicModelUtils.WordSimilarity> result = new ArrayList<>();
// if list still empty - return empty collection
if (labelsMatrix == null || labelsList == null || labelsList.isEmpty()) {
log.warn("Labels list is empty!");
return new ArrayList<>();
}
if (!normalizedLabels) {
synchronized (this) {
if (!normalizedLabels) {
labelsMatrix.diviColumnVector(labelsMatrix.norm1(1));
normalizedLabels = true;
}
}
}
INDArray similarity = Transforms.unitVec(labelVector).mmul(labelsMatrix.transpose());
List<Double> highToLowSimList = getTopN(similarity, topN + 20);
for (int i = 0; i < highToLowSimList.size(); i++) {
String word = labelsList.get(highToLowSimList.get(i).intValue()).getLabel();
if (word != null && !word.equals("UNK") && !word.equals("STOP")) {
INDArray otherVec = lookupTable.vector(word);
double sim = Transforms.cosineSim(labelVector, otherVec);
result.add(new BasicModelUtils.WordSimilarity(word, sim));
}
}
Collections.sort(result, new BasicModelUtils.SimilarityComparator());
return BasicModelUtils.getLabels(result, topN);
} | class class_name[name] begin[{]
method[nearestLabels, return_type[type[Collection]], modifier[public], parameter[labelVector, topN]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.labelsMatrix], ==, literal[null]], ||, binary_operation[member[.labelsList], ==, literal[null]]], ||, call[labelsList.isEmpty, parameter[]]]] begin[{]
call[.extractLabels, parameter[]]
else begin[{]
None
end[}]
local_variable[type[List], result]
if[binary_operation[binary_operation[binary_operation[member[.labelsMatrix], ==, literal[null]], ||, binary_operation[member[.labelsList], ==, literal[null]]], ||, call[labelsList.isEmpty, parameter[]]]] begin[{]
call[log.warn, parameter[literal["Labels list is empty!"]]]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
if[member[.normalizedLabels]] begin[{]
SYNCHRONIZED[THIS[]] BEGIN[{]
if[member[.normalizedLabels]] begin[{]
call[labelsMatrix.diviColumnVector, parameter[call[labelsMatrix.norm1, parameter[literal[1]]]]]
assign[member[.normalizedLabels], literal[true]]
else begin[{]
None
end[}]
END[}]
else begin[{]
None
end[}]
local_variable[type[INDArray], similarity]
local_variable[type[List], highToLowSimList]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=highToLowSimList, selectors=[MethodInvocation(arguments=[], member=intValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=labelsList, selectors=[MethodInvocation(arguments=[], member=getLabel, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=word)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UNK")], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=word, selectors=[], type_arguments=None), operator=&&), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="STOP")], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=word, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=vector, postfix_operators=[], prefix_operators=[], qualifier=lookupTable, selectors=[], type_arguments=None), name=otherVec)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=INDArray, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=labelVector, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=otherVec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cosineSim, postfix_operators=[], prefix_operators=[], qualifier=Transforms, selectors=[], type_arguments=None), name=sim)], modifiers=set(), type=BasicType(dimensions=[], name=double)), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=word, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sim, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicModelUtils, sub_type=ReferenceType(arguments=None, dimensions=None, name=WordSimilarity, sub_type=None)))], member=add, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=highToLowSimList, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[Collections.sort, parameter[member[.result], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BasicModelUtils, sub_type=ReferenceType(arguments=None, dimensions=None, name=SimilarityComparator, sub_type=None)))]]
return[call[BasicModelUtils.getLabels, parameter[member[.result], member[.topN]]]]
end[}]
END[}] | Keyword[public] identifier[Collection] operator[<] identifier[String] operator[>] identifier[nearestLabels] operator[SEP] identifier[INDArray] identifier[labelVector] , Keyword[int] identifier[topN] operator[SEP] {
Keyword[if] operator[SEP] identifier[labelsMatrix] operator[==] Other[null] operator[||] identifier[labelsList] operator[==] Other[null] operator[||] identifier[labelsList] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] identifier[extractLabels] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[BasicModelUtils] operator[SEP] identifier[WordSimilarity] operator[>] identifier[result] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[labelsMatrix] operator[==] Other[null] operator[||] identifier[labelsList] operator[==] Other[null] operator[||] identifier[labelsList] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[normalizedLabels] operator[SEP] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[normalizedLabels] operator[SEP] {
identifier[labelsMatrix] operator[SEP] identifier[diviColumnVector] operator[SEP] identifier[labelsMatrix] operator[SEP] identifier[norm1] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[normalizedLabels] operator[=] literal[boolean] operator[SEP]
}
}
}
identifier[INDArray] identifier[similarity] operator[=] identifier[Transforms] operator[SEP] identifier[unitVec] operator[SEP] identifier[labelVector] operator[SEP] operator[SEP] identifier[mmul] operator[SEP] identifier[labelsMatrix] operator[SEP] identifier[transpose] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Double] operator[>] identifier[highToLowSimList] operator[=] identifier[getTopN] operator[SEP] identifier[similarity] , identifier[topN] operator[+] Other[20] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[highToLowSimList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[String] identifier[word] operator[=] identifier[labelsList] operator[SEP] identifier[get] operator[SEP] identifier[highToLowSimList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getLabel] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[word] operator[!=] Other[null] operator[&&] operator[!] identifier[word] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[word] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[INDArray] identifier[otherVec] operator[=] identifier[lookupTable] operator[SEP] identifier[vector] operator[SEP] identifier[word] operator[SEP] operator[SEP] Keyword[double] identifier[sim] operator[=] identifier[Transforms] operator[SEP] identifier[cosineSim] operator[SEP] identifier[labelVector] , identifier[otherVec] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[BasicModelUtils] operator[SEP] identifier[WordSimilarity] operator[SEP] identifier[word] , identifier[sim] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[Collections] operator[SEP] identifier[sort] operator[SEP] identifier[result] , Keyword[new] identifier[BasicModelUtils] operator[SEP] identifier[SimilarityComparator] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[BasicModelUtils] operator[SEP] identifier[getLabels] operator[SEP] identifier[result] , identifier[topN] operator[SEP] operator[SEP]
}
|
public static <E> E[] remove(E[] a, E e) {
List<E> list = remove(Arrays.asList(a), e);
return (E[])list.toArray();
} | class class_name[name] begin[{]
method[remove, return_type[type[E]], modifier[public static], parameter[a, e]] begin[{]
local_variable[type[List], list]
return[Cast(expression=MethodInvocation(arguments=[], member=toArray, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=E, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[E] operator[>] identifier[E] operator[SEP] operator[SEP] identifier[remove] operator[SEP] identifier[E] operator[SEP] operator[SEP] identifier[a] , identifier[E] identifier[e] operator[SEP] {
identifier[List] operator[<] identifier[E] operator[>] identifier[list] operator[=] identifier[remove] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[a] operator[SEP] , identifier[e] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[E] operator[SEP] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP]
}
|
private BaseType buildArrayTemplate(Element template, String indent)
throws DASException, NoSuchTypeException, BadSemanticsException {
BaseType bt = null;
if (_Debug) showXMLElement(template, indent + "...:");
// Get all of the Attribute elements (tagged <Attribute>)
Iterator attrElements = template.getChildren("Attribute", opendapNameSpace).iterator();
if (attrElements.hasNext())
throw new BadSemanticsException("Array Template Variables MAY NOT have Attributes");
// Build the appropriate BaseType from the tag.
bt = newBaseType(template);
if (_Debug) System.out.println("Got template: " + bt.getTypeName() + " " + bt.getClearName());
// Now we need to make sure this particular BaseType
// derived element isn't some special type that needs
// additional parsing:
// Is it a container?
if (bt instanceof DConstructor) {
// Up date the parsers state, (cache my parent)
DConstructor myParentDC = parentDC;
parentDC = (DConstructor) bt;
try {
// Grids are special containers, handle them
if (bt instanceof DGrid) {
parseGrid(template, indent);
} else {
// Otherwise, recurse on the children
for (Element child : template.getChildren()) {
parseBase(child, indent + " ");
}
}
} finally {
// restore my parent
parentDC = myParentDC;
}
}
return (bt);
} | class class_name[name] begin[{]
method[buildArrayTemplate, return_type[type[BaseType]], modifier[private], parameter[template, indent]] begin[{]
local_variable[type[BaseType], bt]
if[member[._Debug]] begin[{]
call[.showXMLElement, parameter[member[.template], binary_operation[member[.indent], +, literal["...:"]]]]
else begin[{]
None
end[}]
local_variable[type[Iterator], attrElements]
if[call[attrElements.hasNext, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Array Template Variables MAY NOT have Attributes")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BadSemanticsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.bt], call[.newBaseType, parameter[member[.template]]]]
if[member[._Debug]] begin[{]
call[System.out.println, parameter[binary_operation[binary_operation[binary_operation[literal["Got template: "], +, call[bt.getTypeName, parameter[]]], +, literal[" "]], +, call[bt.getClearName, parameter[]]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.bt], instanceof, type[DConstructor]]] begin[{]
local_variable[type[DConstructor], myParentDC]
assign[member[.parentDC], Cast(expression=MemberReference(member=bt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DConstructor, sub_type=None))]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=bt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=DGrid, sub_type=None), operator=instanceof), else_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=child, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=indent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+)], member=parseBase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getChildren, postfix_operators=[], prefix_operators=[], qualifier=template, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=child)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Element, sub_type=None))), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=template, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=indent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseGrid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=parentDC, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=myParentDC, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
return[member[.bt]]
end[}]
END[}] | Keyword[private] identifier[BaseType] identifier[buildArrayTemplate] operator[SEP] identifier[Element] identifier[template] , identifier[String] identifier[indent] operator[SEP] Keyword[throws] identifier[DASException] , identifier[NoSuchTypeException] , identifier[BadSemanticsException] {
identifier[BaseType] identifier[bt] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[_Debug] operator[SEP] identifier[showXMLElement] operator[SEP] identifier[template] , identifier[indent] operator[+] literal[String] operator[SEP] operator[SEP] identifier[Iterator] identifier[attrElements] operator[=] identifier[template] operator[SEP] identifier[getChildren] operator[SEP] literal[String] , identifier[opendapNameSpace] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attrElements] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[BadSemanticsException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[bt] operator[=] identifier[newBaseType] operator[SEP] identifier[template] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_Debug] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[+] identifier[bt] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[bt] operator[SEP] identifier[getClearName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bt] Keyword[instanceof] identifier[DConstructor] operator[SEP] {
identifier[DConstructor] identifier[myParentDC] operator[=] identifier[parentDC] operator[SEP] identifier[parentDC] operator[=] operator[SEP] identifier[DConstructor] operator[SEP] identifier[bt] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[bt] Keyword[instanceof] identifier[DGrid] operator[SEP] {
identifier[parseGrid] operator[SEP] identifier[template] , identifier[indent] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[for] operator[SEP] identifier[Element] identifier[child] operator[:] identifier[template] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] {
identifier[parseBase] operator[SEP] identifier[child] , identifier[indent] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
}
Keyword[finally] {
identifier[parentDC] operator[=] identifier[myParentDC] operator[SEP]
}
}
Keyword[return] operator[SEP] identifier[bt] operator[SEP] operator[SEP]
}
|
public ZealotKhala like(String field, Object value) {
return this.doLike(ZealotConst.ONE_SPACE, field, value, true, true);
} | class class_name[name] begin[{]
method[like, return_type[type[ZealotKhala]], modifier[public], parameter[field, value]] begin[{]
return[THIS[call[None.doLike, parameter[member[ZealotConst.ONE_SPACE], member[.field], member[.value], literal[true], literal[true]]]]]
end[}]
END[}] | Keyword[public] identifier[ZealotKhala] identifier[like] operator[SEP] identifier[String] identifier[field] , identifier[Object] identifier[value] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[doLike] operator[SEP] identifier[ZealotConst] operator[SEP] identifier[ONE_SPACE] , identifier[field] , identifier[value] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP]
}
|
public String applyTemplate(String aTemplate) {
String result = getEnvironment().processTemplate(aTemplate, getCurrentValues());
result = postProcess(result);
result = formatResult(aTemplate, result);
return result;
} | class class_name[name] begin[{]
method[applyTemplate, return_type[type[String]], modifier[public], parameter[aTemplate]] begin[{]
local_variable[type[String], result]
assign[member[.result], call[.postProcess, parameter[member[.result]]]]
assign[member[.result], call[.formatResult, parameter[member[.aTemplate], member[.result]]]]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[applyTemplate] operator[SEP] identifier[String] identifier[aTemplate] operator[SEP] {
identifier[String] identifier[result] operator[=] identifier[getEnvironment] operator[SEP] operator[SEP] operator[SEP] identifier[processTemplate] operator[SEP] identifier[aTemplate] , identifier[getCurrentValues] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[postProcess] operator[SEP] identifier[result] operator[SEP] operator[SEP] identifier[result] operator[=] identifier[formatResult] operator[SEP] identifier[aTemplate] , identifier[result] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
protected byte[] getBinaryData(Resource resource, @SuppressWarnings("unused") SlingHttpServletRequest request) throws IOException {
InputStream is = resource.adaptTo(InputStream.class);
if (is == null) {
return null;
}
try {
return IOUtils.toByteArray(is);
}
finally {
is.close();
}
} | class class_name[name] begin[{]
method[getBinaryData, return_type[type[byte]], modifier[protected], parameter[resource, request]] begin[{]
local_variable[type[InputStream], is]
if[binary_operation[member[.is], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=is, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toByteArray, postfix_operators=[], prefix_operators=[], qualifier=IOUtils, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=is, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[protected] Keyword[byte] operator[SEP] operator[SEP] identifier[getBinaryData] operator[SEP] identifier[Resource] identifier[resource] , annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[SlingHttpServletRequest] identifier[request] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[InputStream] identifier[is] operator[=] identifier[resource] operator[SEP] identifier[adaptTo] operator[SEP] identifier[InputStream] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[is] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[IOUtils] operator[SEP] identifier[toByteArray] operator[SEP] identifier[is] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[is] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public final <T> T fold(Function<? super L, ? extends T> left, Function<? super R, ? extends T> right) {
if (isLeft()) {
return left.apply(getLeft());
} else {
return right.apply(getRight());
}
} | class class_name[name] begin[{]
method[fold, return_type[type[T]], modifier[final public], parameter[left, right]] begin[{]
if[call[.isLeft, parameter[]]] begin[{]
return[call[left.apply, parameter[call[.getLeft, parameter[]]]]]
else begin[{]
return[call[right.apply, parameter[call[.getRight, parameter[]]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[final] operator[<] identifier[T] operator[>] identifier[T] identifier[fold] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[L] , operator[?] Keyword[extends] identifier[T] operator[>] identifier[left] , identifier[Function] operator[<] operator[?] Keyword[super] identifier[R] , operator[?] Keyword[extends] identifier[T] operator[>] identifier[right] operator[SEP] {
Keyword[if] operator[SEP] identifier[isLeft] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[left] operator[SEP] identifier[apply] operator[SEP] identifier[getLeft] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[right] operator[SEP] identifier[apply] operator[SEP] identifier[getRight] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static void forEachIndex(short[] input,boolean[] inputSkip,int[] output ,int outPutIndex,ForEachIndexController controller)
{
for(int i=0;i<input.length;i++)
{
if(inputSkip[i])
{
continue;
}
output[outPutIndex]=i;//输出当前位锁定值
ComputeStatus status=controller.onOutEvent(output, outPutIndex);
if(status.isStop())
{
return;
}
if(status.isSkip())
{//跳过下层循环
continue;
}
outPutIndex++;
if(outPutIndex>=input.length)
{//如果是最后一个则返回
break;
}
//解锁下一个
inputSkip[i]=true;//锁定当前位占用索引,其它位不可使用该索引
forEachIndex(input, inputSkip, output, outPutIndex,controller);
outPutIndex--;//回到当前
inputSkip[i]=false;//释放锁定
}
} | class class_name[name] begin[{]
method[forEachIndex, return_type[void], modifier[public static], parameter[input, inputSkip, output, outPutIndex, controller]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=inputSkip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=outPutIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outPutIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onOutEvent, postfix_operators=[], prefix_operators=[], qualifier=controller, selectors=[], type_arguments=None), name=status)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ComputeStatus, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isStop, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), IfStatement(condition=MethodInvocation(arguments=[], member=isSkip, postfix_operators=[], prefix_operators=[], qualifier=status, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MemberReference(member=outPutIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=outPutIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[]), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=inputSkip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=inputSkip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=outPutIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=controller, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forEachIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=outPutIndex, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=inputSkip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[forEachIndex] operator[SEP] Keyword[short] operator[SEP] operator[SEP] identifier[input] , Keyword[boolean] operator[SEP] operator[SEP] identifier[inputSkip] , Keyword[int] operator[SEP] operator[SEP] identifier[output] , Keyword[int] identifier[outPutIndex] , identifier[ForEachIndexController] identifier[controller] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[input] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[inputSkip] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[output] operator[SEP] identifier[outPutIndex] operator[SEP] operator[=] identifier[i] operator[SEP] identifier[ComputeStatus] identifier[status] operator[=] identifier[controller] operator[SEP] identifier[onOutEvent] operator[SEP] identifier[output] , identifier[outPutIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[status] operator[SEP] identifier[isStop] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[status] operator[SEP] identifier[isSkip] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[outPutIndex] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[outPutIndex] operator[>=] identifier[input] operator[SEP] identifier[length] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[inputSkip] operator[SEP] identifier[i] operator[SEP] operator[=] literal[boolean] operator[SEP] identifier[forEachIndex] operator[SEP] identifier[input] , identifier[inputSkip] , identifier[output] , identifier[outPutIndex] , identifier[controller] operator[SEP] operator[SEP] identifier[outPutIndex] operator[--] operator[SEP] identifier[inputSkip] operator[SEP] identifier[i] operator[SEP] operator[=] literal[boolean] operator[SEP]
}
}
|
public static <T extends NamedElement> ElementMatcher.Junction<T> nameEndsWithIgnoreCase(String suffix) {
return new NameMatcher<T>(new StringMatcher(suffix, StringMatcher.Mode.ENDS_WITH_IGNORE_CASE));
} | class class_name[name] begin[{]
method[nameEndsWithIgnoreCase, return_type[type[ElementMatcher]], modifier[public static], parameter[suffix]] begin[{]
return[ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=suffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ENDS_WITH_IGNORE_CASE, postfix_operators=[], prefix_operators=[], qualifier=StringMatcher.Mode, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StringMatcher, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=NameMatcher, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[NamedElement] operator[>] identifier[ElementMatcher] operator[SEP] identifier[Junction] operator[<] identifier[T] operator[>] identifier[nameEndsWithIgnoreCase] operator[SEP] identifier[String] identifier[suffix] operator[SEP] {
Keyword[return] Keyword[new] identifier[NameMatcher] operator[<] identifier[T] operator[>] operator[SEP] Keyword[new] identifier[StringMatcher] operator[SEP] identifier[suffix] , identifier[StringMatcher] operator[SEP] identifier[Mode] operator[SEP] identifier[ENDS_WITH_IGNORE_CASE] operator[SEP] operator[SEP] operator[SEP]
}
|
private void removeInactiveScopeOwnerByTeamId(String teamId) {
if (!StringUtils.isEmpty(teamId)
&& teamRepo.findByTeamId(teamId) != null) {
ObjectId inactiveTeamId = teamRepo.findByTeamId(teamId).getId();
if (inactiveTeamId != null) {
teamRepo.delete(inactiveTeamId);
}
}
} | class class_name[name] begin[{]
method[removeInactiveScopeOwnerByTeamId, return_type[void], modifier[private], parameter[teamId]] begin[{]
if[binary_operation[call[StringUtils.isEmpty, parameter[member[.teamId]]], &&, binary_operation[call[teamRepo.findByTeamId, parameter[member[.teamId]]], !=, literal[null]]]] begin[{]
local_variable[type[ObjectId], inactiveTeamId]
if[binary_operation[member[.inactiveTeamId], !=, literal[null]]] begin[{]
call[teamRepo.delete, parameter[member[.inactiveTeamId]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[removeInactiveScopeOwnerByTeamId] operator[SEP] identifier[String] identifier[teamId] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[isEmpty] operator[SEP] identifier[teamId] operator[SEP] operator[&&] identifier[teamRepo] operator[SEP] identifier[findByTeamId] operator[SEP] identifier[teamId] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[ObjectId] identifier[inactiveTeamId] operator[=] identifier[teamRepo] operator[SEP] identifier[findByTeamId] operator[SEP] identifier[teamId] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[inactiveTeamId] operator[!=] Other[null] operator[SEP] {
identifier[teamRepo] operator[SEP] identifier[delete] operator[SEP] identifier[inactiveTeamId] operator[SEP] operator[SEP]
}
}
}
|
private Glyph createControlStructure(Control ctrl) {
Glyph cg;
Set<PhysicalEntity> controllers = getControllers(ctrl);
// If no representable controller found, skip this control
if (controllers.isEmpty()) {
cg = null;
} else if (controllers.size() == 1 && getControllerSize(ctrl.getControlledOf()) == 0)
{ // If there is only one controller with no modulator, put an arc for controller
cg = getGlyphToLink(controllers.iterator().next(), convertID(ctrl.getUri()));
} else {
// This list will contain handles for each participant of the AND structure
List<Glyph> toConnect = new ArrayList<Glyph>();
// Bundle controllers if necessary
Glyph gg = handlePEGroup(controllers, convertID(ctrl.getUri()));
if(gg != null)
toConnect.add(gg);
// Handle co-factors of catalysis
if (ctrl instanceof Catalysis) {
Set<PhysicalEntity> cofs = ((Catalysis) ctrl).getCofactor();
Glyph g = handlePEGroup(cofs, convertID(ctrl.getUri()));
if (g != null)
toConnect.add(g);
}
if (toConnect.isEmpty()) {
return null;
} else if (toConnect.size() == 1) {
cg = toConnect.iterator().next();
} else {
cg = connectWithAND(toConnect);
}
}
return cg;
} | class class_name[name] begin[{]
method[createControlStructure, return_type[type[Glyph]], modifier[private], parameter[ctrl]] begin[{]
local_variable[type[Glyph], cg]
local_variable[type[Set], controllers]
if[call[controllers.isEmpty, parameter[]]] begin[{]
assign[member[.cg], literal[null]]
else begin[{]
if[binary_operation[binary_operation[call[controllers.size, parameter[]], ==, literal[1]], &&, binary_operation[call[.getControllerSize, parameter[call[ctrl.getControlledOf, parameter[]]]], ==, literal[0]]]] begin[{]
assign[member[.cg], call[.getGlyphToLink, parameter[call[controllers.iterator, parameter[]], call[.convertID, parameter[call[ctrl.getUri, parameter[]]]]]]]
else begin[{]
local_variable[type[List], toConnect]
local_variable[type[Glyph], gg]
if[binary_operation[member[.gg], !=, literal[null]]] begin[{]
call[toConnect.add, parameter[member[.gg]]]
else begin[{]
None
end[}]
if[binary_operation[member[.ctrl], instanceof, type[Catalysis]]] begin[{]
local_variable[type[Set], cofs]
local_variable[type[Glyph], g]
if[binary_operation[member[.g], !=, literal[null]]] begin[{]
call[toConnect.add, parameter[member[.g]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[call[toConnect.isEmpty, parameter[]]] begin[{]
return[literal[null]]
else begin[{]
if[binary_operation[call[toConnect.size, parameter[]], ==, literal[1]]] begin[{]
assign[member[.cg], call[toConnect.iterator, parameter[]]]
else begin[{]
assign[member[.cg], call[.connectWithAND, parameter[member[.toConnect]]]]
end[}]
end[}]
end[}]
end[}]
return[member[.cg]]
end[}]
END[}] | Keyword[private] identifier[Glyph] identifier[createControlStructure] operator[SEP] identifier[Control] identifier[ctrl] operator[SEP] {
identifier[Glyph] identifier[cg] operator[SEP] identifier[Set] operator[<] identifier[PhysicalEntity] operator[>] identifier[controllers] operator[=] identifier[getControllers] operator[SEP] identifier[ctrl] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[controllers] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[cg] operator[=] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[controllers] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[&&] identifier[getControllerSize] operator[SEP] identifier[ctrl] operator[SEP] identifier[getControlledOf] operator[SEP] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[cg] operator[=] identifier[getGlyphToLink] operator[SEP] identifier[controllers] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] , identifier[convertID] operator[SEP] identifier[ctrl] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[List] operator[<] identifier[Glyph] operator[>] identifier[toConnect] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Glyph] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Glyph] identifier[gg] operator[=] identifier[handlePEGroup] operator[SEP] identifier[controllers] , identifier[convertID] operator[SEP] identifier[ctrl] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[gg] operator[!=] Other[null] operator[SEP] identifier[toConnect] operator[SEP] identifier[add] operator[SEP] identifier[gg] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ctrl] Keyword[instanceof] identifier[Catalysis] operator[SEP] {
identifier[Set] operator[<] identifier[PhysicalEntity] operator[>] identifier[cofs] operator[=] operator[SEP] operator[SEP] identifier[Catalysis] operator[SEP] identifier[ctrl] operator[SEP] operator[SEP] identifier[getCofactor] operator[SEP] operator[SEP] operator[SEP] identifier[Glyph] identifier[g] operator[=] identifier[handlePEGroup] operator[SEP] identifier[cofs] , identifier[convertID] operator[SEP] identifier[ctrl] operator[SEP] identifier[getUri] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[g] operator[!=] Other[null] operator[SEP] identifier[toConnect] operator[SEP] identifier[add] operator[SEP] identifier[g] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[toConnect] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[toConnect] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[cg] operator[=] identifier[toConnect] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[cg] operator[=] identifier[connectWithAND] operator[SEP] identifier[toConnect] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[cg] operator[SEP]
}
|
public ListRateBasedRulesResult withRules(RuleSummary... rules) {
if (this.rules == null) {
setRules(new java.util.ArrayList<RuleSummary>(rules.length));
}
for (RuleSummary ele : rules) {
this.rules.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withRules, return_type[type[ListRateBasedRulesResult]], modifier[public], parameter[rules]] begin[{]
if[binary_operation[THIS[member[None.rules]], ==, literal[null]]] begin[{]
call[.setRules, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=rules, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=RuleSummary, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=rules, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rules, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RuleSummary, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ListRateBasedRulesResult] identifier[withRules] operator[SEP] identifier[RuleSummary] operator[...] identifier[rules] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[rules] operator[==] Other[null] operator[SEP] {
identifier[setRules] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[RuleSummary] operator[>] operator[SEP] identifier[rules] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[RuleSummary] identifier[ele] operator[:] identifier[rules] operator[SEP] {
Keyword[this] operator[SEP] identifier[rules] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.BAND_IMAGE__BCOUNT:
return BCOUNT_EDEFAULT == null ? bcount != null : !BCOUNT_EDEFAULT.equals(bcount);
case AfplibPackage.BAND_IMAGE__RG:
return rg != null && !rg.isEmpty();
}
return super.eIsSet(featureID);
} | class class_name[name] begin[{]
method[eIsSet, return_type[type[boolean]], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=BAND_IMAGE__BCOUNT, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=BCOUNT_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=bcount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=BCOUNT_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=bcount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)]), SwitchStatementCase(case=[MemberReference(member=BAND_IMAGE__RG, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=rg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=rg, selectors=[], type_arguments=None), operator=&&), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eIsSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[eIsSet] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[BAND_IMAGE__BCOUNT] operator[:] Keyword[return] identifier[BCOUNT_EDEFAULT] operator[==] Other[null] operator[?] identifier[bcount] operator[!=] Other[null] operator[:] operator[!] identifier[BCOUNT_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[bcount] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[BAND_IMAGE__RG] operator[:] Keyword[return] identifier[rg] operator[!=] Other[null] operator[&&] operator[!] identifier[rg] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eIsSet] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
public VideoParameters withCodecOptions(java.util.Map<String, String> codecOptions) {
setCodecOptions(codecOptions);
return this;
} | class class_name[name] begin[{]
method[withCodecOptions, return_type[type[VideoParameters]], modifier[public], parameter[codecOptions]] begin[{]
call[.setCodecOptions, parameter[member[.codecOptions]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[VideoParameters] identifier[withCodecOptions] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[codecOptions] operator[SEP] {
identifier[setCodecOptions] operator[SEP] identifier[codecOptions] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static <T> T unmarshal(InputStream is, final Class<T> type, Map<String, String> parameters) throws KubernetesClientException {
return unmarshal(is, new TypeReference<T>() {
@Override
public Type getType() {
return type;
}
}, parameters);
} | class class_name[name] begin[{]
method[unmarshal, return_type[type[T]], modifier[public static], parameter[is, type, parameters]] begin[{]
return[call[.unmarshal, parameter[member[.is], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[ReturnStatement(expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], documentation=None, modifiers={'public'}, name=getType, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Type, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=None, name=TypeReference, sub_type=None)), member[.parameters]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[unmarshal] operator[SEP] identifier[InputStream] identifier[is] , Keyword[final] identifier[Class] operator[<] identifier[T] operator[>] identifier[type] , identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[parameters] operator[SEP] Keyword[throws] identifier[KubernetesClientException] {
Keyword[return] identifier[unmarshal] operator[SEP] identifier[is] , Keyword[new] identifier[TypeReference] operator[<] identifier[T] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Type] identifier[getType] operator[SEP] operator[SEP] {
Keyword[return] identifier[type] operator[SEP]
}
} , identifier[parameters] operator[SEP] operator[SEP]
}
|
@Override
public String indexValue(String name, Object value) {
if (value == null) {
return null;
} else if (value instanceof ByteBuffer) {
ByteBuffer bb = (ByteBuffer) value;
return ByteBufferUtils.toHex(bb);
} else if (value instanceof byte[]) {
byte[] bytes = (byte[]) value;
return ByteBufferUtils.toHex(bytes);
} else if (value instanceof String) {
String string = (String) value;
string = string.replaceFirst("0x", "");
byte[] bytes = Hex.hexToBytes(string);
return Hex.bytesToHex(bytes);
} else {
throw new IllegalArgumentException(String.format("Value '%s' cannot be cast to byte array", value));
}
} | class class_name[name] begin[{]
method[indexValue, return_type[type[String]], modifier[public], parameter[name, value]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[ByteBuffer]]] begin[{]
local_variable[type[ByteBuffer], bb]
return[call[ByteBufferUtils.toHex, parameter[member[.bb]]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[byte]]] begin[{]
local_variable[type[byte], bytes]
return[call[ByteBufferUtils.toHex, parameter[member[.bytes]]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[String]]] begin[{]
local_variable[type[String], string]
assign[member[.string], call[string.replaceFirst, parameter[literal["0x"], literal[""]]]]
local_variable[type[byte], bytes]
return[call[Hex.bytesToHex, parameter[member[.bytes]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Value '%s' cannot be cast to byte array"), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[indexValue] operator[SEP] identifier[String] identifier[name] , identifier[Object] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[ByteBuffer] operator[SEP] {
identifier[ByteBuffer] identifier[bb] operator[=] operator[SEP] identifier[ByteBuffer] operator[SEP] identifier[value] operator[SEP] Keyword[return] identifier[ByteBufferUtils] operator[SEP] identifier[toHex] operator[SEP] identifier[bb] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[value] operator[SEP] Keyword[return] identifier[ByteBufferUtils] operator[SEP] identifier[toHex] operator[SEP] identifier[bytes] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[String] operator[SEP] {
identifier[String] identifier[string] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[value] operator[SEP] identifier[string] operator[=] identifier[string] operator[SEP] identifier[replaceFirst] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[Hex] operator[SEP] identifier[hexToBytes] operator[SEP] identifier[string] operator[SEP] operator[SEP] Keyword[return] identifier[Hex] operator[SEP] identifier[bytesToHex] operator[SEP] identifier[bytes] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static int cudaMemcpyToArrayAsync(cudaArray dst, long wOffset, long hOffset, Pointer src, long count, int cudaMemcpyKind_kind, cudaStream_t stream)
{
return checkResult(cudaMemcpyToArrayAsyncNative(dst, wOffset, hOffset, src, count, cudaMemcpyKind_kind, stream));
} | class class_name[name] begin[{]
method[cudaMemcpyToArrayAsync, return_type[type[int]], modifier[public static], parameter[dst, wOffset, hOffset, src, count, cudaMemcpyKind_kind, stream]] begin[{]
return[call[.checkResult, parameter[call[.cudaMemcpyToArrayAsyncNative, parameter[member[.dst], member[.wOffset], member[.hOffset], member[.src], member[.count], member[.cudaMemcpyKind_kind], member[.stream]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[cudaMemcpyToArrayAsync] operator[SEP] identifier[cudaArray] identifier[dst] , Keyword[long] identifier[wOffset] , Keyword[long] identifier[hOffset] , identifier[Pointer] identifier[src] , Keyword[long] identifier[count] , Keyword[int] identifier[cudaMemcpyKind_kind] , identifier[cudaStream_t] identifier[stream] operator[SEP] {
Keyword[return] identifier[checkResult] operator[SEP] identifier[cudaMemcpyToArrayAsyncNative] operator[SEP] identifier[dst] , identifier[wOffset] , identifier[hOffset] , identifier[src] , identifier[count] , identifier[cudaMemcpyKind_kind] , identifier[stream] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public FSDataOutputStream create(Path f, FsPermission permission,
boolean overwrite,
int bufferSize, short replication, long blockSize,
Progressable progress) throws IOException {
FSDataOutputStream fd = new FSDataOutputStream(
new CacheOutputStream(conf, this, f,
permission, overwrite, bufferSize,
replication, blockSize, progress));
return fd;
} | class class_name[name] begin[{]
method[create, return_type[type[FSDataOutputStream]], modifier[public], parameter[f, permission, overwrite, bufferSize, replication, blockSize, progress]] begin[{]
local_variable[type[FSDataOutputStream], fd]
return[member[.fd]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[FSDataOutputStream] identifier[create] operator[SEP] identifier[Path] identifier[f] , identifier[FsPermission] identifier[permission] , Keyword[boolean] identifier[overwrite] , Keyword[int] identifier[bufferSize] , Keyword[short] identifier[replication] , Keyword[long] identifier[blockSize] , identifier[Progressable] identifier[progress] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[FSDataOutputStream] identifier[fd] operator[=] Keyword[new] identifier[FSDataOutputStream] operator[SEP] Keyword[new] identifier[CacheOutputStream] operator[SEP] identifier[conf] , Keyword[this] , identifier[f] , identifier[permission] , identifier[overwrite] , identifier[bufferSize] , identifier[replication] , identifier[blockSize] , identifier[progress] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[fd] operator[SEP]
}
|
@Override
public void validate(ValidationHelper helper, Context context, String key, Contact t) {
if (t != null) {
String url = t.getUrl();
if (url != null) {
if (!ValidatorUtils.isValidURI(url)) {
final String message = Tr.formatMessage(tc, "contactInvalidURL", url);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("url"), message));
}
}
String email = t.getEmail();
if (email != null) {
if (!ValidatorUtils.isValidEmailAddress(email)) {
final String message = Tr.formatMessage(tc, "contactInvalidEmail", email);
helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("email"), message));
}
}
}
} | class class_name[name] begin[{]
method[validate, return_type[void], modifier[public], parameter[helper, context, key, t]] begin[{]
if[binary_operation[member[.t], !=, literal[null]]] begin[{]
local_variable[type[String], url]
if[binary_operation[member[.url], !=, literal[null]]] begin[{]
if[call[ValidatorUtils.isValidURI, parameter[member[.url]]]] begin[{]
local_variable[type[String], message]
call[helper.addValidationEvent, parameter[ClassCreator(arguments=[MemberReference(member=ERROR, postfix_operators=[], prefix_operators=[], qualifier=ValidationEvent.Severity, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="url")], member=getLocation, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ValidationEvent, sub_type=None))]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[String], email]
if[binary_operation[member[.email], !=, literal[null]]] begin[{]
if[call[ValidatorUtils.isValidEmailAddress, parameter[member[.email]]]] begin[{]
local_variable[type[String], message]
call[helper.addValidationEvent, parameter[ClassCreator(arguments=[MemberReference(member=ERROR, postfix_operators=[], prefix_operators=[], qualifier=ValidationEvent.Severity, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="email")], member=getLocation, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ValidationEvent, sub_type=None))]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[validate] operator[SEP] identifier[ValidationHelper] identifier[helper] , identifier[Context] identifier[context] , identifier[String] identifier[key] , identifier[Contact] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[url] operator[=] identifier[t] operator[SEP] identifier[getUrl] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[url] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[ValidatorUtils] operator[SEP] identifier[isValidURI] operator[SEP] identifier[url] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[message] operator[=] identifier[Tr] operator[SEP] identifier[formatMessage] operator[SEP] identifier[tc] , literal[String] , identifier[url] operator[SEP] operator[SEP] identifier[helper] operator[SEP] identifier[addValidationEvent] operator[SEP] Keyword[new] identifier[ValidationEvent] operator[SEP] identifier[ValidationEvent] operator[SEP] identifier[Severity] operator[SEP] identifier[ERROR] , identifier[context] operator[SEP] identifier[getLocation] operator[SEP] literal[String] operator[SEP] , identifier[message] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[String] identifier[email] operator[=] identifier[t] operator[SEP] identifier[getEmail] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[email] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[ValidatorUtils] operator[SEP] identifier[isValidEmailAddress] operator[SEP] identifier[email] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[message] operator[=] identifier[Tr] operator[SEP] identifier[formatMessage] operator[SEP] identifier[tc] , literal[String] , identifier[email] operator[SEP] operator[SEP] identifier[helper] operator[SEP] identifier[addValidationEvent] operator[SEP] Keyword[new] identifier[ValidationEvent] operator[SEP] identifier[ValidationEvent] operator[SEP] identifier[Severity] operator[SEP] identifier[ERROR] , identifier[context] operator[SEP] identifier[getLocation] operator[SEP] literal[String] operator[SEP] , identifier[message] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
@Override
public List<CommerceDiscountRel> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | class class_name[name] begin[{]
method[findAll, return_type[type[List]], modifier[public], parameter[]] begin[{]
return[call[.findAll, parameter[member[QueryUtil.ALL_POS], member[QueryUtil.ALL_POS], literal[null]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[List] operator[<] identifier[CommerceDiscountRel] operator[>] identifier[findAll] operator[SEP] operator[SEP] {
Keyword[return] identifier[findAll] operator[SEP] identifier[QueryUtil] operator[SEP] identifier[ALL_POS] , identifier[QueryUtil] operator[SEP] identifier[ALL_POS] , Other[null] operator[SEP] operator[SEP]
}
|
public static JSplitPane newJSplitPane(int newOrientation, boolean newContinuousLayout,
Component newLeftComponent, Component newRightComponent)
{
return new JSplitPane(newOrientation, newContinuousLayout, newLeftComponent,
newRightComponent);
} | class class_name[name] begin[{]
method[newJSplitPane, return_type[type[JSplitPane]], modifier[public static], parameter[newOrientation, newContinuousLayout, newLeftComponent, newRightComponent]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=newOrientation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newContinuousLayout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newLeftComponent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newRightComponent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSplitPane, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[JSplitPane] identifier[newJSplitPane] operator[SEP] Keyword[int] identifier[newOrientation] , Keyword[boolean] identifier[newContinuousLayout] , identifier[Component] identifier[newLeftComponent] , identifier[Component] identifier[newRightComponent] operator[SEP] {
Keyword[return] Keyword[new] identifier[JSplitPane] operator[SEP] identifier[newOrientation] , identifier[newContinuousLayout] , identifier[newLeftComponent] , identifier[newRightComponent] operator[SEP] operator[SEP]
}
|
public String getValue(String entityName) {
notNull(entityName, "Entity name");
final T entity = get(entityName);
if(entity == null) {
return null;
}
return entity.getValue();
} | class class_name[name] begin[{]
method[getValue, return_type[type[String]], modifier[public], parameter[entityName]] begin[{]
call[.notNull, parameter[member[.entityName], literal["Entity name"]]]
local_variable[type[T], entity]
if[binary_operation[member[.entity], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[entity.getValue, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getValue] operator[SEP] identifier[String] identifier[entityName] operator[SEP] {
identifier[notNull] operator[SEP] identifier[entityName] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[T] identifier[entity] operator[=] identifier[get] operator[SEP] identifier[entityName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entity] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[entity] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void writeFile(CompoundTag tag, String path) throws IOException {
writeFile(tag, new File(path));
} | class class_name[name] begin[{]
method[writeFile, return_type[void], modifier[public static], parameter[tag, path]] begin[{]
call[.writeFile, parameter[member[.tag], ClassCreator(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[writeFile] operator[SEP] identifier[CompoundTag] identifier[tag] , identifier[String] identifier[path] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[writeFile] operator[SEP] identifier[tag] , Keyword[new] identifier[File] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP]
}
|
public Set<CurrencyUnit> getCurrencies(Locale locale, String... providers) {
return getCurrencies(CurrencyQueryBuilder.of().setCountries(locale).setProviderNames(providers).build());
} | class class_name[name] begin[{]
method[getCurrencies, return_type[type[Set]], modifier[public], parameter[locale, providers]] begin[{]
return[call[.getCurrencies, parameter[call[CurrencyQueryBuilder.of, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[Set] operator[<] identifier[CurrencyUnit] operator[>] identifier[getCurrencies] operator[SEP] identifier[Locale] identifier[locale] , identifier[String] operator[...] identifier[providers] operator[SEP] {
Keyword[return] identifier[getCurrencies] operator[SEP] identifier[CurrencyQueryBuilder] operator[SEP] identifier[of] operator[SEP] operator[SEP] operator[SEP] identifier[setCountries] operator[SEP] identifier[locale] operator[SEP] operator[SEP] identifier[setProviderNames] operator[SEP] identifier[providers] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://www.w3.org/1998/Math/MathML", name = "complexes")
public JAXBElement<ConstantType> createComplexes(ConstantType value) {
return new JAXBElement<ConstantType>(_Complexes_QNAME, ConstantType.class, null, value);
} | class class_name[name] begin[{]
method[createComplexes, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_Complexes_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConstantType, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ConstantType, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[ConstantType] operator[>] identifier[createComplexes] operator[SEP] identifier[ConstantType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[ConstantType] operator[>] operator[SEP] identifier[_Complexes_QNAME] , identifier[ConstantType] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
@Override
public void setParameters(Object[] params) throws CDKException {
if (params.length > 1) {
throw new CDKException("BondCount only expects one parameter");
}
if (!(params[0] instanceof String)) {
throw new CDKException("The parameter must be of type IBond.Order");
}
String bondType = (String) params[0];
if (bondType.length() > 1 || !"sdtq".contains(bondType)) {
throw new CDKException("The only allowed values for this parameter are 's', 'd', 't', 'q' and ''.");
}
// ok, all should be fine
order = bondType;
} | class class_name[name] begin[{]
method[setParameters, return_type[void], modifier[public], parameter[params]] begin[{]
if[binary_operation[member[params.length], >, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BondCount only expects one parameter")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CDKException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.params], instanceof, type[String]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The parameter must be of type IBond.Order")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CDKException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], bondType]
if[binary_operation[binary_operation[call[bondType.length, parameter[]], >, literal[1]], ||, literal["sdtq"]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The only allowed values for this parameter are 's', 'd', 't', 'q' and ''.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CDKException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.order], member[.bondType]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setParameters] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[params] operator[SEP] Keyword[throws] identifier[CDKException] {
Keyword[if] operator[SEP] identifier[params] operator[SEP] identifier[length] operator[>] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CDKException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[params] operator[SEP] Other[0] operator[SEP] Keyword[instanceof] identifier[String] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CDKException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[bondType] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[params] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[bondType] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[1] operator[||] operator[!] literal[String] operator[SEP] identifier[contains] operator[SEP] identifier[bondType] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CDKException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[order] operator[=] identifier[bondType] operator[SEP]
}
|
public static void disposeOf(final ObjectMap<?, ? extends Disposable> disposables) {
if (disposables != null) {
for (final Disposable disposable : disposables.values()) {
disposeOf(disposable);
}
}
} | class class_name[name] begin[{]
method[disposeOf, return_type[void], modifier[public static], parameter[disposables]] begin[{]
if[binary_operation[member[.disposables], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=disposable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=disposeOf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=disposables, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=disposable)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Disposable, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[disposeOf] operator[SEP] Keyword[final] identifier[ObjectMap] operator[<] operator[?] , operator[?] Keyword[extends] identifier[Disposable] operator[>] identifier[disposables] operator[SEP] {
Keyword[if] operator[SEP] identifier[disposables] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[Disposable] identifier[disposable] operator[:] identifier[disposables] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
identifier[disposeOf] operator[SEP] identifier[disposable] operator[SEP] operator[SEP]
}
}
}
|
public void spare_spare_returnMerchandise_POST(String spare) throws IOException {
String qPath = "/xdsl/spare/{spare}/returnMerchandise";
StringBuilder sb = path(qPath, spare);
exec(qPath, "POST", sb.toString(), null);
} | class class_name[name] begin[{]
method[spare_spare_returnMerchandise_POST, return_type[void], modifier[public], parameter[spare]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
call[.exec, parameter[member[.qPath], literal["POST"], call[sb.toString, parameter[]], literal[null]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[spare_spare_returnMerchandise_POST] operator[SEP] identifier[String] identifier[spare] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[spare] operator[SEP] operator[SEP] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
|
@UsedByGeneratedCode
public static boolean ivicheck(int ids, String nameAndDescriptor) {
// Check 1: FAST: Has anything at all been reloaded?
if (nothingReloaded) {
return false;
}
// if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINER)) {
// log.entering("TypeRegistry", "ivicheck", new Object[] { ids, nameAndDescriptor });
// }
// TODO [perf] global check (anything been reloaded?)
// TODO [perf] local check (type or anything in its hierarchy reloaded)
int registryId = ids >>> 16;
int typeId = ids & 0xffff;
TypeRegistry typeRegistry = registryInstances[registryId].get();
ReloadableType reloadableType = typeRegistry.getReloadableType(typeId);
// Ok, think about what null means here. It means this registry has not loaded this type as a reloadable type. That doesn't
// mean it isn't reloadable as a parent loaded may have found it. We have 3 options:
// 1. assume names are unique - we can look up this type and find the registry in question
// 2. assume delegating classloaders and search the parent registry for it
// 3. pass something in at the call site (the class obejct), this would give us the classloader and thus the registry
// 3 is ideal, but slower. 2 is nice but not always safe. 1 will work in a lot of situations.
// let's try with a (2) strategy, fallback on a (1) - when we revisit this we can end up doing (3) maybe...
// TODO [grails] We need a sentinel to indicate that we've had a look, so that we dont go off searching every time, but for now, lets
// just do the search:
if (reloadableType == null) {
reloadableType = searchForReloadableType(typeId, typeRegistry);
}
// Check 2: Info computed earlier
if (reloadableType != null && !reloadableType.isAffectedByReload()) {
return false;
}
if (reloadableType != null && reloadableType.hasBeenReloaded()) {
MethodMember method = reloadableType.getLiveVersion().incrementalTypeDescriptor.getFromLatestByDescriptor(
nameAndDescriptor);
boolean dispatchThroughDescriptor = false;
if (method == null) {
if (!reloadableType.getTypeDescriptor().isFinalInHierarchy(nameAndDescriptor)) {
// Reloading has occurred and method does not exist in new version, throw NSME
throw new NoSuchMethodError(reloadableType.getBaseName() + "." + nameAndDescriptor);
}
}
else if (IncrementalTypeDescriptor.isBrandNewMethod(method)) {
// Reloading has occurred and method has been added (it wasn't in the original) definetly need to use the dispatcher
dispatchThroughDescriptor = true;
}
else if (IncrementalTypeDescriptor.hasChanged(method)) {
// Reloading has occurred and the method has changed in some way
// Method has been deleted - let the catcher/new generated dispatcher deal with it
if (!IncrementalTypeDescriptor.isCatcher(method)) {
if (!IncrementalTypeDescriptor.wasDeleted(method)) {
// Don't want to call the one that was there!
dispatchThroughDescriptor = true;
}
// } else if (IncrementalTypeDescriptor.wasDeleted(method)) {
// // The method is a catcher because it used to be there, it no longer is
// dispatchThroughDescriptor = true;
}
}
if (dispatchThroughDescriptor) {
if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINER)) {
log.info("versionstamp " + reloadableType.getLiveVersion().versionstamp);
log.exiting("TypeRegistry", "ivicheck", true);
}
return true;
}
}
// if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINER)) {
// log.exiting("TypeRegistry", "ivicheck", true);
// }
return false;
} | class class_name[name] begin[{]
method[ivicheck, return_type[type[boolean]], modifier[public static], parameter[ids, nameAndDescriptor]] begin[{]
if[member[.nothingReloaded]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[int], registryId]
local_variable[type[int], typeId]
local_variable[type[TypeRegistry], typeRegistry]
local_variable[type[ReloadableType], reloadableType]
if[binary_operation[member[.reloadableType], ==, literal[null]]] begin[{]
assign[member[.reloadableType], call[.searchForReloadableType, parameter[member[.typeId], member[.typeRegistry]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.reloadableType], !=, literal[null]], &&, call[reloadableType.isAffectedByReload, parameter[]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.reloadableType], !=, literal[null]], &&, call[reloadableType.hasBeenReloaded, parameter[]]]] begin[{]
local_variable[type[MethodMember], method]
local_variable[type[boolean], dispatchThroughDescriptor]
if[binary_operation[member[.method], ==, literal[null]]] begin[{]
if[call[reloadableType.getTypeDescriptor, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getBaseName, postfix_operators=[], prefix_operators=[], qualifier=reloadableType, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), operator=+), operandr=MemberReference(member=nameAndDescriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchMethodError, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
if[call[IncrementalTypeDescriptor.isBrandNewMethod, parameter[member[.method]]]] begin[{]
assign[member[.dispatchThroughDescriptor], literal[true]]
else begin[{]
if[call[IncrementalTypeDescriptor.hasChanged, parameter[member[.method]]]] begin[{]
if[call[IncrementalTypeDescriptor.isCatcher, parameter[member[.method]]]] begin[{]
if[call[IncrementalTypeDescriptor.wasDeleted, parameter[member[.method]]]] begin[{]
assign[member[.dispatchThroughDescriptor], literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
end[}]
if[member[.dispatchThroughDescriptor]] begin[{]
if[binary_operation[member[GlobalConfiguration.isRuntimeLogging], &&, call[log.isLoggable, parameter[member[Level.FINER]]]]] begin[{]
call[log.info, parameter[binary_operation[literal["versionstamp "], +, call[reloadableType.getLiveVersion, parameter[]]]]]
call[log.exiting, parameter[literal["TypeRegistry"], literal["ivicheck"], literal[true]]]
else begin[{]
None
end[}]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | annotation[@] identifier[UsedByGeneratedCode] Keyword[public] Keyword[static] Keyword[boolean] identifier[ivicheck] operator[SEP] Keyword[int] identifier[ids] , identifier[String] identifier[nameAndDescriptor] operator[SEP] {
Keyword[if] operator[SEP] identifier[nothingReloaded] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[int] identifier[registryId] operator[=] identifier[ids] operator[>] operator[>] operator[>] Other[16] operator[SEP] Keyword[int] identifier[typeId] operator[=] identifier[ids] operator[&] literal[Integer] operator[SEP] identifier[TypeRegistry] identifier[typeRegistry] operator[=] identifier[registryInstances] operator[SEP] identifier[registryId] operator[SEP] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[ReloadableType] identifier[reloadableType] operator[=] identifier[typeRegistry] operator[SEP] identifier[getReloadableType] operator[SEP] identifier[typeId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[reloadableType] operator[==] Other[null] operator[SEP] {
identifier[reloadableType] operator[=] identifier[searchForReloadableType] operator[SEP] identifier[typeId] , identifier[typeRegistry] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[reloadableType] operator[!=] Other[null] operator[&&] operator[!] identifier[reloadableType] operator[SEP] identifier[isAffectedByReload] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] identifier[reloadableType] operator[!=] Other[null] operator[&&] identifier[reloadableType] operator[SEP] identifier[hasBeenReloaded] operator[SEP] operator[SEP] operator[SEP] {
identifier[MethodMember] identifier[method] operator[=] identifier[reloadableType] operator[SEP] identifier[getLiveVersion] operator[SEP] operator[SEP] operator[SEP] identifier[incrementalTypeDescriptor] operator[SEP] identifier[getFromLatestByDescriptor] operator[SEP] identifier[nameAndDescriptor] operator[SEP] operator[SEP] Keyword[boolean] identifier[dispatchThroughDescriptor] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[method] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[reloadableType] operator[SEP] identifier[getTypeDescriptor] operator[SEP] operator[SEP] operator[SEP] identifier[isFinalInHierarchy] operator[SEP] identifier[nameAndDescriptor] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NoSuchMethodError] operator[SEP] identifier[reloadableType] operator[SEP] identifier[getBaseName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[nameAndDescriptor] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[IncrementalTypeDescriptor] operator[SEP] identifier[isBrandNewMethod] operator[SEP] identifier[method] operator[SEP] operator[SEP] {
identifier[dispatchThroughDescriptor] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[IncrementalTypeDescriptor] operator[SEP] identifier[hasChanged] operator[SEP] identifier[method] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[IncrementalTypeDescriptor] operator[SEP] identifier[isCatcher] operator[SEP] identifier[method] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[IncrementalTypeDescriptor] operator[SEP] identifier[wasDeleted] operator[SEP] identifier[method] operator[SEP] operator[SEP] {
identifier[dispatchThroughDescriptor] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[dispatchThroughDescriptor] operator[SEP] {
Keyword[if] operator[SEP] identifier[GlobalConfiguration] operator[SEP] identifier[isRuntimeLogging] operator[&&] identifier[log] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINER] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[reloadableType] operator[SEP] identifier[getLiveVersion] operator[SEP] operator[SEP] operator[SEP] identifier[versionstamp] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[exiting] operator[SEP] literal[String] , literal[String] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void alias(DMatrixRMaj variable , String name ) {
if( isReserved(name))
throw new RuntimeException("Reserved word or contains a reserved character");
VariableMatrix old = (VariableMatrix)variables.get(name);
if( old == null ) {
variables.put(name, new VariableMatrix(variable));
}else {
old.matrix = variable;
}
} | class class_name[name] begin[{]
method[alias, return_type[void], modifier[public], parameter[variable, name]] begin[{]
if[call[.isReserved, parameter[member[.name]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Reserved word or contains a reserved character")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[VariableMatrix], old]
if[binary_operation[member[.old], ==, literal[null]]] begin[{]
call[variables.put, parameter[member[.name], ClassCreator(arguments=[MemberReference(member=variable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=VariableMatrix, sub_type=None))]]
else begin[{]
assign[member[old.matrix], member[.variable]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[alias] operator[SEP] identifier[DMatrixRMaj] identifier[variable] , identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[isReserved] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[VariableMatrix] identifier[old] operator[=] operator[SEP] identifier[VariableMatrix] operator[SEP] identifier[variables] operator[SEP] identifier[get] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[old] operator[==] Other[null] operator[SEP] {
identifier[variables] operator[SEP] identifier[put] operator[SEP] identifier[name] , Keyword[new] identifier[VariableMatrix] operator[SEP] identifier[variable] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[old] operator[SEP] identifier[matrix] operator[=] identifier[variable] operator[SEP]
}
}
|
public void sendRoomInvitation(RoomInvitation.Type type, Jid invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final RoomInvitation invitation = new RoomInvitation(type, invitee, sessionID, reason);
IQ iq = new RoomInvitation.RoomInvitationIQ(invitation);
iq.setType(IQ.Type.set);
iq.setTo(workgroupJID);
iq.setFrom(connection.getUser());
connection.createStanzaCollectorAndSend(iq).nextResultOrThrow();
} | class class_name[name] begin[{]
method[sendRoomInvitation, return_type[void], modifier[public], parameter[type, invitee, sessionID, reason]] begin[{]
local_variable[type[RoomInvitation], invitation]
local_variable[type[IQ], iq]
call[iq.setType, parameter[member[IQ.Type.set]]]
call[iq.setTo, parameter[member[.workgroupJID]]]
call[iq.setFrom, parameter[call[connection.getUser, parameter[]]]]
call[connection.createStanzaCollectorAndSend, parameter[member[.iq]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[sendRoomInvitation] operator[SEP] identifier[RoomInvitation] operator[SEP] identifier[Type] identifier[type] , identifier[Jid] identifier[invitee] , identifier[String] identifier[sessionID] , identifier[String] identifier[reason] operator[SEP] Keyword[throws] identifier[NoResponseException] , identifier[XMPPErrorException] , identifier[NotConnectedException] , identifier[InterruptedException] {
Keyword[final] identifier[RoomInvitation] identifier[invitation] operator[=] Keyword[new] identifier[RoomInvitation] operator[SEP] identifier[type] , identifier[invitee] , identifier[sessionID] , identifier[reason] operator[SEP] operator[SEP] identifier[IQ] identifier[iq] operator[=] Keyword[new] identifier[RoomInvitation] operator[SEP] identifier[RoomInvitationIQ] operator[SEP] identifier[invitation] operator[SEP] operator[SEP] identifier[iq] operator[SEP] identifier[setType] operator[SEP] identifier[IQ] operator[SEP] identifier[Type] operator[SEP] identifier[set] operator[SEP] operator[SEP] identifier[iq] operator[SEP] identifier[setTo] operator[SEP] identifier[workgroupJID] operator[SEP] operator[SEP] identifier[iq] operator[SEP] identifier[setFrom] operator[SEP] identifier[connection] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[connection] operator[SEP] identifier[createStanzaCollectorAndSend] operator[SEP] identifier[iq] operator[SEP] operator[SEP] identifier[nextResultOrThrow] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setDefaultAnswer(String variable) {
if (!isSubmitType()) {
throw new IllegalStateException("Cannot set an answer if the form is not of type " +
"\"submit\"");
}
FormField field = getField(variable);
if (field != null) {
// Clear the old values
field.resetValues();
// Set the default value
for (CharSequence value : field.getValues()) {
field.addValue(value);
}
}
else {
throw new IllegalArgumentException("Couldn't find a field for the specified variable.");
}
} | class class_name[name] begin[{]
method[setDefaultAnswer, return_type[void], modifier[public], parameter[variable]] begin[{]
if[call[.isSubmitType, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot set an answer if the form is not of type "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\"submit\""), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[FormField], field]
if[binary_operation[member[.field], !=, literal[null]]] begin[{]
call[field.resetValues, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addValue, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getValues, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CharSequence, sub_type=None))), label=None)
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Couldn't find a field for the specified variable.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setDefaultAnswer] operator[SEP] identifier[String] identifier[variable] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isSubmitType] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[FormField] identifier[field] operator[=] identifier[getField] operator[SEP] identifier[variable] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[field] operator[!=] Other[null] operator[SEP] {
identifier[field] operator[SEP] identifier[resetValues] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CharSequence] identifier[value] operator[:] identifier[field] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] operator[SEP] {
identifier[field] operator[SEP] identifier[addValue] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public void addShutdownConstraint (ShutdownComponent lhs, Constraint constraint,
ShutdownComponent rhs)
{
if (lhs == null || rhs == null) {
throw new IllegalArgumentException("Cannot add constraint about null component.");
}
ShutdownComponent before = (constraint == Constraint.RUNS_BEFORE) ? lhs : rhs;
ShutdownComponent after = (constraint == Constraint.RUNS_BEFORE) ? rhs : lhs;
_downers.addDependency(after, before);
} | class class_name[name] begin[{]
method[addShutdownConstraint, return_type[void], modifier[public], parameter[lhs, constraint, rhs]] begin[{]
if[binary_operation[binary_operation[member[.lhs], ==, literal[null]], ||, binary_operation[member[.rhs], ==, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot add constraint about null component.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ShutdownComponent], before]
local_variable[type[ShutdownComponent], after]
call[_downers.addDependency, parameter[member[.after], member[.before]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addShutdownConstraint] operator[SEP] identifier[ShutdownComponent] identifier[lhs] , identifier[Constraint] identifier[constraint] , identifier[ShutdownComponent] identifier[rhs] operator[SEP] {
Keyword[if] operator[SEP] identifier[lhs] operator[==] Other[null] operator[||] identifier[rhs] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ShutdownComponent] identifier[before] operator[=] operator[SEP] identifier[constraint] operator[==] identifier[Constraint] operator[SEP] identifier[RUNS_BEFORE] operator[SEP] operator[?] identifier[lhs] operator[:] identifier[rhs] operator[SEP] identifier[ShutdownComponent] identifier[after] operator[=] operator[SEP] identifier[constraint] operator[==] identifier[Constraint] operator[SEP] identifier[RUNS_BEFORE] operator[SEP] operator[?] identifier[rhs] operator[:] identifier[lhs] operator[SEP] identifier[_downers] operator[SEP] identifier[addDependency] operator[SEP] identifier[after] , identifier[before] operator[SEP] operator[SEP]
}
|
public static SurgeConfirmationError parseSurgeConfirmationError(Gson gson, RetrofitError retrofitError) throws IOException {
String body = IOUtils.toString(retrofitError.getResponse().getBody().in(), "UTF-8");
IOUtils.closeQuietly(retrofitError.getResponse().getBody().in());
return gson.fromJson(body, SurgeConfirmationError.class);
} | class class_name[name] begin[{]
method[parseSurgeConfirmationError, return_type[type[SurgeConfirmationError]], modifier[public static], parameter[gson, retrofitError]] begin[{]
local_variable[type[String], body]
call[IOUtils.closeQuietly, parameter[call[retrofitError.getResponse, parameter[]]]]
return[call[gson.fromJson, parameter[member[.body], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SurgeConfirmationError, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SurgeConfirmationError] identifier[parseSurgeConfirmationError] operator[SEP] identifier[Gson] identifier[gson] , identifier[RetrofitError] identifier[retrofitError] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[body] operator[=] identifier[IOUtils] operator[SEP] identifier[toString] operator[SEP] identifier[retrofitError] operator[SEP] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] identifier[getBody] operator[SEP] operator[SEP] operator[SEP] identifier[in] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] identifier[IOUtils] operator[SEP] identifier[closeQuietly] operator[SEP] identifier[retrofitError] operator[SEP] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] identifier[getBody] operator[SEP] operator[SEP] operator[SEP] identifier[in] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[gson] operator[SEP] identifier[fromJson] operator[SEP] identifier[body] , identifier[SurgeConfirmationError] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
private void updateCompoundBounds(Glyph parent,List<Glyph> childGlyphs)
{
float PAD = (float) 2.0;
float minX = Float.MAX_VALUE; float minY = Float.MAX_VALUE;
float maxX = Float.MIN_VALUE; float maxY = Float.MIN_VALUE;
for (Glyph tmpGlyph : childGlyphs)
{
if(!glyphClazzOneOf(tmpGlyph, GlyphClazz.UNIT_OF_INFORMATION, GlyphClazz.STATE_VARIABLE))
{
if(tmpGlyph.getGlyph().size() > 0)
updateCompoundBounds(tmpGlyph, tmpGlyph.getGlyph());
float w = tmpGlyph.getBbox().getW();
float h = tmpGlyph.getBbox().getH();
// Verify MIN and MAX x/y again:
minX = Math.min(minX, (tmpGlyph.getBbox().getX()));
minY = Math.min(minY, (tmpGlyph.getBbox().getY()));
maxX = Math.max(maxX, (tmpGlyph.getBbox().getX())+w);
maxY = Math.max(maxY, (tmpGlyph.getBbox().getY())+h);
if (minX == Float.MAX_VALUE) minX = 0;
if (minY == Float.MAX_VALUE) minY = 0;
if (maxX == Float.MIN_VALUE) maxX = 0;
if (maxY == Float.MIN_VALUE) maxY = 0;
parent.getBbox().setX(minX - PAD);
parent.getBbox().setY(minY - PAD);
parent.getBbox().setW(maxX - parent.getBbox().getX() + PAD);
parent.getBbox().setH(maxY - parent.getBbox().getY() + PAD);
}
}
} | class class_name[name] begin[{]
method[updateCompoundBounds, return_type[void], modifier[private], parameter[parent, childGlyphs]] begin[{]
local_variable[type[float], PAD]
local_variable[type[float], minX]
local_variable[type[float], minY]
local_variable[type[float], maxX]
local_variable[type[float], maxY]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=tmpGlyph, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=UNIT_OF_INFORMATION, postfix_operators=[], prefix_operators=[], qualifier=GlyphClazz, selectors=[]), MemberReference(member=STATE_VARIABLE, postfix_operators=[], prefix_operators=[], qualifier=GlyphClazz, selectors=[])], member=glyphClazzOneOf, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getGlyph, postfix_operators=[], prefix_operators=[], qualifier=tmpGlyph, selectors=[MethodInvocation(arguments=[], member=size, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tmpGlyph, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getGlyph, postfix_operators=[], prefix_operators=[], qualifier=tmpGlyph, selectors=[], type_arguments=None)], member=updateCompoundBounds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=tmpGlyph, selectors=[MethodInvocation(arguments=[], member=getW, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=w)], modifiers=set(), type=BasicType(dimensions=[], name=float)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=tmpGlyph, selectors=[MethodInvocation(arguments=[], member=getH, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=h)], modifiers=set(), type=BasicType(dimensions=[], name=float)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=minX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=minX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=tmpGlyph, selectors=[], type_arguments=None)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=minY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=minY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=tmpGlyph, selectors=[], type_arguments=None)], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=maxX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=tmpGlyph, selectors=[], type_arguments=None), operandr=MemberReference(member=w, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=max, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=maxY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=tmpGlyph, selectors=[], type_arguments=None), operandr=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=max, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=minX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Float, selectors=[]), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=minX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=minY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MAX_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Float, selectors=[]), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=minY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=maxX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MIN_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Float, selectors=[]), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=maxY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=MIN_VALUE, postfix_operators=[], prefix_operators=[], qualifier=Float, selectors=[]), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=maxY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), label=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=minX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=PAD, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=setX, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=minY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=PAD, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=setY, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=maxX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[MethodInvocation(arguments=[], member=getX, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=-), operandr=MemberReference(member=PAD, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=setW, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=maxY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getBbox, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[MethodInvocation(arguments=[], member=getY, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=-), operandr=MemberReference(member=PAD, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=setH, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=childGlyphs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tmpGlyph)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Glyph, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[updateCompoundBounds] operator[SEP] identifier[Glyph] identifier[parent] , identifier[List] operator[<] identifier[Glyph] operator[>] identifier[childGlyphs] operator[SEP] {
Keyword[float] identifier[PAD] operator[=] operator[SEP] Keyword[float] operator[SEP] literal[Float] operator[SEP] Keyword[float] identifier[minX] operator[=] identifier[Float] operator[SEP] identifier[MAX_VALUE] operator[SEP] Keyword[float] identifier[minY] operator[=] identifier[Float] operator[SEP] identifier[MAX_VALUE] operator[SEP] Keyword[float] identifier[maxX] operator[=] identifier[Float] operator[SEP] identifier[MIN_VALUE] operator[SEP] Keyword[float] identifier[maxY] operator[=] identifier[Float] operator[SEP] identifier[MIN_VALUE] operator[SEP] Keyword[for] operator[SEP] identifier[Glyph] identifier[tmpGlyph] operator[:] identifier[childGlyphs] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[glyphClazzOneOf] operator[SEP] identifier[tmpGlyph] , identifier[GlyphClazz] operator[SEP] identifier[UNIT_OF_INFORMATION] , identifier[GlyphClazz] operator[SEP] identifier[STATE_VARIABLE] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[tmpGlyph] operator[SEP] identifier[getGlyph] operator[SEP] operator[SEP] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] identifier[updateCompoundBounds] operator[SEP] identifier[tmpGlyph] , identifier[tmpGlyph] operator[SEP] identifier[getGlyph] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[w] operator[=] identifier[tmpGlyph] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[getW] operator[SEP] operator[SEP] operator[SEP] Keyword[float] identifier[h] operator[=] identifier[tmpGlyph] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[getH] operator[SEP] operator[SEP] operator[SEP] identifier[minX] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[minX] , operator[SEP] identifier[tmpGlyph] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[minY] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[minY] , operator[SEP] identifier[tmpGlyph] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[maxX] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[maxX] , operator[SEP] identifier[tmpGlyph] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[SEP] operator[+] identifier[w] operator[SEP] operator[SEP] identifier[maxY] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[maxY] , operator[SEP] identifier[tmpGlyph] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[SEP] operator[+] identifier[h] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[minX] operator[==] identifier[Float] operator[SEP] identifier[MAX_VALUE] operator[SEP] identifier[minX] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[minY] operator[==] identifier[Float] operator[SEP] identifier[MAX_VALUE] operator[SEP] identifier[minY] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[maxX] operator[==] identifier[Float] operator[SEP] identifier[MIN_VALUE] operator[SEP] identifier[maxX] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[maxY] operator[==] identifier[Float] operator[SEP] identifier[MIN_VALUE] operator[SEP] identifier[maxY] operator[=] Other[0] operator[SEP] identifier[parent] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[setX] operator[SEP] identifier[minX] operator[-] identifier[PAD] operator[SEP] operator[SEP] identifier[parent] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[setY] operator[SEP] identifier[minY] operator[-] identifier[PAD] operator[SEP] operator[SEP] identifier[parent] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[setW] operator[SEP] identifier[maxX] operator[-] identifier[parent] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[+] identifier[PAD] operator[SEP] operator[SEP] identifier[parent] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[setH] operator[SEP] identifier[maxY] operator[-] identifier[parent] operator[SEP] identifier[getBbox] operator[SEP] operator[SEP] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[+] identifier[PAD] operator[SEP] operator[SEP]
}
}
}
|
@Override
public final IoBuffer put(byte[] src, int offset, int length) {
autoExpand(length);
buf().put(src, offset, length);
return this;
} | class class_name[name] begin[{]
method[put, return_type[type[IoBuffer]], modifier[final public], parameter[src, offset, length]] begin[{]
call[.autoExpand, parameter[member[.length]]]
call[.buf, parameter[]]
return[THIS[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] identifier[IoBuffer] identifier[put] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[src] , Keyword[int] identifier[offset] , Keyword[int] identifier[length] operator[SEP] {
identifier[autoExpand] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[buf] operator[SEP] operator[SEP] operator[SEP] identifier[put] operator[SEP] identifier[src] , identifier[offset] , identifier[length] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static List<CPMeasurementUnit> toModels(
CPMeasurementUnitSoap[] soapModels) {
if (soapModels == null) {
return null;
}
List<CPMeasurementUnit> models = new ArrayList<CPMeasurementUnit>(soapModels.length);
for (CPMeasurementUnitSoap soapModel : soapModels) {
models.add(toModel(soapModel));
}
return models;
} | class class_name[name] begin[{]
method[toModels, return_type[type[List]], modifier[public static], parameter[soapModels]] begin[{]
if[binary_operation[member[.soapModels], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[List], models]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=soapModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=models, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=soapModels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=soapModel)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CPMeasurementUnitSoap, sub_type=None))), label=None)
return[member[.models]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[List] operator[<] identifier[CPMeasurementUnit] operator[>] identifier[toModels] operator[SEP] identifier[CPMeasurementUnitSoap] operator[SEP] operator[SEP] identifier[soapModels] operator[SEP] {
Keyword[if] operator[SEP] identifier[soapModels] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[List] operator[<] identifier[CPMeasurementUnit] operator[>] identifier[models] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[CPMeasurementUnit] operator[>] operator[SEP] identifier[soapModels] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CPMeasurementUnitSoap] identifier[soapModel] operator[:] identifier[soapModels] operator[SEP] {
identifier[models] operator[SEP] identifier[add] operator[SEP] identifier[toModel] operator[SEP] identifier[soapModel] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[models] operator[SEP]
}
|
private void traverseStoredDescendants(ItemData parent, DataManager dataManager, int action,
Map<String, ItemData> ret, boolean listOnly, Collection<ItemState> transientDescendants)
throws RepositoryException
{
if (parent.isNode() && !isNew(parent.getIdentifier()))
{
if (action != MERGE_PROPS)
{
List<NodeData> childNodes = dataManager.getChildNodesData((NodeData)parent);
for (int i = 0, length = childNodes.size(); i < length; i++)
{
NodeData childNode = childNodes.get(i);
ret.put(childNode.getIdentifier(), childNode);
}
}
if (action != MERGE_NODES)
{
List<PropertyData> childProps =
listOnly ? dataManager.listChildPropertiesData((NodeData)parent) : dataManager
.getChildPropertiesData((NodeData)parent);
outer : for (int i = 0, length = childProps.size(); i < length; i++)
{
PropertyData childProp = childProps.get(i);
for (ItemState transientState : transientDescendants)
{
if (!transientState.isNode() && !transientState.isDeleted()
&& transientState.getData().getQPath().getDepth() == childProp.getQPath().getDepth()
&& transientState.getData().getQPath().getName().equals(childProp.getQPath().getName()))
{
continue outer;
}
}
if (!childProp.getQPath().isDescendantOf(parent.getQPath(), true))
{
// In case we get the data from the cache, we need to set the correct path
QPath qpath = QPath.makeChildPath(parent.getQPath(), childProp.getQPath().getName());
childProp =
new PersistedPropertyData(childProp.getIdentifier(), qpath, childProp.getParentIdentifier(),
childProp.getPersistedVersion(), childProp.getType(), childProp.isMultiValued(),
childProp.getValues(), new SimplePersistedSize(
((PersistedPropertyData)childProp).getPersistedSize()));
}
ret.put(childProp.getIdentifier(), childProp);
}
}
}
} | class class_name[name] begin[{]
method[traverseStoredDescendants, return_type[void], modifier[private], parameter[parent, dataManager, action, ret, listOnly, transientDescendants]] begin[{]
if[binary_operation[call[parent.isNode, parameter[]], &&, call[.isNew, parameter[call[parent.getIdentifier, parameter[]]]]]] begin[{]
if[binary_operation[member[.action], !=, member[.MERGE_PROPS]]] begin[{]
local_variable[type[List], childNodes]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=childNodes, selectors=[], type_arguments=None), name=childNode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=NodeData, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIdentifier, postfix_operators=[], prefix_operators=[], qualifier=childNode, selectors=[], type_arguments=None), MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i), VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=childNodes, selectors=[], type_arguments=None), name=length)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.action], !=, member[.MERGE_NODES]]] begin[{]
local_variable[type[List], childProps]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=childProps, selectors=[], type_arguments=None), name=childProp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PropertyData, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isNode, postfix_operators=[], prefix_operators=['!'], qualifier=transientState, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isDeleted, postfix_operators=[], prefix_operators=['!'], qualifier=transientState, selectors=[], type_arguments=None), operator=&&), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=transientState, selectors=[MethodInvocation(arguments=[], member=getQPath, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getDepth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getQPath, postfix_operators=[], prefix_operators=[], qualifier=childProp, selectors=[MethodInvocation(arguments=[], member=getDepth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator===), operator=&&), operandr=MethodInvocation(arguments=[], member=getData, postfix_operators=[], prefix_operators=[], qualifier=transientState, selectors=[MethodInvocation(arguments=[], member=getQPath, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getQPath, postfix_operators=[], prefix_operators=[], qualifier=childProp, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=outer, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=transientDescendants, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=transientState)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ItemState, sub_type=None))), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=getQPath, postfix_operators=[], prefix_operators=['!'], qualifier=childProp, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getQPath, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=isDescendantOf, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getQPath, postfix_operators=[], prefix_operators=[], qualifier=parent, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getQPath, postfix_operators=[], prefix_operators=[], qualifier=childProp, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=makeChildPath, postfix_operators=[], prefix_operators=[], qualifier=QPath, selectors=[], type_arguments=None), name=qpath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=QPath, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=childProp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getIdentifier, postfix_operators=[], prefix_operators=[], qualifier=childProp, selectors=[], type_arguments=None), MemberReference(member=qpath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getParentIdentifier, postfix_operators=[], prefix_operators=[], qualifier=childProp, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getPersistedVersion, postfix_operators=[], prefix_operators=[], qualifier=childProp, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=childProp, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=isMultiValued, postfix_operators=[], prefix_operators=[], qualifier=childProp, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValues, postfix_operators=[], prefix_operators=[], qualifier=childProp, selectors=[], type_arguments=None), ClassCreator(arguments=[Cast(expression=MemberReference(member=childProp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=PersistedPropertyData, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SimplePersistedSize, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PersistedPropertyData, sub_type=None))), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIdentifier, postfix_operators=[], prefix_operators=[], qualifier=childProp, selectors=[], type_arguments=None), MemberReference(member=childProp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i), VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=childProps, selectors=[], type_arguments=None), name=length)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=outer)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[traverseStoredDescendants] operator[SEP] identifier[ItemData] identifier[parent] , identifier[DataManager] identifier[dataManager] , Keyword[int] identifier[action] , identifier[Map] operator[<] identifier[String] , identifier[ItemData] operator[>] identifier[ret] , Keyword[boolean] identifier[listOnly] , identifier[Collection] operator[<] identifier[ItemState] operator[>] identifier[transientDescendants] operator[SEP] Keyword[throws] identifier[RepositoryException] {
Keyword[if] operator[SEP] identifier[parent] operator[SEP] identifier[isNode] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[isNew] operator[SEP] identifier[parent] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[action] operator[!=] identifier[MERGE_PROPS] operator[SEP] {
identifier[List] operator[<] identifier[NodeData] operator[>] identifier[childNodes] operator[=] identifier[dataManager] operator[SEP] identifier[getChildNodesData] operator[SEP] operator[SEP] identifier[NodeData] operator[SEP] identifier[parent] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[length] operator[=] identifier[childNodes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[NodeData] identifier[childNode] operator[=] identifier[childNodes] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[childNode] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] , identifier[childNode] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[action] operator[!=] identifier[MERGE_NODES] operator[SEP] {
identifier[List] operator[<] identifier[PropertyData] operator[>] identifier[childProps] operator[=] identifier[listOnly] operator[?] identifier[dataManager] operator[SEP] identifier[listChildPropertiesData] operator[SEP] operator[SEP] identifier[NodeData] operator[SEP] identifier[parent] operator[SEP] operator[:] identifier[dataManager] operator[SEP] identifier[getChildPropertiesData] operator[SEP] operator[SEP] identifier[NodeData] operator[SEP] identifier[parent] operator[SEP] operator[SEP] identifier[outer] operator[:] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[length] operator[=] identifier[childProps] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[PropertyData] identifier[childProp] operator[=] identifier[childProps] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ItemState] identifier[transientState] operator[:] identifier[transientDescendants] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[transientState] operator[SEP] identifier[isNode] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[transientState] operator[SEP] identifier[isDeleted] operator[SEP] operator[SEP] operator[&&] identifier[transientState] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[getDepth] operator[SEP] operator[SEP] operator[==] identifier[childProp] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[getDepth] operator[SEP] operator[SEP] operator[&&] identifier[transientState] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[childProp] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] identifier[outer] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[childProp] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[isDescendantOf] operator[SEP] identifier[parent] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] {
identifier[QPath] identifier[qpath] operator[=] identifier[QPath] operator[SEP] identifier[makeChildPath] operator[SEP] identifier[parent] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] , identifier[childProp] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[childProp] operator[=] Keyword[new] identifier[PersistedPropertyData] operator[SEP] identifier[childProp] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] , identifier[qpath] , identifier[childProp] operator[SEP] identifier[getParentIdentifier] operator[SEP] operator[SEP] , identifier[childProp] operator[SEP] identifier[getPersistedVersion] operator[SEP] operator[SEP] , identifier[childProp] operator[SEP] identifier[getType] operator[SEP] operator[SEP] , identifier[childProp] operator[SEP] identifier[isMultiValued] operator[SEP] operator[SEP] , identifier[childProp] operator[SEP] identifier[getValues] operator[SEP] operator[SEP] , Keyword[new] identifier[SimplePersistedSize] operator[SEP] operator[SEP] operator[SEP] identifier[PersistedPropertyData] operator[SEP] identifier[childProp] operator[SEP] operator[SEP] identifier[getPersistedSize] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[ret] operator[SEP] identifier[put] operator[SEP] identifier[childProp] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] , identifier[childProp] operator[SEP] operator[SEP]
}
}
}
}
|
@Override
public void handleRequest(final Request request) {
assertConfigured();
//
// Service the request for each row.
//
List beanList = getBeanList();
HashSet rowIds = new HashSet(beanList.size());
WComponent row = getRepeatedComponent();
for (int i = 0; i < beanList.size(); i++) {
Object rowData = beanList.get(i);
rowIds.add(getRowId(rowData));
// Each row has its own context. This is why we can reuse the same
// WComponent instance for each row.
UIContext rowContext = getRowContext(rowData, i);
try {
UIContextHolder.pushContext(rowContext);
row.serviceRequest(request);
} finally {
UIContextHolder.popContext();
}
}
cleanupStaleContexts(rowIds);
} | class class_name[name] begin[{]
method[handleRequest, return_type[void], modifier[public], parameter[request]] begin[{]
call[.assertConfigured, parameter[]]
local_variable[type[List], beanList]
local_variable[type[HashSet], rowIds]
local_variable[type[WComponent], row]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=beanList, selectors=[], type_arguments=None), name=rowData)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=rowData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRowId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=rowIds, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=rowData, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getRowContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=rowContext)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=UIContext, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rowContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushContext, postfix_operators=[], prefix_operators=[], qualifier=UIContextHolder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=serviceRequest, postfix_operators=[], prefix_operators=[], qualifier=row, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=popContext, postfix_operators=[], prefix_operators=[], qualifier=UIContextHolder, selectors=[], type_arguments=None), label=None)], label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=beanList, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[.cleanupStaleContexts, parameter[member[.rowIds]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[handleRequest] operator[SEP] Keyword[final] identifier[Request] identifier[request] operator[SEP] {
identifier[assertConfigured] operator[SEP] operator[SEP] operator[SEP] identifier[List] identifier[beanList] operator[=] identifier[getBeanList] operator[SEP] operator[SEP] operator[SEP] identifier[HashSet] identifier[rowIds] operator[=] Keyword[new] identifier[HashSet] operator[SEP] identifier[beanList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[WComponent] identifier[row] operator[=] identifier[getRepeatedComponent] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[beanList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Object] identifier[rowData] operator[=] identifier[beanList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[rowIds] operator[SEP] identifier[add] operator[SEP] identifier[getRowId] operator[SEP] identifier[rowData] operator[SEP] operator[SEP] operator[SEP] identifier[UIContext] identifier[rowContext] operator[=] identifier[getRowContext] operator[SEP] identifier[rowData] , identifier[i] operator[SEP] operator[SEP] Keyword[try] {
identifier[UIContextHolder] operator[SEP] identifier[pushContext] operator[SEP] identifier[rowContext] operator[SEP] operator[SEP] identifier[row] operator[SEP] identifier[serviceRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[UIContextHolder] operator[SEP] identifier[popContext] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[cleanupStaleContexts] operator[SEP] identifier[rowIds] operator[SEP] operator[SEP]
}
|
@Override
boolean eligibleForLock(EJSDeployedSupport methodContext, ContainerTx tx) // d671368
{
// If the bean is enlisted in a global transaction, and was in a
// method on a concurrent thread at the time this thread attempted
// to call a method... then the current thread was unaware of the
// global transaction and started a local transaction. For this
// scenario, the local tran should be ignored when determining
// if the bean is eligible to be locked. The local tran will be
// 'completed' and the global tran resumed after the lock has
// been acquired... during 'enlist'.
if (state == TX_METHOD_READY &&
currentTx != null && currentTx.isTransactionGlobal() &&
!tx.isTransactionGlobal())
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "eligibleForLock : ignoring local tran : " + tx);
if (super.eligibleForLock(methodContext, currentTx)) // d671368.1 d704504
{
// Attempt to transition thread from local to sticky global tran.
// Lock the bean only if successful. d671368.1
return container.transitionToStickyGlobalTran(beanId, tx, currentTx);
}
return false; // d671368.1
}
// Not the sticky global tran scenario... so perform normal checking.
return super.eligibleForLock(methodContext, tx); // d704504
} | class class_name[name] begin[{]
method[eligibleForLock, return_type[type[boolean]], modifier[default], parameter[methodContext, tx]] begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.state], ==, member[.TX_METHOD_READY]], &&, binary_operation[member[.currentTx], !=, literal[null]]], &&, call[currentTx.isTransactionGlobal, parameter[]]], &&, call[tx.isTransactionGlobal, parameter[]]]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[literal["eligibleForLock : ignoring local tran : "], +, member[.tx]]]]
else begin[{]
None
end[}]
if[SuperMethodInvocation(arguments=[MemberReference(member=methodContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentTx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eligibleForLock, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)] begin[{]
return[call[container.transitionToStickyGlobalTran, parameter[member[.beanId], member[.tx], member[.currentTx]]]]
else begin[{]
None
end[}]
return[literal[false]]
else begin[{]
None
end[}]
return[SuperMethodInvocation(arguments=[MemberReference(member=methodContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eligibleForLock, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[boolean] identifier[eligibleForLock] operator[SEP] identifier[EJSDeployedSupport] identifier[methodContext] , identifier[ContainerTx] identifier[tx] operator[SEP] {
Keyword[if] operator[SEP] identifier[state] operator[==] identifier[TX_METHOD_READY] operator[&&] identifier[currentTx] operator[!=] Other[null] operator[&&] identifier[currentTx] operator[SEP] identifier[isTransactionGlobal] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[tx] operator[SEP] identifier[isTransactionGlobal] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[tx] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[super] operator[SEP] identifier[eligibleForLock] operator[SEP] identifier[methodContext] , identifier[currentTx] operator[SEP] operator[SEP] {
Keyword[return] identifier[container] operator[SEP] identifier[transitionToStickyGlobalTran] operator[SEP] identifier[beanId] , identifier[tx] , identifier[currentTx] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eligibleForLock] operator[SEP] identifier[methodContext] , identifier[tx] operator[SEP] operator[SEP]
}
|
@Override
public LatLonPoint getLatLon(int xindex, int yindex) {
double x, y;
if (horizXaxis instanceof CoordinateAxis1D) {
CoordinateAxis1D horiz1D = (CoordinateAxis1D) horizXaxis;
x = horiz1D.getCoordValue(xindex);
} else {
CoordinateAxis2D horiz2D = (CoordinateAxis2D) horizXaxis;
x = horiz2D.getCoordValue( yindex, xindex);
}
if (horizYaxis instanceof CoordinateAxis1D) {
CoordinateAxis1D horiz1D = (CoordinateAxis1D) horizYaxis;
y = horiz1D.getCoordValue(yindex);
} else {
CoordinateAxis2D horiz2D = (CoordinateAxis2D) horizYaxis;
y = horiz2D.getCoordValue( yindex, xindex);
}
return isLatLon() ? new LatLonPointImpl(y, x) : getLatLon(x, y);
} | class class_name[name] begin[{]
method[getLatLon, return_type[type[LatLonPoint]], modifier[public], parameter[xindex, yindex]] begin[{]
local_variable[type[double], x]
if[binary_operation[member[.horizXaxis], instanceof, type[CoordinateAxis1D]]] begin[{]
local_variable[type[CoordinateAxis1D], horiz1D]
assign[member[.x], call[horiz1D.getCoordValue, parameter[member[.xindex]]]]
else begin[{]
local_variable[type[CoordinateAxis2D], horiz2D]
assign[member[.x], call[horiz2D.getCoordValue, parameter[member[.yindex], member[.xindex]]]]
end[}]
if[binary_operation[member[.horizYaxis], instanceof, type[CoordinateAxis1D]]] begin[{]
local_variable[type[CoordinateAxis1D], horiz1D]
assign[member[.y], call[horiz1D.getCoordValue, parameter[member[.yindex]]]]
else begin[{]
local_variable[type[CoordinateAxis2D], horiz2D]
assign[member[.y], call[horiz2D.getCoordValue, parameter[member[.yindex], member[.xindex]]]]
end[}]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=isLatLon, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getLatLon, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=ClassCreator(arguments=[MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LatLonPointImpl, sub_type=None)))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[LatLonPoint] identifier[getLatLon] operator[SEP] Keyword[int] identifier[xindex] , Keyword[int] identifier[yindex] operator[SEP] {
Keyword[double] identifier[x] , identifier[y] operator[SEP] Keyword[if] operator[SEP] identifier[horizXaxis] Keyword[instanceof] identifier[CoordinateAxis1D] operator[SEP] {
identifier[CoordinateAxis1D] identifier[horiz1D] operator[=] operator[SEP] identifier[CoordinateAxis1D] operator[SEP] identifier[horizXaxis] operator[SEP] identifier[x] operator[=] identifier[horiz1D] operator[SEP] identifier[getCoordValue] operator[SEP] identifier[xindex] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[CoordinateAxis2D] identifier[horiz2D] operator[=] operator[SEP] identifier[CoordinateAxis2D] operator[SEP] identifier[horizXaxis] operator[SEP] identifier[x] operator[=] identifier[horiz2D] operator[SEP] identifier[getCoordValue] operator[SEP] identifier[yindex] , identifier[xindex] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[horizYaxis] Keyword[instanceof] identifier[CoordinateAxis1D] operator[SEP] {
identifier[CoordinateAxis1D] identifier[horiz1D] operator[=] operator[SEP] identifier[CoordinateAxis1D] operator[SEP] identifier[horizYaxis] operator[SEP] identifier[y] operator[=] identifier[horiz1D] operator[SEP] identifier[getCoordValue] operator[SEP] identifier[yindex] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[CoordinateAxis2D] identifier[horiz2D] operator[=] operator[SEP] identifier[CoordinateAxis2D] operator[SEP] identifier[horizYaxis] operator[SEP] identifier[y] operator[=] identifier[horiz2D] operator[SEP] identifier[getCoordValue] operator[SEP] identifier[yindex] , identifier[xindex] operator[SEP] operator[SEP]
}
Keyword[return] identifier[isLatLon] operator[SEP] operator[SEP] operator[?] Keyword[new] identifier[LatLonPointImpl] operator[SEP] identifier[y] , identifier[x] operator[SEP] operator[:] identifier[getLatLon] operator[SEP] identifier[x] , identifier[y] operator[SEP] operator[SEP]
}
|
public final void readFully(byte[] dst, int offset, int byteCount) throws IOException {
Arrays.checkOffsetAndCount(dst.length, offset, byteCount);
while (byteCount > 0) {
int result = read(dst, offset, byteCount);
if (result < 0) {
throw new EOFException();
}
offset += result;
byteCount -= result;
}
} | class class_name[name] begin[{]
method[readFully, return_type[void], modifier[final public], parameter[dst, offset, byteCount]] begin[{]
call[Arrays.checkOffsetAndCount, parameter[member[dst.length], member[.offset], member[.byteCount]]]
while[binary_operation[member[.byteCount], >, literal[0]]] begin[{]
local_variable[type[int], result]
if[binary_operation[member[.result], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EOFException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.offset], member[.result]]
assign[member[.byteCount], member[.result]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[readFully] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[dst] , Keyword[int] identifier[offset] , Keyword[int] identifier[byteCount] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Arrays] operator[SEP] identifier[checkOffsetAndCount] operator[SEP] identifier[dst] operator[SEP] identifier[length] , identifier[offset] , identifier[byteCount] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[byteCount] operator[>] Other[0] operator[SEP] {
Keyword[int] identifier[result] operator[=] identifier[read] operator[SEP] identifier[dst] , identifier[offset] , identifier[byteCount] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[EOFException] operator[SEP] operator[SEP] operator[SEP]
}
identifier[offset] operator[+=] identifier[result] operator[SEP] identifier[byteCount] operator[-=] identifier[result] operator[SEP]
}
}
|
public static <T extends Transform> T multiply (
double m00, double m01, double m10, double m11, double tx, double ty, AffineTransform b, T into) {
return multiply(m00, m01, m10, m11, tx, ty, b.m00, b.m01, b.m10, b.m11, b.tx, b.ty, into);
} | class class_name[name] begin[{]
method[multiply, return_type[type[T]], modifier[public static], parameter[m00, m01, m10, m11, tx, ty, b, into]] begin[{]
return[call[.multiply, parameter[member[.m00], member[.m01], member[.m10], member[.m11], member[.tx], member[.ty], member[b.m00], member[b.m01], member[b.m10], member[b.m11], member[b.tx], member[b.ty], member[.into]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Transform] operator[>] identifier[T] identifier[multiply] operator[SEP] Keyword[double] identifier[m00] , Keyword[double] identifier[m01] , Keyword[double] identifier[m10] , Keyword[double] identifier[m11] , Keyword[double] identifier[tx] , Keyword[double] identifier[ty] , identifier[AffineTransform] identifier[b] , identifier[T] identifier[into] operator[SEP] {
Keyword[return] identifier[multiply] operator[SEP] identifier[m00] , identifier[m01] , identifier[m10] , identifier[m11] , identifier[tx] , identifier[ty] , identifier[b] operator[SEP] identifier[m00] , identifier[b] operator[SEP] identifier[m01] , identifier[b] operator[SEP] identifier[m10] , identifier[b] operator[SEP] identifier[m11] , identifier[b] operator[SEP] identifier[tx] , identifier[b] operator[SEP] identifier[ty] , identifier[into] operator[SEP] operator[SEP]
}
|
public static FloatList toFloatList(Collection<?> inputList, String propertyPath) {
if (inputList.size() == 0) {
return new FloatList(0);
}
FloatList outputList = new FloatList(inputList.size());
if (propertyPath.contains(".") || propertyPath.contains("[")) {
String[] properties = StringScanner.splitByDelimiters(propertyPath, ".[]");
for (Object o : inputList) {
outputList.add(BeanUtils.getPropertyFloat(o, properties));
}
} else {
Map<String, FieldAccess> fields = BeanUtils.getFieldsFromObject(inputList.iterator().next());
FieldAccess fieldAccess = fields.get(propertyPath);
for (Object o : inputList) {
outputList.add(fieldAccess.getFloat(o));
}
}
return outputList;
} | class class_name[name] begin[{]
method[toFloatList, return_type[type[FloatList]], modifier[public static], parameter[inputList, propertyPath]] begin[{]
if[binary_operation[call[inputList.size, parameter[]], ==, literal[0]]] begin[{]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FloatList, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[FloatList], outputList]
if[binary_operation[call[propertyPath.contains, parameter[literal["."]]], ||, call[propertyPath.contains, parameter[literal["["]]]]] begin[{]
local_variable[type[String], properties]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPropertyFloat, postfix_operators=[], prefix_operators=[], qualifier=BeanUtils, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=outputList, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=inputList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
else begin[{]
local_variable[type[Map], fields]
local_variable[type[FieldAccess], fieldAccess]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFloat, postfix_operators=[], prefix_operators=[], qualifier=fieldAccess, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=outputList, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=inputList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
end[}]
return[member[.outputList]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[FloatList] identifier[toFloatList] operator[SEP] identifier[Collection] operator[<] operator[?] operator[>] identifier[inputList] , identifier[String] identifier[propertyPath] operator[SEP] {
Keyword[if] operator[SEP] identifier[inputList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[FloatList] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
identifier[FloatList] identifier[outputList] operator[=] Keyword[new] identifier[FloatList] operator[SEP] identifier[inputList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[propertyPath] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[||] identifier[propertyPath] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[properties] operator[=] identifier[StringScanner] operator[SEP] identifier[splitByDelimiters] operator[SEP] identifier[propertyPath] , literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[inputList] operator[SEP] {
identifier[outputList] operator[SEP] identifier[add] operator[SEP] identifier[BeanUtils] operator[SEP] identifier[getPropertyFloat] operator[SEP] identifier[o] , identifier[properties] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[Map] operator[<] identifier[String] , identifier[FieldAccess] operator[>] identifier[fields] operator[=] identifier[BeanUtils] operator[SEP] identifier[getFieldsFromObject] operator[SEP] identifier[inputList] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[FieldAccess] identifier[fieldAccess] operator[=] identifier[fields] operator[SEP] identifier[get] operator[SEP] identifier[propertyPath] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[inputList] operator[SEP] {
identifier[outputList] operator[SEP] identifier[add] operator[SEP] identifier[fieldAccess] operator[SEP] identifier[getFloat] operator[SEP] identifier[o] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[outputList] operator[SEP]
}
|
public OCR oCRMethod(String language, OCRMethodOptionalParameter oCRMethodOptionalParameter) {
return oCRMethodWithServiceResponseAsync(language, oCRMethodOptionalParameter).toBlocking().single().body();
} | class class_name[name] begin[{]
method[oCRMethod, return_type[type[OCR]], modifier[public], parameter[language, oCRMethodOptionalParameter]] begin[{]
return[call[.oCRMethodWithServiceResponseAsync, parameter[member[.language], member[.oCRMethodOptionalParameter]]]]
end[}]
END[}] | Keyword[public] identifier[OCR] identifier[oCRMethod] operator[SEP] identifier[String] identifier[language] , identifier[OCRMethodOptionalParameter] identifier[oCRMethodOptionalParameter] operator[SEP] {
Keyword[return] identifier[oCRMethodWithServiceResponseAsync] operator[SEP] identifier[language] , identifier[oCRMethodOptionalParameter] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
public ClassGraph whitelistModules(final String... moduleNames) {
for (final String moduleName : moduleNames) {
scanSpec.moduleWhiteBlackList.addToWhitelist(WhiteBlackList.normalizePackageOrClassName(moduleName));
}
return this;
} | class class_name[name] begin[{]
method[whitelistModules, return_type[type[ClassGraph]], modifier[public], parameter[moduleNames]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=moduleName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=normalizePackageOrClassName, postfix_operators=[], prefix_operators=[], qualifier=WhiteBlackList, selectors=[], type_arguments=None)], member=addToWhitelist, postfix_operators=[], prefix_operators=[], qualifier=scanSpec.moduleWhiteBlackList, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=moduleNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=moduleName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ClassGraph] identifier[whitelistModules] operator[SEP] Keyword[final] identifier[String] operator[...] identifier[moduleNames] operator[SEP] {
Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[moduleName] operator[:] identifier[moduleNames] operator[SEP] {
identifier[scanSpec] operator[SEP] identifier[moduleWhiteBlackList] operator[SEP] identifier[addToWhitelist] operator[SEP] identifier[WhiteBlackList] operator[SEP] identifier[normalizePackageOrClassName] operator[SEP] identifier[moduleName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static ResponseField forFragment(String responseName, String fieldName, List<String> typeConditions) {
List<Condition> conditions = new ArrayList<>(typeConditions.size());
for (String typeCondition : typeConditions) {
conditions.add(Condition.typeCondition(typeCondition));
}
return new ResponseField(Type.FRAGMENT, responseName, fieldName, Collections.<String, Object>emptyMap(),
false, conditions);
} | class class_name[name] begin[{]
method[forFragment, return_type[type[ResponseField]], modifier[public static], parameter[responseName, fieldName, typeConditions]] begin[{]
local_variable[type[List], conditions]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=typeCondition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=typeCondition, postfix_operators=[], prefix_operators=[], qualifier=Condition, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=conditions, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=typeConditions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=typeCondition)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[ClassCreator(arguments=[MemberReference(member=FRAGMENT, postfix_operators=[], prefix_operators=[], qualifier=Type, selectors=[]), MemberReference(member=responseName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=Collections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=conditions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ResponseField, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ResponseField] identifier[forFragment] operator[SEP] identifier[String] identifier[responseName] , identifier[String] identifier[fieldName] , identifier[List] operator[<] identifier[String] operator[>] identifier[typeConditions] operator[SEP] {
identifier[List] operator[<] identifier[Condition] operator[>] identifier[conditions] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[typeConditions] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[typeCondition] operator[:] identifier[typeConditions] operator[SEP] {
identifier[conditions] operator[SEP] identifier[add] operator[SEP] identifier[Condition] operator[SEP] identifier[typeCondition] operator[SEP] identifier[typeCondition] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[ResponseField] operator[SEP] identifier[Type] operator[SEP] identifier[FRAGMENT] , identifier[responseName] , identifier[fieldName] , identifier[Collections] operator[SEP] operator[<] identifier[String] , identifier[Object] operator[>] identifier[emptyMap] operator[SEP] operator[SEP] , literal[boolean] , identifier[conditions] operator[SEP] operator[SEP]
}
|
@Override
public void paint(final RenderContext renderContext) {
super.paint(renderContext);
if (!DebugUtil.isDebugFeaturesEnabled() || !(renderContext instanceof WebXmlRenderContext)) {
return;
}
XmlStringBuilder xml = ((WebXmlRenderContext) renderContext).getWriter();
xml.appendTag("ui:debug");
writeDebugInfo(getUI(), xml);
xml.appendEndTag("ui:debug");
} | class class_name[name] begin[{]
method[paint, return_type[void], modifier[public], parameter[renderContext]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=renderContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=paint, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
if[binary_operation[call[DebugUtil.isDebugFeaturesEnabled, parameter[]], ||, binary_operation[member[.renderContext], instanceof, type[WebXmlRenderContext]]]] begin[{]
return[None]
else begin[{]
None
end[}]
local_variable[type[XmlStringBuilder], xml]
call[xml.appendTag, parameter[literal["ui:debug"]]]
call[.writeDebugInfo, parameter[call[.getUI, parameter[]], member[.xml]]]
call[xml.appendEndTag, parameter[literal["ui:debug"]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[paint] operator[SEP] Keyword[final] identifier[RenderContext] identifier[renderContext] operator[SEP] {
Keyword[super] operator[SEP] identifier[paint] operator[SEP] identifier[renderContext] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[DebugUtil] operator[SEP] identifier[isDebugFeaturesEnabled] operator[SEP] operator[SEP] operator[||] operator[!] operator[SEP] identifier[renderContext] Keyword[instanceof] identifier[WebXmlRenderContext] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
identifier[XmlStringBuilder] identifier[xml] operator[=] operator[SEP] operator[SEP] identifier[WebXmlRenderContext] operator[SEP] identifier[renderContext] operator[SEP] operator[SEP] identifier[getWriter] operator[SEP] operator[SEP] operator[SEP] identifier[xml] operator[SEP] identifier[appendTag] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[writeDebugInfo] operator[SEP] identifier[getUI] operator[SEP] operator[SEP] , identifier[xml] operator[SEP] operator[SEP] identifier[xml] operator[SEP] identifier[appendEndTag] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public static Element findCamundaExtensionElement(Element element, String extensionElementName) {
Element extensionElements = element.element("extensionElements");
if(extensionElements != null) {
return extensionElements.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, extensionElementName);
} else {
return null;
}
} | class class_name[name] begin[{]
method[findCamundaExtensionElement, return_type[type[Element]], modifier[public static], parameter[element, extensionElementName]] begin[{]
local_variable[type[Element], extensionElements]
if[binary_operation[member[.extensionElements], !=, literal[null]]] begin[{]
return[call[extensionElements.elementNS, parameter[member[BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS], member[.extensionElementName]]]]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Element] identifier[findCamundaExtensionElement] operator[SEP] identifier[Element] identifier[element] , identifier[String] identifier[extensionElementName] operator[SEP] {
identifier[Element] identifier[extensionElements] operator[=] identifier[element] operator[SEP] identifier[element] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[extensionElements] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[extensionElements] operator[SEP] identifier[elementNS] operator[SEP] identifier[BpmnParse] operator[SEP] identifier[CAMUNDA_BPMN_EXTENSIONS_NS] , identifier[extensionElementName] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
private void tryToEliminateTheScope()
{
for( int i = 0; i < _statements.length; i++ )
{
Statement statement = _statements[i];
if( statement instanceof VarStatement ||
(!(statement instanceof StatementList) &&
statement.getContainedParsedElementsByType( EvalExpression.class, null )) )
{
return;
}
}
setNoScope();
} | class class_name[name] begin[{]
method[tryToEliminateTheScope, return_type[void], modifier[private], parameter[]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=_statements, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=statement)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Statement, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=statement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=VarStatement, sub_type=None), operator=instanceof), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=statement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=StatementList, sub_type=None), operator=instanceof), operandr=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=EvalExpression, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=getContainedParsedElementsByType, postfix_operators=[], prefix_operators=[], qualifier=statement, selectors=[], type_arguments=None), operator=&&), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=_statements, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[.setNoScope, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[tryToEliminateTheScope] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[_statements] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Statement] identifier[statement] operator[=] identifier[_statements] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[statement] Keyword[instanceof] identifier[VarStatement] operator[||] operator[SEP] operator[!] operator[SEP] identifier[statement] Keyword[instanceof] identifier[StatementList] operator[SEP] operator[&&] identifier[statement] operator[SEP] identifier[getContainedParsedElementsByType] operator[SEP] identifier[EvalExpression] operator[SEP] Keyword[class] , Other[null] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
}
identifier[setNoScope] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void validateFileStoreSettings() throws InvalidFileStoreConfigurationException {
if (logFileSize >= maxPermanentFileStoreSize) {
// We do not want to fail if the logFileSize is more than or equel maxPermanentFileStoreSize,
// we reset the log to 1 MB less than the maxPermanentFileStoreSize and write a ffdc and a warning message
// informing the issue and gracefully continue.
String errorMsg = nls.getFormattedMessage("INVALID_FILE_SIZE_SIAS0124", new Object[] { logFileSize / (1024 * 1024), maxPermanentFileStoreSize / (1024 * 1024) }, null);
SibTr.warning(tc, errorMsg);
logFileSize = maxPermanentFileStoreSize - 1024 * 1024;
}
// Since the minimum is always the default value
// if the log file size is more than the minimum values, set to logFileSize
if (logFileSize > minPermanentFileStoreSize) {
minPermanentFileStoreSize = logFileSize;
minTemporaryFileStoreSize = logFileSize;
}
} | class class_name[name] begin[{]
method[validateFileStoreSettings, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.logFileSize], >=, member[.maxPermanentFileStoreSize]]] begin[{]
local_variable[type[String], errorMsg]
call[SibTr.warning, parameter[member[.tc], member[.errorMsg]]]
assign[member[.logFileSize], binary_operation[member[.maxPermanentFileStoreSize], -, binary_operation[literal[1024], *, literal[1024]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.logFileSize], >, member[.minPermanentFileStoreSize]]] begin[{]
assign[member[.minPermanentFileStoreSize], member[.logFileSize]]
assign[member[.minTemporaryFileStoreSize], member[.logFileSize]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[validateFileStoreSettings] operator[SEP] operator[SEP] Keyword[throws] identifier[InvalidFileStoreConfigurationException] {
Keyword[if] operator[SEP] identifier[logFileSize] operator[>=] identifier[maxPermanentFileStoreSize] operator[SEP] {
identifier[String] identifier[errorMsg] operator[=] identifier[nls] operator[SEP] identifier[getFormattedMessage] operator[SEP] literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[logFileSize] operator[/] operator[SEP] Other[1024] operator[*] Other[1024] operator[SEP] , identifier[maxPermanentFileStoreSize] operator[/] operator[SEP] Other[1024] operator[*] Other[1024] operator[SEP]
} , Other[null] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[warning] operator[SEP] identifier[tc] , identifier[errorMsg] operator[SEP] operator[SEP] identifier[logFileSize] operator[=] identifier[maxPermanentFileStoreSize] operator[-] Other[1024] operator[*] Other[1024] operator[SEP]
}
Keyword[if] operator[SEP] identifier[logFileSize] operator[>] identifier[minPermanentFileStoreSize] operator[SEP] {
identifier[minPermanentFileStoreSize] operator[=] identifier[logFileSize] operator[SEP] identifier[minTemporaryFileStoreSize] operator[=] identifier[logFileSize] operator[SEP]
}
}
|
private static String format(final String aBundleName, final String aMessageKey, final Object... aVarargs) {
return format(null, aBundleName, aMessageKey, aVarargs);
} | class class_name[name] begin[{]
method[format, return_type[type[String]], modifier[private static], parameter[aBundleName, aMessageKey, aVarargs]] begin[{]
return[call[.format, parameter[literal[null], member[.aBundleName], member[.aMessageKey], member[.aVarargs]]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[format] operator[SEP] Keyword[final] identifier[String] identifier[aBundleName] , Keyword[final] identifier[String] identifier[aMessageKey] , Keyword[final] identifier[Object] operator[...] identifier[aVarargs] operator[SEP] {
Keyword[return] identifier[format] operator[SEP] Other[null] , identifier[aBundleName] , identifier[aMessageKey] , identifier[aVarargs] operator[SEP] operator[SEP]
}
|
public static int assertSameDimensionality(SpatialComparable box1, SpatialComparable box2) {
final int dim = box1.getDimensionality();
if(dim != box2.getDimensionality()) {
throw new IllegalArgumentException("The spatial objects do not have the same dimensionality!");
}
return dim;
} | class class_name[name] begin[{]
method[assertSameDimensionality, return_type[type[int]], modifier[public static], parameter[box1, box2]] begin[{]
local_variable[type[int], dim]
if[binary_operation[member[.dim], !=, call[box2.getDimensionality, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The spatial objects do not have the same dimensionality!")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.dim]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[assertSameDimensionality] operator[SEP] identifier[SpatialComparable] identifier[box1] , identifier[SpatialComparable] identifier[box2] operator[SEP] {
Keyword[final] Keyword[int] identifier[dim] operator[=] identifier[box1] operator[SEP] identifier[getDimensionality] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dim] operator[!=] identifier[box2] operator[SEP] identifier[getDimensionality] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[dim] operator[SEP]
}
|
public ListAssignmentsForHITRequest withAssignmentStatuses(String... assignmentStatuses) {
if (this.assignmentStatuses == null) {
setAssignmentStatuses(new java.util.ArrayList<String>(assignmentStatuses.length));
}
for (String ele : assignmentStatuses) {
this.assignmentStatuses.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withAssignmentStatuses, return_type[type[ListAssignmentsForHITRequest]], modifier[public], parameter[assignmentStatuses]] begin[{]
if[binary_operation[THIS[member[None.assignmentStatuses]], ==, literal[null]]] begin[{]
call[.setAssignmentStatuses, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=assignmentStatuses, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=assignmentStatuses, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=ele, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=assignmentStatuses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ele)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ListAssignmentsForHITRequest] identifier[withAssignmentStatuses] operator[SEP] identifier[String] operator[...] identifier[assignmentStatuses] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[assignmentStatuses] operator[==] Other[null] operator[SEP] {
identifier[setAssignmentStatuses] operator[SEP] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[assignmentStatuses] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[String] identifier[ele] operator[:] identifier[assignmentStatuses] operator[SEP] {
Keyword[this] operator[SEP] identifier[assignmentStatuses] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
private void setHBaseDataIntoObject(String columnName, byte[] columnValue, Map<String, Field> columnNameToFieldMap,
Object columnFamilyObj, boolean isEmbeddeble) throws PropertyAccessException
{
String qualifier = columnName.substring(columnName.indexOf("#") + 1, columnName.lastIndexOf("#"));
// Get Column from metadata
Field columnField = columnNameToFieldMap.get(qualifier);
if (columnField != null)
{
if (isEmbeddeble)
{
PropertyAccessorHelper.set(columnFamilyObj, columnField, columnValue);
}
else
{
columnFamilyObj = HBaseUtils.fromBytes(columnValue, columnFamilyObj.getClass());
}
}
} | class class_name[name] begin[{]
method[setHBaseDataIntoObject, return_type[void], modifier[private], parameter[columnName, columnValue, columnNameToFieldMap, columnFamilyObj, isEmbeddeble]] begin[{]
local_variable[type[String], qualifier]
local_variable[type[Field], columnField]
if[binary_operation[member[.columnField], !=, literal[null]]] begin[{]
if[member[.isEmbeddeble]] begin[{]
call[PropertyAccessorHelper.set, parameter[member[.columnFamilyObj], member[.columnField], member[.columnValue]]]
else begin[{]
assign[member[.columnFamilyObj], call[HBaseUtils.fromBytes, parameter[member[.columnValue], call[columnFamilyObj.getClass, parameter[]]]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[setHBaseDataIntoObject] operator[SEP] identifier[String] identifier[columnName] , Keyword[byte] operator[SEP] operator[SEP] identifier[columnValue] , identifier[Map] operator[<] identifier[String] , identifier[Field] operator[>] identifier[columnNameToFieldMap] , identifier[Object] identifier[columnFamilyObj] , Keyword[boolean] identifier[isEmbeddeble] operator[SEP] Keyword[throws] identifier[PropertyAccessException] {
identifier[String] identifier[qualifier] operator[=] identifier[columnName] operator[SEP] identifier[substring] operator[SEP] identifier[columnName] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[+] Other[1] , identifier[columnName] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[Field] identifier[columnField] operator[=] identifier[columnNameToFieldMap] operator[SEP] identifier[get] operator[SEP] identifier[qualifier] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[columnField] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[isEmbeddeble] operator[SEP] {
identifier[PropertyAccessorHelper] operator[SEP] identifier[set] operator[SEP] identifier[columnFamilyObj] , identifier[columnField] , identifier[columnValue] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[columnFamilyObj] operator[=] identifier[HBaseUtils] operator[SEP] identifier[fromBytes] operator[SEP] identifier[columnValue] , identifier[columnFamilyObj] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
private void au(final String name, final String definition,
final String symbol, final String plural)
throws UnitExistsException, NoSuchUnitException,
UnitParseException, SpecificationException, UnitDBException,
PrefixDBException, OperationException, NameException,
UnitSystemException {
final Unit unit = format.parse(definition, this);
if (unit == null) {
throw new NoSuchUnitException(definition);
}
addUnit(unit.clone(UnitName.newUnitName(name, plural, symbol)));
} | class class_name[name] begin[{]
method[au, return_type[void], modifier[private], parameter[name, definition, symbol, plural]] begin[{]
local_variable[type[Unit], unit]
if[binary_operation[member[.unit], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=definition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NoSuchUnitException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.addUnit, parameter[call[unit.clone, parameter[call[UnitName.newUnitName, parameter[member[.name], member[.plural], member[.symbol]]]]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[au] operator[SEP] Keyword[final] identifier[String] identifier[name] , Keyword[final] identifier[String] identifier[definition] , Keyword[final] identifier[String] identifier[symbol] , Keyword[final] identifier[String] identifier[plural] operator[SEP] Keyword[throws] identifier[UnitExistsException] , identifier[NoSuchUnitException] , identifier[UnitParseException] , identifier[SpecificationException] , identifier[UnitDBException] , identifier[PrefixDBException] , identifier[OperationException] , identifier[NameException] , identifier[UnitSystemException] {
Keyword[final] identifier[Unit] identifier[unit] operator[=] identifier[format] operator[SEP] identifier[parse] operator[SEP] identifier[definition] , Keyword[this] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[unit] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NoSuchUnitException] operator[SEP] identifier[definition] operator[SEP] operator[SEP]
}
identifier[addUnit] operator[SEP] identifier[unit] operator[SEP] identifier[clone] operator[SEP] identifier[UnitName] operator[SEP] identifier[newUnitName] operator[SEP] identifier[name] , identifier[plural] , identifier[symbol] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setMetTech(Integer newMetTech) {
Integer oldMetTech = metTech;
metTech = newMetTech;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AfplibPackage.FONT_RESOLUTION__MET_TECH, oldMetTech, metTech));
} | class class_name[name] begin[{]
method[setMetTech, return_type[void], modifier[public], parameter[newMetTech]] begin[{]
local_variable[type[Integer], oldMetTech]
assign[member[.metTech], member[.newMetTech]]
if[call[.eNotificationRequired, parameter[]]] begin[{]
call[.eNotify, parameter[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=SET, postfix_operators=[], prefix_operators=[], qualifier=Notification, selectors=[]), MemberReference(member=FONT_RESOLUTION__MET_TECH, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[]), MemberReference(member=oldMetTech, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=metTech, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ENotificationImpl, sub_type=None))]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setMetTech] operator[SEP] identifier[Integer] identifier[newMetTech] operator[SEP] {
identifier[Integer] identifier[oldMetTech] operator[=] identifier[metTech] operator[SEP] identifier[metTech] operator[=] identifier[newMetTech] operator[SEP] Keyword[if] operator[SEP] identifier[eNotificationRequired] operator[SEP] operator[SEP] operator[SEP] identifier[eNotify] operator[SEP] Keyword[new] identifier[ENotificationImpl] operator[SEP] Keyword[this] , identifier[Notification] operator[SEP] identifier[SET] , identifier[AfplibPackage] operator[SEP] identifier[FONT_RESOLUTION__MET_TECH] , identifier[oldMetTech] , identifier[metTech] operator[SEP] operator[SEP] operator[SEP]
}
|
public String generateDataURI(final InputStream inputStream, final String fileName)
throws IOException {
final StringWriter writer = new StringWriter();
final byte[] bytes = IOUtils.toByteArray(inputStream);
inputStream.close();
final String mimeType = getMimeType(fileName);
// actually write
generateDataURI(bytes, writer, mimeType);
return writer.toString();
} | class class_name[name] begin[{]
method[generateDataURI, return_type[type[String]], modifier[public], parameter[inputStream, fileName]] begin[{]
local_variable[type[StringWriter], writer]
local_variable[type[byte], bytes]
call[inputStream.close, parameter[]]
local_variable[type[String], mimeType]
call[.generateDataURI, parameter[member[.bytes], member[.writer], member[.mimeType]]]
return[call[writer.toString, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[generateDataURI] operator[SEP] Keyword[final] identifier[InputStream] identifier[inputStream] , Keyword[final] identifier[String] identifier[fileName] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[StringWriter] identifier[writer] operator[=] Keyword[new] identifier[StringWriter] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[bytes] operator[=] identifier[IOUtils] operator[SEP] identifier[toByteArray] operator[SEP] identifier[inputStream] operator[SEP] operator[SEP] identifier[inputStream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[mimeType] operator[=] identifier[getMimeType] operator[SEP] identifier[fileName] operator[SEP] operator[SEP] identifier[generateDataURI] operator[SEP] identifier[bytes] , identifier[writer] , identifier[mimeType] operator[SEP] operator[SEP] Keyword[return] identifier[writer] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T> T toBean(File jsonFile, TypeReference<T> valueTypeRef) {
if (valueTypeRef == null || jsonFile == null)
return null;
return toBean(new MyJsonParser(jsonFile), valueTypeRef);
} | class class_name[name] begin[{]
method[toBean, return_type[type[T]], modifier[public static], parameter[jsonFile, valueTypeRef]] begin[{]
if[binary_operation[binary_operation[member[.valueTypeRef], ==, literal[null]], ||, binary_operation[member[.jsonFile], ==, literal[null]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[.toBean, parameter[ClassCreator(arguments=[MemberReference(member=jsonFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MyJsonParser, sub_type=None)), member[.valueTypeRef]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[toBean] operator[SEP] identifier[File] identifier[jsonFile] , identifier[TypeReference] operator[<] identifier[T] operator[>] identifier[valueTypeRef] operator[SEP] {
Keyword[if] operator[SEP] identifier[valueTypeRef] operator[==] Other[null] operator[||] identifier[jsonFile] operator[==] Other[null] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[return] identifier[toBean] operator[SEP] Keyword[new] identifier[MyJsonParser] operator[SEP] identifier[jsonFile] operator[SEP] , identifier[valueTypeRef] operator[SEP] operator[SEP]
}
|
private void calculateSegmentSize()
{
DatabaseKelp db = _table.database();
_segmentSizeNew = calculateSegmentSize(db.getSegmentSizeFactorNew(),
_segmentSizeNew);
_segmentSizeGc = calculateSegmentSize(db.getSegmentSizeFactorGc(),
_segmentSizeGc);
} | class class_name[name] begin[{]
method[calculateSegmentSize, return_type[void], modifier[private], parameter[]] begin[{]
local_variable[type[DatabaseKelp], db]
assign[member[._segmentSizeNew], call[.calculateSegmentSize, parameter[call[db.getSegmentSizeFactorNew, parameter[]], member[._segmentSizeNew]]]]
assign[member[._segmentSizeGc], call[.calculateSegmentSize, parameter[call[db.getSegmentSizeFactorGc, parameter[]], member[._segmentSizeGc]]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[calculateSegmentSize] operator[SEP] operator[SEP] {
identifier[DatabaseKelp] identifier[db] operator[=] identifier[_table] operator[SEP] identifier[database] operator[SEP] operator[SEP] operator[SEP] identifier[_segmentSizeNew] operator[=] identifier[calculateSegmentSize] operator[SEP] identifier[db] operator[SEP] identifier[getSegmentSizeFactorNew] operator[SEP] operator[SEP] , identifier[_segmentSizeNew] operator[SEP] operator[SEP] identifier[_segmentSizeGc] operator[=] identifier[calculateSegmentSize] operator[SEP] identifier[db] operator[SEP] identifier[getSegmentSizeFactorGc] operator[SEP] operator[SEP] , identifier[_segmentSizeGc] operator[SEP] operator[SEP]
}
|
SchemaFactory createInstance( String className ) {
try {
if (debug) debugPrintln("instantiating "+className);
Class clazz;
if( classLoader!=null )
clazz = classLoader.loadClass(className);
else
clazz = Class.forName(className);
if(debug) debugPrintln("loaded it from "+which(clazz));
Object o = clazz.newInstance();
if( o instanceof SchemaFactory )
return (SchemaFactory)o;
if (debug) debugPrintln(className+" is not assignable to "+SERVICE_CLASS.getName());
}
// The VM ran out of memory or there was some other serious problem. Re-throw.
catch (VirtualMachineError vme) {
throw vme;
}
// ThreadDeath should always be re-thrown
catch (ThreadDeath td) {
throw td;
}
catch (Throwable t) {
debugPrintln("failed to instantiate "+className);
if(debug) t.printStackTrace();
}
return null;
} | class class_name[name] begin[{]
method[createInstance, return_type[type[SchemaFactory]], modifier[default], parameter[className]] begin[{]
TryStatement(block=[IfStatement(condition=MemberReference(member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="instantiating "), operandr=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debugPrintln, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=clazz)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=classLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)), label=None), label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadClass, postfix_operators=[], prefix_operators=[], qualifier=classLoader, selectors=[], type_arguments=None)), label=None)), IfStatement(condition=MemberReference(member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="loaded it from "), operandr=MethodInvocation(arguments=[MemberReference(member=clazz, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=which, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=+)], member=debugPrintln, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=clazz, selectors=[], type_arguments=None), name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=SchemaFactory, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=ReturnStatement(expression=Cast(expression=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=SchemaFactory, sub_type=None)), label=None)), IfStatement(condition=MemberReference(member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is not assignable to "), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=SERVICE_CLASS, selectors=[], type_arguments=None), operator=+)], member=debugPrintln, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None))], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=vme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=vme, types=['VirtualMachineError'])), CatchClause(block=[ThrowStatement(expression=MemberReference(member=td, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=td, types=['ThreadDeath'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failed to instantiate "), operandr=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debugPrintln, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=debug, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None), label=None))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
return[literal[null]]
end[}]
END[}] | identifier[SchemaFactory] identifier[createInstance] operator[SEP] identifier[String] identifier[className] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[debug] operator[SEP] identifier[debugPrintln] operator[SEP] literal[String] operator[+] identifier[className] operator[SEP] operator[SEP] identifier[Class] identifier[clazz] operator[SEP] Keyword[if] operator[SEP] identifier[classLoader] operator[!=] Other[null] operator[SEP] identifier[clazz] operator[=] identifier[classLoader] operator[SEP] identifier[loadClass] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[else] identifier[clazz] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[debug] operator[SEP] identifier[debugPrintln] operator[SEP] literal[String] operator[+] identifier[which] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[o] operator[=] identifier[clazz] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[o] Keyword[instanceof] identifier[SchemaFactory] operator[SEP] Keyword[return] operator[SEP] identifier[SchemaFactory] operator[SEP] identifier[o] operator[SEP] Keyword[if] operator[SEP] identifier[debug] operator[SEP] identifier[debugPrintln] operator[SEP] identifier[className] operator[+] literal[String] operator[+] identifier[SERVICE_CLASS] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[VirtualMachineError] identifier[vme] operator[SEP] {
Keyword[throw] identifier[vme] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ThreadDeath] identifier[td] operator[SEP] {
Keyword[throw] identifier[td] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[debugPrintln] operator[SEP] literal[String] operator[+] identifier[className] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[debug] operator[SEP] identifier[t] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public ServiceFuture<UUID> createRegexEntityRoleAsync(UUID appId, String versionId, UUID entityId, CreateRegexEntityRoleOptionalParameter createRegexEntityRoleOptionalParameter, final ServiceCallback<UUID> serviceCallback) {
return ServiceFuture.fromResponse(createRegexEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createRegexEntityRoleOptionalParameter), serviceCallback);
} | class class_name[name] begin[{]
method[createRegexEntityRoleAsync, return_type[type[ServiceFuture]], modifier[public], parameter[appId, versionId, entityId, createRegexEntityRoleOptionalParameter, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.createRegexEntityRoleWithServiceResponseAsync, parameter[member[.appId], member[.versionId], member[.entityId], member[.createRegexEntityRoleOptionalParameter]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[UUID] operator[>] identifier[createRegexEntityRoleAsync] operator[SEP] identifier[UUID] identifier[appId] , identifier[String] identifier[versionId] , identifier[UUID] identifier[entityId] , identifier[CreateRegexEntityRoleOptionalParameter] identifier[createRegexEntityRoleOptionalParameter] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[UUID] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[createRegexEntityRoleWithServiceResponseAsync] operator[SEP] identifier[appId] , identifier[versionId] , identifier[entityId] , identifier[createRegexEntityRoleOptionalParameter] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
@Nonnull
public static LFltIntPredicate fltIntPredicateFrom(Consumer<LFltIntPredicateBuilder> buildingFunction) {
LFltIntPredicateBuilder builder = new LFltIntPredicateBuilder();
buildingFunction.accept(builder);
return builder.build();
} | class class_name[name] begin[{]
method[fltIntPredicateFrom, return_type[type[LFltIntPredicate]], modifier[public static], parameter[buildingFunction]] begin[{]
local_variable[type[LFltIntPredicateBuilder], builder]
call[buildingFunction.accept, parameter[member[.builder]]]
return[call[builder.build, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[LFltIntPredicate] identifier[fltIntPredicateFrom] operator[SEP] identifier[Consumer] operator[<] identifier[LFltIntPredicateBuilder] operator[>] identifier[buildingFunction] operator[SEP] {
identifier[LFltIntPredicateBuilder] identifier[builder] operator[=] Keyword[new] identifier[LFltIntPredicateBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[buildingFunction] operator[SEP] identifier[accept] operator[SEP] identifier[builder] operator[SEP] operator[SEP] Keyword[return] identifier[builder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
private void parseCondition(Element node, LayoutTrigger parent) {
new LayoutTriggerCondition(parent, getDefinition(null, node));
} | class class_name[name] begin[{]
method[parseCondition, return_type[void], modifier[private], parameter[node, parent]] begin[{]
ClassCreator(arguments=[MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDefinition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LayoutTriggerCondition, sub_type=None))
end[}]
END[}] | Keyword[private] Keyword[void] identifier[parseCondition] operator[SEP] identifier[Element] identifier[node] , identifier[LayoutTrigger] identifier[parent] operator[SEP] {
Keyword[new] identifier[LayoutTriggerCondition] operator[SEP] identifier[parent] , identifier[getDefinition] operator[SEP] Other[null] , identifier[node] operator[SEP] operator[SEP] operator[SEP]
}
|
public void addResponseProp(String key, String value) {
if (responseProps == null) {
responseProps = new HashMap<String, String>(16);
}
if (key != null && value != null) {
responseProps.put(key, value);
}
} | class class_name[name] begin[{]
method[addResponseProp, return_type[void], modifier[public], parameter[key, value]] begin[{]
if[binary_operation[member[.responseProps], ==, literal[null]]] begin[{]
assign[member[.responseProps], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=16)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashMap, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.key], !=, literal[null]], &&, binary_operation[member[.value], !=, literal[null]]]] begin[{]
call[responseProps.put, parameter[member[.key], member[.value]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addResponseProp] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[responseProps] operator[==] Other[null] operator[SEP] {
identifier[responseProps] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[String] operator[>] operator[SEP] Other[16] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[key] operator[!=] Other[null] operator[&&] identifier[value] operator[!=] Other[null] operator[SEP] {
identifier[responseProps] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
}
|
public OutputStream openStream() throws IllegalStateException {
if (mClass != null) {
throw new IllegalStateException("New class has already been defined");
}
ByteArrayOutputStream data = mData;
if (data != null) {
throw new IllegalStateException("Stream already opened");
}
mData = data = new ByteArrayOutputStream();
return data;
} | class class_name[name] begin[{]
method[openStream, return_type[type[OutputStream]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.mClass], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="New class has already been defined")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ByteArrayOutputStream], data]
if[binary_operation[member[.data], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Stream already opened")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.mData], assign[member[.data], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ByteArrayOutputStream, sub_type=None))]]
return[member[.data]]
end[}]
END[}] | Keyword[public] identifier[OutputStream] identifier[openStream] operator[SEP] operator[SEP] Keyword[throws] identifier[IllegalStateException] {
Keyword[if] operator[SEP] identifier[mClass] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ByteArrayOutputStream] identifier[data] operator[=] identifier[mData] operator[SEP] Keyword[if] operator[SEP] identifier[data] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[mData] operator[=] identifier[data] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[data] operator[SEP]
}
|
public synchronized void initialize(CmsObject cms) throws CmsRoleViolationException {
if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_1_CORE_OBJECT) {
// simple test cases don't require this check
OpenCms.getRoleManager().checkRole(cms, CmsRole.ROOT_ADMIN);
}
// initialize the special entity resolver
CmsXmlEntityResolver.initialize(cms, getSchemaBytes());
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_NUM_ST_INITIALIZED_1,
new Integer(m_registeredTypes.size())));
}
} | class class_name[name] begin[{]
method[initialize, return_type[void], modifier[synchronized public], parameter[cms]] begin[{]
if[binary_operation[call[OpenCms.getRunLevel, parameter[]], >, member[OpenCms.RUNLEVEL_1_CORE_OBJECT]]] begin[{]
call[OpenCms.getRoleManager, parameter[]]
else begin[{]
None
end[}]
call[CmsXmlEntityResolver.initialize, parameter[member[.cms], call[.getSchemaBytes, parameter[]]]]
if[call[CmsLog.INIT.isInfoEnabled, parameter[]]] begin[{]
call[CmsLog.INIT.info, parameter[call[Messages.get, parameter[]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[initialize] operator[SEP] identifier[CmsObject] identifier[cms] operator[SEP] Keyword[throws] identifier[CmsRoleViolationException] {
Keyword[if] operator[SEP] identifier[OpenCms] operator[SEP] identifier[getRunLevel] operator[SEP] operator[SEP] operator[>] identifier[OpenCms] operator[SEP] identifier[RUNLEVEL_1_CORE_OBJECT] operator[SEP] {
identifier[OpenCms] operator[SEP] identifier[getRoleManager] operator[SEP] operator[SEP] operator[SEP] identifier[checkRole] operator[SEP] identifier[cms] , identifier[CmsRole] operator[SEP] identifier[ROOT_ADMIN] operator[SEP] operator[SEP]
}
identifier[CmsXmlEntityResolver] operator[SEP] identifier[initialize] operator[SEP] identifier[cms] , identifier[getSchemaBytes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CmsLog] operator[SEP] identifier[INIT] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[CmsLog] operator[SEP] identifier[INIT] operator[SEP] identifier[info] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[getBundle] operator[SEP] operator[SEP] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[INIT_NUM_ST_INITIALIZED_1] , Keyword[new] identifier[Integer] operator[SEP] identifier[m_registeredTypes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void add(final int index, final Object obj) {
maintain();
SoftObject soft = SoftObject.create(obj, queue);
list.add(index, soft);
} | class class_name[name] begin[{]
method[add, return_type[void], modifier[public], parameter[index, obj]] begin[{]
call[.maintain, parameter[]]
local_variable[type[SoftObject], soft]
call[list.add, parameter[member[.index], member[.soft]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[add] operator[SEP] Keyword[final] Keyword[int] identifier[index] , Keyword[final] identifier[Object] identifier[obj] operator[SEP] {
identifier[maintain] operator[SEP] operator[SEP] operator[SEP] identifier[SoftObject] identifier[soft] operator[=] identifier[SoftObject] operator[SEP] identifier[create] operator[SEP] identifier[obj] , identifier[queue] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[index] , identifier[soft] operator[SEP] operator[SEP]
}
|
public void addFalsePositive(Key[] keys) {
if (keys == null) {
throw new NullPointerException("Key[] can not be null");
}
for (int i = 0; i < keys.length; i++) {
addFalsePositive(keys[i]);
}
} | class class_name[name] begin[{]
method[addFalsePositive, return_type[void], modifier[public], parameter[keys]] begin[{]
if[binary_operation[member[.keys], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Key[] can not be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=addFalsePositive, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=keys, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addFalsePositive] operator[SEP] identifier[Key] operator[SEP] operator[SEP] identifier[keys] operator[SEP] {
Keyword[if] operator[SEP] identifier[keys] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[keys] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[addFalsePositive] operator[SEP] identifier[keys] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void checkSslConfigAvailability(SSLConfig sslConfig) {
if (sslConfig != null && sslConfig.isEnabled()) {
if (!BuildInfoProvider.getBuildInfo().isEnterprise()) {
throw new IllegalStateException("SSL/TLS requires Hazelcast Enterprise Edition");
}
}
} | class class_name[name] begin[{]
method[checkSslConfigAvailability, return_type[void], modifier[private], parameter[sslConfig]] begin[{]
if[binary_operation[binary_operation[member[.sslConfig], !=, literal[null]], &&, call[sslConfig.isEnabled, parameter[]]]] begin[{]
if[call[BuildInfoProvider.getBuildInfo, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SSL/TLS requires Hazelcast Enterprise Edition")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[checkSslConfigAvailability] operator[SEP] identifier[SSLConfig] identifier[sslConfig] operator[SEP] {
Keyword[if] operator[SEP] identifier[sslConfig] operator[!=] Other[null] operator[&&] identifier[sslConfig] operator[SEP] identifier[isEnabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[BuildInfoProvider] operator[SEP] identifier[getBuildInfo] operator[SEP] operator[SEP] operator[SEP] identifier[isEnterprise] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
|
public ImageEncodingCOMPRID createImageEncodingCOMPRIDFromString(EDataType eDataType, String initialValue) {
ImageEncodingCOMPRID result = ImageEncodingCOMPRID.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
return result;
} | class class_name[name] begin[{]
method[createImageEncodingCOMPRIDFromString, return_type[type[ImageEncodingCOMPRID]], modifier[public], parameter[eDataType, initialValue]] begin[{]
local_variable[type[ImageEncodingCOMPRID], result]
if[binary_operation[member[.result], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value '"), operandr=MemberReference(member=initialValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="' is not a valid enumerator of '"), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=eDataType, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.result]]
end[}]
END[}] | Keyword[public] identifier[ImageEncodingCOMPRID] identifier[createImageEncodingCOMPRIDFromString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[String] identifier[initialValue] operator[SEP] {
identifier[ImageEncodingCOMPRID] identifier[result] operator[=] identifier[ImageEncodingCOMPRID] operator[SEP] identifier[get] operator[SEP] identifier[initialValue] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[initialValue] operator[+] literal[String] operator[+] identifier[eDataType] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
|
public boolean removeVariable(String attribute, String varName) {
Bindings binds = rslTree.getBindings(attribute);
if (binds == null) return false;
return binds.removeVariable(varName);
} | class class_name[name] begin[{]
method[removeVariable, return_type[type[boolean]], modifier[public], parameter[attribute, varName]] begin[{]
local_variable[type[Bindings], binds]
if[binary_operation[member[.binds], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[call[binds.removeVariable, parameter[member[.varName]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[removeVariable] operator[SEP] identifier[String] identifier[attribute] , identifier[String] identifier[varName] operator[SEP] {
identifier[Bindings] identifier[binds] operator[=] identifier[rslTree] operator[SEP] identifier[getBindings] operator[SEP] identifier[attribute] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[binds] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] identifier[binds] operator[SEP] identifier[removeVariable] operator[SEP] identifier[varName] operator[SEP] operator[SEP]
}
|
public static <T, U> Collector<T, ?, Optional<U>> median(Function<? super T, ? extends U> function, Comparator<? super U> comparator) {
return percentile(0.5, function, comparator);
} | class class_name[name] begin[{]
method[median, return_type[type[Collector]], modifier[public static], parameter[function, comparator]] begin[{]
return[call[.percentile, parameter[literal[0.5], member[.function], member[.comparator]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[U] operator[>] identifier[Collector] operator[<] identifier[T] , operator[?] , identifier[Optional] operator[<] identifier[U] operator[>] operator[>] identifier[median] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[U] operator[>] identifier[function] , identifier[Comparator] operator[<] operator[?] Keyword[super] identifier[U] operator[>] identifier[comparator] operator[SEP] {
Keyword[return] identifier[percentile] operator[SEP] literal[Float] , identifier[function] , identifier[comparator] operator[SEP] operator[SEP]
}
|
public void setVelocity(float dirx, float diry, float speed) {
this.velx = dirx * speed;
this.vely = diry * speed;
} | class class_name[name] begin[{]
method[setVelocity, return_type[void], modifier[public], parameter[dirx, diry, speed]] begin[{]
assign[THIS[member[None.velx]], binary_operation[member[.dirx], *, member[.speed]]]
assign[THIS[member[None.vely]], binary_operation[member[.diry], *, member[.speed]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setVelocity] operator[SEP] Keyword[float] identifier[dirx] , Keyword[float] identifier[diry] , Keyword[float] identifier[speed] operator[SEP] {
Keyword[this] operator[SEP] identifier[velx] operator[=] identifier[dirx] operator[*] identifier[speed] operator[SEP] Keyword[this] operator[SEP] identifier[vely] operator[=] identifier[diry] operator[*] identifier[speed] operator[SEP]
}
|
public boolean getBoolean(String columnName, boolean defaultValue) {
int defaultValueAsInt = (defaultValue) ? SQLITE_TRUE : SQLITE_FALSE;
return getInteger(columnName, defaultValueAsInt) == SQLITE_TRUE;
} | class class_name[name] begin[{]
method[getBoolean, return_type[type[boolean]], modifier[public], parameter[columnName, defaultValue]] begin[{]
local_variable[type[int], defaultValueAsInt]
return[binary_operation[call[.getInteger, parameter[member[.columnName], member[.defaultValueAsInt]]], ==, member[.SQLITE_TRUE]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[getBoolean] operator[SEP] identifier[String] identifier[columnName] , Keyword[boolean] identifier[defaultValue] operator[SEP] {
Keyword[int] identifier[defaultValueAsInt] operator[=] operator[SEP] identifier[defaultValue] operator[SEP] operator[?] identifier[SQLITE_TRUE] operator[:] identifier[SQLITE_FALSE] operator[SEP] Keyword[return] identifier[getInteger] operator[SEP] identifier[columnName] , identifier[defaultValueAsInt] operator[SEP] operator[==] identifier[SQLITE_TRUE] operator[SEP]
}
|
@Override
public long deserialize(DataTree dt, Map<Long, Long> sessions)
throws IOException {
// we run through 100 snapshots (not all of them)
// if we cannot get it running within 100 snapshots
// we should give up
List<File> snapList = findNValidSnapshots(100);
if (snapList.size() == 0) {
return -1L;
}
File snap = null;
boolean foundValid = false;
for (int i = 0; i < snapList.size(); i++) {
snap = snapList.get(i);
InputStream snapIS = null;
CheckedInputStream crcIn = null;
try {
LOG.info("Reading snapshot " + snap);
snapIS = new BufferedInputStream(new FileInputStream(snap));
crcIn = new CheckedInputStream(snapIS, new Adler32());
InputArchive ia = BinaryInputArchive.getArchive(crcIn);
deserialize(dt,sessions, ia);
long checkSum = crcIn.getChecksum().getValue();
long val = ia.readLong("val");
if (val != checkSum) {
throw new IOException("CRC corruption in snapshot : " + snap);
}
foundValid = true;
break;
} catch(IOException e) {
LOG.warn("problem reading snap file " + snap, e);
} finally {
if (snapIS != null)
snapIS.close();
if (crcIn != null)
crcIn.close();
}
}
if (!foundValid) {
throw new IOException("Not able to find valid snapshots in " + snapDir);
}
dt.lastProcessedZxid = Util.getZxidFromName(snap.getName(), "snapshot");
return dt.lastProcessedZxid;
} | class class_name[name] begin[{]
method[deserialize, return_type[type[long]], modifier[public], parameter[dt, sessions]] begin[{]
local_variable[type[List], snapList]
if[binary_operation[call[snapList.size, parameter[]], ==, literal[0]]] begin[{]
return[literal[1L]]
else begin[{]
None
end[}]
local_variable[type[File], snap]
local_variable[type[boolean], foundValid]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=snap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=snapList, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=snapIS)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InputStream, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=crcIn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CheckedInputStream, sub_type=None)), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Reading snapshot "), operandr=MemberReference(member=snap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=snapIS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=snap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedInputStream, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=crcIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=snapIS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Adler32, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CheckedInputStream, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=crcIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getArchive, postfix_operators=[], prefix_operators=[], qualifier=BinaryInputArchive, selectors=[], type_arguments=None), name=ia)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=InputArchive, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=sessions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ia, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=deserialize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getChecksum, postfix_operators=[], prefix_operators=[], qualifier=crcIn, selectors=[MethodInvocation(arguments=[], member=getValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=checkSum)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="val")], member=readLong, postfix_operators=[], prefix_operators=[], qualifier=ia, selectors=[], type_arguments=None), name=val)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=checkSum, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="CRC corruption in snapshot : "), operandr=MemberReference(member=snap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=foundValid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="problem reading snap file "), operandr=MemberReference(member=snap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=snapIS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=snapIS, selectors=[], type_arguments=None), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=crcIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=crcIn, selectors=[], type_arguments=None), label=None))], label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=snapList, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[member[.foundValid]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Not able to find valid snapshots in "), operandr=MemberReference(member=snapDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[dt.lastProcessedZxid], call[Util.getZxidFromName, parameter[call[snap.getName, parameter[]], literal["snapshot"]]]]
return[member[dt.lastProcessedZxid]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[deserialize] operator[SEP] identifier[DataTree] identifier[dt] , identifier[Map] operator[<] identifier[Long] , identifier[Long] operator[>] identifier[sessions] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[List] operator[<] identifier[File] operator[>] identifier[snapList] operator[=] identifier[findNValidSnapshots] operator[SEP] Other[100] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[snapList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] operator[-] Other[1L] operator[SEP]
}
identifier[File] identifier[snap] operator[=] Other[null] operator[SEP] Keyword[boolean] identifier[foundValid] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[snapList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[snap] operator[=] identifier[snapList] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[InputStream] identifier[snapIS] operator[=] Other[null] operator[SEP] identifier[CheckedInputStream] identifier[crcIn] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[snap] operator[SEP] operator[SEP] identifier[snapIS] operator[=] Keyword[new] identifier[BufferedInputStream] operator[SEP] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[snap] operator[SEP] operator[SEP] operator[SEP] identifier[crcIn] operator[=] Keyword[new] identifier[CheckedInputStream] operator[SEP] identifier[snapIS] , Keyword[new] identifier[Adler32] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[InputArchive] identifier[ia] operator[=] identifier[BinaryInputArchive] operator[SEP] identifier[getArchive] operator[SEP] identifier[crcIn] operator[SEP] operator[SEP] identifier[deserialize] operator[SEP] identifier[dt] , identifier[sessions] , identifier[ia] operator[SEP] operator[SEP] Keyword[long] identifier[checkSum] operator[=] identifier[crcIn] operator[SEP] identifier[getChecksum] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[val] operator[=] identifier[ia] operator[SEP] identifier[readLong] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[val] operator[!=] identifier[checkSum] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[snap] operator[SEP] operator[SEP]
}
identifier[foundValid] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[snap] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[snapIS] operator[!=] Other[null] operator[SEP] identifier[snapIS] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[crcIn] operator[!=] Other[null] operator[SEP] identifier[crcIn] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[foundValid] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[snapDir] operator[SEP] operator[SEP]
}
identifier[dt] operator[SEP] identifier[lastProcessedZxid] operator[=] identifier[Util] operator[SEP] identifier[getZxidFromName] operator[SEP] identifier[snap] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[dt] operator[SEP] identifier[lastProcessedZxid] operator[SEP]
}
|
@Override
@XmlTransient
public JSONObject toJsonObject() throws JSONException {
JSONObject returnVal = super.toJsonObject();
//Active...
returnVal.put(JSONMapping.ACTIVE, this.isActive());
//Invalid Login Count...
returnVal.put(JSONMapping.INVALID_LOGIN_COUNT,
this.getInvalidLoginCount());
//Username...
if(this.getUsername() != null)
{
returnVal.put(JSONMapping.USERNAME,this.getUsername());
}
//Password Sha 256...
if(this.getPasswordSha256() != null)
{
returnVal.put(JSONMapping.PASSWORD_SHA_256,this.getPasswordSha256());
}
//Password Clear...
if(this.getPasswordClear() != null)
{
returnVal.put(JSONMapping.PASSWORD_CLEAR,this.getPasswordClear());
}
//Date Created...
if(this.getDateCreated() != null)
{
returnVal.put(User.JSONMapping.DATE_CREATED,
this.getDateAsLongFromJson(this.getDateCreated()));
}
//Date Last Updated...
if(this.getDateLastUpdated() != null)
{
returnVal.put(User.JSONMapping.DATE_LAST_UPDATED,
this.getDateAsLongFromJson(this.getDateLastUpdated()));
}
//Password Changed At...
if(this.getPasswordChangedAt() != null)
{
returnVal.put(JSONMapping.PASSWORD_CHANGED_AT,
this.getDateAsLongFromJson(this.getPasswordChangedAt()));
}
//Logged In Date Time...
if(this.getLoggedInDateTime() != null)
{
returnVal.put(JSONMapping.LOGGED_IN_DATE_TIME,
this.getDateAsLongFromJson(this.getLoggedInDateTime()));
}
//SALT...
if(this.getSalt() != null)
{
returnVal.put(JSONMapping.SALT,this.getSalt());
}
//Timezone...
if(this.getTimezone() != null)
{
returnVal.put(JSONMapping.TIMEZONE,
this.getTimezone().doubleValue());
}
//Date Format...
if(this.getDateFormat() != null)
{
returnVal.put(JSONMapping.DATE_FORMAT, this.getDateFormat());
}
//Time Format...
if(this.getTimeFormat() != null)
{
returnVal.put(JSONMapping.TIME_FORMAT, this.getTimeFormat());
}
//Locale...
if(this.getLocale() != null) {
returnVal.put(JSONMapping.LOCALE, this.getLocale());
}
//Email Notification...
returnVal.put(JSONMapping.EMAIL_USER_NOTIFICATION, this.isEmailUserNotification());
//Roles...
if(this.getRoles() != null && !this.getRoles().isEmpty())
{
JSONArray rolesArr = new JSONArray();
for(Role toAdd :this.getRoles())
{
rolesArr.put(toAdd.toJsonObject());
}
returnVal.put(JSONMapping.ROLES,rolesArr);
}
//Email Addresses...
if(this.getEmailAddresses() != null &&
!this.getEmailAddresses().isEmpty())
{
JSONArray emailArr = new JSONArray();
for(String toAdd :this.getEmailAddresses())
{
emailArr.put(toAdd);
}
returnVal.put(JSONMapping.EMAIL_ADDRESSES, emailArr);
}
//User Fields...
if(this.getUserFields() != null && !this.getUserFields().isEmpty())
{
JSONArray userFieldsArr = new JSONArray();
for(Field toAdd :this.getUserFields())
{
userFieldsArr.put(toAdd.toJsonObject());
}
returnVal.put(JSONMapping.USER_FIELDS,userFieldsArr);
}
return returnVal;
} | class class_name[name] begin[{]
method[toJsonObject, return_type[type[JSONObject]], modifier[public], parameter[]] begin[{]
local_variable[type[JSONObject], returnVal]
call[returnVal.put, parameter[member[JSONMapping.ACTIVE], THIS[call[None.isActive, parameter[]]]]]
call[returnVal.put, parameter[member[JSONMapping.INVALID_LOGIN_COUNT], THIS[call[None.getInvalidLoginCount, parameter[]]]]]
if[binary_operation[THIS[call[None.getUsername, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[JSONMapping.USERNAME], THIS[call[None.getUsername, parameter[]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getPasswordSha256, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[JSONMapping.PASSWORD_SHA_256], THIS[call[None.getPasswordSha256, parameter[]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getPasswordClear, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[JSONMapping.PASSWORD_CLEAR], THIS[call[None.getPasswordClear, parameter[]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getDateCreated, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[User.JSONMapping.DATE_CREATED], THIS[call[None.getDateAsLongFromJson, parameter[THIS[call[None.getDateCreated, parameter[]]]]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getDateLastUpdated, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[User.JSONMapping.DATE_LAST_UPDATED], THIS[call[None.getDateAsLongFromJson, parameter[THIS[call[None.getDateLastUpdated, parameter[]]]]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getPasswordChangedAt, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[JSONMapping.PASSWORD_CHANGED_AT], THIS[call[None.getDateAsLongFromJson, parameter[THIS[call[None.getPasswordChangedAt, parameter[]]]]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getLoggedInDateTime, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[JSONMapping.LOGGED_IN_DATE_TIME], THIS[call[None.getDateAsLongFromJson, parameter[THIS[call[None.getLoggedInDateTime, parameter[]]]]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getSalt, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[JSONMapping.SALT], THIS[call[None.getSalt, parameter[]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getTimezone, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[JSONMapping.TIMEZONE], THIS[call[None.getTimezone, parameter[]]call[None.doubleValue, parameter[]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getDateFormat, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[JSONMapping.DATE_FORMAT], THIS[call[None.getDateFormat, parameter[]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getTimeFormat, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[JSONMapping.TIME_FORMAT], THIS[call[None.getTimeFormat, parameter[]]]]]
else begin[{]
None
end[}]
if[binary_operation[THIS[call[None.getLocale, parameter[]]], !=, literal[null]]] begin[{]
call[returnVal.put, parameter[member[JSONMapping.LOCALE], THIS[call[None.getLocale, parameter[]]]]]
else begin[{]
None
end[}]
call[returnVal.put, parameter[member[JSONMapping.EMAIL_USER_NOTIFICATION], THIS[call[None.isEmailUserNotification, parameter[]]]]]
if[binary_operation[binary_operation[THIS[call[None.getRoles, parameter[]]], !=, literal[null]], &&, THIS[call[None.getRoles, parameter[]]call[None.isEmpty, parameter[]]]]] begin[{]
local_variable[type[JSONArray], rolesArr]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toJsonObject, postfix_operators=[], prefix_operators=[], qualifier=toAdd, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=rolesArr, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getRoles, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=toAdd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Role, sub_type=None))), label=None)
call[returnVal.put, parameter[member[JSONMapping.ROLES], member[.rolesArr]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[THIS[call[None.getEmailAddresses, parameter[]]], !=, literal[null]], &&, THIS[call[None.getEmailAddresses, parameter[]]call[None.isEmpty, parameter[]]]]] begin[{]
local_variable[type[JSONArray], emailArr]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=toAdd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=emailArr, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getEmailAddresses, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=toAdd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[returnVal.put, parameter[member[JSONMapping.EMAIL_ADDRESSES], member[.emailArr]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[THIS[call[None.getUserFields, parameter[]]], !=, literal[null]], &&, THIS[call[None.getUserFields, parameter[]]call[None.isEmpty, parameter[]]]]] begin[{]
local_variable[type[JSONArray], userFieldsArr]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toJsonObject, postfix_operators=[], prefix_operators=[], qualifier=toAdd, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=userFieldsArr, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getUserFields, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=toAdd)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None))), label=None)
call[returnVal.put, parameter[member[JSONMapping.USER_FIELDS], member[.userFieldsArr]]]
else begin[{]
None
end[}]
return[member[.returnVal]]
end[}]
END[}] | annotation[@] identifier[Override] annotation[@] identifier[XmlTransient] Keyword[public] identifier[JSONObject] identifier[toJsonObject] operator[SEP] operator[SEP] Keyword[throws] identifier[JSONException] {
identifier[JSONObject] identifier[returnVal] operator[=] Keyword[super] operator[SEP] identifier[toJsonObject] operator[SEP] operator[SEP] operator[SEP] identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[ACTIVE] , Keyword[this] operator[SEP] identifier[isActive] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[INVALID_LOGIN_COUNT] , Keyword[this] operator[SEP] identifier[getInvalidLoginCount] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getUsername] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[USERNAME] , Keyword[this] operator[SEP] identifier[getUsername] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getPasswordSha256] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[PASSWORD_SHA_256] , Keyword[this] operator[SEP] identifier[getPasswordSha256] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getPasswordClear] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[PASSWORD_CLEAR] , Keyword[this] operator[SEP] identifier[getPasswordClear] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getDateCreated] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[User] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[DATE_CREATED] , Keyword[this] operator[SEP] identifier[getDateAsLongFromJson] operator[SEP] Keyword[this] operator[SEP] identifier[getDateCreated] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getDateLastUpdated] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[User] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[DATE_LAST_UPDATED] , Keyword[this] operator[SEP] identifier[getDateAsLongFromJson] operator[SEP] Keyword[this] operator[SEP] identifier[getDateLastUpdated] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getPasswordChangedAt] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[PASSWORD_CHANGED_AT] , Keyword[this] operator[SEP] identifier[getDateAsLongFromJson] operator[SEP] Keyword[this] operator[SEP] identifier[getPasswordChangedAt] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getLoggedInDateTime] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[LOGGED_IN_DATE_TIME] , Keyword[this] operator[SEP] identifier[getDateAsLongFromJson] operator[SEP] Keyword[this] operator[SEP] identifier[getLoggedInDateTime] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getSalt] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[SALT] , Keyword[this] operator[SEP] identifier[getSalt] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getTimezone] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[TIMEZONE] , Keyword[this] operator[SEP] identifier[getTimezone] operator[SEP] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getDateFormat] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[DATE_FORMAT] , Keyword[this] operator[SEP] identifier[getDateFormat] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getTimeFormat] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[TIME_FORMAT] , Keyword[this] operator[SEP] identifier[getTimeFormat] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[LOCALE] , Keyword[this] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[EMAIL_USER_NOTIFICATION] , Keyword[this] operator[SEP] identifier[isEmailUserNotification] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getRoles] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] Keyword[this] operator[SEP] identifier[getRoles] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[JSONArray] identifier[rolesArr] operator[=] Keyword[new] identifier[JSONArray] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Role] identifier[toAdd] operator[:] Keyword[this] operator[SEP] identifier[getRoles] operator[SEP] operator[SEP] operator[SEP] {
identifier[rolesArr] operator[SEP] identifier[put] operator[SEP] identifier[toAdd] operator[SEP] identifier[toJsonObject] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[ROLES] , identifier[rolesArr] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getEmailAddresses] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] Keyword[this] operator[SEP] identifier[getEmailAddresses] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[JSONArray] identifier[emailArr] operator[=] Keyword[new] identifier[JSONArray] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[toAdd] operator[:] Keyword[this] operator[SEP] identifier[getEmailAddresses] operator[SEP] operator[SEP] operator[SEP] {
identifier[emailArr] operator[SEP] identifier[put] operator[SEP] identifier[toAdd] operator[SEP] operator[SEP]
}
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[EMAIL_ADDRESSES] , identifier[emailArr] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[getUserFields] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] operator[!] Keyword[this] operator[SEP] identifier[getUserFields] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[JSONArray] identifier[userFieldsArr] operator[=] Keyword[new] identifier[JSONArray] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Field] identifier[toAdd] operator[:] Keyword[this] operator[SEP] identifier[getUserFields] operator[SEP] operator[SEP] operator[SEP] {
identifier[userFieldsArr] operator[SEP] identifier[put] operator[SEP] identifier[toAdd] operator[SEP] identifier[toJsonObject] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[returnVal] operator[SEP] identifier[put] operator[SEP] identifier[JSONMapping] operator[SEP] identifier[USER_FIELDS] , identifier[userFieldsArr] operator[SEP] operator[SEP]
}
Keyword[return] identifier[returnVal] operator[SEP]
}
|
public static double getDBE(IMolecularFormula formula) throws CDKException {
int valencies[] = new int[5];
IAtomContainer ac = getAtomContainer(formula);
AtomTypeFactory factory = AtomTypeFactory.getInstance(
"org/openscience/cdk/config/data/structgen_atomtypes.xml", ac.getBuilder());
for (int f = 0; f < ac.getAtomCount(); f++) {
IAtomType[] types = factory.getAtomTypes(ac.getAtom(f).getSymbol());
if (types.length == 0)
throw new CDKException(
"Calculation of double bond equivalents not possible due to problems with element "
+ ac.getAtom(f).getSymbol());
// valencies[(int) (types[0].getBondOrderSum() + ac.getAtom(f).getFormalCharge())]++;
valencies[types[0].getBondOrderSum().intValue()]++;
}
return 1 + (valencies[4]) + (valencies[3] / 2) - (valencies[1] / 2);
} | class class_name[name] begin[{]
method[getDBE, return_type[type[double]], modifier[public static], parameter[formula]] begin[{]
local_variable[type[int], valencies]
local_variable[type[IAtomContainer], ac]
local_variable[type[AtomTypeFactory], factory]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAtom, postfix_operators=[], prefix_operators=[], qualifier=ac, selectors=[MethodInvocation(arguments=[], member=getSymbol, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=getAtomTypes, postfix_operators=[], prefix_operators=[], qualifier=factory, selectors=[], type_arguments=None), name=types)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=IAtomType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=types, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Calculation of double bond equivalents not possible due to problems with element "), operandr=MethodInvocation(arguments=[MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getAtom, postfix_operators=[], prefix_operators=[], qualifier=ac, selectors=[MethodInvocation(arguments=[], member=getSymbol, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CDKException, sub_type=None)), label=None)), StatementExpression(expression=MemberReference(member=valencies, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=types, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)), MethodInvocation(arguments=[], member=getBondOrderSum, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=intValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]))]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getAtomCount, postfix_operators=[], prefix_operators=[], qualifier=ac, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=f)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=f, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[binary_operation[binary_operation[binary_operation[literal[1], +, member[.valencies]], +, binary_operation[member[.valencies], /, literal[2]]], -, binary_operation[member[.valencies], /, literal[2]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[getDBE] operator[SEP] identifier[IMolecularFormula] identifier[formula] operator[SEP] Keyword[throws] identifier[CDKException] {
Keyword[int] identifier[valencies] operator[SEP] operator[SEP] operator[=] Keyword[new] Keyword[int] operator[SEP] Other[5] operator[SEP] operator[SEP] identifier[IAtomContainer] identifier[ac] operator[=] identifier[getAtomContainer] operator[SEP] identifier[formula] operator[SEP] operator[SEP] identifier[AtomTypeFactory] identifier[factory] operator[=] identifier[AtomTypeFactory] operator[SEP] identifier[getInstance] operator[SEP] literal[String] , identifier[ac] operator[SEP] identifier[getBuilder] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[f] operator[=] Other[0] operator[SEP] identifier[f] operator[<] identifier[ac] operator[SEP] identifier[getAtomCount] operator[SEP] operator[SEP] operator[SEP] identifier[f] operator[++] operator[SEP] {
identifier[IAtomType] operator[SEP] operator[SEP] identifier[types] operator[=] identifier[factory] operator[SEP] identifier[getAtomTypes] operator[SEP] identifier[ac] operator[SEP] identifier[getAtom] operator[SEP] identifier[f] operator[SEP] operator[SEP] identifier[getSymbol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[types] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[CDKException] operator[SEP] literal[String] operator[+] identifier[ac] operator[SEP] identifier[getAtom] operator[SEP] identifier[f] operator[SEP] operator[SEP] identifier[getSymbol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[valencies] operator[SEP] identifier[types] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getBondOrderSum] operator[SEP] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[++] operator[SEP]
}
Keyword[return] Other[1] operator[+] operator[SEP] identifier[valencies] operator[SEP] Other[4] operator[SEP] operator[SEP] operator[+] operator[SEP] identifier[valencies] operator[SEP] Other[3] operator[SEP] operator[/] Other[2] operator[SEP] operator[-] operator[SEP] identifier[valencies] operator[SEP] Other[1] operator[SEP] operator[/] Other[2] operator[SEP] operator[SEP]
}
|
@UiHandler("m_okButton")
protected void onClickOk(ClickEvent e) {
changeState(State.validationRunning);
final String newName = getValue();
CmsRpcAction<String> validate = new CmsRpcAction<String>() {
@Override
public void execute() {
start(200, false);
CmsCoreProvider.getVfsService().renameResource(m_structureId, newName, this);
}
@Override
public void onFailure(Throwable t) {
super.onFailure(t);
changeState(State.validationUnknown);
}
@Override
protected void onResponse(String result) {
stop(false);
if (result == null) {
close();
if (m_renameCallback != null) {
m_renameCallback.onSuccess(newName);
}
} else {
changeState(State.validationFailed);
setValidationError(result);
}
}
};
validate.execute();
} | class class_name[name] begin[{]
method[onClickOk, return_type[void], modifier[protected], parameter[e]] begin[{]
call[.changeState, parameter[member[State.validationRunning]]]
local_variable[type[String], newName]
local_variable[type[CmsRpcAction], validate]
call[validate.execute, parameter[]]
end[}]
END[}] | annotation[@] identifier[UiHandler] operator[SEP] literal[String] operator[SEP] Keyword[protected] Keyword[void] identifier[onClickOk] operator[SEP] identifier[ClickEvent] identifier[e] operator[SEP] {
identifier[changeState] operator[SEP] identifier[State] operator[SEP] identifier[validationRunning] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[newName] operator[=] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[CmsRpcAction] operator[<] identifier[String] operator[>] identifier[validate] operator[=] Keyword[new] identifier[CmsRpcAction] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[execute] operator[SEP] operator[SEP] {
identifier[start] operator[SEP] Other[200] , literal[boolean] operator[SEP] operator[SEP] identifier[CmsCoreProvider] operator[SEP] identifier[getVfsService] operator[SEP] operator[SEP] operator[SEP] identifier[renameResource] operator[SEP] identifier[m_structureId] , identifier[newName] , Keyword[this] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onFailure] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[super] operator[SEP] identifier[onFailure] operator[SEP] identifier[t] operator[SEP] operator[SEP] identifier[changeState] operator[SEP] identifier[State] operator[SEP] identifier[validationUnknown] operator[SEP] operator[SEP]
} annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[onResponse] operator[SEP] identifier[String] identifier[result] operator[SEP] {
identifier[stop] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[==] Other[null] operator[SEP] {
identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_renameCallback] operator[!=] Other[null] operator[SEP] {
identifier[m_renameCallback] operator[SEP] identifier[onSuccess] operator[SEP] identifier[newName] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[changeState] operator[SEP] identifier[State] operator[SEP] identifier[validationFailed] operator[SEP] operator[SEP] identifier[setValidationError] operator[SEP] identifier[result] operator[SEP] operator[SEP]
}
}
} operator[SEP] identifier[validate] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP]
}
|
public String getViewClassNameFromModelClassName(String modelClassName)
{
String packageRoot = SCREEN_VIEW_PACKAGE;
String packagePrefix = DBConstants.BLANK;
int iLastDot = modelClassName.lastIndexOf('.');
if (iLastDot != -1)
{
if (!modelClassName.startsWith(SCREEN_MODEL_PACKAGE))
packageRoot = modelClassName.substring(0, iLastDot) + ".view.";
int iModelEnd = modelClassName.lastIndexOf(SCREEN_MODEL_PACKAGE);
if (iModelEnd != -1)
{
iModelEnd += SCREEN_MODEL_PACKAGE.length();
if (iModelEnd < iLastDot)
packagePrefix = modelClassName.substring(iModelEnd, iLastDot);
}
modelClassName = modelClassName.substring(iLastDot + 1);
}
return this.assembleViewClassName(packageRoot, packagePrefix, modelClassName);
} | class class_name[name] begin[{]
method[getViewClassNameFromModelClassName, return_type[type[String]], modifier[public], parameter[modelClassName]] begin[{]
local_variable[type[String], packageRoot]
local_variable[type[String], packagePrefix]
local_variable[type[int], iLastDot]
if[binary_operation[member[.iLastDot], !=, literal[1]]] begin[{]
if[call[modelClassName.startsWith, parameter[member[.SCREEN_MODEL_PACKAGE]]]] begin[{]
assign[member[.packageRoot], binary_operation[call[modelClassName.substring, parameter[literal[0], member[.iLastDot]]], +, literal[".view."]]]
else begin[{]
None
end[}]
local_variable[type[int], iModelEnd]
if[binary_operation[member[.iModelEnd], !=, literal[1]]] begin[{]
assign[member[.iModelEnd], call[SCREEN_MODEL_PACKAGE.length, parameter[]]]
if[binary_operation[member[.iModelEnd], <, member[.iLastDot]]] begin[{]
assign[member[.packagePrefix], call[modelClassName.substring, parameter[member[.iModelEnd], member[.iLastDot]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.modelClassName], call[modelClassName.substring, parameter[binary_operation[member[.iLastDot], +, literal[1]]]]]
else begin[{]
None
end[}]
return[THIS[call[None.assembleViewClassName, parameter[member[.packageRoot], member[.packagePrefix], member[.modelClassName]]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getViewClassNameFromModelClassName] operator[SEP] identifier[String] identifier[modelClassName] operator[SEP] {
identifier[String] identifier[packageRoot] operator[=] identifier[SCREEN_VIEW_PACKAGE] operator[SEP] identifier[String] identifier[packagePrefix] operator[=] identifier[DBConstants] operator[SEP] identifier[BLANK] operator[SEP] Keyword[int] identifier[iLastDot] operator[=] identifier[modelClassName] operator[SEP] identifier[lastIndexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iLastDot] operator[!=] operator[-] Other[1] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[modelClassName] operator[SEP] identifier[startsWith] operator[SEP] identifier[SCREEN_MODEL_PACKAGE] operator[SEP] operator[SEP] identifier[packageRoot] operator[=] identifier[modelClassName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[iLastDot] operator[SEP] operator[+] literal[String] operator[SEP] Keyword[int] identifier[iModelEnd] operator[=] identifier[modelClassName] operator[SEP] identifier[lastIndexOf] operator[SEP] identifier[SCREEN_MODEL_PACKAGE] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iModelEnd] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[iModelEnd] operator[+=] identifier[SCREEN_MODEL_PACKAGE] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iModelEnd] operator[<] identifier[iLastDot] operator[SEP] identifier[packagePrefix] operator[=] identifier[modelClassName] operator[SEP] identifier[substring] operator[SEP] identifier[iModelEnd] , identifier[iLastDot] operator[SEP] operator[SEP]
}
identifier[modelClassName] operator[=] identifier[modelClassName] operator[SEP] identifier[substring] operator[SEP] identifier[iLastDot] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[assembleViewClassName] operator[SEP] identifier[packageRoot] , identifier[packagePrefix] , identifier[modelClassName] operator[SEP] operator[SEP]
}
|
private void forwardToParameterServer(INDArrayMessage message) {
try {
incomingFlow.accept(message);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | class class_name[name] begin[{]
method[forwardToParameterServer, return_type[void], modifier[private], parameter[message]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=[], prefix_operators=[], qualifier=incomingFlow, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[forwardToParameterServer] operator[SEP] identifier[INDArrayMessage] identifier[message] operator[SEP] {
Keyword[try] {
identifier[incomingFlow] operator[SEP] identifier[accept] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public R getRelationships() {
R r = new R(factory.getTotalConcepts(), factory.getTotalRoles());
// Collect subsumptions from context index
for (IntIterator it = contextIndex.keyIterator(); it.hasNext();) {
int key = it.next();
Context ctx = contextIndex.get(key);
int concept = ctx.getConcept();
CR pred = ctx.getPred();
CR succ = ctx.getSucc();
int[] predRoles = pred.getRoles();
for(int i = 0; i < predRoles.length; i++) {
IConceptSet cs = pred.lookupConcept(predRoles[i]);
for(IntIterator it2 = cs.iterator(); it2.hasNext(); ) {
int predC = it2.next();
r.store(predC, predRoles[i], concept);
}
}
int[] succRoles = succ.getRoles();
for(int i = 0; i < succRoles.length; i++) {
IConceptSet cs = succ.lookupConcept(succRoles[i]);
for(IntIterator it2 = cs.iterator(); it2.hasNext(); ) {
int succC = it2.next();
r.store(concept, succRoles[i], succC);
}
}
}
return r;
} | class class_name[name] begin[{]
method[getRelationships, return_type[type[R]], modifier[public], parameter[]] begin[{]
local_variable[type[R], r]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), name=key)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=contextIndex, selectors=[], type_arguments=None), name=ctx)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Context, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getConcept, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None), name=concept)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPred, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None), name=pred)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CR, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSucc, postfix_operators=[], prefix_operators=[], qualifier=ctx, selectors=[], type_arguments=None), name=succ)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CR, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getRoles, postfix_operators=[], prefix_operators=[], qualifier=pred, selectors=[], type_arguments=None), name=predRoles)], modifiers=set(), type=BasicType(dimensions=[None], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=predRoles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=lookupConcept, postfix_operators=[], prefix_operators=[], qualifier=pred, selectors=[], type_arguments=None), name=cs)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IConceptSet, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it2, selectors=[], type_arguments=None), name=predC)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=predC, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=predRoles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=concept, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=store, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it2, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=cs, selectors=[], type_arguments=None), name=it2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IntIterator, sub_type=None)), update=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=predRoles, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getRoles, postfix_operators=[], prefix_operators=[], qualifier=succ, selectors=[], type_arguments=None), name=succRoles)], modifiers=set(), type=BasicType(dimensions=[None], name=int)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=succRoles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=lookupConcept, postfix_operators=[], prefix_operators=[], qualifier=succ, selectors=[], type_arguments=None), name=cs)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IConceptSet, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it2, selectors=[], type_arguments=None), name=succC)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=concept, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=succRoles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=succC, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=store, postfix_operators=[], prefix_operators=[], qualifier=r, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it2, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=cs, selectors=[], type_arguments=None), name=it2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IntIterator, sub_type=None)), update=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=succRoles, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=keyIterator, postfix_operators=[], prefix_operators=[], qualifier=contextIndex, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IntIterator, sub_type=None)), update=None), label=None)
return[member[.r]]
end[}]
END[}] | Keyword[public] identifier[R] identifier[getRelationships] operator[SEP] operator[SEP] {
identifier[R] identifier[r] operator[=] Keyword[new] identifier[R] operator[SEP] identifier[factory] operator[SEP] identifier[getTotalConcepts] operator[SEP] operator[SEP] , identifier[factory] operator[SEP] identifier[getTotalRoles] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[IntIterator] identifier[it] operator[=] identifier[contextIndex] operator[SEP] identifier[keyIterator] operator[SEP] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[key] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[Context] identifier[ctx] operator[=] identifier[contextIndex] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[int] identifier[concept] operator[=] identifier[ctx] operator[SEP] identifier[getConcept] operator[SEP] operator[SEP] operator[SEP] identifier[CR] identifier[pred] operator[=] identifier[ctx] operator[SEP] identifier[getPred] operator[SEP] operator[SEP] operator[SEP] identifier[CR] identifier[succ] operator[=] identifier[ctx] operator[SEP] identifier[getSucc] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[predRoles] operator[=] identifier[pred] operator[SEP] identifier[getRoles] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[predRoles] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[IConceptSet] identifier[cs] operator[=] identifier[pred] operator[SEP] identifier[lookupConcept] operator[SEP] identifier[predRoles] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[IntIterator] identifier[it2] operator[=] identifier[cs] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[it2] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[predC] operator[=] identifier[it2] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[r] operator[SEP] identifier[store] operator[SEP] identifier[predC] , identifier[predRoles] operator[SEP] identifier[i] operator[SEP] , identifier[concept] operator[SEP] operator[SEP]
}
}
Keyword[int] operator[SEP] operator[SEP] identifier[succRoles] operator[=] identifier[succ] operator[SEP] identifier[getRoles] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[succRoles] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[IConceptSet] identifier[cs] operator[=] identifier[succ] operator[SEP] identifier[lookupConcept] operator[SEP] identifier[succRoles] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[IntIterator] identifier[it2] operator[=] identifier[cs] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[it2] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[succC] operator[=] identifier[it2] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[r] operator[SEP] identifier[store] operator[SEP] identifier[concept] , identifier[succRoles] operator[SEP] identifier[i] operator[SEP] , identifier[succC] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[r] operator[SEP]
}
|
public byte getByte(long pos) {
checkOffsetAndCount(size, pos, 1);
for (Segment s = head; true; s = s.next) {
int segmentByteCount = s.limit - s.pos;
if (pos < segmentByteCount) return s.data[s.pos + (int) pos];
pos -= segmentByteCount;
}
} | class class_name[name] begin[{]
method[getByte, return_type[type[byte]], modifier[public], parameter[pos]] begin[{]
call[.checkOffsetAndCount, parameter[member[.size], member[.pos], literal[1]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=limit, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[]), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[]), operator=-), name=segmentByteCount)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=segmentByteCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[]), operandr=Cast(expression=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=BasicType(dimensions=[], name=int)), operator=+))]), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=-=, value=MemberReference(member=segmentByteCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=head, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Segment, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[]))]), label=None)
end[}]
END[}] | Keyword[public] Keyword[byte] identifier[getByte] operator[SEP] Keyword[long] identifier[pos] operator[SEP] {
identifier[checkOffsetAndCount] operator[SEP] identifier[size] , identifier[pos] , Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Segment] identifier[s] operator[=] identifier[head] operator[SEP] literal[boolean] operator[SEP] identifier[s] operator[=] identifier[s] operator[SEP] identifier[next] operator[SEP] {
Keyword[int] identifier[segmentByteCount] operator[=] identifier[s] operator[SEP] identifier[limit] operator[-] identifier[s] operator[SEP] identifier[pos] operator[SEP] Keyword[if] operator[SEP] identifier[pos] operator[<] identifier[segmentByteCount] operator[SEP] Keyword[return] identifier[s] operator[SEP] identifier[data] operator[SEP] identifier[s] operator[SEP] identifier[pos] operator[+] operator[SEP] Keyword[int] operator[SEP] identifier[pos] operator[SEP] operator[SEP] identifier[pos] operator[-=] identifier[segmentByteCount] operator[SEP]
}
}
|
public ServiceFuture<DatabasePrincipalListResultInner> removePrincipalsAsync(String resourceGroupName, String clusterName, String databaseName, List<DatabasePrincipalInner> value, final ServiceCallback<DatabasePrincipalListResultInner> serviceCallback) {
return ServiceFuture.fromResponse(removePrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value), serviceCallback);
} | class class_name[name] begin[{]
method[removePrincipalsAsync, return_type[type[ServiceFuture]], modifier[public], parameter[resourceGroupName, clusterName, databaseName, value, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.removePrincipalsWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.clusterName], member[.databaseName], member[.value]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[DatabasePrincipalListResultInner] operator[>] identifier[removePrincipalsAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[clusterName] , identifier[String] identifier[databaseName] , identifier[List] operator[<] identifier[DatabasePrincipalInner] operator[>] identifier[value] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[DatabasePrincipalListResultInner] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[removePrincipalsWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[clusterName] , identifier[databaseName] , identifier[value] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
public static channel_interface_binding[] get(nitro_service service, String id) throws Exception{
channel_interface_binding obj = new channel_interface_binding();
obj.set_id(id);
channel_interface_binding response[] = (channel_interface_binding[]) obj.get_resources(service);
return response;
} | class class_name[name] begin[{]
method[get, return_type[type[channel_interface_binding]], modifier[public static], parameter[service, id]] begin[{]
local_variable[type[channel_interface_binding], obj]
call[obj.set_id, parameter[member[.id]]]
local_variable[type[channel_interface_binding], response]
return[member[.response]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[channel_interface_binding] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[id] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[channel_interface_binding] identifier[obj] operator[=] Keyword[new] identifier[channel_interface_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_id] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[channel_interface_binding] identifier[response] operator[SEP] operator[SEP] operator[=] operator[SEP] identifier[channel_interface_binding] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[get_resources] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
protected ParserType getType(final String variableString) {
final String uppercaseVarSet = variableString.trim().toUpperCase(Locale.ENGLISH);
if (uppercaseVarSet.matches(ProcessorConstants.RELATED_REGEX)) {
return ParserType.REFER_TO;
} else if (uppercaseVarSet.matches(ProcessorConstants.PREREQUISITE_REGEX)) {
return ParserType.PREREQUISITE;
} else if (uppercaseVarSet.matches(ProcessorConstants.NEXT_REGEX)) {
return ParserType.NEXT;
} else if (uppercaseVarSet.matches(ProcessorConstants.PREV_REGEX)) {
return ParserType.PREVIOUS;
} else if (uppercaseVarSet.matches(ProcessorConstants.TARGET_REGEX)) {
return ParserType.TARGET;
} else if (uppercaseVarSet.matches(ProcessorConstants.EXTERNAL_TARGET_REGEX)) {
return ParserType.EXTERNAL_TARGET;
} else if (uppercaseVarSet.matches(ProcessorConstants.EXTERNAL_CSP_REGEX)) {
return ParserType.EXTERNAL_CONTENT_SPEC;
} else if (uppercaseVarSet.matches(ProcessorConstants.LINK_LIST_REGEX)) {
return ParserType.LINKLIST;
} else if (uppercaseVarSet.matches(ProcessorConstants.INFO_REGEX)) {
return ParserType.INFO;
} else {
return ParserType.NONE;
}
} | class class_name[name] begin[{]
method[getType, return_type[type[ParserType]], modifier[protected], parameter[variableString]] begin[{]
local_variable[type[String], uppercaseVarSet]
if[call[uppercaseVarSet.matches, parameter[member[ProcessorConstants.RELATED_REGEX]]]] begin[{]
return[member[ParserType.REFER_TO]]
else begin[{]
if[call[uppercaseVarSet.matches, parameter[member[ProcessorConstants.PREREQUISITE_REGEX]]]] begin[{]
return[member[ParserType.PREREQUISITE]]
else begin[{]
if[call[uppercaseVarSet.matches, parameter[member[ProcessorConstants.NEXT_REGEX]]]] begin[{]
return[member[ParserType.NEXT]]
else begin[{]
if[call[uppercaseVarSet.matches, parameter[member[ProcessorConstants.PREV_REGEX]]]] begin[{]
return[member[ParserType.PREVIOUS]]
else begin[{]
if[call[uppercaseVarSet.matches, parameter[member[ProcessorConstants.TARGET_REGEX]]]] begin[{]
return[member[ParserType.TARGET]]
else begin[{]
if[call[uppercaseVarSet.matches, parameter[member[ProcessorConstants.EXTERNAL_TARGET_REGEX]]]] begin[{]
return[member[ParserType.EXTERNAL_TARGET]]
else begin[{]
if[call[uppercaseVarSet.matches, parameter[member[ProcessorConstants.EXTERNAL_CSP_REGEX]]]] begin[{]
return[member[ParserType.EXTERNAL_CONTENT_SPEC]]
else begin[{]
if[call[uppercaseVarSet.matches, parameter[member[ProcessorConstants.LINK_LIST_REGEX]]]] begin[{]
return[member[ParserType.LINKLIST]]
else begin[{]
if[call[uppercaseVarSet.matches, parameter[member[ProcessorConstants.INFO_REGEX]]]] begin[{]
return[member[ParserType.INFO]]
else begin[{]
return[member[ParserType.NONE]]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[protected] identifier[ParserType] identifier[getType] operator[SEP] Keyword[final] identifier[String] identifier[variableString] operator[SEP] {
Keyword[final] identifier[String] identifier[uppercaseVarSet] operator[=] identifier[variableString] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[toUpperCase] operator[SEP] identifier[Locale] operator[SEP] identifier[ENGLISH] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[uppercaseVarSet] operator[SEP] identifier[matches] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[RELATED_REGEX] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParserType] operator[SEP] identifier[REFER_TO] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[uppercaseVarSet] operator[SEP] identifier[matches] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[PREREQUISITE_REGEX] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParserType] operator[SEP] identifier[PREREQUISITE] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[uppercaseVarSet] operator[SEP] identifier[matches] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[NEXT_REGEX] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParserType] operator[SEP] identifier[NEXT] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[uppercaseVarSet] operator[SEP] identifier[matches] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[PREV_REGEX] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParserType] operator[SEP] identifier[PREVIOUS] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[uppercaseVarSet] operator[SEP] identifier[matches] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[TARGET_REGEX] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParserType] operator[SEP] identifier[TARGET] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[uppercaseVarSet] operator[SEP] identifier[matches] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[EXTERNAL_TARGET_REGEX] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParserType] operator[SEP] identifier[EXTERNAL_TARGET] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[uppercaseVarSet] operator[SEP] identifier[matches] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[EXTERNAL_CSP_REGEX] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParserType] operator[SEP] identifier[EXTERNAL_CONTENT_SPEC] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[uppercaseVarSet] operator[SEP] identifier[matches] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[LINK_LIST_REGEX] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParserType] operator[SEP] identifier[LINKLIST] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[uppercaseVarSet] operator[SEP] identifier[matches] operator[SEP] identifier[ProcessorConstants] operator[SEP] identifier[INFO_REGEX] operator[SEP] operator[SEP] {
Keyword[return] identifier[ParserType] operator[SEP] identifier[INFO] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[ParserType] operator[SEP] identifier[NONE] operator[SEP]
}
}
|
public EntityManager em() {
Deque<EntityManager> ems = this.emStack(true);
if (ems.isEmpty()) {
Http.Context.safeCurrent()
.map(
ctx -> {
throw new RuntimeException(
"No EntityManager found in the context. Try to annotate your action method with @play.db.jpa.Transactional");
})
.orElseGet(
() -> {
throw new RuntimeException(
"No EntityManager bound to this thread. Try wrapping this call in JPAApi.withTransaction, or ensure that the HTTP context is setup on this thread.");
});
}
return ems.peekFirst();
} | class class_name[name] begin[{]
method[em, return_type[type[EntityManager]], modifier[public], parameter[]] begin[{]
local_variable[type[Deque], ems]
if[call[ems.isEmpty, parameter[]]] begin[{]
call[Http.Context.safeCurrent, parameter[]]
else begin[{]
None
end[}]
return[call[ems.peekFirst, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[EntityManager] identifier[em] operator[SEP] operator[SEP] {
identifier[Deque] operator[<] identifier[EntityManager] operator[>] identifier[ems] operator[=] Keyword[this] operator[SEP] identifier[emStack] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ems] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[Http] operator[SEP] identifier[Context] operator[SEP] identifier[safeCurrent] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[ctx] operator[->] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[orElseGet] operator[SEP] operator[SEP] operator[SEP] operator[->] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
Keyword[return] identifier[ems] operator[SEP] identifier[peekFirst] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, Long adGroupId,
Long criterionId) throws RemoteException {
// Get the DataService.
DataServiceInterface dataService = adWordsServices.get(session, DataServiceInterface.class);
// Create a query to select all keyword bid simulations for the ad group.
ServiceQuery query =
new ServiceQuery.Builder()
.fields(
DataField.AdGroupId,
DataField.CriterionId,
DataField.StartDate,
DataField.EndDate,
DataField.Bid,
DataField.BiddableConversions,
DataField.BiddableConversionsValue,
DataField.LocalClicks,
DataField.LocalCost,
DataField.LocalImpressions)
.where(DataField.AdGroupId)
.equalTo(adGroupId)
.where(DataField.CriterionId)
.equalTo(criterionId)
.limit(0, PAGE_SIZE)
.build();
// Display bid landscapes.
CriterionBidLandscapePage page = null;
do {
query.nextPage(page);
// Retrieve keyword bid simulations one page at a time, continuing to request pages until all
// of them have been retrieved.
page = dataService.queryCriterionBidLandscape(query.toString());
if (page.getEntries() != null) {
for (CriterionBidLandscape criterionBidLandscape : page.getEntries()) {
System.out.printf(
"Criterion bid landscape with ad group ID %d, criterion ID %d, "
+ "start date %s, end date %s, with landscape points:%n",
criterionBidLandscape.getAdGroupId(),
criterionBidLandscape.getCriterionId(),
criterionBidLandscape.getStartDate(),
criterionBidLandscape.getEndDate());
for (BidLandscapeLandscapePoint bidLanscapePoint :
criterionBidLandscape.getLandscapePoints()) {
System.out.printf(
"\t{bid: %d clicks: %d cost: %d impressions: %d, biddable conversions: %.2f, "
+ "biddable conversions value: %.2f}%n",
bidLanscapePoint.getBid().getMicroAmount(),
bidLanscapePoint.getClicks(),
bidLanscapePoint.getCost().getMicroAmount(),
bidLanscapePoint.getImpressions(),
bidLanscapePoint.getBiddableConversions(),
bidLanscapePoint.getBiddableConversionsValue());
}
System.out.println(" was found.");
}
}
} while (query.hasNext(page));
} | class class_name[name] begin[{]
method[runExample, return_type[void], modifier[public static], parameter[adWordsServices, session, adGroupId, criterionId]] begin[{]
local_variable[type[DataServiceInterface], dataService]
local_variable[type[ServiceQuery], query]
local_variable[type[CriterionBidLandscapePage], page]
do[call[query.hasNext, parameter[member[.page]]]] begin[{]
call[query.nextPage, parameter[member[.page]]]
assign[member[.page], call[dataService.queryCriterionBidLandscape, parameter[call[query.toString, parameter[]]]]]
if[binary_operation[call[page.getEntries, parameter[]], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Criterion bid landscape with ad group ID %d, criterion ID %d, "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="start date %s, end date %s, with landscape points:%n"), operator=+), MethodInvocation(arguments=[], member=getAdGroupId, postfix_operators=[], prefix_operators=[], qualifier=criterionBidLandscape, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getCriterionId, postfix_operators=[], prefix_operators=[], qualifier=criterionBidLandscape, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getStartDate, postfix_operators=[], prefix_operators=[], qualifier=criterionBidLandscape, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getEndDate, postfix_operators=[], prefix_operators=[], qualifier=criterionBidLandscape, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\t{bid: %d clicks: %d cost: %d impressions: %d, biddable conversions: %.2f, "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="biddable conversions value: %.2f}%n"), operator=+), MethodInvocation(arguments=[], member=getBid, postfix_operators=[], prefix_operators=[], qualifier=bidLanscapePoint, selectors=[MethodInvocation(arguments=[], member=getMicroAmount, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getClicks, postfix_operators=[], prefix_operators=[], qualifier=bidLanscapePoint, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getCost, postfix_operators=[], prefix_operators=[], qualifier=bidLanscapePoint, selectors=[MethodInvocation(arguments=[], member=getMicroAmount, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getImpressions, postfix_operators=[], prefix_operators=[], qualifier=bidLanscapePoint, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getBiddableConversions, postfix_operators=[], prefix_operators=[], qualifier=bidLanscapePoint, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getBiddableConversionsValue, postfix_operators=[], prefix_operators=[], qualifier=bidLanscapePoint, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getLandscapePoints, postfix_operators=[], prefix_operators=[], qualifier=criterionBidLandscape, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bidLanscapePoint)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BidLandscapeLandscapePoint, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" was found.")], member=println, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getEntries, postfix_operators=[], prefix_operators=[], qualifier=page, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=criterionBidLandscape)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CriterionBidLandscape, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[runExample] operator[SEP] identifier[AdWordsServicesInterface] identifier[adWordsServices] , identifier[AdWordsSession] identifier[session] , identifier[Long] identifier[adGroupId] , identifier[Long] identifier[criterionId] operator[SEP] Keyword[throws] identifier[RemoteException] {
identifier[DataServiceInterface] identifier[dataService] operator[=] identifier[adWordsServices] operator[SEP] identifier[get] operator[SEP] identifier[session] , identifier[DataServiceInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[ServiceQuery] identifier[query] operator[=] Keyword[new] identifier[ServiceQuery] operator[SEP] identifier[Builder] operator[SEP] operator[SEP] operator[SEP] identifier[fields] operator[SEP] identifier[DataField] operator[SEP] identifier[AdGroupId] , identifier[DataField] operator[SEP] identifier[CriterionId] , identifier[DataField] operator[SEP] identifier[StartDate] , identifier[DataField] operator[SEP] identifier[EndDate] , identifier[DataField] operator[SEP] identifier[Bid] , identifier[DataField] operator[SEP] identifier[BiddableConversions] , identifier[DataField] operator[SEP] identifier[BiddableConversionsValue] , identifier[DataField] operator[SEP] identifier[LocalClicks] , identifier[DataField] operator[SEP] identifier[LocalCost] , identifier[DataField] operator[SEP] identifier[LocalImpressions] operator[SEP] operator[SEP] identifier[where] operator[SEP] identifier[DataField] operator[SEP] identifier[AdGroupId] operator[SEP] operator[SEP] identifier[equalTo] operator[SEP] identifier[adGroupId] operator[SEP] operator[SEP] identifier[where] operator[SEP] identifier[DataField] operator[SEP] identifier[CriterionId] operator[SEP] operator[SEP] identifier[equalTo] operator[SEP] identifier[criterionId] operator[SEP] operator[SEP] identifier[limit] operator[SEP] Other[0] , identifier[PAGE_SIZE] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[CriterionBidLandscapePage] identifier[page] operator[=] Other[null] operator[SEP] Keyword[do] {
identifier[query] operator[SEP] identifier[nextPage] operator[SEP] identifier[page] operator[SEP] operator[SEP] identifier[page] operator[=] identifier[dataService] operator[SEP] identifier[queryCriterionBidLandscape] operator[SEP] identifier[query] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[page] operator[SEP] identifier[getEntries] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[CriterionBidLandscape] identifier[criterionBidLandscape] operator[:] identifier[page] operator[SEP] identifier[getEntries] operator[SEP] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] operator[+] literal[String] , identifier[criterionBidLandscape] operator[SEP] identifier[getAdGroupId] operator[SEP] operator[SEP] , identifier[criterionBidLandscape] operator[SEP] identifier[getCriterionId] operator[SEP] operator[SEP] , identifier[criterionBidLandscape] operator[SEP] identifier[getStartDate] operator[SEP] operator[SEP] , identifier[criterionBidLandscape] operator[SEP] identifier[getEndDate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[BidLandscapeLandscapePoint] identifier[bidLanscapePoint] operator[:] identifier[criterionBidLandscape] operator[SEP] identifier[getLandscapePoints] operator[SEP] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] operator[+] literal[String] , identifier[bidLanscapePoint] operator[SEP] identifier[getBid] operator[SEP] operator[SEP] operator[SEP] identifier[getMicroAmount] operator[SEP] operator[SEP] , identifier[bidLanscapePoint] operator[SEP] identifier[getClicks] operator[SEP] operator[SEP] , identifier[bidLanscapePoint] operator[SEP] identifier[getCost] operator[SEP] operator[SEP] operator[SEP] identifier[getMicroAmount] operator[SEP] operator[SEP] , identifier[bidLanscapePoint] operator[SEP] identifier[getImpressions] operator[SEP] operator[SEP] , identifier[bidLanscapePoint] operator[SEP] identifier[getBiddableConversions] operator[SEP] operator[SEP] , identifier[bidLanscapePoint] operator[SEP] identifier[getBiddableConversionsValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
Keyword[while] operator[SEP] identifier[query] operator[SEP] identifier[hasNext] operator[SEP] identifier[page] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void loadGroups(Collection<TileGroup> groups)
{
groupTiles.clear();
tilesGroup.clear();
groupTypes.clear();
for (final TileGroup group : groups)
{
final String name = group.getName();
groupTiles.put(name, group.getTiles());
groupTypes.put(name, group.getType());
for (final TileRef tile : group.getTiles())
{
tilesGroup.put(tile, name);
}
}
} | class class_name[name] begin[{]
method[loadGroups, return_type[void], modifier[public], parameter[groups]] begin[{]
call[groupTiles.clear, parameter[]]
call[tilesGroup.clear, parameter[]]
call[groupTypes.clear, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[], type_arguments=None), name=name)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getTiles, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=groupTiles, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=groupTypes, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=tilesGroup, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getTiles, postfix_operators=[], prefix_operators=[], qualifier=group, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tile)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=TileRef, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=groups, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=group)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=TileGroup, sub_type=None))), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[loadGroups] operator[SEP] identifier[Collection] operator[<] identifier[TileGroup] operator[>] identifier[groups] operator[SEP] {
identifier[groupTiles] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[tilesGroup] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[groupTypes] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[TileGroup] identifier[group] operator[:] identifier[groups] operator[SEP] {
Keyword[final] identifier[String] identifier[name] operator[=] identifier[group] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[groupTiles] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[group] operator[SEP] identifier[getTiles] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[groupTypes] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[group] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[TileRef] identifier[tile] operator[:] identifier[group] operator[SEP] identifier[getTiles] operator[SEP] operator[SEP] operator[SEP] {
identifier[tilesGroup] operator[SEP] identifier[put] operator[SEP] identifier[tile] , identifier[name] operator[SEP] operator[SEP]
}
}
}
|
@Override
public Serializable removeAttribute(final String key) {
ComponentModel model = getOrCreateComponentModel();
return model.removeAttribute(key);
} | class class_name[name] begin[{]
method[removeAttribute, return_type[type[Serializable]], modifier[public], parameter[key]] begin[{]
local_variable[type[ComponentModel], model]
return[call[model.removeAttribute, parameter[member[.key]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Serializable] identifier[removeAttribute] operator[SEP] Keyword[final] identifier[String] identifier[key] operator[SEP] {
identifier[ComponentModel] identifier[model] operator[=] identifier[getOrCreateComponentModel] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[model] operator[SEP] identifier[removeAttribute] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
|
public void compact() {
Set<String> compactionTargets = findCompactionTargets();
Map<String, BitSet> relocatedOrdinals = new HashMap<String, BitSet>();
PartialOrdinalRemapper remapper = new PartialOrdinalRemapper();
for(String compactionTarget : compactionTargets) {
HollowTypeReadState typeState = readEngine.getTypeState(compactionTarget);
HollowTypeWriteState writeState = writeEngine.getTypeState(compactionTarget);
BitSet populatedOrdinals = typeState.getListener(PopulatedOrdinalListener.class).getPopulatedOrdinals();
BitSet typeRelocatedOrdinals = new BitSet(populatedOrdinals.length());
int populatedCardinality = populatedOrdinals.cardinality();
writeState.addAllObjectsFromPreviousCycle();
int numRelocations = 0;
int ordinalToRelocate = populatedOrdinals.nextSetBit(populatedCardinality);
while(ordinalToRelocate != -1) {
numRelocations++;
ordinalToRelocate = populatedOrdinals.nextSetBit(ordinalToRelocate+1);
}
HollowRecordCopier copier = HollowRecordCopier.createCopier(typeState);
IntMap remappedOrdinals = new IntMap(numRelocations);
ordinalToRelocate = populatedOrdinals.length();
int relocatePosition = -1;
try {
for(int i=0;i<numRelocations;i++) {
while(!populatedOrdinals.get(--ordinalToRelocate));
relocatePosition = populatedOrdinals.nextClearBit(relocatePosition + 1);
typeRelocatedOrdinals.set(ordinalToRelocate);
writeState.removeOrdinalFromThisCycle(ordinalToRelocate);
HollowWriteRecord rec = copier.copy(ordinalToRelocate);
writeState.mapOrdinal(rec, relocatePosition, false, true);
remappedOrdinals.put(ordinalToRelocate, relocatePosition);
}
} finally {
writeState.recalculateFreeOrdinals();
}
remapper.addOrdinalRemapping(compactionTarget, remappedOrdinals);
relocatedOrdinals.put(compactionTarget, typeRelocatedOrdinals);
}
/// find the referencing dependents
TransitiveSetTraverser.addReferencingOutsideClosure(readEngine, relocatedOrdinals);
/// copy all forward except remapped and transitive dependents of remapped
for(HollowSchema schema : HollowSchemaSorter.dependencyOrderedSchemaList(writeEngine.getSchemas())) {
if(!compactionTargets.contains(schema.getName())) {
HollowTypeWriteState writeState = writeEngine.getTypeState(schema.getName());
writeState.addAllObjectsFromPreviousCycle();
BitSet typeRelocatedOrdinals = relocatedOrdinals.get(schema.getName());
if(typeRelocatedOrdinals != null) {
HollowTypeReadState readState = readEngine.getTypeState(schema.getName());
IntMap remappedOrdinals = new IntMap(typeRelocatedOrdinals.cardinality());
boolean preserveHashPositions = shouldPreserveHashPositions(schema);
HollowRecordCopier copier = HollowRecordCopier.createCopier(readState, remapper, preserveHashPositions);
int remapOrdinal = typeRelocatedOrdinals.nextSetBit(0);
while(remapOrdinal != -1) {
HollowWriteRecord rec = copier.copy(remapOrdinal);
int newOrdinal = writeState.add(rec);
remappedOrdinals.put(remapOrdinal, newOrdinal);
writeState.removeOrdinalFromThisCycle(remapOrdinal);
remapOrdinal = typeRelocatedOrdinals.nextSetBit(remapOrdinal + 1);
}
remapper.addOrdinalRemapping(schema.getName(), remappedOrdinals);
}
}
}
} | class class_name[name] begin[{]
method[compact, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[Set], compactionTargets]
local_variable[type[Map], relocatedOrdinals]
local_variable[type[PartialOrdinalRemapper], remapper]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=compactionTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTypeState, postfix_operators=[], prefix_operators=[], qualifier=readEngine, selectors=[], type_arguments=None), name=typeState)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HollowTypeReadState, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=compactionTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTypeState, postfix_operators=[], prefix_operators=[], qualifier=writeEngine, selectors=[], type_arguments=None), name=writeState)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HollowTypeWriteState, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PopulatedOrdinalListener, sub_type=None))], member=getListener, postfix_operators=[], prefix_operators=[], qualifier=typeState, selectors=[MethodInvocation(arguments=[], member=getPopulatedOrdinals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=populatedOrdinals)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BitSet, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=populatedOrdinals, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BitSet, sub_type=None)), name=typeRelocatedOrdinals)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BitSet, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=cardinality, postfix_operators=[], prefix_operators=[], qualifier=populatedOrdinals, selectors=[], type_arguments=None), name=populatedCardinality)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[], member=addAllObjectsFromPreviousCycle, postfix_operators=[], prefix_operators=[], qualifier=writeState, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=numRelocations)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=populatedCardinality, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=nextSetBit, postfix_operators=[], prefix_operators=[], qualifier=populatedOrdinals, selectors=[], type_arguments=None), name=ordinalToRelocate)], modifiers=set(), type=BasicType(dimensions=[], name=int)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=numRelocations, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ordinalToRelocate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=ordinalToRelocate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=nextSetBit, postfix_operators=[], prefix_operators=[], qualifier=populatedOrdinals, selectors=[], type_arguments=None)), label=None)]), condition=BinaryOperation(operandl=MemberReference(member=ordinalToRelocate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=typeState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createCopier, postfix_operators=[], prefix_operators=[], qualifier=HollowRecordCopier, selectors=[], type_arguments=None), name=copier)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HollowRecordCopier, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=numRelocations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IntMap, sub_type=None)), name=remappedOrdinals)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IntMap, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=ordinalToRelocate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=populatedOrdinals, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), name=relocatePosition)], modifiers=set(), type=BasicType(dimensions=[], name=int)), TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[WhileStatement(body=Statement(label=None), condition=MethodInvocation(arguments=[MemberReference(member=ordinalToRelocate, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=['!'], qualifier=populatedOrdinals, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=relocatePosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=relocatePosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=nextClearBit, postfix_operators=[], prefix_operators=[], qualifier=populatedOrdinals, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ordinalToRelocate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=typeRelocatedOrdinals, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ordinalToRelocate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeOrdinalFromThisCycle, postfix_operators=[], prefix_operators=[], qualifier=writeState, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ordinalToRelocate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copy, postfix_operators=[], prefix_operators=[], qualifier=copier, selectors=[], type_arguments=None), name=rec)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HollowWriteRecord, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=relocatePosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=mapOrdinal, postfix_operators=[], prefix_operators=[], qualifier=writeState, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ordinalToRelocate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=relocatePosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=remappedOrdinals, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=numRelocations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=recalculateFreeOrdinals, postfix_operators=[], prefix_operators=[], qualifier=writeState, selectors=[], type_arguments=None), label=None)], label=None, resources=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=compactionTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=remappedOrdinals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addOrdinalRemapping, postfix_operators=[], prefix_operators=[], qualifier=remapper, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=compactionTarget, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=typeRelocatedOrdinals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=relocatedOrdinals, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=compactionTargets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=compactionTarget)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[TransitiveSetTraverser.addReferencingOutsideClosure, parameter[member[.readEngine], member[.relocatedOrdinals]]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=schema, selectors=[], type_arguments=None)], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=compactionTargets, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=schema, selectors=[], type_arguments=None)], member=getTypeState, postfix_operators=[], prefix_operators=[], qualifier=writeEngine, selectors=[], type_arguments=None), name=writeState)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HollowTypeWriteState, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=addAllObjectsFromPreviousCycle, postfix_operators=[], prefix_operators=[], qualifier=writeState, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=schema, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=relocatedOrdinals, selectors=[], type_arguments=None), name=typeRelocatedOrdinals)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BitSet, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=typeRelocatedOrdinals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=schema, selectors=[], type_arguments=None)], member=getTypeState, postfix_operators=[], prefix_operators=[], qualifier=readEngine, selectors=[], type_arguments=None), name=readState)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HollowTypeReadState, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=cardinality, postfix_operators=[], prefix_operators=[], qualifier=typeRelocatedOrdinals, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IntMap, sub_type=None)), name=remappedOrdinals)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IntMap, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=schema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=shouldPreserveHashPositions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=preserveHashPositions)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=readState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=remapper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=preserveHashPositions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createCopier, postfix_operators=[], prefix_operators=[], qualifier=HollowRecordCopier, selectors=[], type_arguments=None), name=copier)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HollowRecordCopier, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=nextSetBit, postfix_operators=[], prefix_operators=[], qualifier=typeRelocatedOrdinals, selectors=[], type_arguments=None), name=remapOrdinal)], modifiers=set(), type=BasicType(dimensions=[], name=int)), WhileStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=remapOrdinal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=copy, postfix_operators=[], prefix_operators=[], qualifier=copier, selectors=[], type_arguments=None), name=rec)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HollowWriteRecord, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=rec, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=writeState, selectors=[], type_arguments=None), name=newOrdinal)], modifiers=set(), type=BasicType(dimensions=[], name=int)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=remapOrdinal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newOrdinal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=remappedOrdinals, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=remapOrdinal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeOrdinalFromThisCycle, postfix_operators=[], prefix_operators=[], qualifier=writeState, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=remapOrdinal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=remapOrdinal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)], member=nextSetBit, postfix_operators=[], prefix_operators=[], qualifier=typeRelocatedOrdinals, selectors=[], type_arguments=None)), label=None)]), condition=BinaryOperation(operandl=MemberReference(member=remapOrdinal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=schema, selectors=[], type_arguments=None), MemberReference(member=remappedOrdinals, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addOrdinalRemapping, postfix_operators=[], prefix_operators=[], qualifier=remapper, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getSchemas, postfix_operators=[], prefix_operators=[], qualifier=writeEngine, selectors=[], type_arguments=None)], member=dependencyOrderedSchemaList, postfix_operators=[], prefix_operators=[], qualifier=HollowSchemaSorter, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=schema)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HollowSchema, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[compact] operator[SEP] operator[SEP] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[compactionTargets] operator[=] identifier[findCompactionTargets] operator[SEP] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[BitSet] operator[>] identifier[relocatedOrdinals] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[BitSet] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[PartialOrdinalRemapper] identifier[remapper] operator[=] Keyword[new] identifier[PartialOrdinalRemapper] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[compactionTarget] operator[:] identifier[compactionTargets] operator[SEP] {
identifier[HollowTypeReadState] identifier[typeState] operator[=] identifier[readEngine] operator[SEP] identifier[getTypeState] operator[SEP] identifier[compactionTarget] operator[SEP] operator[SEP] identifier[HollowTypeWriteState] identifier[writeState] operator[=] identifier[writeEngine] operator[SEP] identifier[getTypeState] operator[SEP] identifier[compactionTarget] operator[SEP] operator[SEP] identifier[BitSet] identifier[populatedOrdinals] operator[=] identifier[typeState] operator[SEP] identifier[getListener] operator[SEP] identifier[PopulatedOrdinalListener] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[getPopulatedOrdinals] operator[SEP] operator[SEP] operator[SEP] identifier[BitSet] identifier[typeRelocatedOrdinals] operator[=] Keyword[new] identifier[BitSet] operator[SEP] identifier[populatedOrdinals] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[populatedCardinality] operator[=] identifier[populatedOrdinals] operator[SEP] identifier[cardinality] operator[SEP] operator[SEP] operator[SEP] identifier[writeState] operator[SEP] identifier[addAllObjectsFromPreviousCycle] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[numRelocations] operator[=] Other[0] operator[SEP] Keyword[int] identifier[ordinalToRelocate] operator[=] identifier[populatedOrdinals] operator[SEP] identifier[nextSetBit] operator[SEP] identifier[populatedCardinality] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[ordinalToRelocate] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[numRelocations] operator[++] operator[SEP] identifier[ordinalToRelocate] operator[=] identifier[populatedOrdinals] operator[SEP] identifier[nextSetBit] operator[SEP] identifier[ordinalToRelocate] operator[+] Other[1] operator[SEP] operator[SEP]
}
identifier[HollowRecordCopier] identifier[copier] operator[=] identifier[HollowRecordCopier] operator[SEP] identifier[createCopier] operator[SEP] identifier[typeState] operator[SEP] operator[SEP] identifier[IntMap] identifier[remappedOrdinals] operator[=] Keyword[new] identifier[IntMap] operator[SEP] identifier[numRelocations] operator[SEP] operator[SEP] identifier[ordinalToRelocate] operator[=] identifier[populatedOrdinals] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[relocatePosition] operator[=] operator[-] Other[1] operator[SEP] Keyword[try] {
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[numRelocations] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[while] operator[SEP] operator[!] identifier[populatedOrdinals] operator[SEP] identifier[get] operator[SEP] operator[--] identifier[ordinalToRelocate] operator[SEP] operator[SEP] operator[SEP] identifier[relocatePosition] operator[=] identifier[populatedOrdinals] operator[SEP] identifier[nextClearBit] operator[SEP] identifier[relocatePosition] operator[+] Other[1] operator[SEP] operator[SEP] identifier[typeRelocatedOrdinals] operator[SEP] identifier[set] operator[SEP] identifier[ordinalToRelocate] operator[SEP] operator[SEP] identifier[writeState] operator[SEP] identifier[removeOrdinalFromThisCycle] operator[SEP] identifier[ordinalToRelocate] operator[SEP] operator[SEP] identifier[HollowWriteRecord] identifier[rec] operator[=] identifier[copier] operator[SEP] identifier[copy] operator[SEP] identifier[ordinalToRelocate] operator[SEP] operator[SEP] identifier[writeState] operator[SEP] identifier[mapOrdinal] operator[SEP] identifier[rec] , identifier[relocatePosition] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] identifier[remappedOrdinals] operator[SEP] identifier[put] operator[SEP] identifier[ordinalToRelocate] , identifier[relocatePosition] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[writeState] operator[SEP] identifier[recalculateFreeOrdinals] operator[SEP] operator[SEP] operator[SEP]
}
identifier[remapper] operator[SEP] identifier[addOrdinalRemapping] operator[SEP] identifier[compactionTarget] , identifier[remappedOrdinals] operator[SEP] operator[SEP] identifier[relocatedOrdinals] operator[SEP] identifier[put] operator[SEP] identifier[compactionTarget] , identifier[typeRelocatedOrdinals] operator[SEP] operator[SEP]
}
identifier[TransitiveSetTraverser] operator[SEP] identifier[addReferencingOutsideClosure] operator[SEP] identifier[readEngine] , identifier[relocatedOrdinals] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[HollowSchema] identifier[schema] operator[:] identifier[HollowSchemaSorter] operator[SEP] identifier[dependencyOrderedSchemaList] operator[SEP] identifier[writeEngine] operator[SEP] identifier[getSchemas] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[compactionTargets] operator[SEP] identifier[contains] operator[SEP] identifier[schema] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[HollowTypeWriteState] identifier[writeState] operator[=] identifier[writeEngine] operator[SEP] identifier[getTypeState] operator[SEP] identifier[schema] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writeState] operator[SEP] identifier[addAllObjectsFromPreviousCycle] operator[SEP] operator[SEP] operator[SEP] identifier[BitSet] identifier[typeRelocatedOrdinals] operator[=] identifier[relocatedOrdinals] operator[SEP] identifier[get] operator[SEP] identifier[schema] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[typeRelocatedOrdinals] operator[!=] Other[null] operator[SEP] {
identifier[HollowTypeReadState] identifier[readState] operator[=] identifier[readEngine] operator[SEP] identifier[getTypeState] operator[SEP] identifier[schema] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[IntMap] identifier[remappedOrdinals] operator[=] Keyword[new] identifier[IntMap] operator[SEP] identifier[typeRelocatedOrdinals] operator[SEP] identifier[cardinality] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[preserveHashPositions] operator[=] identifier[shouldPreserveHashPositions] operator[SEP] identifier[schema] operator[SEP] operator[SEP] identifier[HollowRecordCopier] identifier[copier] operator[=] identifier[HollowRecordCopier] operator[SEP] identifier[createCopier] operator[SEP] identifier[readState] , identifier[remapper] , identifier[preserveHashPositions] operator[SEP] operator[SEP] Keyword[int] identifier[remapOrdinal] operator[=] identifier[typeRelocatedOrdinals] operator[SEP] identifier[nextSetBit] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[remapOrdinal] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[HollowWriteRecord] identifier[rec] operator[=] identifier[copier] operator[SEP] identifier[copy] operator[SEP] identifier[remapOrdinal] operator[SEP] operator[SEP] Keyword[int] identifier[newOrdinal] operator[=] identifier[writeState] operator[SEP] identifier[add] operator[SEP] identifier[rec] operator[SEP] operator[SEP] identifier[remappedOrdinals] operator[SEP] identifier[put] operator[SEP] identifier[remapOrdinal] , identifier[newOrdinal] operator[SEP] operator[SEP] identifier[writeState] operator[SEP] identifier[removeOrdinalFromThisCycle] operator[SEP] identifier[remapOrdinal] operator[SEP] operator[SEP] identifier[remapOrdinal] operator[=] identifier[typeRelocatedOrdinals] operator[SEP] identifier[nextSetBit] operator[SEP] identifier[remapOrdinal] operator[+] Other[1] operator[SEP] operator[SEP]
}
identifier[remapper] operator[SEP] identifier[addOrdinalRemapping] operator[SEP] identifier[schema] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[remappedOrdinals] operator[SEP] operator[SEP]
}
}
}
}
|
@Override
public DescribeMyUserProfileResult describeMyUserProfile(DescribeMyUserProfileRequest request) {
request = beforeClientExecution(request);
return executeDescribeMyUserProfile(request);
} | class class_name[name] begin[{]
method[describeMyUserProfile, return_type[type[DescribeMyUserProfileResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDescribeMyUserProfile, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DescribeMyUserProfileResult] identifier[describeMyUserProfile] operator[SEP] identifier[DescribeMyUserProfileRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDescribeMyUserProfile] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
private static void ensureStatusOk(HttpResponse<String> response) throws ClientErrorException,
ServerErrorException, OtherCommunicationException {
int responseStatus = response.getStatus();
if (isClientError(responseStatus)) {
throw new ClientErrorException(response.getBody());
} else if (isServerError(responseStatus)) {
throw new ServerErrorException();
} else if (isOtherErrorResponse(responseStatus)) {
throw new OtherCommunicationException();
}
} | class class_name[name] begin[{]
method[ensureStatusOk, return_type[void], modifier[private static], parameter[response]] begin[{]
local_variable[type[int], responseStatus]
if[call[.isClientError, parameter[member[.responseStatus]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getBody, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClientErrorException, sub_type=None)), label=None)
else begin[{]
if[call[.isServerError, parameter[member[.responseStatus]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ServerErrorException, sub_type=None)), label=None)
else begin[{]
if[call[.isOtherErrorResponse, parameter[member[.responseStatus]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OtherCommunicationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[ensureStatusOk] operator[SEP] identifier[HttpResponse] operator[<] identifier[String] operator[>] identifier[response] operator[SEP] Keyword[throws] identifier[ClientErrorException] , identifier[ServerErrorException] , identifier[OtherCommunicationException] {
Keyword[int] identifier[responseStatus] operator[=] identifier[response] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isClientError] operator[SEP] identifier[responseStatus] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ClientErrorException] operator[SEP] identifier[response] operator[SEP] identifier[getBody] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isServerError] operator[SEP] identifier[responseStatus] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ServerErrorException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[isOtherErrorResponse] operator[SEP] identifier[responseStatus] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[OtherCommunicationException] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Set<T> getEdges(int vertex) {
Set<T> s = vertexToEdges.get(vertex);
return (s == null)
? Collections.<T>emptySet()
: s;
} | class class_name[name] begin[{]
method[getEdges, return_type[type[Set]], modifier[public], parameter[vertex]] begin[{]
local_variable[type[Set], s]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MethodInvocation(arguments=[], member=Collections, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]))]
end[}]
END[}] | Keyword[public] identifier[Set] operator[<] identifier[T] operator[>] identifier[getEdges] operator[SEP] Keyword[int] identifier[vertex] operator[SEP] {
identifier[Set] operator[<] identifier[T] operator[>] identifier[s] operator[=] identifier[vertexToEdges] operator[SEP] identifier[get] operator[SEP] identifier[vertex] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[s] operator[==] Other[null] operator[SEP] operator[?] identifier[Collections] operator[SEP] operator[<] identifier[T] operator[>] identifier[emptySet] operator[SEP] operator[SEP] operator[:] identifier[s] operator[SEP]
}
|
public void afterPropertiesSet() throws Exception {
if (httpClient == null) {
httpClient = new DefaultHttpClient();
}
if (params != null) {
for (Entry<String, Object> param : params.entrySet()) {
log.debug("Setting custom Http param on client: '" + param.getKey() + "'='" + param.getValue() + "'");
httpClient.getParams().setParameter(param.getKey(), param.getValue());
}
}
} | class class_name[name] begin[{]
method[afterPropertiesSet, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.httpClient], ==, literal[null]]] begin[{]
assign[member[.httpClient], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultHttpClient, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.params], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Setting custom Http param on client: '"), operandr=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'='"), operator=+), operandr=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="'"), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getParams, postfix_operators=[], prefix_operators=[], qualifier=httpClient, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None)], member=setParameter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=params, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=param)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[afterPropertiesSet] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[httpClient] operator[==] Other[null] operator[SEP] {
identifier[httpClient] operator[=] Keyword[new] identifier[DefaultHttpClient] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[params] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[param] operator[:] identifier[params] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[param] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[param] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[httpClient] operator[SEP] identifier[getParams] operator[SEP] operator[SEP] operator[SEP] identifier[setParameter] operator[SEP] identifier[param] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] , identifier[param] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public OneToMany<Attributes<T>> getOrCreateOneToMany()
{
List<Node> nodeList = childNode.get("one-to-many");
if (nodeList != null && nodeList.size() > 0)
{
return new OneToManyImpl<Attributes<T>>(this, "one-to-many", childNode, nodeList.get(0));
}
return createOneToMany();
} | class class_name[name] begin[{]
method[getOrCreateOneToMany, return_type[type[OneToMany]], modifier[public], parameter[]] begin[{]
local_variable[type[List], nodeList]
if[binary_operation[binary_operation[member[.nodeList], !=, literal[null]], &&, binary_operation[call[nodeList.size, parameter[]], >, literal[0]]]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="one-to-many"), MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=nodeList, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Attributes, sub_type=None))], dimensions=None, name=OneToManyImpl, sub_type=None))]
else begin[{]
None
end[}]
return[call[.createOneToMany, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[OneToMany] operator[<] identifier[Attributes] operator[<] identifier[T] operator[>] operator[>] identifier[getOrCreateOneToMany] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[childNode] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodeList] operator[!=] Other[null] operator[&&] identifier[nodeList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[OneToManyImpl] operator[<] identifier[Attributes] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[nodeList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[createOneToMany] operator[SEP] operator[SEP] operator[SEP]
}
|
void resetDefaultsFlag() {
hasDefaultValues = false;
for (int i = 0; i < colDefaults.length; i++) {
hasDefaultValues = hasDefaultValues || colDefaults[i] != null;
}
} | class class_name[name] begin[{]
method[resetDefaultsFlag, return_type[void], modifier[default], parameter[]] begin[{]
assign[member[.hasDefaultValues], literal[false]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=hasDefaultValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=hasDefaultValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=colDefaults, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=||)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=colDefaults, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[void] identifier[resetDefaultsFlag] operator[SEP] operator[SEP] {
identifier[hasDefaultValues] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[colDefaults] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[hasDefaultValues] operator[=] identifier[hasDefaultValues] operator[||] identifier[colDefaults] operator[SEP] identifier[i] operator[SEP] operator[!=] Other[null] operator[SEP]
}
}
|
public ExplanationOfBenefit addOccurenceSpanCode(Coding t) { //3
if (t == null)
return this;
if (this.occurenceSpanCode == null)
this.occurenceSpanCode = new ArrayList<Coding>();
this.occurenceSpanCode.add(t);
return this;
} | class class_name[name] begin[{]
method[addOccurenceSpanCode, return_type[type[ExplanationOfBenefit]], modifier[public], parameter[t]] begin[{]
if[binary_operation[member[.t], ==, literal[null]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
if[binary_operation[THIS[member[None.occurenceSpanCode]], ==, literal[null]]] begin[{]
assign[THIS[member[None.occurenceSpanCode]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Coding, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
THIS[member[None.occurenceSpanCode]call[None.add, parameter[member[.t]]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ExplanationOfBenefit] identifier[addOccurenceSpanCode] operator[SEP] identifier[Coding] identifier[t] operator[SEP] {
Keyword[if] operator[SEP] identifier[t] operator[==] Other[null] operator[SEP] Keyword[return] Keyword[this] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[occurenceSpanCode] operator[==] Other[null] operator[SEP] Keyword[this] operator[SEP] identifier[occurenceSpanCode] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Coding] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[occurenceSpanCode] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public List<WebhookDeliveryLiteDto> selectByWebhookUuid(DbSession dbSession, String webhookUuid, int offset, int limit) {
return mapper(dbSession).selectByWebhookUuid(webhookUuid, new RowBounds(offset, limit));
} | class class_name[name] begin[{]
method[selectByWebhookUuid, return_type[type[List]], modifier[public], parameter[dbSession, webhookUuid, offset, limit]] begin[{]
return[call[.mapper, parameter[member[.dbSession]]]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[WebhookDeliveryLiteDto] operator[>] identifier[selectByWebhookUuid] operator[SEP] identifier[DbSession] identifier[dbSession] , identifier[String] identifier[webhookUuid] , Keyword[int] identifier[offset] , Keyword[int] identifier[limit] operator[SEP] {
Keyword[return] identifier[mapper] operator[SEP] identifier[dbSession] operator[SEP] operator[SEP] identifier[selectByWebhookUuid] operator[SEP] identifier[webhookUuid] , Keyword[new] identifier[RowBounds] operator[SEP] identifier[offset] , identifier[limit] operator[SEP] operator[SEP] operator[SEP]
}
|
protected void findParameters(final List<Parameter> parms, final Term trm) {
List<BELObject> tfa = trm.getFunctionArguments();
if (hasItems(tfa)) {
for (BELObject bmo : tfa) {
if (Parameter.class.isAssignableFrom(bmo.getClass())) {
Parameter p = (Parameter) bmo;
parms.add(p);
} else {
Term inner = (Term) bmo;
if (!isProteinDecorator(inner.function)) {
findParameters(parms, inner);
} else if (FUSION.equals(inner.function)
&& hasItems(inner.getParameters())) {
parms.add(inner.getParameters().get(0));
}
}
}
}
} | class class_name[name] begin[{]
method[findParameters, return_type[void], modifier[protected], parameter[parms, trm]] begin[{]
local_variable[type[List], tfa]
if[call[.hasItems, parameter[member[.tfa]]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=bmo, selectors=[], type_arguments=None)], member=isAssignableFrom, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Parameter, sub_type=None)), else_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=bmo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Term, sub_type=None)), name=inner)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Term, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=function, postfix_operators=[], prefix_operators=[], qualifier=inner, selectors=[])], member=isProteinDecorator, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=function, postfix_operators=[], prefix_operators=[], qualifier=inner, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=FUSION, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParameters, postfix_operators=[], prefix_operators=[], qualifier=inner, selectors=[], type_arguments=None)], member=hasItems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParameters, postfix_operators=[], prefix_operators=[], qualifier=inner, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=parms, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=inner, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=findParameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=bmo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Parameter, sub_type=None)), name=p)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Parameter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=parms, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=tfa, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bmo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BELObject, sub_type=None))), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[void] identifier[findParameters] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Parameter] operator[>] identifier[parms] , Keyword[final] identifier[Term] identifier[trm] operator[SEP] {
identifier[List] operator[<] identifier[BELObject] operator[>] identifier[tfa] operator[=] identifier[trm] operator[SEP] identifier[getFunctionArguments] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hasItems] operator[SEP] identifier[tfa] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[BELObject] identifier[bmo] operator[:] identifier[tfa] operator[SEP] {
Keyword[if] operator[SEP] identifier[Parameter] operator[SEP] Keyword[class] operator[SEP] identifier[isAssignableFrom] operator[SEP] identifier[bmo] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Parameter] identifier[p] operator[=] operator[SEP] identifier[Parameter] operator[SEP] identifier[bmo] operator[SEP] identifier[parms] operator[SEP] identifier[add] operator[SEP] identifier[p] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Term] identifier[inner] operator[=] operator[SEP] identifier[Term] operator[SEP] identifier[bmo] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isProteinDecorator] operator[SEP] identifier[inner] operator[SEP] identifier[function] operator[SEP] operator[SEP] {
identifier[findParameters] operator[SEP] identifier[parms] , identifier[inner] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[FUSION] operator[SEP] identifier[equals] operator[SEP] identifier[inner] operator[SEP] identifier[function] operator[SEP] operator[&&] identifier[hasItems] operator[SEP] identifier[inner] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[parms] operator[SEP] identifier[add] operator[SEP] identifier[inner] operator[SEP] identifier[getParameters] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.