code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
byte[] pickleMetrics(List<MetricTuple> metrics) throws IOException {
// Extremely rough estimate of 75 bytes per message
ByteArrayOutputStream out = new ByteArrayOutputStream(metrics.size() * 75);
Writer pickled = new OutputStreamWriter(out, charset);
pickled.append(MARK);
pickled.append(LIST);
for (MetricTuple tuple : metrics) {
// start the outer tuple
pickled.append(MARK);
// the metric name is a string.
pickled.append(STRING);
// the single quotes are to match python's repr("abcd")
pickled.append(QUOTE);
pickled.append(tuple.name);
pickled.append(QUOTE);
pickled.append(LF);
// start the inner tuple
pickled.append(MARK);
// timestamp is a long
pickled.append(LONG);
pickled.append(Long.toString(tuple.timestamp));
// the trailing L is to match python's repr(long(1234))
pickled.append(LONG);
pickled.append(LF);
// and the value is a string.
pickled.append(STRING);
pickled.append(QUOTE);
pickled.append(tuple.value);
pickled.append(QUOTE);
pickled.append(LF);
pickled.append(TUPLE); // inner close
pickled.append(TUPLE); // outer close
pickled.append(APPEND);
}
// every pickle ends with STOP
pickled.append(STOP);
pickled.flush();
return out.toByteArray();
} | class class_name[name] begin[{]
method[pickleMetrics, return_type[type[byte]], modifier[default], parameter[metrics]] begin[{]
local_variable[type[ByteArrayOutputStream], out]
local_variable[type[Writer], pickled]
call[pickled.append, parameter[member[.MARK]]]
call[pickled.append, parameter[member[.LIST]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MARK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=STRING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=QUOTE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=tuple, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=QUOTE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=LF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=MARK, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=timestamp, postfix_operators=[], prefix_operators=[], qualifier=tuple, selectors=[])], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Long, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=LONG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=LF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=STRING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=QUOTE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=tuple, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=QUOTE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=LF, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TUPLE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=TUPLE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=APPEND, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=pickled, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=metrics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tuple)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MetricTuple, sub_type=None))), label=None)
call[pickled.append, parameter[member[.STOP]]]
call[pickled.flush, parameter[]]
return[call[out.toByteArray, parameter[]]]
end[}]
END[}] | Keyword[byte] operator[SEP] operator[SEP] identifier[pickleMetrics] operator[SEP] identifier[List] operator[<] identifier[MetricTuple] operator[>] identifier[metrics] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[ByteArrayOutputStream] identifier[out] operator[=] Keyword[new] identifier[ByteArrayOutputStream] operator[SEP] identifier[metrics] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[*] Other[75] operator[SEP] operator[SEP] identifier[Writer] identifier[pickled] operator[=] Keyword[new] identifier[OutputStreamWriter] operator[SEP] identifier[out] , identifier[charset] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[MARK] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[LIST] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[MetricTuple] identifier[tuple] operator[:] identifier[metrics] operator[SEP] {
identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[MARK] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[STRING] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[QUOTE] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[tuple] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[QUOTE] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[LF] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[MARK] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[LONG] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[Long] operator[SEP] identifier[toString] operator[SEP] identifier[tuple] operator[SEP] identifier[timestamp] operator[SEP] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[LONG] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[LF] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[STRING] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[QUOTE] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[tuple] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[QUOTE] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[LF] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[TUPLE] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[TUPLE] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[APPEND] operator[SEP] operator[SEP]
}
identifier[pickled] operator[SEP] identifier[append] operator[SEP] identifier[STOP] operator[SEP] operator[SEP] identifier[pickled] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[out] operator[SEP] identifier[toByteArray] operator[SEP] operator[SEP] operator[SEP]
}
|
public void setMemberData(StructureMembers.Member m, Array data) {
if (data == null)
throw new IllegalArgumentException("data cant be null");
memberData.put(m, data);
} | class class_name[name] begin[{]
method[setMemberData, return_type[void], modifier[public], parameter[m, data]] begin[{]
if[binary_operation[member[.data], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="data cant be null")], 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[}]
call[memberData.put, parameter[member[.m], member[.data]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setMemberData] operator[SEP] identifier[StructureMembers] operator[SEP] identifier[Member] identifier[m] , identifier[Array] identifier[data] operator[SEP] {
Keyword[if] operator[SEP] identifier[data] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[memberData] operator[SEP] identifier[put] operator[SEP] identifier[m] , identifier[data] operator[SEP] operator[SEP]
}
|
private void createIndex() {
indexLen = MIN_LEN;
TreeMap<String, TreeSet<Integer>> indexT = new TreeMap<String, TreeSet<Integer>>();
for(String s: dp.keySet()) {
if(s.length() < indexLen)
continue;
String temp = s.substring(0, indexLen);
//System.out.println(temp);
if(indexT.containsKey(temp) == false) {
TreeSet<Integer> set = new TreeSet<Integer>();
set.add(s.length());
indexT.put(temp, set);
} else {
indexT.get(temp).add(s.length());
}
}
for(Entry<String, TreeSet<Integer>> entry: indexT.entrySet()) {
String key = entry.getKey();
TreeSet<Integer> set = entry.getValue();
int[] ia = new int[set.size()];
int i = set.size();
// System.out.println(key);
for(Integer integer: set) {
ia[--i] = integer;
}
// for(int j = 0; j < ia.length; j++)
// System.out.println(ia[j]);
index.put(key, ia);
}
// System.out.println(indexT);
} | class class_name[name] begin[{]
method[createIndex, return_type[void], modifier[private], parameter[]] begin[{]
assign[member[.indexLen], member[.MIN_LEN]]
local_variable[type[TreeMap], indexT]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operandr=MemberReference(member=indexLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=indexLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), name=temp)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=temp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=[], qualifier=indexT, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=temp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=indexT, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=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=Integer, sub_type=None))], dimensions=None, name=TreeSet, sub_type=None)), name=set)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=[], name=TreeSet, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=set, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=temp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=set, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=indexT, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=dp, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=set)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=[], name=TreeSet, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=set, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int)), name=ia)], modifiers=set(), type=BasicType(dimensions=[None], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=set, selectors=[], type_arguments=None), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ia, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=['--'], qualifier=, selectors=[]))]), type==, value=MemberReference(member=integer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=set, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=integer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ia, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=index, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=indexT, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], 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=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=[], name=TreeSet, sub_type=None))], dimensions=[], name=Entry, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[createIndex] operator[SEP] operator[SEP] {
identifier[indexLen] operator[=] identifier[MIN_LEN] operator[SEP] identifier[TreeMap] operator[<] identifier[String] , identifier[TreeSet] operator[<] identifier[Integer] operator[>] operator[>] identifier[indexT] operator[=] Keyword[new] identifier[TreeMap] operator[<] identifier[String] , identifier[TreeSet] operator[<] identifier[Integer] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[s] operator[:] identifier[dp] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[<] identifier[indexLen] operator[SEP] Keyword[continue] operator[SEP] identifier[String] identifier[temp] operator[=] identifier[s] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[indexLen] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[indexT] operator[SEP] identifier[containsKey] operator[SEP] identifier[temp] operator[SEP] operator[==] literal[boolean] operator[SEP] {
identifier[TreeSet] operator[<] identifier[Integer] operator[>] identifier[set] operator[=] Keyword[new] identifier[TreeSet] operator[<] identifier[Integer] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[add] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[indexT] operator[SEP] identifier[put] operator[SEP] identifier[temp] , identifier[set] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[indexT] operator[SEP] identifier[get] operator[SEP] identifier[temp] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[TreeSet] operator[<] identifier[Integer] operator[>] operator[>] identifier[entry] operator[:] identifier[indexT] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[key] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[TreeSet] operator[<] identifier[Integer] operator[>] identifier[set] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[ia] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[set] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[set] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Integer] identifier[integer] operator[:] identifier[set] operator[SEP] {
identifier[ia] operator[SEP] operator[--] identifier[i] operator[SEP] operator[=] identifier[integer] operator[SEP]
}
identifier[index] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[ia] operator[SEP] operator[SEP]
}
}
|
public static int[] getBondCoordinates(IBond bond) {
if (bond.getBegin().getPoint2d() == null || bond.getEnd().getPoint2d() == null) {
logger.error("getBondCoordinates() called on Bond without 2D coordinates!");
return new int[0];
}
int beginX = (int) bond.getBegin().getPoint2d().x;
int endX = (int) bond.getEnd().getPoint2d().x;
int beginY = (int) bond.getBegin().getPoint2d().y;
int endY = (int) bond.getEnd().getPoint2d().y;
return new int[]{beginX, beginY, endX, endY};
} | class class_name[name] begin[{]
method[getBondCoordinates, return_type[type[int]], modifier[public static], parameter[bond]] begin[{]
if[binary_operation[binary_operation[call[bond.getBegin, parameter[]], ==, literal[null]], ||, binary_operation[call[bond.getEnd, parameter[]], ==, literal[null]]]] begin[{]
call[logger.error, parameter[literal["getBondCoordinates() called on Bond without 2D coordinates!"]]]
return[ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int))]
else begin[{]
None
end[}]
local_variable[type[int], beginX]
local_variable[type[int], endX]
local_variable[type[int], beginY]
local_variable[type[int], endY]
return[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=beginX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=beginY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=endX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=endY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] operator[SEP] operator[SEP] identifier[getBondCoordinates] operator[SEP] identifier[IBond] identifier[bond] operator[SEP] {
Keyword[if] operator[SEP] identifier[bond] operator[SEP] identifier[getBegin] operator[SEP] operator[SEP] operator[SEP] identifier[getPoint2d] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[bond] operator[SEP] identifier[getEnd] operator[SEP] operator[SEP] operator[SEP] identifier[getPoint2d] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] Keyword[int] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[int] identifier[beginX] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[bond] operator[SEP] identifier[getBegin] operator[SEP] operator[SEP] operator[SEP] identifier[getPoint2d] operator[SEP] operator[SEP] operator[SEP] identifier[x] operator[SEP] Keyword[int] identifier[endX] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[bond] operator[SEP] identifier[getEnd] operator[SEP] operator[SEP] operator[SEP] identifier[getPoint2d] operator[SEP] operator[SEP] operator[SEP] identifier[x] operator[SEP] Keyword[int] identifier[beginY] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[bond] operator[SEP] identifier[getBegin] operator[SEP] operator[SEP] operator[SEP] identifier[getPoint2d] operator[SEP] operator[SEP] operator[SEP] identifier[y] operator[SEP] Keyword[int] identifier[endY] operator[=] operator[SEP] Keyword[int] operator[SEP] identifier[bond] operator[SEP] identifier[getEnd] operator[SEP] operator[SEP] operator[SEP] identifier[getPoint2d] operator[SEP] operator[SEP] operator[SEP] identifier[y] operator[SEP] Keyword[return] Keyword[new] Keyword[int] operator[SEP] operator[SEP] {
identifier[beginX] , identifier[beginY] , identifier[endX] , identifier[endY]
} operator[SEP]
}
|
public void setVolumes(java.util.Collection<ImportInstanceVolumeDetailItem> volumes) {
if (volumes == null) {
this.volumes = null;
return;
}
this.volumes = new com.amazonaws.internal.SdkInternalList<ImportInstanceVolumeDetailItem>(volumes);
} | class class_name[name] begin[{]
method[setVolumes, return_type[void], modifier[public], parameter[volumes]] begin[{]
if[binary_operation[member[.volumes], ==, literal[null]]] begin[{]
assign[THIS[member[None.volumes]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.volumes]], ClassCreator(arguments=[MemberReference(member=volumes, 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=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ImportInstanceVolumeDetailItem, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setVolumes] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[ImportInstanceVolumeDetailItem] operator[>] identifier[volumes] operator[SEP] {
Keyword[if] operator[SEP] identifier[volumes] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[volumes] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[volumes] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[ImportInstanceVolumeDetailItem] operator[>] operator[SEP] identifier[volumes] operator[SEP] operator[SEP]
}
|
public boolean reloadAllocsIfNecessary() {
if (allocFile == null) {
// A warning has been logged when allocFile is null.
// We should just return here.
return false;
}
long time = System.currentTimeMillis();
boolean reloaded = false;
if (time > lastReloadAttempt + ALLOC_RELOAD_INTERVAL) {
lastReloadAttempt = time;
try {
File file = new File(allocFile);
long lastModified = file.lastModified();
if (lastModified > lastSuccessfulReload &&
time > lastModified + ALLOC_RELOAD_WAIT) {
reloadAllocs();
reloaded = true;
lastSuccessfulReload = time;
lastReloadAttemptFailed = false;
}
} catch (Exception e) {
// Throwing the error further out here won't help - the RPC thread
// will catch it and report it in a loop. Instead, just log it and
// hope somebody will notice from the log.
// We log the error only on the first failure so we don't fill up the
// JobTracker's log with these messages.
if (!lastReloadAttemptFailed) {
LOG.error("Failed to reload allocations file - " +
"will use existing allocations.", e);
}
lastReloadAttemptFailed = true;
}
}
return reloaded;
} | class class_name[name] begin[{]
method[reloadAllocsIfNecessary, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.allocFile], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[long], time]
local_variable[type[boolean], reloaded]
if[binary_operation[member[.time], >, binary_operation[member[.lastReloadAttempt], +, member[.ALLOC_RELOAD_INTERVAL]]]] begin[{]
assign[member[.lastReloadAttempt], member[.time]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=allocFile, 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)), name=file)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=lastModified, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), name=lastModified)], modifiers=set(), type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=lastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=lastSuccessfulReload, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), operandr=BinaryOperation(operandl=MemberReference(member=time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=lastModified, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=ALLOC_RELOAD_WAIT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=reloadAllocs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=reloaded, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastSuccessfulReload, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=time, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastReloadAttemptFailed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]))], catches=[CatchClause(block=[IfStatement(condition=MemberReference(member=lastReloadAttemptFailed, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to reload allocations file - "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="will use existing allocations."), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastReloadAttemptFailed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.reloaded]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[reloadAllocsIfNecessary] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[allocFile] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[long] identifier[time] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[reloaded] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[time] operator[>] identifier[lastReloadAttempt] operator[+] identifier[ALLOC_RELOAD_INTERVAL] operator[SEP] {
identifier[lastReloadAttempt] operator[=] identifier[time] operator[SEP] Keyword[try] {
identifier[File] identifier[file] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[allocFile] operator[SEP] operator[SEP] Keyword[long] identifier[lastModified] operator[=] identifier[file] operator[SEP] identifier[lastModified] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lastModified] operator[>] identifier[lastSuccessfulReload] operator[&&] identifier[time] operator[>] identifier[lastModified] operator[+] identifier[ALLOC_RELOAD_WAIT] operator[SEP] {
identifier[reloadAllocs] operator[SEP] operator[SEP] operator[SEP] identifier[reloaded] operator[=] literal[boolean] operator[SEP] identifier[lastSuccessfulReload] operator[=] identifier[time] operator[SEP] identifier[lastReloadAttemptFailed] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[lastReloadAttemptFailed] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[lastReloadAttemptFailed] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[return] identifier[reloaded] operator[SEP]
}
|
@Override
public boolean canUpdateNode(IUserLayoutNodeDescription node) {
if (node == null) return false;
return isFragmentOwner
|| node.isEditAllowed()
|| node instanceof IUserLayoutChannelDescription;
} | class class_name[name] begin[{]
method[canUpdateNode, return_type[type[boolean]], modifier[public], parameter[node]] begin[{]
if[binary_operation[member[.node], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[binary_operation[binary_operation[member[.isFragmentOwner], ||, call[node.isEditAllowed, parameter[]]], ||, binary_operation[member[.node], instanceof, type[IUserLayoutChannelDescription]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[canUpdateNode] operator[SEP] identifier[IUserLayoutNodeDescription] identifier[node] operator[SEP] {
Keyword[if] operator[SEP] identifier[node] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[return] identifier[isFragmentOwner] operator[||] identifier[node] operator[SEP] identifier[isEditAllowed] operator[SEP] operator[SEP] operator[||] identifier[node] Keyword[instanceof] identifier[IUserLayoutChannelDescription] operator[SEP]
}
|
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XbasePackage.XFOR_LOOP_EXPRESSION__FOR_EXPRESSION:
return basicSetForExpression(null, msgs);
case XbasePackage.XFOR_LOOP_EXPRESSION__EACH_EXPRESSION:
return basicSetEachExpression(null, msgs);
case XbasePackage.XFOR_LOOP_EXPRESSION__DECLARED_PARAM:
return basicSetDeclaredParam(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
} | class class_name[name] begin[{]
method[eInverseRemove, return_type[type[NotificationChain]], modifier[public], parameter[otherEnd, featureID, msgs]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=XFOR_LOOP_EXPRESSION__FOR_EXPRESSION, postfix_operators=[], prefix_operators=[], qualifier=XbasePackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=basicSetForExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=XFOR_LOOP_EXPRESSION__EACH_EXPRESSION, postfix_operators=[], prefix_operators=[], qualifier=XbasePackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=basicSetEachExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), SwitchStatementCase(case=[MemberReference(member=XFOR_LOOP_EXPRESSION__DECLARED_PARAM, postfix_operators=[], prefix_operators=[], qualifier=XbasePackage, selectors=[])], statements=[ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=basicSetDeclaredParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=otherEnd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eInverseRemove, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[NotificationChain] identifier[eInverseRemove] operator[SEP] identifier[InternalEObject] identifier[otherEnd] , Keyword[int] identifier[featureID] , identifier[NotificationChain] identifier[msgs] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[XbasePackage] operator[SEP] identifier[XFOR_LOOP_EXPRESSION__FOR_EXPRESSION] operator[:] Keyword[return] identifier[basicSetForExpression] operator[SEP] Other[null] , identifier[msgs] operator[SEP] operator[SEP] Keyword[case] identifier[XbasePackage] operator[SEP] identifier[XFOR_LOOP_EXPRESSION__EACH_EXPRESSION] operator[:] Keyword[return] identifier[basicSetEachExpression] operator[SEP] Other[null] , identifier[msgs] operator[SEP] operator[SEP] Keyword[case] identifier[XbasePackage] operator[SEP] identifier[XFOR_LOOP_EXPRESSION__DECLARED_PARAM] operator[:] Keyword[return] identifier[basicSetDeclaredParam] operator[SEP] Other[null] , identifier[msgs] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eInverseRemove] operator[SEP] identifier[otherEnd] , identifier[featureID] , identifier[msgs] operator[SEP] operator[SEP]
}
|
@Override
public SparseTensor elementwiseProduct(Tensor other) {
int[] dimensionNums = getDimensionNumbers();
int[] dimensionSizes = getDimensionSizes();
int[] otherDimensions = other.getDimensionNumbers();
int[] otherSizes = other.getDimensionSizes();
// Check that dimensionNums contains a superset of otherDimensions
int myInd = 0, otherInd = 0;
int myLength = dimensionNums.length;
int otherLength = otherDimensions.length;
while (myInd < myLength && otherInd < otherLength) {
if (dimensionNums[myInd] < otherDimensions[otherInd]) {
myInd++;
} else if (dimensionNums[myInd] == otherDimensions[otherInd]) {
Preconditions.checkArgument(dimensionSizes[myInd] == otherSizes[otherInd],
"dimensionSizes[myInd]: %s\notherSizes[otherInd]: %s",
dimensionSizes[myInd], otherSizes[otherInd]);
myInd++;
otherInd++;
} else {
// Not a superset.
Preconditions.checkArgument(false, "Dimensions not a superset");
}
}
// There are three possible multiplication implementations: an extremely
// fast one for the case when both sets of dimensions are exactly equal,
// a pretty fast one for when the dimensions of other line up
// against the leftmost dimensions of this, and another for all
// other cases. Check which case applies, then use the
// fastest possible algorithm.
for (int i = 0; i < otherDimensions.length; i++) {
if (otherDimensions[i] != dimensionNums[i]) {
// Not left aligned.
return elementwiseMultiplyNaive(this, other);
}
}
if (otherDimensions.length == dimensionNums.length) {
// Both tensors contain the exact same set of dimensions
return elementwiseMultiplySparseDense(this, other);
} else {
// Dimensions of other are aligned with the leftmost dimensions
// of this tensor.
return elementwiseMultiplyLeftAligned(this, other);
}
} | class class_name[name] begin[{]
method[elementwiseProduct, return_type[type[SparseTensor]], modifier[public], parameter[other]] begin[{]
local_variable[type[int], dimensionNums]
local_variable[type[int], dimensionSizes]
local_variable[type[int], otherDimensions]
local_variable[type[int], otherSizes]
local_variable[type[int], myInd]
local_variable[type[int], myLength]
local_variable[type[int], otherLength]
while[binary_operation[binary_operation[member[.myInd], <, member[.myLength]], &&, binary_operation[member[.otherInd], <, member[.otherLength]]]] begin[{]
if[binary_operation[member[.dimensionNums], <, member[.otherDimensions]]] begin[{]
member[.myInd]
else begin[{]
if[binary_operation[member[.dimensionNums], ==, member[.otherDimensions]]] begin[{]
call[Preconditions.checkArgument, parameter[binary_operation[member[.dimensionSizes], ==, member[.otherSizes]], literal["dimensionSizes[myInd]: %s\notherSizes[otherInd]: %s"], member[.dimensionSizes], member[.otherSizes]]]
member[.myInd]
member[.otherInd]
else begin[{]
call[Preconditions.checkArgument, parameter[literal[false], literal["Dimensions not a superset"]]]
end[}]
end[}]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=otherDimensions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=dimensionNums, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=other, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=elementwiseMultiplyNaive, 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=otherDimensions, 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)
if[binary_operation[member[otherDimensions.length], ==, member[dimensionNums.length]]] begin[{]
return[call[.elementwiseMultiplySparseDense, parameter[THIS[], member[.other]]]]
else begin[{]
return[call[.elementwiseMultiplyLeftAligned, parameter[THIS[], member[.other]]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[SparseTensor] identifier[elementwiseProduct] operator[SEP] identifier[Tensor] identifier[other] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[dimensionNums] operator[=] identifier[getDimensionNumbers] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[dimensionSizes] operator[=] identifier[getDimensionSizes] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[otherDimensions] operator[=] identifier[other] operator[SEP] identifier[getDimensionNumbers] operator[SEP] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[otherSizes] operator[=] identifier[other] operator[SEP] identifier[getDimensionSizes] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[myInd] operator[=] Other[0] , identifier[otherInd] operator[=] Other[0] operator[SEP] Keyword[int] identifier[myLength] operator[=] identifier[dimensionNums] operator[SEP] identifier[length] operator[SEP] Keyword[int] identifier[otherLength] operator[=] identifier[otherDimensions] operator[SEP] identifier[length] operator[SEP] Keyword[while] operator[SEP] identifier[myInd] operator[<] identifier[myLength] operator[&&] identifier[otherInd] operator[<] identifier[otherLength] operator[SEP] {
Keyword[if] operator[SEP] identifier[dimensionNums] operator[SEP] identifier[myInd] operator[SEP] operator[<] identifier[otherDimensions] operator[SEP] identifier[otherInd] operator[SEP] operator[SEP] {
identifier[myInd] operator[++] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[dimensionNums] operator[SEP] identifier[myInd] operator[SEP] operator[==] identifier[otherDimensions] operator[SEP] identifier[otherInd] operator[SEP] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] identifier[dimensionSizes] operator[SEP] identifier[myInd] operator[SEP] operator[==] identifier[otherSizes] operator[SEP] identifier[otherInd] operator[SEP] , literal[String] , identifier[dimensionSizes] operator[SEP] identifier[myInd] operator[SEP] , identifier[otherSizes] operator[SEP] identifier[otherInd] operator[SEP] operator[SEP] operator[SEP] identifier[myInd] operator[++] operator[SEP] identifier[otherInd] operator[++] operator[SEP]
}
Keyword[else] {
identifier[Preconditions] operator[SEP] identifier[checkArgument] operator[SEP] literal[boolean] , literal[String] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[otherDimensions] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[otherDimensions] operator[SEP] identifier[i] operator[SEP] operator[!=] identifier[dimensionNums] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
Keyword[return] identifier[elementwiseMultiplyNaive] operator[SEP] Keyword[this] , identifier[other] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[otherDimensions] operator[SEP] identifier[length] operator[==] identifier[dimensionNums] operator[SEP] identifier[length] operator[SEP] {
Keyword[return] identifier[elementwiseMultiplySparseDense] operator[SEP] Keyword[this] , identifier[other] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[elementwiseMultiplyLeftAligned] operator[SEP] Keyword[this] , identifier[other] operator[SEP] operator[SEP]
}
}
|
public static void setCompressionType(ImageWriteParam param, BufferedImage image)
{
// avoid error: first compression type is RLE, not optimal and incorrect for color images
// TODO expose this choice to the user?
if (image.getType() == BufferedImage.TYPE_BYTE_BINARY &&
image.getColorModel().getPixelSize() == 1)
{
param.setCompressionType("CCITT T.6");
}
else
{
param.setCompressionType("LZW");
}
} | class class_name[name] begin[{]
method[setCompressionType, return_type[void], modifier[public static], parameter[param, image]] begin[{]
if[binary_operation[binary_operation[call[image.getType, parameter[]], ==, member[BufferedImage.TYPE_BYTE_BINARY]], &&, binary_operation[call[image.getColorModel, parameter[]], ==, literal[1]]]] begin[{]
call[param.setCompressionType, parameter[literal["CCITT T.6"]]]
else begin[{]
call[param.setCompressionType, parameter[literal["LZW"]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[setCompressionType] operator[SEP] identifier[ImageWriteParam] identifier[param] , identifier[BufferedImage] identifier[image] operator[SEP] {
Keyword[if] operator[SEP] identifier[image] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[==] identifier[BufferedImage] operator[SEP] identifier[TYPE_BYTE_BINARY] operator[&&] identifier[image] operator[SEP] identifier[getColorModel] operator[SEP] operator[SEP] operator[SEP] identifier[getPixelSize] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[param] operator[SEP] identifier[setCompressionType] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[param] operator[SEP] identifier[setCompressionType] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public boolean filterNTLMResponses(String k) {
boolean found = false;
for (int i=0; i<nkeys; i++) {
if (k.equalsIgnoreCase(keys[i])
&& values[i] != null && values[i].length() > 5
&& values[i].regionMatches(true, 0, "NTLM ", 0, 5)) {
found = true;
break;
}
}
if (found) {
int j = 0;
for (int i=0; i<nkeys; i++) {
if (k.equalsIgnoreCase(keys[i]) && (
"Negotiate".equalsIgnoreCase(values[i]) ||
"Kerberos".equalsIgnoreCase(values[i]))) {
continue;
}
if (i != j) {
keys[j] = keys[i];
values[j] = values[i];
}
j++;
}
if (j != nkeys) {
nkeys = j;
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[filterNTLMResponses, return_type[type[boolean]], modifier[public], parameter[k]] begin[{]
local_variable[type[boolean], found]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=k, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=values, 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=&&), operandr=BinaryOperation(operandl=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5), operator=>), operator=&&), operandr=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="NTLM "), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)], member=regionMatches, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=found, 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)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nkeys, 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)
if[member[.found]] begin[{]
local_variable[type[int], j]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=k, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="Negotiate"), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="Kerberos"), operator=||), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=keys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)])), StatementExpression(expression=MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nkeys, 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)
if[binary_operation[member[.j], !=, member[.nkeys]]] begin[{]
assign[member[.nkeys], member[.j]]
return[literal[true]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[filterNTLMResponses] operator[SEP] identifier[String] identifier[k] operator[SEP] {
Keyword[boolean] identifier[found] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[nkeys] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[k] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[keys] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[&&] identifier[values] operator[SEP] identifier[i] operator[SEP] operator[!=] Other[null] operator[&&] identifier[values] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[5] operator[&&] identifier[values] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[regionMatches] operator[SEP] literal[boolean] , Other[0] , literal[String] , Other[0] , Other[5] operator[SEP] operator[SEP] {
identifier[found] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[found] operator[SEP] {
Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[nkeys] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[k] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[keys] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[&&] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[values] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[||] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[values] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[i] operator[!=] identifier[j] operator[SEP] {
identifier[keys] operator[SEP] identifier[j] operator[SEP] operator[=] identifier[keys] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[values] operator[SEP] identifier[j] operator[SEP] operator[=] identifier[values] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
identifier[j] operator[++] operator[SEP]
}
Keyword[if] operator[SEP] identifier[j] operator[!=] identifier[nkeys] operator[SEP] {
identifier[nkeys] operator[=] identifier[j] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
void writeLine(String line) throws IOException {
checkState(isRunning(), "Cannot read items from a %s StreamService", state());
checkState(socketWriter != null, "Attempted to write to the socket before it was opened.");
try {
socketWriter.write(line);
socketWriter.write('\n');
// We need to flush since this is a back and forth lockstep protocol, buffering can cause
// deadlock!
socketWriter.flush();
} catch (IOException e) {
Closeables.close(socketWriter, true);
notifyFailed(e);
throw e;
}
} | class class_name[name] begin[{]
method[writeLine, return_type[void], modifier[default], parameter[line]] begin[{]
call[.checkState, parameter[call[.isRunning, parameter[]], literal["Cannot read items from a %s StreamService"], call[.state, parameter[]]]]
call[.checkState, parameter[binary_operation[member[.socketWriter], !=, literal[null]], literal["Attempted to write to the socket before it was opened."]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=write, postfix_operators=[], prefix_operators=[], qualifier=socketWriter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n')], member=write, postfix_operators=[], prefix_operators=[], qualifier=socketWriter, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=flush, postfix_operators=[], prefix_operators=[], qualifier=socketWriter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=socketWriter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=close, postfix_operators=[], prefix_operators=[], qualifier=Closeables, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=notifyFailed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[void] identifier[writeLine] operator[SEP] identifier[String] identifier[line] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[checkState] operator[SEP] identifier[isRunning] operator[SEP] operator[SEP] , literal[String] , identifier[state] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[checkState] operator[SEP] identifier[socketWriter] operator[!=] Other[null] , literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[socketWriter] operator[SEP] identifier[write] operator[SEP] identifier[line] operator[SEP] operator[SEP] identifier[socketWriter] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[socketWriter] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
identifier[Closeables] operator[SEP] identifier[close] operator[SEP] identifier[socketWriter] , literal[boolean] operator[SEP] operator[SEP] identifier[notifyFailed] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[throw] identifier[e] operator[SEP]
}
}
|
@Override
public final synchronized void addPropertyChangeListener(
PropertyChangeListener listener) {
if (listener == null) {
return;
}
if (changeSupport == null) {
changeSupport = createPropertyChangeSupport(this);
}
changeSupport.addPropertyChangeListener(listener);
} | class class_name[name] begin[{]
method[addPropertyChangeListener, return_type[void], modifier[synchronized final public], parameter[listener]] begin[{]
if[binary_operation[member[.listener], ==, literal[null]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.changeSupport], ==, literal[null]]] begin[{]
assign[member[.changeSupport], call[.createPropertyChangeSupport, parameter[THIS[]]]]
else begin[{]
None
end[}]
call[changeSupport.addPropertyChangeListener, parameter[member[.listener]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[synchronized] Keyword[void] identifier[addPropertyChangeListener] operator[SEP] identifier[PropertyChangeListener] identifier[listener] operator[SEP] {
Keyword[if] operator[SEP] identifier[listener] operator[==] Other[null] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[changeSupport] operator[==] Other[null] operator[SEP] {
identifier[changeSupport] operator[=] identifier[createPropertyChangeSupport] operator[SEP] Keyword[this] operator[SEP] operator[SEP]
}
identifier[changeSupport] operator[SEP] identifier[addPropertyChangeListener] operator[SEP] identifier[listener] operator[SEP] operator[SEP]
}
|
@Override
public void submit(String name, Runnable action) {
ActionEvent<Void> event = ActionEvent.create(name, action);
sink.add(event, Channel.BROADCAST);
} | class class_name[name] begin[{]
method[submit, return_type[void], modifier[public], parameter[name, action]] begin[{]
local_variable[type[ActionEvent], event]
call[sink.add, parameter[member[.event], member[Channel.BROADCAST]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[submit] operator[SEP] identifier[String] identifier[name] , identifier[Runnable] identifier[action] operator[SEP] {
identifier[ActionEvent] operator[<] identifier[Void] operator[>] identifier[event] operator[=] identifier[ActionEvent] operator[SEP] identifier[create] operator[SEP] identifier[name] , identifier[action] operator[SEP] operator[SEP] identifier[sink] operator[SEP] identifier[add] operator[SEP] identifier[event] , identifier[Channel] operator[SEP] identifier[BROADCAST] operator[SEP] operator[SEP]
}
|
public void initDelegateDialect(MappedStatement ms) {
if (delegate == null) {
if (autoDialect) {
this.delegate = getDialect(ms);
} else {
dialectThreadLocal.set(getDialect(ms));
}
}
} | class class_name[name] begin[{]
method[initDelegateDialect, return_type[void], modifier[public], parameter[ms]] begin[{]
if[binary_operation[member[.delegate], ==, literal[null]]] begin[{]
if[member[.autoDialect]] begin[{]
assign[THIS[member[None.delegate]], call[.getDialect, parameter[member[.ms]]]]
else begin[{]
call[dialectThreadLocal.set, parameter[call[.getDialect, parameter[member[.ms]]]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[initDelegateDialect] operator[SEP] identifier[MappedStatement] identifier[ms] operator[SEP] {
Keyword[if] operator[SEP] identifier[delegate] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[autoDialect] operator[SEP] {
Keyword[this] operator[SEP] identifier[delegate] operator[=] identifier[getDialect] operator[SEP] identifier[ms] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[dialectThreadLocal] operator[SEP] identifier[set] operator[SEP] identifier[getDialect] operator[SEP] identifier[ms] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@Deprecated
protected final void registerExtendedFactory(String key, T factory) {
extendedFactories.put(key, factory);
} | class class_name[name] begin[{]
method[registerExtendedFactory, return_type[void], modifier[final protected], parameter[key, factory]] begin[{]
call[extendedFactories.put, parameter[member[.key], member[.factory]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[protected] Keyword[final] Keyword[void] identifier[registerExtendedFactory] operator[SEP] identifier[String] identifier[key] , identifier[T] identifier[factory] operator[SEP] {
identifier[extendedFactories] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[factory] operator[SEP] operator[SEP]
}
|
public static void copyFile(@Nonnull File src, @Nonnull File dst) throws BuildException {
Copy cp = new Copy();
cp.setProject(new org.apache.tools.ant.Project());
cp.setTofile(dst);
cp.setFile(src);
cp.setOverwrite(true);
cp.execute();
} | class class_name[name] begin[{]
method[copyFile, return_type[void], modifier[public static], parameter[src, dst]] begin[{]
local_variable[type[Copy], cp]
call[cp.setProject, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=org, sub_type=ReferenceType(arguments=None, dimensions=None, name=apache, sub_type=ReferenceType(arguments=None, dimensions=None, name=tools, sub_type=ReferenceType(arguments=None, dimensions=None, name=ant, sub_type=ReferenceType(arguments=None, dimensions=None, name=Project, sub_type=None))))))]]
call[cp.setTofile, parameter[member[.dst]]]
call[cp.setFile, parameter[member[.src]]]
call[cp.setOverwrite, parameter[literal[true]]]
call[cp.execute, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[copyFile] operator[SEP] annotation[@] identifier[Nonnull] identifier[File] identifier[src] , annotation[@] identifier[Nonnull] identifier[File] identifier[dst] operator[SEP] Keyword[throws] identifier[BuildException] {
identifier[Copy] identifier[cp] operator[=] Keyword[new] identifier[Copy] operator[SEP] operator[SEP] operator[SEP] identifier[cp] operator[SEP] identifier[setProject] operator[SEP] Keyword[new] identifier[org] operator[SEP] identifier[apache] operator[SEP] identifier[tools] operator[SEP] identifier[ant] operator[SEP] identifier[Project] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[cp] operator[SEP] identifier[setTofile] operator[SEP] identifier[dst] operator[SEP] operator[SEP] identifier[cp] operator[SEP] identifier[setFile] operator[SEP] identifier[src] operator[SEP] operator[SEP] identifier[cp] operator[SEP] identifier[setOverwrite] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[cp] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP]
}
|
public String defaultActionHtml() {
String params = allParamsAsRequest();
String titleUri = CmsEncoder.escapeXml(getJsp().getRequest().getParameter(PARAM_TITLE_URI));
if (CmsStringUtil.isEmptyOrWhitespaceOnly(titleUri)) {
titleUri = CmsToolManager.ADMINVIEW_ROOT_LOCATION + "/list-title.jsp";
}
String titleSrc = getFrameSource("tool_title", getJsp().link(titleUri + "?" + params));
String contentSrc = getFrameSource(
"tool_content",
getJsp().link(CmsToolManager.ADMINVIEW_ROOT_LOCATION + "/list-explorer.jsp") + "?" + params);
StringBuffer html = new StringBuffer(1024);
html.append("<!DOCTYPE html>\n");
html.append("<html>\n");
html.append("\t<head>\n");
html.append("\t\t<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=\"").append(
getEncoding()).append("\">\n");
String uplink = "/opencms_a/opencms/system/workplace/views/admin/admin-main.jsp?path=/projects/files&action=initial&projectid=fa9f561f-be30-11e2-bac3-21ebf444feef&showexplorer=true";
html.append(
"<script type='text/javascript'>var uplink = \""
+ CmsStringUtil.escapeJavaScript(uplink)
+ "\";</script>\n");
html.append("\t\t<title>\n");
html.append(
"\t\t\t").append(
key(
org.opencms.workplace.Messages.GUI_LABEL_WPTITLE_1,
new Object[] {getSettings().getUser().getFullName()})).append("\n");
html.append("\t\t</title>\n");
html.append("\t</head>\n");
html.append("\t<frameset rows='57,*' border='0' frameborder='0' framespacing='0'>\n");
html.append("\t\t<frame ").append(titleSrc).append(" frameborder='0' border='0' noresize scrolling='no'>\n");
html.append("\t\t<frame ").append(contentSrc).append(
" frameborder='0' border='0' noresize scrolling='auto' framespacing='0' marginheight='2' marginwidth='2' >\n");
html.append("\t</frameset>\n");
html.append("</html>\n");
return html.toString();
} | class class_name[name] begin[{]
method[defaultActionHtml, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[String], params]
local_variable[type[String], titleUri]
if[call[CmsStringUtil.isEmptyOrWhitespaceOnly, parameter[member[.titleUri]]]] begin[{]
assign[member[.titleUri], binary_operation[member[CmsToolManager.ADMINVIEW_ROOT_LOCATION], +, literal["/list-title.jsp"]]]
else begin[{]
None
end[}]
local_variable[type[String], titleSrc]
local_variable[type[String], contentSrc]
local_variable[type[StringBuffer], html]
call[html.append, parameter[literal["<!DOCTYPE html>\n"]]]
call[html.append, parameter[literal["<html>\n"]]]
call[html.append, parameter[literal["\t<head>\n"]]]
call[html.append, parameter[literal["\t\t<meta HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=\""]]]
local_variable[type[String], uplink]
call[html.append, parameter[binary_operation[binary_operation[literal["<script type='text/javascript'>var uplink = \""], +, call[CmsStringUtil.escapeJavaScript, parameter[member[.uplink]]]], +, literal["\";</script>\n"]]]]
call[html.append, parameter[literal["\t\t<title>\n"]]]
call[html.append, parameter[literal["\t\t\t"]]]
call[html.append, parameter[literal["\t\t</title>\n"]]]
call[html.append, parameter[literal["\t</head>\n"]]]
call[html.append, parameter[literal["\t<frameset rows='57,*' border='0' frameborder='0' framespacing='0'>\n"]]]
call[html.append, parameter[literal["\t\t<frame "]]]
call[html.append, parameter[literal["\t\t<frame "]]]
call[html.append, parameter[literal["\t</frameset>\n"]]]
call[html.append, parameter[literal["</html>\n"]]]
return[call[html.toString, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[defaultActionHtml] operator[SEP] operator[SEP] {
identifier[String] identifier[params] operator[=] identifier[allParamsAsRequest] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[titleUri] operator[=] identifier[CmsEncoder] operator[SEP] identifier[escapeXml] operator[SEP] identifier[getJsp] operator[SEP] operator[SEP] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getParameter] operator[SEP] identifier[PARAM_TITLE_URI] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CmsStringUtil] operator[SEP] identifier[isEmptyOrWhitespaceOnly] operator[SEP] identifier[titleUri] operator[SEP] operator[SEP] {
identifier[titleUri] operator[=] identifier[CmsToolManager] operator[SEP] identifier[ADMINVIEW_ROOT_LOCATION] operator[+] literal[String] operator[SEP]
}
identifier[String] identifier[titleSrc] operator[=] identifier[getFrameSource] operator[SEP] literal[String] , identifier[getJsp] operator[SEP] operator[SEP] operator[SEP] identifier[link] operator[SEP] identifier[titleUri] operator[+] literal[String] operator[+] identifier[params] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[contentSrc] operator[=] identifier[getFrameSource] operator[SEP] literal[String] , identifier[getJsp] operator[SEP] operator[SEP] operator[SEP] identifier[link] operator[SEP] identifier[CmsToolManager] operator[SEP] identifier[ADMINVIEW_ROOT_LOCATION] operator[+] literal[String] operator[SEP] operator[+] literal[String] operator[+] identifier[params] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[html] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] Other[1024] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[getEncoding] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[uplink] operator[=] literal[String] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[CmsStringUtil] operator[SEP] identifier[escapeJavaScript] operator[SEP] identifier[uplink] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[key] operator[SEP] identifier[org] operator[SEP] identifier[opencms] operator[SEP] identifier[workplace] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_LABEL_WPTITLE_1] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[getSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getUser] operator[SEP] operator[SEP] operator[SEP] identifier[getFullName] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[titleSrc] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[contentSrc] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[html] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public Object get(Object obj) throws IllegalAccessException, InvocationTargetException {
// always try the "getMethod" first
if (getMethod != null) {
return getMethod.invoke(obj);
// fall back to getting the field directly
} else if (field != null) {
return field.get(obj);
} else {
throw new IllegalAccessException("Cannot get property value");
}
} | class class_name[name] begin[{]
method[get, return_type[type[Object]], modifier[public], parameter[obj]] begin[{]
if[binary_operation[member[.getMethod], !=, literal[null]]] begin[{]
return[call[getMethod.invoke, parameter[member[.obj]]]]
else begin[{]
if[binary_operation[member[.field], !=, literal[null]]] begin[{]
return[call[field.get, parameter[member[.obj]]]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot get property value")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalAccessException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[get] operator[SEP] identifier[Object] identifier[obj] operator[SEP] Keyword[throws] identifier[IllegalAccessException] , identifier[InvocationTargetException] {
Keyword[if] operator[SEP] identifier[getMethod] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[getMethod] operator[SEP] identifier[invoke] operator[SEP] identifier[obj] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[field] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[field] operator[SEP] identifier[get] operator[SEP] identifier[obj] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IllegalAccessException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
private synchronized void prepareFile() throws IOException{
outputFile = new File(getFileName());
if(outputFile.exists())
outputFile.delete();
if(outputFile.isDirectory())
throw new IOException("I/O Error on creating file: File is a directory!");
outputFile.createNewFile();
if(!outputFile.canWrite())
throw new IOException("I/O Error on creating file: Unable to write into file!");
} | class class_name[name] begin[{]
method[prepareFile, return_type[void], modifier[synchronized private], parameter[]] begin[{]
assign[member[.outputFile], ClassCreator(arguments=[MethodInvocation(arguments=[], member=getFileName, 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=File, sub_type=None))]
if[call[outputFile.exists, parameter[]]] begin[{]
call[outputFile.delete, parameter[]]
else begin[{]
None
end[}]
if[call[outputFile.isDirectory, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="I/O Error on creating file: File is a directory!")], 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[}]
call[outputFile.createNewFile, parameter[]]
if[call[outputFile.canWrite, parameter[]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="I/O Error on creating file: Unable to write into file!")], 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[}]
end[}]
END[}] | Keyword[private] Keyword[synchronized] Keyword[void] identifier[prepareFile] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[outputFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[getFileName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[outputFile] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] identifier[outputFile] operator[SEP] identifier[delete] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[outputFile] operator[SEP] identifier[isDirectory] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[outputFile] operator[SEP] identifier[createNewFile] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[outputFile] operator[SEP] identifier[canWrite] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
|
public Observable<ServiceResponseWithHeaders<Void, ComputeNodeUpdateUserHeaders>> updateUserWithServiceResponseAsync(String poolId, String nodeId, String userName, NodeUpdateUserParameter nodeUpdateUserParameter, ComputeNodeUpdateUserOptions computeNodeUpdateUserOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (poolId == null) {
throw new IllegalArgumentException("Parameter poolId is required and cannot be null.");
}
if (nodeId == null) {
throw new IllegalArgumentException("Parameter nodeId is required and cannot be null.");
}
if (userName == null) {
throw new IllegalArgumentException("Parameter userName is required and cannot be null.");
}
if (nodeUpdateUserParameter == null) {
throw new IllegalArgumentException("Parameter nodeUpdateUserParameter is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(nodeUpdateUserParameter);
Validator.validate(computeNodeUpdateUserOptions);
Integer timeout = null;
if (computeNodeUpdateUserOptions != null) {
timeout = computeNodeUpdateUserOptions.timeout();
}
UUID clientRequestId = null;
if (computeNodeUpdateUserOptions != null) {
clientRequestId = computeNodeUpdateUserOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (computeNodeUpdateUserOptions != null) {
returnClientRequestId = computeNodeUpdateUserOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (computeNodeUpdateUserOptions != null) {
ocpDate = computeNodeUpdateUserOptions.ocpDate();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
return service.updateUser(poolId, nodeId, userName, nodeUpdateUserParameter, this.client.apiVersion(), this.client.acceptLanguage(), timeout, clientRequestId, returnClientRequestId, ocpDateConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<Void, ComputeNodeUpdateUserHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Void, ComputeNodeUpdateUserHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<Void, ComputeNodeUpdateUserHeaders> clientResponse = updateUserDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} | class class_name[name] begin[{]
method[updateUserWithServiceResponseAsync, return_type[type[Observable]], modifier[public], parameter[poolId, nodeId, userName, nodeUpdateUserParameter, computeNodeUpdateUserOptions]] begin[{]
if[binary_operation[THIS[member[None.client]call[None.batchUrl, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.batchUrl() is required and cannot be null.")], 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[}]
if[binary_operation[member[.poolId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter poolId is required and cannot be null.")], 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[}]
if[binary_operation[member[.nodeId], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter nodeId is required and cannot be null.")], 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[}]
if[binary_operation[member[.userName], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter userName is required and cannot be null.")], 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[}]
if[binary_operation[member[.nodeUpdateUserParameter], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter nodeUpdateUserParameter is required and cannot be null.")], 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[}]
if[binary_operation[THIS[member[None.client]call[None.apiVersion, parameter[]]], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter this.client.apiVersion() is required and cannot be null.")], 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[}]
call[Validator.validate, parameter[member[.nodeUpdateUserParameter]]]
call[Validator.validate, parameter[member[.computeNodeUpdateUserOptions]]]
local_variable[type[Integer], timeout]
if[binary_operation[member[.computeNodeUpdateUserOptions], !=, literal[null]]] begin[{]
assign[member[.timeout], call[computeNodeUpdateUserOptions.timeout, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[UUID], clientRequestId]
if[binary_operation[member[.computeNodeUpdateUserOptions], !=, literal[null]]] begin[{]
assign[member[.clientRequestId], call[computeNodeUpdateUserOptions.clientRequestId, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[Boolean], returnClientRequestId]
if[binary_operation[member[.computeNodeUpdateUserOptions], !=, literal[null]]] begin[{]
assign[member[.returnClientRequestId], call[computeNodeUpdateUserOptions.returnClientRequestId, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[DateTime], ocpDate]
if[binary_operation[member[.computeNodeUpdateUserOptions], !=, literal[null]]] begin[{]
assign[member[.ocpDate], call[computeNodeUpdateUserOptions.ocpDate, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[String], parameterizedHost]
local_variable[type[DateTimeRfc1123], ocpDateConverted]
if[binary_operation[member[.ocpDate], !=, literal[null]]] begin[{]
assign[member[.ocpDateConverted], ClassCreator(arguments=[MemberReference(member=ocpDate, 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=DateTimeRfc1123, sub_type=None))]
else begin[{]
None
end[}]
return[call[service.updateUser, parameter[member[.poolId], member[.nodeId], member[.userName], member[.nodeUpdateUserParameter], THIS[member[None.client]call[None.apiVersion, parameter[]]], THIS[member[None.client]call[None.acceptLanguage, parameter[]]], member[.timeout], member[.clientRequestId], member[.returnClientRequestId], member[.ocpDateConverted], member[.parameterizedHost], THIS[member[None.client]call[None.userAgent, parameter[]]]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponseWithHeaders] operator[<] identifier[Void] , identifier[ComputeNodeUpdateUserHeaders] operator[>] operator[>] identifier[updateUserWithServiceResponseAsync] operator[SEP] identifier[String] identifier[poolId] , identifier[String] identifier[nodeId] , identifier[String] identifier[userName] , identifier[NodeUpdateUserParameter] identifier[nodeUpdateUserParameter] , identifier[ComputeNodeUpdateUserOptions] identifier[computeNodeUpdateUserOptions] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[batchUrl] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[poolId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[nodeId] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[userName] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[nodeUpdateUserParameter] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Validator] operator[SEP] identifier[validate] operator[SEP] identifier[nodeUpdateUserParameter] operator[SEP] operator[SEP] identifier[Validator] operator[SEP] identifier[validate] operator[SEP] identifier[computeNodeUpdateUserOptions] operator[SEP] operator[SEP] identifier[Integer] identifier[timeout] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[computeNodeUpdateUserOptions] operator[!=] Other[null] operator[SEP] {
identifier[timeout] operator[=] identifier[computeNodeUpdateUserOptions] operator[SEP] identifier[timeout] operator[SEP] operator[SEP] operator[SEP]
}
identifier[UUID] identifier[clientRequestId] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[computeNodeUpdateUserOptions] operator[!=] Other[null] operator[SEP] {
identifier[clientRequestId] operator[=] identifier[computeNodeUpdateUserOptions] operator[SEP] identifier[clientRequestId] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Boolean] identifier[returnClientRequestId] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[computeNodeUpdateUserOptions] operator[!=] Other[null] operator[SEP] {
identifier[returnClientRequestId] operator[=] identifier[computeNodeUpdateUserOptions] operator[SEP] identifier[returnClientRequestId] operator[SEP] operator[SEP] operator[SEP]
}
identifier[DateTime] identifier[ocpDate] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[computeNodeUpdateUserOptions] operator[!=] Other[null] operator[SEP] {
identifier[ocpDate] operator[=] identifier[computeNodeUpdateUserOptions] operator[SEP] identifier[ocpDate] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[parameterizedHost] operator[=] identifier[Joiner] operator[SEP] identifier[on] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[join] operator[SEP] literal[String] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[batchUrl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[DateTimeRfc1123] identifier[ocpDateConverted] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[ocpDate] operator[!=] Other[null] operator[SEP] {
identifier[ocpDateConverted] operator[=] Keyword[new] identifier[DateTimeRfc1123] operator[SEP] identifier[ocpDate] operator[SEP] operator[SEP]
}
Keyword[return] identifier[service] operator[SEP] identifier[updateUser] operator[SEP] identifier[poolId] , identifier[nodeId] , identifier[userName] , identifier[nodeUpdateUserParameter] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[apiVersion] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , identifier[timeout] , identifier[clientRequestId] , identifier[returnClientRequestId] , identifier[ocpDateConverted] , identifier[parameterizedHost] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponseWithHeaders] operator[<] identifier[Void] , identifier[ComputeNodeUpdateUserHeaders] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponseWithHeaders] operator[<] identifier[Void] , identifier[ComputeNodeUpdateUserHeaders] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponseWithHeaders] operator[<] identifier[Void] , identifier[ComputeNodeUpdateUserHeaders] operator[>] identifier[clientResponse] operator[=] identifier[updateUserDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] identifier[clientResponse] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
public static void extractParameterMap(final HttpServletRequest request, final Map<String, String[]> parameters,
final Map<String, FileItem[]> files) {
if (isMultipart(request)) {
ServletFileUpload upload = new ServletFileUpload();
upload.setFileItemFactory(new DiskFileItemFactory());
try {
List fileItems = upload.parseRequest(request);
uploadFileItems(fileItems, parameters, files);
} catch (FileUploadException ex) {
throw new SystemException(ex);
}
// Include Query String Parameters (only if parameters were not included in the form fields)
for (Object entry : request.getParameterMap().entrySet()) {
Map.Entry<String, String[]> param = (Map.Entry<String, String[]>) entry;
if (!parameters.containsKey(param.getKey())) {
parameters.put(param.getKey(), param.getValue());
}
}
} else {
parameters.putAll(request.getParameterMap());
}
} | class class_name[name] begin[{]
method[extractParameterMap, return_type[void], modifier[public static], parameter[request, parameters, files]] begin[{]
if[call[.isMultipart, parameter[member[.request]]]] begin[{]
local_variable[type[ServletFileUpload], upload]
call[upload.setFileItemFactory, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DiskFileItemFactory, sub_type=None))]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseRequest, postfix_operators=[], prefix_operators=[], qualifier=upload, selectors=[], type_arguments=None), name=fileItems)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=List, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fileItems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=files, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=uploadFileItems, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ex, 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=SystemException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['FileUploadException']))], finally_block=None, label=None, resources=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=entry, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_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=[None], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None))), name=param)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_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=[None], name=String, sub_type=None))], dimensions=None, name=Entry, sub_type=None))), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=param, selectors=[], type_arguments=None)], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=parameters, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=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=put, postfix_operators=[], prefix_operators=[], qualifier=parameters, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getParameterMap, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[MethodInvocation(arguments=[], member=entrySet, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
else begin[{]
call[parameters.putAll, parameter[call[request.getParameterMap, parameter[]]]]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[extractParameterMap] operator[SEP] Keyword[final] identifier[HttpServletRequest] identifier[request] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[parameters] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[FileItem] operator[SEP] operator[SEP] operator[>] identifier[files] operator[SEP] {
Keyword[if] operator[SEP] identifier[isMultipart] operator[SEP] identifier[request] operator[SEP] operator[SEP] {
identifier[ServletFileUpload] identifier[upload] operator[=] Keyword[new] identifier[ServletFileUpload] operator[SEP] operator[SEP] operator[SEP] identifier[upload] operator[SEP] identifier[setFileItemFactory] operator[SEP] Keyword[new] identifier[DiskFileItemFactory] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[List] identifier[fileItems] operator[=] identifier[upload] operator[SEP] identifier[parseRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP] identifier[uploadFileItems] operator[SEP] identifier[fileItems] , identifier[parameters] , identifier[files] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[FileUploadException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SystemException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Object] identifier[entry] operator[:] identifier[request] operator[SEP] identifier[getParameterMap] operator[SEP] operator[SEP] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] identifier[param] operator[=] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[String] operator[SEP] operator[SEP] operator[>] operator[SEP] identifier[entry] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[parameters] operator[SEP] identifier[containsKey] operator[SEP] identifier[param] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[parameters] operator[SEP] identifier[put] 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]
}
}
}
Keyword[else] {
identifier[parameters] operator[SEP] identifier[putAll] operator[SEP] identifier[request] operator[SEP] identifier[getParameterMap] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void visit(GroovyCodeVisitor visitor) {
if (visitor instanceof ClassGenerator) {
ClassGenerator gen = (ClassGenerator) visitor;
gen.visitBytecodeSequence(this);
return;
}
for (Iterator iterator = instructions.iterator(); iterator.hasNext();) {
Object part = (Object) iterator.next();
if (part instanceof ASTNode) {
((ASTNode)part).visit(visitor);
}
}
} | class class_name[name] begin[{]
method[visit, return_type[void], modifier[public], parameter[visitor]] begin[{]
if[binary_operation[member[.visitor], instanceof, type[ClassGenerator]]] begin[{]
local_variable[type[ClassGenerator], gen]
call[gen.visitBytecodeSequence, parameter[THIS[]]]
return[None]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), name=part)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=part, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=ASTNode, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Cast(expression=MemberReference(member=part, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=ASTNode, sub_type=None)), label=None)]))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=iterator, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=instructions, selectors=[], type_arguments=None), name=iterator)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[visit] operator[SEP] identifier[GroovyCodeVisitor] identifier[visitor] operator[SEP] {
Keyword[if] operator[SEP] identifier[visitor] Keyword[instanceof] identifier[ClassGenerator] operator[SEP] {
identifier[ClassGenerator] identifier[gen] operator[=] operator[SEP] identifier[ClassGenerator] operator[SEP] identifier[visitor] operator[SEP] identifier[gen] operator[SEP] identifier[visitBytecodeSequence] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Iterator] identifier[iterator] operator[=] identifier[instructions] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[Object] identifier[part] operator[=] operator[SEP] identifier[Object] operator[SEP] identifier[iterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[part] Keyword[instanceof] identifier[ASTNode] operator[SEP] {
operator[SEP] operator[SEP] identifier[ASTNode] operator[SEP] identifier[part] operator[SEP] operator[SEP] identifier[visit] operator[SEP] identifier[visitor] operator[SEP] operator[SEP]
}
}
}
|
public final void wrap(final AtomicBuffer buffer, final int offset, final int length)
{
this.buffer.wrap(buffer, offset, length);
} | class class_name[name] begin[{]
method[wrap, return_type[void], modifier[final public], parameter[buffer, offset, length]] begin[{]
THIS[member[None.buffer]call[None.wrap, parameter[member[.buffer], member[.offset], member[.length]]]]
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[wrap] operator[SEP] Keyword[final] identifier[AtomicBuffer] identifier[buffer] , Keyword[final] Keyword[int] identifier[offset] , Keyword[final] Keyword[int] identifier[length] operator[SEP] {
Keyword[this] operator[SEP] identifier[buffer] operator[SEP] identifier[wrap] operator[SEP] identifier[buffer] , identifier[offset] , identifier[length] operator[SEP] operator[SEP]
}
|
public static <K, V> DataLoader<K, V> newMappedDataLoaderWithTry(MappedBatchLoader<K, Try<V>> batchLoadFunction) {
return newMappedDataLoaderWithTry(batchLoadFunction, null);
} | class class_name[name] begin[{]
method[newMappedDataLoaderWithTry, return_type[type[DataLoader]], modifier[public static], parameter[batchLoadFunction]] begin[{]
return[call[.newMappedDataLoaderWithTry, parameter[member[.batchLoadFunction], literal[null]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[DataLoader] operator[<] identifier[K] , identifier[V] operator[>] identifier[newMappedDataLoaderWithTry] operator[SEP] identifier[MappedBatchLoader] operator[<] identifier[K] , identifier[Try] operator[<] identifier[V] operator[>] operator[>] identifier[batchLoadFunction] operator[SEP] {
Keyword[return] identifier[newMappedDataLoaderWithTry] operator[SEP] identifier[batchLoadFunction] , Other[null] operator[SEP] operator[SEP]
}
|
public static Boolean extractSharedHttpContext(final ServiceReference<?> serviceReference) {
Boolean sharedHttpContext = Boolean
.parseBoolean((String) serviceReference
.getProperty(ExtenderConstants.PROPERTY_HTTP_CONTEXT_SHARED));
if (serviceReference.getProperty(HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT) != null) {
sharedHttpContext = true;
}
return sharedHttpContext;
} | class class_name[name] begin[{]
method[extractSharedHttpContext, return_type[type[Boolean]], modifier[public static], parameter[serviceReference]] begin[{]
local_variable[type[Boolean], sharedHttpContext]
if[binary_operation[call[serviceReference.getProperty, parameter[member[HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT]]], !=, literal[null]]] begin[{]
assign[member[.sharedHttpContext], literal[true]]
else begin[{]
None
end[}]
return[member[.sharedHttpContext]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Boolean] identifier[extractSharedHttpContext] operator[SEP] Keyword[final] identifier[ServiceReference] operator[<] operator[?] operator[>] identifier[serviceReference] operator[SEP] {
identifier[Boolean] identifier[sharedHttpContext] operator[=] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[serviceReference] operator[SEP] identifier[getProperty] operator[SEP] identifier[ExtenderConstants] operator[SEP] identifier[PROPERTY_HTTP_CONTEXT_SHARED] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[serviceReference] operator[SEP] identifier[getProperty] operator[SEP] identifier[HttpWhiteboardConstants] operator[SEP] identifier[HTTP_WHITEBOARD_CONTEXT_SELECT] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[sharedHttpContext] operator[=] literal[boolean] operator[SEP]
}
Keyword[return] identifier[sharedHttpContext] operator[SEP]
}
|
static @Nonnull List<ThreadLock.Monitor> getMonitors(final ThreadInfo threadInfo) {
final MonitorInfo[] monitors = threadInfo.getLockedMonitors();
final List<ThreadLock.Monitor> locks = new ArrayList<ThreadLock.Monitor>(monitors.length);
for (MonitorInfo info: monitors) {
locks.add(getMonitor(info));
}
return locks;
} | class class_name[name] begin[{]
method[getMonitors, return_type[type[List]], modifier[static], parameter[threadInfo]] begin[{]
local_variable[type[MonitorInfo], monitors]
local_variable[type[List], locks]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=info, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMonitor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=locks, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=monitors, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=info)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MonitorInfo, sub_type=None))), label=None)
return[member[.locks]]
end[}]
END[}] | Keyword[static] annotation[@] identifier[Nonnull] identifier[List] operator[<] identifier[ThreadLock] operator[SEP] identifier[Monitor] operator[>] identifier[getMonitors] operator[SEP] Keyword[final] identifier[ThreadInfo] identifier[threadInfo] operator[SEP] {
Keyword[final] identifier[MonitorInfo] operator[SEP] operator[SEP] identifier[monitors] operator[=] identifier[threadInfo] operator[SEP] identifier[getLockedMonitors] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[ThreadLock] operator[SEP] identifier[Monitor] operator[>] identifier[locks] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[ThreadLock] operator[SEP] identifier[Monitor] operator[>] operator[SEP] identifier[monitors] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[MonitorInfo] identifier[info] operator[:] identifier[monitors] operator[SEP] {
identifier[locks] operator[SEP] identifier[add] operator[SEP] identifier[getMonitor] operator[SEP] identifier[info] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[locks] operator[SEP]
}
|
protected Optional<SamlRegisteredServiceServiceProviderMetadataFacade> getSamlMetadataFacadeFor(final SamlRegisteredService registeredService,
final RequestAbstractType authnRequest) {
return SamlRegisteredServiceServiceProviderMetadataFacade.get(
samlProfileHandlerConfigurationContext.getSamlRegisteredServiceCachingMetadataResolver(), registeredService, authnRequest);
} | class class_name[name] begin[{]
method[getSamlMetadataFacadeFor, return_type[type[Optional]], modifier[protected], parameter[registeredService, authnRequest]] begin[{]
return[call[SamlRegisteredServiceServiceProviderMetadataFacade.get, parameter[call[samlProfileHandlerConfigurationContext.getSamlRegisteredServiceCachingMetadataResolver, parameter[]], member[.registeredService], member[.authnRequest]]]]
end[}]
END[}] | Keyword[protected] identifier[Optional] operator[<] identifier[SamlRegisteredServiceServiceProviderMetadataFacade] operator[>] identifier[getSamlMetadataFacadeFor] operator[SEP] Keyword[final] identifier[SamlRegisteredService] identifier[registeredService] , Keyword[final] identifier[RequestAbstractType] identifier[authnRequest] operator[SEP] {
Keyword[return] identifier[SamlRegisteredServiceServiceProviderMetadataFacade] operator[SEP] identifier[get] operator[SEP] identifier[samlProfileHandlerConfigurationContext] operator[SEP] identifier[getSamlRegisteredServiceCachingMetadataResolver] operator[SEP] operator[SEP] , identifier[registeredService] , identifier[authnRequest] operator[SEP] operator[SEP]
}
|
private void tryUnlock(CmsObjectWrapper cms, String path) {
try {
cms.unlockResource(path);
} catch (Throwable e) {
LOG.info(e.getLocalizedMessage(), e);
}
} | class class_name[name] begin[{]
method[tryUnlock, return_type[void], modifier[private], parameter[cms, path]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unlockResource, postfix_operators=[], prefix_operators=[], qualifier=cms, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[tryUnlock] operator[SEP] identifier[CmsObjectWrapper] identifier[cms] , identifier[String] identifier[path] operator[SEP] {
Keyword[try] {
identifier[cms] operator[SEP] identifier[unlockResource] operator[SEP] identifier[path] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings({"rawtypes","unchecked"})
public static void copyRowsToTable(Selection rows, Table oldTable, Table newTable) {
for (int columnIndex = 0; columnIndex < oldTable.columnCount(); columnIndex++) {
Column oldColumn = oldTable.column(columnIndex);
int r = 0;
for (int i : rows) {
newTable.column(columnIndex).set(r, oldColumn, i);
r++;
}
}
} | class class_name[name] begin[{]
method[copyRowsToTable, return_type[void], modifier[public static], parameter[rows, oldTable, newTable]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=column, postfix_operators=[], prefix_operators=[], qualifier=oldTable, selectors=[], type_arguments=None), name=oldColumn)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Column, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=r)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=column, postfix_operators=[], prefix_operators=[], qualifier=newTable, selectors=[MethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=oldColumn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=r, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=columnCount, postfix_operators=[], prefix_operators=[], qualifier=oldTable, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=columnIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=columnIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] Keyword[public] Keyword[static] Keyword[void] identifier[copyRowsToTable] operator[SEP] identifier[Selection] identifier[rows] , identifier[Table] identifier[oldTable] , identifier[Table] identifier[newTable] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[columnIndex] operator[=] Other[0] operator[SEP] identifier[columnIndex] operator[<] identifier[oldTable] operator[SEP] identifier[columnCount] operator[SEP] operator[SEP] operator[SEP] identifier[columnIndex] operator[++] operator[SEP] {
identifier[Column] identifier[oldColumn] operator[=] identifier[oldTable] operator[SEP] identifier[column] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] Keyword[int] identifier[r] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[:] identifier[rows] operator[SEP] {
identifier[newTable] operator[SEP] identifier[column] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] identifier[set] operator[SEP] identifier[r] , identifier[oldColumn] , identifier[i] operator[SEP] operator[SEP] identifier[r] operator[++] operator[SEP]
}
}
}
|
@Deprecated
public boolean removeCircleFromField(ProfileField<?> field, String circle, SPFPersona persona) {
return mProfileTable.removeCircleFromField(circle, field, persona);
} | class class_name[name] begin[{]
method[removeCircleFromField, return_type[type[boolean]], modifier[public], parameter[field, circle, persona]] begin[{]
return[call[mProfileTable.removeCircleFromField, parameter[member[.circle], member[.field], member[.persona]]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[boolean] identifier[removeCircleFromField] operator[SEP] identifier[ProfileField] operator[<] operator[?] operator[>] identifier[field] , identifier[String] identifier[circle] , identifier[SPFPersona] identifier[persona] operator[SEP] {
Keyword[return] identifier[mProfileTable] operator[SEP] identifier[removeCircleFromField] operator[SEP] identifier[circle] , identifier[field] , identifier[persona] operator[SEP] operator[SEP]
}
|
public int poll(final long now, final TimerHandler handler, final int maxTimersToExpire)
{
int timersExpired = 0;
if (timerCount > 0)
{
final long[] array = wheel[currentTick & wheelMask];
for (int i = 0, length = array.length; i < length && maxTimersToExpire > timersExpired; i++)
{
final long deadline = array[pollIndex];
if (deadline <= now)
{
array[pollIndex] = NULL_TIMER;
timerCount--;
timersExpired++;
if (!handler.onTimerExpiry(timeUnit, now, timerIdForSlot(currentTick & wheelMask, pollIndex)))
{
array[pollIndex] = deadline;
timerCount++;
return timersExpired;
}
}
pollIndex = (pollIndex + 1) >= length ? 0 : (pollIndex + 1);
}
if (maxTimersToExpire > timersExpired && currentTickTime() <= now)
{
currentTick++;
pollIndex = 0;
}
else if (pollIndex >= array.length)
{
pollIndex = 0;
}
}
else if (currentTickTime() <= now)
{
currentTick++;
pollIndex = 0;
}
return timersExpired;
} | class class_name[name] begin[{]
method[poll, return_type[type[int]], modifier[public], parameter[now, handler, maxTimersToExpire]] begin[{]
local_variable[type[int], timersExpired]
if[binary_operation[member[.timerCount], >, literal[0]]] begin[{]
local_variable[type[long], array]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pollIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=deadline)], modifiers={'final'}, type=BasicType(dimensions=[], name=long)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=deadline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=now, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pollIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=NULL_TIMER, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MemberReference(member=timerCount, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=MemberReference(member=timersExpired, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=timeUnit, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=now, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=currentTick, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=wheelMask, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=&), MemberReference(member=pollIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=timerIdForSlot, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=onTimerExpiry, postfix_operators=[], prefix_operators=['!'], qualifier=handler, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=pollIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=deadline, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MemberReference(member=timerCount, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), ReturnStatement(expression=MemberReference(member=timersExpired, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=pollIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=TernaryExpression(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=pollIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>=), if_false=BinaryOperation(operandl=MemberReference(member=pollIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=maxTimersToExpire, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=timersExpired, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), operator=&&), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i), VariableDeclarator(dimensions=[], initializer=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=array, selectors=[]), name=length)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[binary_operation[binary_operation[member[.maxTimersToExpire], >, member[.timersExpired]], &&, binary_operation[call[.currentTickTime, parameter[]], <=, member[.now]]]] begin[{]
member[.currentTick]
assign[member[.pollIndex], literal[0]]
else begin[{]
if[binary_operation[member[.pollIndex], >=, member[array.length]]] begin[{]
assign[member[.pollIndex], literal[0]]
else begin[{]
None
end[}]
end[}]
else begin[{]
if[binary_operation[call[.currentTickTime, parameter[]], <=, member[.now]]] begin[{]
member[.currentTick]
assign[member[.pollIndex], literal[0]]
else begin[{]
None
end[}]
end[}]
return[member[.timersExpired]]
end[}]
END[}] | Keyword[public] Keyword[int] identifier[poll] operator[SEP] Keyword[final] Keyword[long] identifier[now] , Keyword[final] identifier[TimerHandler] identifier[handler] , Keyword[final] Keyword[int] identifier[maxTimersToExpire] operator[SEP] {
Keyword[int] identifier[timersExpired] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[timerCount] operator[>] Other[0] operator[SEP] {
Keyword[final] Keyword[long] operator[SEP] operator[SEP] identifier[array] operator[=] identifier[wheel] operator[SEP] identifier[currentTick] operator[&] identifier[wheelMask] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[length] operator[=] identifier[array] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[<] identifier[length] operator[&&] identifier[maxTimersToExpire] operator[>] identifier[timersExpired] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] Keyword[long] identifier[deadline] operator[=] identifier[array] operator[SEP] identifier[pollIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[deadline] operator[<=] identifier[now] operator[SEP] {
identifier[array] operator[SEP] identifier[pollIndex] operator[SEP] operator[=] identifier[NULL_TIMER] operator[SEP] identifier[timerCount] operator[--] operator[SEP] identifier[timersExpired] operator[++] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[handler] operator[SEP] identifier[onTimerExpiry] operator[SEP] identifier[timeUnit] , identifier[now] , identifier[timerIdForSlot] operator[SEP] identifier[currentTick] operator[&] identifier[wheelMask] , identifier[pollIndex] operator[SEP] operator[SEP] operator[SEP] {
identifier[array] operator[SEP] identifier[pollIndex] operator[SEP] operator[=] identifier[deadline] operator[SEP] identifier[timerCount] operator[++] operator[SEP] Keyword[return] identifier[timersExpired] operator[SEP]
}
}
identifier[pollIndex] operator[=] operator[SEP] identifier[pollIndex] operator[+] Other[1] operator[SEP] operator[>=] identifier[length] operator[?] Other[0] operator[:] operator[SEP] identifier[pollIndex] operator[+] Other[1] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[maxTimersToExpire] operator[>] identifier[timersExpired] operator[&&] identifier[currentTickTime] operator[SEP] operator[SEP] operator[<=] identifier[now] operator[SEP] {
identifier[currentTick] operator[++] operator[SEP] identifier[pollIndex] operator[=] Other[0] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[pollIndex] operator[>=] identifier[array] operator[SEP] identifier[length] operator[SEP] {
identifier[pollIndex] operator[=] Other[0] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[currentTickTime] operator[SEP] operator[SEP] operator[<=] identifier[now] operator[SEP] {
identifier[currentTick] operator[++] operator[SEP] identifier[pollIndex] operator[=] Other[0] operator[SEP]
}
Keyword[return] identifier[timersExpired] operator[SEP]
}
|
public static GeographyPointValue unflattenFromBuffer(ByteBuffer inBuffer, int offset) {
double lng = inBuffer.getDouble(offset);
double lat = inBuffer.getDouble(offset + BYTES_IN_A_COORD);
if (lat == 360.0 && lng == 360.0) {
// This is a null point.
return null;
}
return new GeographyPointValue(lng, lat);
} | class class_name[name] begin[{]
method[unflattenFromBuffer, return_type[type[GeographyPointValue]], modifier[public static], parameter[inBuffer, offset]] begin[{]
local_variable[type[double], lng]
local_variable[type[double], lat]
if[binary_operation[binary_operation[member[.lat], ==, literal[360.0]], &&, binary_operation[member[.lng], ==, literal[360.0]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=lng, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lat, 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=GeographyPointValue, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[GeographyPointValue] identifier[unflattenFromBuffer] operator[SEP] identifier[ByteBuffer] identifier[inBuffer] , Keyword[int] identifier[offset] operator[SEP] {
Keyword[double] identifier[lng] operator[=] identifier[inBuffer] operator[SEP] identifier[getDouble] operator[SEP] identifier[offset] operator[SEP] operator[SEP] Keyword[double] identifier[lat] operator[=] identifier[inBuffer] operator[SEP] identifier[getDouble] operator[SEP] identifier[offset] operator[+] identifier[BYTES_IN_A_COORD] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[lat] operator[==] literal[Float] operator[&&] identifier[lng] operator[==] literal[Float] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] Keyword[new] identifier[GeographyPointValue] operator[SEP] identifier[lng] , identifier[lat] operator[SEP] operator[SEP]
}
|
@Override
public ListShardsResult listShards(ListShardsRequest request) {
request = beforeClientExecution(request);
return executeListShards(request);
} | class class_name[name] begin[{]
method[listShards, return_type[type[ListShardsResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeListShards, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ListShardsResult] identifier[listShards] operator[SEP] identifier[ListShardsRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeListShards] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public Filters withChannels(Channel... channels) {
java.util.ArrayList<String> channelsCopy = new java.util.ArrayList<String>(channels.length);
for (Channel value : channels) {
channelsCopy.add(value.toString());
}
if (getChannels() == null) {
setChannels(channelsCopy);
} else {
getChannels().addAll(channelsCopy);
}
return this;
} | class class_name[name] begin[{]
method[withChannels, return_type[type[Filters]], modifier[public], parameter[channels]] begin[{]
local_variable[type[java], channelsCopy]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=channelsCopy, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=channels, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Channel, sub_type=None))), label=None)
if[binary_operation[call[.getChannels, parameter[]], ==, literal[null]]] begin[{]
call[.setChannels, parameter[member[.channelsCopy]]]
else begin[{]
call[.getChannels, parameter[]]
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[Filters] identifier[withChannels] operator[SEP] identifier[Channel] operator[...] identifier[channels] operator[SEP] {
identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[channelsCopy] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[String] operator[>] operator[SEP] identifier[channels] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Channel] identifier[value] operator[:] identifier[channels] operator[SEP] {
identifier[channelsCopy] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[getChannels] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[setChannels] operator[SEP] identifier[channelsCopy] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[getChannels] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[channelsCopy] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public ModifyOptionGroupRequest withOptionsToInclude(OptionConfiguration... optionsToInclude) {
if (this.optionsToInclude == null) {
setOptionsToInclude(new com.amazonaws.internal.SdkInternalList<OptionConfiguration>(optionsToInclude.length));
}
for (OptionConfiguration ele : optionsToInclude) {
this.optionsToInclude.add(ele);
}
return this;
} | class class_name[name] begin[{]
method[withOptionsToInclude, return_type[type[ModifyOptionGroupRequest]], modifier[public], parameter[optionsToInclude]] begin[{]
if[binary_operation[THIS[member[None.optionsToInclude]], ==, literal[null]]] begin[{]
call[.setOptionsToInclude, parameter[ClassCreator(arguments=[MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=optionsToInclude, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=OptionConfiguration, sub_type=None))], dimensions=None, name=SdkInternalList, 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=optionsToInclude, 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=optionsToInclude, 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=OptionConfiguration, sub_type=None))), label=None)
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ModifyOptionGroupRequest] identifier[withOptionsToInclude] operator[SEP] identifier[OptionConfiguration] operator[...] identifier[optionsToInclude] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[optionsToInclude] operator[==] Other[null] operator[SEP] {
identifier[setOptionsToInclude] operator[SEP] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[OptionConfiguration] operator[>] operator[SEP] identifier[optionsToInclude] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[OptionConfiguration] identifier[ele] operator[:] identifier[optionsToInclude] operator[SEP] {
Keyword[this] operator[SEP] identifier[optionsToInclude] operator[SEP] identifier[add] operator[SEP] identifier[ele] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@RequestMapping(method = RequestMethod.POST)
@Transactional
public Callable<ResponseEntity<JsonNode>> post(@RequestBody String input) throws IOException {
return () -> {
// Gets the components
Request request = objectMapper.readValue(input, Request.class);
// Variables must not be null
request = request.withVariables();
// Runs the query
return ResponseEntity.ok(
requestAsJson(request)
);
};
} | class class_name[name] begin[{]
method[post, return_type[type[Callable]], modifier[public], parameter[input]] begin[{]
return[LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Request, sub_type=None))], member=readValue, postfix_operators=[], prefix_operators=[], qualifier=objectMapper, selectors=[], type_arguments=None), name=request)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Request, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=withVariables, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=requestAsJson, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=ok, postfix_operators=[], prefix_operators=[], qualifier=ResponseEntity, selectors=[], type_arguments=None), label=None)], parameters=[])]
end[}]
END[}] | annotation[@] identifier[RequestMapping] operator[SEP] identifier[method] operator[=] identifier[RequestMethod] operator[SEP] identifier[POST] operator[SEP] annotation[@] identifier[Transactional] Keyword[public] identifier[Callable] operator[<] identifier[ResponseEntity] operator[<] identifier[JsonNode] operator[>] operator[>] identifier[post] operator[SEP] annotation[@] identifier[RequestBody] identifier[String] identifier[input] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] operator[SEP] operator[SEP] operator[->] {
identifier[Request] identifier[request] operator[=] identifier[objectMapper] operator[SEP] identifier[readValue] operator[SEP] identifier[input] , identifier[Request] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[request] operator[=] identifier[request] operator[SEP] identifier[withVariables] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ResponseEntity] operator[SEP] identifier[ok] operator[SEP] identifier[requestAsJson] operator[SEP] identifier[request] operator[SEP] operator[SEP] operator[SEP]
} operator[SEP]
}
|
public String[] getMonths(int context, int width) {
String [] returnValue = null;
switch (context) {
case FORMAT :
switch(width) {
case WIDE :
returnValue = months;
break;
case ABBREVIATED :
case SHORT : // no month data for this, defaults to ABBREVIATED
returnValue = shortMonths;
break;
case NARROW :
returnValue = narrowMonths;
break;
}
break;
case STANDALONE :
switch(width) {
case WIDE :
returnValue = standaloneMonths;
break;
case ABBREVIATED :
case SHORT : // no month data for this, defaults to ABBREVIATED
returnValue = standaloneShortMonths;
break;
case NARROW :
returnValue = standaloneNarrowMonths;
break;
}
break;
}
if (returnValue == null) {
throw new IllegalArgumentException("Bad context or width argument");
}
return duplicate(returnValue);
} | class class_name[name] begin[{]
method[getMonths, return_type[type[String]], modifier[public], parameter[context, width]] begin[{]
local_variable[type[String], returnValue]
SwitchStatement(cases=[SwitchStatementCase(case=['FORMAT'], statements=[SwitchStatement(cases=[SwitchStatementCase(case=['WIDE'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=returnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=months, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['ABBREVIATED', 'SHORT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=returnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=shortMonths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['NARROW'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=returnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=narrowMonths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['STANDALONE'], statements=[SwitchStatement(cases=[SwitchStatementCase(case=['WIDE'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=returnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=standaloneMonths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['ABBREVIATED', 'SHORT'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=returnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=standaloneShortMonths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['NARROW'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=returnValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=standaloneNarrowMonths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
if[binary_operation[member[.returnValue], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Bad context or width argument")], 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[call[.duplicate, parameter[member[.returnValue]]]]
end[}]
END[}] | Keyword[public] identifier[String] operator[SEP] operator[SEP] identifier[getMonths] operator[SEP] Keyword[int] identifier[context] , Keyword[int] identifier[width] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[returnValue] operator[=] Other[null] operator[SEP] Keyword[switch] operator[SEP] identifier[context] operator[SEP] {
Keyword[case] identifier[FORMAT] operator[:] Keyword[switch] operator[SEP] identifier[width] operator[SEP] {
Keyword[case] identifier[WIDE] operator[:] identifier[returnValue] operator[=] identifier[months] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[ABBREVIATED] operator[:] Keyword[case] identifier[SHORT] operator[:] identifier[returnValue] operator[=] identifier[shortMonths] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[NARROW] operator[:] identifier[returnValue] operator[=] identifier[narrowMonths] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] identifier[STANDALONE] operator[:] Keyword[switch] operator[SEP] identifier[width] operator[SEP] {
Keyword[case] identifier[WIDE] operator[:] identifier[returnValue] operator[=] identifier[standaloneMonths] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[ABBREVIATED] operator[:] Keyword[case] identifier[SHORT] operator[:] identifier[returnValue] operator[=] identifier[standaloneShortMonths] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[NARROW] operator[:] identifier[returnValue] operator[=] identifier[standaloneNarrowMonths] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[break] operator[SEP]
}
Keyword[if] operator[SEP] identifier[returnValue] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[duplicate] operator[SEP] identifier[returnValue] operator[SEP] operator[SEP]
}
|
@Override
public final void initialize(final SizeWithoutSeparators pconstraintAnnotation) {
min = pconstraintAnnotation.min();
max = pconstraintAnnotation.max();
ignoreWhiteSpaces = pconstraintAnnotation.ignoreWhiteSpaces();
ignoreMinus = pconstraintAnnotation.ignoreMinus();
ignoreSlashes = pconstraintAnnotation.ignoreSlashes();
validateParameters();
} | class class_name[name] begin[{]
method[initialize, return_type[void], modifier[final public], parameter[pconstraintAnnotation]] begin[{]
assign[member[.min], call[pconstraintAnnotation.min, parameter[]]]
assign[member[.max], call[pconstraintAnnotation.max, parameter[]]]
assign[member[.ignoreWhiteSpaces], call[pconstraintAnnotation.ignoreWhiteSpaces, parameter[]]]
assign[member[.ignoreMinus], call[pconstraintAnnotation.ignoreMinus, parameter[]]]
assign[member[.ignoreSlashes], call[pconstraintAnnotation.ignoreSlashes, parameter[]]]
call[.validateParameters, parameter[]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[initialize] operator[SEP] Keyword[final] identifier[SizeWithoutSeparators] identifier[pconstraintAnnotation] operator[SEP] {
identifier[min] operator[=] identifier[pconstraintAnnotation] operator[SEP] identifier[min] operator[SEP] operator[SEP] operator[SEP] identifier[max] operator[=] identifier[pconstraintAnnotation] operator[SEP] identifier[max] operator[SEP] operator[SEP] operator[SEP] identifier[ignoreWhiteSpaces] operator[=] identifier[pconstraintAnnotation] operator[SEP] identifier[ignoreWhiteSpaces] operator[SEP] operator[SEP] operator[SEP] identifier[ignoreMinus] operator[=] identifier[pconstraintAnnotation] operator[SEP] identifier[ignoreMinus] operator[SEP] operator[SEP] operator[SEP] identifier[ignoreSlashes] operator[=] identifier[pconstraintAnnotation] operator[SEP] identifier[ignoreSlashes] operator[SEP] operator[SEP] operator[SEP] identifier[validateParameters] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected String getReadOnlyValue(final AbstractUIField _uiField)
throws EFapsException
{
Object ret = _uiField.getValue().getReadOnlyValue(_uiField.getParent().getMode());
if (ret instanceof Type) {
ret = ((Type) ret).getLabel();
}
return ret == null ? "" : String.valueOf(ret);
} | class class_name[name] begin[{]
method[getReadOnlyValue, return_type[type[String]], modifier[protected], parameter[_uiField]] begin[{]
local_variable[type[Object], ret]
if[binary_operation[member[.ret], instanceof, type[Type]]] begin[{]
assign[member[.ret], Cast(expression=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Type, sub_type=None))]
else begin[{]
None
end[}]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] identifier[String] identifier[getReadOnlyValue] operator[SEP] Keyword[final] identifier[AbstractUIField] identifier[_uiField] operator[SEP] Keyword[throws] identifier[EFapsException] {
identifier[Object] identifier[ret] operator[=] identifier[_uiField] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[getReadOnlyValue] operator[SEP] identifier[_uiField] operator[SEP] identifier[getParent] operator[SEP] operator[SEP] operator[SEP] identifier[getMode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ret] Keyword[instanceof] identifier[Type] operator[SEP] {
identifier[ret] operator[=] operator[SEP] operator[SEP] identifier[Type] operator[SEP] identifier[ret] operator[SEP] operator[SEP] identifier[getLabel] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[ret] operator[SEP] operator[SEP]
}
|
public String updateSpecification(Vector<Object> oldSpecificationParams, Vector<Object> newSpecificationParams)
{
try
{
Specification oldSpecification = XmlRpcDataMarshaller.toSpecification( oldSpecificationParams );
Specification newSpecification = XmlRpcDataMarshaller.toSpecification( newSpecificationParams );
service.updateSpecification(oldSpecification, newSpecification);
log.debug( "Updated Specification: " + oldSpecification.getName() );
return SUCCESS;
}
catch (Exception e)
{
return errorAsString( e, SPECIFICATION_UPDATE_FAILED );
}
} | class class_name[name] begin[{]
method[updateSpecification, return_type[type[String]], modifier[public], parameter[oldSpecificationParams, newSpecificationParams]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=oldSpecificationParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toSpecification, postfix_operators=[], prefix_operators=[], qualifier=XmlRpcDataMarshaller, selectors=[], type_arguments=None), name=oldSpecification)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Specification, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=newSpecificationParams, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toSpecification, postfix_operators=[], prefix_operators=[], qualifier=XmlRpcDataMarshaller, selectors=[], type_arguments=None), name=newSpecification)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Specification, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=oldSpecification, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newSpecification, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=updateSpecification, postfix_operators=[], prefix_operators=[], qualifier=service, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Updated Specification: "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=oldSpecification, selectors=[], type_arguments=None), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=SUCCESS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=SPECIFICATION_UPDATE_FAILED, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=errorAsString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=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[public] identifier[String] identifier[updateSpecification] operator[SEP] identifier[Vector] operator[<] identifier[Object] operator[>] identifier[oldSpecificationParams] , identifier[Vector] operator[<] identifier[Object] operator[>] identifier[newSpecificationParams] operator[SEP] {
Keyword[try] {
identifier[Specification] identifier[oldSpecification] operator[=] identifier[XmlRpcDataMarshaller] operator[SEP] identifier[toSpecification] operator[SEP] identifier[oldSpecificationParams] operator[SEP] operator[SEP] identifier[Specification] identifier[newSpecification] operator[=] identifier[XmlRpcDataMarshaller] operator[SEP] identifier[toSpecification] operator[SEP] identifier[newSpecificationParams] operator[SEP] operator[SEP] identifier[service] operator[SEP] identifier[updateSpecification] operator[SEP] identifier[oldSpecification] , identifier[newSpecification] operator[SEP] operator[SEP] identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[oldSpecification] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[SUCCESS] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[return] identifier[errorAsString] operator[SEP] identifier[e] , identifier[SPECIFICATION_UPDATE_FAILED] operator[SEP] operator[SEP]
}
}
|
@Override
public void setMinView(final DateTimePickerView dateTimePickerView) {
this.minView = dateTimePickerView;
// We keep the view select the same as the min view
if (viewSelect != minView) {
setViewSelect(dateTimePickerView);
}
} | class class_name[name] begin[{]
method[setMinView, return_type[void], modifier[public], parameter[dateTimePickerView]] begin[{]
assign[THIS[member[None.minView]], member[.dateTimePickerView]]
if[binary_operation[member[.viewSelect], !=, member[.minView]]] begin[{]
call[.setViewSelect, parameter[member[.dateTimePickerView]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setMinView] operator[SEP] Keyword[final] identifier[DateTimePickerView] identifier[dateTimePickerView] operator[SEP] {
Keyword[this] operator[SEP] identifier[minView] operator[=] identifier[dateTimePickerView] operator[SEP] Keyword[if] operator[SEP] identifier[viewSelect] operator[!=] identifier[minView] operator[SEP] {
identifier[setViewSelect] operator[SEP] identifier[dateTimePickerView] operator[SEP] operator[SEP]
}
}
|
@ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class })
public static void notEmpty(final boolean expression, @Nullable final String name) {
if (expression) {
throw new IllegalEmptyArgumentException(name);
}
} | class class_name[name] begin[{]
method[notEmpty, return_type[void], modifier[public static], parameter[expression, name]] begin[{]
if[member[.expression]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=name, 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=IllegalEmptyArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[ArgumentsChecked] annotation[@] identifier[Throws] operator[SEP] {
identifier[IllegalNullArgumentException] operator[SEP] Keyword[class] , identifier[IllegalEmptyArgumentException] operator[SEP] Keyword[class]
} operator[SEP] Keyword[public] Keyword[static] Keyword[void] identifier[notEmpty] operator[SEP] Keyword[final] Keyword[boolean] identifier[expression] , annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[name] operator[SEP] {
Keyword[if] operator[SEP] identifier[expression] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalEmptyArgumentException] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
}
|
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case XtextPackage.NEGATION__VALUE:
setValue((Condition)newValue);
return;
}
super.eSet(featureID, newValue);
} | class class_name[name] begin[{]
method[eSet, return_type[void], modifier[public], parameter[featureID, newValue]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=NEGATION__VALUE, postfix_operators=[], prefix_operators=[], qualifier=XtextPackage, selectors=[])], statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Condition, sub_type=None))], member=setValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[eSet] operator[SEP] Keyword[int] identifier[featureID] , identifier[Object] identifier[newValue] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[XtextPackage] operator[SEP] identifier[NEGATION__VALUE] operator[:] identifier[setValue] operator[SEP] operator[SEP] identifier[Condition] operator[SEP] identifier[newValue] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[eSet] operator[SEP] identifier[featureID] , identifier[newValue] operator[SEP] operator[SEP]
}
|
private static byte[] decode4to3( byte[] fourBytes )
{
byte[] outBuff1 = new byte[3];
int count = decode4to3( fourBytes, 0, outBuff1, 0 );
byte[] outBuff2 = new byte[ count ];
System.arraycopy( outBuff1, 0, outBuff2, 0, count );
return outBuff2;
} | class class_name[name] begin[{]
method[decode4to3, return_type[type[byte]], modifier[private static], parameter[fourBytes]] begin[{]
local_variable[type[byte], outBuff1]
local_variable[type[int], count]
local_variable[type[byte], outBuff2]
call[System.arraycopy, parameter[member[.outBuff1], literal[0], member[.outBuff2], literal[0], member[.count]]]
return[member[.outBuff2]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[byte] operator[SEP] operator[SEP] identifier[decode4to3] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[fourBytes] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[outBuff1] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[3] operator[SEP] operator[SEP] Keyword[int] identifier[count] operator[=] identifier[decode4to3] operator[SEP] identifier[fourBytes] , Other[0] , identifier[outBuff1] , Other[0] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[outBuff2] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[count] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[outBuff1] , Other[0] , identifier[outBuff2] , Other[0] , identifier[count] operator[SEP] operator[SEP] Keyword[return] identifier[outBuff2] operator[SEP]
}
|
private boolean resolveDirectoryConflictTrivially(Path canonicalPath, Path conflictingPath) throws IOException {
if (!Files.exists(canonicalPath)) {
Files.move(conflictingPath, canonicalPath, StandardCopyOption.ATOMIC_MOVE);
return true;
} else if (hasSameDirFileContent(conflictingPath, canonicalPath)) {
// there must not be two directories pointing to the same dirId.
LOG.info("Removing conflicting directory file {} (identical to {})", conflictingPath, canonicalPath);
Files.deleteIfExists(conflictingPath);
return true;
} else {
return false;
}
} | class class_name[name] begin[{]
method[resolveDirectoryConflictTrivially, return_type[type[boolean]], modifier[private], parameter[canonicalPath, conflictingPath]] begin[{]
if[call[Files.exists, parameter[member[.canonicalPath]]]] begin[{]
call[Files.move, parameter[member[.conflictingPath], member[.canonicalPath], member[StandardCopyOption.ATOMIC_MOVE]]]
return[literal[true]]
else begin[{]
if[call[.hasSameDirFileContent, parameter[member[.conflictingPath], member[.canonicalPath]]]] begin[{]
call[LOG.info, parameter[literal["Removing conflicting directory file {} (identical to {})"], member[.conflictingPath], member[.canonicalPath]]]
call[Files.deleteIfExists, parameter[member[.conflictingPath]]]
return[literal[true]]
else begin[{]
return[literal[false]]
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[resolveDirectoryConflictTrivially] operator[SEP] identifier[Path] identifier[canonicalPath] , identifier[Path] identifier[conflictingPath] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] operator[!] identifier[Files] operator[SEP] identifier[exists] operator[SEP] identifier[canonicalPath] operator[SEP] operator[SEP] {
identifier[Files] operator[SEP] identifier[move] operator[SEP] identifier[conflictingPath] , identifier[canonicalPath] , identifier[StandardCopyOption] operator[SEP] identifier[ATOMIC_MOVE] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[hasSameDirFileContent] operator[SEP] identifier[conflictingPath] , identifier[canonicalPath] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[conflictingPath] , identifier[canonicalPath] operator[SEP] operator[SEP] identifier[Files] operator[SEP] identifier[deleteIfExists] operator[SEP] identifier[conflictingPath] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[return] literal[boolean] operator[SEP]
}
}
|
public void setIgnore(Collection<Class<? extends Throwable>> ignore) {
FailureInterpreter fi = getFailureInterpreter();
if (!(fi instanceof DefaultFailureInterpreter)) {
throw new IllegalStateException("setIgnore() not supported: this CircuitBreaker's FailureInterpreter isn't a DefaultFailureInterpreter.");
}
@SuppressWarnings("unchecked")
Class<? extends Throwable>[] classes = new Class[ignore.size()];
int i = 0;
for(Class<? extends Throwable> c : ignore) {
classes[i] = c;
i++;
}
((DefaultFailureInterpreter)fi).setIgnore(classes);
} | class class_name[name] begin[{]
method[setIgnore, return_type[void], modifier[public], parameter[ignore]] begin[{]
local_variable[type[FailureInterpreter], fi]
if[binary_operation[member[.fi], instanceof, type[DefaultFailureInterpreter]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="setIgnore() not supported: this CircuitBreaker's FailureInterpreter isn't a DefaultFailureInterpreter.")], 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[Class], classes]
local_variable[type[int], i]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=classes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=ignore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=c)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None))], dimensions=[], name=Class, sub_type=None))), label=None)
Cast(expression=MemberReference(member=fi, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DefaultFailureInterpreter, sub_type=None))
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setIgnore] operator[SEP] identifier[Collection] operator[<] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Throwable] operator[>] operator[>] identifier[ignore] operator[SEP] {
identifier[FailureInterpreter] identifier[fi] operator[=] identifier[getFailureInterpreter] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[fi] Keyword[instanceof] identifier[DefaultFailureInterpreter] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
} annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Throwable] operator[>] operator[SEP] operator[SEP] identifier[classes] operator[=] Keyword[new] identifier[Class] operator[SEP] identifier[ignore] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Throwable] operator[>] identifier[c] operator[:] identifier[ignore] operator[SEP] {
identifier[classes] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[c] operator[SEP] identifier[i] operator[++] operator[SEP]
} operator[SEP] operator[SEP] identifier[DefaultFailureInterpreter] operator[SEP] identifier[fi] operator[SEP] operator[SEP] identifier[setIgnore] operator[SEP] identifier[classes] operator[SEP] operator[SEP]
}
|
public void write(XMLStreamWriter writer, String xmlElementName, AttributeDefinition<?>... defs) throws XMLStreamException {
boolean skip = true;
for (AttributeDefinition def : defs) {
skip = skip && !attribute(def).isModified();
}
if (!skip) {
writer.writeStartElement(xmlElementName);
for (AttributeDefinition def : defs) {
Attribute attr = attribute(def);
attr.write(writer, attr.getAttributeDefinition().xmlName());
}
writer.writeEndElement();
}
} | class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[writer, xmlElementName, defs]] begin[{]
local_variable[type[boolean], skip]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=skip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=skip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[MemberReference(member=def, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=attribute, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[MethodInvocation(arguments=[], member=isModified, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=defs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=def)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AttributeDefinition, sub_type=None))), label=None)
if[member[.skip]] begin[{]
call[writer.writeStartElement, parameter[member[.xmlElementName]]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=def, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=attribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=attr)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getAttributeDefinition, postfix_operators=[], prefix_operators=[], qualifier=attr, selectors=[MethodInvocation(arguments=[], member=xmlName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=write, postfix_operators=[], prefix_operators=[], qualifier=attr, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=defs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=def)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AttributeDefinition, sub_type=None))), label=None)
call[writer.writeEndElement, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[write] operator[SEP] identifier[XMLStreamWriter] identifier[writer] , identifier[String] identifier[xmlElementName] , identifier[AttributeDefinition] operator[<] operator[?] operator[>] operator[...] identifier[defs] operator[SEP] Keyword[throws] identifier[XMLStreamException] {
Keyword[boolean] identifier[skip] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[AttributeDefinition] identifier[def] operator[:] identifier[defs] operator[SEP] {
identifier[skip] operator[=] identifier[skip] operator[&&] operator[!] identifier[attribute] operator[SEP] identifier[def] operator[SEP] operator[SEP] identifier[isModified] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[skip] operator[SEP] {
identifier[writer] operator[SEP] identifier[writeStartElement] operator[SEP] identifier[xmlElementName] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[AttributeDefinition] identifier[def] operator[:] identifier[defs] operator[SEP] {
identifier[Attribute] identifier[attr] operator[=] identifier[attribute] operator[SEP] identifier[def] operator[SEP] operator[SEP] identifier[attr] operator[SEP] identifier[write] operator[SEP] identifier[writer] , identifier[attr] operator[SEP] identifier[getAttributeDefinition] operator[SEP] operator[SEP] operator[SEP] identifier[xmlName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[writer] operator[SEP] identifier[writeEndElement] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void changePassword(Authorizable authorizable, String password, String oldPassword) throws StorageClientException,
AccessDeniedException {
long t = System.currentTimeMillis();
try {
String id = authorizable.getId();
if (thisUser.isAdmin() || currentUserId.equals(id)) {
if (!thisUser.isAdmin()) {
User u = authenticator.authenticate(id, oldPassword);
if (u == null) {
throw new IllegalArgumentException("Unable to change passwords, old password does not match");
}
}
putCached(keySpace, authorizableColumnFamily, id, ImmutableMap.of(Authorizable.LASTMODIFIED_FIELD,
(Object) System.currentTimeMillis(), Authorizable.ID_FIELD, id, Authorizable.LASTMODIFIED_BY_FIELD,
accessControlManager.getCurrentUserId(), Authorizable.PASSWORD_FIELD,
StorageClientUtils.secureHash(password)), false);
storeListener.onUpdate(Security.ZONE_AUTHORIZABLES, id, currentUserId, getType(authorizable), false, null,
"op:change-password");
} else {
throw new AccessDeniedException(Security.ZONE_ADMIN, id,
"Not allowed to change the password, must be the user or an admin user", currentUserId);
}
} finally {
statsService.apiCall(AuthorizableManagerImpl.class.getName(), "changePassword", System.currentTimeMillis() - t);
}
} | class class_name[name] begin[{]
method[changePassword, return_type[void], modifier[public], parameter[authorizable, password, oldPassword]] begin[{]
local_variable[type[long], t]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=authorizable, selectors=[], type_arguments=None), name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAdmin, postfix_operators=[], prefix_operators=[], qualifier=thisUser, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=currentUserId, selectors=[], type_arguments=None), operator=||), else_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ZONE_ADMIN, postfix_operators=[], prefix_operators=[], qualifier=Security, selectors=[]), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Not allowed to change the password, must be the user or an admin user"), MemberReference(member=currentUserId, 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=AccessDeniedException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isAdmin, postfix_operators=[], prefix_operators=['!'], qualifier=thisUser, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=oldPassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=authenticate, postfix_operators=[], prefix_operators=[], qualifier=authenticator, selectors=[], type_arguments=None), name=u)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=User, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=u, 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=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to change passwords, old password does not match")], 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)]))])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=keySpace, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=authorizableColumnFamily, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=LASTMODIFIED_FIELD, postfix_operators=[], prefix_operators=[], qualifier=Authorizable, selectors=[]), Cast(expression=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), MemberReference(member=ID_FIELD, postfix_operators=[], prefix_operators=[], qualifier=Authorizable, selectors=[]), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=LASTMODIFIED_BY_FIELD, postfix_operators=[], prefix_operators=[], qualifier=Authorizable, selectors=[]), MethodInvocation(arguments=[], member=getCurrentUserId, postfix_operators=[], prefix_operators=[], qualifier=accessControlManager, selectors=[], type_arguments=None), MemberReference(member=PASSWORD_FIELD, postfix_operators=[], prefix_operators=[], qualifier=Authorizable, selectors=[]), MethodInvocation(arguments=[MemberReference(member=password, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=secureHash, postfix_operators=[], prefix_operators=[], qualifier=StorageClientUtils, selectors=[], type_arguments=None)], member=of, postfix_operators=[], prefix_operators=[], qualifier=ImmutableMap, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=putCached, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ZONE_AUTHORIZABLES, postfix_operators=[], prefix_operators=[], qualifier=Security, selectors=[]), MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=currentUserId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=authorizable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="op:change-password")], member=onUpdate, postfix_operators=[], prefix_operators=[], qualifier=storeListener, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=AuthorizableManagerImpl, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="changePassword"), BinaryOperation(operandl=MethodInvocation(arguments=[], member=currentTimeMillis, postfix_operators=[], prefix_operators=[], qualifier=System, selectors=[], type_arguments=None), operandr=MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], member=apiCall, postfix_operators=[], prefix_operators=[], qualifier=statsService, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[changePassword] operator[SEP] identifier[Authorizable] identifier[authorizable] , identifier[String] identifier[password] , identifier[String] identifier[oldPassword] operator[SEP] Keyword[throws] identifier[StorageClientException] , identifier[AccessDeniedException] {
Keyword[long] identifier[t] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[String] identifier[id] operator[=] identifier[authorizable] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[thisUser] operator[SEP] identifier[isAdmin] operator[SEP] operator[SEP] operator[||] identifier[currentUserId] operator[SEP] identifier[equals] operator[SEP] identifier[id] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[thisUser] operator[SEP] identifier[isAdmin] operator[SEP] operator[SEP] operator[SEP] {
identifier[User] identifier[u] operator[=] identifier[authenticator] operator[SEP] identifier[authenticate] operator[SEP] identifier[id] , identifier[oldPassword] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[u] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[putCached] operator[SEP] identifier[keySpace] , identifier[authorizableColumnFamily] , identifier[id] , identifier[ImmutableMap] operator[SEP] identifier[of] operator[SEP] identifier[Authorizable] operator[SEP] identifier[LASTMODIFIED_FIELD] , operator[SEP] identifier[Object] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] , identifier[Authorizable] operator[SEP] identifier[ID_FIELD] , identifier[id] , identifier[Authorizable] operator[SEP] identifier[LASTMODIFIED_BY_FIELD] , identifier[accessControlManager] operator[SEP] identifier[getCurrentUserId] operator[SEP] operator[SEP] , identifier[Authorizable] operator[SEP] identifier[PASSWORD_FIELD] , identifier[StorageClientUtils] operator[SEP] identifier[secureHash] operator[SEP] identifier[password] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP] identifier[storeListener] operator[SEP] identifier[onUpdate] operator[SEP] identifier[Security] operator[SEP] identifier[ZONE_AUTHORIZABLES] , identifier[id] , identifier[currentUserId] , identifier[getType] operator[SEP] identifier[authorizable] operator[SEP] , literal[boolean] , Other[null] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[AccessDeniedException] operator[SEP] identifier[Security] operator[SEP] identifier[ZONE_ADMIN] , identifier[id] , literal[String] , identifier[currentUserId] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[statsService] operator[SEP] identifier[apiCall] operator[SEP] identifier[AuthorizableManagerImpl] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , literal[String] , identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[t] operator[SEP] operator[SEP]
}
}
|
@Override
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);
// synchronizing on the pool (and actually all its threads)
// the synchronization is needed to avoid more than one signal if two or more
// threads decrement almost together and come to the if with 0 tasks together
synchronized (this) {
tasksInProcess.decrementAndGet();
if (tasksInProcess.intValue() == 0) {
synchronizer.signalAll();
}
}
} | class class_name[name] begin[{]
method[afterExecute, return_type[void], modifier[protected], parameter[r, t]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=afterExecute, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
SYNCHRONIZED[THIS[]] BEGIN[{]
call[tasksInProcess.decrementAndGet, parameter[]]
if[binary_operation[call[tasksInProcess.intValue, parameter[]], ==, literal[0]]] begin[{]
call[synchronizer.signalAll, parameter[]]
else begin[{]
None
end[}]
END[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[afterExecute] operator[SEP] identifier[Runnable] identifier[r] , identifier[Throwable] identifier[t] operator[SEP] {
Keyword[super] operator[SEP] identifier[afterExecute] operator[SEP] identifier[r] , identifier[t] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
identifier[tasksInProcess] operator[SEP] identifier[decrementAndGet] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[tasksInProcess] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[synchronizer] operator[SEP] identifier[signalAll] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@Override
public short getShort(final int index) {
boundsCheck(index, Bits.SHORT_SIZE_IN_BYTES);
short bits = MEM.getShort(byteArray, addressOffset + index);
if (NATIVE_BYTE_ORDER != PROTOCOL_BYTE_ORDER) {
bits = Short.reverseBytes(bits);
}
return bits;
} | class class_name[name] begin[{]
method[getShort, return_type[type[short]], modifier[public], parameter[index]] begin[{]
call[.boundsCheck, parameter[member[.index], member[Bits.SHORT_SIZE_IN_BYTES]]]
local_variable[type[short], bits]
if[binary_operation[member[.NATIVE_BYTE_ORDER], !=, member[.PROTOCOL_BYTE_ORDER]]] begin[{]
assign[member[.bits], call[Short.reverseBytes, parameter[member[.bits]]]]
else begin[{]
None
end[}]
return[member[.bits]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[short] identifier[getShort] operator[SEP] Keyword[final] Keyword[int] identifier[index] operator[SEP] {
identifier[boundsCheck] operator[SEP] identifier[index] , identifier[Bits] operator[SEP] identifier[SHORT_SIZE_IN_BYTES] operator[SEP] operator[SEP] Keyword[short] identifier[bits] operator[=] identifier[MEM] operator[SEP] identifier[getShort] operator[SEP] identifier[byteArray] , identifier[addressOffset] operator[+] identifier[index] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[NATIVE_BYTE_ORDER] operator[!=] identifier[PROTOCOL_BYTE_ORDER] operator[SEP] {
identifier[bits] operator[=] identifier[Short] operator[SEP] identifier[reverseBytes] operator[SEP] identifier[bits] operator[SEP] operator[SEP]
}
Keyword[return] identifier[bits] operator[SEP]
}
|
public static License createLicense(final String name, final String longName, final String comments, final String regexp, final String url){
final License license = new License();
license.setName(name);
license.setLongName(longName);
license.setComments(comments);
license.setRegexp(regexp);
license.setUrl(url);
return license;
} | class class_name[name] begin[{]
method[createLicense, return_type[type[License]], modifier[public static], parameter[name, longName, comments, regexp, url]] begin[{]
local_variable[type[License], license]
call[license.setName, parameter[member[.name]]]
call[license.setLongName, parameter[member[.longName]]]
call[license.setComments, parameter[member[.comments]]]
call[license.setRegexp, parameter[member[.regexp]]]
call[license.setUrl, parameter[member[.url]]]
return[member[.license]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[License] identifier[createLicense] operator[SEP] Keyword[final] identifier[String] identifier[name] , Keyword[final] identifier[String] identifier[longName] , Keyword[final] identifier[String] identifier[comments] , Keyword[final] identifier[String] identifier[regexp] , Keyword[final] identifier[String] identifier[url] operator[SEP] {
Keyword[final] identifier[License] identifier[license] operator[=] Keyword[new] identifier[License] operator[SEP] operator[SEP] operator[SEP] identifier[license] operator[SEP] identifier[setName] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[license] operator[SEP] identifier[setLongName] operator[SEP] identifier[longName] operator[SEP] operator[SEP] identifier[license] operator[SEP] identifier[setComments] operator[SEP] identifier[comments] operator[SEP] operator[SEP] identifier[license] operator[SEP] identifier[setRegexp] operator[SEP] identifier[regexp] operator[SEP] operator[SEP] identifier[license] operator[SEP] identifier[setUrl] operator[SEP] identifier[url] operator[SEP] operator[SEP] Keyword[return] identifier[license] operator[SEP]
}
|
public static A_CmsAjaxGallery createInstance(String galleryTypeName, CmsJspActionElement jsp) {
if (jsp != null) {
// must have a valid JSP in order to read from the user session
HttpSession session = jsp.getRequest().getSession();
// lookup the workplace settings
CmsWorkplaceSettings settings = (CmsWorkplaceSettings)session.getAttribute(
CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
if (settings != null) {
if (CmsStringUtil.isEmpty(galleryTypeName)) {
// look up the gallery type from the settings
galleryTypeName = settings.getGalleryType();
} else {
// store the last used gallery type name
settings.setGalleryType(galleryTypeName);
}
}
}
// get the gallery class name for the type
A_CmsAjaxGallery template = OpenCms.getWorkplaceManager().getGalleries().get(galleryTypeName);
if (template == null) {
// requested gallery type is not configured
CmsMessageContainer message;
if (jsp == null) {
message = Messages.get().container(Messages.LOG_UNKNOWN_GALLERY_TYPE_REQ_1, galleryTypeName);
} else {
message = Messages.get().container(
Messages.LOG_UNKNOWN_GALLERY_TYPE_REQ_JSP_2,
galleryTypeName,
jsp.info("opencms.request.element.uri"));
}
LOG.error(message.key());
throw new CmsRuntimeException(message);
}
try {
// first get the class of the gallery
Class<?> galleryClass = Class.forName(template.getResourceType().getFolderClassName());
// create a new instance and cast to a gallery
A_CmsAjaxGallery galleryInstance = (A_CmsAjaxGallery)galleryClass.newInstance();
// set the type name and id
galleryInstance.m_resourceType = template.getResourceType();
galleryInstance.m_galleryTypeParams = template.getResourceType().getFolderClassParams();
// initialize the members
galleryInstance.initWorkplaceMembers(jsp);
// perform other initialization
galleryInstance.init();
// return the result
return galleryInstance;
} catch (Exception e) {
// requested type is not configured
CmsMessageContainer message;
if (jsp == null) {
message = Messages.get().container(
Messages.LOG_CREATE_GALLERY_INSTANCE_FAILED_2,
template.getResourceType().getFolderClassName(),
galleryTypeName);
} else {
message = Messages.get().container(
Messages.LOG_CREATE_GALLERY_INSTANCE_FAILED_JSP_3,
template.getResourceType().getFolderClassName(),
galleryTypeName,
jsp.info("opencms.request.element.uri"));
}
LOG.error(message.key());
throw new CmsRuntimeException(message);
}
} | class class_name[name] begin[{]
method[createInstance, return_type[type[A_CmsAjaxGallery]], modifier[public static], parameter[galleryTypeName, jsp]] begin[{]
if[binary_operation[member[.jsp], !=, literal[null]]] begin[{]
local_variable[type[HttpSession], session]
local_variable[type[CmsWorkplaceSettings], settings]
if[binary_operation[member[.settings], !=, literal[null]]] begin[{]
if[call[CmsStringUtil.isEmpty, parameter[member[.galleryTypeName]]]] begin[{]
assign[member[.galleryTypeName], call[settings.getGalleryType, parameter[]]]
else begin[{]
call[settings.setGalleryType, parameter[member[.galleryTypeName]]]
end[}]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[A_CmsAjaxGallery], template]
if[binary_operation[member[.template], ==, literal[null]]] begin[{]
local_variable[type[CmsMessageContainer], message]
if[binary_operation[member[.jsp], ==, literal[null]]] begin[{]
assign[member[.message], call[Messages.get, parameter[]]]
else begin[{]
assign[member[.message], call[Messages.get, parameter[]]]
end[}]
call[LOG.error, parameter[call[message.key, parameter[]]]]
ThrowStatement(expression=ClassCreator(arguments=[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=CmsRuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getResourceType, postfix_operators=[], prefix_operators=[], qualifier=template, selectors=[MethodInvocation(arguments=[], member=getFolderClassName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None), name=galleryClass)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=galleryClass, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=A_CmsAjaxGallery, sub_type=None)), name=galleryInstance)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=A_CmsAjaxGallery, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_resourceType, postfix_operators=[], prefix_operators=[], qualifier=galleryInstance, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getResourceType, postfix_operators=[], prefix_operators=[], qualifier=template, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_galleryTypeParams, postfix_operators=[], prefix_operators=[], qualifier=galleryInstance, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getResourceType, postfix_operators=[], prefix_operators=[], qualifier=template, selectors=[MethodInvocation(arguments=[], member=getFolderClassParams, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=jsp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initWorkplaceMembers, postfix_operators=[], prefix_operators=[], qualifier=galleryInstance, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=init, postfix_operators=[], prefix_operators=[], qualifier=galleryInstance, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=galleryInstance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=message)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsMessageContainer, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=jsp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=LOG_CREATE_GALLERY_INSTANCE_FAILED_JSP_3, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MethodInvocation(arguments=[], member=getResourceType, postfix_operators=[], prefix_operators=[], qualifier=template, selectors=[MethodInvocation(arguments=[], member=getFolderClassName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=galleryTypeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="opencms.request.element.uri")], member=info, postfix_operators=[], prefix_operators=[], qualifier=jsp, selectors=[], type_arguments=None)], member=container, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=LOG_CREATE_GALLERY_INSTANCE_FAILED_2, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MethodInvocation(arguments=[], member=getResourceType, postfix_operators=[], prefix_operators=[], qualifier=template, selectors=[MethodInvocation(arguments=[], member=getFolderClassName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=galleryTypeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=container, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=key, postfix_operators=[], prefix_operators=[], qualifier=message, selectors=[], type_arguments=None)], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[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=CmsRuntimeException, 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[public] Keyword[static] identifier[A_CmsAjaxGallery] identifier[createInstance] operator[SEP] identifier[String] identifier[galleryTypeName] , identifier[CmsJspActionElement] identifier[jsp] operator[SEP] {
Keyword[if] operator[SEP] identifier[jsp] operator[!=] Other[null] operator[SEP] {
identifier[HttpSession] identifier[session] operator[=] identifier[jsp] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] identifier[getSession] operator[SEP] operator[SEP] operator[SEP] identifier[CmsWorkplaceSettings] identifier[settings] operator[=] operator[SEP] identifier[CmsWorkplaceSettings] operator[SEP] identifier[session] operator[SEP] identifier[getAttribute] operator[SEP] identifier[CmsWorkplaceManager] operator[SEP] identifier[SESSION_WORKPLACE_SETTINGS] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[settings] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[CmsStringUtil] operator[SEP] identifier[isEmpty] operator[SEP] identifier[galleryTypeName] operator[SEP] operator[SEP] {
identifier[galleryTypeName] operator[=] identifier[settings] operator[SEP] identifier[getGalleryType] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[settings] operator[SEP] identifier[setGalleryType] operator[SEP] identifier[galleryTypeName] operator[SEP] operator[SEP]
}
}
}
identifier[A_CmsAjaxGallery] identifier[template] operator[=] identifier[OpenCms] operator[SEP] identifier[getWorkplaceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getGalleries] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[galleryTypeName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[template] operator[==] Other[null] operator[SEP] {
identifier[CmsMessageContainer] identifier[message] operator[SEP] Keyword[if] operator[SEP] identifier[jsp] operator[==] Other[null] operator[SEP] {
identifier[message] operator[=] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[LOG_UNKNOWN_GALLERY_TYPE_REQ_1] , identifier[galleryTypeName] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[message] operator[=] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[LOG_UNKNOWN_GALLERY_TYPE_REQ_JSP_2] , identifier[galleryTypeName] , identifier[jsp] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[message] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CmsRuntimeException] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[Class] operator[<] operator[?] operator[>] identifier[galleryClass] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[template] operator[SEP] identifier[getResourceType] operator[SEP] operator[SEP] operator[SEP] identifier[getFolderClassName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[A_CmsAjaxGallery] identifier[galleryInstance] operator[=] operator[SEP] identifier[A_CmsAjaxGallery] operator[SEP] identifier[galleryClass] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] identifier[galleryInstance] operator[SEP] identifier[m_resourceType] operator[=] identifier[template] operator[SEP] identifier[getResourceType] operator[SEP] operator[SEP] operator[SEP] identifier[galleryInstance] operator[SEP] identifier[m_galleryTypeParams] operator[=] identifier[template] operator[SEP] identifier[getResourceType] operator[SEP] operator[SEP] operator[SEP] identifier[getFolderClassParams] operator[SEP] operator[SEP] operator[SEP] identifier[galleryInstance] operator[SEP] identifier[initWorkplaceMembers] operator[SEP] identifier[jsp] operator[SEP] operator[SEP] identifier[galleryInstance] operator[SEP] identifier[init] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[galleryInstance] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[CmsMessageContainer] identifier[message] operator[SEP] Keyword[if] operator[SEP] identifier[jsp] operator[==] Other[null] operator[SEP] {
identifier[message] operator[=] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[LOG_CREATE_GALLERY_INSTANCE_FAILED_2] , identifier[template] operator[SEP] identifier[getResourceType] operator[SEP] operator[SEP] operator[SEP] identifier[getFolderClassName] operator[SEP] operator[SEP] , identifier[galleryTypeName] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[message] operator[=] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[Messages] operator[SEP] identifier[LOG_CREATE_GALLERY_INSTANCE_FAILED_JSP_3] , identifier[template] operator[SEP] identifier[getResourceType] operator[SEP] operator[SEP] operator[SEP] identifier[getFolderClassName] operator[SEP] operator[SEP] , identifier[galleryTypeName] , identifier[jsp] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[message] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[CmsRuntimeException] operator[SEP] identifier[message] operator[SEP] operator[SEP]
}
}
|
public Class<?> resolveClass(String classname) throws ClassNotFoundException {
LOGGER.trace("Trying to resolve class {} from BundleDelegatingClassResolver", classname);
synchronized (bundles) {
Collection<Bundle> values = bundles.values();
for (Bundle bundle : values) {
try {
LOGGER.trace("Trying to load class {} from bundle {}", classname, bundle.getSymbolicName());
Class<?> loadedClass = bundle.loadClass(classname);
LOGGER.debug("Loaded class {} from bundle {}", classname, bundle.getSymbolicName());
return loadedClass;
} catch (ClassNotFoundException e) {
LOGGER.trace("Could not load class {} from bundle {} because bundle does not contain the class",
classname, bundle.getSymbolicName());
} catch (IllegalStateException e) {
LOGGER.trace("Could not load class {} from bundle {} because bundle had been uninstalled",
classname,
bundle.getSymbolicName());
}
}
}
throw new ClassNotFoundException("Class [" + classname + "] can't be resolved.");
} | class class_name[name] begin[{]
method[resolveClass, return_type[type[Class]], modifier[public], parameter[classname]] begin[{]
call[LOGGER.trace, parameter[literal["Trying to resolve class {} from BundleDelegatingClassResolver"], member[.classname]]]
SYNCHRONIZED[member[.bundles]] BEGIN[{]
local_variable[type[Collection], values]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Trying to load class {} from bundle {}"), MemberReference(member=classname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getSymbolicName, postfix_operators=[], prefix_operators=[], qualifier=bundle, selectors=[], type_arguments=None)], member=trace, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=classname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadClass, postfix_operators=[], prefix_operators=[], qualifier=bundle, selectors=[], type_arguments=None), name=loadedClass)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Loaded class {} from bundle {}"), MemberReference(member=classname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getSymbolicName, postfix_operators=[], prefix_operators=[], qualifier=bundle, selectors=[], type_arguments=None)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=loadedClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not load class {} from bundle {} because bundle does not contain the class"), MemberReference(member=classname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getSymbolicName, postfix_operators=[], prefix_operators=[], qualifier=bundle, selectors=[], type_arguments=None)], member=trace, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not load class {} from bundle {} because bundle had been uninstalled"), MemberReference(member=classname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getSymbolicName, postfix_operators=[], prefix_operators=[], qualifier=bundle, selectors=[], type_arguments=None)], member=trace, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalStateException']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bundle)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Bundle, sub_type=None))), label=None)
END[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Class ["), operandr=MemberReference(member=classname, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] can't be resolved."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClassNotFoundException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[public] identifier[Class] operator[<] operator[?] operator[>] identifier[resolveClass] operator[SEP] identifier[String] identifier[classname] operator[SEP] Keyword[throws] identifier[ClassNotFoundException] {
identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[classname] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[bundles] operator[SEP] {
identifier[Collection] operator[<] identifier[Bundle] operator[>] identifier[values] operator[=] identifier[bundles] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Bundle] identifier[bundle] operator[:] identifier[values] operator[SEP] {
Keyword[try] {
identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[classname] , identifier[bundle] operator[SEP] identifier[getSymbolicName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[loadedClass] operator[=] identifier[bundle] operator[SEP] identifier[loadClass] operator[SEP] identifier[classname] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[classname] , identifier[bundle] operator[SEP] identifier[getSymbolicName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[loadedClass] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[classname] , identifier[bundle] operator[SEP] identifier[getSymbolicName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalStateException] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[classname] , identifier[bundle] operator[SEP] identifier[getSymbolicName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[throw] Keyword[new] identifier[ClassNotFoundException] operator[SEP] literal[String] operator[+] identifier[classname] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
public Observable<Void> updateGatewaySettingsAsync(String resourceGroupName, String clusterName, UpdateGatewaySettingsParameters parameters) {
return updateGatewaySettingsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[updateGatewaySettingsAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, clusterName, parameters]] begin[{]
return[call[.updateGatewaySettingsWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.clusterName], member[.parameters]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[Void] operator[>] identifier[updateGatewaySettingsAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[clusterName] , identifier[UpdateGatewaySettingsParameters] identifier[parameters] operator[SEP] {
Keyword[return] identifier[updateGatewaySettingsWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[clusterName] , identifier[parameters] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[Void] operator[>] , identifier[Void] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Void] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[Void] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public boolean onLogout()
{
App application = this.getTask().getApplication();
int iErrorCode = application.login(this.getTask(), null, null, this.getProperty(DBParams.DOMAIN));
if (iErrorCode != DBConstants.NORMAL_RETURN)
return false;
String strMenu = this.getProperty(DBParams.HOME);
if (strMenu == null)
strMenu = this.getTask().getProperty(DBParams.MENU);
if (strMenu != null)
{
BasePanel screenParent = this.getParentScreen();
int count = 0;
while (screenParent.popHistory(1, false) != null)
{
count++;
}
count--; // Want to move back to the first one
if (count > 0)
popHistory(count, true); // Dump all browser history
Map<String,Object> properties = this.getProperties();
this.finalizeThisScreen(); // Validate current control, update record, get ready to close screen.
if (!(this instanceof MenuScreen))
{
this.free();
new MenuScreen(null, null, screenParent, null, ScreenConstants.MAINT_MODE, properties);
}
else
this.doCommand("?" + DBParams.MENU + '=' + strMenu, this, ScreenConstants.USE_SAME_WINDOW | DBConstants.PUSH_TO_BROWSER);
}
return true; // Should always be successful
} | class class_name[name] begin[{]
method[onLogout, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[App], application]
local_variable[type[int], iErrorCode]
if[binary_operation[member[.iErrorCode], !=, member[DBConstants.NORMAL_RETURN]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[String], strMenu]
if[binary_operation[member[.strMenu], ==, literal[null]]] begin[{]
assign[member[.strMenu], THIS[call[None.getTask, parameter[]]call[None.getProperty, parameter[member[DBParams.MENU]]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.strMenu], !=, literal[null]]] begin[{]
local_variable[type[BasePanel], screenParent]
local_variable[type[int], count]
while[binary_operation[call[screenParent.popHistory, parameter[literal[1], literal[false]]], !=, literal[null]]] begin[{]
member[.count]
end[}]
member[.count]
if[binary_operation[member[.count], >, literal[0]]] begin[{]
call[.popHistory, parameter[member[.count], literal[true]]]
else begin[{]
None
end[}]
local_variable[type[Map], properties]
THIS[call[None.finalizeThisScreen, parameter[]]]
if[binary_operation[THIS[], instanceof, type[MenuScreen]]] begin[{]
THIS[call[None.free, parameter[]]]
ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=screenParent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=MAINT_MODE, postfix_operators=[], prefix_operators=[], qualifier=ScreenConstants, selectors=[]), MemberReference(member=properties, 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=MenuScreen, sub_type=None))
else begin[{]
THIS[call[None.doCommand, parameter[binary_operation[binary_operation[binary_operation[literal["?"], +, member[DBParams.MENU]], +, literal['=']], +, member[.strMenu]], THIS[], binary_operation[member[ScreenConstants.USE_SAME_WINDOW], |, member[DBConstants.PUSH_TO_BROWSER]]]]]
end[}]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[onLogout] operator[SEP] operator[SEP] {
identifier[App] identifier[application] operator[=] Keyword[this] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] operator[SEP] identifier[getApplication] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[iErrorCode] operator[=] identifier[application] operator[SEP] identifier[login] operator[SEP] Keyword[this] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] , Other[null] , Other[null] , Keyword[this] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBParams] operator[SEP] identifier[DOMAIN] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iErrorCode] operator[!=] identifier[DBConstants] operator[SEP] identifier[NORMAL_RETURN] operator[SEP] Keyword[return] literal[boolean] operator[SEP] identifier[String] identifier[strMenu] operator[=] Keyword[this] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBParams] operator[SEP] identifier[HOME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strMenu] operator[==] Other[null] operator[SEP] identifier[strMenu] operator[=] Keyword[this] operator[SEP] identifier[getTask] operator[SEP] operator[SEP] operator[SEP] identifier[getProperty] operator[SEP] identifier[DBParams] operator[SEP] identifier[MENU] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strMenu] operator[!=] Other[null] operator[SEP] {
identifier[BasePanel] identifier[screenParent] operator[=] Keyword[this] operator[SEP] identifier[getParentScreen] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[count] operator[=] Other[0] operator[SEP] Keyword[while] operator[SEP] identifier[screenParent] operator[SEP] identifier[popHistory] operator[SEP] Other[1] , literal[boolean] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[count] operator[++] operator[SEP]
}
identifier[count] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[count] operator[>] Other[0] operator[SEP] identifier[popHistory] operator[SEP] identifier[count] , literal[boolean] operator[SEP] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] operator[=] Keyword[this] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[finalizeThisScreen] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] Keyword[this] Keyword[instanceof] identifier[MenuScreen] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[free] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[MenuScreen] operator[SEP] Other[null] , Other[null] , identifier[screenParent] , Other[null] , identifier[ScreenConstants] operator[SEP] identifier[MAINT_MODE] , identifier[properties] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[this] operator[SEP] identifier[doCommand] operator[SEP] literal[String] operator[+] identifier[DBParams] operator[SEP] identifier[MENU] operator[+] literal[String] operator[+] identifier[strMenu] , Keyword[this] , identifier[ScreenConstants] operator[SEP] identifier[USE_SAME_WINDOW] operator[|] identifier[DBConstants] operator[SEP] identifier[PUSH_TO_BROWSER] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public void tidyUpUIContextForTree() {
UIContext uic = UIContextHolder.getCurrent();
if (uic != null) {
tidyUpUIContext();
List<WComponent> children = getComponentModel().getChildren();
if (children != null) {
final int size = children.size();
for (int i = 0; i < size; i++) {
children.get(i).tidyUpUIContextForTree();
}
}
}
} | class class_name[name] begin[{]
method[tidyUpUIContextForTree, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[UIContext], uic]
if[binary_operation[member[.uic], !=, literal[null]]] begin[{]
call[.tidyUpUIContext, parameter[]]
local_variable[type[List], children]
if[binary_operation[member[.children], !=, literal[null]]] begin[{]
local_variable[type[int], size]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=children, selectors=[MethodInvocation(arguments=[], member=tidyUpUIContextForTree, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=size, 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)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[tidyUpUIContextForTree] operator[SEP] operator[SEP] {
identifier[UIContext] identifier[uic] operator[=] identifier[UIContextHolder] operator[SEP] identifier[getCurrent] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[uic] operator[!=] Other[null] operator[SEP] {
identifier[tidyUpUIContext] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[WComponent] operator[>] identifier[children] operator[=] identifier[getComponentModel] operator[SEP] operator[SEP] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[children] operator[!=] Other[null] operator[SEP] {
Keyword[final] Keyword[int] identifier[size] operator[=] identifier[children] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[size] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[children] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[tidyUpUIContextForTree] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public RestTemplateBuilder additionalCustomizers(
RestTemplateCustomizer... restTemplateCustomizers) {
Assert.notNull(restTemplateCustomizers,
"RestTemplateCustomizers must not be null");
return additionalCustomizers(Arrays.asList(restTemplateCustomizers));
} | class class_name[name] begin[{]
method[additionalCustomizers, return_type[type[RestTemplateBuilder]], modifier[public], parameter[restTemplateCustomizers]] begin[{]
call[Assert.notNull, parameter[member[.restTemplateCustomizers], literal["RestTemplateCustomizers must not be null"]]]
return[call[.additionalCustomizers, parameter[call[Arrays.asList, parameter[member[.restTemplateCustomizers]]]]]]
end[}]
END[}] | Keyword[public] identifier[RestTemplateBuilder] identifier[additionalCustomizers] operator[SEP] identifier[RestTemplateCustomizer] operator[...] identifier[restTemplateCustomizers] operator[SEP] {
identifier[Assert] operator[SEP] identifier[notNull] operator[SEP] identifier[restTemplateCustomizers] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[additionalCustomizers] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[restTemplateCustomizers] operator[SEP] operator[SEP] operator[SEP]
}
|
private ProducerSession internalCreateProducerSession(
SIDestinationAddress destAddress,
DestinationType destinationType,
boolean system,
SecurityContext secContext,
boolean keepSecurityUserid,
boolean fixedMessagePoint,
boolean preferLocal,
boolean clearPubSubFingerprints,
String discriminator)
throws SIConnectionUnavailableException, SIConnectionDroppedException,
SIErrorException,
SITemporaryDestinationNotFoundException, SIIncorrectCallException, SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"internalCreateProducerSession",
new Object[] { destAddress,
destinationType,
system,
secContext,
keepSecurityUserid,
fixedMessagePoint,
preferLocal,
clearPubSubFingerprints });
String destinationName = destAddress.getDestinationName();
String busName = destAddress.getBusName();
DestinationHandler destination =
_destinationManager.getDestination(destinationName, busName, false, true);
// Check the destination type
checkDestinationType(destinationType, destAddress, destination, system);
// Check authority to produce to destination
// If security is disabled then we'll bypass the check
// Security changes for Liberty Messaging: Sharath Start
// Remove the If condition, since the proxy class handles it
checkDestinationAuthority(destination, MessagingSecurityConstants.OPERATION_TYPE_SEND, discriminator);
// Security changes for Liberty Messaging: Sharath End
ProducerSession producer = null;
// Synchronize on the close object, we don't want the connection closing
// while we try to add the producer.
synchronized (this)
{
// See if this connection has been closed
checkNotClosed();
producer =
new ProducerSessionImpl(destAddress,
destination,
this,
secContext,
keepSecurityUserid,
fixedMessagePoint,
preferLocal,
clearPubSubFingerprints);
synchronized (_producers)
{
//store a reference to that producer session so that we can close
//it again later if needed
_producers.add(producer);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "internalCreateProducerSession", producer);
return producer; //169892
} | class class_name[name] begin[{]
method[internalCreateProducerSession, return_type[type[ProducerSession]], modifier[private], parameter[destAddress, destinationType, system, secContext, keepSecurityUserid, fixedMessagePoint, preferLocal, clearPubSubFingerprints, discriminator]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[member[.tc], literal["internalCreateProducerSession"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=destAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=destinationType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=system, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=secContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keepSecurityUserid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fixedMessagePoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=preferLocal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clearPubSubFingerprints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[String], destinationName]
local_variable[type[String], busName]
local_variable[type[DestinationHandler], destination]
call[.checkDestinationType, parameter[member[.destinationType], member[.destAddress], member[.destination], member[.system]]]
call[.checkDestinationAuthority, parameter[member[.destination], member[MessagingSecurityConstants.OPERATION_TYPE_SEND], member[.discriminator]]]
local_variable[type[ProducerSession], producer]
SYNCHRONIZED[THIS[]] BEGIN[{]
call[.checkNotClosed, parameter[]]
assign[member[.producer], ClassCreator(arguments=[MemberReference(member=destAddress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=destination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=secContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keepSecurityUserid, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fixedMessagePoint, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=preferLocal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=clearPubSubFingerprints, 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=ProducerSessionImpl, sub_type=None))]
SYNCHRONIZED[member[._producers]] BEGIN[{]
call[_producers.add, parameter[member[.producer]]]
END[}]
END[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[member[.tc], literal["internalCreateProducerSession"], member[.producer]]]
else begin[{]
None
end[}]
return[member[.producer]]
end[}]
END[}] | Keyword[private] identifier[ProducerSession] identifier[internalCreateProducerSession] operator[SEP] identifier[SIDestinationAddress] identifier[destAddress] , identifier[DestinationType] identifier[destinationType] , Keyword[boolean] identifier[system] , identifier[SecurityContext] identifier[secContext] , Keyword[boolean] identifier[keepSecurityUserid] , Keyword[boolean] identifier[fixedMessagePoint] , Keyword[boolean] identifier[preferLocal] , Keyword[boolean] identifier[clearPubSubFingerprints] , identifier[String] identifier[discriminator] operator[SEP] Keyword[throws] identifier[SIConnectionUnavailableException] , identifier[SIConnectionDroppedException] , identifier[SIErrorException] , identifier[SITemporaryDestinationNotFoundException] , identifier[SIIncorrectCallException] , identifier[SIResourceException] , identifier[SINotPossibleInCurrentConfigurationException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[destAddress] , identifier[destinationType] , identifier[system] , identifier[secContext] , identifier[keepSecurityUserid] , identifier[fixedMessagePoint] , identifier[preferLocal] , identifier[clearPubSubFingerprints]
} operator[SEP] operator[SEP] identifier[String] identifier[destinationName] operator[=] identifier[destAddress] operator[SEP] identifier[getDestinationName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[busName] operator[=] identifier[destAddress] operator[SEP] identifier[getBusName] operator[SEP] operator[SEP] operator[SEP] identifier[DestinationHandler] identifier[destination] operator[=] identifier[_destinationManager] operator[SEP] identifier[getDestination] operator[SEP] identifier[destinationName] , identifier[busName] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] identifier[checkDestinationType] operator[SEP] identifier[destinationType] , identifier[destAddress] , identifier[destination] , identifier[system] operator[SEP] operator[SEP] identifier[checkDestinationAuthority] operator[SEP] identifier[destination] , identifier[MessagingSecurityConstants] operator[SEP] identifier[OPERATION_TYPE_SEND] , identifier[discriminator] operator[SEP] operator[SEP] identifier[ProducerSession] identifier[producer] operator[=] Other[null] operator[SEP] Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
identifier[checkNotClosed] operator[SEP] operator[SEP] operator[SEP] identifier[producer] operator[=] Keyword[new] identifier[ProducerSessionImpl] operator[SEP] identifier[destAddress] , identifier[destination] , Keyword[this] , identifier[secContext] , identifier[keepSecurityUserid] , identifier[fixedMessagePoint] , identifier[preferLocal] , identifier[clearPubSubFingerprints] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[_producers] operator[SEP] {
identifier[_producers] operator[SEP] identifier[add] operator[SEP] identifier[producer] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] , identifier[producer] operator[SEP] operator[SEP] Keyword[return] identifier[producer] operator[SEP]
}
|
public String putEvents(List<EventType> eventTypes) throws PutEventsFault {
if (LOG.isLoggable(Level.INFO)) {
LOG.info("Received event(" + eventTypes.size() + ") from Agent.");
}
List<Event> events = new ArrayList<Event>(eventTypes.size());
try {
for (EventType eventType : eventTypes) {
events.add(EventTypeMapper.map(eventType));
}
} catch (RuntimeException e) {
throwFault("004", "Could not map web service data to event." + e.getMessage(), e);
}
try {
monitoringService.putEvents(events);
} catch (MonitoringException e) {
e.logException(Level.SEVERE);
throwFault(e.getCode(), e.getMessage(), e);
} catch (Throwable t) {
throwFault("000", "Unknown error " + t.getMessage(), t);
}
return "success";
} | class class_name[name] begin[{]
method[putEvents, return_type[type[String]], modifier[public], parameter[eventTypes]] begin[{]
if[call[LOG.isLoggable, parameter[member[Level.INFO]]]] begin[{]
call[LOG.info, parameter[binary_operation[binary_operation[literal["Received event("], +, call[eventTypes.size, parameter[]]], +, literal[") from Agent."]]]]
else begin[{]
None
end[}]
local_variable[type[List], events]
TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=eventType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=map, postfix_operators=[], prefix_operators=[], qualifier=EventTypeMapper, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=events, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=eventTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=eventType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=EventType, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="004"), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not map web service data to event."), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=throwFault, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['RuntimeException']))], finally_block=None, label=None, resources=None)
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=events, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putEvents, postfix_operators=[], prefix_operators=[], qualifier=monitoringService, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=SEVERE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], member=logException, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCode, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=throwFault, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MonitoringException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="000"), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown error "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None), operator=+), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=throwFault, postfix_operators=[], prefix_operators=[], qualifier=, 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["success"]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[putEvents] operator[SEP] identifier[List] operator[<] identifier[EventType] operator[>] identifier[eventTypes] operator[SEP] Keyword[throws] identifier[PutEventsFault] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[INFO] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[eventTypes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[Event] operator[>] identifier[events] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Event] operator[>] operator[SEP] identifier[eventTypes] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[for] operator[SEP] identifier[EventType] identifier[eventType] operator[:] identifier[eventTypes] operator[SEP] {
identifier[events] operator[SEP] identifier[add] operator[SEP] identifier[EventTypeMapper] operator[SEP] identifier[map] operator[SEP] identifier[eventType] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[RuntimeException] identifier[e] operator[SEP] {
identifier[throwFault] operator[SEP] literal[String] , literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[monitoringService] operator[SEP] identifier[putEvents] operator[SEP] identifier[events] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[MonitoringException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[logException] operator[SEP] identifier[Level] operator[SEP] identifier[SEVERE] operator[SEP] operator[SEP] identifier[throwFault] operator[SEP] identifier[e] operator[SEP] identifier[getCode] operator[SEP] operator[SEP] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[throwFault] operator[SEP] literal[String] , literal[String] operator[+] identifier[t] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[t] operator[SEP] operator[SEP]
}
Keyword[return] literal[String] operator[SEP]
}
|
public com.squareup.okhttp.Call postPermissionsAsync(String objectType, PostPermissionsData body, final ApiCallback<Void> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = postPermissionsValidateBeforeCall(objectType, body, progressListener, progressRequestListener);
apiClient.executeAsync(call, callback);
return call;
} | class class_name[name] begin[{]
method[postPermissionsAsync, return_type[type[com]], modifier[public], parameter[objectType, body, callback]] begin[{]
local_variable[type[ProgressResponseBody], progressListener]
local_variable[type[ProgressRequestBody], progressRequestListener]
if[binary_operation[member[.callback], !=, literal[null]]] begin[{]
assign[member[.progressListener], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bytesRead, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=contentLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=done, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onDownloadProgress, postfix_operators=[], prefix_operators=[], qualifier=callback, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=update, parameters=[FormalParameter(annotations=[], modifiers=set(), name=bytesRead, type=BasicType(dimensions=[], name=long), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=contentLength, type=BasicType(dimensions=[], name=long), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=done, type=BasicType(dimensions=[], name=boolean), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ProgressResponseBody, sub_type=ReferenceType(arguments=None, dimensions=None, name=ProgressListener, sub_type=None)))]
assign[member[.progressRequestListener], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=bytesWritten, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=contentLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=done, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=onUploadProgress, postfix_operators=[], prefix_operators=[], qualifier=callback, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=onRequestProgress, parameters=[FormalParameter(annotations=[], modifiers=set(), name=bytesWritten, type=BasicType(dimensions=[], name=long), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=contentLength, type=BasicType(dimensions=[], name=long), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=done, type=BasicType(dimensions=[], name=boolean), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ProgressRequestBody, sub_type=ReferenceType(arguments=None, dimensions=None, name=ProgressRequestListener, sub_type=None)))]
else begin[{]
None
end[}]
local_variable[type[com], call]
call[apiClient.executeAsync, parameter[member[.call], member[.callback]]]
return[member[.call]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[postPermissionsAsync] operator[SEP] identifier[String] identifier[objectType] , identifier[PostPermissionsData] identifier[body] , Keyword[final] identifier[ApiCallback] operator[<] identifier[Void] operator[>] identifier[callback] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[ProgressResponseBody] operator[SEP] identifier[ProgressListener] identifier[progressListener] operator[=] Other[null] operator[SEP] identifier[ProgressRequestBody] operator[SEP] identifier[ProgressRequestListener] identifier[progressRequestListener] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[callback] operator[!=] Other[null] operator[SEP] {
identifier[progressListener] operator[=] Keyword[new] identifier[ProgressResponseBody] operator[SEP] identifier[ProgressListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[update] operator[SEP] Keyword[long] identifier[bytesRead] , Keyword[long] identifier[contentLength] , Keyword[boolean] identifier[done] operator[SEP] {
identifier[callback] operator[SEP] identifier[onDownloadProgress] operator[SEP] identifier[bytesRead] , identifier[contentLength] , identifier[done] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[progressRequestListener] operator[=] Keyword[new] identifier[ProgressRequestBody] operator[SEP] identifier[ProgressRequestListener] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onRequestProgress] operator[SEP] Keyword[long] identifier[bytesWritten] , Keyword[long] identifier[contentLength] , Keyword[boolean] identifier[done] operator[SEP] {
identifier[callback] operator[SEP] identifier[onUploadProgress] operator[SEP] identifier[bytesWritten] , identifier[contentLength] , identifier[done] operator[SEP] operator[SEP]
}
} operator[SEP]
}
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[postPermissionsValidateBeforeCall] operator[SEP] identifier[objectType] , identifier[body] , identifier[progressListener] , identifier[progressRequestListener] operator[SEP] operator[SEP] identifier[apiClient] operator[SEP] identifier[executeAsync] operator[SEP] identifier[call] , identifier[callback] operator[SEP] operator[SEP] Keyword[return] identifier[call] operator[SEP]
}
|
@Nullable
public static String replaceAll (@Nullable final String sInputString,
final char cSearchChar,
final char cReplacementChar)
{
// Is input string empty?
if (hasNoText (sInputString))
return sInputString;
// Replace old with the same new?
if (cSearchChar == cReplacementChar)
return sInputString;
// Does the old text occur anywhere?
int nIndex = sInputString.indexOf (cSearchChar, 0);
if (nIndex == STRING_NOT_FOUND)
return sInputString;
// build output buffer
final StringBuilder ret = new StringBuilder (sInputString.length ());
int nOldIndex = 0;
do
{
ret.append (sInputString, nOldIndex, nIndex).append (cReplacementChar);
nIndex++;
nOldIndex = nIndex;
nIndex = sInputString.indexOf (cSearchChar, nIndex);
} while (nIndex != STRING_NOT_FOUND);
ret.append (sInputString, nOldIndex, sInputString.length ());
return ret.toString ();
} | class class_name[name] begin[{]
method[replaceAll, return_type[type[String]], modifier[public static], parameter[sInputString, cSearchChar, cReplacementChar]] begin[{]
if[call[.hasNoText, parameter[member[.sInputString]]]] begin[{]
return[member[.sInputString]]
else begin[{]
None
end[}]
if[binary_operation[member[.cSearchChar], ==, member[.cReplacementChar]]] begin[{]
return[member[.sInputString]]
else begin[{]
None
end[}]
local_variable[type[int], nIndex]
if[binary_operation[member[.nIndex], ==, member[.STRING_NOT_FOUND]]] begin[{]
return[member[.sInputString]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], ret]
local_variable[type[int], nOldIndex]
do[binary_operation[member[.nIndex], !=, member[.STRING_NOT_FOUND]]] begin[{]
call[ret.append, parameter[member[.sInputString], member[.nOldIndex], member[.nIndex]]]
member[.nIndex]
assign[member[.nOldIndex], member[.nIndex]]
assign[member[.nIndex], call[sInputString.indexOf, parameter[member[.cSearchChar], member[.nIndex]]]]
end[}]
call[ret.append, parameter[member[.sInputString], member[.nOldIndex], call[sInputString.length, parameter[]]]]
return[call[ret.toString, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] Keyword[static] identifier[String] identifier[replaceAll] operator[SEP] annotation[@] identifier[Nullable] Keyword[final] identifier[String] identifier[sInputString] , Keyword[final] Keyword[char] identifier[cSearchChar] , Keyword[final] Keyword[char] identifier[cReplacementChar] operator[SEP] {
Keyword[if] operator[SEP] identifier[hasNoText] operator[SEP] identifier[sInputString] operator[SEP] operator[SEP] Keyword[return] identifier[sInputString] operator[SEP] Keyword[if] operator[SEP] identifier[cSearchChar] operator[==] identifier[cReplacementChar] operator[SEP] Keyword[return] identifier[sInputString] operator[SEP] Keyword[int] identifier[nIndex] operator[=] identifier[sInputString] operator[SEP] identifier[indexOf] operator[SEP] identifier[cSearchChar] , Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nIndex] operator[==] identifier[STRING_NOT_FOUND] operator[SEP] Keyword[return] identifier[sInputString] operator[SEP] Keyword[final] identifier[StringBuilder] identifier[ret] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[sInputString] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[nOldIndex] operator[=] Other[0] operator[SEP] Keyword[do] {
identifier[ret] operator[SEP] identifier[append] operator[SEP] identifier[sInputString] , identifier[nOldIndex] , identifier[nIndex] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[cReplacementChar] operator[SEP] operator[SEP] identifier[nIndex] operator[++] operator[SEP] identifier[nOldIndex] operator[=] identifier[nIndex] operator[SEP] identifier[nIndex] operator[=] identifier[sInputString] operator[SEP] identifier[indexOf] operator[SEP] identifier[cSearchChar] , identifier[nIndex] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[nIndex] operator[!=] identifier[STRING_NOT_FOUND] operator[SEP] operator[SEP] identifier[ret] operator[SEP] identifier[append] operator[SEP] identifier[sInputString] , identifier[nOldIndex] , identifier[sInputString] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ret] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private void initWindowed(Resolution output)
{
final Canvas canvas = new Canvas(conf);
canvas.setBackground(Color.BLACK);
canvas.setEnabled(true);
canvas.setVisible(true);
canvas.setIgnoreRepaint(true);
frame.add(canvas);
canvas.setPreferredSize(new Dimension(output.getWidth(), output.getHeight()));
frame.pack();
frame.setLocationRelativeTo(null);
ToolsAwt.createBufferStrategy(canvas, conf);
buf = canvas.getBufferStrategy();
// Set input listeners
componentForKeyboard = canvas;
componentForMouse = canvas;
componentForCursor = frame;
frame.validate();
} | class class_name[name] begin[{]
method[initWindowed, return_type[void], modifier[private], parameter[output]] begin[{]
local_variable[type[Canvas], canvas]
call[canvas.setBackground, parameter[member[Color.BLACK]]]
call[canvas.setEnabled, parameter[literal[true]]]
call[canvas.setVisible, parameter[literal[true]]]
call[canvas.setIgnoreRepaint, parameter[literal[true]]]
call[frame.add, parameter[member[.canvas]]]
call[canvas.setPreferredSize, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getWidth, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getHeight, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))]]
call[frame.pack, parameter[]]
call[frame.setLocationRelativeTo, parameter[literal[null]]]
call[ToolsAwt.createBufferStrategy, parameter[member[.canvas], member[.conf]]]
assign[member[.buf], call[canvas.getBufferStrategy, parameter[]]]
assign[member[.componentForKeyboard], member[.canvas]]
assign[member[.componentForMouse], member[.canvas]]
assign[member[.componentForCursor], member[.frame]]
call[frame.validate, parameter[]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[initWindowed] operator[SEP] identifier[Resolution] identifier[output] operator[SEP] {
Keyword[final] identifier[Canvas] identifier[canvas] operator[=] Keyword[new] identifier[Canvas] operator[SEP] identifier[conf] operator[SEP] operator[SEP] identifier[canvas] operator[SEP] identifier[setBackground] operator[SEP] identifier[Color] operator[SEP] identifier[BLACK] operator[SEP] operator[SEP] identifier[canvas] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[canvas] operator[SEP] identifier[setVisible] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[canvas] operator[SEP] identifier[setIgnoreRepaint] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[add] operator[SEP] identifier[canvas] operator[SEP] operator[SEP] identifier[canvas] operator[SEP] identifier[setPreferredSize] operator[SEP] Keyword[new] identifier[Dimension] operator[SEP] identifier[output] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] , identifier[output] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[pack] operator[SEP] operator[SEP] operator[SEP] identifier[frame] operator[SEP] identifier[setLocationRelativeTo] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[ToolsAwt] operator[SEP] identifier[createBufferStrategy] operator[SEP] identifier[canvas] , identifier[conf] operator[SEP] operator[SEP] identifier[buf] operator[=] identifier[canvas] operator[SEP] identifier[getBufferStrategy] operator[SEP] operator[SEP] operator[SEP] identifier[componentForKeyboard] operator[=] identifier[canvas] operator[SEP] identifier[componentForMouse] operator[=] identifier[canvas] operator[SEP] identifier[componentForCursor] operator[=] identifier[frame] operator[SEP] identifier[frame] operator[SEP] identifier[validate] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected void updateResultsGUI() {
if( selectedImage < results.size() ) {
ImageResults r = results.get(selectedImage);
String textMean = String.format("%5.1e", r.meanError);
String textMax = String.format("%5.1e",r.maxError);
meanError.setText(textMean);
maxError.setText(textMax);
}
} | class class_name[name] begin[{]
method[updateResultsGUI, return_type[void], modifier[protected], parameter[]] begin[{]
if[binary_operation[member[.selectedImage], <, call[results.size, parameter[]]]] begin[{]
local_variable[type[ImageResults], r]
local_variable[type[String], textMean]
local_variable[type[String], textMax]
call[meanError.setText, parameter[member[.textMean]]]
call[maxError.setText, parameter[member[.textMax]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[updateResultsGUI] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[selectedImage] operator[<] identifier[results] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[ImageResults] identifier[r] operator[=] identifier[results] operator[SEP] identifier[get] operator[SEP] identifier[selectedImage] operator[SEP] operator[SEP] identifier[String] identifier[textMean] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[r] operator[SEP] identifier[meanError] operator[SEP] operator[SEP] identifier[String] identifier[textMax] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[r] operator[SEP] identifier[maxError] operator[SEP] operator[SEP] identifier[meanError] operator[SEP] identifier[setText] operator[SEP] identifier[textMean] operator[SEP] operator[SEP] identifier[maxError] operator[SEP] identifier[setText] operator[SEP] identifier[textMax] operator[SEP] operator[SEP]
}
}
|
@Override
public String getValue(Match m, int col)
{
assert col == 0;
return getRelatedIDs((SmallMoleculeReference) m.get("SMR", getPattern()));
} | class class_name[name] begin[{]
method[getValue, return_type[type[String]], modifier[public], parameter[m, col]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), label=None, value=None)
return[call[.getRelatedIDs, parameter[Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SMR"), MethodInvocation(arguments=[], member=getPattern, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=m, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SmallMoleculeReference, sub_type=None))]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[getValue] operator[SEP] identifier[Match] identifier[m] , Keyword[int] identifier[col] operator[SEP] {
Keyword[assert] identifier[col] operator[==] Other[0] operator[SEP] Keyword[return] identifier[getRelatedIDs] operator[SEP] operator[SEP] identifier[SmallMoleculeReference] operator[SEP] identifier[m] operator[SEP] identifier[get] operator[SEP] literal[String] , identifier[getPattern] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Deprecated
public static String getTypeName(Class<? extends Tag<?>> clazz) {
return TagType.getByTagClass(clazz).getTypeName();
} | class class_name[name] begin[{]
method[getTypeName, return_type[type[String]], modifier[public static], parameter[clazz]] begin[{]
return[call[TagType.getByTagClass, parameter[member[.clazz]]]]
end[}]
END[}] | annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] identifier[String] identifier[getTypeName] operator[SEP] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[Tag] operator[<] operator[?] operator[>] operator[>] identifier[clazz] operator[SEP] {
Keyword[return] identifier[TagType] operator[SEP] identifier[getByTagClass] operator[SEP] identifier[clazz] operator[SEP] operator[SEP] identifier[getTypeName] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T> T map(final JBBPFieldStruct root, final String structPath, final Class<T> mappingClass) {
return map(root, structPath, mappingClass, null);
} | class class_name[name] begin[{]
method[map, return_type[type[T]], modifier[public static], parameter[root, structPath, mappingClass]] begin[{]
return[call[.map, parameter[member[.root], member[.structPath], member[.mappingClass], literal[null]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[map] operator[SEP] Keyword[final] identifier[JBBPFieldStruct] identifier[root] , Keyword[final] identifier[String] identifier[structPath] , Keyword[final] identifier[Class] operator[<] identifier[T] operator[>] identifier[mappingClass] operator[SEP] {
Keyword[return] identifier[map] operator[SEP] identifier[root] , identifier[structPath] , identifier[mappingClass] , Other[null] operator[SEP] operator[SEP]
}
|
public double computeValue(double srcValue)
{
double dateOtherDate = 0;
double dateThisDate = 0;
if (m_fldOtherDate != null)
dateOtherDate = m_fldOtherDate.getValue();
else
dateOtherDate = DateField.todaysDate();
dateThisDate = ((DateTimeField)this.getOwner()).getValue();
double tsDifference = (Math.floor((dateThisDate - dateOtherDate + 0.5)) / DBConstants.KMS_IN_A_DAY); // Rounded number of days
return tsDifference; // Difference between this date and target
} | class class_name[name] begin[{]
method[computeValue, return_type[type[double]], modifier[public], parameter[srcValue]] begin[{]
local_variable[type[double], dateOtherDate]
local_variable[type[double], dateThisDate]
if[binary_operation[member[.m_fldOtherDate], !=, literal[null]]] begin[{]
assign[member[.dateOtherDate], call[m_fldOtherDate.getValue, parameter[]]]
else begin[{]
assign[member[.dateOtherDate], call[DateField.todaysDate, parameter[]]]
end[}]
assign[member[.dateThisDate], Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getOwner, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=DateTimeField, sub_type=None))]
local_variable[type[double], tsDifference]
return[member[.tsDifference]]
end[}]
END[}] | Keyword[public] Keyword[double] identifier[computeValue] operator[SEP] Keyword[double] identifier[srcValue] operator[SEP] {
Keyword[double] identifier[dateOtherDate] operator[=] Other[0] operator[SEP] Keyword[double] identifier[dateThisDate] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[m_fldOtherDate] operator[!=] Other[null] operator[SEP] identifier[dateOtherDate] operator[=] identifier[m_fldOtherDate] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[else] identifier[dateOtherDate] operator[=] identifier[DateField] operator[SEP] identifier[todaysDate] operator[SEP] operator[SEP] operator[SEP] identifier[dateThisDate] operator[=] operator[SEP] operator[SEP] identifier[DateTimeField] operator[SEP] Keyword[this] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[tsDifference] operator[=] operator[SEP] identifier[Math] operator[SEP] identifier[floor] operator[SEP] operator[SEP] identifier[dateThisDate] operator[-] identifier[dateOtherDate] operator[+] literal[Float] operator[SEP] operator[SEP] operator[/] identifier[DBConstants] operator[SEP] identifier[KMS_IN_A_DAY] operator[SEP] operator[SEP] Keyword[return] identifier[tsDifference] operator[SEP]
}
|
public void marshall(AttachmentStateChange attachmentStateChange, ProtocolMarshaller protocolMarshaller) {
if (attachmentStateChange == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(attachmentStateChange.getAttachmentArn(), ATTACHMENTARN_BINDING);
protocolMarshaller.marshall(attachmentStateChange.getStatus(), STATUS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[attachmentStateChange, protocolMarshaller]] begin[{]
if[binary_operation[member[.attachmentStateChange], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getAttachmentArn, postfix_operators=[], prefix_operators=[], qualifier=attachmentStateChange, selectors=[], type_arguments=None), MemberReference(member=ATTACHMENTARN_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getStatus, postfix_operators=[], prefix_operators=[], qualifier=attachmentStateChange, selectors=[], type_arguments=None), MemberReference(member=STATUS_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), 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=SdkClientException, 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[public] Keyword[void] identifier[marshall] operator[SEP] identifier[AttachmentStateChange] identifier[attachmentStateChange] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[attachmentStateChange] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[attachmentStateChange] operator[SEP] identifier[getAttachmentArn] operator[SEP] operator[SEP] , identifier[ATTACHMENTARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[attachmentStateChange] operator[SEP] identifier[getStatus] operator[SEP] operator[SEP] , identifier[STATUS_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
static int[] compactOffsets(int[] offsets, int index, int length)
{
if (index == 0 && offsets.length == length + 1) {
return offsets;
}
int[] newOffsets = new int[length + 1];
for (int i = 1; i <= length; i++) {
newOffsets[i] = offsets[index + i] - offsets[index];
}
return newOffsets;
} | class class_name[name] begin[{]
method[compactOffsets, return_type[type[int]], modifier[static], parameter[offsets, index, length]] begin[{]
if[binary_operation[binary_operation[member[.index], ==, literal[0]], &&, binary_operation[member[offsets.length], ==, binary_operation[member[.length], +, literal[1]]]]] begin[{]
return[member[.offsets]]
else begin[{]
None
end[}]
local_variable[type[int], newOffsets]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newOffsets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=BinaryOperation(operandl=MemberReference(member=offsets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+))]), operandr=MemberReference(member=offsets, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), 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=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.newOffsets]]
end[}]
END[}] | Keyword[static] Keyword[int] operator[SEP] operator[SEP] identifier[compactOffsets] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[offsets] , Keyword[int] identifier[index] , Keyword[int] identifier[length] operator[SEP] {
Keyword[if] operator[SEP] identifier[index] operator[==] Other[0] operator[&&] identifier[offsets] operator[SEP] identifier[length] operator[==] identifier[length] operator[+] Other[1] operator[SEP] {
Keyword[return] identifier[offsets] operator[SEP]
}
Keyword[int] operator[SEP] operator[SEP] identifier[newOffsets] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[length] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<=] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[newOffsets] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[offsets] operator[SEP] identifier[index] operator[+] identifier[i] operator[SEP] operator[-] identifier[offsets] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
Keyword[return] identifier[newOffsets] operator[SEP]
}
|
public void start() {
synchronized (getLock()) {
if (destroyed.get()) {
return;
}
if (bundle.getState() != Bundle.ACTIVE) {
return;
}
if (bundle.getBundleContext() != bundleContext) {
return;
}
try {
doStart();
} catch (Throwable e) {
logger.warn("Error starting extension for bundle " + bundle, e);
}
}
} | class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[]] begin[{]
SYNCHRONIZED[call[.getLock, parameter[]]] BEGIN[{]
if[call[destroyed.get, parameter[]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[call[bundle.getState, parameter[]], !=, member[Bundle.ACTIVE]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[call[bundle.getBundleContext, parameter[]], !=, member[.bundleContext]]] begin[{]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=doStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error starting extension for bundle "), operandr=MemberReference(member=bundle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)
END[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[start] operator[SEP] operator[SEP] {
Keyword[synchronized] operator[SEP] identifier[getLock] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[destroyed] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[bundle] operator[SEP] identifier[getState] operator[SEP] operator[SEP] operator[!=] identifier[Bundle] operator[SEP] identifier[ACTIVE] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[bundle] operator[SEP] identifier[getBundleContext] operator[SEP] operator[SEP] operator[!=] identifier[bundleContext] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[try] {
identifier[doStart] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[bundle] , identifier[e] operator[SEP] operator[SEP]
}
}
}
|
public static IJavaStackFrame getStackFrame(IValue value)
throws CoreException {
IStatusHandler handler = getStackFrameProvider();
if (handler != null) {
IJavaStackFrame stackFrame = (IJavaStackFrame) handler
.handleStatus(fgNeedStackFrame, value);
if (stackFrame != null) {
return stackFrame;
}
}
IDebugTarget target = value.getDebugTarget();
IJavaDebugTarget javaTarget = (IJavaDebugTarget) target
.getAdapter(IJavaDebugTarget.class);
if (javaTarget != null) {
IThread[] threads = javaTarget.getThreads();
for (int i = 0; i < threads.length; i++) {
IThread thread = threads[i];
if (thread.isSuspended()) {
return (IJavaStackFrame) thread.getTopStackFrame();
}
}
}
return null;
} | class class_name[name] begin[{]
method[getStackFrame, return_type[type[IJavaStackFrame]], modifier[public static], parameter[value]] begin[{]
local_variable[type[IStatusHandler], handler]
if[binary_operation[member[.handler], !=, literal[null]]] begin[{]
local_variable[type[IJavaStackFrame], stackFrame]
if[binary_operation[member[.stackFrame], !=, literal[null]]] begin[{]
return[member[.stackFrame]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
local_variable[type[IDebugTarget], target]
local_variable[type[IJavaDebugTarget], javaTarget]
if[binary_operation[member[.javaTarget], !=, literal[null]]] begin[{]
local_variable[type[IThread], threads]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=threads, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=thread)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IThread, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=isSuspended, postfix_operators=[], prefix_operators=[], qualifier=thread, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Cast(expression=MethodInvocation(arguments=[], member=getTopStackFrame, postfix_operators=[], prefix_operators=[], qualifier=thread, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=IJavaStackFrame, sub_type=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=threads, 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)
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[IJavaStackFrame] identifier[getStackFrame] operator[SEP] identifier[IValue] identifier[value] operator[SEP] Keyword[throws] identifier[CoreException] {
identifier[IStatusHandler] identifier[handler] operator[=] identifier[getStackFrameProvider] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[handler] operator[!=] Other[null] operator[SEP] {
identifier[IJavaStackFrame] identifier[stackFrame] operator[=] operator[SEP] identifier[IJavaStackFrame] operator[SEP] identifier[handler] operator[SEP] identifier[handleStatus] operator[SEP] identifier[fgNeedStackFrame] , identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stackFrame] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[stackFrame] operator[SEP]
}
}
identifier[IDebugTarget] identifier[target] operator[=] identifier[value] operator[SEP] identifier[getDebugTarget] operator[SEP] operator[SEP] operator[SEP] identifier[IJavaDebugTarget] identifier[javaTarget] operator[=] operator[SEP] identifier[IJavaDebugTarget] operator[SEP] identifier[target] operator[SEP] identifier[getAdapter] operator[SEP] identifier[IJavaDebugTarget] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[javaTarget] operator[!=] Other[null] operator[SEP] {
identifier[IThread] operator[SEP] operator[SEP] identifier[threads] operator[=] identifier[javaTarget] operator[SEP] identifier[getThreads] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[threads] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[IThread] identifier[thread] operator[=] identifier[threads] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[thread] operator[SEP] identifier[isSuspended] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[IJavaStackFrame] operator[SEP] identifier[thread] operator[SEP] identifier[getTopStackFrame] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Other[null] operator[SEP]
}
|
private ByteBuffer successor(@Nullable ByteBuffer buf) {
if (buf == null) {
return ByteBuffer.allocate(0);
}
ByteBuffer next = ByteBuffer.allocate(buf.remaining() + 1);
next.put(buf.duplicate());
next.put((byte) 0);
next.flip();
return next;
} | class class_name[name] begin[{]
method[successor, return_type[type[ByteBuffer]], modifier[private], parameter[buf]] begin[{]
if[binary_operation[member[.buf], ==, literal[null]]] begin[{]
return[call[ByteBuffer.allocate, parameter[literal[0]]]]
else begin[{]
None
end[}]
local_variable[type[ByteBuffer], next]
call[next.put, parameter[call[buf.duplicate, parameter[]]]]
call[next.put, parameter[Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), type=BasicType(dimensions=[], name=byte))]]
call[next.flip, parameter[]]
return[member[.next]]
end[}]
END[}] | Keyword[private] identifier[ByteBuffer] identifier[successor] operator[SEP] annotation[@] identifier[Nullable] identifier[ByteBuffer] identifier[buf] operator[SEP] {
Keyword[if] operator[SEP] identifier[buf] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[ByteBuffer] operator[SEP] identifier[allocate] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
identifier[ByteBuffer] identifier[next] operator[=] identifier[ByteBuffer] operator[SEP] identifier[allocate] operator[SEP] identifier[buf] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[+] Other[1] operator[SEP] operator[SEP] identifier[next] operator[SEP] identifier[put] operator[SEP] identifier[buf] operator[SEP] identifier[duplicate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] identifier[put] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[next] operator[SEP] identifier[flip] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[next] operator[SEP]
}
|
@Override
public int findTokenStart(final @NonNull Spanned text, final int cursor) {
int start = getSearchStartIndex(text, cursor);
int i = cursor;
// If it is explicit, return the index of the first explicit character
if (isExplicit(text, cursor)) {
i--;
while (i >= start) {
char currentChar = text.charAt(i);
if (isExplicitChar(currentChar)) {
if (i == 0 || isWordBreakingChar(text.charAt(i - 1))) {
return i;
}
}
i--;
}
// Could not find explicit character before the cursor
// Note: This case should never happen (means that isExplicit
// returned true when it should have been false)
return -1;
} else {
// For implicit tokens, we need to go back a certain number of words to find the start
// of the token (with the max number of words to go back defined in the config)
int maxNumKeywords = mConfig.MAX_NUM_KEYWORDS;
// Go back to the start of the word that the cursor is currently in
while (i > start && !isWordBreakingChar(text.charAt(i - 1))) {
i--;
}
// Cursor is at beginning of current word, go back MaxNumKeywords - 1 now
for (int j = 0; j < maxNumKeywords - 1; j++) {
// Decrement through only one word-breaking character, if it exists
if (i > start && isWordBreakingChar(text.charAt(i - 1))) {
i--;
}
// If there is more than one word-breaking space, break out now
// Do not consider queries with words separated by more than one word-breaking char
if (i > start && isWordBreakingChar(text.charAt(i - 1))) {
break;
}
// Decrement until the next space
while (i > start && !isWordBreakingChar(text.charAt(i - 1))) {
i--;
}
}
// Ensures that text.char(i) is not a word-breaking or explicit char (i.e. cursor must have a
// word-breaking char in front of it and a non-word-breaking char behind it)
while (i < cursor && (isWordBreakingChar(text.charAt(i)) || isExplicitChar(text.charAt(i)))) {
i++;
}
return i;
}
} | class class_name[name] begin[{]
method[findTokenStart, return_type[type[int]], modifier[public], parameter[text, cursor]] begin[{]
local_variable[type[int], start]
local_variable[type[int], i]
if[call[.isExplicit, parameter[member[.text], member[.cursor]]]] begin[{]
member[.i]
while[binary_operation[member[.i], >=, member[.start]]] begin[{]
local_variable[type[char], currentChar]
if[call[.isExplicitChar, parameter[member[.currentChar]]]] begin[{]
if[binary_operation[binary_operation[member[.i], ==, literal[0]], ||, call[.isWordBreakingChar, parameter[call[text.charAt, parameter[binary_operation[member[.i], -, literal[1]]]]]]]] begin[{]
return[member[.i]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
member[.i]
end[}]
return[literal[1]]
else begin[{]
local_variable[type[int], maxNumKeywords]
while[binary_operation[binary_operation[member[.i], >, member[.start]], &&, call[.isWordBreakingChar, parameter[call[text.charAt, parameter[binary_operation[member[.i], -, literal[1]]]]]]]] begin[{]
member[.i]
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=text, selectors=[], type_arguments=None)], member=isWordBreakingChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=i, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None)])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=text, selectors=[], type_arguments=None)], member=isWordBreakingChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=i, postfix_operators=['--'], prefix_operators=[], qualifier=, selectors=[]), label=None)]), condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=text, selectors=[], type_arguments=None)], member=isWordBreakingChar, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), operator=&&), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=maxNumKeywords, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
while[binary_operation[binary_operation[member[.i], <, member[.cursor]], &&, binary_operation[call[.isWordBreakingChar, parameter[call[text.charAt, parameter[member[.i]]]]], ||, call[.isExplicitChar, parameter[call[text.charAt, parameter[member[.i]]]]]]]] begin[{]
member[.i]
end[}]
return[member[.i]]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[int] identifier[findTokenStart] operator[SEP] Keyword[final] annotation[@] identifier[NonNull] identifier[Spanned] identifier[text] , Keyword[final] Keyword[int] identifier[cursor] operator[SEP] {
Keyword[int] identifier[start] operator[=] identifier[getSearchStartIndex] operator[SEP] identifier[text] , identifier[cursor] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[cursor] operator[SEP] Keyword[if] operator[SEP] identifier[isExplicit] operator[SEP] identifier[text] , identifier[cursor] operator[SEP] operator[SEP] {
identifier[i] operator[--] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[>=] identifier[start] operator[SEP] {
Keyword[char] identifier[currentChar] operator[=] identifier[text] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isExplicitChar] operator[SEP] identifier[currentChar] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[==] Other[0] operator[||] identifier[isWordBreakingChar] operator[SEP] identifier[text] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[i] operator[SEP]
}
}
identifier[i] operator[--] operator[SEP]
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
Keyword[else] {
Keyword[int] identifier[maxNumKeywords] operator[=] identifier[mConfig] operator[SEP] identifier[MAX_NUM_KEYWORDS] operator[SEP] Keyword[while] operator[SEP] identifier[i] operator[>] identifier[start] operator[&&] operator[!] identifier[isWordBreakingChar] operator[SEP] identifier[text] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
identifier[i] operator[--] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] identifier[j] operator[<] identifier[maxNumKeywords] operator[-] Other[1] operator[SEP] identifier[j] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[>] identifier[start] operator[&&] identifier[isWordBreakingChar] operator[SEP] identifier[text] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
identifier[i] operator[--] operator[SEP]
}
Keyword[if] operator[SEP] identifier[i] operator[>] identifier[start] operator[&&] identifier[isWordBreakingChar] operator[SEP] identifier[text] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
Keyword[while] operator[SEP] identifier[i] operator[>] identifier[start] operator[&&] operator[!] identifier[isWordBreakingChar] operator[SEP] identifier[text] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[-] Other[1] operator[SEP] operator[SEP] operator[SEP] {
identifier[i] operator[--] operator[SEP]
}
}
Keyword[while] operator[SEP] identifier[i] operator[<] identifier[cursor] operator[&&] operator[SEP] identifier[isWordBreakingChar] operator[SEP] identifier[text] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[||] identifier[isExplicitChar] operator[SEP] identifier[text] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[i] operator[++] operator[SEP]
}
Keyword[return] identifier[i] operator[SEP]
}
}
|
@Generated(value={"com.threerings.presents.tools.GenDObjectTask"})
public void setOccupantInfo (DSet<OccupantInfo> value)
{
requestAttributeChange(OCCUPANT_INFO, value, this.occupantInfo);
DSet<OccupantInfo> clone = (value == null) ? null : value.clone();
this.occupantInfo = clone;
} | class class_name[name] begin[{]
method[setOccupantInfo, return_type[void], modifier[public], parameter[value]] begin[{]
call[.requestAttributeChange, parameter[member[.OCCUPANT_INFO], member[.value], THIS[member[None.occupantInfo]]]]
local_variable[type[DSet], clone]
assign[THIS[member[None.occupantInfo]], member[.clone]]
end[}]
END[}] | annotation[@] identifier[Generated] operator[SEP] identifier[value] operator[=] {
literal[String]
} operator[SEP] Keyword[public] Keyword[void] identifier[setOccupantInfo] operator[SEP] identifier[DSet] operator[<] identifier[OccupantInfo] operator[>] identifier[value] operator[SEP] {
identifier[requestAttributeChange] operator[SEP] identifier[OCCUPANT_INFO] , identifier[value] , Keyword[this] operator[SEP] identifier[occupantInfo] operator[SEP] operator[SEP] identifier[DSet] operator[<] identifier[OccupantInfo] operator[>] identifier[clone] operator[=] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] operator[?] Other[null] operator[:] identifier[value] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[occupantInfo] operator[=] identifier[clone] operator[SEP]
}
|
public AbstractPrintQuery addMsgPhrase(final String... _msgPhrase)
throws EFapsException
{
final List<MsgPhrase> msgphrases = new ArrayList<>();
for (final String phraseStr : _msgPhrase) {
msgphrases.add(MsgPhrase.get(phraseStr));
}
return addMsgPhrase(msgphrases.toArray(new MsgPhrase[msgphrases.size()]));
} | class class_name[name] begin[{]
method[addMsgPhrase, return_type[type[AbstractPrintQuery]], modifier[public], parameter[_msgPhrase]] begin[{]
local_variable[type[List], msgphrases]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=phraseStr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=MsgPhrase, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=msgphrases, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=_msgPhrase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=phraseStr)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[call[.addMsgPhrase, parameter[call[msgphrases.toArray, parameter[ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=msgphrases, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MsgPhrase, sub_type=None))]]]]]
end[}]
END[}] | Keyword[public] identifier[AbstractPrintQuery] identifier[addMsgPhrase] operator[SEP] Keyword[final] identifier[String] operator[...] identifier[_msgPhrase] operator[SEP] Keyword[throws] identifier[EFapsException] {
Keyword[final] identifier[List] operator[<] identifier[MsgPhrase] operator[>] identifier[msgphrases] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[phraseStr] operator[:] identifier[_msgPhrase] operator[SEP] {
identifier[msgphrases] operator[SEP] identifier[add] operator[SEP] identifier[MsgPhrase] operator[SEP] identifier[get] operator[SEP] identifier[phraseStr] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[addMsgPhrase] operator[SEP] identifier[msgphrases] operator[SEP] identifier[toArray] operator[SEP] Keyword[new] identifier[MsgPhrase] operator[SEP] identifier[msgphrases] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public ListObjectsResponse listNextBatchOfObjects(ListObjectsResponse previousResponse) {
checkNotNull(previousResponse, "previousResponse should not be null.");
if (!previousResponse.isTruncated()) {
ListObjectsResponse emptyResponse = new ListObjectsResponse();
emptyResponse.setBucketName(previousResponse.getBucketName());
emptyResponse.setDelimiter(previousResponse.getDelimiter());
emptyResponse.setMarker(previousResponse.getNextMarker());
emptyResponse.setMaxKeys(previousResponse.getMaxKeys());
emptyResponse.setPrefix(previousResponse.getPrefix());
emptyResponse.setTruncated(false);
return emptyResponse;
}
return this.listObjects(new ListObjectsRequest(previousResponse.getBucketName())
.withPrefix(previousResponse.getPrefix())
.withMarker(previousResponse.getNextMarker())
.withDelimiter(previousResponse.getDelimiter())
.withMaxKeys(previousResponse.getMaxKeys()));
} | class class_name[name] begin[{]
method[listNextBatchOfObjects, return_type[type[ListObjectsResponse]], modifier[public], parameter[previousResponse]] begin[{]
call[.checkNotNull, parameter[member[.previousResponse], literal["previousResponse should not be null."]]]
if[call[previousResponse.isTruncated, parameter[]]] begin[{]
local_variable[type[ListObjectsResponse], emptyResponse]
call[emptyResponse.setBucketName, parameter[call[previousResponse.getBucketName, parameter[]]]]
call[emptyResponse.setDelimiter, parameter[call[previousResponse.getDelimiter, parameter[]]]]
call[emptyResponse.setMarker, parameter[call[previousResponse.getNextMarker, parameter[]]]]
call[emptyResponse.setMaxKeys, parameter[call[previousResponse.getMaxKeys, parameter[]]]]
call[emptyResponse.setPrefix, parameter[call[previousResponse.getPrefix, parameter[]]]]
call[emptyResponse.setTruncated, parameter[literal[false]]]
return[member[.emptyResponse]]
else begin[{]
None
end[}]
return[THIS[call[None.listObjects, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getBucketName, postfix_operators=[], prefix_operators=[], qualifier=previousResponse, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPrefix, postfix_operators=[], prefix_operators=[], qualifier=previousResponse, selectors=[], type_arguments=None)], member=withPrefix, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getNextMarker, postfix_operators=[], prefix_operators=[], qualifier=previousResponse, selectors=[], type_arguments=None)], member=withMarker, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getDelimiter, postfix_operators=[], prefix_operators=[], qualifier=previousResponse, selectors=[], type_arguments=None)], member=withDelimiter, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMaxKeys, postfix_operators=[], prefix_operators=[], qualifier=previousResponse, selectors=[], type_arguments=None)], member=withMaxKeys, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ListObjectsRequest, sub_type=None))]]]]
end[}]
END[}] | Keyword[public] identifier[ListObjectsResponse] identifier[listNextBatchOfObjects] operator[SEP] identifier[ListObjectsResponse] identifier[previousResponse] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[previousResponse] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[previousResponse] operator[SEP] identifier[isTruncated] operator[SEP] operator[SEP] operator[SEP] {
identifier[ListObjectsResponse] identifier[emptyResponse] operator[=] Keyword[new] identifier[ListObjectsResponse] operator[SEP] operator[SEP] operator[SEP] identifier[emptyResponse] operator[SEP] identifier[setBucketName] operator[SEP] identifier[previousResponse] operator[SEP] identifier[getBucketName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[emptyResponse] operator[SEP] identifier[setDelimiter] operator[SEP] identifier[previousResponse] operator[SEP] identifier[getDelimiter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[emptyResponse] operator[SEP] identifier[setMarker] operator[SEP] identifier[previousResponse] operator[SEP] identifier[getNextMarker] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[emptyResponse] operator[SEP] identifier[setMaxKeys] operator[SEP] identifier[previousResponse] operator[SEP] identifier[getMaxKeys] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[emptyResponse] operator[SEP] identifier[setPrefix] operator[SEP] identifier[previousResponse] operator[SEP] identifier[getPrefix] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[emptyResponse] operator[SEP] identifier[setTruncated] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[emptyResponse] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[listObjects] operator[SEP] Keyword[new] identifier[ListObjectsRequest] operator[SEP] identifier[previousResponse] operator[SEP] identifier[getBucketName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withPrefix] operator[SEP] identifier[previousResponse] operator[SEP] identifier[getPrefix] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withMarker] operator[SEP] identifier[previousResponse] operator[SEP] identifier[getNextMarker] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withDelimiter] operator[SEP] identifier[previousResponse] operator[SEP] identifier[getDelimiter] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[withMaxKeys] operator[SEP] identifier[previousResponse] operator[SEP] identifier[getMaxKeys] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void deleteLocal(String key) {
if (localCache != null) {
try {
localCache.delete(key);
} catch (Exception e) {
throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
}
}
} | class class_name[name] begin[{]
method[deleteLocal, return_type[void], modifier[public], parameter[key]] begin[{]
if[binary_operation[member[.localCache], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=delete, postfix_operators=[], prefix_operators=[], qualifier=localCache, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=CacheException, sub_type=None), operator=instanceof), if_false=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=CacheException, sub_type=None)), if_true=Cast(expression=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=CacheException, sub_type=None))), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[deleteLocal] operator[SEP] identifier[String] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] identifier[localCache] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[localCache] operator[SEP] identifier[delete] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] identifier[e] Keyword[instanceof] identifier[CacheException] operator[?] operator[SEP] identifier[CacheException] operator[SEP] identifier[e] operator[:] Keyword[new] identifier[CacheException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
}
|
protected final int[]ctypeCodeRange(int ctype) {
if (ctype >= UnicodeProperties.CodeRangeTable.length) throw new InternalError(ErrorMessages.ERR_TYPE_BUG);
return UnicodeProperties.CodeRangeTable[ctype].getRange();
} | class class_name[name] begin[{]
method[ctypeCodeRange, return_type[type[int]], modifier[final protected], parameter[ctype]] begin[{]
if[binary_operation[member[.ctype], >=, member[UnicodeProperties.CodeRangeTable.length]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=ERR_TYPE_BUG, postfix_operators=[], prefix_operators=[], qualifier=ErrorMessages, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InternalError, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[UnicodeProperties.CodeRangeTable]]
end[}]
END[}] | Keyword[protected] Keyword[final] Keyword[int] operator[SEP] operator[SEP] identifier[ctypeCodeRange] operator[SEP] Keyword[int] identifier[ctype] operator[SEP] {
Keyword[if] operator[SEP] identifier[ctype] operator[>=] identifier[UnicodeProperties] operator[SEP] identifier[CodeRangeTable] operator[SEP] identifier[length] operator[SEP] Keyword[throw] Keyword[new] identifier[InternalError] operator[SEP] identifier[ErrorMessages] operator[SEP] identifier[ERR_TYPE_BUG] operator[SEP] operator[SEP] Keyword[return] identifier[UnicodeProperties] operator[SEP] identifier[CodeRangeTable] operator[SEP] identifier[ctype] operator[SEP] operator[SEP] identifier[getRange] operator[SEP] operator[SEP] operator[SEP]
}
|
protected Response head(MultivaluedMap<String, String> queryParams, URL url) {
return (invocation(url, queryParams).head());
} | class class_name[name] begin[{]
method[head, return_type[type[Response]], modifier[protected], parameter[queryParams, url]] begin[{]
return[call[.invocation, parameter[member[.url], member[.queryParams]]]]
end[}]
END[}] | Keyword[protected] identifier[Response] identifier[head] operator[SEP] identifier[MultivaluedMap] operator[<] identifier[String] , identifier[String] operator[>] identifier[queryParams] , identifier[URL] identifier[url] operator[SEP] {
Keyword[return] operator[SEP] identifier[invocation] operator[SEP] identifier[url] , identifier[queryParams] operator[SEP] operator[SEP] identifier[head] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void closeInfoStore() throws UnableToAdaptException {
try {
getInfoStore().close();
} catch (InfoStoreException e) {
String msg = Tr.formatMessage(tc, "failed.to.close.web.module.info.store.CWWKM0476E",
"Failed to close web module info store", e);
throw new UnableToAdaptException(msg);
}
} | class class_name[name] begin[{]
method[closeInfoStore, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getInfoStore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=close, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="failed.to.close.web.module.info.store.CWWKM0476E"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to close web module info store"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=formatMessage, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), name=msg)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, 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=UnableToAdaptException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InfoStoreException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[closeInfoStore] operator[SEP] operator[SEP] Keyword[throws] identifier[UnableToAdaptException] {
Keyword[try] {
identifier[getInfoStore] operator[SEP] operator[SEP] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InfoStoreException] identifier[e] operator[SEP] {
identifier[String] identifier[msg] operator[=] identifier[Tr] operator[SEP] identifier[formatMessage] operator[SEP] identifier[tc] , literal[String] , literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[UnableToAdaptException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
}
|
public String convertTableNameToEntityName(final String tableName) {
StringBuilder className = new StringBuilder(tableName.length());
int len = tableName.length();
int i = 0;
if (prefix != null) {
if (tableName.startsWith(prefix)) {
i = prefix.length();
}
}
if (suffix != null) {
if (tableName.endsWith(suffix)) {
len -= suffix.length();
}
}
if (splitCamelCase) {
boolean toUpper = true;
for (; i < len; i++) {
char c = tableName.charAt(i);
if (c == separatorChar) {
toUpper = true;
continue;
}
if (toUpper) {
className.append(Character.toUpperCase(c));
toUpper = false;
} else {
className.append(Character.toLowerCase(c));
}
}
return className.toString();
}
return tableName.substring(i, len);
} | class class_name[name] begin[{]
method[convertTableNameToEntityName, return_type[type[String]], modifier[public], parameter[tableName]] begin[{]
local_variable[type[StringBuilder], className]
local_variable[type[int], len]
local_variable[type[int], i]
if[binary_operation[member[.prefix], !=, literal[null]]] begin[{]
if[call[tableName.startsWith, parameter[member[.prefix]]]] begin[{]
assign[member[.i], call[prefix.length, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.suffix], !=, literal[null]]] begin[{]
if[call[tableName.endsWith, parameter[member[.suffix]]]] begin[{]
assign[member[.len], call[suffix.length, parameter[]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[member[.splitCamelCase]] begin[{]
local_variable[type[boolean], toUpper]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=tableName, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=separatorChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=toUpper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), ContinueStatement(goto=None, label=None)])), IfStatement(condition=MemberReference(member=toUpper, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toLowerCase, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=className, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toUpperCase, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=className, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=toUpper, 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=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=None, update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[call[className.toString, parameter[]]]
else begin[{]
None
end[}]
return[call[tableName.substring, parameter[member[.i], member[.len]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[convertTableNameToEntityName] operator[SEP] Keyword[final] identifier[String] identifier[tableName] operator[SEP] {
identifier[StringBuilder] identifier[className] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[tableName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[=] identifier[tableName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[prefix] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[tableName] operator[SEP] identifier[startsWith] operator[SEP] identifier[prefix] operator[SEP] operator[SEP] {
identifier[i] operator[=] identifier[prefix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[suffix] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[tableName] operator[SEP] identifier[endsWith] operator[SEP] identifier[suffix] operator[SEP] operator[SEP] {
identifier[len] operator[-=] identifier[suffix] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[splitCamelCase] operator[SEP] {
Keyword[boolean] identifier[toUpper] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[tableName] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] identifier[separatorChar] operator[SEP] {
identifier[toUpper] operator[=] literal[boolean] operator[SEP] Keyword[continue] operator[SEP]
}
Keyword[if] operator[SEP] identifier[toUpper] operator[SEP] {
identifier[className] operator[SEP] identifier[append] operator[SEP] identifier[Character] operator[SEP] identifier[toUpperCase] operator[SEP] identifier[c] operator[SEP] operator[SEP] operator[SEP] identifier[toUpper] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[className] operator[SEP] identifier[append] operator[SEP] identifier[Character] operator[SEP] identifier[toLowerCase] operator[SEP] identifier[c] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[className] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[tableName] operator[SEP] identifier[substring] operator[SEP] identifier[i] , identifier[len] operator[SEP] operator[SEP]
}
|
public static boolean isFileImportable(File file, String prefix) throws SQLException, FileNotFoundException{
if (isExtensionWellFormated(file, prefix)) {
if (file.exists()) {
return true;
} else {
throw new FileNotFoundException("The following file does not exists:\n" + file.getPath());
}
} else {
throw new SQLException("Please use " + prefix + " extension.");
}
} | class class_name[name] begin[{]
method[isFileImportable, return_type[type[boolean]], modifier[public static], parameter[file, prefix]] begin[{]
if[call[.isExtensionWellFormated, parameter[member[.file], member[.prefix]]]] begin[{]
if[call[file.exists, parameter[]]] begin[{]
return[literal[true]]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The following file does not exists:\n"), operandr=MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=file, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileNotFoundException, sub_type=None)), label=None)
end[}]
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Please use "), operandr=MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" extension."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SQLException, sub_type=None)), label=None)
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[isFileImportable] operator[SEP] identifier[File] identifier[file] , identifier[String] identifier[prefix] operator[SEP] Keyword[throws] identifier[SQLException] , identifier[FileNotFoundException] {
Keyword[if] operator[SEP] identifier[isExtensionWellFormated] operator[SEP] identifier[file] , identifier[prefix] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[FileNotFoundException] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[SQLException] operator[SEP] literal[String] operator[+] identifier[prefix] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
|
public void write(Map<?, ?> row) throws IOException {
if (row != null) {
if (header.isEmpty()) {
List<?> entries = row.values().stream().map(o -> Convert.convert(o, String.class)).collect(
Collectors.toList());
writer.write(formatter.format(entries));
writer.write(SystemInfo.LINE_SEPARATOR);
} else {
writer.write(
formatter.format(
Stream.concat(
header.stream()
.map(
h -> row.containsKey(h) ? Convert.convert(row.get(h), String.class) : StringUtils.EMPTY),
row.keySet().stream()
.map(k -> Convert.convert(k, String.class))
.filter(h -> !header.contains(h))
.map(h -> Convert.convert(row.get(h), String.class))
)
.collect(Collectors.toList())
)
);
writer.write(SystemInfo.LINE_SEPARATOR);
}
}
} | class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[row]] begin[{]
if[binary_operation[member[.row], !=, literal[null]]] begin[{]
if[call[header.isEmpty, parameter[]]] begin[{]
local_variable[type[List], entries]
call[writer.write, parameter[call[formatter.format, parameter[member[.entries]]]]]
call[writer.write, parameter[member[SystemInfo.LINE_SEPARATOR]]]
else begin[{]
call[writer.write, parameter[call[formatter.format, parameter[call[Stream.concat, parameter[call[header.stream, parameter[]], call[row.keySet, parameter[]]]]]]]]
call[writer.write, parameter[member[SystemInfo.LINE_SEPARATOR]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[write] operator[SEP] identifier[Map] operator[<] operator[?] , operator[?] operator[>] identifier[row] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[row] operator[!=] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[header] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[List] operator[<] operator[?] operator[>] identifier[entries] operator[=] identifier[row] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[o] operator[->] identifier[Convert] operator[SEP] identifier[convert] operator[SEP] identifier[o] , identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[formatter] operator[SEP] identifier[format] operator[SEP] identifier[entries] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[SystemInfo] operator[SEP] identifier[LINE_SEPARATOR] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[formatter] operator[SEP] identifier[format] operator[SEP] identifier[Stream] operator[SEP] identifier[concat] operator[SEP] identifier[header] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[h] operator[->] identifier[row] operator[SEP] identifier[containsKey] operator[SEP] identifier[h] operator[SEP] operator[?] identifier[Convert] operator[SEP] identifier[convert] operator[SEP] identifier[row] operator[SEP] identifier[get] operator[SEP] identifier[h] operator[SEP] , identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[:] identifier[StringUtils] operator[SEP] identifier[EMPTY] operator[SEP] , identifier[row] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[k] operator[->] identifier[Convert] operator[SEP] identifier[convert] operator[SEP] identifier[k] , identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[h] operator[->] operator[!] identifier[header] operator[SEP] identifier[contains] operator[SEP] identifier[h] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[h] operator[->] identifier[Convert] operator[SEP] identifier[convert] operator[SEP] identifier[row] operator[SEP] identifier[get] operator[SEP] identifier[h] operator[SEP] , identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[writer] operator[SEP] identifier[write] operator[SEP] identifier[SystemInfo] operator[SEP] identifier[LINE_SEPARATOR] operator[SEP] operator[SEP]
}
}
}
|
void initButtons() {
m_okButton = new Button(CmsVaadinUtils.getMessageText(org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_OK_0));
m_okButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
onClickOk();
}
});
addButton(m_okButton);
m_cancelButton = new Button(
CmsVaadinUtils.getMessageText(org.opencms.workplace.Messages.GUI_DIALOG_BUTTON_CANCEL_0));
m_cancelButton.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
@SuppressWarnings("synthetic-access")
public void buttonClick(ClickEvent event) {
m_context.finish(new ArrayList<CmsUUID>());
}
});
addButton(m_cancelButton);
} | class class_name[name] begin[{]
method[initButtons, return_type[void], modifier[default], parameter[]] begin[{]
assign[member[.m_okButton], ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=GUI_DIALOG_BUTTON_OK_0, postfix_operators=[], prefix_operators=[], qualifier=org.opencms.workplace.Messages, selectors=[])], member=getMessageText, postfix_operators=[], prefix_operators=[], qualifier=CmsVaadinUtils, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Button, sub_type=None))]
call[m_okButton.addClickListener, parameter[ClassCreator(arguments=[], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1L), name=serialVersionUID)], documentation=None, modifiers={'final', 'private', 'static'}, type=BasicType(dimensions=[], name=long)), MethodDeclaration(annotations=[], body=[StatementExpression(expression=MethodInvocation(arguments=[], member=onClickOk, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=buttonClick, parameters=[FormalParameter(annotations=[], modifiers=set(), name=event, type=ReferenceType(arguments=None, dimensions=[], name=ClickEvent, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClickListener, sub_type=None))]]
call[.addButton, parameter[member[.m_okButton]]]
assign[member[.m_cancelButton], ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=GUI_DIALOG_BUTTON_CANCEL_0, postfix_operators=[], prefix_operators=[], qualifier=org.opencms.workplace.Messages, selectors=[])], member=getMessageText, postfix_operators=[], prefix_operators=[], qualifier=CmsVaadinUtils, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Button, sub_type=None))]
call[m_cancelButton.addClickListener, parameter[ClassCreator(arguments=[], body=[FieldDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1L), name=serialVersionUID)], documentation=None, modifiers={'final', 'private', 'static'}, type=BasicType(dimensions=[], name=long)), MethodDeclaration(annotations=[Annotation(element=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="synthetic-access"), name=SuppressWarnings)], body=[StatementExpression(expression=MethodInvocation(arguments=[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=CmsUUID, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))], member=finish, postfix_operators=[], prefix_operators=[], qualifier=m_context, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=buttonClick, parameters=[FormalParameter(annotations=[], modifiers=set(), name=event, type=ReferenceType(arguments=None, dimensions=[], name=ClickEvent, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ClickListener, sub_type=None))]]
call[.addButton, parameter[member[.m_cancelButton]]]
end[}]
END[}] | Keyword[void] identifier[initButtons] operator[SEP] operator[SEP] {
identifier[m_okButton] operator[=] Keyword[new] identifier[Button] operator[SEP] identifier[CmsVaadinUtils] operator[SEP] identifier[getMessageText] operator[SEP] identifier[org] operator[SEP] identifier[opencms] operator[SEP] identifier[workplace] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_DIALOG_BUTTON_OK_0] operator[SEP] operator[SEP] operator[SEP] identifier[m_okButton] operator[SEP] identifier[addClickListener] operator[SEP] Keyword[new] identifier[ClickListener] operator[SEP] operator[SEP] {
Keyword[private] Keyword[static] Keyword[final] Keyword[long] identifier[serialVersionUID] operator[=] Other[1L] operator[SEP] Keyword[public] Keyword[void] identifier[buttonClick] operator[SEP] identifier[ClickEvent] identifier[event] operator[SEP] {
identifier[onClickOk] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[addButton] operator[SEP] identifier[m_okButton] operator[SEP] operator[SEP] identifier[m_cancelButton] operator[=] Keyword[new] identifier[Button] operator[SEP] identifier[CmsVaadinUtils] operator[SEP] identifier[getMessageText] operator[SEP] identifier[org] operator[SEP] identifier[opencms] operator[SEP] identifier[workplace] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_DIALOG_BUTTON_CANCEL_0] operator[SEP] operator[SEP] operator[SEP] identifier[m_cancelButton] operator[SEP] identifier[addClickListener] operator[SEP] Keyword[new] identifier[ClickListener] operator[SEP] operator[SEP] {
Keyword[private] Keyword[static] Keyword[final] Keyword[long] identifier[serialVersionUID] operator[=] Other[1L] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[void] identifier[buttonClick] operator[SEP] identifier[ClickEvent] identifier[event] operator[SEP] {
identifier[m_context] operator[SEP] identifier[finish] operator[SEP] Keyword[new] identifier[ArrayList] operator[<] identifier[CmsUUID] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[addButton] operator[SEP] identifier[m_cancelButton] operator[SEP] operator[SEP]
}
|
private CompletableFuture<Revision> removePermissionAtPointer(Author author, String projectName,
JsonPointer path, String commitSummary) {
final Change<JsonNode> change = Change.ofJsonPatch(METADATA_JSON,
new RemoveOperation(path).toJsonNode());
return metadataRepo.push(projectName, Project.REPO_DOGMA, author, commitSummary, change);
} | class class_name[name] begin[{]
method[removePermissionAtPointer, return_type[type[CompletableFuture]], modifier[private], parameter[author, projectName, path, commitSummary]] begin[{]
local_variable[type[Change], change]
return[call[metadataRepo.push, parameter[member[.projectName], member[Project.REPO_DOGMA], member[.author], member[.commitSummary], member[.change]]]]
end[}]
END[}] | Keyword[private] identifier[CompletableFuture] operator[<] identifier[Revision] operator[>] identifier[removePermissionAtPointer] operator[SEP] identifier[Author] identifier[author] , identifier[String] identifier[projectName] , identifier[JsonPointer] identifier[path] , identifier[String] identifier[commitSummary] operator[SEP] {
Keyword[final] identifier[Change] operator[<] identifier[JsonNode] operator[>] identifier[change] operator[=] identifier[Change] operator[SEP] identifier[ofJsonPatch] operator[SEP] identifier[METADATA_JSON] , Keyword[new] identifier[RemoveOperation] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[toJsonNode] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[metadataRepo] operator[SEP] identifier[push] operator[SEP] identifier[projectName] , identifier[Project] operator[SEP] identifier[REPO_DOGMA] , identifier[author] , identifier[commitSummary] , identifier[change] operator[SEP] operator[SEP]
}
|
@Override
public com.liferay.commerce.model.CommerceRegion createCommerceRegion(
long commerceRegionId) {
return _commerceRegionLocalService.createCommerceRegion(commerceRegionId);
} | class class_name[name] begin[{]
method[createCommerceRegion, return_type[type[com]], modifier[public], parameter[commerceRegionId]] begin[{]
return[call[_commerceRegionLocalService.createCommerceRegion, parameter[member[.commerceRegionId]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[model] operator[SEP] identifier[CommerceRegion] identifier[createCommerceRegion] operator[SEP] Keyword[long] identifier[commerceRegionId] operator[SEP] {
Keyword[return] identifier[_commerceRegionLocalService] operator[SEP] identifier[createCommerceRegion] operator[SEP] identifier[commerceRegionId] operator[SEP] operator[SEP]
}
|
public static Set<Event> resolveEventViaMultivaluedAttribute(final Principal principal,
final Object attributeValue,
final RegisteredService service,
final Optional<RequestContext> context,
final MultifactorAuthenticationProvider provider,
final Predicate<String> predicate) {
val events = new HashSet<Event>();
if (attributeValue instanceof Collection) {
val values = (Collection<String>) attributeValue;
values.forEach(value -> {
try {
if (predicate.test(value)) {
val id = provider.getId();
val event = validateEventIdForMatchingTransitionInContext(id, context, buildEventAttributeMap(principal, Optional.of(service), provider));
events.add(event);
}
} catch (final Exception e) {
LOGGER.debug("Ignoring [{}] since no matching transition could be found", value);
}
});
return events;
}
return null;
} | class class_name[name] begin[{]
method[resolveEventViaMultivaluedAttribute, return_type[type[Set]], modifier[public static], parameter[principal, attributeValue, service, context, provider, predicate]] begin[{]
local_variable[type[val], events]
if[binary_operation[member[.attributeValue], instanceof, type[Collection]]] begin[{]
local_variable[type[val], values]
call[values.forEach, parameter[LambdaExpression(body=[TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=test, postfix_operators=[], prefix_operators=[], qualifier=predicate, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=provider, selectors=[], type_arguments=None), name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=val, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=principal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=service, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=of, postfix_operators=[], prefix_operators=[], qualifier=Optional, selectors=[], type_arguments=None), MemberReference(member=provider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=buildEventAttributeMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=validateEventIdForMatchingTransitionInContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=event)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=val, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=events, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Ignoring [{}] since no matching transition could be found"), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)], parameters=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]
return[member[.events]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[Event] operator[>] identifier[resolveEventViaMultivaluedAttribute] operator[SEP] Keyword[final] identifier[Principal] identifier[principal] , Keyword[final] identifier[Object] identifier[attributeValue] , Keyword[final] identifier[RegisteredService] identifier[service] , Keyword[final] identifier[Optional] operator[<] identifier[RequestContext] operator[>] identifier[context] , Keyword[final] identifier[MultifactorAuthenticationProvider] identifier[provider] , Keyword[final] identifier[Predicate] operator[<] identifier[String] operator[>] identifier[predicate] operator[SEP] {
identifier[val] identifier[events] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[Event] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attributeValue] Keyword[instanceof] identifier[Collection] operator[SEP] {
identifier[val] identifier[values] operator[=] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] operator[SEP] identifier[attributeValue] operator[SEP] identifier[values] operator[SEP] identifier[forEach] operator[SEP] identifier[value] operator[->] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[predicate] operator[SEP] identifier[test] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
identifier[val] identifier[id] operator[=] identifier[provider] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] identifier[val] identifier[event] operator[=] identifier[validateEventIdForMatchingTransitionInContext] operator[SEP] identifier[id] , identifier[context] , identifier[buildEventAttributeMap] operator[SEP] identifier[principal] , identifier[Optional] operator[SEP] identifier[of] operator[SEP] identifier[service] operator[SEP] , identifier[provider] operator[SEP] operator[SEP] operator[SEP] identifier[events] operator[SEP] identifier[add] operator[SEP] identifier[event] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] Keyword[final] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[value] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[return] identifier[events] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
private void handleFlowResults(Queue<Env<AttrContext>> queue, ListBuffer<Element> elems) {
for (Env<AttrContext> env: queue) {
switch (env.tree.getTag()) {
case CLASSDEF:
JCClassDecl cdef = (JCClassDecl) env.tree;
if (cdef.sym != null)
elems.append(cdef.sym);
break;
case MODULEDEF:
JCModuleDecl mod = (JCModuleDecl) env.tree;
if (mod.sym != null)
elems.append(mod.sym);
break;
case PACKAGEDEF:
JCCompilationUnit unit = env.toplevel;
if (unit.packge != null)
elems.append(unit.packge);
break;
}
}
genList.addAll(queue);
} | class class_name[name] begin[{]
method[handleFlowResults, return_type[void], modifier[private], parameter[queue, elems]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[SwitchStatement(cases=[SwitchStatementCase(case=['CLASSDEF'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=env, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JCClassDecl, sub_type=None)), name=cdef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JCClassDecl, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=sym, postfix_operators=[], prefix_operators=[], qualifier=cdef, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sym, postfix_operators=[], prefix_operators=[], qualifier=cdef, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=elems, selectors=[], type_arguments=None), label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['MODULEDEF'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=tree, postfix_operators=[], prefix_operators=[], qualifier=env, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JCModuleDecl, sub_type=None)), name=mod)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JCModuleDecl, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=sym, postfix_operators=[], prefix_operators=[], qualifier=mod, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=sym, postfix_operators=[], prefix_operators=[], qualifier=mod, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=elems, selectors=[], type_arguments=None), label=None)), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['PACKAGEDEF'], statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=toplevel, postfix_operators=[], prefix_operators=[], qualifier=env, selectors=[]), name=unit)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JCCompilationUnit, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=packge, postfix_operators=[], prefix_operators=[], qualifier=unit, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=packge, postfix_operators=[], prefix_operators=[], qualifier=unit, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=elems, selectors=[], type_arguments=None), label=None)), BreakStatement(goto=None, label=None)])], expression=MethodInvocation(arguments=[], member=getTag, postfix_operators=[], prefix_operators=[], qualifier=env.tree, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=queue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=env)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=AttrContext, sub_type=None))], dimensions=[], name=Env, sub_type=None))), label=None)
call[genList.addAll, parameter[member[.queue]]]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[handleFlowResults] operator[SEP] identifier[Queue] operator[<] identifier[Env] operator[<] identifier[AttrContext] operator[>] operator[>] identifier[queue] , identifier[ListBuffer] operator[<] identifier[Element] operator[>] identifier[elems] operator[SEP] {
Keyword[for] operator[SEP] identifier[Env] operator[<] identifier[AttrContext] operator[>] identifier[env] operator[:] identifier[queue] operator[SEP] {
Keyword[switch] operator[SEP] identifier[env] operator[SEP] identifier[tree] operator[SEP] identifier[getTag] operator[SEP] operator[SEP] operator[SEP] {
Keyword[case] identifier[CLASSDEF] operator[:] identifier[JCClassDecl] identifier[cdef] operator[=] operator[SEP] identifier[JCClassDecl] operator[SEP] identifier[env] operator[SEP] identifier[tree] operator[SEP] Keyword[if] operator[SEP] identifier[cdef] operator[SEP] identifier[sym] operator[!=] Other[null] operator[SEP] identifier[elems] operator[SEP] identifier[append] operator[SEP] identifier[cdef] operator[SEP] identifier[sym] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[MODULEDEF] operator[:] identifier[JCModuleDecl] identifier[mod] operator[=] operator[SEP] identifier[JCModuleDecl] operator[SEP] identifier[env] operator[SEP] identifier[tree] operator[SEP] Keyword[if] operator[SEP] identifier[mod] operator[SEP] identifier[sym] operator[!=] Other[null] operator[SEP] identifier[elems] operator[SEP] identifier[append] operator[SEP] identifier[mod] operator[SEP] identifier[sym] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[PACKAGEDEF] operator[:] identifier[JCCompilationUnit] identifier[unit] operator[=] identifier[env] operator[SEP] identifier[toplevel] operator[SEP] Keyword[if] operator[SEP] identifier[unit] operator[SEP] identifier[packge] operator[!=] Other[null] operator[SEP] identifier[elems] operator[SEP] identifier[append] operator[SEP] identifier[unit] operator[SEP] identifier[packge] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
identifier[genList] operator[SEP] identifier[addAll] operator[SEP] identifier[queue] operator[SEP] operator[SEP]
}
|
static final void syntaxError(String msg, String rule, int start) {
int end = ruleEnd(rule, start, rule.length());
throw new IllegalIcuArgumentException(msg + " in \"" +
Utility.escape(rule.substring(start, end)) + '"');
} | class class_name[name] begin[{]
method[syntaxError, return_type[void], modifier[final static], parameter[msg, rule, start]] begin[{]
local_variable[type[int], end]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" in \""), operator=+), operandr=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=end, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=rule, selectors=[], type_arguments=None)], member=escape, postfix_operators=[], prefix_operators=[], qualifier=Utility, 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=IllegalIcuArgumentException, sub_type=None)), label=None)
end[}]
END[}] | Keyword[static] Keyword[final] Keyword[void] identifier[syntaxError] operator[SEP] identifier[String] identifier[msg] , identifier[String] identifier[rule] , Keyword[int] identifier[start] operator[SEP] {
Keyword[int] identifier[end] operator[=] identifier[ruleEnd] operator[SEP] identifier[rule] , identifier[start] , identifier[rule] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalIcuArgumentException] operator[SEP] identifier[msg] operator[+] literal[String] operator[+] identifier[Utility] operator[SEP] identifier[escape] operator[SEP] identifier[rule] operator[SEP] identifier[substring] operator[SEP] identifier[start] , identifier[end] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
private void verifyPage(String pageId) {
if (!pages.containsKey(pageId)) {
throw new CitrusRuntimeException(String.format("Unknown page '%s' - please introduce page with type information first", pageId));
}
} | class class_name[name] begin[{]
method[verifyPage, return_type[void], modifier[private], parameter[pageId]] begin[{]
if[call[pages.containsKey, parameter[member[.pageId]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unknown page '%s' - please introduce page with type information first"), MemberReference(member=pageId, 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=CitrusRuntimeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[verifyPage] operator[SEP] identifier[String] identifier[pageId] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[pages] operator[SEP] identifier[containsKey] operator[SEP] identifier[pageId] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CitrusRuntimeException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[pageId] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
protected void internalWriteUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value)
throws CmsDataAccessException {
PreparedStatement stmt = null;
Connection conn = null;
try {
// get connection
conn = m_sqlManager.getConnection(dbc);
// write data to database
stmt = m_sqlManager.getPreparedStatement(conn, "C_ORACLE_USERDATA_WRITE_3");
stmt.setString(1, userId.toString());
stmt.setString(2, key);
stmt.setString(3, value.getClass().getName());
stmt.executeUpdate();
} catch (SQLException e) {
throw new CmsDbSqlException(
org.opencms.db.generic.Messages.get().container(
org.opencms.db.generic.Messages.ERR_GENERIC_SQL_1,
CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, null);
}
internalUpdateUserInfoData(dbc, userId, key, value);
} | class class_name[name] begin[{]
method[internalWriteUserInfo, return_type[void], modifier[protected], parameter[dbc, userId, key, value]] begin[{]
local_variable[type[PreparedStatement], stmt]
local_variable[type[Connection], conn]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=dbc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getConnection, postfix_operators=[], prefix_operators=[], qualifier=m_sqlManager, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="C_ORACLE_USERDATA_WRITE_3")], member=getPreparedStatement, postfix_operators=[], prefix_operators=[], qualifier=m_sqlManager, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=userId, selectors=[], type_arguments=None)], member=setString, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setString, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), MethodInvocation(arguments=[], member=getClass, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setString, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=executeUpdate, postfix_operators=[], prefix_operators=[], qualifier=stmt, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=org.opencms.db.generic.Messages, selectors=[MethodInvocation(arguments=[MemberReference(member=ERR_GENERIC_SQL_1, postfix_operators=[], prefix_operators=[], qualifier=org.opencms.db.generic.Messages, selectors=[]), MethodInvocation(arguments=[MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getErrorQuery, postfix_operators=[], prefix_operators=[], qualifier=CmsDbSqlException, selectors=[], type_arguments=None)], member=container, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), 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=CmsDbSqlException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['SQLException']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=dbc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=conn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=stmt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=closeAll, postfix_operators=[], prefix_operators=[], qualifier=m_sqlManager, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
call[.internalUpdateUserInfoData, parameter[member[.dbc], member[.userId], member[.key], member[.value]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[internalWriteUserInfo] operator[SEP] identifier[CmsDbContext] identifier[dbc] , identifier[CmsUUID] identifier[userId] , identifier[String] identifier[key] , identifier[Object] identifier[value] operator[SEP] Keyword[throws] identifier[CmsDataAccessException] {
identifier[PreparedStatement] identifier[stmt] operator[=] Other[null] operator[SEP] identifier[Connection] identifier[conn] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[conn] operator[=] identifier[m_sqlManager] operator[SEP] identifier[getConnection] operator[SEP] identifier[dbc] operator[SEP] operator[SEP] identifier[stmt] operator[=] identifier[m_sqlManager] operator[SEP] identifier[getPreparedStatement] operator[SEP] identifier[conn] , literal[String] operator[SEP] operator[SEP] identifier[stmt] operator[SEP] identifier[setString] operator[SEP] Other[1] , identifier[userId] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[stmt] operator[SEP] identifier[setString] operator[SEP] Other[2] , identifier[key] operator[SEP] operator[SEP] identifier[stmt] operator[SEP] identifier[setString] operator[SEP] Other[3] , identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[stmt] operator[SEP] identifier[executeUpdate] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[SQLException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[CmsDbSqlException] operator[SEP] identifier[org] operator[SEP] identifier[opencms] operator[SEP] identifier[db] operator[SEP] identifier[generic] operator[SEP] identifier[Messages] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[container] operator[SEP] identifier[org] operator[SEP] identifier[opencms] operator[SEP] identifier[db] operator[SEP] identifier[generic] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_GENERIC_SQL_1] , identifier[CmsDbSqlException] operator[SEP] identifier[getErrorQuery] operator[SEP] identifier[stmt] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[m_sqlManager] operator[SEP] identifier[closeAll] operator[SEP] identifier[dbc] , identifier[conn] , identifier[stmt] , Other[null] operator[SEP] operator[SEP]
}
identifier[internalUpdateUserInfoData] operator[SEP] identifier[dbc] , identifier[userId] , identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
|
protected boolean isEqual(NodeList nodeList1, NodeList nodeList2, XmlCompareMode mode) {
// compare child nodes
Iterator<Node> nodeIterator1 = new JoiningNodeIterator(nodeList1, mode);
Iterator<Node> nodeIterator2 = new JoiningNodeIterator(nodeList2, mode);
while (nodeIterator1.hasNext()) {
Node child1 = nodeIterator1.next();
if (!nodeIterator2.hasNext()) {
return false;
}
Node child2 = nodeIterator2.next();
if ((child1.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE) && (child2.getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) {
// according to DOM-spec nodes can never return DocumentFragment as
// child - in our case this indicates that the JoiningNodeIterator has
// joined CharacterData according to "mode" into a DocumentFragment.
CharIterator charIterator1 = new NodeValueCharIterator(child1.getChildNodes());
CharIterator charIterator2 = new NodeValueCharIterator(child2.getChildNodes());
if (!isEqual(charIterator1, charIterator2, mode)) {
return false;
}
}
if (!isEqual(child1, child2, mode)) {
return false;
}
}
if (nodeIterator2.hasNext()) {
return false;
}
return true;
} | class class_name[name] begin[{]
method[isEqual, return_type[type[boolean]], modifier[protected], parameter[nodeList1, nodeList2, mode]] begin[{]
local_variable[type[Iterator], nodeIterator1]
local_variable[type[Iterator], nodeIterator2]
while[call[nodeIterator1.hasNext, parameter[]]] begin[{]
local_variable[type[Node], child1]
if[call[nodeIterator2.hasNext, parameter[]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[Node], child2]
if[binary_operation[binary_operation[call[child1.getNodeType, parameter[]], ==, member[Node.DOCUMENT_FRAGMENT_NODE]], &&, binary_operation[call[child2.getNodeType, parameter[]], ==, member[Node.DOCUMENT_FRAGMENT_NODE]]]] begin[{]
local_variable[type[CharIterator], charIterator1]
local_variable[type[CharIterator], charIterator2]
if[call[.isEqual, parameter[member[.charIterator1], member[.charIterator2], member[.mode]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[call[.isEqual, parameter[member[.child1], member[.child2], member[.mode]]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
end[}]
if[call[nodeIterator2.hasNext, parameter[]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[protected] Keyword[boolean] identifier[isEqual] operator[SEP] identifier[NodeList] identifier[nodeList1] , identifier[NodeList] identifier[nodeList2] , identifier[XmlCompareMode] identifier[mode] operator[SEP] {
identifier[Iterator] operator[<] identifier[Node] operator[>] identifier[nodeIterator1] operator[=] Keyword[new] identifier[JoiningNodeIterator] operator[SEP] identifier[nodeList1] , identifier[mode] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[Node] operator[>] identifier[nodeIterator2] operator[=] Keyword[new] identifier[JoiningNodeIterator] operator[SEP] identifier[nodeList2] , identifier[mode] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[nodeIterator1] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[Node] identifier[child1] operator[=] identifier[nodeIterator1] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[nodeIterator2] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[Node] identifier[child2] operator[=] identifier[nodeIterator2] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[child1] operator[SEP] identifier[getNodeType] operator[SEP] operator[SEP] operator[==] identifier[Node] operator[SEP] identifier[DOCUMENT_FRAGMENT_NODE] operator[SEP] operator[&&] operator[SEP] identifier[child2] operator[SEP] identifier[getNodeType] operator[SEP] operator[SEP] operator[==] identifier[Node] operator[SEP] identifier[DOCUMENT_FRAGMENT_NODE] operator[SEP] operator[SEP] {
identifier[CharIterator] identifier[charIterator1] operator[=] Keyword[new] identifier[NodeValueCharIterator] operator[SEP] identifier[child1] operator[SEP] identifier[getChildNodes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[CharIterator] identifier[charIterator2] operator[=] Keyword[new] identifier[NodeValueCharIterator] operator[SEP] identifier[child2] operator[SEP] identifier[getChildNodes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isEqual] operator[SEP] identifier[charIterator1] , identifier[charIterator2] , identifier[mode] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] operator[!] identifier[isEqual] operator[SEP] identifier[child1] , identifier[child2] , identifier[mode] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[nodeIterator2] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void marshalling(Xdr xdr) {
super.marshalling(xdr);
xdr.putLong(_offset);
xdr.putUnsignedInt(_size);
xdr.putInt(_syncType);
// opaque payload, pass payload size down to avoid enumerating the list
// again
if (_payload != null) {
xdr.putPayloads(_payload, _size);
}
} | class class_name[name] begin[{]
method[marshalling, return_type[void], modifier[public], parameter[xdr]] begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=xdr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshalling, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
call[xdr.putLong, parameter[member[._offset]]]
call[xdr.putUnsignedInt, parameter[member[._size]]]
call[xdr.putInt, parameter[member[._syncType]]]
if[binary_operation[member[._payload], !=, literal[null]]] begin[{]
call[xdr.putPayloads, parameter[member[._payload], member[._size]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshalling] operator[SEP] identifier[Xdr] identifier[xdr] operator[SEP] {
Keyword[super] operator[SEP] identifier[marshalling] operator[SEP] identifier[xdr] operator[SEP] operator[SEP] identifier[xdr] operator[SEP] identifier[putLong] operator[SEP] identifier[_offset] operator[SEP] operator[SEP] identifier[xdr] operator[SEP] identifier[putUnsignedInt] operator[SEP] identifier[_size] operator[SEP] operator[SEP] identifier[xdr] operator[SEP] identifier[putInt] operator[SEP] identifier[_syncType] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[_payload] operator[!=] Other[null] operator[SEP] {
identifier[xdr] operator[SEP] identifier[putPayloads] operator[SEP] identifier[_payload] , identifier[_size] operator[SEP] operator[SEP]
}
}
|
@Override
protected void write(LogLevel level, String correlationId, Exception error, String message) {
for (ILogger logger : _loggers)
logger.log(level, correlationId, error, message);
} | class class_name[name] begin[{]
method[write, return_type[void], modifier[protected], parameter[level, correlationId, error, message]] begin[{]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=level, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=correlationId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=error, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=_loggers, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=logger)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ILogger, sub_type=None))), label=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] Keyword[void] identifier[write] operator[SEP] identifier[LogLevel] identifier[level] , identifier[String] identifier[correlationId] , identifier[Exception] identifier[error] , identifier[String] identifier[message] operator[SEP] {
Keyword[for] operator[SEP] identifier[ILogger] identifier[logger] operator[:] identifier[_loggers] operator[SEP] identifier[logger] operator[SEP] identifier[log] operator[SEP] identifier[level] , identifier[correlationId] , identifier[error] , identifier[message] operator[SEP] operator[SEP]
}
|
public static int pixelsWidth(final DisplayMetrics displayMetrics, final int dip) {
final float scale = displayMetrics.density;
final float alpha = 0.5f;
return (int)(dip * scale + alpha);
} | class class_name[name] begin[{]
method[pixelsWidth, return_type[type[int]], modifier[public static], parameter[displayMetrics, dip]] begin[{]
local_variable[type[float], scale]
local_variable[type[float], alpha]
return[Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=dip, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=scale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=*), operandr=MemberReference(member=alpha, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), type=BasicType(dimensions=[], name=int))]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[pixelsWidth] operator[SEP] Keyword[final] identifier[DisplayMetrics] identifier[displayMetrics] , Keyword[final] Keyword[int] identifier[dip] operator[SEP] {
Keyword[final] Keyword[float] identifier[scale] operator[=] identifier[displayMetrics] operator[SEP] identifier[density] operator[SEP] Keyword[final] Keyword[float] identifier[alpha] operator[=] literal[Float] operator[SEP] Keyword[return] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[dip] operator[*] identifier[scale] operator[+] identifier[alpha] operator[SEP] operator[SEP]
}
|
public static <T> T copy(final T object, final DataTypeDescriptor<T> descriptor) {
if (descriptor == null) {
throw new NullPointerException("descriptor");
}
return copy(object, descriptor.getType());
} | class class_name[name] begin[{]
method[copy, return_type[type[T]], modifier[public static], parameter[object, descriptor]] begin[{]
if[binary_operation[member[.descriptor], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="descriptor")], 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[}]
return[call[.copy, parameter[member[.object], call[descriptor.getType, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[copy] operator[SEP] Keyword[final] identifier[T] identifier[object] , Keyword[final] identifier[DataTypeDescriptor] operator[<] identifier[T] operator[>] identifier[descriptor] operator[SEP] {
Keyword[if] operator[SEP] identifier[descriptor] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[copy] operator[SEP] identifier[object] , identifier[descriptor] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T extends Tree> MultiMatcher<T, AnnotationTree> annotations(
MatchType matchType, Matcher<AnnotationTree> annotationMatcher) {
return new AnnotationMatcher<>(matchType, annotationMatcher);
} | class class_name[name] begin[{]
method[annotations, return_type[type[MultiMatcher]], modifier[public static], parameter[matchType, annotationMatcher]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=matchType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=annotationMatcher, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=AnnotationMatcher, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[Tree] operator[>] identifier[MultiMatcher] operator[<] identifier[T] , identifier[AnnotationTree] operator[>] identifier[annotations] operator[SEP] identifier[MatchType] identifier[matchType] , identifier[Matcher] operator[<] identifier[AnnotationTree] operator[>] identifier[annotationMatcher] operator[SEP] {
Keyword[return] Keyword[new] identifier[AnnotationMatcher] operator[<] operator[>] operator[SEP] identifier[matchType] , identifier[annotationMatcher] operator[SEP] operator[SEP]
}
|
public static LongBinaryOperator longBinaryOperator(CheckedLongBinaryOperator operator, Consumer<Throwable> handler) {
return (l1, l2) -> {
try {
return operator.applyAsLong(l1, l2);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | class class_name[name] begin[{]
method[longBinaryOperator, return_type[type[LongBinaryOperator]], modifier[public static], parameter[operator, handler]] begin[{]
return[LambdaExpression(body=[TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=l1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=l2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=applyAsLong, postfix_operators=[], prefix_operators=[], qualifier=operator, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=[], prefix_operators=[], qualifier=handler, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception handler must throw a RuntimeException"), 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=IllegalStateException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Throwable']))], finally_block=None, label=None, resources=None)], parameters=[InferredFormalParameter(name=l1), InferredFormalParameter(name=l2)])]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[LongBinaryOperator] identifier[longBinaryOperator] operator[SEP] identifier[CheckedLongBinaryOperator] identifier[operator] , identifier[Consumer] operator[<] identifier[Throwable] operator[>] identifier[handler] operator[SEP] {
Keyword[return] operator[SEP] identifier[l1] , identifier[l2] operator[SEP] operator[->] {
Keyword[try] {
Keyword[return] identifier[operator] operator[SEP] identifier[applyAsLong] operator[SEP] identifier[l1] , identifier[l2] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[e] operator[SEP] {
identifier[handler] operator[SEP] identifier[accept] operator[SEP] identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
} operator[SEP]
}
|
public static PoolInfo createPoolInfo(String poolInfoString) {
if (poolInfoString == null || poolInfoString.isEmpty()) {
LOG.warn("createPoolInfo: Null or empty input " + poolInfoString);
return null;
}
String[] poolInfoSplitString = poolInfoString.split("[.]");
if (poolInfoSplitString.length != 2) {
LOG.warn("createPoolInfo: Couldn't parse " + poolInfoString);
return null;
}
return new PoolInfo(poolInfoSplitString[0], poolInfoSplitString[1]);
} | class class_name[name] begin[{]
method[createPoolInfo, return_type[type[PoolInfo]], modifier[public static], parameter[poolInfoString]] begin[{]
if[binary_operation[binary_operation[member[.poolInfoString], ==, literal[null]], ||, call[poolInfoString.isEmpty, parameter[]]]] begin[{]
call[LOG.warn, parameter[binary_operation[literal["createPoolInfo: Null or empty input "], +, member[.poolInfoString]]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], poolInfoSplitString]
if[binary_operation[member[poolInfoSplitString.length], !=, literal[2]]] begin[{]
call[LOG.warn, parameter[binary_operation[literal["createPoolInfo: Couldn't parse "], +, member[.poolInfoString]]]]
return[literal[null]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=poolInfoSplitString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), MemberReference(member=poolInfoSplitString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PoolInfo, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[PoolInfo] identifier[createPoolInfo] operator[SEP] identifier[String] identifier[poolInfoString] operator[SEP] {
Keyword[if] operator[SEP] identifier[poolInfoString] operator[==] Other[null] operator[||] identifier[poolInfoString] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[poolInfoString] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[poolInfoSplitString] operator[=] identifier[poolInfoString] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[poolInfoSplitString] operator[SEP] identifier[length] operator[!=] Other[2] operator[SEP] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[poolInfoString] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[return] Keyword[new] identifier[PoolInfo] operator[SEP] identifier[poolInfoSplitString] operator[SEP] Other[0] operator[SEP] , identifier[poolInfoSplitString] operator[SEP] Other[1] 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.