code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public static void normalizeDoubleQuotes(final List<Token> sentence,
final String lang) {
boolean isLeft = true;
for (int i = 0; i < sentence.size(); i++) {
if (lang.equalsIgnoreCase("en")) {
final Matcher doubleAsciiQuoteMatcher = doubleAsciiQuote
.matcher(sentence.get(i).getTokenValue());
final Matcher singleAsciiQuoteMatcher = singleAsciiQuote
.matcher(sentence.get(i).getTokenValue());
// if current token is "
if (doubleAsciiQuoteMatcher.find()) {
if (isLeft && i < sentence.size() - 1 && doubleAsciiQuoteAlphaNumeric
.matcher(sentence.get(i + 1).getTokenValue()).find()) {
sentence.get(i).setTokenValue("``");
isLeft = false;
} else if (!isLeft) {
sentence.get(i).setTokenValue("''");
isLeft = true;
}
} else if (singleAsciiQuoteMatcher.find()) {
if (i < sentence.size() - 2
&& sentence.get(i + 1).getTokenValue().matches("[A-Za-z]")
&& sentence.get(i + 2).getTokenValue()
.matches("[^ \t\n\r\u00A0\u00B6]")) {
sentence.get(i).setTokenValue("`");
}
}
}
}
} | class class_name[name] begin[{]
method[normalizeDoubleQuotes, return_type[void], modifier[public static], parameter[sentence, lang]] begin[{]
local_variable[type[boolean], isLeft]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="en")], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=lang, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[MethodInvocation(arguments=[], member=getTokenValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=matcher, postfix_operators=[], prefix_operators=[], qualifier=doubleAsciiQuote, selectors=[], type_arguments=None), name=doubleAsciiQuoteMatcher)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Matcher, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[MethodInvocation(arguments=[], member=getTokenValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=matcher, postfix_operators=[], prefix_operators=[], qualifier=singleAsciiQuote, selectors=[], type_arguments=None), name=singleAsciiQuoteMatcher)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Matcher, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[], member=find, postfix_operators=[], prefix_operators=[], qualifier=doubleAsciiQuoteMatcher, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[], member=find, postfix_operators=[], prefix_operators=[], qualifier=singleAsciiQuoteMatcher, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-), operator=<), operandr=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=get, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[MethodInvocation(arguments=[], member=getTokenValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[A-Za-z]")], member=matches, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), operandr=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=+)], member=get, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[MethodInvocation(arguments=[], member=getTokenValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[^ \t\n\r ¶]")], member=matches, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="`")], member=setTokenValue, 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=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=isLeft, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=<), 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=get, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[MethodInvocation(arguments=[], member=getTokenValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=matcher, postfix_operators=[], prefix_operators=[], qualifier=doubleAsciiQuoteAlphaNumeric, selectors=[MethodInvocation(arguments=[], member=find, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=IfStatement(condition=MemberReference(member=isLeft, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="''")], member=setTokenValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isLeft, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="``")], member=setTokenValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=isLeft, 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=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=sentence, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[normalizeDoubleQuotes] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[Token] operator[>] identifier[sentence] , Keyword[final] identifier[String] identifier[lang] operator[SEP] {
Keyword[boolean] identifier[isLeft] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[sentence] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[lang] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[final] identifier[Matcher] identifier[doubleAsciiQuoteMatcher] operator[=] identifier[doubleAsciiQuote] operator[SEP] identifier[matcher] operator[SEP] identifier[sentence] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getTokenValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Matcher] identifier[singleAsciiQuoteMatcher] operator[=] identifier[singleAsciiQuote] operator[SEP] identifier[matcher] operator[SEP] identifier[sentence] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getTokenValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[doubleAsciiQuoteMatcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[isLeft] operator[&&] identifier[i] operator[<] identifier[sentence] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[&&] identifier[doubleAsciiQuoteAlphaNumeric] operator[SEP] identifier[matcher] operator[SEP] identifier[sentence] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] identifier[getTokenValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
identifier[sentence] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[setTokenValue] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isLeft] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] operator[!] identifier[isLeft] operator[SEP] {
identifier[sentence] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[setTokenValue] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[isLeft] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[singleAsciiQuoteMatcher] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[<] identifier[sentence] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[2] operator[&&] identifier[sentence] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[SEP] identifier[getTokenValue] operator[SEP] operator[SEP] operator[SEP] identifier[matches] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[sentence] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[+] Other[2] operator[SEP] operator[SEP] identifier[getTokenValue] operator[SEP] operator[SEP] operator[SEP] identifier[matches] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[sentence] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[setTokenValue] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
}
}
}
|
public static Point2D_F64 convertNormToPixel(CameraModel param , Point2D_F64 norm , Point2D_F64 pixel ) {
return convertNormToPixel(param,norm.x,norm.y,pixel);
} | class class_name[name] begin[{]
method[convertNormToPixel, return_type[type[Point2D_F64]], modifier[public static], parameter[param, norm, pixel]] begin[{]
return[call[.convertNormToPixel, parameter[member[.param], member[norm.x], member[norm.y], member[.pixel]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Point2D_F64] identifier[convertNormToPixel] operator[SEP] identifier[CameraModel] identifier[param] , identifier[Point2D_F64] identifier[norm] , identifier[Point2D_F64] identifier[pixel] operator[SEP] {
Keyword[return] identifier[convertNormToPixel] operator[SEP] identifier[param] , identifier[norm] operator[SEP] identifier[x] , identifier[norm] operator[SEP] identifier[y] , identifier[pixel] operator[SEP] operator[SEP]
}
|
@NonNull
@Override
public Flowable<PutResults<T>> asRxFlowable(@NonNull BackpressureStrategy backpressureStrategy) {
return RxJavaUtils.createFlowable(storIOSQLite, this, backpressureStrategy);
} | class class_name[name] begin[{]
method[asRxFlowable, return_type[type[Flowable]], modifier[public], parameter[backpressureStrategy]] begin[{]
return[call[RxJavaUtils.createFlowable, parameter[member[.storIOSQLite], THIS[], member[.backpressureStrategy]]]]
end[}]
END[}] | annotation[@] identifier[NonNull] annotation[@] identifier[Override] Keyword[public] identifier[Flowable] operator[<] identifier[PutResults] operator[<] identifier[T] operator[>] operator[>] identifier[asRxFlowable] operator[SEP] annotation[@] identifier[NonNull] identifier[BackpressureStrategy] identifier[backpressureStrategy] operator[SEP] {
Keyword[return] identifier[RxJavaUtils] operator[SEP] identifier[createFlowable] operator[SEP] identifier[storIOSQLite] , Keyword[this] , identifier[backpressureStrategy] operator[SEP] operator[SEP]
}
|
public static BigDecimal sround(BigDecimal b0, int b1) {
return b0.movePointRight(b1)
.setScale(0, RoundingMode.HALF_UP).movePointLeft(b1);
} | class class_name[name] begin[{]
method[sround, return_type[type[BigDecimal]], modifier[public static], parameter[b0, b1]] begin[{]
return[call[b0.movePointRight, parameter[member[.b1]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[BigDecimal] identifier[sround] operator[SEP] identifier[BigDecimal] identifier[b0] , Keyword[int] identifier[b1] operator[SEP] {
Keyword[return] identifier[b0] operator[SEP] identifier[movePointRight] operator[SEP] identifier[b1] operator[SEP] operator[SEP] identifier[setScale] operator[SEP] Other[0] , identifier[RoundingMode] operator[SEP] identifier[HALF_UP] operator[SEP] operator[SEP] identifier[movePointLeft] operator[SEP] identifier[b1] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("rawtypes")
private static Object findFirstNonNull(Iterator it) {
Object result = null;
while(it.hasNext()) {
result = it.next();
if(result != null) {
break;
}
}
return result;
} | class class_name[name] begin[{]
method[findFirstNonNull, return_type[type[Object]], modifier[private static], parameter[it]] begin[{]
local_variable[type[Object], result]
while[call[it.hasNext, parameter[]]] begin[{]
assign[member[.result], call[it.next, parameter[]]]
if[binary_operation[member[.result], !=, literal[null]]] begin[{]
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
return[member[.result]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[private] Keyword[static] identifier[Object] identifier[findFirstNonNull] operator[SEP] identifier[Iterator] identifier[it] operator[SEP] {
identifier[Object] identifier[result] operator[=] Other[null] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[SEP] {
Keyword[break] operator[SEP]
}
}
Keyword[return] identifier[result] operator[SEP]
}
|
protected ConfigWebImpl getConfigWebImpl(String realpath) {
Iterator<String> it = initContextes.keySet().iterator();
while (it.hasNext()) {
ConfigWebImpl cw = ((CFMLFactoryImpl) initContextes.get(it.next())).getConfigWebImpl();
if (ReqRspUtil.getRootPath(cw.getServletContext()).equals(realpath)) return cw;
}
return null;
} | class class_name[name] begin[{]
method[getConfigWebImpl, return_type[type[ConfigWebImpl]], modifier[protected], parameter[realpath]] begin[{]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
local_variable[type[ConfigWebImpl], cw]
if[call[ReqRspUtil.getRootPath, parameter[call[cw.getServletContext, parameter[]]]]] begin[{]
return[member[.cw]]
else begin[{]
None
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[protected] identifier[ConfigWebImpl] identifier[getConfigWebImpl] operator[SEP] identifier[String] identifier[realpath] operator[SEP] {
identifier[Iterator] operator[<] identifier[String] operator[>] identifier[it] operator[=] identifier[initContextes] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[ConfigWebImpl] identifier[cw] operator[=] operator[SEP] operator[SEP] identifier[CFMLFactoryImpl] operator[SEP] identifier[initContextes] operator[SEP] identifier[get] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getConfigWebImpl] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ReqRspUtil] operator[SEP] identifier[getRootPath] operator[SEP] identifier[cw] operator[SEP] identifier[getServletContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[realpath] operator[SEP] operator[SEP] Keyword[return] identifier[cw] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public static void validateSchemaAsNeeded(StoreDefinition storeDefinition) {
logger.info("Validating schema for store: " + storeDefinition.getName());
SerializerDefinition keySerDef = storeDefinition.getKeySerializer();
// validate the key schemas
try {
validateIfAvroSchema(keySerDef);
} catch(Exception e) {
logger.error("Validating key schema failed for store: " + storeDefinition.getName());
throw new VoldemortException("Error validating key schema for store: "
+ storeDefinition.getName() + " " + e.getMessage(), e);
}
// validate the value schemas
SerializerDefinition valueSerDef = storeDefinition.getValueSerializer();
try {
validateIfAvroSchema(valueSerDef);
} catch(Exception e) {
logger.error("Validating value schema failed for store: " + storeDefinition.getName());
throw new VoldemortException("Error validating value schema for store: "
+ storeDefinition.getName() + " " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[validateSchemaAsNeeded, return_type[void], modifier[public static], parameter[storeDefinition]] begin[{]
call[logger.info, parameter[binary_operation[literal["Validating schema for store: "], +, call[storeDefinition.getName, parameter[]]]]]
local_variable[type[SerializerDefinition], keySerDef]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=keySerDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=validateIfAvroSchema, 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="Validating key schema failed for store: "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=storeDefinition, selectors=[], type_arguments=None), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error validating key schema for store: "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=storeDefinition, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), 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=VoldemortException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
local_variable[type[SerializerDefinition], valueSerDef]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=valueSerDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=validateIfAvroSchema, 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="Validating value schema failed for store: "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=storeDefinition, selectors=[], type_arguments=None), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error validating value schema for store: "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=storeDefinition, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" "), operator=+), 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=VoldemortException, 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] Keyword[void] identifier[validateSchemaAsNeeded] operator[SEP] identifier[StoreDefinition] identifier[storeDefinition] operator[SEP] {
identifier[logger] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[storeDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[SerializerDefinition] identifier[keySerDef] operator[=] identifier[storeDefinition] operator[SEP] identifier[getKeySerializer] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[validateIfAvroSchema] operator[SEP] identifier[keySerDef] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[storeDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[VoldemortException] operator[SEP] literal[String] operator[+] identifier[storeDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
identifier[SerializerDefinition] identifier[valueSerDef] operator[=] identifier[storeDefinition] operator[SEP] identifier[getValueSerializer] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[validateIfAvroSchema] operator[SEP] identifier[valueSerDef] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[storeDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[VoldemortException] operator[SEP] literal[String] operator[+] identifier[storeDefinition] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void waitForUninterruptibly(Guard guard) {
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
throw new IllegalMonitorStateException();
}
if (!guard.isSatisfied()) {
awaitUninterruptibly(guard, true);
}
} | class class_name[name] begin[{]
method[waitForUninterruptibly, return_type[void], modifier[public], parameter[guard]] begin[{]
if[binary_operation[binary_operation[member[guard.monitor], ==, THIS[]], &, call[lock.isHeldByCurrentThread, parameter[]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalMonitorStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[guard.isSatisfied, parameter[]]] begin[{]
call[.awaitUninterruptibly, parameter[member[.guard], literal[true]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[waitForUninterruptibly] operator[SEP] identifier[Guard] identifier[guard] operator[SEP] {
Keyword[if] operator[SEP] operator[!] operator[SEP] operator[SEP] identifier[guard] operator[SEP] identifier[monitor] operator[==] Keyword[this] operator[SEP] operator[&] identifier[lock] operator[SEP] identifier[isHeldByCurrentThread] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalMonitorStateException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[guard] operator[SEP] identifier[isSatisfied] operator[SEP] operator[SEP] operator[SEP] {
identifier[awaitUninterruptibly] operator[SEP] identifier[guard] , literal[boolean] operator[SEP] operator[SEP]
}
}
|
public Observable<PublicIPAddressInner> beginCreateOrUpdateAsync(String resourceGroupName, String publicIpAddressName, PublicIPAddressInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, publicIpAddressName, parameters).map(new Func1<ServiceResponse<PublicIPAddressInner>, PublicIPAddressInner>() {
@Override
public PublicIPAddressInner call(ServiceResponse<PublicIPAddressInner> response) {
return response.body();
}
});
} | class class_name[name] begin[{]
method[beginCreateOrUpdateAsync, return_type[type[Observable]], modifier[public], parameter[resourceGroupName, publicIpAddressName, parameters]] begin[{]
return[call[.beginCreateOrUpdateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.publicIpAddressName], member[.parameters]]]]
end[}]
END[}] | Keyword[public] identifier[Observable] operator[<] identifier[PublicIPAddressInner] operator[>] identifier[beginCreateOrUpdateAsync] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[publicIpAddressName] , identifier[PublicIPAddressInner] identifier[parameters] operator[SEP] {
Keyword[return] identifier[beginCreateOrUpdateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[publicIpAddressName] , identifier[parameters] operator[SEP] operator[SEP] identifier[map] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[ServiceResponse] operator[<] identifier[PublicIPAddressInner] operator[>] , identifier[PublicIPAddressInner] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[PublicIPAddressInner] identifier[call] operator[SEP] identifier[ServiceResponse] operator[<] identifier[PublicIPAddressInner] operator[>] identifier[response] operator[SEP] {
Keyword[return] identifier[response] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@Override
public boolean hasNext() {
// first all items of the second operand are stored in the set.
while (mOp2.hasNext()) {
if (getNode().getDataKey() < 0) { // only nodes are
// allowed
throw new XPathError(ErrorType.XPTY0004);
}
mDupSet.add(getNode().getDataKey());
}
while (mOp1.hasNext()) {
if (getNode().getDataKey() < 0) { // only nodes are
// allowed
throw new XPathError(ErrorType.XPTY0004);
}
// return true, if node is not already in the set, which means, that
// it is
// not also an item of the result set of the second operand
// sequence.
if (mDupSet.add(getNode().getDataKey())) {
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[hasNext, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
while[call[mOp2.hasNext, parameter[]]] begin[{]
if[binary_operation[call[.getNode, parameter[]], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=XPTY0004, postfix_operators=[], prefix_operators=[], qualifier=ErrorType, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XPathError, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[mDupSet.add, parameter[call[.getNode, parameter[]]]]
end[}]
while[call[mOp1.hasNext, parameter[]]] begin[{]
if[binary_operation[call[.getNode, parameter[]], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=XPTY0004, postfix_operators=[], prefix_operators=[], qualifier=ErrorType, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=XPathError, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[call[mDupSet.add, parameter[call[.getNode, parameter[]]]]] begin[{]
return[literal[true]]
else begin[{]
None
end[}]
end[}]
return[literal[false]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[hasNext] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[mOp2] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[getDataKey] operator[SEP] operator[SEP] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[XPathError] operator[SEP] identifier[ErrorType] operator[SEP] identifier[XPTY0004] operator[SEP] operator[SEP]
}
identifier[mDupSet] operator[SEP] identifier[add] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[getDataKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[mOp1] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[getDataKey] operator[SEP] operator[SEP] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[XPathError] operator[SEP] identifier[ErrorType] operator[SEP] identifier[XPTY0004] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[mDupSet] operator[SEP] identifier[add] operator[SEP] identifier[getNode] operator[SEP] operator[SEP] operator[SEP] identifier[getDataKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
@Override
public MessageProducer createProducer(Destination destination) throws JMSException
{
externalAccessLock.readLock().lock();
try
{
checkNotClosed();
LocalMessageProducer producer = new LocalMessageProducer(this,destination,idProvider.createID());
registerProducer(producer);
return producer;
}
finally
{
externalAccessLock.readLock().unlock();
}
} | class class_name[name] begin[{]
method[createProducer, return_type[type[MessageProducer]], modifier[public], parameter[destination]] begin[{]
call[externalAccessLock.readLock, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=checkNotClosed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=destination, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=createID, postfix_operators=[], prefix_operators=[], qualifier=idProvider, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LocalMessageProducer, sub_type=None)), name=producer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=LocalMessageProducer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=producer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=registerProducer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MemberReference(member=producer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=readLock, postfix_operators=[], prefix_operators=[], qualifier=externalAccessLock, selectors=[MethodInvocation(arguments=[], member=unlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[MessageProducer] identifier[createProducer] operator[SEP] identifier[Destination] identifier[destination] operator[SEP] Keyword[throws] identifier[JMSException] {
identifier[externalAccessLock] operator[SEP] identifier[readLock] operator[SEP] operator[SEP] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[checkNotClosed] operator[SEP] operator[SEP] operator[SEP] identifier[LocalMessageProducer] identifier[producer] operator[=] Keyword[new] identifier[LocalMessageProducer] operator[SEP] Keyword[this] , identifier[destination] , identifier[idProvider] operator[SEP] identifier[createID] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[registerProducer] operator[SEP] identifier[producer] operator[SEP] operator[SEP] Keyword[return] identifier[producer] operator[SEP]
}
Keyword[finally] {
identifier[externalAccessLock] operator[SEP] identifier[readLock] operator[SEP] operator[SEP] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public void scrollLines(int firstLine, int lastLine, int distance) {
// just ignore certain kinds of garbage:
if (distance == 0 || firstLine > lastLine) { return; }
super.scrollLines(firstLine, lastLine, distance);
// Save scroll hint for next refresh:
ScrollHint newHint = new ScrollHint(firstLine,lastLine,distance);
if (scrollHint == null) {
// no scroll hint yet: use the new one:
scrollHint = newHint;
} else //noinspection StatementWithEmptyBody
if (scrollHint == ScrollHint.INVALID) {
// scroll ranges already inconsistent since latest refresh!
// leave at INVALID
} else if (scrollHint.matches(newHint)) {
// same range: just accumulate distance:
scrollHint.distance += newHint.distance;
} else {
// different scroll range: no scroll-optimization for next refresh
this.scrollHint = ScrollHint.INVALID;
}
} | class class_name[name] begin[{]
method[scrollLines, return_type[void], modifier[public], parameter[firstLine, lastLine, distance]] begin[{]
if[binary_operation[binary_operation[member[.distance], ==, literal[0]], ||, binary_operation[member[.firstLine], >, member[.lastLine]]]] begin[{]
return[None]
else begin[{]
None
end[}]
SuperMethodInvocation(arguments=[MemberReference(member=firstLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lastLine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=distance, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=scrollLines, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[ScrollHint], newHint]
if[binary_operation[member[.scrollHint], ==, literal[null]]] begin[{]
assign[member[.scrollHint], member[.newHint]]
else begin[{]
if[binary_operation[member[.scrollHint], ==, member[ScrollHint.INVALID]]] begin[{]
else begin[{]
if[call[scrollHint.matches, parameter[member[.newHint]]]] begin[{]
assign[member[scrollHint.distance], member[newHint.distance]]
else begin[{]
assign[THIS[member[None.scrollHint]], member[ScrollHint.INVALID]]
end[}]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[scrollLines] operator[SEP] Keyword[int] identifier[firstLine] , Keyword[int] identifier[lastLine] , Keyword[int] identifier[distance] operator[SEP] {
Keyword[if] operator[SEP] identifier[distance] operator[==] Other[0] operator[||] identifier[firstLine] operator[>] identifier[lastLine] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[super] operator[SEP] identifier[scrollLines] operator[SEP] identifier[firstLine] , identifier[lastLine] , identifier[distance] operator[SEP] operator[SEP] identifier[ScrollHint] identifier[newHint] operator[=] Keyword[new] identifier[ScrollHint] operator[SEP] identifier[firstLine] , identifier[lastLine] , identifier[distance] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scrollHint] operator[==] Other[null] operator[SEP] {
identifier[scrollHint] operator[=] identifier[newHint] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[scrollHint] operator[==] identifier[ScrollHint] operator[SEP] identifier[INVALID] operator[SEP] {
}
Keyword[else] Keyword[if] operator[SEP] identifier[scrollHint] operator[SEP] identifier[matches] operator[SEP] identifier[newHint] operator[SEP] operator[SEP] {
identifier[scrollHint] operator[SEP] identifier[distance] operator[+=] identifier[newHint] operator[SEP] identifier[distance] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[scrollHint] operator[=] identifier[ScrollHint] operator[SEP] identifier[INVALID] operator[SEP]
}
}
|
public void setCharoff(String alignCharOff) {
_tbodyTag.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.CHAROFF, alignCharOff);
} | class class_name[name] begin[{]
method[setCharoff, return_type[void], modifier[public], parameter[alignCharOff]] begin[{]
call[_tbodyTag.registerAttribute, parameter[member[AbstractHtmlState.ATTR_GENERAL], member[HtmlConstants.CHAROFF], member[.alignCharOff]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setCharoff] operator[SEP] identifier[String] identifier[alignCharOff] operator[SEP] {
identifier[_tbodyTag] operator[SEP] identifier[registerAttribute] operator[SEP] identifier[AbstractHtmlState] operator[SEP] identifier[ATTR_GENERAL] , identifier[HtmlConstants] operator[SEP] identifier[CHAROFF] , identifier[alignCharOff] operator[SEP] operator[SEP]
}
|
public void setCandidateProperties(GlobalProperties gProps, LocalProperties lProps, Channel initialInput) {
this.cachedPlans = Collections.<PlanNode>singletonList(new SolutionSetPlanNode(this, "SolutionSet ("+this.getOperator().getName()+")", gProps, lProps, initialInput));
} | class class_name[name] begin[{]
method[setCandidateProperties, return_type[void], modifier[public], parameter[gProps, lProps, initialInput]] begin[{]
assign[THIS[member[None.cachedPlans]], call[.Collections, parameter[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SolutionSet ("), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=getOperator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+), MemberReference(member=gProps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=lProps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=initialInput, 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=SolutionSetPlanNode, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setCandidateProperties] operator[SEP] identifier[GlobalProperties] identifier[gProps] , identifier[LocalProperties] identifier[lProps] , identifier[Channel] identifier[initialInput] operator[SEP] {
Keyword[this] operator[SEP] identifier[cachedPlans] operator[=] identifier[Collections] operator[SEP] operator[<] identifier[PlanNode] operator[>] identifier[singletonList] operator[SEP] Keyword[new] identifier[SolutionSetPlanNode] operator[SEP] Keyword[this] , literal[String] operator[+] Keyword[this] operator[SEP] identifier[getOperator] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] , identifier[gProps] , identifier[lProps] , identifier[initialInput] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void unregisterMXBean(CacheProxy<?, ?> cache, MBeanType type) {
ObjectName objectName = getObjectName(cache, type);
unregister(objectName);
} | class class_name[name] begin[{]
method[unregisterMXBean, return_type[void], modifier[public static], parameter[cache, type]] begin[{]
local_variable[type[ObjectName], objectName]
call[.unregister, parameter[member[.objectName]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[unregisterMXBean] operator[SEP] identifier[CacheProxy] operator[<] operator[?] , operator[?] operator[>] identifier[cache] , identifier[MBeanType] identifier[type] operator[SEP] {
identifier[ObjectName] identifier[objectName] operator[=] identifier[getObjectName] operator[SEP] identifier[cache] , identifier[type] operator[SEP] operator[SEP] identifier[unregister] operator[SEP] identifier[objectName] operator[SEP] operator[SEP]
}
|
public InputStream fetch(URL url) throws DownloadFailedException {
if ("file".equalsIgnoreCase(url.getProtocol())) {
final File file;
try {
file = new File(url.toURI());
} catch (URISyntaxException ex) {
final String msg = format("Download failed, unable to locate '%s'", url.toString());
throw new DownloadFailedException(msg);
}
if (file.exists()) {
try {
return new FileInputStream(file);
} catch (IOException ex) {
final String msg = format("Download failed, unable to rerieve '%s'", url.toString());
throw new DownloadFailedException(msg, ex);
}
} else {
final String msg = format("Download failed, file ('%s') does not exist", url.toString());
throw new DownloadFailedException(msg);
}
} else {
if (connection != null) {
LOGGER.warn("HTTP URL Connection was not properly closed");
connection.disconnect();
connection = null;
}
connection = obtainConnection(url);
final String encoding = connection.getContentEncoding();
try {
if (encoding != null && "gzip".equalsIgnoreCase(encoding)) {
return new GZIPInputStream(connection.getInputStream());
} else if (encoding != null && "deflate".equalsIgnoreCase(encoding)) {
return new InflaterInputStream(connection.getInputStream());
} else {
return connection.getInputStream();
}
} catch (IOException ex) {
checkForCommonExceptionTypes(ex);
final String msg = format("Error retrieving '%s'%nConnection Timeout: %d%nEncoding: %s%n",
url.toString(), connection.getConnectTimeout(), encoding);
throw new DownloadFailedException(msg, ex);
} catch (Exception ex) {
final String msg = format("Unexpected exception retrieving '%s'%nConnection Timeout: %d%nEncoding: %s%n",
url.toString(), connection.getConnectTimeout(), encoding);
throw new DownloadFailedException(msg, ex);
}
}
} | class class_name[name] begin[{]
method[fetch, return_type[type[InputStream]], modifier[public], parameter[url]] begin[{]
if[literal["file"]] begin[{]
local_variable[type[File], file]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MethodInvocation(arguments=[], member=toURI, postfix_operators=[], prefix_operators=[], qualifier=url, 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))), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Download failed, unable to locate '%s'"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=msg)], modifiers={'final'}, 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=DownloadFailedException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['URISyntaxException']))], finally_block=None, label=None, resources=None)
if[call[file.exists, parameter[]]] begin[{]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None)), label=None)], catches=[CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Download failed, unable to rerieve '%s'"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None)], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=msg)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=DownloadFailedException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
local_variable[type[String], msg]
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=DownloadFailedException, sub_type=None)), label=None)
end[}]
else begin[{]
if[binary_operation[member[.connection], !=, literal[null]]] begin[{]
call[LOGGER.warn, parameter[literal["HTTP URL Connection was not properly closed"]]]
call[connection.disconnect, parameter[]]
assign[member[.connection], literal[null]]
else begin[{]
None
end[}]
assign[member[.connection], call[.obtainConnection, parameter[member[.url]]]]
local_variable[type[String], encoding]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="gzip"), operator=&&), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="deflate"), operator=&&), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InflaterInputStream, sub_type=None)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GZIPInputStream, sub_type=None)), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkForCommonExceptionTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error retrieving '%s'%nConnection Timeout: %d%nEncoding: %s%n"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getConnectTimeout, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None), MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=msg)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=DownloadFailedException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException'])), CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unexpected exception retrieving '%s'%nConnection Timeout: %d%nEncoding: %s%n"), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getConnectTimeout, postfix_operators=[], prefix_operators=[], qualifier=connection, selectors=[], type_arguments=None), MemberReference(member=encoding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=msg)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=msg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=DownloadFailedException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
end[}]
END[}] | Keyword[public] identifier[InputStream] identifier[fetch] operator[SEP] identifier[URL] identifier[url] operator[SEP] Keyword[throws] identifier[DownloadFailedException] {
Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[url] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[File] identifier[file] operator[SEP] Keyword[try] {
identifier[file] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[url] operator[SEP] identifier[toURI] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[URISyntaxException] identifier[ex] operator[SEP] {
Keyword[final] identifier[String] identifier[msg] operator[=] identifier[format] operator[SEP] literal[String] , identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[DownloadFailedException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[return] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[file] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ex] operator[SEP] {
Keyword[final] identifier[String] identifier[msg] operator[=] identifier[format] operator[SEP] literal[String] , identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[DownloadFailedException] operator[SEP] identifier[msg] , identifier[ex] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[final] identifier[String] identifier[msg] operator[=] identifier[format] operator[SEP] literal[String] , identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[DownloadFailedException] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[connection] operator[!=] Other[null] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[connection] operator[SEP] identifier[disconnect] operator[SEP] operator[SEP] operator[SEP] identifier[connection] operator[=] Other[null] operator[SEP]
}
identifier[connection] operator[=] identifier[obtainConnection] operator[SEP] identifier[url] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[encoding] operator[=] identifier[connection] operator[SEP] identifier[getContentEncoding] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[encoding] operator[!=] Other[null] operator[&&] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[GZIPInputStream] operator[SEP] identifier[connection] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[encoding] operator[!=] Other[null] operator[&&] literal[String] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[encoding] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[InflaterInputStream] operator[SEP] identifier[connection] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[connection] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ex] operator[SEP] {
identifier[checkForCommonExceptionTypes] operator[SEP] identifier[ex] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[msg] operator[=] identifier[format] operator[SEP] literal[String] , identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[connection] operator[SEP] identifier[getConnectTimeout] operator[SEP] operator[SEP] , identifier[encoding] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[DownloadFailedException] operator[SEP] identifier[msg] , identifier[ex] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[final] identifier[String] identifier[msg] operator[=] identifier[format] operator[SEP] literal[String] , identifier[url] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[connection] operator[SEP] identifier[getConnectTimeout] operator[SEP] operator[SEP] , identifier[encoding] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[DownloadFailedException] operator[SEP] identifier[msg] , identifier[ex] operator[SEP] operator[SEP]
}
}
}
|
public void setClearVisible(boolean visible) {
if (mClearButtonEnabled) {
final Drawable d = (visible ? mTappableDrawable : null);
final Drawable[] drawables = getCompoundDrawables();
if (drawables != null) {
setCompoundDrawables(drawables[0], drawables[1], d, drawables[3]);
} else {
Log.w(TAG, "No clear button is available.");
}
}
} | class class_name[name] begin[{]
method[setClearVisible, return_type[void], modifier[public], parameter[visible]] begin[{]
if[member[.mClearButtonEnabled]] begin[{]
local_variable[type[Drawable], d]
local_variable[type[Drawable], drawables]
if[binary_operation[member[.drawables], !=, literal[null]]] begin[{]
call[.setCompoundDrawables, parameter[member[.drawables], member[.drawables], member[.d], member[.drawables]]]
else begin[{]
call[Log.w, parameter[member[.TAG], literal["No clear button is available."]]]
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setClearVisible] operator[SEP] Keyword[boolean] identifier[visible] operator[SEP] {
Keyword[if] operator[SEP] identifier[mClearButtonEnabled] operator[SEP] {
Keyword[final] identifier[Drawable] identifier[d] operator[=] operator[SEP] identifier[visible] operator[?] identifier[mTappableDrawable] operator[:] Other[null] operator[SEP] operator[SEP] Keyword[final] identifier[Drawable] operator[SEP] operator[SEP] identifier[drawables] operator[=] identifier[getCompoundDrawables] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[drawables] operator[!=] Other[null] operator[SEP] {
identifier[setCompoundDrawables] operator[SEP] identifier[drawables] operator[SEP] Other[0] operator[SEP] , identifier[drawables] operator[SEP] Other[1] operator[SEP] , identifier[d] , identifier[drawables] operator[SEP] Other[3] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Log] operator[SEP] identifier[w] operator[SEP] identifier[TAG] , literal[String] operator[SEP] operator[SEP]
}
}
}
|
public static KeyPair generateKeyPair(int keySize) throws NoSuchAlgorithmException {
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
keyPairGenerator.initialize(keySize);
KeyPair keyPair = keyPairGenerator.genKeyPair();
return keyPair;
} | class class_name[name] begin[{]
method[generateKeyPair, return_type[type[KeyPair]], modifier[public static], parameter[keySize]] begin[{]
local_variable[type[KeyPairGenerator], keyPairGenerator]
call[keyPairGenerator.initialize, parameter[member[.keySize]]]
local_variable[type[KeyPair], keyPair]
return[member[.keyPair]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[KeyPair] identifier[generateKeyPair] operator[SEP] Keyword[int] identifier[keySize] operator[SEP] Keyword[throws] identifier[NoSuchAlgorithmException] {
identifier[KeyPairGenerator] identifier[keyPairGenerator] operator[=] identifier[KeyPairGenerator] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[keyPairGenerator] operator[SEP] identifier[initialize] operator[SEP] identifier[keySize] operator[SEP] operator[SEP] identifier[KeyPair] identifier[keyPair] operator[=] identifier[keyPairGenerator] operator[SEP] identifier[genKeyPair] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[keyPair] operator[SEP]
}
|
public java.util.List<SchemaExtensionInfo> getSchemaExtensionsInfo() {
if (schemaExtensionsInfo == null) {
schemaExtensionsInfo = new com.amazonaws.internal.SdkInternalList<SchemaExtensionInfo>();
}
return schemaExtensionsInfo;
} | class class_name[name] begin[{]
method[getSchemaExtensionsInfo, return_type[type[java]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.schemaExtensionsInfo], ==, literal[null]]] begin[{]
assign[member[.schemaExtensionsInfo], ClassCreator(arguments=[], 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=SchemaExtensionInfo, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
else begin[{]
None
end[}]
return[member[.schemaExtensionsInfo]]
end[}]
END[}] | Keyword[public] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[List] operator[<] identifier[SchemaExtensionInfo] operator[>] identifier[getSchemaExtensionsInfo] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[schemaExtensionsInfo] operator[==] Other[null] operator[SEP] {
identifier[schemaExtensionsInfo] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[SchemaExtensionInfo] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[schemaExtensionsInfo] operator[SEP]
}
|
public void addExtraCapabilities(DesiredCapabilities extraCapabilities) {
if (extraCapabilities != null && browser.getName() != BrowserName.NONE) {
desiredCapabilities = desiredCapabilities.merge(extraCapabilities);
}
} | class class_name[name] begin[{]
method[addExtraCapabilities, return_type[void], modifier[public], parameter[extraCapabilities]] begin[{]
if[binary_operation[binary_operation[member[.extraCapabilities], !=, literal[null]], &&, binary_operation[call[browser.getName, parameter[]], !=, member[BrowserName.NONE]]]] begin[{]
assign[member[.desiredCapabilities], call[desiredCapabilities.merge, parameter[member[.extraCapabilities]]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addExtraCapabilities] operator[SEP] identifier[DesiredCapabilities] identifier[extraCapabilities] operator[SEP] {
Keyword[if] operator[SEP] identifier[extraCapabilities] operator[!=] Other[null] operator[&&] identifier[browser] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[!=] identifier[BrowserName] operator[SEP] identifier[NONE] operator[SEP] {
identifier[desiredCapabilities] operator[=] identifier[desiredCapabilities] operator[SEP] identifier[merge] operator[SEP] identifier[extraCapabilities] operator[SEP] operator[SEP]
}
}
|
public void saveTxt(String file) throws Exception {
FileOutputStream fos = new FileOutputStream(file);
BufferedWriter bout = new BufferedWriter(new OutputStreamWriter(
fos, "UTF8"));
bout.write(this.toString());
bout.close();
} | class class_name[name] begin[{]
method[saveTxt, return_type[void], modifier[public], parameter[file]] begin[{]
local_variable[type[FileOutputStream], fos]
local_variable[type[BufferedWriter], bout]
call[bout.write, parameter[THIS[call[None.toString, parameter[]]]]]
call[bout.close, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[saveTxt] operator[SEP] identifier[String] identifier[file] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[FileOutputStream] identifier[fos] operator[=] Keyword[new] identifier[FileOutputStream] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[BufferedWriter] identifier[bout] operator[=] Keyword[new] identifier[BufferedWriter] operator[SEP] Keyword[new] identifier[OutputStreamWriter] operator[SEP] identifier[fos] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[bout] operator[SEP] identifier[write] operator[SEP] Keyword[this] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[bout] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
|
public CompletableFuture<Boolean> drain(Duration timeout) throws InterruptedException {
if (!this.isActive() || this.connection==null) {
throw new IllegalStateException("Consumer is closed");
}
if (isDraining()) {
return this.getDrainingFuture();
}
Instant start = Instant.now();
final CompletableFuture<Boolean> tracker = new CompletableFuture<>();
this.markDraining(tracker);
this.sendUnsubForDrain();
try {
this.connection.flush(timeout); // Flush and wait up to the timeout
} catch (TimeoutException e) {
this.connection.processException(e);
}
this.markUnsubedForDrain();
// Wait for the timeout or the pending count to go to 0, skipped if conn is
// draining
connection.getExecutor().submit(() -> {
try {
Instant now = Instant.now();
while (timeout == null || timeout.equals(Duration.ZERO)
|| Duration.between(start, now).compareTo(timeout) < 0) {
if (this.isDrained()) {
break;
}
Thread.sleep(1); // Sleep 1 milli
now = Instant.now();
}
this.cleanUpAfterDrain();
} catch (InterruptedException e) {
this.connection.processException(e);
} finally {
tracker.complete(this.isDrained());
}
});
return getDrainingFuture();
} | class class_name[name] begin[{]
method[drain, return_type[type[CompletableFuture]], modifier[public], parameter[timeout]] begin[{]
if[binary_operation[THIS[call[None.isActive, parameter[]]], ||, binary_operation[THIS[member[None.connection]], ==, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Consumer is closed")], 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[}]
if[call[.isDraining, parameter[]]] begin[{]
return[THIS[call[None.getDrainingFuture, parameter[]]]]
else begin[{]
None
end[}]
local_variable[type[Instant], start]
local_variable[type[CompletableFuture], tracker]
THIS[call[None.markDraining, parameter[member[.tracker]]]]
THIS[call[None.sendUnsubForDrain, parameter[]]]
TryStatement(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=connection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=timeout, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=flush, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], catches=[CatchClause(block=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=connection, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processException, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TimeoutException']))], finally_block=None, label=None, resources=None)
THIS[call[None.markUnsubedForDrain, parameter[]]]
call[connection.getExecutor, parameter[]]
return[call[.getDrainingFuture, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[CompletableFuture] operator[<] identifier[Boolean] operator[>] identifier[drain] operator[SEP] identifier[Duration] identifier[timeout] operator[SEP] Keyword[throws] identifier[InterruptedException] {
Keyword[if] operator[SEP] operator[!] Keyword[this] operator[SEP] identifier[isActive] operator[SEP] operator[SEP] operator[||] Keyword[this] operator[SEP] identifier[connection] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isDraining] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[getDrainingFuture] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Instant] identifier[start] operator[=] identifier[Instant] operator[SEP] identifier[now] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[CompletableFuture] operator[<] identifier[Boolean] operator[>] identifier[tracker] operator[=] Keyword[new] identifier[CompletableFuture] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[markDraining] operator[SEP] identifier[tracker] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[sendUnsubForDrain] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[this] operator[SEP] identifier[connection] operator[SEP] identifier[flush] operator[SEP] identifier[timeout] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TimeoutException] identifier[e] operator[SEP] {
Keyword[this] operator[SEP] identifier[connection] operator[SEP] identifier[processException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[markUnsubedForDrain] operator[SEP] operator[SEP] operator[SEP] identifier[connection] operator[SEP] identifier[getExecutor] operator[SEP] operator[SEP] operator[SEP] identifier[submit] operator[SEP] operator[SEP] operator[SEP] operator[->] {
Keyword[try] {
identifier[Instant] identifier[now] operator[=] identifier[Instant] operator[SEP] identifier[now] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[timeout] operator[==] Other[null] operator[||] identifier[timeout] operator[SEP] identifier[equals] operator[SEP] identifier[Duration] operator[SEP] identifier[ZERO] operator[SEP] operator[||] identifier[Duration] operator[SEP] identifier[between] operator[SEP] identifier[start] , identifier[now] operator[SEP] operator[SEP] identifier[compareTo] operator[SEP] identifier[timeout] operator[SEP] operator[<] Other[0] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[isDrained] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[Thread] operator[SEP] identifier[sleep] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[now] operator[=] identifier[Instant] operator[SEP] identifier[now] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[cleanUpAfterDrain] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[InterruptedException] identifier[e] operator[SEP] {
Keyword[this] operator[SEP] identifier[connection] operator[SEP] identifier[processException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[tracker] operator[SEP] identifier[complete] operator[SEP] Keyword[this] operator[SEP] identifier[isDrained] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] Keyword[return] identifier[getDrainingFuture] operator[SEP] operator[SEP] operator[SEP]
}
|
protected Object coerceToType(Object param, Class<?> type)
throws Throwable {
if (type != Object.class)
param = Types.castObject(param, type, Types.CAST);
return Primitive.unwrap(param);
} | class class_name[name] begin[{]
method[coerceToType, return_type[type[Object]], modifier[protected], parameter[param, type]] begin[{]
if[binary_operation[member[.type], !=, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]] begin[{]
assign[member[.param], call[Types.castObject, parameter[member[.param], member[.type], member[Types.CAST]]]]
else begin[{]
None
end[}]
return[call[Primitive.unwrap, parameter[member[.param]]]]
end[}]
END[}] | Keyword[protected] identifier[Object] identifier[coerceToType] operator[SEP] identifier[Object] identifier[param] , identifier[Class] operator[<] operator[?] operator[>] identifier[type] operator[SEP] Keyword[throws] identifier[Throwable] {
Keyword[if] operator[SEP] identifier[type] operator[!=] identifier[Object] operator[SEP] Keyword[class] operator[SEP] identifier[param] operator[=] identifier[Types] operator[SEP] identifier[castObject] operator[SEP] identifier[param] , identifier[type] , identifier[Types] operator[SEP] identifier[CAST] operator[SEP] operator[SEP] Keyword[return] identifier[Primitive] operator[SEP] identifier[unwrap] operator[SEP] identifier[param] operator[SEP] operator[SEP]
}
|
public List<RTMovie> getMoviesSearch(String query, int pageLimit, int page) throws RottenTomatoesException {
properties.clear();
properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIES_SEARCH);
properties.put(ApiBuilder.PROPERTY_PAGE_LIMIT, ApiBuilder.validatePageLimit(pageLimit));
properties.put(ApiBuilder.PROPERTY_PAGE, ApiBuilder.validatePage(page));
try {
properties.put(ApiBuilder.PROPERTY_QUERY, URLEncoder.encode(query, ENCODING_UTF8));
} catch (UnsupportedEncodingException ex) {
throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, "Failed to encode URL", query, ex);
}
WrapperLists wrapper = response.getResponse(WrapperLists.class, properties);
if (wrapper != null && wrapper.getMovies() != null) {
return wrapper.getMovies();
} else {
return Collections.emptyList();
}
} | class class_name[name] begin[{]
method[getMoviesSearch, return_type[type[List]], modifier[public], parameter[query, pageLimit, page]] begin[{]
call[properties.clear, parameter[]]
call[properties.put, parameter[member[ApiBuilder.PROPERTY_URL], member[.URL_MOVIES_SEARCH]]]
call[properties.put, parameter[member[ApiBuilder.PROPERTY_PAGE_LIMIT], call[ApiBuilder.validatePageLimit, parameter[member[.pageLimit]]]]]
call[properties.put, parameter[member[ApiBuilder.PROPERTY_PAGE], call[ApiBuilder.validatePage, parameter[member[.page]]]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=PROPERTY_QUERY, postfix_operators=[], prefix_operators=[], qualifier=ApiBuilder, selectors=[]), MethodInvocation(arguments=[MemberReference(member=query, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ENCODING_UTF8, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=encode, postfix_operators=[], prefix_operators=[], qualifier=URLEncoder, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=MAPPING_FAILED, postfix_operators=[], prefix_operators=[], qualifier=ApiExceptionType, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to encode URL"), MemberReference(member=query, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=RottenTomatoesException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
local_variable[type[WrapperLists], wrapper]
if[binary_operation[binary_operation[member[.wrapper], !=, literal[null]], &&, binary_operation[call[wrapper.getMovies, parameter[]], !=, literal[null]]]] begin[{]
return[call[wrapper.getMovies, parameter[]]]
else begin[{]
return[call[Collections.emptyList, parameter[]]]
end[}]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[RTMovie] operator[>] identifier[getMoviesSearch] operator[SEP] identifier[String] identifier[query] , Keyword[int] identifier[pageLimit] , Keyword[int] identifier[page] operator[SEP] Keyword[throws] identifier[RottenTomatoesException] {
identifier[properties] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] identifier[properties] operator[SEP] identifier[put] operator[SEP] identifier[ApiBuilder] operator[SEP] identifier[PROPERTY_URL] , identifier[URL_MOVIES_SEARCH] operator[SEP] operator[SEP] identifier[properties] operator[SEP] identifier[put] operator[SEP] identifier[ApiBuilder] operator[SEP] identifier[PROPERTY_PAGE_LIMIT] , identifier[ApiBuilder] operator[SEP] identifier[validatePageLimit] operator[SEP] identifier[pageLimit] operator[SEP] operator[SEP] operator[SEP] identifier[properties] operator[SEP] identifier[put] operator[SEP] identifier[ApiBuilder] operator[SEP] identifier[PROPERTY_PAGE] , identifier[ApiBuilder] operator[SEP] identifier[validatePage] operator[SEP] identifier[page] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[properties] operator[SEP] identifier[put] operator[SEP] identifier[ApiBuilder] operator[SEP] identifier[PROPERTY_QUERY] , identifier[URLEncoder] operator[SEP] identifier[encode] operator[SEP] identifier[query] , identifier[ENCODING_UTF8] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RottenTomatoesException] operator[SEP] identifier[ApiExceptionType] operator[SEP] identifier[MAPPING_FAILED] , literal[String] , identifier[query] , identifier[ex] operator[SEP] operator[SEP]
}
identifier[WrapperLists] identifier[wrapper] operator[=] identifier[response] operator[SEP] identifier[getResponse] operator[SEP] identifier[WrapperLists] operator[SEP] Keyword[class] , identifier[properties] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[wrapper] operator[!=] Other[null] operator[&&] identifier[wrapper] operator[SEP] identifier[getMovies] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[wrapper] operator[SEP] identifier[getMovies] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Collections] operator[SEP] identifier[emptyList] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public ActivityInfo addReceiverIfNotPresent(ComponentName componentName) {
return addComponent(
receiverFilters,
p -> p.receivers,
(p, a) -> p.receivers = a,
updateName(componentName, new ActivityInfo()),
false);
} | class class_name[name] begin[{]
method[addReceiverIfNotPresent, return_type[type[ActivityInfo]], modifier[public], parameter[componentName]] begin[{]
return[call[.addComponent, parameter[member[.receiverFilters], LambdaExpression(body=MemberReference(member=receivers, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[]), parameters=[MemberReference(member=p, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), LambdaExpression(body=Assignment(expressionl=MemberReference(member=receivers, postfix_operators=[], prefix_operators=[], qualifier=p, selectors=[]), type==, value=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), parameters=[InferredFormalParameter(name=p), InferredFormalParameter(name=a)]), call[.updateName, parameter[member[.componentName], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ActivityInfo, sub_type=None))]], literal[false]]]]
end[}]
END[}] | Keyword[public] identifier[ActivityInfo] identifier[addReceiverIfNotPresent] operator[SEP] identifier[ComponentName] identifier[componentName] operator[SEP] {
Keyword[return] identifier[addComponent] operator[SEP] identifier[receiverFilters] , identifier[p] operator[->] identifier[p] operator[SEP] identifier[receivers] , operator[SEP] identifier[p] , identifier[a] operator[SEP] operator[->] identifier[p] operator[SEP] identifier[receivers] operator[=] identifier[a] , identifier[updateName] operator[SEP] identifier[componentName] , Keyword[new] identifier[ActivityInfo] operator[SEP] operator[SEP] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
|
private boolean ownerCanReadTable(String ownerId, String table) {
return _internalAuthorizer.hasPermissionById(ownerId, getReadPermission(table));
} | class class_name[name] begin[{]
method[ownerCanReadTable, return_type[type[boolean]], modifier[private], parameter[ownerId, table]] begin[{]
return[call[_internalAuthorizer.hasPermissionById, parameter[member[.ownerId], call[.getReadPermission, parameter[member[.table]]]]]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[ownerCanReadTable] operator[SEP] identifier[String] identifier[ownerId] , identifier[String] identifier[table] operator[SEP] {
Keyword[return] identifier[_internalAuthorizer] operator[SEP] identifier[hasPermissionById] operator[SEP] identifier[ownerId] , identifier[getReadPermission] operator[SEP] identifier[table] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(StaticKeyProvider staticKeyProvider, ProtocolMarshaller protocolMarshaller) {
if (staticKeyProvider == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(staticKeyProvider.getKeyFormat(), KEYFORMAT_BINDING);
protocolMarshaller.marshall(staticKeyProvider.getKeyFormatVersions(), KEYFORMATVERSIONS_BINDING);
protocolMarshaller.marshall(staticKeyProvider.getStaticKeyValue(), STATICKEYVALUE_BINDING);
protocolMarshaller.marshall(staticKeyProvider.getUrl(), URL_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[staticKeyProvider, protocolMarshaller]] begin[{]
if[binary_operation[member[.staticKeyProvider], ==, 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=getKeyFormat, postfix_operators=[], prefix_operators=[], qualifier=staticKeyProvider, selectors=[], type_arguments=None), MemberReference(member=KEYFORMAT_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=getKeyFormatVersions, postfix_operators=[], prefix_operators=[], qualifier=staticKeyProvider, selectors=[], type_arguments=None), MemberReference(member=KEYFORMATVERSIONS_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=getStaticKeyValue, postfix_operators=[], prefix_operators=[], qualifier=staticKeyProvider, selectors=[], type_arguments=None), MemberReference(member=STATICKEYVALUE_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=getUrl, postfix_operators=[], prefix_operators=[], qualifier=staticKeyProvider, selectors=[], type_arguments=None), MemberReference(member=URL_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[StaticKeyProvider] identifier[staticKeyProvider] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[staticKeyProvider] 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[staticKeyProvider] operator[SEP] identifier[getKeyFormat] operator[SEP] operator[SEP] , identifier[KEYFORMAT_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[staticKeyProvider] operator[SEP] identifier[getKeyFormatVersions] operator[SEP] operator[SEP] , identifier[KEYFORMATVERSIONS_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[staticKeyProvider] operator[SEP] identifier[getStaticKeyValue] operator[SEP] operator[SEP] , identifier[STATICKEYVALUE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[staticKeyProvider] operator[SEP] identifier[getUrl] operator[SEP] operator[SEP] , identifier[URL_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]
}
}
|
@Nullable
public static Object triggerSynchronous (@Nonnull final IEvent aEvent)
{
ValueEnforcer.notNull (aEvent, "Event");
final ICommonsList <Object> aRetValues = new CommonsArrayList <> ();
// for all scopes
for (final EScope eCurrentScope : EScope.values ())
{
// get current instance of scope
final IScope aScope = _getScope (eCurrentScope, false);
if (aScope != null)
{
// get event manager (may be null)
final InternalScopedEventManager aEventMgr = _getEventMgr (aScope);
if (aEventMgr != null)
{
// main event trigger
aRetValues.add (aEventMgr.triggerSynchronous (aEvent));
}
}
}
return aEvent.getResultAggregator ().apply (aRetValues);
} | class class_name[name] begin[{]
method[triggerSynchronous, return_type[type[Object]], modifier[public static], parameter[aEvent]] begin[{]
call[ValueEnforcer.notNull, parameter[member[.aEvent], literal["Event"]]]
local_variable[type[ICommonsList], aRetValues]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=eCurrentScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=_getScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=aScope)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=IScope, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=aScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=aScope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=_getEventMgr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=aEventMgr)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=InternalScopedEventManager, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=aEventMgr, 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=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=aEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=triggerSynchronous, postfix_operators=[], prefix_operators=[], qualifier=aEventMgr, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=aRetValues, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=EScope, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=eCurrentScope)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=EScope, sub_type=None))), label=None)
return[call[aEvent.getResultAggregator, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] Keyword[static] identifier[Object] identifier[triggerSynchronous] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[IEvent] identifier[aEvent] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[notNull] operator[SEP] identifier[aEvent] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[ICommonsList] operator[<] identifier[Object] operator[>] identifier[aRetValues] operator[=] Keyword[new] identifier[CommonsArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[EScope] identifier[eCurrentScope] operator[:] identifier[EScope] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[IScope] identifier[aScope] operator[=] identifier[_getScope] operator[SEP] identifier[eCurrentScope] , literal[boolean] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[aScope] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[InternalScopedEventManager] identifier[aEventMgr] operator[=] identifier[_getEventMgr] operator[SEP] identifier[aScope] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[aEventMgr] operator[!=] Other[null] operator[SEP] {
identifier[aRetValues] operator[SEP] identifier[add] operator[SEP] identifier[aEventMgr] operator[SEP] identifier[triggerSynchronous] operator[SEP] identifier[aEvent] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[aEvent] operator[SEP] identifier[getResultAggregator] operator[SEP] operator[SEP] operator[SEP] identifier[apply] operator[SEP] identifier[aRetValues] operator[SEP] operator[SEP]
}
|
public BitapMatcher substitutionAndIndelMatcherFirst(int maxNumberOfErrors, final Sequence sequence) {
return substitutionAndIndelMatcherFirst(maxNumberOfErrors, sequence, 0, sequence.size());
} | class class_name[name] begin[{]
method[substitutionAndIndelMatcherFirst, return_type[type[BitapMatcher]], modifier[public], parameter[maxNumberOfErrors, sequence]] begin[{]
return[call[.substitutionAndIndelMatcherFirst, parameter[member[.maxNumberOfErrors], member[.sequence], literal[0], call[sequence.size, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[BitapMatcher] identifier[substitutionAndIndelMatcherFirst] operator[SEP] Keyword[int] identifier[maxNumberOfErrors] , Keyword[final] identifier[Sequence] identifier[sequence] operator[SEP] {
Keyword[return] identifier[substitutionAndIndelMatcherFirst] operator[SEP] identifier[maxNumberOfErrors] , identifier[sequence] , Other[0] , identifier[sequence] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public LaContainer build(String path, ClassLoader classLoader) {
final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
try {
if (classLoader != null) {
Thread.currentThread().setContextClassLoader(classLoader);
}
return build(path);
} finally {
Thread.currentThread().setContextClassLoader(oldLoader);
}
} | class class_name[name] begin[{]
method[build, return_type[type[LaContainer]], modifier[public], parameter[path, classLoader]] begin[{]
local_variable[type[ClassLoader], oldLoader]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=classLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=currentThread, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[MethodInvocation(arguments=[MemberReference(member=classLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContextClassLoader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=build, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=currentThread, postfix_operators=[], prefix_operators=[], qualifier=Thread, selectors=[MethodInvocation(arguments=[MemberReference(member=oldLoader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContextClassLoader, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[LaContainer] identifier[build] operator[SEP] identifier[String] identifier[path] , identifier[ClassLoader] identifier[classLoader] operator[SEP] {
Keyword[final] identifier[ClassLoader] identifier[oldLoader] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getContextClassLoader] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[classLoader] operator[!=] Other[null] operator[SEP] {
identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[setContextClassLoader] operator[SEP] identifier[classLoader] operator[SEP] operator[SEP]
}
Keyword[return] identifier[build] operator[SEP] identifier[path] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[setContextClassLoader] operator[SEP] identifier[oldLoader] operator[SEP] operator[SEP]
}
}
|
@Nullable
public String readLine () throws IOException
{
StringBuilder aSB = null;
int nStartChar;
_ensureOpen ();
boolean bOmitLF = m_bSkipLF;
while (true)
{
if (m_nNextCharIndex >= m_nChars)
_fill ();
if (m_nNextCharIndex >= m_nChars)
{
/* EOF */
if (StringHelper.hasText (aSB))
return aSB.toString ();
return null;
}
boolean bEOL = false;
char cLast = 0;
int nIndex;
/* Skip a leftover '\n', if necessary */
if (bOmitLF && m_aBuf[m_nNextCharIndex] == '\n')
m_nNextCharIndex++;
m_bSkipLF = false;
bOmitLF = false;
for (nIndex = m_nNextCharIndex; nIndex < m_nChars; nIndex++)
{
cLast = m_aBuf[nIndex];
if (cLast == '\n' || cLast == '\r')
{
bEOL = true;
break;
}
}
nStartChar = m_nNextCharIndex;
m_nNextCharIndex = nIndex;
if (bEOL)
{
String sRet;
if (aSB == null)
sRet = new String (m_aBuf, nStartChar, nIndex - nStartChar);
else
{
aSB.append (m_aBuf, nStartChar, nIndex - nStartChar);
sRet = aSB.toString ();
}
m_nNextCharIndex++;
if (cLast == '\r')
m_bSkipLF = true;
return sRet;
}
if (aSB == null)
aSB = new StringBuilder (DEFAULT_EXPECTED_LINE_LENGTH);
aSB.append (m_aBuf, nStartChar, nIndex - nStartChar);
}
} | class class_name[name] begin[{]
method[readLine, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[StringBuilder], aSB]
local_variable[type[int], nStartChar]
call[._ensureOpen, parameter[]]
local_variable[type[boolean], bOmitLF]
while[literal[true]] begin[{]
if[binary_operation[member[.m_nNextCharIndex], >=, member[.m_nChars]]] begin[{]
call[._fill, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[.m_nNextCharIndex], >=, member[.m_nChars]]] begin[{]
if[call[StringHelper.hasText, parameter[member[.aSB]]]] begin[{]
return[call[aSB.toString, parameter[]]]
else begin[{]
None
end[}]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[boolean], bEOL]
local_variable[type[char], cLast]
local_variable[type[int], nIndex]
if[binary_operation[member[.bOmitLF], &&, binary_operation[member[.m_aBuf], ==, literal['\n']]]] begin[{]
member[.m_nNextCharIndex]
else begin[{]
None
end[}]
assign[member[.m_bSkipLF], literal[false]]
assign[member[.bOmitLF], literal[false]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cLast, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=m_aBuf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=nIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=cLast, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\n'), operator===), operandr=BinaryOperation(operandl=MemberReference(member=cLast, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\r'), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bEOL, 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=nIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=m_nChars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=[Assignment(expressionl=MemberReference(member=nIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=m_nNextCharIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], update=[MemberReference(member=nIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
assign[member[.nStartChar], member[.m_nNextCharIndex]]
assign[member[.m_nNextCharIndex], member[.nIndex]]
if[member[.bEOL]] begin[{]
local_variable[type[String], sRet]
if[binary_operation[member[.aSB], ==, literal[null]]] begin[{]
assign[member[.sRet], ClassCreator(arguments=[MemberReference(member=m_aBuf, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nStartChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=MemberReference(member=nIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nStartChar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
else begin[{]
call[aSB.append, parameter[member[.m_aBuf], member[.nStartChar], binary_operation[member[.nIndex], -, member[.nStartChar]]]]
assign[member[.sRet], call[aSB.toString, parameter[]]]
end[}]
member[.m_nNextCharIndex]
if[binary_operation[member[.cLast], ==, literal['\r']]] begin[{]
assign[member[.m_bSkipLF], literal[true]]
else begin[{]
None
end[}]
return[member[.sRet]]
else begin[{]
None
end[}]
if[binary_operation[member[.aSB], ==, literal[null]]] begin[{]
assign[member[.aSB], ClassCreator(arguments=[MemberReference(member=DEFAULT_EXPECTED_LINE_LENGTH, 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=StringBuilder, sub_type=None))]
else begin[{]
None
end[}]
call[aSB.append, parameter[member[.m_aBuf], member[.nStartChar], binary_operation[member[.nIndex], -, member[.nStartChar]]]]
end[}]
end[}]
END[}] | annotation[@] identifier[Nullable] Keyword[public] identifier[String] identifier[readLine] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[StringBuilder] identifier[aSB] operator[=] Other[null] operator[SEP] Keyword[int] identifier[nStartChar] operator[SEP] identifier[_ensureOpen] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[bOmitLF] operator[=] identifier[m_bSkipLF] operator[SEP] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_nNextCharIndex] operator[>=] identifier[m_nChars] operator[SEP] identifier[_fill] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_nNextCharIndex] operator[>=] identifier[m_nChars] operator[SEP] {
Keyword[if] operator[SEP] identifier[StringHelper] operator[SEP] identifier[hasText] operator[SEP] identifier[aSB] operator[SEP] operator[SEP] Keyword[return] identifier[aSB] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[boolean] identifier[bEOL] operator[=] literal[boolean] operator[SEP] Keyword[char] identifier[cLast] operator[=] Other[0] operator[SEP] Keyword[int] identifier[nIndex] operator[SEP] Keyword[if] operator[SEP] identifier[bOmitLF] operator[&&] identifier[m_aBuf] operator[SEP] identifier[m_nNextCharIndex] operator[SEP] operator[==] literal[String] operator[SEP] identifier[m_nNextCharIndex] operator[++] operator[SEP] identifier[m_bSkipLF] operator[=] literal[boolean] operator[SEP] identifier[bOmitLF] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[nIndex] operator[=] identifier[m_nNextCharIndex] operator[SEP] identifier[nIndex] operator[<] identifier[m_nChars] operator[SEP] identifier[nIndex] operator[++] operator[SEP] {
identifier[cLast] operator[=] identifier[m_aBuf] operator[SEP] identifier[nIndex] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cLast] operator[==] literal[String] operator[||] identifier[cLast] operator[==] literal[String] operator[SEP] {
identifier[bEOL] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
identifier[nStartChar] operator[=] identifier[m_nNextCharIndex] operator[SEP] identifier[m_nNextCharIndex] operator[=] identifier[nIndex] operator[SEP] Keyword[if] operator[SEP] identifier[bEOL] operator[SEP] {
identifier[String] identifier[sRet] operator[SEP] Keyword[if] operator[SEP] identifier[aSB] operator[==] Other[null] operator[SEP] identifier[sRet] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[m_aBuf] , identifier[nStartChar] , identifier[nIndex] operator[-] identifier[nStartChar] operator[SEP] operator[SEP] Keyword[else] {
identifier[aSB] operator[SEP] identifier[append] operator[SEP] identifier[m_aBuf] , identifier[nStartChar] , identifier[nIndex] operator[-] identifier[nStartChar] operator[SEP] operator[SEP] identifier[sRet] operator[=] identifier[aSB] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
identifier[m_nNextCharIndex] operator[++] operator[SEP] Keyword[if] operator[SEP] identifier[cLast] operator[==] literal[String] operator[SEP] identifier[m_bSkipLF] operator[=] literal[boolean] operator[SEP] Keyword[return] identifier[sRet] operator[SEP]
}
Keyword[if] operator[SEP] identifier[aSB] operator[==] Other[null] operator[SEP] identifier[aSB] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[DEFAULT_EXPECTED_LINE_LENGTH] operator[SEP] operator[SEP] identifier[aSB] operator[SEP] identifier[append] operator[SEP] identifier[m_aBuf] , identifier[nStartChar] , identifier[nIndex] operator[-] identifier[nStartChar] operator[SEP] operator[SEP]
}
}
|
public void readTreeLevel(CmsObject cms, CmsUUID parentId) {
try {
CmsResource parent = cms.readResource(parentId, m_filter);
List<CmsResource> children = cms.readResources(parent, m_filter, false);
// sets the parent to leaf mode, in case no child folders are present
setChildrenAllowed(parentId, !children.isEmpty());
for (CmsResource resource : children) {
addTreeItem(cms, resource, parentId);
}
} catch (CmsException e) {
CmsErrorDialog.showErrorDialog(
CmsVaadinUtils.getMessageText(Messages.ERR_EXPLORER_CAN_NOT_READ_RESOURCE_1, parentId),
e);
LOG.error(e.getLocalizedMessage(), e);
}
} | class class_name[name] begin[{]
method[readTreeLevel, return_type[void], modifier[public], parameter[cms, parentId]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=parentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m_filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readResource, postfix_operators=[], prefix_operators=[], qualifier=cms, selectors=[], type_arguments=None), name=parent)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsResource, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=parent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m_filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=readResources, postfix_operators=[], prefix_operators=[], qualifier=cms, selectors=[], type_arguments=None), name=children)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CmsResource, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=parentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=children, selectors=[], type_arguments=None)], member=setChildrenAllowed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=resource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=parentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addTreeItem, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=children, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=resource)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsResource, sub_type=None))), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=ERR_EXPLORER_CAN_NOT_READ_RESOURCE_1, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[]), MemberReference(member=parentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMessageText, postfix_operators=[], prefix_operators=[], qualifier=CmsVaadinUtils, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=showErrorDialog, postfix_operators=[], prefix_operators=[], qualifier=CmsErrorDialog, selectors=[], type_arguments=None), label=None), 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=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CmsException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[readTreeLevel] operator[SEP] identifier[CmsObject] identifier[cms] , identifier[CmsUUID] identifier[parentId] operator[SEP] {
Keyword[try] {
identifier[CmsResource] identifier[parent] operator[=] identifier[cms] operator[SEP] identifier[readResource] operator[SEP] identifier[parentId] , identifier[m_filter] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[CmsResource] operator[>] identifier[children] operator[=] identifier[cms] operator[SEP] identifier[readResources] operator[SEP] identifier[parent] , identifier[m_filter] , literal[boolean] operator[SEP] operator[SEP] identifier[setChildrenAllowed] operator[SEP] identifier[parentId] , operator[!] identifier[children] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[CmsResource] identifier[resource] operator[:] identifier[children] operator[SEP] {
identifier[addTreeItem] operator[SEP] identifier[cms] , identifier[resource] , identifier[parentId] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[CmsException] identifier[e] operator[SEP] {
identifier[CmsErrorDialog] operator[SEP] identifier[showErrorDialog] operator[SEP] identifier[CmsVaadinUtils] operator[SEP] identifier[getMessageText] operator[SEP] identifier[Messages] operator[SEP] identifier[ERR_EXPLORER_CAN_NOT_READ_RESOURCE_1] , identifier[parentId] operator[SEP] , identifier[e] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
private boolean doSSLShutdown() {
if (SSL.isInInit(ssl) != 0) {
// Only try to call SSL_shutdown if we are not in the init state anymore.
// Otherwise we will see 'error:140E0197:SSL routines:SSL_shutdown:shutdown while in init' in our logs.
//
// See also http://hg.nginx.org/nginx/rev/062c189fee20
return false;
}
int err = SSL.shutdownSSL(ssl);
if (err < 0) {
int sslErr = SSL.getError(ssl, err);
if (sslErr == SSL.SSL_ERROR_SYSCALL || sslErr == SSL.SSL_ERROR_SSL) {
if (logger.isDebugEnabled()) {
int error = SSL.getLastErrorNumber();
logger.debug("SSL_shutdown failed: OpenSSL error: {} {}", error, SSL.getErrorString(error));
}
// There was an internal error -- shutdown
shutdown();
return false;
}
SSL.clearError();
}
return true;
} | class class_name[name] begin[{]
method[doSSLShutdown, return_type[type[boolean]], modifier[private], parameter[]] begin[{]
if[binary_operation[call[SSL.isInInit, parameter[member[.ssl]]], !=, literal[0]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
local_variable[type[int], err]
if[binary_operation[member[.err], <, literal[0]]] begin[{]
local_variable[type[int], sslErr]
if[binary_operation[binary_operation[member[.sslErr], ==, member[SSL.SSL_ERROR_SYSCALL]], ||, binary_operation[member[.sslErr], ==, member[SSL.SSL_ERROR_SSL]]]] begin[{]
if[call[logger.isDebugEnabled, parameter[]]] begin[{]
local_variable[type[int], error]
call[logger.debug, parameter[literal["SSL_shutdown failed: OpenSSL error: {} {}"], member[.error], call[SSL.getErrorString, parameter[member[.error]]]]]
else begin[{]
None
end[}]
call[.shutdown, parameter[]]
return[literal[false]]
else begin[{]
None
end[}]
call[SSL.clearError, parameter[]]
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[private] Keyword[boolean] identifier[doSSLShutdown] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[SSL] operator[SEP] identifier[isInInit] operator[SEP] identifier[ssl] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[int] identifier[err] operator[=] identifier[SSL] operator[SEP] identifier[shutdownSSL] operator[SEP] identifier[ssl] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[err] operator[<] Other[0] operator[SEP] {
Keyword[int] identifier[sslErr] operator[=] identifier[SSL] operator[SEP] identifier[getError] operator[SEP] identifier[ssl] , identifier[err] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sslErr] operator[==] identifier[SSL] operator[SEP] identifier[SSL_ERROR_SYSCALL] operator[||] identifier[sslErr] operator[==] identifier[SSL] operator[SEP] identifier[SSL_ERROR_SSL] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
Keyword[int] identifier[error] operator[=] identifier[SSL] operator[SEP] identifier[getLastErrorNumber] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[error] , identifier[SSL] operator[SEP] identifier[getErrorString] operator[SEP] identifier[error] operator[SEP] operator[SEP] operator[SEP]
}
identifier[shutdown] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP]
}
identifier[SSL] operator[SEP] identifier[clearError] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public void setQuery(String query) throws URIException {
if (query == null || query.length() == 0) {
_query = (query == null) ? null : query.toCharArray();
setURI();
return;
}
setRawQuery(encode(query, allowed_query, getProtocolCharset()));
} | class class_name[name] begin[{]
method[setQuery, return_type[void], modifier[public], parameter[query]] begin[{]
if[binary_operation[binary_operation[member[.query], ==, literal[null]], ||, binary_operation[call[query.length, parameter[]], ==, literal[0]]]] begin[{]
assign[member[._query], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=query, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toCharArray, postfix_operators=[], prefix_operators=[], qualifier=query, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
call[.setURI, parameter[]]
return[None]
else begin[{]
None
end[}]
call[.setRawQuery, parameter[call[.encode, parameter[member[.query], member[.allowed_query], call[.getProtocolCharset, parameter[]]]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setQuery] operator[SEP] identifier[String] identifier[query] operator[SEP] Keyword[throws] identifier[URIException] {
Keyword[if] operator[SEP] identifier[query] operator[==] Other[null] operator[||] identifier[query] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[_query] operator[=] operator[SEP] identifier[query] operator[==] Other[null] operator[SEP] operator[?] Other[null] operator[:] identifier[query] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] identifier[setURI] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[setRawQuery] operator[SEP] identifier[encode] operator[SEP] identifier[query] , identifier[allowed_query] , identifier[getProtocolCharset] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected T doSwitch(EClass theEClass, EObject theEObject) {
if (theEClass.eContainer() == modelPackage) {
return doSwitch(theEClass.getClassifierID(), theEObject);
}
else {
List<EClass> eSuperTypes = theEClass.getESuperTypes();
return
eSuperTypes.isEmpty() ?
defaultCase(theEObject) :
doSwitch(eSuperTypes.get(0), theEObject);
}
} | class class_name[name] begin[{]
method[doSwitch, return_type[type[T]], modifier[protected], parameter[theEClass, theEObject]] begin[{]
if[binary_operation[call[theEClass.eContainer, parameter[]], ==, member[.modelPackage]]] begin[{]
return[call[.doSwitch, parameter[call[theEClass.getClassifierID, parameter[]], member[.theEObject]]]]
else begin[{]
local_variable[type[List], eSuperTypes]
return[TernaryExpression(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=eSuperTypes, selectors=[], type_arguments=None), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=eSuperTypes, selectors=[], type_arguments=None), MemberReference(member=theEObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doSwitch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[MemberReference(member=theEObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=defaultCase, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None))]
end[}]
end[}]
END[}] | Keyword[protected] identifier[T] identifier[doSwitch] operator[SEP] identifier[EClass] identifier[theEClass] , identifier[EObject] identifier[theEObject] operator[SEP] {
Keyword[if] operator[SEP] identifier[theEClass] operator[SEP] identifier[eContainer] operator[SEP] operator[SEP] operator[==] identifier[modelPackage] operator[SEP] {
Keyword[return] identifier[doSwitch] operator[SEP] identifier[theEClass] operator[SEP] identifier[getClassifierID] operator[SEP] operator[SEP] , identifier[theEObject] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[List] operator[<] identifier[EClass] operator[>] identifier[eSuperTypes] operator[=] identifier[theEClass] operator[SEP] identifier[getESuperTypes] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[eSuperTypes] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[?] identifier[defaultCase] operator[SEP] identifier[theEObject] operator[SEP] operator[:] identifier[doSwitch] operator[SEP] identifier[eSuperTypes] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] , identifier[theEObject] operator[SEP] operator[SEP]
}
}
|
public Request<Void> revokeToken(String refreshToken) {
Asserts.assertNotNull(refreshToken, "refresh token");
String url = baseUrl
.newBuilder()
.addPathSegment(PATH_OAUTH)
.addPathSegment(PATH_REVOKE)
.build()
.toString();
VoidRequest request = new VoidRequest(client, url, "POST");
request.addParameter(KEY_CLIENT_ID, clientId);
request.addParameter(KEY_CLIENT_SECRET, clientSecret);
request.addParameter(KEY_TOKEN, refreshToken);
return request;
} | class class_name[name] begin[{]
method[revokeToken, return_type[type[Request]], modifier[public], parameter[refreshToken]] begin[{]
call[Asserts.assertNotNull, parameter[member[.refreshToken], literal["refresh token"]]]
local_variable[type[String], url]
local_variable[type[VoidRequest], request]
call[request.addParameter, parameter[member[.KEY_CLIENT_ID], member[.clientId]]]
call[request.addParameter, parameter[member[.KEY_CLIENT_SECRET], member[.clientSecret]]]
call[request.addParameter, parameter[member[.KEY_TOKEN], member[.refreshToken]]]
return[member[.request]]
end[}]
END[}] | Keyword[public] identifier[Request] operator[<] identifier[Void] operator[>] identifier[revokeToken] operator[SEP] identifier[String] identifier[refreshToken] operator[SEP] {
identifier[Asserts] operator[SEP] identifier[assertNotNull] operator[SEP] identifier[refreshToken] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[url] operator[=] identifier[baseUrl] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[addPathSegment] operator[SEP] identifier[PATH_OAUTH] operator[SEP] operator[SEP] identifier[addPathSegment] operator[SEP] identifier[PATH_REVOKE] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[VoidRequest] identifier[request] operator[=] Keyword[new] identifier[VoidRequest] operator[SEP] identifier[client] , identifier[url] , literal[String] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addParameter] operator[SEP] identifier[KEY_CLIENT_ID] , identifier[clientId] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addParameter] operator[SEP] identifier[KEY_CLIENT_SECRET] , identifier[clientSecret] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[addParameter] operator[SEP] identifier[KEY_TOKEN] , identifier[refreshToken] operator[SEP] operator[SEP] Keyword[return] identifier[request] operator[SEP]
}
|
@PostConstruct
protected void postConstruct() {
if (null == authenticationServices) {
authenticationServices = new ArrayList<AuthenticationService>();
}
if (!excludeDefault) {
authenticationServices.add(staticAuthenticationService);
}
} | class class_name[name] begin[{]
method[postConstruct, return_type[void], modifier[protected], parameter[]] begin[{]
if[binary_operation[literal[null], ==, member[.authenticationServices]]] begin[{]
assign[member[.authenticationServices], 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=AuthenticationService, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
else begin[{]
None
end[}]
if[member[.excludeDefault]] begin[{]
call[authenticationServices.add, parameter[member[.staticAuthenticationService]]]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[PostConstruct] Keyword[protected] Keyword[void] identifier[postConstruct] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[==] identifier[authenticationServices] operator[SEP] {
identifier[authenticationServices] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[AuthenticationService] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[excludeDefault] operator[SEP] {
identifier[authenticationServices] operator[SEP] identifier[add] operator[SEP] identifier[staticAuthenticationService] operator[SEP] operator[SEP]
}
}
|
static SoyAutoescapeException createCausedWithNode(
String message, Throwable cause, SoyNode node) {
return new SoyAutoescapeException(message, cause, node);
} | class class_name[name] begin[{]
method[createCausedWithNode, return_type[type[SoyAutoescapeException]], modifier[static], parameter[message, cause, node]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=cause, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, 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=SoyAutoescapeException, sub_type=None))]
end[}]
END[}] | Keyword[static] identifier[SoyAutoescapeException] identifier[createCausedWithNode] operator[SEP] identifier[String] identifier[message] , identifier[Throwable] identifier[cause] , identifier[SoyNode] identifier[node] operator[SEP] {
Keyword[return] Keyword[new] identifier[SoyAutoescapeException] operator[SEP] identifier[message] , identifier[cause] , identifier[node] operator[SEP] operator[SEP]
}
|
public void unload(String resourceId) {
LoadableResource res = this.resources.get(resourceId);
if (res!=null) {
res.unload();
}
} | class class_name[name] begin[{]
method[unload, return_type[void], modifier[public], parameter[resourceId]] begin[{]
local_variable[type[LoadableResource], res]
if[binary_operation[member[.res], !=, literal[null]]] begin[{]
call[res.unload, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[unload] operator[SEP] identifier[String] identifier[resourceId] operator[SEP] {
identifier[LoadableResource] identifier[res] operator[=] Keyword[this] operator[SEP] identifier[resources] operator[SEP] identifier[get] operator[SEP] identifier[resourceId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[res] operator[!=] Other[null] operator[SEP] {
identifier[res] operator[SEP] identifier[unload] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public final void interfaceMethodOrFieldDecl() throws RecognitionException {
int interfaceMethodOrFieldDecl_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 29) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:406:5: ( type Identifier interfaceMethodOrFieldRest )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:406:7: type Identifier interfaceMethodOrFieldRest
{
pushFollow(FOLLOW_type_in_interfaceMethodOrFieldDecl975);
type();
state._fsp--;
if (state.failed) return;
match(input,Identifier,FOLLOW_Identifier_in_interfaceMethodOrFieldDecl977); if (state.failed) return;
pushFollow(FOLLOW_interfaceMethodOrFieldRest_in_interfaceMethodOrFieldDecl979);
interfaceMethodOrFieldRest();
state._fsp--;
if (state.failed) return;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 29, interfaceMethodOrFieldDecl_StartIndex); }
}
} | class class_name[name] begin[{]
method[interfaceMethodOrFieldDecl, return_type[void], modifier[final public], parameter[]] begin[{]
local_variable[type[int], interfaceMethodOrFieldDecl_StartIndex]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), operandr=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=29)], member=alreadyParsedRule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=None, label=None)])), BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_type_in_interfaceMethodOrFieldDecl975, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=Identifier, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=FOLLOW_Identifier_in_interfaceMethodOrFieldDecl977, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_interfaceMethodOrFieldRest_in_interfaceMethodOrFieldDecl979, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=interfaceMethodOrFieldRest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=None, label=None))])], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=reportError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=29), MemberReference(member=interfaceMethodOrFieldDecl_StartIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=memoize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[final] Keyword[void] identifier[interfaceMethodOrFieldDecl] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
Keyword[int] identifier[interfaceMethodOrFieldDecl_StartIndex] operator[=] identifier[input] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[>] Other[0] operator[&&] identifier[alreadyParsedRule] operator[SEP] identifier[input] , Other[29] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP]
} {
identifier[pushFollow] operator[SEP] identifier[FOLLOW_type_in_interfaceMethodOrFieldDecl975] operator[SEP] operator[SEP] identifier[type] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP] identifier[match] operator[SEP] identifier[input] , identifier[Identifier] , identifier[FOLLOW_Identifier_in_interfaceMethodOrFieldDecl977] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP] identifier[pushFollow] operator[SEP] identifier[FOLLOW_interfaceMethodOrFieldRest_in_interfaceMethodOrFieldDecl979] operator[SEP] operator[SEP] identifier[interfaceMethodOrFieldRest] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[reportError] operator[SEP] identifier[re] operator[SEP] operator[SEP] identifier[recover] operator[SEP] identifier[input] , identifier[re] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[>] Other[0] operator[SEP] {
identifier[memoize] operator[SEP] identifier[input] , Other[29] , identifier[interfaceMethodOrFieldDecl_StartIndex] operator[SEP] operator[SEP]
}
}
}
|
public static void write(final Hml data, final Writer writer) throws IOException {
checkNotNull(data);
checkNotNull(writer);
try {
JAXBContext context = JAXBContext.newInstance(Hml.class);
Marshaller marshaller = context.createMarshaller();
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
URL schemaURL = HmlReader.class.getResource("/org/nmdp/ngs/hml/xsd/hml-1.0.1.xsd");
Schema schema = schemaFactory.newSchema(schemaURL);
marshaller.setSchema(schema);
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(data, writer);
}
catch (JAXBException | SAXException e) {
e.printStackTrace();
throw new IOException("could not marshal HML", e);
}
} | class class_name[name] begin[{]
method[write, return_type[void], modifier[public static], parameter[data, writer]] begin[{]
call[.checkNotNull, parameter[member[.data]]]
call[.checkNotNull, parameter[member[.writer]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Hml, sub_type=None))], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=JAXBContext, selectors=[], type_arguments=None), name=context)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JAXBContext, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=createMarshaller, postfix_operators=[], prefix_operators=[], qualifier=context, selectors=[], type_arguments=None), name=marshaller)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Marshaller, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=W3C_XML_SCHEMA_NS_URI, postfix_operators=[], prefix_operators=[], qualifier=XMLConstants, selectors=[])], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=SchemaFactory, selectors=[], type_arguments=None), name=schemaFactory)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SchemaFactory, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/org/nmdp/ngs/hml/xsd/hml-1.0.1.xsd")], member=getResource, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=HmlReader, sub_type=None)), name=schemaURL)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=schemaURL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=newSchema, postfix_operators=[], prefix_operators=[], qualifier=schemaFactory, selectors=[], type_arguments=None), name=schema)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Schema, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=schema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setSchema, postfix_operators=[], prefix_operators=[], qualifier=marshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=JAXB_FORMATTED_OUTPUT, postfix_operators=[], prefix_operators=[], qualifier=Marshaller, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setProperty, postfix_operators=[], prefix_operators=[], qualifier=marshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshal, postfix_operators=[], prefix_operators=[], qualifier=marshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="could not marshal HML"), 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=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['JAXBException', 'SAXException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[write] operator[SEP] Keyword[final] identifier[Hml] identifier[data] , Keyword[final] identifier[Writer] identifier[writer] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[checkNotNull] operator[SEP] identifier[data] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[writer] operator[SEP] operator[SEP] Keyword[try] {
identifier[JAXBContext] identifier[context] operator[=] identifier[JAXBContext] operator[SEP] identifier[newInstance] operator[SEP] identifier[Hml] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[Marshaller] identifier[marshaller] operator[=] identifier[context] operator[SEP] identifier[createMarshaller] operator[SEP] operator[SEP] operator[SEP] identifier[SchemaFactory] identifier[schemaFactory] operator[=] identifier[SchemaFactory] operator[SEP] identifier[newInstance] operator[SEP] identifier[XMLConstants] operator[SEP] identifier[W3C_XML_SCHEMA_NS_URI] operator[SEP] operator[SEP] identifier[URL] identifier[schemaURL] operator[=] identifier[HmlReader] operator[SEP] Keyword[class] operator[SEP] identifier[getResource] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Schema] identifier[schema] operator[=] identifier[schemaFactory] operator[SEP] identifier[newSchema] operator[SEP] identifier[schemaURL] operator[SEP] operator[SEP] identifier[marshaller] operator[SEP] identifier[setSchema] operator[SEP] identifier[schema] operator[SEP] operator[SEP] identifier[marshaller] operator[SEP] identifier[setProperty] operator[SEP] identifier[Marshaller] operator[SEP] identifier[JAXB_FORMATTED_OUTPUT] , literal[boolean] operator[SEP] operator[SEP] identifier[marshaller] operator[SEP] identifier[marshal] operator[SEP] identifier[data] , identifier[writer] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[JAXBException] operator[|] identifier[SAXException] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public Set getMessagingEngineSet(String busName) {
if (!isInitialized()) {
HashSet s = new HashSet();
return s;
}
return _jsmain.getMessagingEngineSet(busName);
} | class class_name[name] begin[{]
method[getMessagingEngineSet, return_type[type[Set]], modifier[public], parameter[busName]] begin[{]
if[call[.isInitialized, parameter[]]] begin[{]
local_variable[type[HashSet], s]
return[member[.s]]
else begin[{]
None
end[}]
return[call[_jsmain.getMessagingEngineSet, parameter[member[.busName]]]]
end[}]
END[}] | Keyword[public] identifier[Set] identifier[getMessagingEngineSet] operator[SEP] identifier[String] identifier[busName] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[isInitialized] operator[SEP] operator[SEP] operator[SEP] {
identifier[HashSet] identifier[s] operator[=] Keyword[new] identifier[HashSet] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[s] operator[SEP]
}
Keyword[return] identifier[_jsmain] operator[SEP] identifier[getMessagingEngineSet] operator[SEP] identifier[busName] operator[SEP] operator[SEP]
}
|
public void setItems(java.util.Collection<Deployment> items) {
if (items == null) {
this.items = null;
return;
}
this.items = new java.util.ArrayList<Deployment>(items);
} | class class_name[name] begin[{]
method[setItems, return_type[void], modifier[public], parameter[items]] begin[{]
if[binary_operation[member[.items], ==, literal[null]]] begin[{]
assign[THIS[member[None.items]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.items]], ClassCreator(arguments=[MemberReference(member=items, 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=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=util, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Deployment, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))))]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setItems] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[Deployment] operator[>] identifier[items] operator[SEP] {
Keyword[if] operator[SEP] identifier[items] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[items] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[items] operator[=] Keyword[new] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[ArrayList] operator[<] identifier[Deployment] operator[>] operator[SEP] identifier[items] operator[SEP] operator[SEP]
}
|
protected static String wildCardTranslate(String pattern) {
String separator = ".";
StringBuffer sb = new StringBuffer();
String es = escape(separator);
// special starter
Matcher ss = Pattern.compile("^([*][*][" + es + "]).*").matcher(pattern);
if (ss.matches()) {
pattern = pattern.substring(ss.group(1).length());
// make leading sep optional
sb.append("(.*[" + es + "])?");
}
// special trailer
Matcher st = Pattern.compile(".*([" + es + "][*][*])$").matcher(pattern);
boolean useSt = false;
if (st.matches()) {
pattern = pattern.substring(0, st.start(1));
useSt = true;
}
for(int i = 0; i != pattern.length(); ++i) {
char c = pattern.charAt(i);
if (c == '?') {
sb.append("[^" + es + "]");
}
else if (c == '*') {
if (i + 1 < pattern.length() && pattern.charAt(i+1) == '*') {
i++;
// **
sb.append(".*");
}
else {
sb.append("[^" + es + "]*");
}
}
else {
if (c == '$') {
sb.append("\\$");
}
else if (Character.isJavaIdentifierPart(c) || Character.isWhitespace(c)) {
sb.append(c);
}
else {
sb.append('\\').append(c);
}
}
}
if (useSt) {
sb.append("([" + es + "].*)?");
}
return sb.toString();
} | class class_name[name] begin[{]
method[wildCardTranslate, return_type[type[String]], modifier[static protected], parameter[pattern]] begin[{]
local_variable[type[String], separator]
local_variable[type[StringBuffer], sb]
local_variable[type[String], es]
local_variable[type[Matcher], ss]
if[call[ss.matches, parameter[]]] begin[{]
assign[member[.pattern], call[pattern.substring, parameter[call[ss.group, parameter[literal[1]]]]]]
call[sb.append, parameter[binary_operation[binary_operation[literal["(.*["], +, member[.es]], +, literal["])?"]]]]
else begin[{]
None
end[}]
local_variable[type[Matcher], st]
local_variable[type[boolean], useSt]
if[call[st.matches, parameter[]]] begin[{]
assign[member[.pattern], call[pattern.substring, parameter[literal[0], call[st.start, parameter[literal[1]]]]]]
assign[member[.useSt], literal[true]]
else begin[{]
None
end[}]
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=pattern, 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=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='?'), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*'), operator===), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='$'), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isJavaIdentifierPart, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isWhitespace, postfix_operators=[], prefix_operators=[], qualifier=Character, selectors=[], type_arguments=None), operator=||), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\')], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, 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=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\$")], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[], type_arguments=None), operator=<), operandr=BinaryOperation(operandl=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=pattern, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*'), operator===), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[^"), operandr=MemberReference(member=es, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]*"), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".*")], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[^"), operandr=MemberReference(member=es, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]"), operator=+)], member=append, postfix_operators=[], prefix_operators=[], qualifier=sb, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=pattern, selectors=[], type_arguments=None), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
if[member[.useSt]] begin[{]
call[sb.append, parameter[binary_operation[binary_operation[literal["(["], +, member[.es]], +, literal["].*)?"]]]]
else begin[{]
None
end[}]
return[call[sb.toString, parameter[]]]
end[}]
END[}] | Keyword[protected] Keyword[static] identifier[String] identifier[wildCardTranslate] operator[SEP] identifier[String] identifier[pattern] operator[SEP] {
identifier[String] identifier[separator] operator[=] literal[String] operator[SEP] identifier[StringBuffer] identifier[sb] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[es] operator[=] identifier[escape] operator[SEP] identifier[separator] operator[SEP] operator[SEP] identifier[Matcher] identifier[ss] operator[=] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] literal[String] operator[+] identifier[es] operator[+] literal[String] operator[SEP] operator[SEP] identifier[matcher] operator[SEP] identifier[pattern] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[ss] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
identifier[pattern] operator[=] identifier[pattern] operator[SEP] identifier[substring] operator[SEP] identifier[ss] operator[SEP] identifier[group] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[es] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[Matcher] identifier[st] operator[=] identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] literal[String] operator[+] identifier[es] operator[+] literal[String] operator[SEP] operator[SEP] identifier[matcher] operator[SEP] identifier[pattern] operator[SEP] operator[SEP] Keyword[boolean] identifier[useSt] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[st] operator[SEP] identifier[matches] operator[SEP] operator[SEP] operator[SEP] {
identifier[pattern] operator[=] identifier[pattern] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[st] operator[SEP] identifier[start] operator[SEP] Other[1] operator[SEP] operator[SEP] operator[SEP] identifier[useSt] operator[=] literal[boolean] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[!=] identifier[pattern] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[pattern] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[es] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[+] Other[1] operator[<] identifier[pattern] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[&&] identifier[pattern] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[+] Other[1] operator[SEP] operator[==] literal[String] operator[SEP] {
identifier[i] operator[++] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[es] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[c] operator[==] literal[String] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[Character] operator[SEP] identifier[isJavaIdentifierPart] operator[SEP] identifier[c] operator[SEP] operator[||] identifier[Character] operator[SEP] identifier[isWhitespace] operator[SEP] identifier[c] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] identifier[useSt] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[+] identifier[es] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public boolean isTrusted(X509Certificate[] certChain) {
String issuerDN = certChain[0].getIssuerX500Principal().getName();
return isTrusted(issuerDN);
} | class class_name[name] begin[{]
method[isTrusted, return_type[type[boolean]], modifier[public], parameter[certChain]] begin[{]
local_variable[type[String], issuerDN]
return[call[.isTrusted, parameter[member[.issuerDN]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[isTrusted] operator[SEP] identifier[X509Certificate] operator[SEP] operator[SEP] identifier[certChain] operator[SEP] {
identifier[String] identifier[issuerDN] operator[=] identifier[certChain] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[getIssuerX500Principal] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[isTrusted] operator[SEP] identifier[issuerDN] operator[SEP] operator[SEP]
}
|
public void persist(Node node)
{
Object entity = node.getData();
Object id = node.getEntityId();
EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, node.getDataClass());
isUpdate = node.isUpdate();
List<RelationHolder> relationHolders = getRelationHolders(node);
onPersist(metadata, entity, id, relationHolders);
id = PropertyAccessorHelper.getId(entity, metadata);
node.setEntityId(id);
indexNode(node, metadata);
} | class class_name[name] begin[{]
method[persist, return_type[void], modifier[public], parameter[node]] begin[{]
local_variable[type[Object], entity]
local_variable[type[Object], id]
local_variable[type[EntityMetadata], metadata]
assign[member[.isUpdate], call[node.isUpdate, parameter[]]]
local_variable[type[List], relationHolders]
call[.onPersist, parameter[member[.metadata], member[.entity], member[.id], member[.relationHolders]]]
assign[member[.id], call[PropertyAccessorHelper.getId, parameter[member[.entity], member[.metadata]]]]
call[node.setEntityId, parameter[member[.id]]]
call[.indexNode, parameter[member[.node], member[.metadata]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[persist] operator[SEP] identifier[Node] identifier[node] operator[SEP] {
identifier[Object] identifier[entity] operator[=] identifier[node] operator[SEP] identifier[getData] operator[SEP] operator[SEP] operator[SEP] identifier[Object] identifier[id] operator[=] identifier[node] operator[SEP] identifier[getEntityId] operator[SEP] operator[SEP] operator[SEP] identifier[EntityMetadata] identifier[metadata] operator[=] identifier[KunderaMetadataManager] operator[SEP] identifier[getEntityMetadata] operator[SEP] identifier[kunderaMetadata] , identifier[node] operator[SEP] identifier[getDataClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[isUpdate] operator[=] identifier[node] operator[SEP] identifier[isUpdate] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[RelationHolder] operator[>] identifier[relationHolders] operator[=] identifier[getRelationHolders] operator[SEP] identifier[node] operator[SEP] operator[SEP] identifier[onPersist] operator[SEP] identifier[metadata] , identifier[entity] , identifier[id] , identifier[relationHolders] operator[SEP] operator[SEP] identifier[id] operator[=] identifier[PropertyAccessorHelper] operator[SEP] identifier[getId] operator[SEP] identifier[entity] , identifier[metadata] operator[SEP] operator[SEP] identifier[node] operator[SEP] identifier[setEntityId] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[indexNode] operator[SEP] identifier[node] , identifier[metadata] operator[SEP] operator[SEP]
}
|
public synchronized void fire(T event) {
if (occured) throw new IllegalStateException("SingleEvent already fired");
occured = true;
data = event;
if (listeners != null) {
for (Listener<T> listener : listeners)
listener.fire(event);
listeners = null;
}
if (listenersRunnable != null) {
for (Runnable listener : listenersRunnable)
listener.run();
listenersRunnable = null;
}
} | class class_name[name] begin[{]
method[fire, return_type[void], modifier[synchronized public], parameter[event]] begin[{]
if[member[.occured]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="SingleEvent already fired")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.occured], literal[true]]
assign[member[.data], member[.event]]
if[binary_operation[member[.listeners], !=, literal[null]]] begin[{]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=event, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fire, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=listeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Listener, sub_type=None))), label=None)
assign[member[.listeners], literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.listenersRunnable], !=, literal[null]]] begin[{]
ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[], member=run, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None), control=EnhancedForControl(iterable=MemberReference(member=listenersRunnable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Runnable, sub_type=None))), label=None)
assign[member[.listenersRunnable], literal[null]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[synchronized] Keyword[void] identifier[fire] operator[SEP] identifier[T] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] identifier[occured] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[occured] operator[=] literal[boolean] operator[SEP] identifier[data] operator[=] identifier[event] operator[SEP] Keyword[if] operator[SEP] identifier[listeners] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Listener] operator[<] identifier[T] operator[>] identifier[listener] operator[:] identifier[listeners] operator[SEP] identifier[listener] operator[SEP] identifier[fire] operator[SEP] identifier[event] operator[SEP] operator[SEP] identifier[listeners] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[listenersRunnable] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[Runnable] identifier[listener] operator[:] identifier[listenersRunnable] operator[SEP] identifier[listener] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP] identifier[listenersRunnable] operator[=] Other[null] operator[SEP]
}
}
|
public static Set<String> getFixedURLs(final ContentSpec contentSpec) {
final Set<String> fixedUrls = new HashSet<String>();
for (final Node childNode : contentSpec.getNodes()) {
if (childNode instanceof SpecNode) {
final SpecNode specNode = ((SpecNode) childNode);
if (!isNullOrEmpty(specNode.getFixedUrl())) {
fixedUrls.add(specNode.getFixedUrl());
}
}
if (childNode instanceof Level) {
fixedUrls.addAll(getFixedURLs((Level) childNode));
}
}
fixedUrls.addAll(getFixedURLs(contentSpec.getBaseLevel()));
return fixedUrls;
} | class class_name[name] begin[{]
method[getFixedURLs, return_type[type[Set]], modifier[public static], parameter[contentSpec]] begin[{]
local_variable[type[Set], fixedUrls]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=SpecNode, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=SpecNode, sub_type=None)), name=specNode)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=SpecNode, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFixedUrl, postfix_operators=[], prefix_operators=[], qualifier=specNode, selectors=[], type_arguments=None)], member=isNullOrEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFixedUrl, postfix_operators=[], prefix_operators=[], qualifier=specNode, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=fixedUrls, selectors=[], type_arguments=None), label=None)]))])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=Level, sub_type=None), operator=instanceof), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Cast(expression=MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Level, sub_type=None))], member=getFixedURLs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=fixedUrls, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getNodes, postfix_operators=[], prefix_operators=[], qualifier=contentSpec, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=childNode)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None)
call[fixedUrls.addAll, parameter[call[.getFixedURLs, parameter[call[contentSpec.getBaseLevel, parameter[]]]]]]
return[member[.fixedUrls]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[String] operator[>] identifier[getFixedURLs] operator[SEP] Keyword[final] identifier[ContentSpec] identifier[contentSpec] operator[SEP] {
Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[fixedUrls] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[Node] identifier[childNode] operator[:] identifier[contentSpec] operator[SEP] identifier[getNodes] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[childNode] Keyword[instanceof] identifier[SpecNode] operator[SEP] {
Keyword[final] identifier[SpecNode] identifier[specNode] operator[=] operator[SEP] operator[SEP] identifier[SpecNode] operator[SEP] identifier[childNode] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isNullOrEmpty] operator[SEP] identifier[specNode] operator[SEP] identifier[getFixedUrl] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[fixedUrls] operator[SEP] identifier[add] operator[SEP] identifier[specNode] operator[SEP] identifier[getFixedUrl] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[childNode] Keyword[instanceof] identifier[Level] operator[SEP] {
identifier[fixedUrls] operator[SEP] identifier[addAll] operator[SEP] identifier[getFixedURLs] operator[SEP] operator[SEP] identifier[Level] operator[SEP] identifier[childNode] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[fixedUrls] operator[SEP] identifier[addAll] operator[SEP] identifier[getFixedURLs] operator[SEP] identifier[contentSpec] operator[SEP] identifier[getBaseLevel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[fixedUrls] operator[SEP]
}
|
private static Function<FedoraEvent, Stream<FedoraEvent>> handleMoveEvents(final Session session) {
return evt -> {
if (evt.getTypes().contains(RESOURCE_RELOCATION)) {
final Map<String, String> movePath = evt.getInfo();
final String dest = movePath.get("destAbsPath");
final String src = movePath.get("srcAbsPath");
final FedoraSession fsession = new FedoraSessionImpl(session);
try {
final FedoraResource resource = new FedoraResourceImpl(session.getNode(evt.getPath()));
return concat(of(evt), resource.getChildren(true).map(FedoraResource::getPath)
.flatMap(path -> of(
new FedoraEventImpl(RESOURCE_RELOCATION, path, evt.getResourceTypes(), evt.getUserID(),
fsession.getUserURI(), evt.getDate(), evt.getInfo()),
new FedoraEventImpl(RESOURCE_DELETION, path.replaceFirst(dest, src), evt.getResourceTypes(),
evt.getUserID(), fsession.getUserURI(), evt.getDate(), evt.getInfo()))));
} catch (final RepositoryException ex) {
throw new RepositoryRuntimeException(ex);
}
}
return of(evt);
};
} | class class_name[name] begin[{]
method[handleMoveEvents, return_type[type[Function]], modifier[private static], parameter[session]] begin[{]
return[LambdaExpression(body=[IfStatement(condition=MethodInvocation(arguments=[], member=getTypes, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[MethodInvocation(arguments=[MemberReference(member=RESOURCE_RELOCATION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getInfo, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[], type_arguments=None), name=movePath)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Map, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="destAbsPath")], member=get, postfix_operators=[], prefix_operators=[], qualifier=movePath, selectors=[], type_arguments=None), name=dest)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="srcAbsPath")], member=get, postfix_operators=[], prefix_operators=[], qualifier=movePath, selectors=[], type_arguments=None), name=src)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=session, 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=FedoraSessionImpl, sub_type=None)), name=fsession)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=FedoraSession, sub_type=None)), TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[], type_arguments=None)], member=getNode, postfix_operators=[], prefix_operators=[], qualifier=session, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FedoraResourceImpl, sub_type=None)), name=resource)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=FedoraResource, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=evt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=of, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=getChildren, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[MethodInvocation(arguments=[MethodReference(expression=MemberReference(member=FedoraResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=getPath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])], member=map, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[LambdaExpression(body=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=RESOURCE_RELOCATION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getResourceTypes, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getUserID, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getUserURI, postfix_operators=[], prefix_operators=[], qualifier=fsession, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getDate, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getInfo, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FedoraEventImpl, sub_type=None)), ClassCreator(arguments=[MemberReference(member=RESOURCE_DELETION, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=dest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=src, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=replaceFirst, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getResourceTypes, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getUserID, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getUserURI, postfix_operators=[], prefix_operators=[], qualifier=fsession, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getDate, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getInfo, postfix_operators=[], prefix_operators=[], qualifier=evt, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FedoraEventImpl, sub_type=None))], member=of, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), parameters=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])], member=flatMap, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=concat, 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=RepositoryRuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['RepositoryException']))], finally_block=None, label=None, resources=None)])), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=evt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=of, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], parameters=[MemberReference(member=evt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[Function] operator[<] identifier[FedoraEvent] , identifier[Stream] operator[<] identifier[FedoraEvent] operator[>] operator[>] identifier[handleMoveEvents] operator[SEP] Keyword[final] identifier[Session] identifier[session] operator[SEP] {
Keyword[return] identifier[evt] operator[->] {
Keyword[if] operator[SEP] identifier[evt] operator[SEP] identifier[getTypes] operator[SEP] operator[SEP] operator[SEP] identifier[contains] operator[SEP] identifier[RESOURCE_RELOCATION] operator[SEP] operator[SEP] {
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[movePath] operator[=] identifier[evt] operator[SEP] identifier[getInfo] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[dest] operator[=] identifier[movePath] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[src] operator[=] identifier[movePath] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[FedoraSession] identifier[fsession] operator[=] Keyword[new] identifier[FedoraSessionImpl] operator[SEP] identifier[session] operator[SEP] operator[SEP] Keyword[try] {
Keyword[final] identifier[FedoraResource] identifier[resource] operator[=] Keyword[new] identifier[FedoraResourceImpl] operator[SEP] identifier[session] operator[SEP] identifier[getNode] operator[SEP] identifier[evt] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[concat] operator[SEP] identifier[of] operator[SEP] identifier[evt] operator[SEP] , identifier[resource] operator[SEP] identifier[getChildren] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[FedoraResource] operator[::] identifier[getPath] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] identifier[path] operator[->] identifier[of] operator[SEP] Keyword[new] identifier[FedoraEventImpl] operator[SEP] identifier[RESOURCE_RELOCATION] , identifier[path] , identifier[evt] operator[SEP] identifier[getResourceTypes] operator[SEP] operator[SEP] , identifier[evt] operator[SEP] identifier[getUserID] operator[SEP] operator[SEP] , identifier[fsession] operator[SEP] identifier[getUserURI] operator[SEP] operator[SEP] , identifier[evt] operator[SEP] identifier[getDate] operator[SEP] operator[SEP] , identifier[evt] operator[SEP] identifier[getInfo] operator[SEP] operator[SEP] operator[SEP] , Keyword[new] identifier[FedoraEventImpl] operator[SEP] identifier[RESOURCE_DELETION] , identifier[path] operator[SEP] identifier[replaceFirst] operator[SEP] identifier[dest] , identifier[src] operator[SEP] , identifier[evt] operator[SEP] identifier[getResourceTypes] operator[SEP] operator[SEP] , identifier[evt] operator[SEP] identifier[getUserID] operator[SEP] operator[SEP] , identifier[fsession] operator[SEP] identifier[getUserURI] operator[SEP] operator[SEP] , identifier[evt] operator[SEP] identifier[getDate] operator[SEP] operator[SEP] , identifier[evt] operator[SEP] identifier[getInfo] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[RepositoryException] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RepositoryRuntimeException] operator[SEP] identifier[ex] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[of] operator[SEP] identifier[evt] operator[SEP] operator[SEP]
} operator[SEP]
}
|
private static String getAliasName(String alias, String bundleLocation) {
String newAlias = alias;
if (alias != null && !alias.isEmpty()) {
try {
if (bundleLocation != null && !bundleLocation.isEmpty()) {
if (bundleLocation.startsWith(XMLConfigConstants.BUNDLE_LOC_KERNEL_TAG)) {
// nothing to do. The alias is returned.
} else if (bundleLocation.startsWith(XMLConfigConstants.BUNDLE_LOC_FEATURE_TAG)) {
// Check for the presence of a product extension location.
int index = bundleLocation.indexOf(XMLConfigConstants.BUNDLE_LOC_PROD_EXT_TAG);
if (index != -1) {
index += XMLConfigConstants.BUNDLE_LOC_PROD_EXT_TAG.length();
int endIndex = bundleLocation.indexOf(":", index);
String productName = bundleLocation.substring(index, endIndex);
newAlias = productName + "_" + alias;
}
} else if (bundleLocation.startsWith(XMLConfigConstants.BUNDLE_LOC_CONNECTOR_TAG)) {
// nothing to do. The alias is returned.
} else {
// Unknown location. Ignore the alias. If bundles are installed through fileInstall,
// bundle resolution should happen through the pid or factoryPid.
newAlias = null;
}
}
} catch (Throwable t) {
// An exception here would be bad. Need an ffdc.
}
}
return newAlias;
} | class class_name[name] begin[{]
method[getAliasName, return_type[type[String]], modifier[private static], parameter[alias, bundleLocation]] begin[{]
local_variable[type[String], newAlias]
if[binary_operation[binary_operation[member[.alias], !=, literal[null]], &&, call[alias.isEmpty, parameter[]]]] begin[{]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=bundleLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=bundleLocation, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=BUNDLE_LOC_KERNEL_TAG, postfix_operators=[], prefix_operators=[], qualifier=XMLConfigConstants, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=bundleLocation, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=BUNDLE_LOC_FEATURE_TAG, postfix_operators=[], prefix_operators=[], qualifier=XMLConfigConstants, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=bundleLocation, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=BUNDLE_LOC_CONNECTOR_TAG, postfix_operators=[], prefix_operators=[], qualifier=XMLConfigConstants, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=bundleLocation, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=newAlias, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=BUNDLE_LOC_PROD_EXT_TAG, postfix_operators=[], prefix_operators=[], qualifier=XMLConfigConstants, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=bundleLocation, selectors=[], type_arguments=None), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=XMLConfigConstants.BUNDLE_LOC_PROD_EXT_TAG, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=indexOf, postfix_operators=[], prefix_operators=[], qualifier=bundleLocation, selectors=[], type_arguments=None), name=endIndex)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=endIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=bundleLocation, selectors=[], type_arguments=None), name=productName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newAlias, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=productName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="_"), operator=+), operandr=MemberReference(member=alias, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)), label=None)]))])), label=None, then_statement=BlockStatement(label=None, statements=[]))]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[member[.newAlias]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[getAliasName] operator[SEP] identifier[String] identifier[alias] , identifier[String] identifier[bundleLocation] operator[SEP] {
identifier[String] identifier[newAlias] operator[=] identifier[alias] operator[SEP] Keyword[if] operator[SEP] identifier[alias] operator[!=] Other[null] operator[&&] operator[!] identifier[alias] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[bundleLocation] operator[!=] Other[null] operator[&&] operator[!] identifier[bundleLocation] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[bundleLocation] operator[SEP] identifier[startsWith] operator[SEP] identifier[XMLConfigConstants] operator[SEP] identifier[BUNDLE_LOC_KERNEL_TAG] operator[SEP] operator[SEP] {
}
Keyword[else] Keyword[if] operator[SEP] identifier[bundleLocation] operator[SEP] identifier[startsWith] operator[SEP] identifier[XMLConfigConstants] operator[SEP] identifier[BUNDLE_LOC_FEATURE_TAG] operator[SEP] operator[SEP] {
Keyword[int] identifier[index] operator[=] identifier[bundleLocation] operator[SEP] identifier[indexOf] operator[SEP] identifier[XMLConfigConstants] operator[SEP] identifier[BUNDLE_LOC_PROD_EXT_TAG] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[index] operator[+=] identifier[XMLConfigConstants] operator[SEP] identifier[BUNDLE_LOC_PROD_EXT_TAG] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[endIndex] operator[=] identifier[bundleLocation] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[index] operator[SEP] operator[SEP] identifier[String] identifier[productName] operator[=] identifier[bundleLocation] operator[SEP] identifier[substring] operator[SEP] identifier[index] , identifier[endIndex] operator[SEP] operator[SEP] identifier[newAlias] operator[=] identifier[productName] operator[+] literal[String] operator[+] identifier[alias] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[bundleLocation] operator[SEP] identifier[startsWith] operator[SEP] identifier[XMLConfigConstants] operator[SEP] identifier[BUNDLE_LOC_CONNECTOR_TAG] operator[SEP] operator[SEP] {
}
Keyword[else] {
identifier[newAlias] operator[=] Other[null] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
}
}
Keyword[return] identifier[newAlias] operator[SEP]
}
|
public static String getJar(Class<?> klass) {
Preconditions.checkNotNull(klass, "klass");
ClassLoader loader = klass.getClassLoader();
if (loader != null) {
String class_file = klass.getName().replaceAll("\\.", "/") + ".class";
try {
for (Enumeration<?> itr = loader.getResources(class_file); itr.hasMoreElements();) {
URL url = (URL) itr.nextElement();
String path = url.getPath();
if (path.startsWith("file:")) {
path = path.substring("file:".length());
}
path = URLDecoder.decode(path, "UTF-8");
if ("jar".equals(url.getProtocol())) {
path = URLDecoder.decode(path, "UTF-8");
return path.replaceAll("!.*$", "");
} else if ("file".equals(url.getProtocol())) {
String klassName = klass.getName();
klassName = klassName.replace(".", "/") + ".class";
path = path.substring(0, path.length() - klassName.length());
File baseDir = new File(path);
File testDir = new File(System.getProperty("test.build.dir", "target/test-dir"));
testDir = testDir.getAbsoluteFile();
if (!testDir.exists()) {
if (!testDir.mkdirs()) {
throw new IOException("Unable to create directory :"+testDir.toString());
}
}
File tempJar = File.createTempFile(TMP_HADOOP, "", testDir);
tempJar = new File(tempJar.getAbsolutePath() + ".jar");
createJar(baseDir, tempJar);
return tempJar.getAbsolutePath();
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return null;
} | class class_name[name] begin[{]
method[getJar, return_type[type[String]], modifier[public static], parameter[klass]] begin[{]
call[Preconditions.checkNotNull, parameter[member[.klass], literal["klass"]]]
local_variable[type[ClassLoader], loader]
if[binary_operation[member[.loader], !=, literal[null]]] begin[{]
local_variable[type[String], class_file]
TryStatement(block=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[], member=nextElement, postfix_operators=[], prefix_operators=[], qualifier=itr, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), name=url)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=URL, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPath, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None), name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="file:")], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="file:")], member=substring, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLDecoder, selectors=[], type_arguments=None)), label=None), IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProtocol, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="jar"), else_statement=IfStatement(condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProtocol, postfix_operators=[], prefix_operators=[], qualifier=url, selectors=[], type_arguments=None)], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], value="file"), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=klass, selectors=[], type_arguments=None), name=klassName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=klassName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="."), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=replace, postfix_operators=[], prefix_operators=[], qualifier=klassName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".class"), operator=+)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=klassName, selectors=[], type_arguments=None), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None)), name=baseDir)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="test.build.dir"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="target/test-dir")], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=System, 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)), name=testDir)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=testDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getAbsoluteFile, postfix_operators=[], prefix_operators=[], qualifier=testDir, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=exists, postfix_operators=[], prefix_operators=['!'], qualifier=testDir, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=mkdirs, postfix_operators=[], prefix_operators=['!'], qualifier=testDir, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to create directory :"), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=testDir, 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=IOException, sub_type=None)), label=None)]))])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=TMP_HADOOP, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=testDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createTempFile, postfix_operators=[], prefix_operators=[], qualifier=File, selectors=[], type_arguments=None), name=tempJar)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=tempJar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=tempJar, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".jar"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=baseDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=tempJar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createJar, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=tempJar, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="UTF-8")], member=decode, postfix_operators=[], prefix_operators=[], qualifier=URLDecoder, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="!.*$"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=replaceAll, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasMoreElements, postfix_operators=[], prefix_operators=[], qualifier=itr, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[MemberReference(member=class_file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getResources, postfix_operators=[], prefix_operators=[], qualifier=loader, selectors=[], type_arguments=None), name=itr)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Enumeration, sub_type=None)), update=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getJar] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[klass] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[klass] , literal[String] operator[SEP] operator[SEP] identifier[ClassLoader] identifier[loader] operator[=] identifier[klass] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[loader] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[class_file] operator[=] identifier[klass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[+] literal[String] operator[SEP] Keyword[try] {
Keyword[for] operator[SEP] identifier[Enumeration] operator[<] operator[?] operator[>] identifier[itr] operator[=] identifier[loader] operator[SEP] identifier[getResources] operator[SEP] identifier[class_file] operator[SEP] operator[SEP] identifier[itr] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[URL] identifier[url] operator[=] operator[SEP] identifier[URL] operator[SEP] identifier[itr] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[path] operator[=] identifier[url] operator[SEP] identifier[getPath] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[path] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[path] operator[=] identifier[path] operator[SEP] identifier[substring] operator[SEP] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[path] operator[=] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[path] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[url] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[path] operator[=] identifier[URLDecoder] operator[SEP] identifier[decode] operator[SEP] identifier[path] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[path] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[url] operator[SEP] identifier[getProtocol] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[klassName] operator[=] identifier[klass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[klassName] operator[=] identifier[klassName] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[+] literal[String] operator[SEP] identifier[path] operator[=] identifier[path] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[path] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] identifier[klassName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[File] identifier[baseDir] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[File] identifier[testDir] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[testDir] operator[=] identifier[testDir] operator[SEP] identifier[getAbsoluteFile] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[testDir] operator[SEP] identifier[exists] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[testDir] operator[SEP] identifier[mkdirs] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[testDir] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
identifier[File] identifier[tempJar] operator[=] identifier[File] operator[SEP] identifier[createTempFile] operator[SEP] identifier[TMP_HADOOP] , literal[String] , identifier[testDir] operator[SEP] operator[SEP] identifier[tempJar] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[tempJar] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP] identifier[createJar] operator[SEP] identifier[baseDir] , identifier[tempJar] operator[SEP] operator[SEP] Keyword[return] identifier[tempJar] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public void rejectValue(final String field, final Class<?> fieldType, final String[] errorCodes,
final Map<String, Object> messageVariables, final String defaultMessage) {
String[] codes = new String[0];
for(String errorCode : errorCodes) {
codes = Utils.concat(codes, messageCodeGenerator.generateCodes(errorCode, getObjectName(), field, fieldType));
}
addError(new CsvFieldError(getObjectName(), field, false, codes, messageVariables, defaultMessage));
} | class class_name[name] begin[{]
method[rejectValue, return_type[void], modifier[public], parameter[field, fieldType, errorCodes, messageVariables, defaultMessage]] begin[{]
local_variable[type[String], codes]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=codes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=codes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=errorCode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getObjectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fieldType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=generateCodes, postfix_operators=[], prefix_operators=[], qualifier=messageCodeGenerator, selectors=[], type_arguments=None)], member=concat, postfix_operators=[], prefix_operators=[], qualifier=Utils, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=errorCodes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=errorCode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
call[.addError, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getObjectName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), MemberReference(member=codes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=messageVariables, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=defaultMessage, 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=CsvFieldError, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[rejectValue] operator[SEP] Keyword[final] identifier[String] identifier[field] , Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[fieldType] , Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[errorCodes] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[messageVariables] , Keyword[final] identifier[String] identifier[defaultMessage] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] identifier[codes] operator[=] Keyword[new] identifier[String] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[errorCode] operator[:] identifier[errorCodes] operator[SEP] {
identifier[codes] operator[=] identifier[Utils] operator[SEP] identifier[concat] operator[SEP] identifier[codes] , identifier[messageCodeGenerator] operator[SEP] identifier[generateCodes] operator[SEP] identifier[errorCode] , identifier[getObjectName] operator[SEP] operator[SEP] , identifier[field] , identifier[fieldType] operator[SEP] operator[SEP] operator[SEP]
}
identifier[addError] operator[SEP] Keyword[new] identifier[CsvFieldError] operator[SEP] identifier[getObjectName] operator[SEP] operator[SEP] , identifier[field] , literal[boolean] , identifier[codes] , identifier[messageVariables] , identifier[defaultMessage] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public DataMedia findById(Long dataMediaId) {
Assert.assertNotNull(dataMediaId);
List<DataMedia> dataMedias = listByIds(dataMediaId);
if (dataMedias.size() != 1) {
String exceptionCause = "query dataMediaId:" + dataMediaId + " but return " + dataMedias.size()
+ " dataMedia.";
logger.error("ERROR ## " + exceptionCause);
throw new ManagerException(exceptionCause);
}
return dataMedias.get(0);
} | class class_name[name] begin[{]
method[findById, return_type[type[DataMedia]], modifier[public], parameter[dataMediaId]] begin[{]
call[Assert.assertNotNull, parameter[member[.dataMediaId]]]
local_variable[type[List], dataMedias]
if[binary_operation[call[dataMedias.size, parameter[]], !=, literal[1]]] begin[{]
local_variable[type[String], exceptionCause]
call[logger.error, parameter[binary_operation[literal["ERROR ## "], +, member[.exceptionCause]]]]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=exceptionCause, 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=ManagerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[dataMedias.get, parameter[literal[0]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DataMedia] identifier[findById] operator[SEP] identifier[Long] identifier[dataMediaId] operator[SEP] {
identifier[Assert] operator[SEP] identifier[assertNotNull] operator[SEP] identifier[dataMediaId] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[DataMedia] operator[>] identifier[dataMedias] operator[=] identifier[listByIds] operator[SEP] identifier[dataMediaId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[dataMedias] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] Other[1] operator[SEP] {
identifier[String] identifier[exceptionCause] operator[=] literal[String] operator[+] identifier[dataMediaId] operator[+] literal[String] operator[+] identifier[dataMedias] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[exceptionCause] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[ManagerException] operator[SEP] identifier[exceptionCause] operator[SEP] operator[SEP]
}
Keyword[return] identifier[dataMedias] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
public DbxEntry./*@Nullable*/Folder createFolder(String path)
throws DbxException
{
DbxPathV1.checkArgNonRoot("path", path);
String[] params = {
"root", "auto",
"path", path,
};
return doPost(host.getApi(), "1/fileops/create_folder", params, null, new DbxRequestUtil.ResponseHandler<DbxEntry./*@Nullable*/Folder>() {
@Override
public DbxEntry./*@Nullable*/Folder handle(HttpRequestor.Response response)
throws DbxException
{
if (response.getStatusCode() == 403) return null;
if (response.getStatusCode() != 200) throw DbxRequestUtil.unexpectedStatus(response);
return DbxRequestUtil.readJsonFromResponse(DbxEntry.Folder.Reader, response);
}
});
} | class class_name[name] begin[{]
method[createFolder, return_type[type[DbxEntry]], modifier[public], parameter[path]] begin[{]
call[DbxPathV1.checkArgNonRoot, parameter[literal["path"], member[.path]]]
local_variable[type[String], params]
return[call[.doPost, parameter[call[host.getApi, parameter[]], literal["1/fileops/create_folder"], member[.params], literal[null], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=403), operator===), else_statement=None, label=None, then_statement=ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getStatusCode, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=200), operator=!=), else_statement=None, label=None, then_statement=ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=unexpectedStatus, postfix_operators=[], prefix_operators=[], qualifier=DbxRequestUtil, selectors=[], type_arguments=None), label=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=Reader, postfix_operators=[], prefix_operators=[], qualifier=DbxEntry.Folder, selectors=[]), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readJsonFromResponse, postfix_operators=[], prefix_operators=[], qualifier=DbxRequestUtil, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=handle, parameters=[FormalParameter(annotations=[], modifiers=set(), name=response, type=ReferenceType(arguments=None, dimensions=[], name=HttpRequestor, sub_type=ReferenceType(arguments=None, dimensions=None, name=Response, sub_type=None)), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=DbxEntry, sub_type=ReferenceType(arguments=None, dimensions=None, name=Folder, sub_type=None)), throws=['DbxException'], type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DbxRequestUtil, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=DbxEntry, sub_type=ReferenceType(arguments=None, dimensions=None, name=Folder, sub_type=None)))], dimensions=None, name=ResponseHandler, sub_type=None)))]]]
end[}]
END[}] | Keyword[public] identifier[DbxEntry] operator[SEP] identifier[Folder] identifier[createFolder] operator[SEP] identifier[String] identifier[path] operator[SEP] Keyword[throws] identifier[DbxException] {
identifier[DbxPathV1] operator[SEP] identifier[checkArgNonRoot] operator[SEP] literal[String] , identifier[path] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[params] operator[=] {
literal[String] , literal[String] , literal[String] , identifier[path] ,
} operator[SEP] Keyword[return] identifier[doPost] operator[SEP] identifier[host] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] , literal[String] , identifier[params] , Other[null] , Keyword[new] identifier[DbxRequestUtil] operator[SEP] identifier[ResponseHandler] operator[<] identifier[DbxEntry] operator[SEP] identifier[Folder] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[DbxEntry] operator[SEP] identifier[Folder] identifier[handle] operator[SEP] identifier[HttpRequestor] operator[SEP] identifier[Response] identifier[response] operator[SEP] Keyword[throws] identifier[DbxException] {
Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[==] Other[403] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[response] operator[SEP] identifier[getStatusCode] operator[SEP] operator[SEP] operator[!=] Other[200] operator[SEP] Keyword[throw] identifier[DbxRequestUtil] operator[SEP] identifier[unexpectedStatus] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[DbxRequestUtil] operator[SEP] identifier[readJsonFromResponse] operator[SEP] identifier[DbxEntry] operator[SEP] identifier[Folder] operator[SEP] identifier[Reader] , identifier[response] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
public static String mkString(Iterable<?> iterable, String prefix, String separator, String suffix) {
final StringBuilder result = new StringBuilder(prefix);
boolean first = true;
for(Object o: iterable) {
if(first) {
first = false;
}
else {
result.append(separator);
}
result.append(o);
}
result.append(suffix);
return result.toString ();
} | class class_name[name] begin[{]
method[mkString, return_type[type[String]], modifier[public static], parameter[iterable, prefix, separator, suffix]] begin[{]
local_variable[type[StringBuilder], result]
local_variable[type[boolean], first]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=separator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=first, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=result, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=iterable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=o)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None))), label=None)
call[result.append, parameter[member[.suffix]]]
return[call[result.toString, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[mkString] operator[SEP] identifier[Iterable] operator[<] operator[?] operator[>] identifier[iterable] , identifier[String] identifier[prefix] , identifier[String] identifier[separator] , identifier[String] identifier[suffix] operator[SEP] {
Keyword[final] identifier[StringBuilder] identifier[result] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[prefix] operator[SEP] operator[SEP] Keyword[boolean] identifier[first] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Object] identifier[o] operator[:] identifier[iterable] operator[SEP] {
Keyword[if] operator[SEP] identifier[first] operator[SEP] {
identifier[first] operator[=] literal[boolean] operator[SEP]
}
Keyword[else] {
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[separator] operator[SEP] operator[SEP]
}
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[o] operator[SEP] operator[SEP]
}
identifier[result] operator[SEP] identifier[append] operator[SEP] identifier[suffix] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public GeoCodeItem toGeoCodeItem(final GeoServiceItem gsItem) {
if (gsItem == null) {
return null;
}
return new GeoCodeItem(gsItem.getPlaceName(),
gsItem.getModernPlaceName(),
toGeocodingResult(gsItem.getResult()));
} | class class_name[name] begin[{]
method[toGeoCodeItem, return_type[type[GeoCodeItem]], modifier[public], parameter[gsItem]] begin[{]
if[binary_operation[member[.gsItem], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getPlaceName, postfix_operators=[], prefix_operators=[], qualifier=gsItem, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getModernPlaceName, postfix_operators=[], prefix_operators=[], qualifier=gsItem, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getResult, postfix_operators=[], prefix_operators=[], qualifier=gsItem, selectors=[], type_arguments=None)], member=toGeocodingResult, 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=GeoCodeItem, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[GeoCodeItem] identifier[toGeoCodeItem] operator[SEP] Keyword[final] identifier[GeoServiceItem] identifier[gsItem] operator[SEP] {
Keyword[if] operator[SEP] identifier[gsItem] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[return] Keyword[new] identifier[GeoCodeItem] operator[SEP] identifier[gsItem] operator[SEP] identifier[getPlaceName] operator[SEP] operator[SEP] , identifier[gsItem] operator[SEP] identifier[getModernPlaceName] operator[SEP] operator[SEP] , identifier[toGeocodingResult] operator[SEP] identifier[gsItem] operator[SEP] identifier[getResult] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected Integer getInteger(Exchange exchange, Message message, String name) {
Object value = getObject(exchange, message, name);
if (value instanceof Integer) {
return (Integer)value;
} else if (value instanceof Number) {
return Integer.valueOf(((Number)value).intValue());
} else if (value instanceof String) {
return Integer.valueOf(((String)value).trim());
}
return null;
} | class class_name[name] begin[{]
method[getInteger, return_type[type[Integer]], modifier[protected], parameter[exchange, message, name]] begin[{]
local_variable[type[Object], value]
if[binary_operation[member[.value], instanceof, type[Integer]]] begin[{]
return[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))]
else begin[{]
if[binary_operation[member[.value], instanceof, type[Number]]] begin[{]
return[call[Integer.valueOf, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None))]]]
else begin[{]
if[binary_operation[member[.value], instanceof, type[String]]] begin[{]
return[call[Integer.valueOf, parameter[Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]]]
else begin[{]
None
end[}]
end[}]
end[}]
return[literal[null]]
end[}]
END[}] | Keyword[protected] identifier[Integer] identifier[getInteger] operator[SEP] identifier[Exchange] identifier[exchange] , identifier[Message] identifier[message] , identifier[String] identifier[name] operator[SEP] {
identifier[Object] identifier[value] operator[=] identifier[getObject] operator[SEP] identifier[exchange] , identifier[message] , identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Integer] operator[SEP] {
Keyword[return] operator[SEP] identifier[Integer] operator[SEP] identifier[value] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[Number] operator[SEP] {
Keyword[return] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] Keyword[instanceof] identifier[String] operator[SEP] {
Keyword[return] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
@Override
public ConnectionLink getConnectionLink(VirtualConnection vc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "getConnectionLink");
}
// add this new connection link to the next in-use list based on
// the atomic index, the extra add/mod handles the negative values
int index = ((this.inUseIndex.getAndIncrement() % SIZE_IN_USE) + SIZE_IN_USE) % SIZE_IN_USE;
TCPConnLink connLink = new TCPConnLink(vc, this, this.config, index);
this.inUse[index].add(connLink);
// assign default ConnectionType and unique ConnectionHandle to new inbound
// connection
// ConnectionType may seem redundant, but is used on some platforms to
// identify
// more than just inbound/outbound flow.
ConnectionType.setDefaultVCConnectionType(vc);
ConnectionHandle.getConnectionHandle(vc);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "getConnectionLink: " + connLink);
}
return connLink;
} | class class_name[name] begin[{]
method[getConnectionLink, return_type[type[ConnectionLink]], modifier[public], parameter[vc]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.entry, parameter[member[.tc], literal["getConnectionLink"]]]
else begin[{]
None
end[}]
local_variable[type[int], index]
local_variable[type[TCPConnLink], connLink]
THIS[member[None.inUse]ArraySelector(index=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))call[None.add, parameter[member[.connLink]]]]
call[ConnectionType.setDefaultVCConnectionType, parameter[member[.vc]]]
call[ConnectionHandle.getConnectionHandle, parameter[member[.vc]]]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[Tr.exit, parameter[member[.tc], binary_operation[literal["getConnectionLink: "], +, member[.connLink]]]]
else begin[{]
None
end[}]
return[member[.connLink]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[ConnectionLink] identifier[getConnectionLink] operator[SEP] identifier[VirtualConnection] identifier[vc] 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[Tr] operator[SEP] identifier[entry] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
Keyword[int] identifier[index] operator[=] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[inUseIndex] operator[SEP] identifier[getAndIncrement] operator[SEP] operator[SEP] operator[%] identifier[SIZE_IN_USE] operator[SEP] operator[+] identifier[SIZE_IN_USE] operator[SEP] operator[%] identifier[SIZE_IN_USE] operator[SEP] identifier[TCPConnLink] identifier[connLink] operator[=] Keyword[new] identifier[TCPConnLink] operator[SEP] identifier[vc] , Keyword[this] , Keyword[this] operator[SEP] identifier[config] , identifier[index] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[inUse] operator[SEP] identifier[index] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[connLink] operator[SEP] operator[SEP] identifier[ConnectionType] operator[SEP] identifier[setDefaultVCConnectionType] operator[SEP] identifier[vc] operator[SEP] operator[SEP] identifier[ConnectionHandle] operator[SEP] identifier[getConnectionHandle] operator[SEP] identifier[vc] 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[Tr] operator[SEP] identifier[exit] operator[SEP] identifier[tc] , literal[String] operator[+] identifier[connLink] operator[SEP] operator[SEP]
}
Keyword[return] identifier[connLink] operator[SEP]
}
|
public NfsReaddirplusRequest makeReaddirplusRequest(long cookie, long cookieverf, int dircount, int maxcount)
throws IOException {
return getNfs().makeReaddirplusRequest(followLinks().getFileHandle(), cookie, cookieverf, dircount, maxcount);
} | class class_name[name] begin[{]
method[makeReaddirplusRequest, return_type[type[NfsReaddirplusRequest]], modifier[public], parameter[cookie, cookieverf, dircount, maxcount]] begin[{]
return[call[.getNfs, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[NfsReaddirplusRequest] identifier[makeReaddirplusRequest] operator[SEP] Keyword[long] identifier[cookie] , Keyword[long] identifier[cookieverf] , Keyword[int] identifier[dircount] , Keyword[int] identifier[maxcount] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[return] identifier[getNfs] operator[SEP] operator[SEP] operator[SEP] identifier[makeReaddirplusRequest] operator[SEP] identifier[followLinks] operator[SEP] operator[SEP] operator[SEP] identifier[getFileHandle] operator[SEP] operator[SEP] , identifier[cookie] , identifier[cookieverf] , identifier[dircount] , identifier[maxcount] operator[SEP] operator[SEP]
}
|
public InputStream getResourceAsStream(String name, BeanContextChild bcc) throws IllegalArgumentException {
// bcc must be a child of this context
if (!contains(bcc)) {
throw new IllegalArgumentException("Child is not a member of this context");
}
ClassLoader cl = bcc.getClass().getClassLoader();
InputStream is;
if (cl != null && (is = cl.getResourceAsStream(name)) != null) {
return is;
}
return ClassLoader.getSystemResourceAsStream(name);
} | class class_name[name] begin[{]
method[getResourceAsStream, return_type[type[InputStream]], modifier[public], parameter[name, bcc]] begin[{]
if[call[.contains, parameter[member[.bcc]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Child is not a member of this context")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[ClassLoader], cl]
local_variable[type[InputStream], is]
if[binary_operation[binary_operation[member[.cl], !=, literal[null]], &&, binary_operation[assign[member[.is], call[cl.getResourceAsStream, parameter[member[.name]]]], !=, literal[null]]]] begin[{]
return[member[.is]]
else begin[{]
None
end[}]
return[call[ClassLoader.getSystemResourceAsStream, parameter[member[.name]]]]
end[}]
END[}] | Keyword[public] identifier[InputStream] identifier[getResourceAsStream] operator[SEP] identifier[String] identifier[name] , identifier[BeanContextChild] identifier[bcc] operator[SEP] Keyword[throws] identifier[IllegalArgumentException] {
Keyword[if] operator[SEP] operator[!] identifier[contains] operator[SEP] identifier[bcc] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[ClassLoader] identifier[cl] operator[=] identifier[bcc] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] identifier[InputStream] identifier[is] operator[SEP] Keyword[if] operator[SEP] identifier[cl] operator[!=] Other[null] operator[&&] operator[SEP] identifier[is] operator[=] identifier[cl] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[name] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[is] operator[SEP]
}
Keyword[return] identifier[ClassLoader] operator[SEP] identifier[getSystemResourceAsStream] operator[SEP] identifier[name] operator[SEP] operator[SEP]
}
|
public final EObject ruleXNumberLiteral() throws RecognitionException {
EObject current = null;
AntlrDatatypeRuleToken lv_value_1_0 = null;
enterRule();
try {
// InternalPureXbase.g:5368:2: ( ( () ( (lv_value_1_0= ruleNumber ) ) ) )
// InternalPureXbase.g:5369:2: ( () ( (lv_value_1_0= ruleNumber ) ) )
{
// InternalPureXbase.g:5369:2: ( () ( (lv_value_1_0= ruleNumber ) ) )
// InternalPureXbase.g:5370:3: () ( (lv_value_1_0= ruleNumber ) )
{
// InternalPureXbase.g:5370:3: ()
// InternalPureXbase.g:5371:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXNumberLiteralAccess().getXNumberLiteralAction_0(),
current);
}
}
// InternalPureXbase.g:5377:3: ( (lv_value_1_0= ruleNumber ) )
// InternalPureXbase.g:5378:4: (lv_value_1_0= ruleNumber )
{
// InternalPureXbase.g:5378:4: (lv_value_1_0= ruleNumber )
// InternalPureXbase.g:5379:5: lv_value_1_0= ruleNumber
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXNumberLiteralAccess().getValueNumberParserRuleCall_1_0());
}
pushFollow(FOLLOW_2);
lv_value_1_0=ruleNumber();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXNumberLiteralRule());
}
set(
current,
"value",
lv_value_1_0,
"org.eclipse.xtext.xbase.Xbase.Number");
afterParserOrEnumRuleCall();
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} | class class_name[name] begin[{]
method[ruleXNumberLiteral, return_type[type[EObject]], modifier[final public], parameter[]] begin[{]
local_variable[type[EObject], current]
local_variable[type[AntlrDatatypeRuleToken], lv_value_1_0]
call[.enterRule, parameter[]]
TryStatement(block=[BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getXNumberLiteralAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getXNumberLiteralAction_0, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forceCreateModelElement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]))]), BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getXNumberLiteralAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getValueNumberParserRuleCall_1_0, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=newCompositeNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=lv_value_1_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=ruleNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=current, 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=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getXNumberLiteralRule, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[], type_arguments=None)], member=createModelElementForParent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="value"), MemberReference(member=lv_value_1_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="org.eclipse.xtext.xbase.Xbase.Number")], member=set, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=afterParserOrEnumRuleCall, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))])])])]), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=leaveRule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=appendSkippedTokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[], label=None, resources=None)
return[member[.current]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[EObject] identifier[ruleXNumberLiteral] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
identifier[EObject] identifier[current] operator[=] Other[null] operator[SEP] identifier[AntlrDatatypeRuleToken] identifier[lv_value_1_0] operator[=] Other[null] operator[SEP] identifier[enterRule] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
{
{
{
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[current] operator[=] identifier[forceCreateModelElement] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getXNumberLiteralAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getXNumberLiteralAction_0] operator[SEP] operator[SEP] , identifier[current] operator[SEP] operator[SEP]
}
} {
{
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[newCompositeNode] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getXNumberLiteralAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getValueNumberParserRuleCall_1_0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[pushFollow] operator[SEP] identifier[FOLLOW_2] operator[SEP] operator[SEP] identifier[lv_value_1_0] operator[=] identifier[ruleNumber] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] identifier[current] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[current] operator[==] Other[null] operator[SEP] {
identifier[current] operator[=] identifier[createModelElementForParent] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getXNumberLiteralRule] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[set] operator[SEP] identifier[current] , literal[String] , identifier[lv_value_1_0] , literal[String] operator[SEP] operator[SEP] identifier[afterParserOrEnumRuleCall] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[leaveRule] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[recover] operator[SEP] identifier[input] , identifier[re] operator[SEP] operator[SEP] identifier[appendSkippedTokens] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
}
Keyword[return] identifier[current] operator[SEP]
}
|
public void endDocument() throws SAXException
{
charactersFlush();
m_nextsib.setElementAt(NULL,m_currentDocumentNode);
if (m_firstch.elementAt(m_currentDocumentNode) == NOTPROCESSED)
m_firstch.setElementAt(NULL,m_currentDocumentNode);
if (DTM.NULL != m_previous)
m_nextsib.setElementAt(DTM.NULL,m_previous);
m_parents = null;
m_prefixMappings = null;
m_contextIndexes = null;
m_currentDocumentNode= NULL; // no longer open
m_endDocumentOccured = true;
} | class class_name[name] begin[{]
method[endDocument, return_type[void], modifier[public], parameter[]] begin[{]
call[.charactersFlush, parameter[]]
call[m_nextsib.setElementAt, parameter[member[.NULL], member[.m_currentDocumentNode]]]
if[binary_operation[call[m_firstch.elementAt, parameter[member[.m_currentDocumentNode]]], ==, member[.NOTPROCESSED]]] begin[{]
call[m_firstch.setElementAt, parameter[member[.NULL], member[.m_currentDocumentNode]]]
else begin[{]
None
end[}]
if[binary_operation[member[DTM.NULL], !=, member[.m_previous]]] begin[{]
call[m_nextsib.setElementAt, parameter[member[DTM.NULL], member[.m_previous]]]
else begin[{]
None
end[}]
assign[member[.m_parents], literal[null]]
assign[member[.m_prefixMappings], literal[null]]
assign[member[.m_contextIndexes], literal[null]]
assign[member[.m_currentDocumentNode], member[.NULL]]
assign[member[.m_endDocumentOccured], literal[true]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[endDocument] operator[SEP] operator[SEP] Keyword[throws] identifier[SAXException] {
identifier[charactersFlush] operator[SEP] operator[SEP] operator[SEP] identifier[m_nextsib] operator[SEP] identifier[setElementAt] operator[SEP] identifier[NULL] , identifier[m_currentDocumentNode] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[m_firstch] operator[SEP] identifier[elementAt] operator[SEP] identifier[m_currentDocumentNode] operator[SEP] operator[==] identifier[NOTPROCESSED] operator[SEP] identifier[m_firstch] operator[SEP] identifier[setElementAt] operator[SEP] identifier[NULL] , identifier[m_currentDocumentNode] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[DTM] operator[SEP] identifier[NULL] operator[!=] identifier[m_previous] operator[SEP] identifier[m_nextsib] operator[SEP] identifier[setElementAt] operator[SEP] identifier[DTM] operator[SEP] identifier[NULL] , identifier[m_previous] operator[SEP] operator[SEP] identifier[m_parents] operator[=] Other[null] operator[SEP] identifier[m_prefixMappings] operator[=] Other[null] operator[SEP] identifier[m_contextIndexes] operator[=] Other[null] operator[SEP] identifier[m_currentDocumentNode] operator[=] identifier[NULL] operator[SEP] identifier[m_endDocumentOccured] operator[=] literal[boolean] operator[SEP]
}
|
public void process(SleeComponentWithUsageParametersInterface component) throws DeploymentException {
ClassPool classPool = component.getClassPool();
String deploymentDir = component.getDeploymentDir().getAbsolutePath();
Class<?> usageParametersInterface = component
.getUsageParametersInterface();
if (usageParametersInterface != null) {
try {
// generate the concrete usage param set class
component
.setUsageParametersConcreteClass(new ConcreteUsageParameterClassGenerator(
usageParametersInterface.getName(),
deploymentDir, classPool)
.generateConcreteUsageParameterClass());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Generated usage parameter impl class for "+component);
}
// generate the mbeans
new ConcreteUsageParameterMBeanGenerator(component)
.generateConcreteUsageParameterMBean();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Generated usage mbean (interface and impl) for "+component);
}
} catch (DeploymentException ex) {
throw ex;
} catch (Exception ex) {
throw new DeploymentException(
"Failed to generate "+component+" usage parameter class", ex);
}
}
} | class class_name[name] begin[{]
method[process, return_type[void], modifier[public], parameter[component]] begin[{]
local_variable[type[ClassPool], classPool]
local_variable[type[String], deploymentDir]
local_variable[type[Class], usageParametersInterface]
if[binary_operation[member[.usageParametersInterface], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=usageParametersInterface, selectors=[], type_arguments=None), MemberReference(member=deploymentDir, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=classPool, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=generateConcreteUsageParameterClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ConcreteUsageParameterClassGenerator, sub_type=None))], member=setUsageParametersConcreteClass, postfix_operators=[], prefix_operators=[], qualifier=component, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), 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="Generated usage parameter impl class for "), operandr=MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=ClassCreator(arguments=[MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=generateConcreteUsageParameterMBean, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ConcreteUsageParameterMBeanGenerator, sub_type=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), 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="Generated usage mbean (interface and impl) for "), operandr=MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['DeploymentException'])), CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to generate "), operandr=MemberReference(member=component, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" usage parameter class"), operator=+), 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=DeploymentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[process] operator[SEP] identifier[SleeComponentWithUsageParametersInterface] identifier[component] operator[SEP] Keyword[throws] identifier[DeploymentException] {
identifier[ClassPool] identifier[classPool] operator[=] identifier[component] operator[SEP] identifier[getClassPool] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[deploymentDir] operator[=] identifier[component] operator[SEP] identifier[getDeploymentDir] operator[SEP] operator[SEP] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[usageParametersInterface] operator[=] identifier[component] operator[SEP] identifier[getUsageParametersInterface] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[usageParametersInterface] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[component] operator[SEP] identifier[setUsageParametersConcreteClass] operator[SEP] Keyword[new] identifier[ConcreteUsageParameterClassGenerator] operator[SEP] identifier[usageParametersInterface] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[deploymentDir] , identifier[classPool] operator[SEP] operator[SEP] identifier[generateConcreteUsageParameterClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOGGER] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[component] operator[SEP] operator[SEP]
}
Keyword[new] identifier[ConcreteUsageParameterMBeanGenerator] operator[SEP] identifier[component] operator[SEP] operator[SEP] identifier[generateConcreteUsageParameterMBean] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOGGER] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[component] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[DeploymentException] identifier[ex] operator[SEP] {
Keyword[throw] identifier[ex] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DeploymentException] operator[SEP] literal[String] operator[+] identifier[component] operator[+] literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
}
|
private static AdCustomizerFeed createCustomizerFeed(AdWordsServicesInterface adWordsServices,
AdWordsSession session, String feedName) throws RemoteException {
// Get the AdCustomizerFeedService.
AdCustomizerFeedServiceInterface adCustomizerFeedService =
adWordsServices.get(session, AdCustomizerFeedServiceInterface.class);
AdCustomizerFeed customizerFeed = new AdCustomizerFeed();
customizerFeed.setFeedName(feedName);
AdCustomizerFeedAttribute nameAttribute = new AdCustomizerFeedAttribute();
nameAttribute.setName("Name");
nameAttribute.setType(AdCustomizerFeedAttributeType.STRING);
AdCustomizerFeedAttribute priceAttribute = new AdCustomizerFeedAttribute();
priceAttribute.setName("Price");
priceAttribute.setType(AdCustomizerFeedAttributeType.STRING);
AdCustomizerFeedAttribute dateAttribute = new AdCustomizerFeedAttribute();
dateAttribute.setName("Date");
dateAttribute.setType(AdCustomizerFeedAttributeType.DATE_TIME);
customizerFeed.setFeedAttributes(
new AdCustomizerFeedAttribute[] {nameAttribute, priceAttribute, dateAttribute});
AdCustomizerFeedOperation feedOperation = new AdCustomizerFeedOperation();
feedOperation.setOperand(customizerFeed);
feedOperation.setOperator(Operator.ADD);
AdCustomizerFeed addedFeed = adCustomizerFeedService.mutate(
new AdCustomizerFeedOperation[] {feedOperation}).getValue()[0];
System.out.printf(
"Created ad customizer feed with ID %d, name '%s' and attributes:%n",
addedFeed.getFeedId(), addedFeed.getFeedName());
for (AdCustomizerFeedAttribute feedAttribute : addedFeed.getFeedAttributes()) {
System.out.printf(
" ID: %d, name: '%s', type: %s%n",
feedAttribute.getId(), feedAttribute.getName(), feedAttribute.getType());
}
return addedFeed;
} | class class_name[name] begin[{]
method[createCustomizerFeed, return_type[type[AdCustomizerFeed]], modifier[private static], parameter[adWordsServices, session, feedName]] begin[{]
local_variable[type[AdCustomizerFeedServiceInterface], adCustomizerFeedService]
local_variable[type[AdCustomizerFeed], customizerFeed]
call[customizerFeed.setFeedName, parameter[member[.feedName]]]
local_variable[type[AdCustomizerFeedAttribute], nameAttribute]
call[nameAttribute.setName, parameter[literal["Name"]]]
call[nameAttribute.setType, parameter[member[AdCustomizerFeedAttributeType.STRING]]]
local_variable[type[AdCustomizerFeedAttribute], priceAttribute]
call[priceAttribute.setName, parameter[literal["Price"]]]
call[priceAttribute.setType, parameter[member[AdCustomizerFeedAttributeType.STRING]]]
local_variable[type[AdCustomizerFeedAttribute], dateAttribute]
call[dateAttribute.setName, parameter[literal["Date"]]]
call[dateAttribute.setType, parameter[member[AdCustomizerFeedAttributeType.DATE_TIME]]]
call[customizerFeed.setFeedAttributes, parameter[ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=nameAttribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=priceAttribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dateAttribute, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AdCustomizerFeedAttribute, sub_type=None))]]
local_variable[type[AdCustomizerFeedOperation], feedOperation]
call[feedOperation.setOperand, parameter[member[.customizerFeed]]]
call[feedOperation.setOperator, parameter[member[Operator.ADD]]]
local_variable[type[AdCustomizerFeed], addedFeed]
call[System.out.printf, parameter[literal["Created ad customizer feed with ID %d, name '%s' and attributes:%n"], call[addedFeed.getFeedId, parameter[]], call[addedFeed.getFeedName, parameter[]]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" ID: %d, name: '%s', type: %s%n"), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=feedAttribute, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=feedAttribute, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=feedAttribute, selectors=[], type_arguments=None)], member=printf, postfix_operators=[], prefix_operators=[], qualifier=System.out, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFeedAttributes, postfix_operators=[], prefix_operators=[], qualifier=addedFeed, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=feedAttribute)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=AdCustomizerFeedAttribute, sub_type=None))), label=None)
return[member[.addedFeed]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[AdCustomizerFeed] identifier[createCustomizerFeed] operator[SEP] identifier[AdWordsServicesInterface] identifier[adWordsServices] , identifier[AdWordsSession] identifier[session] , identifier[String] identifier[feedName] operator[SEP] Keyword[throws] identifier[RemoteException] {
identifier[AdCustomizerFeedServiceInterface] identifier[adCustomizerFeedService] operator[=] identifier[adWordsServices] operator[SEP] identifier[get] operator[SEP] identifier[session] , identifier[AdCustomizerFeedServiceInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[AdCustomizerFeed] identifier[customizerFeed] operator[=] Keyword[new] identifier[AdCustomizerFeed] operator[SEP] operator[SEP] operator[SEP] identifier[customizerFeed] operator[SEP] identifier[setFeedName] operator[SEP] identifier[feedName] operator[SEP] operator[SEP] identifier[AdCustomizerFeedAttribute] identifier[nameAttribute] operator[=] Keyword[new] identifier[AdCustomizerFeedAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[nameAttribute] operator[SEP] identifier[setName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[nameAttribute] operator[SEP] identifier[setType] operator[SEP] identifier[AdCustomizerFeedAttributeType] operator[SEP] identifier[STRING] operator[SEP] operator[SEP] identifier[AdCustomizerFeedAttribute] identifier[priceAttribute] operator[=] Keyword[new] identifier[AdCustomizerFeedAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[priceAttribute] operator[SEP] identifier[setName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[priceAttribute] operator[SEP] identifier[setType] operator[SEP] identifier[AdCustomizerFeedAttributeType] operator[SEP] identifier[STRING] operator[SEP] operator[SEP] identifier[AdCustomizerFeedAttribute] identifier[dateAttribute] operator[=] Keyword[new] identifier[AdCustomizerFeedAttribute] operator[SEP] operator[SEP] operator[SEP] identifier[dateAttribute] operator[SEP] identifier[setName] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dateAttribute] operator[SEP] identifier[setType] operator[SEP] identifier[AdCustomizerFeedAttributeType] operator[SEP] identifier[DATE_TIME] operator[SEP] operator[SEP] identifier[customizerFeed] operator[SEP] identifier[setFeedAttributes] operator[SEP] Keyword[new] identifier[AdCustomizerFeedAttribute] operator[SEP] operator[SEP] {
identifier[nameAttribute] , identifier[priceAttribute] , identifier[dateAttribute]
} operator[SEP] operator[SEP] identifier[AdCustomizerFeedOperation] identifier[feedOperation] operator[=] Keyword[new] identifier[AdCustomizerFeedOperation] operator[SEP] operator[SEP] operator[SEP] identifier[feedOperation] operator[SEP] identifier[setOperand] operator[SEP] identifier[customizerFeed] operator[SEP] operator[SEP] identifier[feedOperation] operator[SEP] identifier[setOperator] operator[SEP] identifier[Operator] operator[SEP] identifier[ADD] operator[SEP] operator[SEP] identifier[AdCustomizerFeed] identifier[addedFeed] operator[=] identifier[adCustomizerFeedService] operator[SEP] identifier[mutate] operator[SEP] Keyword[new] identifier[AdCustomizerFeedOperation] operator[SEP] operator[SEP] {
identifier[feedOperation]
} operator[SEP] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[addedFeed] operator[SEP] identifier[getFeedId] operator[SEP] operator[SEP] , identifier[addedFeed] operator[SEP] identifier[getFeedName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[AdCustomizerFeedAttribute] identifier[feedAttribute] operator[:] identifier[addedFeed] operator[SEP] identifier[getFeedAttributes] operator[SEP] operator[SEP] operator[SEP] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[feedAttribute] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[feedAttribute] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[feedAttribute] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[addedFeed] operator[SEP]
}
|
@Nonnull
private String unpackLanguageOrRegion(byte[] value, int base) {
Preconditions.checkState(value.length == 2, "Language or country value must be 2 bytes.");
if (value[0] == 0 && value[1] == 0) {
return "";
}
if (isTruthy(UnsignedBytes.toInt(value[0]) & 0x80)) {
byte[] result = new byte[3];
result[0] = (byte) (base + (value[1] & 0x1F));
result[1] = (byte) (base + ((value[1] & 0xE0) >>> 5) + ((value[0] & 0x03) << 3));
result[2] = (byte) (base + ((value[0] & 0x7C) >>> 2));
return new String(result, US_ASCII);
}
return new String(value, US_ASCII);
} | class class_name[name] begin[{]
method[unpackLanguageOrRegion, return_type[type[String]], modifier[private], parameter[value, base]] begin[{]
call[Preconditions.checkState, parameter[binary_operation[member[value.length], ==, literal[2]], literal["Language or country value must be 2 bytes."]]]
if[binary_operation[binary_operation[member[.value], ==, literal[0]], &&, binary_operation[member[.value], ==, literal[0]]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
if[call[.isTruthy, parameter[binary_operation[call[UnsignedBytes.toInt, parameter[member[.value]]], &, literal[0x80]]]]] begin[{]
local_variable[type[byte], result]
assign[member[.result], Cast(expression=BinaryOperation(operandl=MemberReference(member=base, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x1F), operator=&), operator=+), type=BasicType(dimensions=[], name=byte))]
assign[member[.result], Cast(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=base, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xE0), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5), operator=>>>), operator=+), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x03), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=<<), operator=+), type=BasicType(dimensions=[], name=byte))]
assign[member[.result], Cast(expression=BinaryOperation(operandl=MemberReference(member=base, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0x7C), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>>>), operator=+), type=BasicType(dimensions=[], name=byte))]
return[ClassCreator(arguments=[MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=US_ASCII, 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=String, sub_type=None))]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=US_ASCII, 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=String, sub_type=None))]
end[}]
END[}] | annotation[@] identifier[Nonnull] Keyword[private] identifier[String] identifier[unpackLanguageOrRegion] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[value] , Keyword[int] identifier[base] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[value] operator[SEP] identifier[length] operator[==] Other[2] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[SEP] Other[0] operator[SEP] operator[==] Other[0] operator[&&] identifier[value] operator[SEP] Other[1] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[if] operator[SEP] identifier[isTruthy] operator[SEP] identifier[UnsignedBytes] operator[SEP] identifier[toInt] operator[SEP] identifier[value] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] Keyword[byte] operator[SEP] Other[3] operator[SEP] operator[SEP] identifier[result] operator[SEP] Other[0] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[base] operator[+] operator[SEP] identifier[value] operator[SEP] Other[1] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] Other[1] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[base] operator[+] operator[SEP] operator[SEP] identifier[value] operator[SEP] Other[1] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[>] operator[>] operator[>] Other[5] operator[SEP] operator[+] operator[SEP] operator[SEP] identifier[value] operator[SEP] Other[0] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[<<] Other[3] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] Other[2] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[base] operator[+] operator[SEP] operator[SEP] identifier[value] operator[SEP] Other[0] operator[SEP] operator[&] literal[Integer] operator[SEP] operator[>] operator[>] operator[>] Other[2] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[result] , identifier[US_ASCII] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[String] operator[SEP] identifier[value] , identifier[US_ASCII] operator[SEP] operator[SEP]
}
|
private void removeEntries(HistoryKey pKey) {
if (pKey.isMBeanPattern()) {
patterns.remove(pKey);
List<HistoryKey> toRemove = new ArrayList<HistoryKey>();
for (HistoryKey key : historyStore.keySet()) {
if (pKey.matches(key)) {
toRemove.add(key);
}
}
// Avoid concurrent modification exceptions
for (HistoryKey key : toRemove) {
historyStore.remove(key);
}
} else {
HistoryEntry entry = historyStore.get(pKey);
if (entry != null) {
historyStore.remove(pKey);
}
}
} | class class_name[name] begin[{]
method[removeEntries, return_type[void], modifier[private], parameter[pKey]] begin[{]
if[call[pKey.isMBeanPattern, parameter[]]] begin[{]
call[patterns.remove, parameter[member[.pKey]]]
local_variable[type[List], toRemove]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=matches, postfix_operators=[], prefix_operators=[], qualifier=pKey, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=toRemove, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=historyStore, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HistoryKey, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=historyStore, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=toRemove, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=HistoryKey, sub_type=None))), label=None)
else begin[{]
local_variable[type[HistoryEntry], entry]
if[binary_operation[member[.entry], !=, literal[null]]] begin[{]
call[historyStore.remove, parameter[member[.pKey]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[removeEntries] operator[SEP] identifier[HistoryKey] identifier[pKey] operator[SEP] {
Keyword[if] operator[SEP] identifier[pKey] operator[SEP] identifier[isMBeanPattern] operator[SEP] operator[SEP] operator[SEP] {
identifier[patterns] operator[SEP] identifier[remove] operator[SEP] identifier[pKey] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[HistoryKey] operator[>] identifier[toRemove] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[HistoryKey] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[HistoryKey] identifier[key] operator[:] identifier[historyStore] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[pKey] operator[SEP] identifier[matches] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[toRemove] operator[SEP] identifier[add] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[HistoryKey] identifier[key] operator[:] identifier[toRemove] operator[SEP] {
identifier[historyStore] operator[SEP] identifier[remove] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[HistoryEntry] identifier[entry] operator[=] identifier[historyStore] operator[SEP] identifier[get] operator[SEP] identifier[pKey] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entry] operator[!=] Other[null] operator[SEP] {
identifier[historyStore] operator[SEP] identifier[remove] operator[SEP] identifier[pKey] operator[SEP] operator[SEP]
}
}
}
|
protected static void put(String resource, RequestParams params,
ResponseHandler responseHandler) {
WonderPushRestClient.put(resource, params, responseHandler);
} | class class_name[name] begin[{]
method[put, return_type[void], modifier[static protected], parameter[resource, params, responseHandler]] begin[{]
call[WonderPushRestClient.put, parameter[member[.resource], member[.params], member[.responseHandler]]]
end[}]
END[}] | Keyword[protected] Keyword[static] Keyword[void] identifier[put] operator[SEP] identifier[String] identifier[resource] , identifier[RequestParams] identifier[params] , identifier[ResponseHandler] identifier[responseHandler] operator[SEP] {
identifier[WonderPushRestClient] operator[SEP] identifier[put] operator[SEP] identifier[resource] , identifier[params] , identifier[responseHandler] operator[SEP] operator[SEP]
}
|
@Override
public synchronized void close () {
SmbTreeHandleImpl th = this.treeHandle;
if ( th != null ) {
this.treeHandle = null;
if ( this.transportContext.getConfig().isStrictResourceLifecycle() ) {
th.close();
}
}
} | class class_name[name] begin[{]
method[close, return_type[void], modifier[synchronized public], parameter[]] begin[{]
local_variable[type[SmbTreeHandleImpl], th]
if[binary_operation[member[.th], !=, literal[null]]] begin[{]
assign[THIS[member[None.treeHandle]], literal[null]]
if[THIS[member[None.transportContext]call[None.getConfig, parameter[]]call[None.isStrictResourceLifecycle, parameter[]]]] begin[{]
call[th.close, parameter[]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[synchronized] Keyword[void] identifier[close] operator[SEP] operator[SEP] {
identifier[SmbTreeHandleImpl] identifier[th] operator[=] Keyword[this] operator[SEP] identifier[treeHandle] operator[SEP] Keyword[if] operator[SEP] identifier[th] operator[!=] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[treeHandle] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[transportContext] operator[SEP] identifier[getConfig] operator[SEP] operator[SEP] operator[SEP] identifier[isStrictResourceLifecycle] operator[SEP] operator[SEP] operator[SEP] {
identifier[th] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@Override
public EClass getIfcDerivedUnit() {
if (ifcDerivedUnitEClass == null) {
ifcDerivedUnitEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(172);
}
return ifcDerivedUnitEClass;
} | class class_name[name] begin[{]
method[getIfcDerivedUnit, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcDerivedUnitEClass], ==, literal[null]]] begin[{]
assign[member[.ifcDerivedUnitEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=172)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcDerivedUnitEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcDerivedUnit] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcDerivedUnitEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcDerivedUnitEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[172] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcDerivedUnitEClass] operator[SEP]
}
|
public static double[] toArray(Collection<? extends Number> collection) {
if (collection instanceof DoubleArrayAsList) {
return ((DoubleArrayAsList) collection).toDoubleArray();
}
Object[] boxedArray = collection.toArray();
int len = boxedArray.length;
double[] array = new double[len];
for (int i = 0; i < len; i++) {
// checkNotNull for GWT (do not optimize)
array[i] = ((Number) checkNotNull(boxedArray[i])).doubleValue();
}
return array;
} | class class_name[name] begin[{]
method[toArray, return_type[type[double]], modifier[public static], parameter[collection]] begin[{]
if[binary_operation[member[.collection], instanceof, type[DoubleArrayAsList]]] begin[{]
return[Cast(expression=MemberReference(member=collection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=DoubleArrayAsList, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[Object], boxedArray]
local_variable[type[int], len]
local_variable[type[double], array]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=boxedArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=checkNotNull, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Number, sub_type=None))), 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=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)
return[member[.array]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] operator[SEP] operator[SEP] identifier[toArray] operator[SEP] identifier[Collection] operator[<] operator[?] Keyword[extends] identifier[Number] operator[>] identifier[collection] operator[SEP] {
Keyword[if] operator[SEP] identifier[collection] Keyword[instanceof] identifier[DoubleArrayAsList] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[DoubleArrayAsList] operator[SEP] identifier[collection] operator[SEP] operator[SEP] identifier[toDoubleArray] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Object] operator[SEP] operator[SEP] identifier[boxedArray] operator[=] identifier[collection] operator[SEP] identifier[toArray] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[len] operator[=] identifier[boxedArray] operator[SEP] identifier[length] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[array] operator[=] Keyword[new] Keyword[double] operator[SEP] identifier[len] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[array] operator[SEP] identifier[i] operator[SEP] operator[=] operator[SEP] operator[SEP] identifier[Number] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[boxedArray] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[doubleValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[array] operator[SEP]
}
|
private void addMethodIfExist(DocEnv env, ClassSymbol def, String methodName) {
Names names = def.name.table.names;
for (Symbol sym : def.members().getSymbolsByName(names.fromString(methodName))) {
if (sym.kind == MTH) {
MethodSymbol md = (MethodSymbol)sym;
if ((md.flags() & Flags.STATIC) == 0) {
/*
* WARNING: not robust if unqualifiedMethodName is overloaded
* method. Signature checking could make more robust.
* READOBJECT takes a single parameter, java.io.ObjectInputStream.
* WRITEOBJECT takes a single parameter, java.io.ObjectOutputStream.
*/
methods.append(env.getMethodDoc(md));
}
}
}
} | class class_name[name] begin[{]
method[addMethodIfExist, return_type[void], modifier[private], parameter[env, def, methodName]] begin[{]
local_variable[type[Names], names]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=kind, postfix_operators=[], prefix_operators=[], qualifier=sym, selectors=[]), operandr=MemberReference(member=MTH, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=sym, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=MethodSymbol, sub_type=None)), name=md)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MethodSymbol, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=flags, postfix_operators=[], prefix_operators=[], qualifier=md, selectors=[], type_arguments=None), operandr=MemberReference(member=STATIC, postfix_operators=[], prefix_operators=[], qualifier=Flags, selectors=[]), operator=&), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=md, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMethodDoc, postfix_operators=[], prefix_operators=[], qualifier=env, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=methods, selectors=[], type_arguments=None), label=None)]))]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=members, postfix_operators=[], prefix_operators=[], qualifier=def, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromString, postfix_operators=[], prefix_operators=[], qualifier=names, selectors=[], type_arguments=None)], member=getSymbolsByName, 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=sym)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Symbol, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[addMethodIfExist] operator[SEP] identifier[DocEnv] identifier[env] , identifier[ClassSymbol] identifier[def] , identifier[String] identifier[methodName] operator[SEP] {
identifier[Names] identifier[names] operator[=] identifier[def] operator[SEP] identifier[name] operator[SEP] identifier[table] operator[SEP] identifier[names] operator[SEP] Keyword[for] operator[SEP] identifier[Symbol] identifier[sym] operator[:] identifier[def] operator[SEP] identifier[members] operator[SEP] operator[SEP] operator[SEP] identifier[getSymbolsByName] operator[SEP] identifier[names] operator[SEP] identifier[fromString] operator[SEP] identifier[methodName] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[sym] operator[SEP] identifier[kind] operator[==] identifier[MTH] operator[SEP] {
identifier[MethodSymbol] identifier[md] operator[=] operator[SEP] identifier[MethodSymbol] operator[SEP] identifier[sym] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[md] operator[SEP] identifier[flags] operator[SEP] operator[SEP] operator[&] identifier[Flags] operator[SEP] identifier[STATIC] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[methods] operator[SEP] identifier[append] operator[SEP] identifier[env] operator[SEP] identifier[getMethodDoc] operator[SEP] identifier[md] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
public static Class<?>[] toClass(final Object... array) {
if (array == null) {
return null;
} else if (array.length == 0) {
return ArrayUtils.EMPTY_CLASS_ARRAY;
}
final Class<?>[] classes = new Class<?>[array.length];
for (int i = 0; i < array.length; i++) {
classes[i] = array[i] == null ? null : array[i].getClass();
}
return classes;
} | class class_name[name] begin[{]
method[toClass, return_type[type[Class]], modifier[public static], parameter[array]] begin[{]
if[binary_operation[member[.array], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
if[binary_operation[member[array.length], ==, literal[0]]] begin[{]
return[member[ArrayUtils.EMPTY_CLASS_ARRAY]]
else begin[{]
None
end[}]
end[}]
local_variable[type[Class], classes]
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=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=array, 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===), if_false=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[], member=getClass, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))), 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=array, 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)
return[member[.classes]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[toClass] operator[SEP] Keyword[final] identifier[Object] operator[...] identifier[array] operator[SEP] {
Keyword[if] operator[SEP] identifier[array] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[array] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[ArrayUtils] operator[SEP] identifier[EMPTY_CLASS_ARRAY] operator[SEP]
}
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[classes] operator[=] Keyword[new] identifier[Class] operator[<] operator[?] operator[>] operator[SEP] identifier[array] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[array] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[classes] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[array] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[classes] operator[SEP]
}
|
void findCoordinateTransform(Group g, String nameStartsWith, int levelType) {
// look for variable that uses this coordinate
List<Variable> vars = g.getVariables();
for (Variable v : vars) {
if (v.getShortName().equals(nameStartsWith)) {
Attribute att = v.findAttribute("grid_level_type");
if ((att == null) || (att.getNumericValue().intValue() != levelType)) {
continue;
}
v.addAttribute(new Attribute(_Coordinate.TransformType, "Vertical"));
v.addAttribute(new Attribute("transform_name", "Existing3DField"));
}
}
} | class class_name[name] begin[{]
method[findCoordinateTransform, return_type[void], modifier[default], parameter[g, nameStartsWith, levelType]] begin[{]
local_variable[type[List], vars]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getShortName, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[MethodInvocation(arguments=[MemberReference(member=nameStartsWith, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="grid_level_type")], member=findAttribute, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None), name=att)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Attribute, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=att, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getNumericValue, postfix_operators=[], prefix_operators=[], qualifier=att, selectors=[MethodInvocation(arguments=[], member=intValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=MemberReference(member=levelType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=TransformType, postfix_operators=[], prefix_operators=[], qualifier=_Coordinate, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Vertical")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Attribute, sub_type=None))], member=addAttribute, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="transform_name"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Existing3DField")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Attribute, sub_type=None))], member=addAttribute, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=vars, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=v)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Variable, sub_type=None))), label=None)
end[}]
END[}] | Keyword[void] identifier[findCoordinateTransform] operator[SEP] identifier[Group] identifier[g] , identifier[String] identifier[nameStartsWith] , Keyword[int] identifier[levelType] operator[SEP] {
identifier[List] operator[<] identifier[Variable] operator[>] identifier[vars] operator[=] identifier[g] operator[SEP] identifier[getVariables] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Variable] identifier[v] operator[:] identifier[vars] operator[SEP] {
Keyword[if] operator[SEP] identifier[v] operator[SEP] identifier[getShortName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[nameStartsWith] operator[SEP] operator[SEP] {
identifier[Attribute] identifier[att] operator[=] identifier[v] operator[SEP] identifier[findAttribute] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[att] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] identifier[att] operator[SEP] identifier[getNumericValue] operator[SEP] operator[SEP] operator[SEP] identifier[intValue] operator[SEP] operator[SEP] operator[!=] identifier[levelType] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[v] operator[SEP] identifier[addAttribute] operator[SEP] Keyword[new] identifier[Attribute] operator[SEP] identifier[_Coordinate] operator[SEP] identifier[TransformType] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[v] operator[SEP] identifier[addAttribute] operator[SEP] Keyword[new] identifier[Attribute] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public DistributedLogServer.Role getRole() {
return Objects.equals(Futures.get(primaryElection.getTerm()).primary().memberId(), clusterMembershipService.getLocalMember().id())
? DistributedLogServer.Role.LEADER
: DistributedLogServer.Role.FOLLOWER;
} | class class_name[name] begin[{]
method[getRole, return_type[type[DistributedLogServer]], modifier[public], parameter[]] begin[{]
return[TernaryExpression(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTerm, postfix_operators=[], prefix_operators=[], qualifier=primaryElection, selectors=[], type_arguments=None)], member=get, postfix_operators=[], prefix_operators=[], qualifier=Futures, selectors=[MethodInvocation(arguments=[], member=primary, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=memberId, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getLocalMember, postfix_operators=[], prefix_operators=[], qualifier=clusterMembershipService, selectors=[MethodInvocation(arguments=[], member=id, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=Objects, selectors=[], type_arguments=None), if_false=MemberReference(member=FOLLOWER, postfix_operators=[], prefix_operators=[], qualifier=DistributedLogServer.Role, selectors=[]), if_true=MemberReference(member=LEADER, postfix_operators=[], prefix_operators=[], qualifier=DistributedLogServer.Role, selectors=[]))]
end[}]
END[}] | Keyword[public] identifier[DistributedLogServer] operator[SEP] identifier[Role] identifier[getRole] operator[SEP] operator[SEP] {
Keyword[return] identifier[Objects] operator[SEP] identifier[equals] operator[SEP] identifier[Futures] operator[SEP] identifier[get] operator[SEP] identifier[primaryElection] operator[SEP] identifier[getTerm] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[primary] operator[SEP] operator[SEP] operator[SEP] identifier[memberId] operator[SEP] operator[SEP] , identifier[clusterMembershipService] operator[SEP] identifier[getLocalMember] operator[SEP] operator[SEP] operator[SEP] identifier[id] operator[SEP] operator[SEP] operator[SEP] operator[?] identifier[DistributedLogServer] operator[SEP] identifier[Role] operator[SEP] identifier[LEADER] operator[:] identifier[DistributedLogServer] operator[SEP] identifier[Role] operator[SEP] identifier[FOLLOWER] operator[SEP]
}
|
public Connection createStandaloneConnection(String addr, int connectTimeout)
throws RemotingException {
return this.connectionManager.create(addr, connectTimeout);
} | class class_name[name] begin[{]
method[createStandaloneConnection, return_type[type[Connection]], modifier[public], parameter[addr, connectTimeout]] begin[{]
return[THIS[member[None.connectionManager]call[None.create, parameter[member[.addr], member[.connectTimeout]]]]]
end[}]
END[}] | Keyword[public] identifier[Connection] identifier[createStandaloneConnection] operator[SEP] identifier[String] identifier[addr] , Keyword[int] identifier[connectTimeout] operator[SEP] Keyword[throws] identifier[RemotingException] {
Keyword[return] Keyword[this] operator[SEP] identifier[connectionManager] operator[SEP] identifier[create] operator[SEP] identifier[addr] , identifier[connectTimeout] operator[SEP] operator[SEP]
}
|
private Object instantiate(Class actualType, JSONObject j) {
Object r = bindInterceptor.instantiate(actualType,j);
if (r!=BindInterceptor.DEFAULT) return r;
for (BindInterceptor bi : getWebApp().bindInterceptors) {
r = bi.instantiate(actualType,j);
if (r!=BindInterceptor.DEFAULT) return r;
}
if (actualType==JSONObject.class || actualType==JSON.class) return actualType.cast(j);
String[] names = new ClassDescriptor(actualType).loadConstructorParamNames();
// the actual arguments to invoke the constructor with.
Object[] args = new Object[names.length];
// constructor
Constructor c = findConstructor(actualType, names.length);
Class[] types = c.getParameterTypes();
Type[] genTypes = c.getGenericParameterTypes();
// convert parameters
for( int i=0; i<names.length; i++ ) {
try {
args[i] = bindJSON(genTypes[i],types[i],j.get(names[i]));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Failed to convert the "+names[i]+" parameter of the constructor "+c,e);
}
}
Object o = injectSetters(invokeConstructor(c, args), j, Arrays.asList(names));
o = bindResolve(o,j);
return o;
} | class class_name[name] begin[{]
method[instantiate, return_type[type[Object]], modifier[private], parameter[actualType, j]] begin[{]
local_variable[type[Object], r]
if[binary_operation[member[.r], !=, member[BindInterceptor.DEFAULT]]] begin[{]
return[member[.r]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=actualType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=instantiate, postfix_operators=[], prefix_operators=[], qualifier=bi, selectors=[], type_arguments=None)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=DEFAULT, postfix_operators=[], prefix_operators=[], qualifier=BindInterceptor, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getWebApp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MemberReference(member=bindInterceptors, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bi)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BindInterceptor, sub_type=None))), label=None)
if[binary_operation[binary_operation[member[.actualType], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSONObject, sub_type=None))], ||, binary_operation[member[.actualType], ==, ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSON, sub_type=None))]]] begin[{]
return[call[actualType.cast, parameter[member[.j]]]]
else begin[{]
None
end[}]
local_variable[type[String], names]
local_variable[type[Object], args]
local_variable[type[Constructor], c]
local_variable[type[Class], types]
local_variable[type[Type], genTypes]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=args, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=genTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=types, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MethodInvocation(arguments=[MemberReference(member=names, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=get, postfix_operators=[], prefix_operators=[], qualifier=j, selectors=[], type_arguments=None)], member=bindJSON, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to convert the "), operandr=MemberReference(member=names, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" parameter of the constructor "), operator=+), operandr=MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=IllegalArgumentException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalArgumentException']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=names, 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)
local_variable[type[Object], o]
assign[member[.o], call[.bindResolve, parameter[member[.o], member[.j]]]]
return[member[.o]]
end[}]
END[}] | Keyword[private] identifier[Object] identifier[instantiate] operator[SEP] identifier[Class] identifier[actualType] , identifier[JSONObject] identifier[j] operator[SEP] {
identifier[Object] identifier[r] operator[=] identifier[bindInterceptor] operator[SEP] identifier[instantiate] operator[SEP] identifier[actualType] , identifier[j] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[!=] identifier[BindInterceptor] operator[SEP] identifier[DEFAULT] operator[SEP] Keyword[return] identifier[r] operator[SEP] Keyword[for] operator[SEP] identifier[BindInterceptor] identifier[bi] operator[:] identifier[getWebApp] operator[SEP] operator[SEP] operator[SEP] identifier[bindInterceptors] operator[SEP] {
identifier[r] operator[=] identifier[bi] operator[SEP] identifier[instantiate] operator[SEP] identifier[actualType] , identifier[j] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[!=] identifier[BindInterceptor] operator[SEP] identifier[DEFAULT] operator[SEP] Keyword[return] identifier[r] operator[SEP]
}
Keyword[if] operator[SEP] identifier[actualType] operator[==] identifier[JSONObject] operator[SEP] Keyword[class] operator[||] identifier[actualType] operator[==] identifier[JSON] operator[SEP] Keyword[class] operator[SEP] Keyword[return] identifier[actualType] operator[SEP] identifier[cast] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[names] operator[=] Keyword[new] identifier[ClassDescriptor] operator[SEP] identifier[actualType] operator[SEP] operator[SEP] identifier[loadConstructorParamNames] operator[SEP] operator[SEP] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[args] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[names] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[Constructor] identifier[c] operator[=] identifier[findConstructor] operator[SEP] identifier[actualType] , identifier[names] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[Class] operator[SEP] operator[SEP] identifier[types] operator[=] identifier[c] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] identifier[Type] operator[SEP] operator[SEP] identifier[genTypes] operator[=] identifier[c] operator[SEP] identifier[getGenericParameterTypes] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[names] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[try] {
identifier[args] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[bindJSON] operator[SEP] identifier[genTypes] operator[SEP] identifier[i] operator[SEP] , identifier[types] operator[SEP] identifier[i] operator[SEP] , identifier[j] operator[SEP] identifier[get] operator[SEP] identifier[names] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalArgumentException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[names] operator[SEP] identifier[i] operator[SEP] operator[+] literal[String] operator[+] identifier[c] , identifier[e] operator[SEP] operator[SEP]
}
}
identifier[Object] identifier[o] operator[=] identifier[injectSetters] operator[SEP] identifier[invokeConstructor] operator[SEP] identifier[c] , identifier[args] operator[SEP] , identifier[j] , identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[names] operator[SEP] operator[SEP] operator[SEP] identifier[o] operator[=] identifier[bindResolve] operator[SEP] identifier[o] , identifier[j] operator[SEP] operator[SEP] Keyword[return] identifier[o] operator[SEP]
}
|
public boolean containsValue(final int value)
{
boolean found = false;
if (value != initialValue)
{
final int[] entries = this.entries;
@DoNotSub final int length = entries.length;
for (@DoNotSub int i = 1; i < length; i += 2)
{
if (value == entries[i])
{
found = true;
break;
}
}
}
return found;
} | class class_name[name] begin[{]
method[containsValue, return_type[type[boolean]], modifier[public], parameter[value]] begin[{]
local_variable[type[boolean], found]
if[binary_operation[member[.value], !=, member[.initialValue]]] begin[{]
local_variable[type[int], entries]
local_variable[type[int], length]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=entries, 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=[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=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[Annotation(element=None, name=DoNotSub)], 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=[Assignment(expressionl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2))]), label=None)
else begin[{]
None
end[}]
return[member[.found]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[containsValue] operator[SEP] Keyword[final] Keyword[int] identifier[value] operator[SEP] {
Keyword[boolean] identifier[found] operator[=] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] identifier[initialValue] operator[SEP] {
Keyword[final] Keyword[int] operator[SEP] operator[SEP] identifier[entries] operator[=] Keyword[this] operator[SEP] identifier[entries] operator[SEP] annotation[@] identifier[DoNotSub] Keyword[final] Keyword[int] identifier[length] operator[=] identifier[entries] operator[SEP] identifier[length] operator[SEP] Keyword[for] operator[SEP] annotation[@] identifier[DoNotSub] Keyword[int] identifier[i] operator[=] Other[1] operator[SEP] identifier[i] operator[<] identifier[length] operator[SEP] identifier[i] operator[+=] Other[2] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] identifier[entries] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
identifier[found] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
}
Keyword[return] identifier[found] operator[SEP]
}
|
public ArrayList<String> cart_cartId_coupon_POST(String cartId, String coupon) throws IOException {
String qPath = "/order/cart/{cartId}/coupon";
StringBuilder sb = path(qPath, cartId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "coupon", coupon);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, t1);
} | class class_name[name] begin[{]
method[cart_cartId_coupon_POST, return_type[type[ArrayList]], modifier[public], parameter[cartId, coupon]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[HashMap], o]
call[.addBody, parameter[member[.o], literal["coupon"], member[.coupon]]]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], member[.t1]]]]
end[}]
END[}] | Keyword[public] identifier[ArrayList] operator[<] identifier[String] operator[>] identifier[cart_cartId_coupon_POST] operator[SEP] identifier[String] identifier[cartId] , identifier[String] identifier[coupon] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[cartId] operator[SEP] operator[SEP] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] identifier[o] operator[=] Keyword[new] identifier[HashMap] operator[<] identifier[String] , identifier[Object] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[addBody] operator[SEP] identifier[o] , literal[String] , identifier[coupon] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[execN] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[o] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[t1] operator[SEP] operator[SEP]
}
|
public com.squareup.okhttp.Call getUniverseGroupsGroupIdAsync(Integer groupId, String acceptLanguage,
String datasource, String ifNoneMatch, String language, final ApiCallback<GroupResponse> callback)
throws ApiException {
com.squareup.okhttp.Call call = getUniverseGroupsGroupIdValidateBeforeCall(groupId, acceptLanguage, datasource,
ifNoneMatch, language, callback);
Type localVarReturnType = new TypeToken<GroupResponse>() {
}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | class class_name[name] begin[{]
method[getUniverseGroupsGroupIdAsync, return_type[type[com]], modifier[public], parameter[groupId, acceptLanguage, datasource, ifNoneMatch, language, callback]] begin[{]
local_variable[type[com], call]
local_variable[type[Type], localVarReturnType]
call[apiClient.executeAsync, parameter[member[.call], member[.localVarReturnType], member[.callback]]]
return[member[.call]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[getUniverseGroupsGroupIdAsync] operator[SEP] identifier[Integer] identifier[groupId] , identifier[String] identifier[acceptLanguage] , identifier[String] identifier[datasource] , identifier[String] identifier[ifNoneMatch] , identifier[String] identifier[language] , Keyword[final] identifier[ApiCallback] operator[<] identifier[GroupResponse] operator[>] identifier[callback] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[getUniverseGroupsGroupIdValidateBeforeCall] operator[SEP] identifier[groupId] , identifier[acceptLanguage] , identifier[datasource] , identifier[ifNoneMatch] , identifier[language] , identifier[callback] operator[SEP] operator[SEP] identifier[Type] identifier[localVarReturnType] operator[=] Keyword[new] identifier[TypeToken] operator[<] identifier[GroupResponse] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[apiClient] operator[SEP] identifier[executeAsync] operator[SEP] identifier[call] , identifier[localVarReturnType] , identifier[callback] operator[SEP] operator[SEP] Keyword[return] identifier[call] operator[SEP]
}
|
public void load(File file, String propertyName) throws IOException
{
Properties tmpProperties = new Properties(defaults);
/*
* Do not throw a FileNotFoundException here because it is OK if the
* file does not exist. In this case, default values will be used.
*/
if (file.isFile())
{
InputStream inputStream = new FileInputStream(file);
try
{
tmpProperties.load(inputStream);
}
finally
{
inputStream.close();
}
}
/*
* If a property name was specified, only load that property and leave
* the rest alone.
*/
if (propertyName != null)
{
String value = tmpProperties.getProperty(propertyName);
if (value == null)
{
properties.remove(propertyName);
}
else
{
setValue(propertyName, value, true);
}
return;
}
Set<String> tmpPropertyNames = tmpProperties.stringPropertyNames();
gatekeeper.signIn();
try
{
/*
* Throw away any property that is not in the file or in the
* defaults.
*/
properties.keySet().retainAll(tmpPropertyNames);
/*
* Set every value to either the value read from the file or the
* default.
*/
for (String tmpPropertyName : tmpPropertyNames)
{
setValue(tmpPropertyName,
tmpProperties.getProperty(tmpPropertyName),
true);
}
}
finally
{
gatekeeper.signOut();
}
} | class class_name[name] begin[{]
method[load, return_type[void], modifier[public], parameter[file, propertyName]] begin[{]
local_variable[type[Properties], tmpProperties]
if[call[file.isFile, parameter[]]] begin[{]
local_variable[type[InputStream], inputStream]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=inputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=load, postfix_operators=[], prefix_operators=[], qualifier=tmpProperties, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=inputStream, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[member[.propertyName], !=, literal[null]]] begin[{]
local_variable[type[String], value]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
call[properties.remove, parameter[member[.propertyName]]]
else begin[{]
call[.setValue, parameter[member[.propertyName], member[.value], literal[true]]]
end[}]
return[None]
else begin[{]
None
end[}]
local_variable[type[Set], tmpPropertyNames]
call[gatekeeper.signIn, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[MethodInvocation(arguments=[MemberReference(member=tmpPropertyNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=retainAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tmpPropertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=tmpPropertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getProperty, postfix_operators=[], prefix_operators=[], qualifier=tmpProperties, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=setValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=tmpPropertyNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=tmpPropertyName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=signOut, postfix_operators=[], prefix_operators=[], qualifier=gatekeeper, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[load] operator[SEP] identifier[File] identifier[file] , identifier[String] identifier[propertyName] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[Properties] identifier[tmpProperties] operator[=] Keyword[new] identifier[Properties] operator[SEP] identifier[defaults] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[file] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
identifier[InputStream] identifier[inputStream] operator[=] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[file] operator[SEP] operator[SEP] Keyword[try] {
identifier[tmpProperties] operator[SEP] identifier[load] operator[SEP] identifier[inputStream] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[inputStream] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[propertyName] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[value] operator[=] identifier[tmpProperties] operator[SEP] identifier[getProperty] operator[SEP] identifier[propertyName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
identifier[properties] operator[SEP] identifier[remove] operator[SEP] identifier[propertyName] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[setValue] operator[SEP] identifier[propertyName] , identifier[value] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP]
}
identifier[Set] operator[<] identifier[String] operator[>] identifier[tmpPropertyNames] operator[=] identifier[tmpProperties] operator[SEP] identifier[stringPropertyNames] operator[SEP] operator[SEP] operator[SEP] identifier[gatekeeper] operator[SEP] identifier[signIn] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[properties] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] identifier[retainAll] operator[SEP] identifier[tmpPropertyNames] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[tmpPropertyName] operator[:] identifier[tmpPropertyNames] operator[SEP] {
identifier[setValue] operator[SEP] identifier[tmpPropertyName] , identifier[tmpProperties] operator[SEP] identifier[getProperty] operator[SEP] identifier[tmpPropertyName] operator[SEP] , literal[boolean] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[gatekeeper] operator[SEP] identifier[signOut] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Throwable getRootCause() {
Throwable throwable = super.getCause();
if (throwable instanceof IDelegated) {
return ((IDelegated) throwable).getRootCause();
}
if (throwable == null) {
return new Exception("");
} else {
return throwable;
}
} | class class_name[name] begin[{]
method[getRootCause, return_type[type[Throwable]], modifier[public], parameter[]] begin[{]
local_variable[type[Throwable], throwable]
if[binary_operation[member[.throwable], instanceof, type[IDelegated]]] begin[{]
return[Cast(expression=MemberReference(member=throwable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=IDelegated, sub_type=None))]
else begin[{]
None
end[}]
if[binary_operation[member[.throwable], ==, literal[null]]] begin[{]
return[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Exception, sub_type=None))]
else begin[{]
return[member[.throwable]]
end[}]
end[}]
END[}] | Keyword[public] identifier[Throwable] identifier[getRootCause] operator[SEP] operator[SEP] {
identifier[Throwable] identifier[throwable] operator[=] Keyword[super] operator[SEP] identifier[getCause] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[throwable] Keyword[instanceof] identifier[IDelegated] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[IDelegated] operator[SEP] identifier[throwable] operator[SEP] operator[SEP] identifier[getRootCause] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[throwable] operator[==] Other[null] operator[SEP] {
Keyword[return] Keyword[new] identifier[Exception] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[throwable] operator[SEP]
}
}
|
public static void main(String[] args) throws Exception {
// set up execution environment
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
StreamTableEnvironment tEnv = StreamTableEnvironment.create(env);
DataStream<Order> orderA = env.fromCollection(Arrays.asList(
new Order(1L, "beer", 3),
new Order(1L, "diaper", 4),
new Order(3L, "rubber", 2)));
DataStream<Order> orderB = env.fromCollection(Arrays.asList(
new Order(2L, "pen", 3),
new Order(2L, "rubber", 3),
new Order(4L, "beer", 1)));
// convert DataStream to Table
Table tableA = tEnv.fromDataStream(orderA, "user, product, amount");
// register DataStream as Table
tEnv.registerDataStream("OrderB", orderB, "user, product, amount");
// union the two tables
Table result = tEnv.sqlQuery("SELECT * FROM " + tableA + " WHERE amount > 2 UNION ALL " +
"SELECT * FROM OrderB WHERE amount < 2");
tEnv.toAppendStream(result, Order.class).print();
env.execute();
} | class class_name[name] begin[{]
method[main, return_type[void], modifier[public static], parameter[args]] begin[{]
local_variable[type[StreamExecutionEnvironment], env]
local_variable[type[StreamTableEnvironment], tEnv]
local_variable[type[DataStream], orderA]
local_variable[type[DataStream], orderB]
local_variable[type[Table], tableA]
call[tEnv.registerDataStream, parameter[literal["OrderB"], member[.orderB], literal["user, product, amount"]]]
local_variable[type[Table], result]
call[tEnv.toAppendStream, parameter[member[.result], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Order, sub_type=None))]]
call[env.execute, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[main] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[args] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[StreamExecutionEnvironment] identifier[env] operator[=] identifier[StreamExecutionEnvironment] operator[SEP] identifier[getExecutionEnvironment] operator[SEP] operator[SEP] operator[SEP] identifier[StreamTableEnvironment] identifier[tEnv] operator[=] identifier[StreamTableEnvironment] operator[SEP] identifier[create] operator[SEP] identifier[env] operator[SEP] operator[SEP] identifier[DataStream] operator[<] identifier[Order] operator[>] identifier[orderA] operator[=] identifier[env] operator[SEP] identifier[fromCollection] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] Keyword[new] identifier[Order] operator[SEP] Other[1L] , literal[String] , Other[3] operator[SEP] , Keyword[new] identifier[Order] operator[SEP] Other[1L] , literal[String] , Other[4] operator[SEP] , Keyword[new] identifier[Order] operator[SEP] Other[3L] , literal[String] , Other[2] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[DataStream] operator[<] identifier[Order] operator[>] identifier[orderB] operator[=] identifier[env] operator[SEP] identifier[fromCollection] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] Keyword[new] identifier[Order] operator[SEP] Other[2L] , literal[String] , Other[3] operator[SEP] , Keyword[new] identifier[Order] operator[SEP] Other[2L] , literal[String] , Other[3] operator[SEP] , Keyword[new] identifier[Order] operator[SEP] Other[4L] , literal[String] , Other[1] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Table] identifier[tableA] operator[=] identifier[tEnv] operator[SEP] identifier[fromDataStream] operator[SEP] identifier[orderA] , literal[String] operator[SEP] operator[SEP] identifier[tEnv] operator[SEP] identifier[registerDataStream] operator[SEP] literal[String] , identifier[orderB] , literal[String] operator[SEP] operator[SEP] identifier[Table] identifier[result] operator[=] identifier[tEnv] operator[SEP] identifier[sqlQuery] operator[SEP] literal[String] operator[+] identifier[tableA] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] identifier[tEnv] operator[SEP] identifier[toAppendStream] operator[SEP] identifier[result] , identifier[Order] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[print] operator[SEP] operator[SEP] operator[SEP] identifier[env] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP]
}
|
private static MutableFst doCompose(Fst fst1, Fst fst2, Semiring semiring, boolean useSorted) {
if (useSorted) {
assert(FstUtils.symbolTableEquals(fst1.getOutputSymbols(), fst2.getInputSymbols()));
}
MutableFst res = new MutableFst(semiring, symbolTableEffectiveCopy(fst1.getInputSymbols()),
symbolTableEffectiveCopy(fst2.getOutputSymbols()));
// state map is q -> n where q is (q_i, q_j) a state pair made up of state from fst1 and a state from fst2 and
// n is the new state index in the composed FST that represents this tuple
HashMap<IndexPair, Integer> stateMap = Maps.newHashMap();
Deque<IndexPair> queue = new LinkedList<>();
IndexPair first = new IndexPair(fst1.getStartState().getId(), fst2.getStartState().getId());
MutableState newStart = res.newStartState();
newStart.setFinalWeight(semiring.times(fst1.getStartState().getFinalWeight(), fst2.getStartState().getFinalWeight()));
stateMap.put(first, newStart.getId());
queue.addLast(first);
SymbolTable.InvertedSymbolTable fst1In = fst1.getInputSymbols().invert();
SymbolTable.InvertedSymbolTable fst1Out = fst1.getOutputSymbols().invert();
SymbolTable.InvertedSymbolTable fst2In = fst2.getInputSymbols().invert();
SymbolTable.InvertedSymbolTable fst2Out = fst2.getOutputSymbols().invert();
while (!queue.isEmpty()) {
IndexPair p = queue.removeFirst();
State s1 = fst1.getState(p.getLeft());
State s2 = fst2.getState(p.getRight());
MutableState resultState = res.getState(stateMap.get(p));
if (useSorted) {
assert (ArcSort.isSorted(s1, OLabelCompare.INSTANCE) && ArcSort.isSorted(s2, ILabelCompare.INSTANCE)) :
"\ns1 " + s1.getArcs() + "\n s2 " + s2.getArcs();
}
int jstart = 0; // if not sorted jstart is never updated so always does full nested loop
for (int i = 0; i < s1.getArcCount(); ++i) {
Arc a1 = s1.getArc(i);
for (int j = jstart; j < s2.getArcCount(); ++j) {
Arc a2 = s2.getArc(j);
if (useSorted && a1.getOlabel() < a2.getIlabel()) {
break; // if we know the arcs are sorted then once we've gotten here we know there cant be more j's
}
String a1Isym = fst1In.keyForId(a1.getIlabel());
String a1Osym = fst1Out.keyForId(a1.getOlabel());
String a2Isym = fst2In.keyForId(a2.getIlabel());
String a2Osym = fst2Out.keyForId(a2.getOlabel());
if (a1Osym.equals(a2Isym)) {
State nextState1 = a1.getNextState();
State nextState2 = a2.getNextState();
IndexPair nextPair = new IndexPair(nextState1.getId(), nextState2.getId());
Integer nextState = stateMap.get(nextPair);
MutableState realNextState;
if (nextState == null) {
realNextState = res.newState();
realNextState.setFinalWeight(semiring.times(nextState1.getFinalWeight(), nextState2.getFinalWeight()));
stateMap.put(nextPair, realNextState.getId());
queue.addLast(nextPair);
} else {
realNextState = res.getState(nextState);
}
res.addArc(resultState, a1Isym, a2Osym, realNextState, semiring.times(a1.getWeight(), a2.getWeight()));
} else if (useSorted && a1.getOlabel() > a2.getIlabel()) {
// if we're sorted and outer is greater then we know we'll never need to eval this inner index again
jstart = j + 1;
}
}
}
}
return res;
} | class class_name[name] begin[{]
method[doCompose, return_type[type[MutableFst]], modifier[private static], parameter[fst1, fst2, semiring, useSorted]] begin[{]
if[member[.useSorted]] begin[{]
AssertStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOutputSymbols, postfix_operators=[], prefix_operators=[], qualifier=fst1, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getInputSymbols, postfix_operators=[], prefix_operators=[], qualifier=fst2, selectors=[], type_arguments=None)], member=symbolTableEquals, postfix_operators=[], prefix_operators=[], qualifier=FstUtils, selectors=[], type_arguments=None), label=None, value=None)
else begin[{]
None
end[}]
local_variable[type[MutableFst], res]
local_variable[type[HashMap], stateMap]
local_variable[type[Deque], queue]
local_variable[type[IndexPair], first]
local_variable[type[MutableState], newStart]
call[newStart.setFinalWeight, parameter[call[semiring.times, parameter[call[fst1.getStartState, parameter[]], call[fst2.getStartState, parameter[]]]]]]
call[stateMap.put, parameter[member[.first], call[newStart.getId, parameter[]]]]
call[queue.addLast, parameter[member[.first]]]
local_variable[type[SymbolTable], fst1In]
local_variable[type[SymbolTable], fst1Out]
local_variable[type[SymbolTable], fst2In]
local_variable[type[SymbolTable], fst2Out]
while[call[queue.isEmpty, parameter[]]] begin[{]
local_variable[type[IndexPair], p]
local_variable[type[State], s1]
local_variable[type[State], s2]
local_variable[type[MutableState], resultState]
if[member[.useSorted]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=s1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=INSTANCE, postfix_operators=[], prefix_operators=[], qualifier=OLabelCompare, selectors=[])], member=isSorted, postfix_operators=[], prefix_operators=[], qualifier=ArcSort, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=s2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=INSTANCE, postfix_operators=[], prefix_operators=[], qualifier=ILabelCompare, selectors=[])], member=isSorted, postfix_operators=[], prefix_operators=[], qualifier=ArcSort, selectors=[], type_arguments=None), operator=&&), label=None, value=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\ns1 "), operandr=MethodInvocation(arguments=[], member=getArcs, postfix_operators=[], prefix_operators=[], qualifier=s1, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n s2 "), operator=+), operandr=MethodInvocation(arguments=[], member=getArcs, postfix_operators=[], prefix_operators=[], qualifier=s2, selectors=[], type_arguments=None), operator=+))
else begin[{]
None
end[}]
local_variable[type[int], jstart]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getArc, postfix_operators=[], prefix_operators=[], qualifier=s1, selectors=[], type_arguments=None), name=a1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Arc, sub_type=None)), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getArc, postfix_operators=[], prefix_operators=[], qualifier=s2, selectors=[], type_arguments=None), name=a2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Arc, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=useSorted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getOlabel, postfix_operators=[], prefix_operators=[], qualifier=a1, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getIlabel, postfix_operators=[], prefix_operators=[], qualifier=a2, selectors=[], type_arguments=None), operator=<), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[BreakStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIlabel, postfix_operators=[], prefix_operators=[], qualifier=a1, selectors=[], type_arguments=None)], member=keyForId, postfix_operators=[], prefix_operators=[], qualifier=fst1In, selectors=[], type_arguments=None), name=a1Isym)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOlabel, postfix_operators=[], prefix_operators=[], qualifier=a1, selectors=[], type_arguments=None)], member=keyForId, postfix_operators=[], prefix_operators=[], qualifier=fst1Out, selectors=[], type_arguments=None), name=a1Osym)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getIlabel, postfix_operators=[], prefix_operators=[], qualifier=a2, selectors=[], type_arguments=None)], member=keyForId, postfix_operators=[], prefix_operators=[], qualifier=fst2In, selectors=[], type_arguments=None), name=a2Isym)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getOlabel, postfix_operators=[], prefix_operators=[], qualifier=a2, selectors=[], type_arguments=None)], member=keyForId, postfix_operators=[], prefix_operators=[], qualifier=fst2Out, selectors=[], type_arguments=None), name=a2Osym)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=a2Isym, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=a1Osym, selectors=[], type_arguments=None), else_statement=IfStatement(condition=BinaryOperation(operandl=MemberReference(member=useSorted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getOlabel, postfix_operators=[], prefix_operators=[], qualifier=a1, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getIlabel, postfix_operators=[], prefix_operators=[], qualifier=a2, selectors=[], type_arguments=None), operator=>), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=jstart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNextState, postfix_operators=[], prefix_operators=[], qualifier=a1, selectors=[], type_arguments=None), name=nextState1)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=State, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getNextState, postfix_operators=[], prefix_operators=[], qualifier=a2, selectors=[], type_arguments=None), name=nextState2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=State, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=nextState1, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=nextState2, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexPair, sub_type=None)), name=nextPair)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=IndexPair, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=nextPair, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=stateMap, selectors=[], type_arguments=None), name=nextState)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=realNextState)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MutableState, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=nextState, 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=realNextState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=nextState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getState, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=realNextState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=newState, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFinalWeight, postfix_operators=[], prefix_operators=[], qualifier=nextState1, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getFinalWeight, postfix_operators=[], prefix_operators=[], qualifier=nextState2, selectors=[], type_arguments=None)], member=times, postfix_operators=[], prefix_operators=[], qualifier=semiring, selectors=[], type_arguments=None)], member=setFinalWeight, postfix_operators=[], prefix_operators=[], qualifier=realNextState, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=nextPair, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=realNextState, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=stateMap, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=nextPair, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addLast, postfix_operators=[], prefix_operators=[], qualifier=queue, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=resultState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=a1Isym, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=a2Osym, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=realNextState, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWeight, postfix_operators=[], prefix_operators=[], qualifier=a1, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getWeight, postfix_operators=[], prefix_operators=[], qualifier=a2, selectors=[], type_arguments=None)], member=times, postfix_operators=[], prefix_operators=[], qualifier=semiring, selectors=[], type_arguments=None)], member=addArc, postfix_operators=[], prefix_operators=[], qualifier=res, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=getArcCount, postfix_operators=[], prefix_operators=[], qualifier=s2, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=jstart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[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=MethodInvocation(arguments=[], member=getArcCount, postfix_operators=[], prefix_operators=[], qualifier=s1, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
end[}]
return[member[.res]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[MutableFst] identifier[doCompose] operator[SEP] identifier[Fst] identifier[fst1] , identifier[Fst] identifier[fst2] , identifier[Semiring] identifier[semiring] , Keyword[boolean] identifier[useSorted] operator[SEP] {
Keyword[if] operator[SEP] identifier[useSorted] operator[SEP] {
Keyword[assert] operator[SEP] identifier[FstUtils] operator[SEP] identifier[symbolTableEquals] operator[SEP] identifier[fst1] operator[SEP] identifier[getOutputSymbols] operator[SEP] operator[SEP] , identifier[fst2] operator[SEP] identifier[getInputSymbols] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[MutableFst] identifier[res] operator[=] Keyword[new] identifier[MutableFst] operator[SEP] identifier[semiring] , identifier[symbolTableEffectiveCopy] operator[SEP] identifier[fst1] operator[SEP] identifier[getInputSymbols] operator[SEP] operator[SEP] operator[SEP] , identifier[symbolTableEffectiveCopy] operator[SEP] identifier[fst2] operator[SEP] identifier[getOutputSymbols] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[HashMap] operator[<] identifier[IndexPair] , identifier[Integer] operator[>] identifier[stateMap] operator[=] identifier[Maps] operator[SEP] identifier[newHashMap] operator[SEP] operator[SEP] operator[SEP] identifier[Deque] operator[<] identifier[IndexPair] operator[>] identifier[queue] operator[=] Keyword[new] identifier[LinkedList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[IndexPair] identifier[first] operator[=] Keyword[new] identifier[IndexPair] operator[SEP] identifier[fst1] operator[SEP] identifier[getStartState] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[fst2] operator[SEP] identifier[getStartState] operator[SEP] operator[SEP] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[MutableState] identifier[newStart] operator[=] identifier[res] operator[SEP] identifier[newStartState] operator[SEP] operator[SEP] operator[SEP] identifier[newStart] operator[SEP] identifier[setFinalWeight] operator[SEP] identifier[semiring] operator[SEP] identifier[times] operator[SEP] identifier[fst1] operator[SEP] identifier[getStartState] operator[SEP] operator[SEP] operator[SEP] identifier[getFinalWeight] operator[SEP] operator[SEP] , identifier[fst2] operator[SEP] identifier[getStartState] operator[SEP] operator[SEP] operator[SEP] identifier[getFinalWeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[stateMap] operator[SEP] identifier[put] operator[SEP] identifier[first] , identifier[newStart] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[queue] operator[SEP] identifier[addLast] operator[SEP] identifier[first] operator[SEP] operator[SEP] identifier[SymbolTable] operator[SEP] identifier[InvertedSymbolTable] identifier[fst1In] operator[=] identifier[fst1] operator[SEP] identifier[getInputSymbols] operator[SEP] operator[SEP] operator[SEP] identifier[invert] operator[SEP] operator[SEP] operator[SEP] identifier[SymbolTable] operator[SEP] identifier[InvertedSymbolTable] identifier[fst1Out] operator[=] identifier[fst1] operator[SEP] identifier[getOutputSymbols] operator[SEP] operator[SEP] operator[SEP] identifier[invert] operator[SEP] operator[SEP] operator[SEP] identifier[SymbolTable] operator[SEP] identifier[InvertedSymbolTable] identifier[fst2In] operator[=] identifier[fst2] operator[SEP] identifier[getInputSymbols] operator[SEP] operator[SEP] operator[SEP] identifier[invert] operator[SEP] operator[SEP] operator[SEP] identifier[SymbolTable] operator[SEP] identifier[InvertedSymbolTable] identifier[fst2Out] operator[=] identifier[fst2] operator[SEP] identifier[getOutputSymbols] operator[SEP] operator[SEP] operator[SEP] identifier[invert] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] operator[!] identifier[queue] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[IndexPair] identifier[p] operator[=] identifier[queue] operator[SEP] identifier[removeFirst] operator[SEP] operator[SEP] operator[SEP] identifier[State] identifier[s1] operator[=] identifier[fst1] operator[SEP] identifier[getState] operator[SEP] identifier[p] operator[SEP] identifier[getLeft] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[State] identifier[s2] operator[=] identifier[fst2] operator[SEP] identifier[getState] operator[SEP] identifier[p] operator[SEP] identifier[getRight] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[MutableState] identifier[resultState] operator[=] identifier[res] operator[SEP] identifier[getState] operator[SEP] identifier[stateMap] operator[SEP] identifier[get] operator[SEP] identifier[p] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[useSorted] operator[SEP] {
Keyword[assert] operator[SEP] identifier[ArcSort] operator[SEP] identifier[isSorted] operator[SEP] identifier[s1] , identifier[OLabelCompare] operator[SEP] identifier[INSTANCE] operator[SEP] operator[&&] identifier[ArcSort] operator[SEP] identifier[isSorted] operator[SEP] identifier[s2] , identifier[ILabelCompare] operator[SEP] identifier[INSTANCE] operator[SEP] operator[SEP] operator[:] literal[String] operator[+] identifier[s1] operator[SEP] identifier[getArcs] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[s2] operator[SEP] identifier[getArcs] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[jstart] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[s1] operator[SEP] identifier[getArcCount] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[Arc] identifier[a1] operator[=] identifier[s1] operator[SEP] identifier[getArc] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[=] identifier[jstart] operator[SEP] identifier[j] operator[<] identifier[s2] operator[SEP] identifier[getArcCount] operator[SEP] operator[SEP] operator[SEP] operator[++] identifier[j] operator[SEP] {
identifier[Arc] identifier[a2] operator[=] identifier[s2] operator[SEP] identifier[getArc] operator[SEP] identifier[j] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[useSorted] operator[&&] identifier[a1] operator[SEP] identifier[getOlabel] operator[SEP] operator[SEP] operator[<] identifier[a2] operator[SEP] identifier[getIlabel] operator[SEP] operator[SEP] operator[SEP] {
Keyword[break] operator[SEP]
}
identifier[String] identifier[a1Isym] operator[=] identifier[fst1In] operator[SEP] identifier[keyForId] operator[SEP] identifier[a1] operator[SEP] identifier[getIlabel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[a1Osym] operator[=] identifier[fst1Out] operator[SEP] identifier[keyForId] operator[SEP] identifier[a1] operator[SEP] identifier[getOlabel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[a2Isym] operator[=] identifier[fst2In] operator[SEP] identifier[keyForId] operator[SEP] identifier[a2] operator[SEP] identifier[getIlabel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[a2Osym] operator[=] identifier[fst2Out] operator[SEP] identifier[keyForId] operator[SEP] identifier[a2] operator[SEP] identifier[getOlabel] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[a1Osym] operator[SEP] identifier[equals] operator[SEP] identifier[a2Isym] operator[SEP] operator[SEP] {
identifier[State] identifier[nextState1] operator[=] identifier[a1] operator[SEP] identifier[getNextState] operator[SEP] operator[SEP] operator[SEP] identifier[State] identifier[nextState2] operator[=] identifier[a2] operator[SEP] identifier[getNextState] operator[SEP] operator[SEP] operator[SEP] identifier[IndexPair] identifier[nextPair] operator[=] Keyword[new] identifier[IndexPair] operator[SEP] identifier[nextState1] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[nextState2] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Integer] identifier[nextState] operator[=] identifier[stateMap] operator[SEP] identifier[get] operator[SEP] identifier[nextPair] operator[SEP] operator[SEP] identifier[MutableState] identifier[realNextState] operator[SEP] Keyword[if] operator[SEP] identifier[nextState] operator[==] Other[null] operator[SEP] {
identifier[realNextState] operator[=] identifier[res] operator[SEP] identifier[newState] operator[SEP] operator[SEP] operator[SEP] identifier[realNextState] operator[SEP] identifier[setFinalWeight] operator[SEP] identifier[semiring] operator[SEP] identifier[times] operator[SEP] identifier[nextState1] operator[SEP] identifier[getFinalWeight] operator[SEP] operator[SEP] , identifier[nextState2] operator[SEP] identifier[getFinalWeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[stateMap] operator[SEP] identifier[put] operator[SEP] identifier[nextPair] , identifier[realNextState] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[queue] operator[SEP] identifier[addLast] operator[SEP] identifier[nextPair] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[realNextState] operator[=] identifier[res] operator[SEP] identifier[getState] operator[SEP] identifier[nextState] operator[SEP] operator[SEP]
}
identifier[res] operator[SEP] identifier[addArc] operator[SEP] identifier[resultState] , identifier[a1Isym] , identifier[a2Osym] , identifier[realNextState] , identifier[semiring] operator[SEP] identifier[times] operator[SEP] identifier[a1] operator[SEP] identifier[getWeight] operator[SEP] operator[SEP] , identifier[a2] operator[SEP] identifier[getWeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[useSorted] operator[&&] identifier[a1] operator[SEP] identifier[getOlabel] operator[SEP] operator[SEP] operator[>] identifier[a2] operator[SEP] identifier[getIlabel] operator[SEP] operator[SEP] operator[SEP] {
identifier[jstart] operator[=] identifier[j] operator[+] Other[1] operator[SEP]
}
}
}
}
Keyword[return] identifier[res] operator[SEP]
}
|
public static DockerClient createDockerClient( Map<String,String> targetProperties ) throws TargetException {
// Validate what needs to be validated.
Logger logger = Logger.getLogger( DockerHandler.class.getName());
logger.fine( "Setting the target properties." );
String edpt = targetProperties.get( DockerHandler.ENDPOINT );
if( Utils.isEmptyOrWhitespaces( edpt ))
edpt = DockerHandler.DEFAULT_ENDPOINT;
// The configuration is straight-forward.
Builder config =
DefaultDockerClientConfig.createDefaultConfigBuilder()
.withDockerHost( edpt )
.withRegistryUsername( targetProperties.get( DockerHandler.USER ))
.withRegistryPassword( targetProperties.get( DockerHandler.PASSWORD ))
.withRegistryEmail( targetProperties.get( DockerHandler.EMAIL ))
.withApiVersion( targetProperties.get( DockerHandler.VERSION ));
// Build the client.
DockerClientBuilder clientBuilder = DockerClientBuilder.getInstance( config.build());
return clientBuilder.build();
} | class class_name[name] begin[{]
method[createDockerClient, return_type[type[DockerClient]], modifier[public static], parameter[targetProperties]] begin[{]
local_variable[type[Logger], logger]
call[logger.fine, parameter[literal["Setting the target properties."]]]
local_variable[type[String], edpt]
if[call[Utils.isEmptyOrWhitespaces, parameter[member[.edpt]]]] begin[{]
assign[member[.edpt], member[DockerHandler.DEFAULT_ENDPOINT]]
else begin[{]
None
end[}]
local_variable[type[Builder], config]
local_variable[type[DockerClientBuilder], clientBuilder]
return[call[clientBuilder.build, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[DockerClient] identifier[createDockerClient] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[targetProperties] operator[SEP] Keyword[throws] identifier[TargetException] {
identifier[Logger] identifier[logger] operator[=] identifier[Logger] operator[SEP] identifier[getLogger] operator[SEP] identifier[DockerHandler] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[String] identifier[edpt] operator[=] identifier[targetProperties] operator[SEP] identifier[get] operator[SEP] identifier[DockerHandler] operator[SEP] identifier[ENDPOINT] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Utils] operator[SEP] identifier[isEmptyOrWhitespaces] operator[SEP] identifier[edpt] operator[SEP] operator[SEP] identifier[edpt] operator[=] identifier[DockerHandler] operator[SEP] identifier[DEFAULT_ENDPOINT] operator[SEP] identifier[Builder] identifier[config] operator[=] identifier[DefaultDockerClientConfig] operator[SEP] identifier[createDefaultConfigBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[withDockerHost] operator[SEP] identifier[edpt] operator[SEP] operator[SEP] identifier[withRegistryUsername] operator[SEP] identifier[targetProperties] operator[SEP] identifier[get] operator[SEP] identifier[DockerHandler] operator[SEP] identifier[USER] operator[SEP] operator[SEP] operator[SEP] identifier[withRegistryPassword] operator[SEP] identifier[targetProperties] operator[SEP] identifier[get] operator[SEP] identifier[DockerHandler] operator[SEP] identifier[PASSWORD] operator[SEP] operator[SEP] operator[SEP] identifier[withRegistryEmail] operator[SEP] identifier[targetProperties] operator[SEP] identifier[get] operator[SEP] identifier[DockerHandler] operator[SEP] identifier[EMAIL] operator[SEP] operator[SEP] operator[SEP] identifier[withApiVersion] operator[SEP] identifier[targetProperties] operator[SEP] identifier[get] operator[SEP] identifier[DockerHandler] operator[SEP] identifier[VERSION] operator[SEP] operator[SEP] operator[SEP] identifier[DockerClientBuilder] identifier[clientBuilder] operator[=] identifier[DockerClientBuilder] operator[SEP] identifier[getInstance] operator[SEP] identifier[config] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[clientBuilder] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean actionAddAce() {
String file = getParamResource();
String name = getParamName();
String type = getParamType();
int arrayPosition = -1;
try {
arrayPosition = Integer.parseInt(type);
} catch (Exception e) {
// can usually be ignored
if (LOG.isInfoEnabled()) {
LOG.info(e.getLocalizedMessage());
}
}
if (checkNewEntry(name, arrayPosition)) {
String permissionString = "";
if (getInheritOption() && getSettings().getUserSettings().getDialogPermissionsInheritOnFolder()) {
// inherit permissions on folders if setting is enabled
permissionString = "+i";
}
try {
// lock resource if autolock is enabled
checkLock(getParamResource());
if (name.equals(key(Messages.GUI_LABEL_ALLOTHERS_0))) {
getCms().chacc(
file,
getTypes(false)[arrayPosition],
CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME,
permissionString);
} else if (name.equals(key(Messages.GUI_LABEL_OVERWRITEALL_0))) {
getCms().chacc(
file,
getTypes(false)[arrayPosition],
CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME,
permissionString);
} else {
if (getTypes(false)[arrayPosition].equalsIgnoreCase(CmsRole.PRINCIPAL_ROLE)) {
// if role, first check if we have to translate the role name
CmsRole role = CmsRole.valueOfRoleName(name);
if (role == null) {
// we need translation
Iterator<CmsRole> it = CmsRole.getSystemRoles().iterator();
while (it.hasNext()) {
role = it.next();
if (role.getName(getLocale()).equalsIgnoreCase(name)) {
name = role.getRoleName();
break;
}
}
}
}
getCms().chacc(file, getTypes(false)[arrayPosition], name, permissionString);
}
return true;
} catch (CmsException e) {
m_errorMessages.add(e.getMessage());
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
return false;
} | class class_name[name] begin[{]
method[actionAddAce, return_type[type[boolean]], modifier[public], parameter[]] begin[{]
local_variable[type[String], file]
local_variable[type[String], name]
local_variable[type[String], type]
local_variable[type[int], arrayPosition]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=arrayPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isInfoEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocalizedMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], 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=['Exception']))], finally_block=None, label=None, resources=None)
if[call[.checkNewEntry, parameter[member[.name], member[.arrayPosition]]]] begin[{]
local_variable[type[String], permissionString]
if[binary_operation[call[.getInheritOption, parameter[]], &&, call[.getSettings, parameter[]]]] begin[{]
assign[member[.permissionString], literal["+i"]]
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getParamResource, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=checkLock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=GUI_LABEL_ALLOTHERS_0, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[])], member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=GUI_LABEL_OVERWRITEALL_0, postfix_operators=[], prefix_operators=[], qualifier=Messages, selectors=[])], member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=name, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=arrayPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), MethodInvocation(arguments=[MemberReference(member=PRINCIPAL_ROLE, postfix_operators=[], prefix_operators=[], qualifier=CmsRole, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOfRoleName, postfix_operators=[], prefix_operators=[], qualifier=CmsRole, selectors=[], type_arguments=None), name=role)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsRole, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=role, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getSystemRoles, postfix_operators=[], prefix_operators=[], qualifier=CmsRole, selectors=[MethodInvocation(arguments=[], member=iterator, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CmsRole, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=role, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getLocale, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=getName, postfix_operators=[], prefix_operators=[], qualifier=role, selectors=[MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getRoleName, postfix_operators=[], prefix_operators=[], qualifier=role, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]))]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), label=None)]))])), StatementExpression(expression=MethodInvocation(arguments=[], member=getCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=arrayPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], type_arguments=None), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=permissionString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=chacc, 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=MethodInvocation(arguments=[], member=getCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=arrayPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], type_arguments=None), MemberReference(member=PRINCIPAL_OVERWRITE_ALL_NAME, postfix_operators=[], prefix_operators=[], qualifier=CmsAccessControlEntry, selectors=[]), MemberReference(member=permissionString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=chacc, 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=MethodInvocation(arguments=[], member=getCms, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=getTypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=arrayPosition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], type_arguments=None), MemberReference(member=PRINCIPAL_ALL_OTHERS_NAME, postfix_operators=[], prefix_operators=[], qualifier=CmsAccessControlEntry, selectors=[]), MemberReference(member=permissionString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=chacc, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=m_errorMessages, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isErrorEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[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=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['CmsException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[actionAddAce] operator[SEP] operator[SEP] {
identifier[String] identifier[file] operator[=] identifier[getParamResource] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[name] operator[=] identifier[getParamName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[type] operator[=] identifier[getParamType] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[arrayPosition] operator[=] operator[-] Other[1] operator[SEP] Keyword[try] {
identifier[arrayPosition] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isInfoEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[checkNewEntry] operator[SEP] identifier[name] , identifier[arrayPosition] operator[SEP] operator[SEP] {
identifier[String] identifier[permissionString] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[getInheritOption] operator[SEP] operator[SEP] operator[&&] identifier[getSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getUserSettings] operator[SEP] operator[SEP] operator[SEP] identifier[getDialogPermissionsInheritOnFolder] operator[SEP] operator[SEP] operator[SEP] {
identifier[permissionString] operator[=] literal[String] operator[SEP]
}
Keyword[try] {
identifier[checkLock] operator[SEP] identifier[getParamResource] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_LABEL_ALLOTHERS_0] operator[SEP] operator[SEP] operator[SEP] {
identifier[getCms] operator[SEP] operator[SEP] operator[SEP] identifier[chacc] operator[SEP] identifier[file] , identifier[getTypes] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[arrayPosition] operator[SEP] , identifier[CmsAccessControlEntry] operator[SEP] identifier[PRINCIPAL_ALL_OTHERS_NAME] , identifier[permissionString] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[name] operator[SEP] identifier[equals] operator[SEP] identifier[key] operator[SEP] identifier[Messages] operator[SEP] identifier[GUI_LABEL_OVERWRITEALL_0] operator[SEP] operator[SEP] operator[SEP] {
identifier[getCms] operator[SEP] operator[SEP] operator[SEP] identifier[chacc] operator[SEP] identifier[file] , identifier[getTypes] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[arrayPosition] operator[SEP] , identifier[CmsAccessControlEntry] operator[SEP] identifier[PRINCIPAL_OVERWRITE_ALL_NAME] , identifier[permissionString] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[getTypes] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[arrayPosition] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[CmsRole] operator[SEP] identifier[PRINCIPAL_ROLE] operator[SEP] operator[SEP] {
identifier[CmsRole] identifier[role] operator[=] identifier[CmsRole] operator[SEP] identifier[valueOfRoleName] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[role] operator[==] Other[null] operator[SEP] {
identifier[Iterator] operator[<] identifier[CmsRole] operator[>] identifier[it] operator[=] identifier[CmsRole] operator[SEP] identifier[getSystemRoles] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[role] operator[=] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[role] operator[SEP] identifier[getName] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
identifier[name] operator[=] identifier[role] operator[SEP] identifier[getRoleName] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
}
}
identifier[getCms] operator[SEP] operator[SEP] operator[SEP] identifier[chacc] operator[SEP] identifier[file] , identifier[getTypes] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[arrayPosition] operator[SEP] , identifier[name] , identifier[permissionString] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[CmsException] identifier[e] operator[SEP] {
identifier[m_errorMessages] operator[SEP] identifier[add] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isErrorEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[e] operator[SEP] identifier[getLocalizedMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public F5<P1, P2, P3, P4, P5, R> orElse(
final Func5<? super P1, ? super P2, ? super P3, ? super P4, ? super P5, ? extends R> fallback
) {
final F5<P1, P2, P3, P4, P5, R> me = this;
return new F5<P1, P2, P3, P4, P5, R>() {
@Override
public R apply(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
try {
return me.apply(p1, p2, p3, p4, p5);
} catch (RuntimeException e) {
return fallback.apply(p1, p2, p3, p4, p5);
}
}
};
} | class class_name[name] begin[{]
method[orElse, return_type[type[F5]], modifier[public], parameter[fallback]] begin[{]
local_variable[type[F5], me]
return[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=p1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=p2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=p3, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=p4, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=p5, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=me, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=p1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=p2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=p3, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=p4, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=p5, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=fallback, 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)], documentation=None, modifiers={'public'}, name=apply, parameters=[FormalParameter(annotations=[], modifiers=set(), name=p1, type=ReferenceType(arguments=None, dimensions=[], name=P1, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=p2, type=ReferenceType(arguments=None, dimensions=[], name=P2, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=p3, type=ReferenceType(arguments=None, dimensions=[], name=P3, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=p4, type=ReferenceType(arguments=None, dimensions=[], name=P4, sub_type=None), varargs=False), FormalParameter(annotations=[], modifiers=set(), name=p5, type=ReferenceType(arguments=None, dimensions=[], name=P5, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None), throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=P1, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=P2, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=P3, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=P4, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=P5, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None))], dimensions=None, name=F5, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[F5] operator[<] identifier[P1] , identifier[P2] , identifier[P3] , identifier[P4] , identifier[P5] , identifier[R] operator[>] identifier[orElse] operator[SEP] Keyword[final] identifier[Func5] operator[<] operator[?] Keyword[super] identifier[P1] , operator[?] Keyword[super] identifier[P2] , operator[?] Keyword[super] identifier[P3] , operator[?] Keyword[super] identifier[P4] , operator[?] Keyword[super] identifier[P5] , operator[?] Keyword[extends] identifier[R] operator[>] identifier[fallback] operator[SEP] {
Keyword[final] identifier[F5] operator[<] identifier[P1] , identifier[P2] , identifier[P3] , identifier[P4] , identifier[P5] , identifier[R] operator[>] identifier[me] operator[=] Keyword[this] operator[SEP] Keyword[return] Keyword[new] identifier[F5] operator[<] identifier[P1] , identifier[P2] , identifier[P3] , identifier[P4] , identifier[P5] , identifier[R] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[R] identifier[apply] operator[SEP] identifier[P1] identifier[p1] , identifier[P2] identifier[p2] , identifier[P3] identifier[p3] , identifier[P4] identifier[p4] , identifier[P5] identifier[p5] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[me] operator[SEP] identifier[apply] operator[SEP] identifier[p1] , identifier[p2] , identifier[p3] , identifier[p4] , identifier[p5] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[RuntimeException] identifier[e] operator[SEP] {
Keyword[return] identifier[fallback] operator[SEP] identifier[apply] operator[SEP] identifier[p1] , identifier[p2] , identifier[p3] , identifier[p4] , identifier[p5] operator[SEP] operator[SEP]
}
}
} operator[SEP]
}
|
public static void iterateTree (@Nonnull final IHCNode aNode, @Nonnull final IHCIteratorCallback aCallback)
{
ValueEnforcer.notNull (aNode, "node");
ValueEnforcer.notNull (aCallback, "callback");
// call callback on start node
if (aCallback.call (null, aNode).isContinue ())
_recursiveIterateTreeBreakable (aNode, aCallback);
} | class class_name[name] begin[{]
method[iterateTree, return_type[void], modifier[public static], parameter[aNode, aCallback]] begin[{]
call[ValueEnforcer.notNull, parameter[member[.aNode], literal["node"]]]
call[ValueEnforcer.notNull, parameter[member[.aCallback], literal["callback"]]]
if[call[aCallback.call, parameter[literal[null], member[.aNode]]]] begin[{]
call[._recursiveIterateTreeBreakable, parameter[member[.aNode], member[.aCallback]]]
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[iterateTree] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[IHCNode] identifier[aNode] , annotation[@] identifier[Nonnull] Keyword[final] identifier[IHCIteratorCallback] identifier[aCallback] operator[SEP] {
identifier[ValueEnforcer] operator[SEP] identifier[notNull] operator[SEP] identifier[aNode] , literal[String] operator[SEP] operator[SEP] identifier[ValueEnforcer] operator[SEP] identifier[notNull] operator[SEP] identifier[aCallback] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[aCallback] operator[SEP] identifier[call] operator[SEP] Other[null] , identifier[aNode] operator[SEP] operator[SEP] identifier[isContinue] operator[SEP] operator[SEP] operator[SEP] identifier[_recursiveIterateTreeBreakable] operator[SEP] identifier[aNode] , identifier[aCallback] operator[SEP] operator[SEP]
}
|
@Override
public long write(ByteBuffer[] srcs, int offset, int length) throws IOException
{
appWrite.compact();
long len = ByteBuffers.move(srcs, offset, length, appWrite);
appWrite.flip();
wrap();
return len;
} | class class_name[name] begin[{]
method[write, return_type[type[long]], modifier[public], parameter[srcs, offset, length]] begin[{]
call[appWrite.compact, parameter[]]
local_variable[type[long], len]
call[appWrite.flip, parameter[]]
call[.wrap, parameter[]]
return[member[.len]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[long] identifier[write] operator[SEP] identifier[ByteBuffer] operator[SEP] operator[SEP] identifier[srcs] , Keyword[int] identifier[offset] , Keyword[int] identifier[length] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[appWrite] operator[SEP] identifier[compact] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[len] operator[=] identifier[ByteBuffers] operator[SEP] identifier[move] operator[SEP] identifier[srcs] , identifier[offset] , identifier[length] , identifier[appWrite] operator[SEP] operator[SEP] identifier[appWrite] operator[SEP] identifier[flip] operator[SEP] operator[SEP] operator[SEP] identifier[wrap] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[len] operator[SEP]
}
|
public CompositeGeneratorNode appendNewLineIfNotEmpty(final CompositeGeneratorNode parent) {
List<IGeneratorNode> _children = parent.getChildren();
String _lineDelimiter = this.wsConfig.getLineDelimiter();
NewLineNode _newLineNode = new NewLineNode(_lineDelimiter, true);
_children.add(_newLineNode);
return parent;
} | class class_name[name] begin[{]
method[appendNewLineIfNotEmpty, return_type[type[CompositeGeneratorNode]], modifier[public], parameter[parent]] begin[{]
local_variable[type[List], _children]
local_variable[type[String], _lineDelimiter]
local_variable[type[NewLineNode], _newLineNode]
call[_children.add, parameter[member[._newLineNode]]]
return[member[.parent]]
end[}]
END[}] | Keyword[public] identifier[CompositeGeneratorNode] identifier[appendNewLineIfNotEmpty] operator[SEP] Keyword[final] identifier[CompositeGeneratorNode] identifier[parent] operator[SEP] {
identifier[List] operator[<] identifier[IGeneratorNode] operator[>] identifier[_children] operator[=] identifier[parent] operator[SEP] identifier[getChildren] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[_lineDelimiter] operator[=] Keyword[this] operator[SEP] identifier[wsConfig] operator[SEP] identifier[getLineDelimiter] operator[SEP] operator[SEP] operator[SEP] identifier[NewLineNode] identifier[_newLineNode] operator[=] Keyword[new] identifier[NewLineNode] operator[SEP] identifier[_lineDelimiter] , literal[boolean] operator[SEP] operator[SEP] identifier[_children] operator[SEP] identifier[add] operator[SEP] identifier[_newLineNode] operator[SEP] operator[SEP] Keyword[return] identifier[parent] operator[SEP]
}
|
protected InstrumentedHttpClientConnectionManager createConnectionManager(Registry<ConnectionSocketFactory> registry,
String name) {
final Duration ttl = configuration.getTimeToLive();
final InstrumentedHttpClientConnectionManager manager = new InstrumentedHttpClientConnectionManager(
metricRegistry,
registry,
null, null,
resolver,
ttl.getQuantity(),
ttl.getUnit(),
name);
return configureConnectionManager(manager);
} | class class_name[name] begin[{]
method[createConnectionManager, return_type[type[InstrumentedHttpClientConnectionManager]], modifier[protected], parameter[registry, name]] begin[{]
local_variable[type[Duration], ttl]
local_variable[type[InstrumentedHttpClientConnectionManager], manager]
return[call[.configureConnectionManager, parameter[member[.manager]]]]
end[}]
END[}] | Keyword[protected] identifier[InstrumentedHttpClientConnectionManager] identifier[createConnectionManager] operator[SEP] identifier[Registry] operator[<] identifier[ConnectionSocketFactory] operator[>] identifier[registry] , identifier[String] identifier[name] operator[SEP] {
Keyword[final] identifier[Duration] identifier[ttl] operator[=] identifier[configuration] operator[SEP] identifier[getTimeToLive] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[InstrumentedHttpClientConnectionManager] identifier[manager] operator[=] Keyword[new] identifier[InstrumentedHttpClientConnectionManager] operator[SEP] identifier[metricRegistry] , identifier[registry] , Other[null] , Other[null] , identifier[resolver] , identifier[ttl] operator[SEP] identifier[getQuantity] operator[SEP] operator[SEP] , identifier[ttl] operator[SEP] identifier[getUnit] operator[SEP] operator[SEP] , identifier[name] operator[SEP] operator[SEP] Keyword[return] identifier[configureConnectionManager] operator[SEP] identifier[manager] operator[SEP] operator[SEP]
}
|
@Override
public String findNodeId(XPathExpression xpathExpression) throws PortalException {
try {
return xpathExpression.evaluate(this.layout);
} catch (XPathExpressionException e) {
throw new PortalException(
"Exception while executing XPathExpression: " + xpathExpression, e);
}
} | class class_name[name] begin[{]
method[findNodeId, return_type[type[String]], modifier[public], parameter[xpathExpression]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=layout, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=evaluate, postfix_operators=[], prefix_operators=[], qualifier=xpathExpression, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception while executing XPathExpression: "), operandr=MemberReference(member=xpathExpression, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=PortalException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['XPathExpressionException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[String] identifier[findNodeId] operator[SEP] identifier[XPathExpression] identifier[xpathExpression] operator[SEP] Keyword[throws] identifier[PortalException] {
Keyword[try] {
Keyword[return] identifier[xpathExpression] operator[SEP] identifier[evaluate] operator[SEP] Keyword[this] operator[SEP] identifier[layout] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[XPathExpressionException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[PortalException] operator[SEP] literal[String] operator[+] identifier[xpathExpression] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("static-method")
protected XExpression _generate(XNumberLiteral literal, IAppendable it, IExtraLanguageGeneratorContext context) {
appendReturnIfExpectedReturnedExpression(it, context);
it.append(literal.getValue());
return literal;
} | class class_name[name] begin[{]
method[_generate, return_type[type[XExpression]], modifier[protected], parameter[literal, it, context]] begin[{]
call[.appendReturnIfExpectedReturnedExpression, parameter[member[.it], member[.context]]]
call[it.append, parameter[call[literal.getValue, parameter[]]]]
return[member[.literal]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] identifier[XExpression] identifier[_generate] operator[SEP] identifier[XNumberLiteral] identifier[literal] , identifier[IAppendable] identifier[it] , identifier[IExtraLanguageGeneratorContext] identifier[context] operator[SEP] {
identifier[appendReturnIfExpectedReturnedExpression] operator[SEP] identifier[it] , identifier[context] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[append] operator[SEP] identifier[literal] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[literal] operator[SEP]
}
|
public com.google.api.ads.adwords.axis.v201809.cm.AppConversionAppPlatform getAppPlatform() {
return appPlatform;
} | class class_name[name] begin[{]
method[getAppPlatform, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.appPlatform]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[adwords] operator[SEP] identifier[axis] operator[SEP] identifier[v201809] operator[SEP] identifier[cm] operator[SEP] identifier[AppConversionAppPlatform] identifier[getAppPlatform] operator[SEP] operator[SEP] {
Keyword[return] identifier[appPlatform] operator[SEP]
}
|
public DataSink<T> writeAsCsv(String filePath, WriteMode writeMode) {
return internalWriteAsCsv(new Path(filePath), CsvOutputFormat.DEFAULT_LINE_DELIMITER, CsvOutputFormat.DEFAULT_FIELD_DELIMITER, writeMode);
} | class class_name[name] begin[{]
method[writeAsCsv, return_type[type[DataSink]], modifier[public], parameter[filePath, writeMode]] begin[{]
return[call[.internalWriteAsCsv, parameter[ClassCreator(arguments=[MemberReference(member=filePath, 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=Path, sub_type=None)), member[CsvOutputFormat.DEFAULT_LINE_DELIMITER], member[CsvOutputFormat.DEFAULT_FIELD_DELIMITER], member[.writeMode]]]]
end[}]
END[}] | Keyword[public] identifier[DataSink] operator[<] identifier[T] operator[>] identifier[writeAsCsv] operator[SEP] identifier[String] identifier[filePath] , identifier[WriteMode] identifier[writeMode] operator[SEP] {
Keyword[return] identifier[internalWriteAsCsv] operator[SEP] Keyword[new] identifier[Path] operator[SEP] identifier[filePath] operator[SEP] , identifier[CsvOutputFormat] operator[SEP] identifier[DEFAULT_LINE_DELIMITER] , identifier[CsvOutputFormat] operator[SEP] identifier[DEFAULT_FIELD_DELIMITER] , identifier[writeMode] operator[SEP] operator[SEP]
}
|
@SuppressWarnings("Duplicates")
protected static void read(File xmlFile) throws SAXException, IOException, ParserConfigurationException, JAXBException {
LOGGER.info("process file: " + xmlFile.getAbsolutePath());
if (!xmlFile.isFile()) {
LOGGER.warn("> provided file is invalid");
return;
}
OpenImmoDocument doc = OpenImmoUtils.createDocument(xmlFile);
if (doc == null) {
LOGGER.warn("> provided XML is not supported");
} else if (doc.isFeedback()) {
printToConsole((OpenImmoFeedbackDocument) doc);
} else if (doc.isTransfer()) {
printToConsole((OpenImmoTransferDocument) doc);
} else {
LOGGER.warn("> unsupported type of document: "
+ doc.getClass().getName());
}
} | class class_name[name] begin[{]
method[read, return_type[void], modifier[static protected], parameter[xmlFile]] begin[{]
call[LOGGER.info, parameter[binary_operation[literal["process file: "], +, call[xmlFile.getAbsolutePath, parameter[]]]]]
if[call[xmlFile.isFile, parameter[]]] begin[{]
call[LOGGER.warn, parameter[literal["> provided file is invalid"]]]
return[None]
else begin[{]
None
end[}]
local_variable[type[OpenImmoDocument], doc]
if[binary_operation[member[.doc], ==, literal[null]]] begin[{]
call[LOGGER.warn, parameter[literal["> provided XML is not supported"]]]
else begin[{]
if[call[doc.isFeedback, parameter[]]] begin[{]
call[.printToConsole, parameter[Cast(expression=MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=OpenImmoFeedbackDocument, sub_type=None))]]
else begin[{]
if[call[doc.isTransfer, parameter[]]] begin[{]
call[.printToConsole, parameter[Cast(expression=MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=OpenImmoTransferDocument, sub_type=None))]]
else begin[{]
call[LOGGER.warn, parameter[binary_operation[literal["> unsupported type of document: "], +, call[doc.getClass, parameter[]]]]]
end[}]
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] Keyword[static] Keyword[void] identifier[read] operator[SEP] identifier[File] identifier[xmlFile] operator[SEP] Keyword[throws] identifier[SAXException] , identifier[IOException] , identifier[ParserConfigurationException] , identifier[JAXBException] {
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[xmlFile] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[xmlFile] operator[SEP] identifier[isFile] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[OpenImmoDocument] identifier[doc] operator[=] identifier[OpenImmoUtils] operator[SEP] identifier[createDocument] operator[SEP] identifier[xmlFile] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[doc] operator[==] Other[null] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[doc] operator[SEP] identifier[isFeedback] operator[SEP] operator[SEP] operator[SEP] {
identifier[printToConsole] operator[SEP] operator[SEP] identifier[OpenImmoFeedbackDocument] operator[SEP] identifier[doc] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[doc] operator[SEP] identifier[isTransfer] operator[SEP] operator[SEP] operator[SEP] {
identifier[printToConsole] operator[SEP] operator[SEP] identifier[OpenImmoTransferDocument] operator[SEP] identifier[doc] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[doc] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
public <T> T get(String fieldName)
{
if (this.overwrites.containsKey(fieldName)) {
return (T) this.overwrites.get(fieldName);
}
return getWrapped().get(fieldName);
} | class class_name[name] begin[{]
method[get, return_type[type[T]], modifier[public], parameter[fieldName]] begin[{]
if[THIS[member[None.overwrites]call[None.containsKey, parameter[member[.fieldName]]]]] begin[{]
return[Cast(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=overwrites, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))]
else begin[{]
None
end[}]
return[call[.getWrapped, parameter[]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[get] operator[SEP] identifier[String] identifier[fieldName] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[overwrites] operator[SEP] identifier[containsKey] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] {
Keyword[return] operator[SEP] identifier[T] operator[SEP] Keyword[this] operator[SEP] identifier[overwrites] operator[SEP] identifier[get] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP]
}
Keyword[return] identifier[getWrapped] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP]
}
|
public WindupConfiguration addDefaultUserRulesDirectory(Path path)
{
List<Path> paths = getOptionValue(DEFAULT_USER_RULES_DIRECTORIES_OPTION);
if (paths == null)
{
paths = new ArrayList<>();
setOptionValue(DEFAULT_USER_RULES_DIRECTORIES_OPTION, paths);
}
Iterable<File> userRulesDirs= getOptionValue(UserRulesDirectoryOption.NAME);
if (userRulesDirs != null)
{
for (File userSpecifiedRuleFile : userRulesDirs)
{
if (userSpecifiedRuleFile != null && userSpecifiedRuleFile.toPath().equals(path))
{
return this;
}
for (Path existingPath : paths)
{
if (existingPath.equals(path))
{
return this;
}
}
}
}
paths.add(path);
return this;
} | class class_name[name] begin[{]
method[addDefaultUserRulesDirectory, return_type[type[WindupConfiguration]], modifier[public], parameter[path]] begin[{]
local_variable[type[List], paths]
if[binary_operation[member[.paths], ==, literal[null]]] begin[{]
assign[member[.paths], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
call[.setOptionValue, parameter[member[.DEFAULT_USER_RULES_DIRECTORIES_OPTION], member[.paths]]]
else begin[{]
None
end[}]
local_variable[type[Iterable], userRulesDirs]
if[binary_operation[member[.userRulesDirs], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=userSpecifiedRuleFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=toPath, postfix_operators=[], prefix_operators=[], qualifier=userSpecifiedRuleFile, selectors=[MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), label=None)])), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=existingPath, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=paths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=existingPath)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Path, sub_type=None))), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=userRulesDirs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=userSpecifiedRuleFile)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=File, sub_type=None))), label=None)
else begin[{]
None
end[}]
call[paths.add, parameter[member[.path]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[WindupConfiguration] identifier[addDefaultUserRulesDirectory] operator[SEP] identifier[Path] identifier[path] operator[SEP] {
identifier[List] operator[<] identifier[Path] operator[>] identifier[paths] operator[=] identifier[getOptionValue] operator[SEP] identifier[DEFAULT_USER_RULES_DIRECTORIES_OPTION] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[paths] operator[==] Other[null] operator[SEP] {
identifier[paths] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[setOptionValue] operator[SEP] identifier[DEFAULT_USER_RULES_DIRECTORIES_OPTION] , identifier[paths] operator[SEP] operator[SEP]
}
identifier[Iterable] operator[<] identifier[File] operator[>] identifier[userRulesDirs] operator[=] identifier[getOptionValue] operator[SEP] identifier[UserRulesDirectoryOption] operator[SEP] identifier[NAME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[userRulesDirs] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] identifier[File] identifier[userSpecifiedRuleFile] operator[:] identifier[userRulesDirs] operator[SEP] {
Keyword[if] operator[SEP] identifier[userSpecifiedRuleFile] operator[!=] Other[null] operator[&&] identifier[userSpecifiedRuleFile] operator[SEP] identifier[toPath] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Path] identifier[existingPath] operator[:] identifier[paths] operator[SEP] {
Keyword[if] operator[SEP] identifier[existingPath] operator[SEP] identifier[equals] operator[SEP] identifier[path] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
}
}
}
identifier[paths] operator[SEP] identifier[add] operator[SEP] identifier[path] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public String getExtension(char key) {
if (!LocaleExtensions.isValidKey(key)) {
throw new IllegalArgumentException("Invalid extension key: " + key);
}
return extensions().getExtensionValue(key);
} | class class_name[name] begin[{]
method[getExtension, return_type[type[String]], modifier[public], parameter[key]] begin[{]
if[call[LocaleExtensions.isValidKey, parameter[member[.key]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid extension key: "), operandr=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.extensions, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[getExtension] operator[SEP] Keyword[char] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[LocaleExtensions] operator[SEP] identifier[isValidKey] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[key] operator[SEP] operator[SEP]
}
Keyword[return] identifier[extensions] operator[SEP] operator[SEP] operator[SEP] identifier[getExtensionValue] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
|
public static <T> List<T> parseListFrom(Reader reader, Schema<T> schema,
boolean numeric) throws IOException
{
final JsonParser parser = DEFAULT_JSON_FACTORY.createJsonParser(reader);
try
{
return parseListFrom(parser, schema, numeric);
}
finally
{
parser.close();
}
} | class class_name[name] begin[{]
method[parseListFrom, return_type[type[List]], modifier[public static], parameter[reader, schema, numeric]] begin[{]
local_variable[type[JsonParser], parser]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=parser, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=schema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=numeric, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseListFrom, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=parser, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[parseListFrom] operator[SEP] identifier[Reader] identifier[reader] , identifier[Schema] operator[<] identifier[T] operator[>] identifier[schema] , Keyword[boolean] identifier[numeric] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[JsonParser] identifier[parser] operator[=] identifier[DEFAULT_JSON_FACTORY] operator[SEP] identifier[createJsonParser] operator[SEP] identifier[reader] operator[SEP] operator[SEP] Keyword[try] {
Keyword[return] identifier[parseListFrom] operator[SEP] identifier[parser] , identifier[schema] , identifier[numeric] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[parser] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static HttpFailure sendErrorResponse(int code, String body) {
return new HttpFailure(new MockResponse().setResponseCode(code).setBody(body));
} | class class_name[name] begin[{]
method[sendErrorResponse, return_type[type[HttpFailure]], modifier[public static], parameter[code, body]] begin[{]
return[ClassCreator(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=code, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setResponseCode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=body, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setBody, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=MockResponse, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=HttpFailure, sub_type=None))]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[HttpFailure] identifier[sendErrorResponse] operator[SEP] Keyword[int] identifier[code] , identifier[String] identifier[body] operator[SEP] {
Keyword[return] Keyword[new] identifier[HttpFailure] operator[SEP] Keyword[new] identifier[MockResponse] operator[SEP] operator[SEP] operator[SEP] identifier[setResponseCode] operator[SEP] identifier[code] operator[SEP] operator[SEP] identifier[setBody] operator[SEP] identifier[body] 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.