code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public static void drop(Table table) {
DBSetup.drop(CallInfo.create(), table.getDB(), table.getName());
}
|
class class_name[name] begin[{]
method[drop, return_type[void], modifier[public static], parameter[table]] begin[{]
call[DBSetup.drop, parameter[call[CallInfo.create, parameter[]], call[table.getDB, parameter[]], call[table.getName, parameter[]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[drop] operator[SEP] identifier[Table] identifier[table] operator[SEP] {
identifier[DBSetup] operator[SEP] identifier[drop] operator[SEP] identifier[CallInfo] operator[SEP] identifier[create] operator[SEP] operator[SEP] , identifier[table] operator[SEP] identifier[getDB] operator[SEP] operator[SEP] , identifier[table] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public QDateTimeValue appendSQL(final SQLSelect _sql)
throws EFapsException
{
_sql.addTimestampValue(new DateTimeType().toString4Where(this.value));
return this;
}
|
class class_name[name] begin[{]
method[appendSQL, return_type[type[QDateTimeValue]], modifier[public], parameter[_sql]] begin[{]
call[_sql.addTimestampValue, parameter[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=value, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=toString4Where, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=DateTimeType, sub_type=None))]]
return[THIS[]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[QDateTimeValue] identifier[appendSQL] operator[SEP] Keyword[final] identifier[SQLSelect] identifier[_sql] operator[SEP] Keyword[throws] identifier[EFapsException] {
identifier[_sql] operator[SEP] identifier[addTimestampValue] operator[SEP] Keyword[new] identifier[DateTimeType] operator[SEP] operator[SEP] operator[SEP] identifier[toString4Where] operator[SEP] Keyword[this] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public com.liferay.commerce.product.type.virtual.order.model.CommerceVirtualOrderItem addCommerceVirtualOrderItem(
com.liferay.commerce.product.type.virtual.order.model.CommerceVirtualOrderItem commerceVirtualOrderItem) {
return _commerceVirtualOrderItemLocalService.addCommerceVirtualOrderItem(commerceVirtualOrderItem);
}
|
class class_name[name] begin[{]
method[addCommerceVirtualOrderItem, return_type[type[com]], modifier[public], parameter[commerceVirtualOrderItem]] begin[{]
return[call[_commerceVirtualOrderItemLocalService.addCommerceVirtualOrderItem, parameter[member[.commerceVirtualOrderItem]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[product] operator[SEP] identifier[type] operator[SEP] identifier[virtual] operator[SEP] identifier[order] operator[SEP] identifier[model] operator[SEP] identifier[CommerceVirtualOrderItem] identifier[addCommerceVirtualOrderItem] operator[SEP] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[product] operator[SEP] identifier[type] operator[SEP] identifier[virtual] operator[SEP] identifier[order] operator[SEP] identifier[model] operator[SEP] identifier[CommerceVirtualOrderItem] identifier[commerceVirtualOrderItem] operator[SEP] {
Keyword[return] identifier[_commerceVirtualOrderItemLocalService] operator[SEP] identifier[addCommerceVirtualOrderItem] operator[SEP] identifier[commerceVirtualOrderItem] operator[SEP] operator[SEP]
}
|
public static <T> Maybe<T> get(String cacheKey, Class<T> clazz) {
return get(CacheService.CACHE_CONFIG_BEAN, cacheKey, clazz);
}
|
class class_name[name] begin[{]
method[get, return_type[type[Maybe]], modifier[public static], parameter[cacheKey, clazz]] begin[{]
return[call[.get, parameter[member[CacheService.CACHE_CONFIG_BEAN], member[.cacheKey], member[.clazz]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Maybe] operator[<] identifier[T] operator[>] identifier[get] operator[SEP] identifier[String] identifier[cacheKey] , identifier[Class] operator[<] identifier[T] operator[>] identifier[clazz] operator[SEP] {
Keyword[return] identifier[get] operator[SEP] identifier[CacheService] operator[SEP] identifier[CACHE_CONFIG_BEAN] , identifier[cacheKey] , identifier[clazz] operator[SEP] operator[SEP]
}
|
public ResponseSpecBuilder expectHeader(String headerName, Matcher<String> expectedValueMatcher) {
spec.header(headerName, expectedValueMatcher);
return this;
}
|
class class_name[name] begin[{]
method[expectHeader, return_type[type[ResponseSpecBuilder]], modifier[public], parameter[headerName, expectedValueMatcher]] begin[{]
call[spec.header, parameter[member[.headerName], member[.expectedValueMatcher]]]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[ResponseSpecBuilder] identifier[expectHeader] operator[SEP] identifier[String] identifier[headerName] , identifier[Matcher] operator[<] identifier[String] operator[>] identifier[expectedValueMatcher] operator[SEP] {
identifier[spec] operator[SEP] identifier[header] operator[SEP] identifier[headerName] , identifier[expectedValueMatcher] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public static void run(final Properties properties)
throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
// read splits
System.out.println("Parsing started: training file");
File trainingFile = new File(properties.getProperty(TRAINING_FILE));
DataModelIF<Long, Long> trainingModel = new SimpleParser().parseData(trainingFile);
System.out.println("Parsing finished: training file");
System.out.println("Parsing started: test file");
File testFile = new File(properties.getProperty(TEST_FILE));
DataModelIF<Long, Long> testModel = new SimpleParser().parseData(testFile);
System.out.println("Parsing finished: test file");
// read other parameters
File inputFile = new File(properties.getProperty(INPUT_FILE));
Boolean overwrite = Boolean.parseBoolean(properties.getProperty(OUTPUT_OVERWRITE, "false"));
File rankingFile = new File(properties.getProperty(OUTPUT_FILE));
File groundtruthFile = new File(properties.getProperty(GROUNDTRUTH_FILE));
EvaluationStrategy.OUTPUT_FORMAT format = null;
if (properties.getProperty(OUTPUT_FORMAT).equals(EvaluationStrategy.OUTPUT_FORMAT.TRECEVAL.toString())) {
format = EvaluationStrategy.OUTPUT_FORMAT.TRECEVAL;
} else {
format = EvaluationStrategy.OUTPUT_FORMAT.SIMPLE;
}
Double threshold = Double.parseDouble(properties.getProperty(RELEVANCE_THRESHOLD));
String strategyClassName = properties.getProperty(STRATEGY);
Class<?> strategyClass = Class.forName(strategyClassName);
// get strategy
EvaluationStrategy<Long, Long> strategy = null;
if (strategyClassName.contains("RelPlusN")) {
Integer number = Integer.parseInt(properties.getProperty(RELPLUSN_N));
Long seed = Long.parseLong(properties.getProperty(RELPLUSN_SEED));
strategy = new RelPlusN(trainingModel, testModel, number, threshold, seed);
} else {
Object strategyObj = strategyClass.getConstructor(DataModelIF.class, DataModelIF.class, double.class).newInstance(trainingModel, testModel, threshold);
if (strategyObj instanceof EvaluationStrategy) {
@SuppressWarnings("unchecked")
EvaluationStrategy<Long, Long> strategyTemp = (EvaluationStrategy<Long, Long>) strategyObj;
strategy = strategyTemp;
}
}
// generate output
generateOutput(testModel, inputFile, strategy, format, rankingFile, groundtruthFile, overwrite);
}
|
class class_name[name] begin[{]
method[run, return_type[void], modifier[public static], parameter[properties]] begin[{]
call[System.out.println, parameter[literal["Parsing started: training file"]]]
local_variable[type[File], trainingFile]
local_variable[type[DataModelIF], trainingModel]
call[System.out.println, parameter[literal["Parsing finished: training file"]]]
call[System.out.println, parameter[literal["Parsing started: test file"]]]
local_variable[type[File], testFile]
local_variable[type[DataModelIF], testModel]
call[System.out.println, parameter[literal["Parsing finished: test file"]]]
local_variable[type[File], inputFile]
local_variable[type[Boolean], overwrite]
local_variable[type[File], rankingFile]
local_variable[type[File], groundtruthFile]
local_variable[type[EvaluationStrategy], format]
if[call[properties.getProperty, parameter[member[.OUTPUT_FORMAT]]]] begin[{]
assign[member[.format], member[EvaluationStrategy.OUTPUT_FORMAT.TRECEVAL]]
else begin[{]
assign[member[.format], member[EvaluationStrategy.OUTPUT_FORMAT.SIMPLE]]
end[}]
local_variable[type[Double], threshold]
local_variable[type[String], strategyClassName]
local_variable[type[Class], strategyClass]
local_variable[type[EvaluationStrategy], strategy]
if[call[strategyClassName.contains, parameter[literal["RelPlusN"]]]] begin[{]
local_variable[type[Integer], number]
local_variable[type[Long], seed]
assign[member[.strategy], ClassCreator(arguments=[MemberReference(member=trainingModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=testModel, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=number, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=threshold, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=seed, 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=RelPlusN, sub_type=None))]
else begin[{]
local_variable[type[Object], strategyObj]
if[binary_operation[member[.strategyObj], instanceof, type[EvaluationStrategy]]] begin[{]
local_variable[type[EvaluationStrategy], strategyTemp]
assign[member[.strategy], member[.strategyTemp]]
else begin[{]
None
end[}]
end[}]
call[.generateOutput, parameter[member[.testModel], member[.inputFile], member[.strategy], member[.format], member[.rankingFile], member[.groundtruthFile], member[.overwrite]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[run] operator[SEP] Keyword[final] identifier[Properties] identifier[properties] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ClassNotFoundException] , identifier[IllegalAccessException] , identifier[InstantiationException] , identifier[InvocationTargetException] , identifier[NoSuchMethodException] {
identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[File] identifier[trainingFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[TRAINING_FILE] operator[SEP] operator[SEP] operator[SEP] identifier[DataModelIF] operator[<] identifier[Long] , identifier[Long] operator[>] identifier[trainingModel] operator[=] Keyword[new] identifier[SimpleParser] operator[SEP] operator[SEP] operator[SEP] identifier[parseData] operator[SEP] identifier[trainingFile] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[File] identifier[testFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[TEST_FILE] operator[SEP] operator[SEP] operator[SEP] identifier[DataModelIF] operator[<] identifier[Long] , identifier[Long] operator[>] identifier[testModel] operator[=] Keyword[new] identifier[SimpleParser] operator[SEP] operator[SEP] operator[SEP] identifier[parseData] operator[SEP] identifier[testFile] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[out] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[File] identifier[inputFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[INPUT_FILE] operator[SEP] operator[SEP] operator[SEP] identifier[Boolean] identifier[overwrite] operator[=] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[OUTPUT_OVERWRITE] , literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[File] identifier[rankingFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[OUTPUT_FILE] operator[SEP] operator[SEP] operator[SEP] identifier[File] identifier[groundtruthFile] operator[=] Keyword[new] identifier[File] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[GROUNDTRUTH_FILE] operator[SEP] operator[SEP] operator[SEP] identifier[EvaluationStrategy] operator[SEP] identifier[OUTPUT_FORMAT] identifier[format] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[OUTPUT_FORMAT] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[EvaluationStrategy] operator[SEP] identifier[OUTPUT_FORMAT] operator[SEP] identifier[TRECEVAL] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[format] operator[=] identifier[EvaluationStrategy] operator[SEP] identifier[OUTPUT_FORMAT] operator[SEP] identifier[TRECEVAL] operator[SEP]
}
Keyword[else] {
identifier[format] operator[=] identifier[EvaluationStrategy] operator[SEP] identifier[OUTPUT_FORMAT] operator[SEP] identifier[SIMPLE] operator[SEP]
}
identifier[Double] identifier[threshold] operator[=] identifier[Double] operator[SEP] identifier[parseDouble] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[RELEVANCE_THRESHOLD] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[strategyClassName] operator[=] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[STRATEGY] operator[SEP] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[strategyClass] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[strategyClassName] operator[SEP] operator[SEP] identifier[EvaluationStrategy] operator[<] identifier[Long] , identifier[Long] operator[>] identifier[strategy] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[strategyClassName] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[Integer] identifier[number] operator[=] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[RELPLUSN_N] operator[SEP] operator[SEP] operator[SEP] identifier[Long] identifier[seed] operator[=] identifier[Long] operator[SEP] identifier[parseLong] operator[SEP] identifier[properties] operator[SEP] identifier[getProperty] operator[SEP] identifier[RELPLUSN_SEED] operator[SEP] operator[SEP] operator[SEP] identifier[strategy] operator[=] Keyword[new] identifier[RelPlusN] operator[SEP] identifier[trainingModel] , identifier[testModel] , identifier[number] , identifier[threshold] , identifier[seed] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Object] identifier[strategyObj] operator[=] identifier[strategyClass] operator[SEP] identifier[getConstructor] operator[SEP] identifier[DataModelIF] operator[SEP] Keyword[class] , identifier[DataModelIF] operator[SEP] Keyword[class] , Keyword[double] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[newInstance] operator[SEP] identifier[trainingModel] , identifier[testModel] , identifier[threshold] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strategyObj] Keyword[instanceof] identifier[EvaluationStrategy] operator[SEP] {
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[EvaluationStrategy] operator[<] identifier[Long] , identifier[Long] operator[>] identifier[strategyTemp] operator[=] operator[SEP] identifier[EvaluationStrategy] operator[<] identifier[Long] , identifier[Long] operator[>] operator[SEP] identifier[strategyObj] operator[SEP] identifier[strategy] operator[=] identifier[strategyTemp] operator[SEP]
}
}
identifier[generateOutput] operator[SEP] identifier[testModel] , identifier[inputFile] , identifier[strategy] , identifier[format] , identifier[rankingFile] , identifier[groundtruthFile] , identifier[overwrite] operator[SEP] operator[SEP]
}
|
public String prepare(String input) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < input.length(); i++){
char c = input.charAt(i);
if(map.get(c) != null) {
replacements++;
sb.append(map.get(c));
} else
sb.append(c);
}
return sb.toString();
}
|
class class_name[name] begin[{]
method[prepare, return_type[type[String]], modifier[public], parameter[input]] begin[{]
local_variable[type[StringBuffer], sb]
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=input, selectors=[], type_arguments=None), name=c)], modifiers=set(), type=BasicType(dimensions=[], name=char)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=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=MemberReference(member=replacements, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None)], 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=input, 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)
return[call[sb.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[prepare] operator[SEP] identifier[String] identifier[input] operator[SEP] {
identifier[StringBuffer] identifier[sb] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[input] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[char] identifier[c] operator[=] identifier[input] operator[SEP] identifier[charAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[map] operator[SEP] identifier[get] operator[SEP] identifier[c] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[replacements] operator[++] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[map] operator[SEP] identifier[get] operator[SEP] identifier[c] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[c] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public int addPoint(double x, double y, int groupIndex) {
final int groupCount = getGroupCount();
if (groupIndex < 0) {
throw new IndexOutOfBoundsException(groupIndex + "<0"); //$NON-NLS-1$
}
if (groupIndex >= groupCount) {
throw new IndexOutOfBoundsException(groupIndex + ">=" + groupCount); //$NON-NLS-1$
}
int pointIndex;
if (this.pointCoordinates == null) {
this.pointCoordinates = new double[] {x, y};
this.partIndexes = null;
pointIndex = 0;
} else {
pointIndex = lastInGroup(groupIndex);
double[] pts = new double[this.pointCoordinates.length + 2];
pointIndex += 2;
System.arraycopy(this.pointCoordinates, 0, pts, 0, pointIndex);
System.arraycopy(this.pointCoordinates, pointIndex, pts, pointIndex + 2, this.pointCoordinates.length - pointIndex);
pts[pointIndex] = x;
pts[pointIndex + 1] = y;
this.pointCoordinates = pts;
pts = null;
//Shift the following groups's indexes
if (this.partIndexes != null) {
for (int idx = groupIndex; idx < this.partIndexes.length; ++idx) {
this.partIndexes[idx] += 2;
}
}
pointIndex /= 2.;
}
fireShapeChanged();
fireElementChanged();
return pointIndex;
}
|
class class_name[name] begin[{]
method[addPoint, return_type[type[int]], modifier[public], parameter[x, y, groupIndex]] begin[{]
local_variable[type[int], groupCount]
if[binary_operation[member[.groupIndex], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=groupIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="<0"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.groupIndex], >=, member[.groupCount]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=groupIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=">="), operator=+), operandr=MemberReference(member=groupCount, 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=IndexOutOfBoundsException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[int], pointIndex]
if[binary_operation[THIS[member[None.pointCoordinates]], ==, literal[null]]] begin[{]
assign[THIS[member[None.pointCoordinates]], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=double))]
assign[THIS[member[None.partIndexes]], literal[null]]
assign[member[.pointIndex], literal[0]]
else begin[{]
assign[member[.pointIndex], call[.lastInGroup, parameter[member[.groupIndex]]]]
local_variable[type[double], pts]
assign[member[.pointIndex], literal[2]]
call[System.arraycopy, parameter[THIS[member[None.pointCoordinates]], literal[0], member[.pts], literal[0], member[.pointIndex]]]
call[System.arraycopy, parameter[THIS[member[None.pointCoordinates]], member[.pointIndex], member[.pts], binary_operation[member[.pointIndex], +, literal[2]], binary_operation[THIS[member[None.pointCoordinates]member[None.length]], -, member[.pointIndex]]]]
assign[member[.pts], member[.x]]
assign[member[.pts], member[.y]]
assign[THIS[member[None.pointCoordinates]], member[.pts]]
assign[member[.pts], literal[null]]
if[binary_operation[THIS[member[None.partIndexes]], !=, literal[null]]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=partIndexes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), ArraySelector(index=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type=+=, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=idx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=partIndexes, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MemberReference(member=length, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=groupIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=idx)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=idx, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
else begin[{]
None
end[}]
assign[member[.pointIndex], literal[2.]]
end[}]
call[.fireShapeChanged, parameter[]]
call[.fireElementChanged, parameter[]]
return[member[.pointIndex]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[addPoint] operator[SEP] Keyword[double] identifier[x] , Keyword[double] identifier[y] , Keyword[int] identifier[groupIndex] operator[SEP] {
Keyword[final] Keyword[int] identifier[groupCount] operator[=] identifier[getGroupCount] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[groupIndex] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] identifier[groupIndex] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[groupIndex] operator[>=] identifier[groupCount] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] identifier[groupIndex] operator[+] literal[String] operator[+] identifier[groupCount] operator[SEP] operator[SEP]
}
Keyword[int] identifier[pointIndex] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[pointCoordinates] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[pointCoordinates] operator[=] Keyword[new] Keyword[double] operator[SEP] operator[SEP] {
identifier[x] , identifier[y]
} operator[SEP] Keyword[this] operator[SEP] identifier[partIndexes] operator[=] Other[null] operator[SEP] identifier[pointIndex] operator[=] Other[0] operator[SEP]
}
Keyword[else] {
identifier[pointIndex] operator[=] identifier[lastInGroup] operator[SEP] identifier[groupIndex] operator[SEP] operator[SEP] Keyword[double] operator[SEP] operator[SEP] identifier[pts] operator[=] Keyword[new] Keyword[double] operator[SEP] Keyword[this] operator[SEP] identifier[pointCoordinates] operator[SEP] identifier[length] operator[+] Other[2] operator[SEP] operator[SEP] identifier[pointIndex] operator[+=] Other[2] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] Keyword[this] operator[SEP] identifier[pointCoordinates] , Other[0] , identifier[pts] , Other[0] , identifier[pointIndex] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] Keyword[this] operator[SEP] identifier[pointCoordinates] , identifier[pointIndex] , identifier[pts] , identifier[pointIndex] operator[+] Other[2] , Keyword[this] operator[SEP] identifier[pointCoordinates] operator[SEP] identifier[length] operator[-] identifier[pointIndex] operator[SEP] operator[SEP] identifier[pts] operator[SEP] identifier[pointIndex] operator[SEP] operator[=] identifier[x] operator[SEP] identifier[pts] operator[SEP] identifier[pointIndex] operator[+] Other[1] operator[SEP] operator[=] identifier[y] operator[SEP] Keyword[this] operator[SEP] identifier[pointCoordinates] operator[=] identifier[pts] operator[SEP] identifier[pts] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[partIndexes] operator[!=] Other[null] operator[SEP] {
Keyword[for] operator[SEP] Keyword[int] identifier[idx] operator[=] identifier[groupIndex] operator[SEP] identifier[idx] operator[<] Keyword[this] operator[SEP] identifier[partIndexes] operator[SEP] identifier[length] operator[SEP] operator[++] identifier[idx] operator[SEP] {
Keyword[this] operator[SEP] identifier[partIndexes] operator[SEP] identifier[idx] operator[SEP] operator[+=] Other[2] operator[SEP]
}
}
identifier[pointIndex] operator[/=] literal[Float] operator[SEP]
}
identifier[fireShapeChanged] operator[SEP] operator[SEP] operator[SEP] identifier[fireElementChanged] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[pointIndex] operator[SEP]
}
|
public void abort() throws SQLException {
if (fetchSize != 0) {
fetchSize = 0;
if (resultSet != null) {
resultSet.abort();
} else {
SelectResultSet firstResult = executionResults.peekFirst();
if (firstResult != null) {
firstResult.abort();
}
}
}
}
|
class class_name[name] begin[{]
method[abort, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.fetchSize], !=, literal[0]]] begin[{]
assign[member[.fetchSize], literal[0]]
if[binary_operation[member[.resultSet], !=, literal[null]]] begin[{]
call[resultSet.abort, parameter[]]
else begin[{]
local_variable[type[SelectResultSet], firstResult]
if[binary_operation[member[.firstResult], !=, literal[null]]] begin[{]
call[firstResult.abort, parameter[]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[abort] operator[SEP] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[if] operator[SEP] identifier[fetchSize] operator[!=] Other[0] operator[SEP] {
identifier[fetchSize] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[resultSet] operator[!=] Other[null] operator[SEP] {
identifier[resultSet] operator[SEP] identifier[abort] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[SelectResultSet] identifier[firstResult] operator[=] identifier[executionResults] operator[SEP] identifier[peekFirst] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[firstResult] operator[!=] Other[null] operator[SEP] {
identifier[firstResult] operator[SEP] identifier[abort] operator[SEP] operator[SEP] operator[SEP]
}
}
}
}
|
@Override
protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m,
Object[] paramArray) throws Exception {
// This retrieves the appropriate method from the wrapper class
m = serviceObject.getClass().getMethod(m.getName(), m.getParameterTypes());
return super.performInvocation(exchange, serviceObject, m, paramArray);
}
|
class class_name[name] begin[{]
method[performInvocation, return_type[type[Object]], modifier[protected], parameter[exchange, serviceObject, m, paramArray]] begin[{]
assign[member[.m], call[serviceObject.getClass, parameter[]]]
return[SuperMethodInvocation(arguments=[MemberReference(member=exchange, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=serviceObject, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=paramArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=performInvocation, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] identifier[Object] identifier[performInvocation] operator[SEP] identifier[Exchange] identifier[exchange] , Keyword[final] identifier[Object] identifier[serviceObject] , identifier[Method] identifier[m] , identifier[Object] operator[SEP] operator[SEP] identifier[paramArray] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[m] operator[=] identifier[serviceObject] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getMethod] operator[SEP] identifier[m] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[m] operator[SEP] identifier[getParameterTypes] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[super] operator[SEP] identifier[performInvocation] operator[SEP] identifier[exchange] , identifier[serviceObject] , identifier[m] , identifier[paramArray] operator[SEP] operator[SEP]
}
|
public void setDates(SortedSet<Date> dates, boolean checked) {
m_checkBoxes.clear();
for (Date date : dates) {
CmsCheckBox cb = generateCheckBox(date, checked);
m_checkBoxes.add(cb);
}
reInitLayoutElements();
setDatesInternal(dates);
}
|
class class_name[name] begin[{]
method[setDates, return_type[void], modifier[public], parameter[dates, checked]] begin[{]
call[m_checkBoxes.clear, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=date, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=checked, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=generateCheckBox, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=cb)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CmsCheckBox, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cb, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=m_checkBoxes, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=dates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=date)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Date, sub_type=None))), label=None)
call[.reInitLayoutElements, parameter[]]
call[.setDatesInternal, parameter[member[.dates]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setDates] operator[SEP] identifier[SortedSet] operator[<] identifier[Date] operator[>] identifier[dates] , Keyword[boolean] identifier[checked] operator[SEP] {
identifier[m_checkBoxes] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Date] identifier[date] operator[:] identifier[dates] operator[SEP] {
identifier[CmsCheckBox] identifier[cb] operator[=] identifier[generateCheckBox] operator[SEP] identifier[date] , identifier[checked] operator[SEP] operator[SEP] identifier[m_checkBoxes] operator[SEP] identifier[add] operator[SEP] identifier[cb] operator[SEP] operator[SEP]
}
identifier[reInitLayoutElements] operator[SEP] operator[SEP] operator[SEP] identifier[setDatesInternal] operator[SEP] identifier[dates] operator[SEP] operator[SEP]
}
|
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AfplibPackage.MMDRG__RG_LENGTH:
return RG_LENGTH_EDEFAULT == null ? rgLength != null : !RG_LENGTH_EDEFAULT.equals(rgLength);
case AfplibPackage.MMDRG__TRIPLETS:
return triplets != null && !triplets.isEmpty();
}
return super.eIsSet(featureID);
}
|
class class_name[name] begin[{]
method[eIsSet, return_type[type[boolean]], modifier[public], parameter[featureID]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=MMDRG__RG_LENGTH, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=RG_LENGTH_EDEFAULT, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=rgLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=RG_LENGTH_EDEFAULT, selectors=[], type_arguments=None), if_true=BinaryOperation(operandl=MemberReference(member=rgLength, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=)), label=None)]), SwitchStatementCase(case=[MemberReference(member=MMDRG__TRIPLETS, postfix_operators=[], prefix_operators=[], qualifier=AfplibPackage, selectors=[])], statements=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=triplets, 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=triplets, selectors=[], type_arguments=None), operator=&&), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eIsSet, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[eIsSet] operator[SEP] Keyword[int] identifier[featureID] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[MMDRG__RG_LENGTH] operator[:] Keyword[return] identifier[RG_LENGTH_EDEFAULT] operator[==] Other[null] operator[?] identifier[rgLength] operator[!=] Other[null] operator[:] operator[!] identifier[RG_LENGTH_EDEFAULT] operator[SEP] identifier[equals] operator[SEP] identifier[rgLength] operator[SEP] operator[SEP] Keyword[case] identifier[AfplibPackage] operator[SEP] identifier[MMDRG__TRIPLETS] operator[:] Keyword[return] identifier[triplets] operator[!=] Other[null] operator[&&] operator[!] identifier[triplets] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eIsSet] operator[SEP] identifier[featureID] operator[SEP] operator[SEP]
}
|
public static Namespace convert(
final org.openbel.framework.common.model.Namespace ns) {
Namespace ws = OBJECT_FACTORY.createNamespace();
ws.setPrefix(ns.getPrefix());
ws.setResourceLocation(ns.getResourceLocation());
return ws;
}
|
class class_name[name] begin[{]
method[convert, return_type[type[Namespace]], modifier[public static], parameter[ns]] begin[{]
local_variable[type[Namespace], ws]
call[ws.setPrefix, parameter[call[ns.getPrefix, parameter[]]]]
call[ws.setResourceLocation, parameter[call[ns.getResourceLocation, parameter[]]]]
return[member[.ws]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Namespace] identifier[convert] operator[SEP] Keyword[final] identifier[org] operator[SEP] identifier[openbel] operator[SEP] identifier[framework] operator[SEP] identifier[common] operator[SEP] identifier[model] operator[SEP] identifier[Namespace] identifier[ns] operator[SEP] {
identifier[Namespace] identifier[ws] operator[=] identifier[OBJECT_FACTORY] operator[SEP] identifier[createNamespace] operator[SEP] operator[SEP] operator[SEP] identifier[ws] operator[SEP] identifier[setPrefix] operator[SEP] identifier[ns] operator[SEP] identifier[getPrefix] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[ws] operator[SEP] identifier[setResourceLocation] operator[SEP] identifier[ns] operator[SEP] identifier[getResourceLocation] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[ws] operator[SEP]
}
|
@Override
public boolean isGlobalResourceBundle(String resourceBundleId) {
boolean isGlobalResourceBundle = false;
for (JoinableResourceBundle bundle : globalBundles) {
if (bundle.getId().equals(resourceBundleId)) {
isGlobalResourceBundle = true;
}
}
return isGlobalResourceBundle;
}
|
class class_name[name] begin[{]
method[isGlobalResourceBundle, return_type[type[boolean]], modifier[public], parameter[resourceBundleId]] begin[{]
local_variable[type[boolean], isGlobalResourceBundle]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getId, postfix_operators=[], prefix_operators=[], qualifier=bundle, selectors=[MethodInvocation(arguments=[MemberReference(member=resourceBundleId, 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=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=isGlobalResourceBundle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=globalBundles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=bundle)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=JoinableResourceBundle, sub_type=None))), label=None)
return[member[.isGlobalResourceBundle]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[isGlobalResourceBundle] operator[SEP] identifier[String] identifier[resourceBundleId] operator[SEP] {
Keyword[boolean] identifier[isGlobalResourceBundle] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[JoinableResourceBundle] identifier[bundle] operator[:] identifier[globalBundles] operator[SEP] {
Keyword[if] operator[SEP] identifier[bundle] operator[SEP] identifier[getId] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[resourceBundleId] operator[SEP] operator[SEP] {
identifier[isGlobalResourceBundle] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[return] identifier[isGlobalResourceBundle] operator[SEP]
}
|
public static String encodeText(String text, Charset charset) {
try {
return MimeUtility.encodeText(text, charset.name(), null);
} catch (UnsupportedEncodingException e) {
// ignore
}
return text;
}
|
class class_name[name] begin[{]
method[encodeText, return_type[type[String]], modifier[public static], parameter[text, charset]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=text, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=name, postfix_operators=[], prefix_operators=[], qualifier=charset, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=encodeText, postfix_operators=[], prefix_operators=[], qualifier=MimeUtility, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['UnsupportedEncodingException']))], finally_block=None, label=None, resources=None)
return[member[.text]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[encodeText] operator[SEP] identifier[String] identifier[text] , identifier[Charset] identifier[charset] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[MimeUtility] operator[SEP] identifier[encodeText] operator[SEP] identifier[text] , identifier[charset] operator[SEP] identifier[name] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[UnsupportedEncodingException] identifier[e] operator[SEP] {
}
Keyword[return] identifier[text] operator[SEP]
}
|
public void addNew() throws DBException
{
super.addNew();
Record recCurrent = this.moveToCurrentRecord(null); // Perhaps, they supplied a default record type and this will switch it.
if ((recCurrent != null) && (this.getBaseRecord() != recCurrent))
recCurrent.handleNewRecord(); // Display Fields and do Add behaviors on correct record
else if ((this.getCurrentRecord() != null) && (this.getCurrentRecord() != this.getBaseRecord()))
{
this.getBaseRecord().matchListeners(this.getCurrentRecord(), false, true, true, true, true); // Clone the listeners that are not there already.
this.getCurrentRecord().addNew();
}
}
|
class class_name[name] begin[{]
method[addNew, return_type[void], modifier[public], parameter[]] begin[{]
SuperMethodInvocation(arguments=[], member=addNew, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
local_variable[type[Record], recCurrent]
if[binary_operation[binary_operation[member[.recCurrent], !=, literal[null]], &&, binary_operation[THIS[call[None.getBaseRecord, parameter[]]], !=, member[.recCurrent]]]] begin[{]
call[recCurrent.handleNewRecord, parameter[]]
else begin[{]
if[binary_operation[binary_operation[THIS[call[None.getCurrentRecord, parameter[]]], !=, literal[null]], &&, binary_operation[THIS[call[None.getCurrentRecord, parameter[]]], !=, THIS[call[None.getBaseRecord, parameter[]]]]]] begin[{]
THIS[call[None.getBaseRecord, parameter[]]call[None.matchListeners, parameter[THIS[call[None.getCurrentRecord, parameter[]]], literal[false], literal[true], literal[true], literal[true], literal[true]]]]
THIS[call[None.getCurrentRecord, parameter[]]call[None.addNew, parameter[]]]
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addNew] operator[SEP] operator[SEP] Keyword[throws] identifier[DBException] {
Keyword[super] operator[SEP] identifier[addNew] operator[SEP] operator[SEP] operator[SEP] identifier[Record] identifier[recCurrent] operator[=] Keyword[this] operator[SEP] identifier[moveToCurrentRecord] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[recCurrent] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] Keyword[this] operator[SEP] identifier[getBaseRecord] operator[SEP] operator[SEP] operator[!=] identifier[recCurrent] operator[SEP] operator[SEP] identifier[recCurrent] operator[SEP] identifier[handleNewRecord] operator[SEP] operator[SEP] operator[SEP] Keyword[else] Keyword[if] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[getCurrentRecord] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] Keyword[this] operator[SEP] identifier[getCurrentRecord] operator[SEP] operator[SEP] operator[!=] Keyword[this] operator[SEP] identifier[getBaseRecord] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[getBaseRecord] operator[SEP] operator[SEP] operator[SEP] identifier[matchListeners] operator[SEP] Keyword[this] operator[SEP] identifier[getCurrentRecord] operator[SEP] operator[SEP] , literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean] , literal[boolean] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[getCurrentRecord] operator[SEP] operator[SEP] operator[SEP] identifier[addNew] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public Optional<String> toContentTypeHeader() {
return contentType.map(ct -> {
if (charset.isPresent()) {
return ct + "; charset=" + charset.get();
} else {
return ct;
}
});
}
|
class class_name[name] begin[{]
method[toContentTypeHeader, return_type[type[Optional]], modifier[public], parameter[]] begin[{]
return[call[contentType.map, parameter[LambdaExpression(body=[IfStatement(condition=MethodInvocation(arguments=[], member=isPresent, postfix_operators=[], prefix_operators=[], qualifier=charset, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=ct, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ct, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="; charset="), operator=+), operandr=MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=charset, selectors=[], type_arguments=None), operator=+), label=None)]))], parameters=[MemberReference(member=ct, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]
end[}]
END[}]
|
Keyword[public] identifier[Optional] operator[<] identifier[String] operator[>] identifier[toContentTypeHeader] operator[SEP] operator[SEP] {
Keyword[return] identifier[contentType] operator[SEP] identifier[map] operator[SEP] identifier[ct] operator[->] {
Keyword[if] operator[SEP] identifier[charset] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[ct] operator[+] literal[String] operator[+] identifier[charset] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[ct] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
@SuppressWarnings({"WeakerAccess", "unused"}) // For library users
public Styler setInput(@NonNull JSONObject result, @NonNull String attribute,
@Nullable String prefix, @Nullable String suffix,
boolean inverted, boolean snippetted) {
final String highlightedAttribute = getHighlightedAttribute(result, attribute, inverted, snippetted);
prefix = prefix == null ? "" : prefix;
suffix = suffix == null ? "" : suffix;
return setInput(prefix + highlightedAttribute + suffix);
}
|
class class_name[name] begin[{]
method[setInput, return_type[type[Styler]], modifier[public], parameter[result, attribute, prefix, suffix, inverted, snippetted]] begin[{]
local_variable[type[String], highlightedAttribute]
assign[member[.prefix], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=prefix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]
assign[member[.suffix], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=suffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MemberReference(member=suffix, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]
return[call[.setInput, parameter[binary_operation[binary_operation[member[.prefix], +, member[.highlightedAttribute]], +, member[.suffix]]]]]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] Keyword[public] identifier[Styler] identifier[setInput] operator[SEP] annotation[@] identifier[NonNull] identifier[JSONObject] identifier[result] , annotation[@] identifier[NonNull] identifier[String] identifier[attribute] , annotation[@] identifier[Nullable] identifier[String] identifier[prefix] , annotation[@] identifier[Nullable] identifier[String] identifier[suffix] , Keyword[boolean] identifier[inverted] , Keyword[boolean] identifier[snippetted] operator[SEP] {
Keyword[final] identifier[String] identifier[highlightedAttribute] operator[=] identifier[getHighlightedAttribute] operator[SEP] identifier[result] , identifier[attribute] , identifier[inverted] , identifier[snippetted] operator[SEP] operator[SEP] identifier[prefix] operator[=] identifier[prefix] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[prefix] operator[SEP] identifier[suffix] operator[=] identifier[suffix] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[suffix] operator[SEP] Keyword[return] identifier[setInput] operator[SEP] identifier[prefix] operator[+] identifier[highlightedAttribute] operator[+] identifier[suffix] operator[SEP] operator[SEP]
}
|
public void onDoubleClick(DoubleClickEvent event) {
//Check if there was a last click that was handled in this class.
if (null != lastClickPosition) {
// Zoom in on the event location.
Bbox bounds = mapWidget.getMapModel().getMapView().getBounds();
double x = lastClickPosition.getX() - (bounds.getWidth() / 4);
double y = lastClickPosition.getY() - (bounds.getHeight() / 4);
Bbox newBounds = new Bbox(x, y, bounds.getWidth() / 2, bounds.getHeight() / 2);
mapWidget.getMapModel().getMapView().applyBounds(newBounds, ZoomOption.LEVEL_CHANGE);
}
}
|
class class_name[name] begin[{]
method[onDoubleClick, return_type[void], modifier[public], parameter[event]] begin[{]
if[binary_operation[literal[null], !=, member[.lastClickPosition]]] begin[{]
local_variable[type[Bbox], bounds]
local_variable[type[double], x]
local_variable[type[double], y]
local_variable[type[Bbox], newBounds]
call[mapWidget.getMapModel, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[onDoubleClick] operator[SEP] identifier[DoubleClickEvent] identifier[event] operator[SEP] {
Keyword[if] operator[SEP] Other[null] operator[!=] identifier[lastClickPosition] operator[SEP] {
identifier[Bbox] identifier[bounds] operator[=] identifier[mapWidget] operator[SEP] identifier[getMapModel] operator[SEP] operator[SEP] operator[SEP] identifier[getMapView] operator[SEP] operator[SEP] operator[SEP] identifier[getBounds] operator[SEP] operator[SEP] operator[SEP] Keyword[double] identifier[x] operator[=] identifier[lastClickPosition] operator[SEP] identifier[getX] operator[SEP] operator[SEP] operator[-] operator[SEP] identifier[bounds] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[/] Other[4] operator[SEP] operator[SEP] Keyword[double] identifier[y] operator[=] identifier[lastClickPosition] operator[SEP] identifier[getY] operator[SEP] operator[SEP] operator[-] operator[SEP] identifier[bounds] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[/] Other[4] operator[SEP] operator[SEP] identifier[Bbox] identifier[newBounds] operator[=] Keyword[new] identifier[Bbox] operator[SEP] identifier[x] , identifier[y] , identifier[bounds] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] operator[/] Other[2] , identifier[bounds] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[/] Other[2] operator[SEP] operator[SEP] identifier[mapWidget] operator[SEP] identifier[getMapModel] operator[SEP] operator[SEP] operator[SEP] identifier[getMapView] operator[SEP] operator[SEP] operator[SEP] identifier[applyBounds] operator[SEP] identifier[newBounds] , identifier[ZoomOption] operator[SEP] identifier[LEVEL_CHANGE] operator[SEP] operator[SEP]
}
}
|
private CloseableReference<Bitmap> createBitmap(
int width,
int height,
Bitmap.Config config,
boolean hasAlpha,
@Nullable Object callerContext) {
return createBitmap(null, width, height, config, hasAlpha, callerContext);
}
|
class class_name[name] begin[{]
method[createBitmap, return_type[type[CloseableReference]], modifier[private], parameter[width, height, config, hasAlpha, callerContext]] begin[{]
return[call[.createBitmap, parameter[literal[null], member[.width], member[.height], member[.config], member[.hasAlpha], member[.callerContext]]]]
end[}]
END[}]
|
Keyword[private] identifier[CloseableReference] operator[<] identifier[Bitmap] operator[>] identifier[createBitmap] operator[SEP] Keyword[int] identifier[width] , Keyword[int] identifier[height] , identifier[Bitmap] operator[SEP] identifier[Config] identifier[config] , Keyword[boolean] identifier[hasAlpha] , annotation[@] identifier[Nullable] identifier[Object] identifier[callerContext] operator[SEP] {
Keyword[return] identifier[createBitmap] operator[SEP] Other[null] , identifier[width] , identifier[height] , identifier[config] , identifier[hasAlpha] , identifier[callerContext] operator[SEP] operator[SEP]
}
|
public static BoxLegalHoldAssignment.Info create(BoxAPIConnection api,
String policyID, String resourceType, String resourceID) {
URL url = ASSIGNMENTS_URL_TEMPLATE.build(api.getBaseURL());
BoxJSONRequest request = new BoxJSONRequest(api, url, "POST");
JsonObject requestJSON = new JsonObject()
.add("policy_id", policyID)
.add("assign_to", new JsonObject()
.add("type", resourceType)
.add("id", resourceID));
request.setBody(requestJSON.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
BoxLegalHoldAssignment createdAssignment = new BoxLegalHoldAssignment(api, responseJSON.get("id").asString());
return createdAssignment.new Info(responseJSON);
}
|
class class_name[name] begin[{]
method[create, return_type[type[BoxLegalHoldAssignment]], modifier[public static], parameter[api, policyID, resourceType, resourceID]] begin[{]
local_variable[type[URL], url]
local_variable[type[BoxJSONRequest], request]
local_variable[type[JsonObject], requestJSON]
call[request.setBody, parameter[call[requestJSON.toString, parameter[]]]]
local_variable[type[BoxJSONResponse], response]
local_variable[type[JsonObject], responseJSON]
local_variable[type[BoxLegalHoldAssignment], createdAssignment]
return[InnerClassCreator(arguments=[MemberReference(member=responseJSON, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=createdAssignment, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Info, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[BoxLegalHoldAssignment] operator[SEP] identifier[Info] identifier[create] operator[SEP] identifier[BoxAPIConnection] identifier[api] , identifier[String] identifier[policyID] , identifier[String] identifier[resourceType] , identifier[String] identifier[resourceID] operator[SEP] {
identifier[URL] identifier[url] operator[=] identifier[ASSIGNMENTS_URL_TEMPLATE] operator[SEP] identifier[build] operator[SEP] identifier[api] operator[SEP] identifier[getBaseURL] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[BoxJSONRequest] identifier[request] operator[=] Keyword[new] identifier[BoxJSONRequest] operator[SEP] identifier[api] , identifier[url] , literal[String] operator[SEP] operator[SEP] identifier[JsonObject] identifier[requestJSON] operator[=] Keyword[new] identifier[JsonObject] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[policyID] operator[SEP] operator[SEP] identifier[add] operator[SEP] literal[String] , Keyword[new] identifier[JsonObject] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[resourceType] operator[SEP] operator[SEP] identifier[add] operator[SEP] literal[String] , identifier[resourceID] operator[SEP] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setBody] operator[SEP] identifier[requestJSON] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[BoxJSONResponse] identifier[response] operator[=] operator[SEP] identifier[BoxJSONResponse] operator[SEP] identifier[request] operator[SEP] identifier[send] operator[SEP] operator[SEP] operator[SEP] identifier[JsonObject] identifier[responseJSON] operator[=] identifier[JsonObject] operator[SEP] identifier[readFrom] operator[SEP] identifier[response] operator[SEP] identifier[getJSON] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[BoxLegalHoldAssignment] identifier[createdAssignment] operator[=] Keyword[new] identifier[BoxLegalHoldAssignment] operator[SEP] identifier[api] , identifier[responseJSON] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[asString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[createdAssignment] operator[SEP] Keyword[new] identifier[Info] operator[SEP] identifier[responseJSON] operator[SEP] operator[SEP]
}
|
private void publishEvent(WSJobInstance objectToPublish, String eventToPublish) {
if (getBatchEventsPublisher() != null) {
getBatchEventsPublisher().publishJobInstanceEvent(objectToPublish, eventToPublish, correlationId);
}
}
|
class class_name[name] begin[{]
method[publishEvent, return_type[void], modifier[private], parameter[objectToPublish, eventToPublish]] begin[{]
if[binary_operation[call[.getBatchEventsPublisher, parameter[]], !=, literal[null]]] begin[{]
call[.getBatchEventsPublisher, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[publishEvent] operator[SEP] identifier[WSJobInstance] identifier[objectToPublish] , identifier[String] identifier[eventToPublish] operator[SEP] {
Keyword[if] operator[SEP] identifier[getBatchEventsPublisher] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[getBatchEventsPublisher] operator[SEP] operator[SEP] operator[SEP] identifier[publishJobInstanceEvent] operator[SEP] identifier[objectToPublish] , identifier[eventToPublish] , identifier[correlationId] operator[SEP] operator[SEP]
}
}
|
public Object eval(String source, int lineNo, int columnNo, Object script) throws BSFException {
try {
Class scriptClass = evalScripts.get(script);
if (scriptClass == null) {
scriptClass = loader.parseClass(script.toString(), source);
evalScripts.put(script, scriptClass);
} else {
LOG.fine("eval() - Using cached script...");
}
//can't cache the script because the context may be different.
//but don't bother loading parsing the class again
Script s = InvokerHelper.createScript(scriptClass, context);
return s.run();
} catch (Exception e) {
throw new BSFException(BSFException.REASON_EXECUTION_ERROR, "exception from Groovy: " + e, e);
}
}
|
class class_name[name] begin[{]
method[eval, return_type[type[Object]], modifier[public], parameter[source, lineNo, columnNo, script]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=script, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=evalScripts, selectors=[], type_arguments=None), name=scriptClass)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Class, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=scriptClass, 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=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="eval() - Using cached script...")], member=fine, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=scriptClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=script, selectors=[], type_arguments=None), MemberReference(member=source, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseClass, postfix_operators=[], prefix_operators=[], qualifier=loader, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=script, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scriptClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=evalScripts, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=scriptClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createScript, postfix_operators=[], prefix_operators=[], qualifier=InvokerHelper, selectors=[], type_arguments=None), name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Script, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[], member=run, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=REASON_EXECUTION_ERROR, postfix_operators=[], prefix_operators=[], qualifier=BSFException, selectors=[]), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="exception from Groovy: "), operandr=MemberReference(member=e, 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=BSFException, 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] identifier[Object] identifier[eval] operator[SEP] identifier[String] identifier[source] , Keyword[int] identifier[lineNo] , Keyword[int] identifier[columnNo] , identifier[Object] identifier[script] operator[SEP] Keyword[throws] identifier[BSFException] {
Keyword[try] {
identifier[Class] identifier[scriptClass] operator[=] identifier[evalScripts] operator[SEP] identifier[get] operator[SEP] identifier[script] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[scriptClass] operator[==] Other[null] operator[SEP] {
identifier[scriptClass] operator[=] identifier[loader] operator[SEP] identifier[parseClass] operator[SEP] identifier[script] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[source] operator[SEP] operator[SEP] identifier[evalScripts] operator[SEP] identifier[put] operator[SEP] identifier[script] , identifier[scriptClass] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[LOG] operator[SEP] identifier[fine] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Script] identifier[s] operator[=] identifier[InvokerHelper] operator[SEP] identifier[createScript] operator[SEP] identifier[scriptClass] , identifier[context] operator[SEP] operator[SEP] Keyword[return] identifier[s] operator[SEP] identifier[run] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[BSFException] operator[SEP] identifier[BSFException] operator[SEP] identifier[REASON_EXECUTION_ERROR] , literal[String] operator[+] identifier[e] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void write(Writer out) throws IOException
{
//logger.debug("writing feature index");
PrintWriter pw = new PrintWriter(out);
Iterator it = map.entrySet().iterator();
//logger.debug("index size " + map.entrySet().size());
while (it.hasNext())
{
Map.Entry me = (Map.Entry) it.next();
// feature index
pw.println(me.getValue() + "\t" + me.getKey());
}
pw.flush();
pw.close();
}
|
class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[out]] begin[{]
local_variable[type[PrintWriter], pw]
local_variable[type[Iterator], it]
while[call[it.hasNext, parameter[]]] begin[{]
local_variable[type[Map], me]
call[pw.println, parameter[binary_operation[binary_operation[call[me.getValue, parameter[]], +, literal["\t"]], +, call[me.getKey, parameter[]]]]]
end[}]
call[pw.flush, parameter[]]
call[pw.close, parameter[]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[write] operator[SEP] identifier[Writer] identifier[out] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[PrintWriter] identifier[pw] operator[=] Keyword[new] identifier[PrintWriter] operator[SEP] identifier[out] operator[SEP] operator[SEP] identifier[Iterator] identifier[it] operator[=] identifier[map] operator[SEP] identifier[entrySet] 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[Map] operator[SEP] identifier[Entry] identifier[me] operator[=] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[pw] operator[SEP] identifier[println] operator[SEP] identifier[me] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[me] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[pw] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] identifier[pw] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
|
protected Command buildCommand(Config cmdConfig, Command currentParent, Command finalChild) {
Preconditions.checkNotNull(cmdConfig);
Preconditions.checkNotNull(currentParent);
Preconditions.checkNotNull(finalChild);
Set<Map.Entry<String, Object>> entries = cmdConfig.root().unwrapped().entrySet();
if (entries.size() != 1) {
throw new MorphlineCompilationException("Illegal number of entries: " + entries.size(), cmdConfig);
}
Map.Entry<String, Object> entry = entries.iterator().next();
String cmdName = entry.getKey();
Class cmdClass;
LOG.trace("Building command: {}", cmdName);
if (!cmdName.contains(".") && !cmdName.contains("/")) {
cmdClass = getContext().getCommandBuilder(cmdName);
if (cmdClass == null) {
throw new MorphlineCompilationException("No command builder registered for name: " + cmdName, cmdConfig);
}
} else {
String className = cmdName.replace('/', '.');
try {
cmdClass = Class.forName(className);
} catch (ClassNotFoundException e) {
throw new MorphlineCompilationException("Cannot find command class: " + className, cmdConfig, e);
}
}
Object obj;
try {
obj = cmdClass.newInstance();
} catch (Exception e) {
throw new MorphlineCompilationException("Cannot instantiate command class: " + cmdClass.getName(), cmdConfig, e);
}
if (!(obj instanceof CommandBuilder)) {
throw new MorphlineCompilationException("Type of command " + cmdName + " must be an instance of "
+ CommandBuilder.class.getName() + " but is: " + cmdClass.getName(), cmdConfig);
}
CommandBuilder builder = (CommandBuilder) obj;
Command cmd = builder.build(cmdConfig.getConfig(cmdName), currentParent, finalChild, getContext());
return cmd;
}
|
class class_name[name] begin[{]
method[buildCommand, return_type[type[Command]], modifier[protected], parameter[cmdConfig, currentParent, finalChild]] begin[{]
call[Preconditions.checkNotNull, parameter[member[.cmdConfig]]]
call[Preconditions.checkNotNull, parameter[member[.currentParent]]]
call[Preconditions.checkNotNull, parameter[member[.finalChild]]]
local_variable[type[Set], entries]
if[binary_operation[call[entries.size, parameter[]], !=, literal[1]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Illegal number of entries: "), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=entries, selectors=[], type_arguments=None), operator=+), MemberReference(member=cmdConfig, 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=MorphlineCompilationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Map], entry]
local_variable[type[String], cmdName]
local_variable[type[Class], cmdClass]
call[LOG.trace, parameter[literal["Building command: {}"], member[.cmdName]]]
if[binary_operation[call[cmdName.contains, parameter[literal["."]]], &&, call[cmdName.contains, parameter[literal["/"]]]]] begin[{]
assign[member[.cmdClass], call[.getContext, parameter[]]]
if[binary_operation[member[.cmdClass], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No command builder registered for name: "), operandr=MemberReference(member=cmdName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=cmdConfig, 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=MorphlineCompilationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
local_variable[type[String], className]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=cmdClass, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forName, postfix_operators=[], prefix_operators=[], qualifier=Class, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot find command class: "), operandr=MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=cmdConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=MorphlineCompilationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassNotFoundException']))], finally_block=None, label=None, resources=None)
end[}]
local_variable[type[Object], obj]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=obj, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=cmdClass, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot instantiate command class: "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=cmdClass, selectors=[], type_arguments=None), operator=+), MemberReference(member=cmdConfig, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=MorphlineCompilationException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[.obj], instanceof, type[CommandBuilder]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Type of command "), operandr=MemberReference(member=cmdName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" must be an instance of "), operator=+), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=CommandBuilder, sub_type=None)), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" but is: "), operator=+), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=cmdClass, selectors=[], type_arguments=None), operator=+), MemberReference(member=cmdConfig, 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=MorphlineCompilationException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[CommandBuilder], builder]
local_variable[type[Command], cmd]
return[member[.cmd]]
end[}]
END[}]
|
Keyword[protected] identifier[Command] identifier[buildCommand] operator[SEP] identifier[Config] identifier[cmdConfig] , identifier[Command] identifier[currentParent] , identifier[Command] identifier[finalChild] operator[SEP] {
identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[cmdConfig] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[currentParent] operator[SEP] operator[SEP] identifier[Preconditions] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[finalChild] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[entries] operator[=] identifier[cmdConfig] operator[SEP] identifier[root] operator[SEP] operator[SEP] operator[SEP] identifier[unwrapped] operator[SEP] operator[SEP] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entries] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[!=] Other[1] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MorphlineCompilationException] operator[SEP] literal[String] operator[+] identifier[entries] operator[SEP] identifier[size] operator[SEP] operator[SEP] , identifier[cmdConfig] operator[SEP] operator[SEP]
}
identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[Object] operator[>] identifier[entry] operator[=] identifier[entries] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[cmdName] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[Class] identifier[cmdClass] operator[SEP] identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[cmdName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[cmdName] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[&&] operator[!] identifier[cmdName] operator[SEP] identifier[contains] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[cmdClass] operator[=] identifier[getContext] operator[SEP] operator[SEP] operator[SEP] identifier[getCommandBuilder] operator[SEP] identifier[cmdName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmdClass] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MorphlineCompilationException] operator[SEP] literal[String] operator[+] identifier[cmdName] , identifier[cmdConfig] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[String] identifier[className] operator[=] identifier[cmdName] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[cmdClass] operator[=] identifier[Class] operator[SEP] identifier[forName] operator[SEP] identifier[className] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassNotFoundException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MorphlineCompilationException] operator[SEP] literal[String] operator[+] identifier[className] , identifier[cmdConfig] , identifier[e] operator[SEP] operator[SEP]
}
}
identifier[Object] identifier[obj] operator[SEP] Keyword[try] {
identifier[obj] operator[=] identifier[cmdClass] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MorphlineCompilationException] operator[SEP] literal[String] operator[+] identifier[cmdClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[cmdConfig] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[obj] Keyword[instanceof] identifier[CommandBuilder] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MorphlineCompilationException] operator[SEP] literal[String] operator[+] identifier[cmdName] operator[+] literal[String] operator[+] identifier[CommandBuilder] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[cmdClass] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[cmdConfig] operator[SEP] operator[SEP]
}
identifier[CommandBuilder] identifier[builder] operator[=] operator[SEP] identifier[CommandBuilder] operator[SEP] identifier[obj] operator[SEP] identifier[Command] identifier[cmd] operator[=] identifier[builder] operator[SEP] identifier[build] operator[SEP] identifier[cmdConfig] operator[SEP] identifier[getConfig] operator[SEP] identifier[cmdName] operator[SEP] , identifier[currentParent] , identifier[finalChild] , identifier[getContext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[cmd] operator[SEP]
}
|
@VisibleForTesting
static String makeTargetStringForDirectAddress(SocketAddress address) {
try {
return new URI(DIRECT_ADDRESS_SCHEME, "", "/" + address, null).toString();
} catch (URISyntaxException e) {
// It should not happen.
throw new RuntimeException(e);
}
}
|
class class_name[name] begin[{]
method[makeTargetStringForDirectAddress, return_type[type[String]], modifier[static], parameter[address]] begin[{]
TryStatement(block=[ReturnStatement(expression=ClassCreator(arguments=[MemberReference(member=DIRECT_ADDRESS_SCHEME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/"), operandr=MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=URI, sub_type=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=['URISyntaxException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
annotation[@] identifier[VisibleForTesting] Keyword[static] identifier[String] identifier[makeTargetStringForDirectAddress] operator[SEP] identifier[SocketAddress] identifier[address] operator[SEP] {
Keyword[try] {
Keyword[return] Keyword[new] identifier[URI] operator[SEP] identifier[DIRECT_ADDRESS_SCHEME] , literal[String] , literal[String] operator[+] identifier[address] , Other[null] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[URISyntaxException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
public static String getContent(String stringUrl) throws IOException {
InputStream stream = getContentStream(stringUrl);
return MyStreamUtils.readContent(stream);
}
|
class class_name[name] begin[{]
method[getContent, return_type[type[String]], modifier[public static], parameter[stringUrl]] begin[{]
local_variable[type[InputStream], stream]
return[call[MyStreamUtils.readContent, parameter[member[.stream]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getContent] operator[SEP] identifier[String] identifier[stringUrl] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[InputStream] identifier[stream] operator[=] identifier[getContentStream] operator[SEP] identifier[stringUrl] operator[SEP] operator[SEP] Keyword[return] identifier[MyStreamUtils] operator[SEP] identifier[readContent] operator[SEP] identifier[stream] operator[SEP] operator[SEP]
}
|
public static String join(Path path1, Path path2) {
if (path2.toString().isEmpty()) {
return "";
}
if (!path1.isAbsolute()) {
path1 = Paths.get(".", path1.toString());
}
if (!path2.isAbsolute()) {
path2 = Paths.get(".", path2.toString());
}
Path result = path1.resolve(path2).normalize();
if (!result.isAbsolute()) {
result = Paths.get(".", result.toString());
}
return result.toString();
}
|
class class_name[name] begin[{]
method[join, return_type[type[String]], modifier[public static], parameter[path1, path2]] begin[{]
if[call[path2.toString, parameter[]]] begin[{]
return[literal[""]]
else begin[{]
None
end[}]
if[call[path1.isAbsolute, parameter[]]] begin[{]
assign[member[.path1], call[Paths.get, parameter[literal["."], call[path1.toString, parameter[]]]]]
else begin[{]
None
end[}]
if[call[path2.isAbsolute, parameter[]]] begin[{]
assign[member[.path2], call[Paths.get, parameter[literal["."], call[path2.toString, parameter[]]]]]
else begin[{]
None
end[}]
local_variable[type[Path], result]
if[call[result.isAbsolute, parameter[]]] begin[{]
assign[member[.result], call[Paths.get, parameter[literal["."], call[result.toString, parameter[]]]]]
else begin[{]
None
end[}]
return[call[result.toString, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[join] operator[SEP] identifier[Path] identifier[path1] , identifier[Path] identifier[path2] operator[SEP] {
Keyword[if] operator[SEP] identifier[path2] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[path1] operator[SEP] identifier[isAbsolute] operator[SEP] operator[SEP] operator[SEP] {
identifier[path1] operator[=] identifier[Paths] operator[SEP] identifier[get] operator[SEP] literal[String] , identifier[path1] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[path2] operator[SEP] identifier[isAbsolute] operator[SEP] operator[SEP] operator[SEP] {
identifier[path2] operator[=] identifier[Paths] operator[SEP] identifier[get] operator[SEP] literal[String] , identifier[path2] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Path] identifier[result] operator[=] identifier[path1] operator[SEP] identifier[resolve] operator[SEP] identifier[path2] operator[SEP] operator[SEP] identifier[normalize] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[result] operator[SEP] identifier[isAbsolute] operator[SEP] operator[SEP] operator[SEP] {
identifier[result] operator[=] identifier[Paths] operator[SEP] identifier[get] operator[SEP] literal[String] , identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private State updateStateWithBackOff(final long timeoutInNanos) {
AtomicRateLimiter.State prev;
AtomicRateLimiter.State next;
do {
prev = state.get();
next = calculateNextState(timeoutInNanos, prev);
} while (!compareAndSet(prev, next));
return next;
}
|
class class_name[name] begin[{]
method[updateStateWithBackOff, return_type[type[State]], modifier[private], parameter[timeoutInNanos]] begin[{]
local_variable[type[AtomicRateLimiter], prev]
local_variable[type[AtomicRateLimiter], next]
do[call[.compareAndSet, parameter[member[.prev], member[.next]]]] begin[{]
assign[member[.prev], call[state.get, parameter[]]]
assign[member[.next], call[.calculateNextState, parameter[member[.timeoutInNanos], member[.prev]]]]
end[}]
return[member[.next]]
end[}]
END[}]
|
Keyword[private] identifier[State] identifier[updateStateWithBackOff] operator[SEP] Keyword[final] Keyword[long] identifier[timeoutInNanos] operator[SEP] {
identifier[AtomicRateLimiter] operator[SEP] identifier[State] identifier[prev] operator[SEP] identifier[AtomicRateLimiter] operator[SEP] identifier[State] identifier[next] operator[SEP] Keyword[do] {
identifier[prev] operator[=] identifier[state] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] identifier[next] operator[=] identifier[calculateNextState] operator[SEP] identifier[timeoutInNanos] , identifier[prev] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] operator[!] identifier[compareAndSet] operator[SEP] identifier[prev] , identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[next] operator[SEP]
}
|
public UNode toGroupedDoc(TableDefinition tableDef) {
Utils.require(tableDef != null, "tableDef");
UNode resultNode = UNode.createMapNode("doc");
Set<FieldDefinition> deferredFields = new HashSet<FieldDefinition>();
for (String fieldName : getUpdatedFieldNames()) {
FieldDefinition fieldDef = tableDef.getFieldDef(fieldName);
if (fieldDef != null && fieldDef.isNestedField()) {
FieldDefinition groupFieldDef = fieldDef.getParentField();
while (groupFieldDef != null && !deferredFields.contains(groupFieldDef)) {
deferredFields.add(groupFieldDef);
groupFieldDef = groupFieldDef.getParentField();
}
deferredFields.add(fieldDef);
} else {
leafFieldtoDoc(resultNode, fieldName);
}
}
for (FieldDefinition fieldDef : deferredFields) {
if (!fieldDef.isNestedField()) {
groupFieldtoDoc(resultNode, fieldDef, deferredFields);
}
}
return resultNode;
}
|
class class_name[name] begin[{]
method[toGroupedDoc, return_type[type[UNode]], modifier[public], parameter[tableDef]] begin[{]
call[Utils.require, parameter[binary_operation[member[.tableDef], !=, literal[null]], literal["tableDef"]]]
local_variable[type[UNode], resultNode]
local_variable[type[Set], deferredFields]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFieldDef, postfix_operators=[], prefix_operators=[], qualifier=tableDef, selectors=[], type_arguments=None), name=fieldDef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldDefinition, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=fieldDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isNestedField, postfix_operators=[], prefix_operators=[], qualifier=fieldDef, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=resultNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fieldName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=leafFieldtoDoc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getParentField, postfix_operators=[], prefix_operators=[], qualifier=fieldDef, selectors=[], type_arguments=None), name=groupFieldDef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldDefinition, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=groupFieldDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=deferredFields, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=groupFieldDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getParentField, postfix_operators=[], prefix_operators=[], qualifier=groupFieldDef, selectors=[], type_arguments=None)), label=None)]), condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=groupFieldDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=groupFieldDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=['!'], qualifier=deferredFields, selectors=[], type_arguments=None), operator=&&), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=fieldDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=deferredFields, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getUpdatedFieldNames, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=isNestedField, postfix_operators=[], prefix_operators=['!'], qualifier=fieldDef, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=resultNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fieldDef, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=deferredFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=groupFieldtoDoc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=deferredFields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=fieldDef)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldDefinition, sub_type=None))), label=None)
return[member[.resultNode]]
end[}]
END[}]
|
Keyword[public] identifier[UNode] identifier[toGroupedDoc] operator[SEP] identifier[TableDefinition] identifier[tableDef] operator[SEP] {
identifier[Utils] operator[SEP] identifier[require] operator[SEP] identifier[tableDef] operator[!=] Other[null] , literal[String] operator[SEP] operator[SEP] identifier[UNode] identifier[resultNode] operator[=] identifier[UNode] operator[SEP] identifier[createMapNode] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[FieldDefinition] operator[>] identifier[deferredFields] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[FieldDefinition] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[fieldName] operator[:] identifier[getUpdatedFieldNames] operator[SEP] operator[SEP] operator[SEP] {
identifier[FieldDefinition] identifier[fieldDef] operator[=] identifier[tableDef] operator[SEP] identifier[getFieldDef] operator[SEP] identifier[fieldName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[fieldDef] operator[!=] Other[null] operator[&&] identifier[fieldDef] operator[SEP] identifier[isNestedField] operator[SEP] operator[SEP] operator[SEP] {
identifier[FieldDefinition] identifier[groupFieldDef] operator[=] identifier[fieldDef] operator[SEP] identifier[getParentField] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[groupFieldDef] operator[!=] Other[null] operator[&&] operator[!] identifier[deferredFields] operator[SEP] identifier[contains] operator[SEP] identifier[groupFieldDef] operator[SEP] operator[SEP] {
identifier[deferredFields] operator[SEP] identifier[add] operator[SEP] identifier[groupFieldDef] operator[SEP] operator[SEP] identifier[groupFieldDef] operator[=] identifier[groupFieldDef] operator[SEP] identifier[getParentField] operator[SEP] operator[SEP] operator[SEP]
}
identifier[deferredFields] operator[SEP] identifier[add] operator[SEP] identifier[fieldDef] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[leafFieldtoDoc] operator[SEP] identifier[resultNode] , identifier[fieldName] operator[SEP] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[FieldDefinition] identifier[fieldDef] operator[:] identifier[deferredFields] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[fieldDef] operator[SEP] identifier[isNestedField] operator[SEP] operator[SEP] operator[SEP] {
identifier[groupFieldtoDoc] operator[SEP] identifier[resultNode] , identifier[fieldDef] , identifier[deferredFields] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[resultNode] operator[SEP]
}
|
public static void closeAll(Logger log, java.io.Closeable... closeables) {
for (java.io.Closeable c : closeables) {
if (c != null) {
try {
if (log != null) {
log.debug("Closing {}", c);
}
c.close();
} catch (Exception e) {
if (log != null && log.isDebugEnabled()) {
log.debug("Exception in closing {}", c, e);
}
}
}
}
}
|
class class_name[name] begin[{]
method[closeAll, return_type[void], modifier[public static], parameter[log, closeables]] begin[{]
ForStatement(body=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=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=log, 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=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Closing {}"), MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=log, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=isDebugEnabled, postfix_operators=[], prefix_operators=[], qualifier=log, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception in closing {}"), MemberReference(member=c, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=debug, 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)]))]), control=EnhancedForControl(iterable=MemberReference(member=closeables, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=c)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=java, sub_type=ReferenceType(arguments=None, dimensions=None, name=io, sub_type=ReferenceType(arguments=None, dimensions=None, name=Closeable, sub_type=None))))), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[closeAll] operator[SEP] identifier[Logger] identifier[log] , identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[Closeable] operator[...] identifier[closeables] operator[SEP] {
Keyword[for] operator[SEP] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[Closeable] identifier[c] operator[:] identifier[closeables] operator[SEP] {
Keyword[if] operator[SEP] identifier[c] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[log] operator[!=] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[c] operator[SEP] operator[SEP]
}
identifier[c] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[log] operator[!=] Other[null] operator[&&] identifier[log] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[log] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[c] , identifier[e] operator[SEP] operator[SEP]
}
}
}
}
}
|
@NonNull
public static Drop dropMaterializedView(@NonNull String viewName) {
return dropMaterializedView(CqlIdentifier.fromCql(viewName));
}
|
class class_name[name] begin[{]
method[dropMaterializedView, return_type[type[Drop]], modifier[public static], parameter[viewName]] begin[{]
return[call[.dropMaterializedView, parameter[call[CqlIdentifier.fromCql, parameter[member[.viewName]]]]]]
end[}]
END[}]
|
annotation[@] identifier[NonNull] Keyword[public] Keyword[static] identifier[Drop] identifier[dropMaterializedView] operator[SEP] annotation[@] identifier[NonNull] identifier[String] identifier[viewName] operator[SEP] {
Keyword[return] identifier[dropMaterializedView] operator[SEP] identifier[CqlIdentifier] operator[SEP] identifier[fromCql] operator[SEP] identifier[viewName] operator[SEP] operator[SEP] operator[SEP]
}
|
private void attemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode){
//Increment the split ID
this.splitId++;
//Schedule time-out thread
ScheduledFuture<?> timeOutHandler = this.executor.schedule(new AggregationTimeOutHandler(this.splitId, this.timedOutSplittingNodes),
this.timeOut, TimeUnit.SECONDS);
//Keep track of the splitting node information, so that we can continue the split
//once we receive all local statistic calculation from Local Statistic PI
//this.splittingNodes.put(Long.valueOf(this.splitId), new SplittingNodeInfo(activeLearningNode, foundNode, null));
this.splittingNodes.put(this.splitId, new SplittingNodeInfo(activeLearningNode, foundNode, timeOutHandler));
//Inform Local Statistic PI to perform local statistic calculation
activeLearningNode.requestDistributedSuggestions(this.splitId, this);
}
|
class class_name[name] begin[{]
method[attemptToSplit, return_type[void], modifier[private], parameter[activeLearningNode, foundNode]] begin[{]
THIS[member[None.splitId]]
local_variable[type[ScheduledFuture], timeOutHandler]
THIS[member[None.splittingNodes]call[None.put, parameter[THIS[member[None.splitId]], ClassCreator(arguments=[MemberReference(member=activeLearningNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=foundNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timeOutHandler, 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=SplittingNodeInfo, sub_type=None))]]]
call[activeLearningNode.requestDistributedSuggestions, parameter[THIS[member[None.splitId]], THIS[]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[attemptToSplit] operator[SEP] identifier[ActiveLearningNode] identifier[activeLearningNode] , identifier[FoundNode] identifier[foundNode] operator[SEP] {
Keyword[this] operator[SEP] identifier[splitId] operator[++] operator[SEP] identifier[ScheduledFuture] operator[<] operator[?] operator[>] identifier[timeOutHandler] operator[=] Keyword[this] operator[SEP] identifier[executor] operator[SEP] identifier[schedule] operator[SEP] Keyword[new] identifier[AggregationTimeOutHandler] operator[SEP] Keyword[this] operator[SEP] identifier[splitId] , Keyword[this] operator[SEP] identifier[timedOutSplittingNodes] operator[SEP] , Keyword[this] operator[SEP] identifier[timeOut] , identifier[TimeUnit] operator[SEP] identifier[SECONDS] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[splittingNodes] operator[SEP] identifier[put] operator[SEP] Keyword[this] operator[SEP] identifier[splitId] , Keyword[new] identifier[SplittingNodeInfo] operator[SEP] identifier[activeLearningNode] , identifier[foundNode] , identifier[timeOutHandler] operator[SEP] operator[SEP] operator[SEP] identifier[activeLearningNode] operator[SEP] identifier[requestDistributedSuggestions] operator[SEP] Keyword[this] operator[SEP] identifier[splitId] , Keyword[this] operator[SEP] operator[SEP]
}
|
Enumeration<String> getWarnings()
{
Vector<String> warnings = new Vector<String>();
Enumeration<String> warnEnum = mainSection.getWarnings();
while ( warnEnum.hasMoreElements() )
{
warnings.addElement( warnEnum.nextElement() );
}
return warnings.elements();
}
|
class class_name[name] begin[{]
method[getWarnings, return_type[type[Enumeration]], modifier[default], parameter[]] begin[{]
local_variable[type[Vector], warnings]
local_variable[type[Enumeration], warnEnum]
while[call[warnEnum.hasMoreElements, parameter[]]] begin[{]
call[warnings.addElement, parameter[call[warnEnum.nextElement, parameter[]]]]
end[}]
return[call[warnings.elements, parameter[]]]
end[}]
END[}]
|
identifier[Enumeration] operator[<] identifier[String] operator[>] identifier[getWarnings] operator[SEP] operator[SEP] {
identifier[Vector] operator[<] identifier[String] operator[>] identifier[warnings] operator[=] Keyword[new] identifier[Vector] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Enumeration] operator[<] identifier[String] operator[>] identifier[warnEnum] operator[=] identifier[mainSection] operator[SEP] identifier[getWarnings] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[warnEnum] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[warnings] operator[SEP] identifier[addElement] operator[SEP] identifier[warnEnum] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[warnings] operator[SEP] identifier[elements] operator[SEP] operator[SEP] operator[SEP]
}
|
public long[] readLongArray(final int items, final JBBPByteOrder byteOrder) throws IOException {
int pos = 0;
if (items < 0) {
long[] buffer = new long[INITIAL_ARRAY_BUFFER_SIZE];
// till end
while (hasAvailableData()) {
final long next = readLong(byteOrder);
if (buffer.length == pos) {
final long[] newbuffer = new long[buffer.length << 1];
System.arraycopy(buffer, 0, newbuffer, 0, buffer.length);
buffer = newbuffer;
}
buffer[pos++] = next;
}
if (buffer.length == pos) {
return buffer;
}
final long[] result = new long[pos];
System.arraycopy(buffer, 0, result, 0, pos);
return result;
} else {
// number
final long[] buffer = new long[items];
for (int i = 0; i < items; i++) {
buffer[i] = readLong(byteOrder);
}
return buffer;
}
}
|
class class_name[name] begin[{]
method[readLongArray, return_type[type[long]], modifier[public], parameter[items, byteOrder]] begin[{]
local_variable[type[int], pos]
if[binary_operation[member[.items], <, literal[0]]] begin[{]
local_variable[type[long], buffer]
while[call[.hasAvailableData, parameter[]]] begin[{]
local_variable[type[long], next]
if[binary_operation[member[buffer.length], ==, member[.pos]]] begin[{]
local_variable[type[long], newbuffer]
call[System.arraycopy, parameter[member[.buffer], literal[0], member[.newbuffer], literal[0], member[buffer.length]]]
assign[member[.buffer], member[.newbuffer]]
else begin[{]
None
end[}]
assign[member[.buffer], member[.next]]
end[}]
if[binary_operation[member[buffer.length], ==, member[.pos]]] begin[{]
return[member[.buffer]]
else begin[{]
None
end[}]
local_variable[type[long], result]
call[System.arraycopy, parameter[member[.buffer], literal[0], member[.result], literal[0], member[.pos]]]
return[member[.result]]
else begin[{]
local_variable[type[long], buffer]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[MemberReference(member=byteOrder, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readLong, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=items, 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[.buffer]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[long] operator[SEP] operator[SEP] identifier[readLongArray] operator[SEP] Keyword[final] Keyword[int] identifier[items] , Keyword[final] identifier[JBBPByteOrder] identifier[byteOrder] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[pos] operator[=] Other[0] operator[SEP] Keyword[if] operator[SEP] identifier[items] operator[<] Other[0] operator[SEP] {
Keyword[long] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[long] operator[SEP] identifier[INITIAL_ARRAY_BUFFER_SIZE] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[hasAvailableData] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] Keyword[long] identifier[next] operator[=] identifier[readLong] operator[SEP] identifier[byteOrder] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[buffer] operator[SEP] identifier[length] operator[==] identifier[pos] operator[SEP] {
Keyword[final] Keyword[long] operator[SEP] operator[SEP] identifier[newbuffer] operator[=] Keyword[new] Keyword[long] operator[SEP] identifier[buffer] operator[SEP] identifier[length] operator[<<] Other[1] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[buffer] , Other[0] , identifier[newbuffer] , Other[0] , identifier[buffer] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[buffer] operator[=] identifier[newbuffer] operator[SEP]
}
identifier[buffer] operator[SEP] identifier[pos] operator[++] operator[SEP] operator[=] identifier[next] operator[SEP]
}
Keyword[if] operator[SEP] identifier[buffer] operator[SEP] identifier[length] operator[==] identifier[pos] operator[SEP] {
Keyword[return] identifier[buffer] operator[SEP]
}
Keyword[final] Keyword[long] operator[SEP] operator[SEP] identifier[result] operator[=] Keyword[new] Keyword[long] operator[SEP] identifier[pos] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[buffer] , Other[0] , identifier[result] , Other[0] , identifier[pos] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP]
}
Keyword[else] {
Keyword[final] Keyword[long] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[long] operator[SEP] identifier[items] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[items] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[buffer] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[readLong] operator[SEP] identifier[byteOrder] operator[SEP] operator[SEP]
}
Keyword[return] identifier[buffer] operator[SEP]
}
}
|
public static int getInt(@NonNull final Context context, @AttrRes final int resourceId,
final int defaultValue) {
return getInt(context, -1, resourceId, defaultValue);
}
|
class class_name[name] begin[{]
method[getInt, return_type[type[int]], modifier[public static], parameter[context, resourceId, defaultValue]] begin[{]
return[call[.getInt, parameter[member[.context], literal[1], member[.resourceId], member[.defaultValue]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[getInt] operator[SEP] annotation[@] identifier[NonNull] Keyword[final] identifier[Context] identifier[context] , annotation[@] identifier[AttrRes] Keyword[final] Keyword[int] identifier[resourceId] , Keyword[final] Keyword[int] identifier[defaultValue] operator[SEP] {
Keyword[return] identifier[getInt] operator[SEP] identifier[context] , operator[-] Other[1] , identifier[resourceId] , identifier[defaultValue] operator[SEP] operator[SEP]
}
|
public static String getJsonFriendlyString(String value) {
if (!"null".equals(value) && JSONUtils.mayBeJSON(value)) {
return "'" + value + "'";
}
return value;
}
|
class class_name[name] begin[{]
method[getJsonFriendlyString, return_type[type[String]], modifier[public static], parameter[value]] begin[{]
if[binary_operation[literal["null"], &&, call[JSONUtils.mayBeJSON, parameter[member[.value]]]]] begin[{]
return[binary_operation[binary_operation[literal["'"], +, member[.value]], +, literal["'"]]]
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getJsonFriendlyString] operator[SEP] identifier[String] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] operator[!] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[value] operator[SEP] operator[&&] identifier[JSONUtils] operator[SEP] identifier[mayBeJSON] operator[SEP] identifier[value] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[+] identifier[value] operator[+] literal[String] operator[SEP]
}
Keyword[return] identifier[value] operator[SEP]
}
|
public void write(ByteCodeWriter out)
throws IOException
{
out.writeUTF8Const(getName());
out.writeInt(_value.length);
out.write(_value, 0, _value.length);
}
|
class class_name[name] begin[{]
method[write, return_type[void], modifier[public], parameter[out]] begin[{]
call[out.writeUTF8Const, parameter[call[.getName, parameter[]]]]
call[out.writeInt, parameter[member[_value.length]]]
call[out.write, parameter[member[._value], literal[0], member[_value.length]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[write] operator[SEP] identifier[ByteCodeWriter] identifier[out] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[out] operator[SEP] identifier[writeUTF8Const] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[writeInt] operator[SEP] identifier[_value] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[out] operator[SEP] identifier[write] operator[SEP] identifier[_value] , Other[0] , identifier[_value] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
|
public static Set<String> getContributors(Set<String> baseContributors, ProbeTest methodAnnotation, ProbeTestClass classAnnotation) {
Set<String> contributors;
if (baseContributors == null) {
contributors = new HashSet<>();
}
else {
contributors = populateContributors(baseContributors, new HashSet<String>());
}
if (classAnnotation != null && classAnnotation.contributors() != null) {
contributors = populateContributors(new HashSet<>(Arrays.asList(classAnnotation.contributors())), contributors);
}
if (methodAnnotation != null && methodAnnotation.contributors() != null) {
contributors = populateContributors(new HashSet<>(Arrays.asList(methodAnnotation.contributors())), contributors);
}
return contributors;
}
|
class class_name[name] begin[{]
method[getContributors, return_type[type[Set]], modifier[public static], parameter[baseContributors, methodAnnotation, classAnnotation]] begin[{]
local_variable[type[Set], contributors]
if[binary_operation[member[.baseContributors], ==, literal[null]]] begin[{]
assign[member[.contributors], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashSet, sub_type=None))]
else begin[{]
assign[member[.contributors], call[.populateContributors, parameter[member[.baseContributors], 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=String, sub_type=None))], dimensions=None, name=HashSet, sub_type=None))]]]
end[}]
if[binary_operation[binary_operation[member[.classAnnotation], !=, literal[null]], &&, binary_operation[call[classAnnotation.contributors, parameter[]], !=, literal[null]]]] begin[{]
assign[member[.contributors], call[.populateContributors, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=contributors, postfix_operators=[], prefix_operators=[], qualifier=classAnnotation, selectors=[], type_arguments=None)], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashSet, sub_type=None)), member[.contributors]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.methodAnnotation], !=, literal[null]], &&, binary_operation[call[methodAnnotation.contributors, parameter[]], !=, literal[null]]]] begin[{]
assign[member[.contributors], call[.populateContributors, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=contributors, postfix_operators=[], prefix_operators=[], qualifier=methodAnnotation, selectors=[], type_arguments=None)], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashSet, sub_type=None)), member[.contributors]]]]
else begin[{]
None
end[}]
return[member[.contributors]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Set] operator[<] identifier[String] operator[>] identifier[getContributors] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[baseContributors] , identifier[ProbeTest] identifier[methodAnnotation] , identifier[ProbeTestClass] identifier[classAnnotation] operator[SEP] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[contributors] operator[SEP] Keyword[if] operator[SEP] identifier[baseContributors] operator[==] Other[null] operator[SEP] {
identifier[contributors] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[contributors] operator[=] identifier[populateContributors] operator[SEP] identifier[baseContributors] , Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[classAnnotation] operator[!=] Other[null] operator[&&] identifier[classAnnotation] operator[SEP] identifier[contributors] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[contributors] operator[=] identifier[populateContributors] operator[SEP] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[classAnnotation] operator[SEP] identifier[contributors] operator[SEP] operator[SEP] operator[SEP] operator[SEP] , identifier[contributors] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[methodAnnotation] operator[!=] Other[null] operator[&&] identifier[methodAnnotation] operator[SEP] identifier[contributors] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[contributors] operator[=] identifier[populateContributors] operator[SEP] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[methodAnnotation] operator[SEP] identifier[contributors] operator[SEP] operator[SEP] operator[SEP] operator[SEP] , identifier[contributors] operator[SEP] operator[SEP]
}
Keyword[return] identifier[contributors] operator[SEP]
}
|
private ResourcePaths.ResourcePath getPathInternal() {
String resolvedPath;
if (isPathAnnotationPresent()) {
Path path = this.annotations.get(Path.class);
if (isBlank(path.value())) {
throw new IllegalArgumentException("The value of the @" + Path.class.getSimpleName() +
" annotation on " + field + " must not be empty");
}
resolvedPath = path.value();
} else {
resolvedPath = field.getName();
}
return path(resolvedPath);
}
|
class class_name[name] begin[{]
method[getPathInternal, return_type[type[ResourcePaths]], modifier[private], parameter[]] begin[{]
local_variable[type[String], resolvedPath]
if[call[.isPathAnnotationPresent, parameter[]]] begin[{]
local_variable[type[Path], path]
if[call[.isBlank, parameter[call[path.value, parameter[]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The value of the @"), operandr=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getSimpleName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Path, sub_type=None)), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" annotation on "), operator=+), operandr=MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" must not be empty"), 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[}]
assign[member[.resolvedPath], call[path.value, parameter[]]]
else begin[{]
assign[member[.resolvedPath], call[field.getName, parameter[]]]
end[}]
return[call[.path, parameter[member[.resolvedPath]]]]
end[}]
END[}]
|
Keyword[private] identifier[ResourcePaths] operator[SEP] identifier[ResourcePath] identifier[getPathInternal] operator[SEP] operator[SEP] {
identifier[String] identifier[resolvedPath] operator[SEP] Keyword[if] operator[SEP] identifier[isPathAnnotationPresent] operator[SEP] operator[SEP] operator[SEP] {
identifier[Path] identifier[path] operator[=] Keyword[this] operator[SEP] identifier[annotations] operator[SEP] identifier[get] operator[SEP] identifier[Path] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[isBlank] operator[SEP] identifier[path] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] identifier[Path] operator[SEP] Keyword[class] operator[SEP] identifier[getSimpleName] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[field] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[resolvedPath] operator[=] identifier[path] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[resolvedPath] operator[=] identifier[field] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[path] operator[SEP] identifier[resolvedPath] operator[SEP] operator[SEP]
}
|
public Object getVal(long waitTime, TimeUnit timeUnit)
throws InterruptedException
{
if(latch.await(waitTime, timeUnit)){
return val;
}
else
{
return null;
}
}
|
class class_name[name] begin[{]
method[getVal, return_type[type[Object]], modifier[public], parameter[waitTime, timeUnit]] begin[{]
if[call[latch.await, parameter[member[.waitTime], member[.timeUnit]]]] begin[{]
return[member[.val]]
else begin[{]
return[literal[null]]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[Object] identifier[getVal] operator[SEP] Keyword[long] identifier[waitTime] , identifier[TimeUnit] identifier[timeUnit] operator[SEP] Keyword[throws] identifier[InterruptedException] {
Keyword[if] operator[SEP] identifier[latch] operator[SEP] identifier[await] operator[SEP] identifier[waitTime] , identifier[timeUnit] operator[SEP] operator[SEP] {
Keyword[return] identifier[val] operator[SEP]
}
Keyword[else] {
Keyword[return] Other[null] operator[SEP]
}
}
|
private boolean isAddToLoadBalancerSuspended(AutoScalingGroup asg) {
List<SuspendedProcess> suspendedProcesses = asg.getSuspendedProcesses();
for (SuspendedProcess process : suspendedProcesses) {
if (PROP_ADD_TO_LOAD_BALANCER.equals(process.getProcessName())) {
return true;
}
}
return false;
}
|
class class_name[name] begin[{]
method[isAddToLoadBalancerSuspended, return_type[type[boolean]], modifier[private], parameter[asg]] begin[{]
local_variable[type[List], suspendedProcesses]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getProcessName, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=[], qualifier=PROP_ADD_TO_LOAD_BALANCER, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=suspendedProcesses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=process)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=SuspendedProcess, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[isAddToLoadBalancerSuspended] operator[SEP] identifier[AutoScalingGroup] identifier[asg] operator[SEP] {
identifier[List] operator[<] identifier[SuspendedProcess] operator[>] identifier[suspendedProcesses] operator[=] identifier[asg] operator[SEP] identifier[getSuspendedProcesses] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[SuspendedProcess] identifier[process] operator[:] identifier[suspendedProcesses] operator[SEP] {
Keyword[if] operator[SEP] identifier[PROP_ADD_TO_LOAD_BALANCER] operator[SEP] identifier[equals] operator[SEP] identifier[process] operator[SEP] identifier[getProcessName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
final TreeMapEntry<K,V> getEntry(Object key) {
// Offload comparator-based version for sake of performance
if (comparator != null)
return getEntryUsingComparator(key);
if (key == null)
throw new NullPointerException();
@SuppressWarnings("unchecked")
Comparable<? super K> k = (Comparable<? super K>) key;
TreeMapEntry<K,V> p = root;
while (p != null) {
int cmp = k.compareTo(p.key);
if (cmp < 0)
p = p.left;
else if (cmp > 0)
p = p.right;
else
return p;
}
return null;
}
|
class class_name[name] begin[{]
method[getEntry, return_type[type[TreeMapEntry]], modifier[final], parameter[key]] begin[{]
if[binary_operation[member[.comparator], !=, literal[null]]] begin[{]
return[call[.getEntryUsingComparator, parameter[member[.key]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.key], ==, literal[null]]] 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=NullPointerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[Comparable], k]
local_variable[type[TreeMapEntry], p]
while[binary_operation[member[.p], !=, literal[null]]] begin[{]
local_variable[type[int], cmp]
if[binary_operation[member[.cmp], <, literal[0]]] begin[{]
assign[member[.p], member[p.left]]
else begin[{]
if[binary_operation[member[.cmp], >, literal[0]]] begin[{]
assign[member[.p], member[p.right]]
else begin[{]
return[member[.p]]
end[}]
end[}]
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[final] identifier[TreeMapEntry] operator[<] identifier[K] , identifier[V] operator[>] identifier[getEntry] operator[SEP] identifier[Object] identifier[key] operator[SEP] {
Keyword[if] operator[SEP] identifier[comparator] operator[!=] Other[null] operator[SEP] Keyword[return] identifier[getEntryUsingComparator] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[key] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[NullPointerException] operator[SEP] operator[SEP] operator[SEP] annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] identifier[Comparable] operator[<] operator[?] Keyword[super] identifier[K] operator[>] identifier[k] operator[=] operator[SEP] identifier[Comparable] operator[<] operator[?] Keyword[super] identifier[K] operator[>] operator[SEP] identifier[key] operator[SEP] identifier[TreeMapEntry] operator[<] identifier[K] , identifier[V] operator[>] identifier[p] operator[=] identifier[root] operator[SEP] Keyword[while] operator[SEP] identifier[p] operator[!=] Other[null] operator[SEP] {
Keyword[int] identifier[cmp] operator[=] identifier[k] operator[SEP] identifier[compareTo] operator[SEP] identifier[p] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cmp] operator[<] Other[0] operator[SEP] identifier[p] operator[=] identifier[p] operator[SEP] identifier[left] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[cmp] operator[>] Other[0] operator[SEP] identifier[p] operator[=] identifier[p] operator[SEP] identifier[right] operator[SEP] Keyword[else] Keyword[return] identifier[p] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
static public String getString(String msg, char arg)
{
return getString(msg, new Object[] { String.valueOf(arg) });
}
|
class class_name[name] begin[{]
method[getString, return_type[type[String]], modifier[public static], parameter[msg, arg]] begin[{]
return[call[.getString, parameter[member[.msg], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[MemberReference(member=arg, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]]
end[}]
END[}]
|
Keyword[static] Keyword[public] identifier[String] identifier[getString] operator[SEP] identifier[String] identifier[msg] , Keyword[char] identifier[arg] operator[SEP] {
Keyword[return] identifier[getString] operator[SEP] identifier[msg] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[arg] operator[SEP]
} operator[SEP] operator[SEP]
}
|
public static PeriodType yearDayTime() {
PeriodType type = cYDTime;
if (type == null) {
type = new PeriodType(
"YearDayTime",
new DurationFieldType[] {
DurationFieldType.years(), DurationFieldType.days(),
DurationFieldType.hours(), DurationFieldType.minutes(),
DurationFieldType.seconds(), DurationFieldType.millis(),
},
new int[] { 0, -1, -1, 1, 2, 3, 4, 5, }
);
cYDTime = type;
}
return type;
}
|
class class_name[name] begin[{]
method[yearDayTime, return_type[type[PeriodType]], modifier[public static], parameter[]] begin[{]
local_variable[type[PeriodType], type]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
assign[member[.type], ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="YearDayTime"), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=years, postfix_operators=[], prefix_operators=[], qualifier=DurationFieldType, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=days, postfix_operators=[], prefix_operators=[], qualifier=DurationFieldType, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=hours, postfix_operators=[], prefix_operators=[], qualifier=DurationFieldType, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=minutes, postfix_operators=[], prefix_operators=[], qualifier=DurationFieldType, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=seconds, postfix_operators=[], prefix_operators=[], qualifier=DurationFieldType, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=millis, postfix_operators=[], prefix_operators=[], qualifier=DurationFieldType, selectors=[], type_arguments=None)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DurationFieldType, sub_type=None)), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=4), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PeriodType, sub_type=None))]
assign[member[.cYDTime], member[.type]]
else begin[{]
None
end[}]
return[member[.type]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[PeriodType] identifier[yearDayTime] operator[SEP] operator[SEP] {
identifier[PeriodType] identifier[type] operator[=] identifier[cYDTime] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
identifier[type] operator[=] Keyword[new] identifier[PeriodType] operator[SEP] literal[String] , Keyword[new] identifier[DurationFieldType] operator[SEP] operator[SEP] {
identifier[DurationFieldType] operator[SEP] identifier[years] operator[SEP] operator[SEP] , identifier[DurationFieldType] operator[SEP] identifier[days] operator[SEP] operator[SEP] , identifier[DurationFieldType] operator[SEP] identifier[hours] operator[SEP] operator[SEP] , identifier[DurationFieldType] operator[SEP] identifier[minutes] operator[SEP] operator[SEP] , identifier[DurationFieldType] operator[SEP] identifier[seconds] operator[SEP] operator[SEP] , identifier[DurationFieldType] operator[SEP] identifier[millis] operator[SEP] operator[SEP] ,
} , Keyword[new] Keyword[int] operator[SEP] operator[SEP] {
Other[0] , operator[-] Other[1] , operator[-] Other[1] , Other[1] , Other[2] , Other[3] , Other[4] , Other[5] ,
} operator[SEP] operator[SEP] identifier[cYDTime] operator[=] identifier[type] operator[SEP]
}
Keyword[return] identifier[type] operator[SEP]
}
|
public static PhotoRequest photo(GeoApiContext context, String photoReference) {
PhotoRequest request = new PhotoRequest(context);
request.photoReference(photoReference);
return request;
}
|
class class_name[name] begin[{]
method[photo, return_type[type[PhotoRequest]], modifier[public static], parameter[context, photoReference]] begin[{]
local_variable[type[PhotoRequest], request]
call[request.photoReference, parameter[member[.photoReference]]]
return[member[.request]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[PhotoRequest] identifier[photo] operator[SEP] identifier[GeoApiContext] identifier[context] , identifier[String] identifier[photoReference] operator[SEP] {
identifier[PhotoRequest] identifier[request] operator[=] Keyword[new] identifier[PhotoRequest] operator[SEP] identifier[context] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[photoReference] operator[SEP] identifier[photoReference] operator[SEP] operator[SEP] Keyword[return] identifier[request] operator[SEP]
}
|
public void setOptions(final Object[] aArray) {
setOptions(aArray == null ? null : Arrays.asList(aArray));
}
|
class class_name[name] begin[{]
method[setOptions, return_type[void], modifier[public], parameter[aArray]] begin[{]
call[.setOptions, parameter[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=aArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[MemberReference(member=aArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setOptions] operator[SEP] Keyword[final] identifier[Object] operator[SEP] operator[SEP] identifier[aArray] operator[SEP] {
identifier[setOptions] operator[SEP] identifier[aArray] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[aArray] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(DescribeVaultOutput describeVaultOutput, ProtocolMarshaller protocolMarshaller) {
if (describeVaultOutput == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeVaultOutput.getVaultARN(), VAULTARN_BINDING);
protocolMarshaller.marshall(describeVaultOutput.getVaultName(), VAULTNAME_BINDING);
protocolMarshaller.marshall(describeVaultOutput.getCreationDate(), CREATIONDATE_BINDING);
protocolMarshaller.marshall(describeVaultOutput.getLastInventoryDate(), LASTINVENTORYDATE_BINDING);
protocolMarshaller.marshall(describeVaultOutput.getNumberOfArchives(), NUMBEROFARCHIVES_BINDING);
protocolMarshaller.marshall(describeVaultOutput.getSizeInBytes(), SIZEINBYTES_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[describeVaultOutput, protocolMarshaller]] begin[{]
if[binary_operation[member[.describeVaultOutput], ==, 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=getVaultARN, postfix_operators=[], prefix_operators=[], qualifier=describeVaultOutput, selectors=[], type_arguments=None), MemberReference(member=VAULTARN_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=getVaultName, postfix_operators=[], prefix_operators=[], qualifier=describeVaultOutput, selectors=[], type_arguments=None), MemberReference(member=VAULTNAME_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=getCreationDate, postfix_operators=[], prefix_operators=[], qualifier=describeVaultOutput, selectors=[], type_arguments=None), MemberReference(member=CREATIONDATE_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=getLastInventoryDate, postfix_operators=[], prefix_operators=[], qualifier=describeVaultOutput, selectors=[], type_arguments=None), MemberReference(member=LASTINVENTORYDATE_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=getNumberOfArchives, postfix_operators=[], prefix_operators=[], qualifier=describeVaultOutput, selectors=[], type_arguments=None), MemberReference(member=NUMBEROFARCHIVES_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=getSizeInBytes, postfix_operators=[], prefix_operators=[], qualifier=describeVaultOutput, selectors=[], type_arguments=None), MemberReference(member=SIZEINBYTES_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[DescribeVaultOutput] identifier[describeVaultOutput] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[describeVaultOutput] 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[describeVaultOutput] operator[SEP] identifier[getVaultARN] operator[SEP] operator[SEP] , identifier[VAULTARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeVaultOutput] operator[SEP] identifier[getVaultName] operator[SEP] operator[SEP] , identifier[VAULTNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeVaultOutput] operator[SEP] identifier[getCreationDate] operator[SEP] operator[SEP] , identifier[CREATIONDATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeVaultOutput] operator[SEP] identifier[getLastInventoryDate] operator[SEP] operator[SEP] , identifier[LASTINVENTORYDATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeVaultOutput] operator[SEP] identifier[getNumberOfArchives] operator[SEP] operator[SEP] , identifier[NUMBEROFARCHIVES_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeVaultOutput] operator[SEP] identifier[getSizeInBytes] operator[SEP] operator[SEP] , identifier[SIZEINBYTES_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]
}
}
|
public EClass getIfcAnnotationSymbolOccurrence() {
if (ifcAnnotationSymbolOccurrenceEClass == null) {
ifcAnnotationSymbolOccurrenceEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(19);
}
return ifcAnnotationSymbolOccurrenceEClass;
}
|
class class_name[name] begin[{]
method[getIfcAnnotationSymbolOccurrence, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcAnnotationSymbolOccurrenceEClass], ==, literal[null]]] begin[{]
assign[member[.ifcAnnotationSymbolOccurrenceEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc2x3tc1Package, 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=19)], 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[.ifcAnnotationSymbolOccurrenceEClass]]
end[}]
END[}]
|
Keyword[public] identifier[EClass] identifier[getIfcAnnotationSymbolOccurrence] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcAnnotationSymbolOccurrenceEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcAnnotationSymbolOccurrenceEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc2x3tc1Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[19] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcAnnotationSymbolOccurrenceEClass] operator[SEP]
}
|
public void writeClassMethods(CodeType codeType)
{
LogicFile recLogicFile = (LogicFile)this.getRecord(LogicFile.LOGIC_FILE_FILE);
try {
Set<String> methodsIncluded = new HashSet<String>();
Set<String> methodInterfaces = new HashSet<String>();
recLogicFile.close();
while (recLogicFile.hasNext())
{
recLogicFile.next();
if (((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(codeType, false))
{
this.writeThisMethod(codeType);
String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString();
if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*')
strMethodName = strMethodName.substring(0, strMethodName.length() - 2);
methodsIncluded.add(strMethodName);
}
if (((IncludeScopeField)recLogicFile.getField(LogicFile.INCLUDE_SCOPE)).includeThis(CodeType.INTERFACE, false))
{
String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString();
if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*')
strMethodName = strMethodName.substring(0, strMethodName.length() - 2);
methodInterfaces.add(strMethodName);
}
}
// Now add a empty implementation for any methods that I don't have
recLogicFile.close();
while (recLogicFile.hasNext())
{
recLogicFile.next();
String strMethodName = recLogicFile.getField(LogicFile.METHOD_NAME).toString();
if (strMethodName.length() > 2) if (strMethodName.charAt(strMethodName.length() - 2) == '*')
strMethodName = strMethodName.substring(0, strMethodName.length() - 2);
if ((methodInterfaces.contains(strMethodName)) && (!methodsIncluded.contains(strMethodName)))
this.writeThisMethod(codeType); // Write a default impl of this method.
}
recLogicFile.close();
} catch (DBException ex) {
ex.printStackTrace();
}
}
|
class class_name[name] begin[{]
method[writeClassMethods, return_type[void], modifier[public], parameter[codeType]] begin[{]
local_variable[type[LogicFile], recLogicFile]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashSet, sub_type=None)), name=methodsIncluded)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=None, name=HashSet, sub_type=None)), name=methodInterfaces)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Set, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[], type_arguments=None), label=None), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[], type_arguments=None), label=None), IfStatement(condition=Cast(expression=MethodInvocation(arguments=[MemberReference(member=INCLUDE_SCOPE, postfix_operators=[], prefix_operators=[], qualifier=LogicFile, selectors=[])], member=getField, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=IncludeScopeField, sub_type=None)), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=codeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeThisMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=METHOD_NAME, postfix_operators=[], prefix_operators=[], qualifier=LogicFile, selectors=[])], member=getField, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=strMethodName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>), else_statement=None, label=None, then_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*'), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=strMethodName, 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=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None)), label=None))), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=strMethodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=methodsIncluded, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=Cast(expression=MethodInvocation(arguments=[MemberReference(member=INCLUDE_SCOPE, postfix_operators=[], prefix_operators=[], qualifier=LogicFile, selectors=[])], member=getField, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=IncludeScopeField, sub_type=None)), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=METHOD_NAME, postfix_operators=[], prefix_operators=[], qualifier=LogicFile, selectors=[])], member=getField, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=strMethodName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>), else_statement=None, label=None, then_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*'), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=strMethodName, 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=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None)), label=None))), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=strMethodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=methodInterfaces, selectors=[], type_arguments=None), label=None)]))]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[], type_arguments=None), label=None), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=METHOD_NAME, postfix_operators=[], prefix_operators=[], qualifier=LogicFile, selectors=[])], member=getField, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=strMethodName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=>), else_statement=None, label=None, then_statement=IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-)], member=charAt, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='*'), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=strMethodName, 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=strMethodName, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), operator=-)], member=substring, postfix_operators=[], prefix_operators=[], qualifier=strMethodName, selectors=[], type_arguments=None)), label=None))), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=strMethodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=methodInterfaces, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=strMethodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=contains, postfix_operators=[], prefix_operators=[], qualifier=methodsIncluded, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=codeType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeThisMethod, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None))]), condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=recLogicFile, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['DBException']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[writeClassMethods] operator[SEP] identifier[CodeType] identifier[codeType] operator[SEP] {
identifier[LogicFile] identifier[recLogicFile] operator[=] operator[SEP] identifier[LogicFile] operator[SEP] Keyword[this] operator[SEP] identifier[getRecord] operator[SEP] identifier[LogicFile] operator[SEP] identifier[LOGIC_FILE_FILE] operator[SEP] operator[SEP] Keyword[try] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[methodsIncluded] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[Set] operator[<] identifier[String] operator[>] identifier[methodInterfaces] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[recLogicFile] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[recLogicFile] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[recLogicFile] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[IncludeScopeField] operator[SEP] identifier[recLogicFile] operator[SEP] identifier[getField] operator[SEP] identifier[LogicFile] operator[SEP] identifier[INCLUDE_SCOPE] operator[SEP] operator[SEP] operator[SEP] identifier[includeThis] operator[SEP] identifier[codeType] , literal[boolean] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[writeThisMethod] operator[SEP] identifier[codeType] operator[SEP] operator[SEP] identifier[String] identifier[strMethodName] operator[=] identifier[recLogicFile] operator[SEP] identifier[getField] operator[SEP] identifier[LogicFile] operator[SEP] identifier[METHOD_NAME] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strMethodName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[2] operator[SEP] Keyword[if] operator[SEP] identifier[strMethodName] operator[SEP] identifier[charAt] operator[SEP] identifier[strMethodName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[==] literal[String] operator[SEP] identifier[strMethodName] operator[=] identifier[strMethodName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[strMethodName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[SEP] identifier[methodsIncluded] operator[SEP] identifier[add] operator[SEP] identifier[strMethodName] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[IncludeScopeField] operator[SEP] identifier[recLogicFile] operator[SEP] identifier[getField] operator[SEP] identifier[LogicFile] operator[SEP] identifier[INCLUDE_SCOPE] operator[SEP] operator[SEP] operator[SEP] identifier[includeThis] operator[SEP] identifier[CodeType] operator[SEP] identifier[INTERFACE] , literal[boolean] operator[SEP] operator[SEP] {
identifier[String] identifier[strMethodName] operator[=] identifier[recLogicFile] operator[SEP] identifier[getField] operator[SEP] identifier[LogicFile] operator[SEP] identifier[METHOD_NAME] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strMethodName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[2] operator[SEP] Keyword[if] operator[SEP] identifier[strMethodName] operator[SEP] identifier[charAt] operator[SEP] identifier[strMethodName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[==] literal[String] operator[SEP] identifier[strMethodName] operator[=] identifier[strMethodName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[strMethodName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[SEP] identifier[methodInterfaces] operator[SEP] identifier[add] operator[SEP] identifier[strMethodName] operator[SEP] operator[SEP]
}
}
identifier[recLogicFile] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[recLogicFile] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[recLogicFile] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[strMethodName] operator[=] identifier[recLogicFile] operator[SEP] identifier[getField] operator[SEP] identifier[LogicFile] operator[SEP] identifier[METHOD_NAME] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[strMethodName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[2] operator[SEP] Keyword[if] operator[SEP] identifier[strMethodName] operator[SEP] identifier[charAt] operator[SEP] identifier[strMethodName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[==] literal[String] operator[SEP] identifier[strMethodName] operator[=] identifier[strMethodName] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[strMethodName] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[-] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[methodInterfaces] operator[SEP] identifier[contains] operator[SEP] identifier[strMethodName] operator[SEP] operator[SEP] operator[&&] operator[SEP] operator[!] identifier[methodsIncluded] operator[SEP] identifier[contains] operator[SEP] identifier[strMethodName] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[writeThisMethod] operator[SEP] identifier[codeType] operator[SEP] operator[SEP]
}
identifier[recLogicFile] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[DBException] identifier[ex] operator[SEP] {
identifier[ex] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static DisconfCoreProcessor getDisconfCoreProcessorFile(WatchMgr watchMgr, FetcherMgr fetcherMgr, Registry
registry) {
return new DisconfFileCoreProcessorImpl(watchMgr, fetcherMgr, registry);
}
|
class class_name[name] begin[{]
method[getDisconfCoreProcessorFile, return_type[type[DisconfCoreProcessor]], modifier[public static], parameter[watchMgr, fetcherMgr, registry]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=watchMgr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=fetcherMgr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=registry, 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=DisconfFileCoreProcessorImpl, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[DisconfCoreProcessor] identifier[getDisconfCoreProcessorFile] operator[SEP] identifier[WatchMgr] identifier[watchMgr] , identifier[FetcherMgr] identifier[fetcherMgr] , identifier[Registry] identifier[registry] operator[SEP] {
Keyword[return] Keyword[new] identifier[DisconfFileCoreProcessorImpl] operator[SEP] identifier[watchMgr] , identifier[fetcherMgr] , identifier[registry] operator[SEP] operator[SEP]
}
|
public static List<GatewayAddress> asList(final List<String> addressList) {
if (addressList == null || addressList.size() == 0) {
throw new IllegalArgumentException("addresses must not be null");
}
List<GatewayAddress> list = new ArrayList<GatewayAddress>();
int id = 1;
for (String address : addressList) {
list.add(new GatewayAddress(id++, address));
}
return list;
}
|
class class_name[name] begin[{]
method[asList, return_type[type[List]], modifier[public static], parameter[addressList]] begin[{]
if[binary_operation[binary_operation[member[.addressList], ==, literal[null]], ||, binary_operation[call[addressList.size, parameter[]], ==, literal[0]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="addresses must not be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[List], list]
local_variable[type[int], id]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=id, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=address, 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=GatewayAddress, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=addressList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=address)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[member[.list]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[List] operator[<] identifier[GatewayAddress] operator[>] identifier[asList] operator[SEP] Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[addressList] operator[SEP] {
Keyword[if] operator[SEP] identifier[addressList] operator[==] Other[null] operator[||] identifier[addressList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[List] operator[<] identifier[GatewayAddress] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[GatewayAddress] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[id] operator[=] Other[1] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[address] operator[:] identifier[addressList] operator[SEP] {
identifier[list] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[GatewayAddress] operator[SEP] identifier[id] operator[++] , identifier[address] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
public String resolvePublic(String publicId, String systemId)
throws MalformedURLException, IOException {
String resolved = super.resolvePublic(publicId, systemId);
if (resolved != null) {
return resolved;
}
Enumeration enumt = catalogEntries.elements();
while (enumt.hasMoreElements()) {
CatalogEntry e = (CatalogEntry) enumt.nextElement();
if (e.getEntryType() == RESOLVER) {
if (systemId != null) {
resolved = resolveExternalSystem(systemId,
e.getEntryArg(0));
if (resolved != null) {
return resolved;
}
}
resolved = resolveExternalPublic(publicId, e.getEntryArg(0));
if (resolved != null) {
return resolved;
}
}
}
return resolveSubordinateCatalogs(Catalog.PUBLIC,
null,
publicId,
systemId);
}
|
class class_name[name] begin[{]
method[resolvePublic, return_type[type[String]], modifier[public], parameter[publicId, systemId]] begin[{]
local_variable[type[String], resolved]
if[binary_operation[member[.resolved], !=, literal[null]]] begin[{]
return[member[.resolved]]
else begin[{]
None
end[}]
local_variable[type[Enumeration], enumt]
while[call[enumt.hasMoreElements, parameter[]]] begin[{]
local_variable[type[CatalogEntry], e]
if[binary_operation[call[e.getEntryType, parameter[]], ==, member[.RESOLVER]]] begin[{]
if[binary_operation[member[.systemId], !=, literal[null]]] begin[{]
assign[member[.resolved], call[.resolveExternalSystem, parameter[member[.systemId], call[e.getEntryArg, parameter[literal[0]]]]]]
if[binary_operation[member[.resolved], !=, literal[null]]] begin[{]
return[member[.resolved]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
assign[member[.resolved], call[.resolveExternalPublic, parameter[member[.publicId], call[e.getEntryArg, parameter[literal[0]]]]]]
if[binary_operation[member[.resolved], !=, literal[null]]] begin[{]
return[member[.resolved]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
end[}]
return[call[.resolveSubordinateCatalogs, parameter[member[Catalog.PUBLIC], literal[null], member[.publicId], member[.systemId]]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[resolvePublic] operator[SEP] identifier[String] identifier[publicId] , identifier[String] identifier[systemId] operator[SEP] Keyword[throws] identifier[MalformedURLException] , identifier[IOException] {
identifier[String] identifier[resolved] operator[=] Keyword[super] operator[SEP] identifier[resolvePublic] operator[SEP] identifier[publicId] , identifier[systemId] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resolved] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[resolved] operator[SEP]
}
identifier[Enumeration] identifier[enumt] operator[=] identifier[catalogEntries] operator[SEP] identifier[elements] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[enumt] operator[SEP] identifier[hasMoreElements] operator[SEP] operator[SEP] operator[SEP] {
identifier[CatalogEntry] identifier[e] operator[=] operator[SEP] identifier[CatalogEntry] operator[SEP] identifier[enumt] operator[SEP] identifier[nextElement] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getEntryType] operator[SEP] operator[SEP] operator[==] identifier[RESOLVER] operator[SEP] {
Keyword[if] operator[SEP] identifier[systemId] operator[!=] Other[null] operator[SEP] {
identifier[resolved] operator[=] identifier[resolveExternalSystem] operator[SEP] identifier[systemId] , identifier[e] operator[SEP] identifier[getEntryArg] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resolved] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[resolved] operator[SEP]
}
}
identifier[resolved] operator[=] identifier[resolveExternalPublic] operator[SEP] identifier[publicId] , identifier[e] operator[SEP] identifier[getEntryArg] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[resolved] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[resolved] operator[SEP]
}
}
}
Keyword[return] identifier[resolveSubordinateCatalogs] operator[SEP] identifier[Catalog] operator[SEP] identifier[PUBLIC] , Other[null] , identifier[publicId] , identifier[systemId] operator[SEP] operator[SEP]
}
|
@Override
public GallicWeight plus(GallicWeight a, GallicWeight b) {
if (isZero(a)) return b;
if (isZero(b)) return a;
if (mode == RESTRICT_GALLIC) {
if (SHORTLEX_ORDERING.compare(a, b) != 0) {
throw new IllegalArgumentException("Trying to plus two different gallic weights, which isn't allowed in " +
"this context. Did you pass a non-functional FST where a functional one was required? a = " + a +
"; b = " + b);
}
double newWeight = this.weightSemiring.plus(a.getWeight(), b.getWeight());
return GallicWeight.create(new IntArrayList(a.getLabels()), newWeight);
} else {
Preconditions.checkState(mode == MIN_GALLIC);
return this.weightSemiring.naturalLess(a.getWeight(), b.getWeight()) ? a : b;
}
}
|
class class_name[name] begin[{]
method[plus, return_type[type[GallicWeight]], modifier[public], parameter[a, b]] begin[{]
if[call[.isZero, parameter[member[.a]]]] begin[{]
return[member[.b]]
else begin[{]
None
end[}]
if[call[.isZero, parameter[member[.b]]]] begin[{]
return[member[.a]]
else begin[{]
None
end[}]
if[binary_operation[member[.mode], ==, member[.RESTRICT_GALLIC]]] begin[{]
if[binary_operation[call[SHORTLEX_ORDERING.compare, parameter[member[.a], member[.b]]], !=, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Trying to plus two different gallic weights, which isn't allowed in "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="this context. Did you pass a non-functional FST where a functional one was required? a = "), operator=+), operandr=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="; b = "), operator=+), operandr=MemberReference(member=b, 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[}]
local_variable[type[double], newWeight]
return[call[GallicWeight.create, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getLabels, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IntArrayList, sub_type=None)), member[.newWeight]]]]
else begin[{]
call[Preconditions.checkState, parameter[binary_operation[member[.mode], ==, member[.MIN_GALLIC]]]]
return[TernaryExpression(condition=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=weightSemiring, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getWeight, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getWeight, postfix_operators=[], prefix_operators=[], qualifier=b, selectors=[], type_arguments=None)], member=naturalLess, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), if_false=MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=a, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[GallicWeight] identifier[plus] operator[SEP] identifier[GallicWeight] identifier[a] , identifier[GallicWeight] identifier[b] operator[SEP] {
Keyword[if] operator[SEP] identifier[isZero] operator[SEP] identifier[a] operator[SEP] operator[SEP] Keyword[return] identifier[b] operator[SEP] Keyword[if] operator[SEP] identifier[isZero] operator[SEP] identifier[b] operator[SEP] operator[SEP] Keyword[return] identifier[a] operator[SEP] Keyword[if] operator[SEP] identifier[mode] operator[==] identifier[RESTRICT_GALLIC] operator[SEP] {
Keyword[if] operator[SEP] identifier[SHORTLEX_ORDERING] operator[SEP] identifier[compare] operator[SEP] identifier[a] , identifier[b] operator[SEP] operator[!=] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[+] literal[String] operator[+] identifier[a] operator[+] literal[String] operator[+] identifier[b] operator[SEP] operator[SEP]
}
Keyword[double] identifier[newWeight] operator[=] Keyword[this] operator[SEP] identifier[weightSemiring] operator[SEP] identifier[plus] operator[SEP] identifier[a] operator[SEP] identifier[getWeight] operator[SEP] operator[SEP] , identifier[b] operator[SEP] identifier[getWeight] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[GallicWeight] operator[SEP] identifier[create] operator[SEP] Keyword[new] identifier[IntArrayList] operator[SEP] identifier[a] operator[SEP] identifier[getLabels] operator[SEP] operator[SEP] operator[SEP] , identifier[newWeight] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[mode] operator[==] identifier[MIN_GALLIC] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[weightSemiring] operator[SEP] identifier[naturalLess] operator[SEP] identifier[a] operator[SEP] identifier[getWeight] operator[SEP] operator[SEP] , identifier[b] operator[SEP] identifier[getWeight] operator[SEP] operator[SEP] operator[SEP] operator[?] identifier[a] operator[:] identifier[b] operator[SEP]
}
}
|
public static boolean or(boolean... array) {
if (ArrayUtil.isEmpty(array)) {
throw new IllegalArgumentException("The Array must not be empty !");
}
for (final boolean element : array) {
if (element) {
return true;
}
}
return false;
}
|
class class_name[name] begin[{]
method[or, return_type[type[boolean]], modifier[public static], parameter[array]] begin[{]
if[call[ArrayUtil.isEmpty, parameter[member[.array]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="The Array must not be empty !")], 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[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=array, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=element)], modifiers={'final'}, type=BasicType(dimensions=[], name=boolean))), label=None)
return[literal[false]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[or] operator[SEP] Keyword[boolean] operator[...] identifier[array] operator[SEP] {
Keyword[if] operator[SEP] identifier[ArrayUtil] operator[SEP] identifier[isEmpty] operator[SEP] identifier[array] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] Keyword[final] Keyword[boolean] identifier[element] operator[:] identifier[array] operator[SEP] {
Keyword[if] operator[SEP] identifier[element] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
private Document toXML(Collection<ArchiveEntry> files) throws Exception
{
Document doc = new DOMDocument();
Element packageElement = new DOMElement("package");
doc.setRootElement(packageElement);
Element infoElement = new DOMElement("infos");
packageElement.add(infoElement);
addInfoElements(infoElement);
Element filesElement = new DOMElement(FILES_TAG);
packageElement.add(filesElement);
addFileElements(files, filesElement);
return doc;
}
|
class class_name[name] begin[{]
method[toXML, return_type[type[Document]], modifier[private], parameter[files]] begin[{]
local_variable[type[Document], doc]
local_variable[type[Element], packageElement]
call[doc.setRootElement, parameter[member[.packageElement]]]
local_variable[type[Element], infoElement]
call[packageElement.add, parameter[member[.infoElement]]]
call[.addInfoElements, parameter[member[.infoElement]]]
local_variable[type[Element], filesElement]
call[packageElement.add, parameter[member[.filesElement]]]
call[.addFileElements, parameter[member[.files], member[.filesElement]]]
return[member[.doc]]
end[}]
END[}]
|
Keyword[private] identifier[Document] identifier[toXML] operator[SEP] identifier[Collection] operator[<] identifier[ArchiveEntry] operator[>] identifier[files] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Document] identifier[doc] operator[=] Keyword[new] identifier[DOMDocument] operator[SEP] operator[SEP] operator[SEP] identifier[Element] identifier[packageElement] operator[=] Keyword[new] identifier[DOMElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[doc] operator[SEP] identifier[setRootElement] operator[SEP] identifier[packageElement] operator[SEP] operator[SEP] identifier[Element] identifier[infoElement] operator[=] Keyword[new] identifier[DOMElement] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[packageElement] operator[SEP] identifier[add] operator[SEP] identifier[infoElement] operator[SEP] operator[SEP] identifier[addInfoElements] operator[SEP] identifier[infoElement] operator[SEP] operator[SEP] identifier[Element] identifier[filesElement] operator[=] Keyword[new] identifier[DOMElement] operator[SEP] identifier[FILES_TAG] operator[SEP] operator[SEP] identifier[packageElement] operator[SEP] identifier[add] operator[SEP] identifier[filesElement] operator[SEP] operator[SEP] identifier[addFileElements] operator[SEP] identifier[files] , identifier[filesElement] operator[SEP] operator[SEP] Keyword[return] identifier[doc] operator[SEP]
}
|
public static int getAStoreReg(final DismantleBytecode dbc, final int seen) {
if (seen == Const.ASTORE) {
return dbc.getRegisterOperand();
}
if (OpcodeUtils.isAStore(seen)) {
return seen - Const.ASTORE_0;
}
return -1;
}
|
class class_name[name] begin[{]
method[getAStoreReg, return_type[type[int]], modifier[public static], parameter[dbc, seen]] begin[{]
if[binary_operation[member[.seen], ==, member[Const.ASTORE]]] begin[{]
return[call[dbc.getRegisterOperand, parameter[]]]
else begin[{]
None
end[}]
if[call[OpcodeUtils.isAStore, parameter[member[.seen]]]] begin[{]
return[binary_operation[member[.seen], -, member[Const.ASTORE_0]]]
else begin[{]
None
end[}]
return[literal[1]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[getAStoreReg] operator[SEP] Keyword[final] identifier[DismantleBytecode] identifier[dbc] , Keyword[final] Keyword[int] identifier[seen] operator[SEP] {
Keyword[if] operator[SEP] identifier[seen] operator[==] identifier[Const] operator[SEP] identifier[ASTORE] operator[SEP] {
Keyword[return] identifier[dbc] operator[SEP] identifier[getRegisterOperand] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[OpcodeUtils] operator[SEP] identifier[isAStore] operator[SEP] identifier[seen] operator[SEP] operator[SEP] {
Keyword[return] identifier[seen] operator[-] identifier[Const] operator[SEP] identifier[ASTORE_0] operator[SEP]
}
Keyword[return] operator[-] Other[1] operator[SEP]
}
|
public long insert(final InsertQuery query) {
return runner.run(new TransactionWrapper<Long>() {
public Long perform(QueryRunner queryRunner) {
return queryRunner.insert(query);
}
});
}
|
class class_name[name] begin[{]
method[insert, return_type[type[long]], modifier[public], parameter[query]] begin[{]
return[call[runner.run, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=query, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=insert, postfix_operators=[], prefix_operators=[], qualifier=queryRunner, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=perform, parameters=[FormalParameter(annotations=[], modifiers=set(), name=queryRunner, type=ReferenceType(arguments=None, dimensions=[], name=QueryRunner, sub_type=None), varargs=False)], return_type=ReferenceType(arguments=None, dimensions=[], name=Long, 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=Long, sub_type=None))], dimensions=None, name=TransactionWrapper, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] Keyword[long] identifier[insert] operator[SEP] Keyword[final] identifier[InsertQuery] identifier[query] operator[SEP] {
Keyword[return] identifier[runner] operator[SEP] identifier[run] operator[SEP] Keyword[new] identifier[TransactionWrapper] operator[<] identifier[Long] operator[>] operator[SEP] operator[SEP] {
Keyword[public] identifier[Long] identifier[perform] operator[SEP] identifier[QueryRunner] identifier[queryRunner] operator[SEP] {
Keyword[return] identifier[queryRunner] operator[SEP] identifier[insert] operator[SEP] identifier[query] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP]
}
|
private static ConfigurationBuilder getConfigurationBuilder(final Optional<Configuration> configuration) {
if (configuration.isPresent()) {
return Tang.Factory.getTang().newConfigurationBuilder(configuration.get());
} else {
return Tang.Factory.getTang().newConfigurationBuilder();
}
}
|
class class_name[name] begin[{]
method[getConfigurationBuilder, return_type[type[ConfigurationBuilder]], modifier[private static], parameter[configuration]] begin[{]
if[call[configuration.isPresent, parameter[]]] begin[{]
return[call[Tang.Factory.getTang, parameter[]]]
else begin[{]
return[call[Tang.Factory.getTang, parameter[]]]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[ConfigurationBuilder] identifier[getConfigurationBuilder] operator[SEP] Keyword[final] identifier[Optional] operator[<] identifier[Configuration] operator[>] identifier[configuration] operator[SEP] {
Keyword[if] operator[SEP] identifier[configuration] operator[SEP] identifier[isPresent] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[Tang] operator[SEP] identifier[Factory] operator[SEP] identifier[getTang] operator[SEP] operator[SEP] operator[SEP] identifier[newConfigurationBuilder] operator[SEP] identifier[configuration] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[Tang] operator[SEP] identifier[Factory] operator[SEP] identifier[getTang] operator[SEP] operator[SEP] operator[SEP] identifier[newConfigurationBuilder] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public String getString(int index) throws JSONException {
Object object = this.get(index);
if (object instanceof String) {
return (String) object;
}
throw new JSONException("JSONArray[" + index + "] not a string.");
}
|
class class_name[name] begin[{]
method[getString, return_type[type[String]], modifier[public], parameter[index]] begin[{]
local_variable[type[Object], object]
if[binary_operation[member[.object], instanceof, type[String]]] begin[{]
return[Cast(expression=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]
else begin[{]
None
end[}]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="JSONArray["), operandr=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] not a string."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=JSONException, sub_type=None)), label=None)
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getString] operator[SEP] Keyword[int] identifier[index] operator[SEP] Keyword[throws] identifier[JSONException] {
identifier[Object] identifier[object] operator[=] Keyword[this] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[object] Keyword[instanceof] identifier[String] operator[SEP] {
Keyword[return] operator[SEP] identifier[String] operator[SEP] identifier[object] operator[SEP]
}
Keyword[throw] Keyword[new] identifier[JSONException] operator[SEP] literal[String] operator[+] identifier[index] operator[+] literal[String] operator[SEP] operator[SEP]
}
|
public void beginDelete(String resourceGroupName, String containerServiceName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, containerServiceName).toBlocking().single().body();
}
|
class class_name[name] begin[{]
method[beginDelete, return_type[void], modifier[public], parameter[resourceGroupName, containerServiceName]] begin[{]
call[.beginDeleteWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.containerServiceName]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[beginDelete] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[containerServiceName] operator[SEP] {
identifier[beginDeleteWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[containerServiceName] operator[SEP] operator[SEP] identifier[toBlocking] operator[SEP] operator[SEP] operator[SEP] identifier[single] operator[SEP] operator[SEP] operator[SEP] identifier[body] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T> CloseableIterable<T> concat(final CloseableIterable<? extends Iterable<? extends T>> inputs) {
return wrap(Iterables.concat(inputs), inputs);
}
|
class class_name[name] begin[{]
method[concat, return_type[type[CloseableIterable]], modifier[public static], parameter[inputs]] begin[{]
return[call[.wrap, parameter[call[Iterables.concat, parameter[member[.inputs]]], member[.inputs]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[CloseableIterable] operator[<] identifier[T] operator[>] identifier[concat] operator[SEP] Keyword[final] identifier[CloseableIterable] operator[<] operator[?] Keyword[extends] identifier[Iterable] operator[<] operator[?] Keyword[extends] identifier[T] operator[>] operator[>] identifier[inputs] operator[SEP] {
Keyword[return] identifier[wrap] operator[SEP] identifier[Iterables] operator[SEP] identifier[concat] operator[SEP] identifier[inputs] operator[SEP] , identifier[inputs] operator[SEP] operator[SEP]
}
|
public Document create(@NonNull String content, @NonNull Language language, @NonNull Map<AttributeType, ?> attributeMap) {
return create("", content, language, attributeMap);
}
|
class class_name[name] begin[{]
method[create, return_type[type[Document]], modifier[public], parameter[content, language, attributeMap]] begin[{]
return[call[.create, parameter[literal[""], member[.content], member[.language], member[.attributeMap]]]]
end[}]
END[}]
|
Keyword[public] identifier[Document] identifier[create] operator[SEP] annotation[@] identifier[NonNull] identifier[String] identifier[content] , annotation[@] identifier[NonNull] identifier[Language] identifier[language] , annotation[@] identifier[NonNull] identifier[Map] operator[<] identifier[AttributeType] , operator[?] operator[>] identifier[attributeMap] operator[SEP] {
Keyword[return] identifier[create] operator[SEP] literal[String] , identifier[content] , identifier[language] , identifier[attributeMap] operator[SEP] operator[SEP]
}
|
public <T> List<T> unmarshalList(Class<T> returnType, Reader reader) throws JsonParseException, JsonMappingException, IOException {
ObjectMapper objectMapper = getContext(null);
CollectionType javaType = objectMapper.getTypeFactory().constructCollectionType(List.class, returnType);
return (objectMapper.readValue(reader, javaType));
}
|
class class_name[name] begin[{]
method[unmarshalList, return_type[type[List]], modifier[public], parameter[returnType, reader]] begin[{]
local_variable[type[ObjectMapper], objectMapper]
local_variable[type[CollectionType], javaType]
return[call[objectMapper.readValue, parameter[member[.reader], member[.javaType]]]]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[T] operator[>] identifier[unmarshalList] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[returnType] , identifier[Reader] identifier[reader] operator[SEP] Keyword[throws] identifier[JsonParseException] , identifier[JsonMappingException] , identifier[IOException] {
identifier[ObjectMapper] identifier[objectMapper] operator[=] identifier[getContext] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[CollectionType] identifier[javaType] operator[=] identifier[objectMapper] operator[SEP] identifier[getTypeFactory] operator[SEP] operator[SEP] operator[SEP] identifier[constructCollectionType] operator[SEP] identifier[List] operator[SEP] Keyword[class] , identifier[returnType] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[objectMapper] operator[SEP] identifier[readValue] operator[SEP] identifier[reader] , identifier[javaType] operator[SEP] operator[SEP] operator[SEP]
}
|
private void cleanPipes()
{
assert (pipe != null);
// Get rid of half-processed messages in the out pipe. Flush any
// unflushed messages upstream.
pipe.rollback();
pipe.flush();
// Remove any half-read message from the in pipe.
while (incompleteIn) {
Msg msg = pullMsg();
if (msg == null) {
assert (!incompleteIn);
break;
}
// msg.close ();
}
}
|
class class_name[name] begin[{]
method[cleanPipes, return_type[void], modifier[private], parameter[]] begin[{]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=pipe, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
call[pipe.rollback, parameter[]]
call[pipe.flush, parameter[]]
while[member[.incompleteIn]] begin[{]
local_variable[type[Msg], msg]
if[binary_operation[member[.msg], ==, literal[null]]] begin[{]
AssertStatement(condition=MemberReference(member=incompleteIn, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None, value=None)
BreakStatement(goto=None, label=None)
else begin[{]
None
end[}]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[cleanPipes] operator[SEP] operator[SEP] {
Keyword[assert] operator[SEP] identifier[pipe] operator[!=] Other[null] operator[SEP] operator[SEP] identifier[pipe] operator[SEP] identifier[rollback] operator[SEP] operator[SEP] operator[SEP] identifier[pipe] operator[SEP] identifier[flush] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[incompleteIn] operator[SEP] {
identifier[Msg] identifier[msg] operator[=] identifier[pullMsg] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[msg] operator[==] Other[null] operator[SEP] {
Keyword[assert] operator[SEP] operator[!] identifier[incompleteIn] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
}
|
public static <T extends TypeDescription> ElementMatcher.Junction<T> hasSuperType(ElementMatcher<? super TypeDescription> matcher) {
return hasGenericSuperType(erasure(matcher));
}
|
class class_name[name] begin[{]
method[hasSuperType, return_type[type[ElementMatcher]], modifier[public static], parameter[matcher]] begin[{]
return[call[.hasGenericSuperType, parameter[call[.erasure, parameter[member[.matcher]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] Keyword[extends] identifier[TypeDescription] operator[>] identifier[ElementMatcher] operator[SEP] identifier[Junction] operator[<] identifier[T] operator[>] identifier[hasSuperType] operator[SEP] identifier[ElementMatcher] operator[<] operator[?] Keyword[super] identifier[TypeDescription] operator[>] identifier[matcher] operator[SEP] {
Keyword[return] identifier[hasGenericSuperType] operator[SEP] identifier[erasure] operator[SEP] identifier[matcher] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(ConnectionPasswordEncryption connectionPasswordEncryption, ProtocolMarshaller protocolMarshaller) {
if (connectionPasswordEncryption == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(connectionPasswordEncryption.getReturnConnectionPasswordEncrypted(), RETURNCONNECTIONPASSWORDENCRYPTED_BINDING);
protocolMarshaller.marshall(connectionPasswordEncryption.getAwsKmsKeyId(), AWSKMSKEYID_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[connectionPasswordEncryption, protocolMarshaller]] begin[{]
if[binary_operation[member[.connectionPasswordEncryption], ==, 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=getReturnConnectionPasswordEncrypted, postfix_operators=[], prefix_operators=[], qualifier=connectionPasswordEncryption, selectors=[], type_arguments=None), MemberReference(member=RETURNCONNECTIONPASSWORDENCRYPTED_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=getAwsKmsKeyId, postfix_operators=[], prefix_operators=[], qualifier=connectionPasswordEncryption, selectors=[], type_arguments=None), MemberReference(member=AWSKMSKEYID_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[ConnectionPasswordEncryption] identifier[connectionPasswordEncryption] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[connectionPasswordEncryption] 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[connectionPasswordEncryption] operator[SEP] identifier[getReturnConnectionPasswordEncrypted] operator[SEP] operator[SEP] , identifier[RETURNCONNECTIONPASSWORDENCRYPTED_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[connectionPasswordEncryption] operator[SEP] identifier[getAwsKmsKeyId] operator[SEP] operator[SEP] , identifier[AWSKMSKEYID_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]
}
}
|
public static Iterable<VcfSample> samples(final File file) throws IOException {
checkNotNull(file);
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
return samples(reader);
}
}
|
class class_name[name] begin[{]
method[samples, return_type[type[Iterable]], modifier[public static], parameter[file]] begin[{]
call[.checkNotNull, parameter[member[.file]]]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=samples, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=reader, type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None), value=ClassCreator(arguments=[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=FileReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)))])
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Iterable] operator[<] identifier[VcfSample] operator[>] identifier[samples] operator[SEP] Keyword[final] identifier[File] identifier[file] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[checkNotNull] operator[SEP] identifier[file] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[FileReader] operator[SEP] identifier[file] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[samples] operator[SEP] identifier[reader] operator[SEP] operator[SEP]
}
}
|
@Deprecated
public static <T> Callable<T> continueRequest(Callable<T> callable, Map<Key<?>, Object> seedMap) {
return wrap(callable, continueRequest(seedMap));
}
|
class class_name[name] begin[{]
method[continueRequest, return_type[type[Callable]], modifier[public static], parameter[callable, seedMap]] begin[{]
return[call[.wrap, parameter[member[.callable], call[.continueRequest, parameter[member[.seedMap]]]]]]
end[}]
END[}]
|
annotation[@] identifier[Deprecated] Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Callable] operator[<] identifier[T] operator[>] identifier[continueRequest] operator[SEP] identifier[Callable] operator[<] identifier[T] operator[>] identifier[callable] , identifier[Map] operator[<] identifier[Key] operator[<] operator[?] operator[>] , identifier[Object] operator[>] identifier[seedMap] operator[SEP] {
Keyword[return] identifier[wrap] operator[SEP] identifier[callable] , identifier[continueRequest] operator[SEP] identifier[seedMap] operator[SEP] operator[SEP] operator[SEP]
}
|
public static SequenceBatchCSVRecord fromWritables(List<List<List<Writable>>> input) {
SequenceBatchCSVRecord ret = new SequenceBatchCSVRecord();
for(int i = 0; i < input.size(); i++) {
ret.add(Arrays.asList(BatchCSVRecord.fromWritables(input.get(i))));
}
return ret;
}
|
class class_name[name] begin[{]
method[fromWritables, return_type[type[SequenceBatchCSVRecord]], modifier[public static], parameter[input]] begin[{]
local_variable[type[SequenceBatchCSVRecord], ret]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None)], member=fromWritables, postfix_operators=[], prefix_operators=[], qualifier=BatchCSVRecord, selectors=[], type_arguments=None)], member=asList, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=input, 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)
return[member[.ret]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[SequenceBatchCSVRecord] identifier[fromWritables] operator[SEP] identifier[List] operator[<] identifier[List] operator[<] identifier[List] operator[<] identifier[Writable] operator[>] operator[>] operator[>] identifier[input] operator[SEP] {
identifier[SequenceBatchCSVRecord] identifier[ret] operator[=] Keyword[new] identifier[SequenceBatchCSVRecord] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[input] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[ret] operator[SEP] identifier[add] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[BatchCSVRecord] operator[SEP] identifier[fromWritables] operator[SEP] identifier[input] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
protected final int doWrite0(ChannelOutboundBuffer in) throws Exception {
Object msg = in.current();
if (msg == null) {
// Directly return here so incompleteWrite(...) is not called.
return 0;
}
return doWriteInternal(in, in.current());
}
|
class class_name[name] begin[{]
method[doWrite0, return_type[type[int]], modifier[final protected], parameter[in]] begin[{]
local_variable[type[Object], msg]
if[binary_operation[member[.msg], ==, literal[null]]] begin[{]
return[literal[0]]
else begin[{]
None
end[}]
return[call[.doWriteInternal, parameter[member[.in], call[in.current, parameter[]]]]]
end[}]
END[}]
|
Keyword[protected] Keyword[final] Keyword[int] identifier[doWrite0] operator[SEP] identifier[ChannelOutboundBuffer] identifier[in] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[Object] identifier[msg] operator[=] identifier[in] operator[SEP] identifier[current] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[msg] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[0] operator[SEP]
}
Keyword[return] identifier[doWriteInternal] operator[SEP] identifier[in] , identifier[in] operator[SEP] identifier[current] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static ByteBuffer putTimeOnlyAsString(ByteBuffer buffer, long value)
{
buffer = putTimeOnlyAsString(buffer, value, true);
return buffer;
}
|
class class_name[name] begin[{]
method[putTimeOnlyAsString, return_type[type[ByteBuffer]], modifier[public static], parameter[buffer, value]] begin[{]
assign[member[.buffer], call[.putTimeOnlyAsString, parameter[member[.buffer], member[.value], literal[true]]]]
return[member[.buffer]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[ByteBuffer] identifier[putTimeOnlyAsString] operator[SEP] identifier[ByteBuffer] identifier[buffer] , Keyword[long] identifier[value] operator[SEP] {
identifier[buffer] operator[=] identifier[putTimeOnlyAsString] operator[SEP] identifier[buffer] , identifier[value] , literal[boolean] operator[SEP] operator[SEP] Keyword[return] identifier[buffer] operator[SEP]
}
|
public SDVariable lte(String name, SDVariable other){
return sameDiff.lte(name, this, other);
}
|
class class_name[name] begin[{]
method[lte, return_type[type[SDVariable]], modifier[public], parameter[name, other]] begin[{]
return[call[sameDiff.lte, parameter[member[.name], THIS[], member[.other]]]]
end[}]
END[}]
|
Keyword[public] identifier[SDVariable] identifier[lte] operator[SEP] identifier[String] identifier[name] , identifier[SDVariable] identifier[other] operator[SEP] {
Keyword[return] identifier[sameDiff] operator[SEP] identifier[lte] operator[SEP] identifier[name] , Keyword[this] , identifier[other] operator[SEP] operator[SEP]
}
|
public static <T1, T2, T3> Consumer<Tuple3<T1, T2, T3>> consumer(Consumer3<T1, T2, T3> consumer) {
return tuple -> consumer.accept(tuple.getT1(), tuple.getT2(), tuple.getT3());
}
|
class class_name[name] begin[{]
method[consumer, return_type[type[Consumer]], modifier[public static], parameter[consumer]] begin[{]
return[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getT1, postfix_operators=[], prefix_operators=[], qualifier=tuple, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getT2, postfix_operators=[], prefix_operators=[], qualifier=tuple, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getT3, postfix_operators=[], prefix_operators=[], qualifier=tuple, selectors=[], type_arguments=None)], member=accept, postfix_operators=[], prefix_operators=[], qualifier=consumer, selectors=[], type_arguments=None), parameters=[MemberReference(member=tuple, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T1] , identifier[T2] , identifier[T3] operator[>] identifier[Consumer] operator[<] identifier[Tuple3] operator[<] identifier[T1] , identifier[T2] , identifier[T3] operator[>] operator[>] identifier[consumer] operator[SEP] identifier[Consumer3] operator[<] identifier[T1] , identifier[T2] , identifier[T3] operator[>] identifier[consumer] operator[SEP] {
Keyword[return] identifier[tuple] operator[->] identifier[consumer] operator[SEP] identifier[accept] operator[SEP] identifier[tuple] operator[SEP] identifier[getT1] operator[SEP] operator[SEP] , identifier[tuple] operator[SEP] identifier[getT2] operator[SEP] operator[SEP] , identifier[tuple] operator[SEP] identifier[getT3] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public boolean cancelOrder(String orderId) throws IOException {
CurrencyPair cp =
(CurrencyPair)
exchange
.getExchangeSpecification()
.getExchangeSpecificParameters()
.get(TheRockExchange.CURRENCY_PAIR);
if (cp == null) {
throw new ExchangeException("Provide TheRockCancelOrderParams with orderId and currencyPair");
}
return cancelOrder(cp, orderId);
}
|
class class_name[name] begin[{]
method[cancelOrder, return_type[type[boolean]], modifier[public], parameter[orderId]] begin[{]
local_variable[type[CurrencyPair], cp]
if[binary_operation[member[.cp], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Provide TheRockCancelOrderParams with orderId and currencyPair")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExchangeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.cancelOrder, parameter[member[.cp], member[.orderId]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[cancelOrder] operator[SEP] identifier[String] identifier[orderId] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[CurrencyPair] identifier[cp] operator[=] operator[SEP] identifier[CurrencyPair] operator[SEP] identifier[exchange] operator[SEP] identifier[getExchangeSpecification] operator[SEP] operator[SEP] operator[SEP] identifier[getExchangeSpecificParameters] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[TheRockExchange] operator[SEP] identifier[CURRENCY_PAIR] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cp] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ExchangeException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[cancelOrder] operator[SEP] identifier[cp] , identifier[orderId] operator[SEP] operator[SEP]
}
|
public synchronized void reloadRulebase() throws RuleBaseException {
long start = System.currentTimeMillis();
reloadDeclarations();
packageStrings.clear();
for (RuleBaseElementId id : manager.listAll(RuleBaseElementType.Function)) {
String packageName = id.getPackageName();
StringBuffer packageString = getPackageString(packageName);
String code = manager.get(id);
packageString.append(code);
}
for (RuleBaseElementId id : manager.listAll(RuleBaseElementType.Rule)) {
String packageName = id.getPackageName();
StringBuffer packageString = getPackageString(packageName);
String code = manager.get(id);
String formattedRule = String.format(RULE_TEMPLATE, id.getName(), code);
packageString.append(formattedRule);
}
for (RuleBaseElementId id : manager.listAll(RuleBaseElementType.Process)) {
getPackageString(id.getPackageName());
}
Collection<KnowledgePackage> compiledPackages = new HashSet<KnowledgePackage>();
if (packageStrings.isEmpty()) {
Set<String> emptySet = Collections.emptySet();
compiledPackages.addAll(compileDrlString("package dummy;\n" + declarations, emptySet));
} else {
for (Map.Entry<String, StringBuffer> entry : packageStrings.entrySet()) {
String packageName = entry.getKey();
StringBuffer drlCode = entry.getValue();
Collection<String> flows = queryFlows(packageName);
Collection<KnowledgePackage> compiledDrlPackage = compileDrlString(drlCode.toString(), flows);
compiledPackages.addAll(compiledDrlPackage);
}
}
lockRuleBase();
clearRulebase();
base.addKnowledgePackages(compiledPackages);
unlockRuleBase();
LOGGER.info("Reloading the rulebase took {}ms", System.currentTimeMillis() - start);
}
|
class class_name[name] begin[{]
method[reloadRulebase, return_type[void], modifier[synchronized public], parameter[]] begin[{]
local_variable[type[long], start]
call[.reloadDeclarations, parameter[]]
call[packageStrings.clear, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPackageName, postfix_operators=[], prefix_operators=[], qualifier=id, selectors=[], type_arguments=None), name=packageName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=packageName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPackageString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=packageString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuffer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[], type_arguments=None), name=code)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=code, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=packageString, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=Function, postfix_operators=[], prefix_operators=[], qualifier=RuleBaseElementType, selectors=[])], member=listAll, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RuleBaseElementId, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPackageName, postfix_operators=[], prefix_operators=[], qualifier=id, selectors=[], type_arguments=None), name=packageName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=packageName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPackageString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=packageString)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuffer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[], type_arguments=None), name=code)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=RULE_TEMPLATE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=id, selectors=[], type_arguments=None), MemberReference(member=code, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None), name=formattedRule)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=formattedRule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=append, postfix_operators=[], prefix_operators=[], qualifier=packageString, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=Rule, postfix_operators=[], prefix_operators=[], qualifier=RuleBaseElementType, selectors=[])], member=listAll, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RuleBaseElementId, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPackageName, postfix_operators=[], prefix_operators=[], qualifier=id, selectors=[], type_arguments=None)], member=getPackageString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=Process, postfix_operators=[], prefix_operators=[], qualifier=RuleBaseElementType, selectors=[])], member=listAll, postfix_operators=[], prefix_operators=[], qualifier=manager, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=id)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RuleBaseElementId, sub_type=None))), label=None)
local_variable[type[Collection], compiledPackages]
if[call[packageStrings.isEmpty, parameter[]]] begin[{]
local_variable[type[Set], emptySet]
call[compiledPackages.addAll, parameter[call[.compileDrlString, parameter[binary_operation[literal["package dummy;\n"], +, member[.declarations]], member[.emptySet]]]]]
else begin[{]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getKey, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=packageName)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=entry, selectors=[], type_arguments=None), name=drlCode)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StringBuffer, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=packageName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=queryFlows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=flows)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=drlCode, selectors=[], type_arguments=None), MemberReference(member=flows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=compileDrlString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=compiledDrlPackage)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=KnowledgePackage, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=compiledDrlPackage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addAll, postfix_operators=[], prefix_operators=[], qualifier=compiledPackages, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=entrySet, postfix_operators=[], prefix_operators=[], qualifier=packageStrings, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=entry)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Map, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=StringBuffer, sub_type=None))], dimensions=None, name=Entry, sub_type=None)))), label=None)
end[}]
call[.lockRuleBase, parameter[]]
call[.clearRulebase, parameter[]]
call[base.addKnowledgePackages, parameter[member[.compiledPackages]]]
call[.unlockRuleBase, parameter[]]
call[LOGGER.info, parameter[literal["Reloading the rulebase took {}ms"], binary_operation[call[System.currentTimeMillis, parameter[]], -, member[.start]]]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[void] identifier[reloadRulebase] operator[SEP] operator[SEP] Keyword[throws] identifier[RuleBaseException] {
Keyword[long] identifier[start] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[reloadDeclarations] operator[SEP] operator[SEP] operator[SEP] identifier[packageStrings] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[RuleBaseElementId] identifier[id] operator[:] identifier[manager] operator[SEP] identifier[listAll] operator[SEP] identifier[RuleBaseElementType] operator[SEP] identifier[Function] operator[SEP] operator[SEP] {
identifier[String] identifier[packageName] operator[=] identifier[id] operator[SEP] identifier[getPackageName] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[packageString] operator[=] identifier[getPackageString] operator[SEP] identifier[packageName] operator[SEP] operator[SEP] identifier[String] identifier[code] operator[=] identifier[manager] operator[SEP] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[packageString] operator[SEP] identifier[append] operator[SEP] identifier[code] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[RuleBaseElementId] identifier[id] operator[:] identifier[manager] operator[SEP] identifier[listAll] operator[SEP] identifier[RuleBaseElementType] operator[SEP] identifier[Rule] operator[SEP] operator[SEP] {
identifier[String] identifier[packageName] operator[=] identifier[id] operator[SEP] identifier[getPackageName] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[packageString] operator[=] identifier[getPackageString] operator[SEP] identifier[packageName] operator[SEP] operator[SEP] identifier[String] identifier[code] operator[=] identifier[manager] operator[SEP] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP] identifier[String] identifier[formattedRule] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[RULE_TEMPLATE] , identifier[id] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[code] operator[SEP] operator[SEP] identifier[packageString] operator[SEP] identifier[append] operator[SEP] identifier[formattedRule] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[RuleBaseElementId] identifier[id] operator[:] identifier[manager] operator[SEP] identifier[listAll] operator[SEP] identifier[RuleBaseElementType] operator[SEP] identifier[Process] operator[SEP] operator[SEP] {
identifier[getPackageString] operator[SEP] identifier[id] operator[SEP] identifier[getPackageName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Collection] operator[<] identifier[KnowledgePackage] operator[>] identifier[compiledPackages] operator[=] Keyword[new] identifier[HashSet] operator[<] identifier[KnowledgePackage] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[packageStrings] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[emptySet] operator[=] identifier[Collections] operator[SEP] identifier[emptySet] operator[SEP] operator[SEP] operator[SEP] identifier[compiledPackages] operator[SEP] identifier[addAll] operator[SEP] identifier[compileDrlString] operator[SEP] literal[String] operator[+] identifier[declarations] , identifier[emptySet] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[for] operator[SEP] identifier[Map] operator[SEP] identifier[Entry] operator[<] identifier[String] , identifier[StringBuffer] operator[>] identifier[entry] operator[:] identifier[packageStrings] operator[SEP] identifier[entrySet] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[packageName] operator[=] identifier[entry] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[drlCode] operator[=] identifier[entry] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[String] operator[>] identifier[flows] operator[=] identifier[queryFlows] operator[SEP] identifier[packageName] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[KnowledgePackage] operator[>] identifier[compiledDrlPackage] operator[=] identifier[compileDrlString] operator[SEP] identifier[drlCode] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[flows] operator[SEP] operator[SEP] identifier[compiledPackages] operator[SEP] identifier[addAll] operator[SEP] identifier[compiledDrlPackage] operator[SEP] operator[SEP]
}
}
identifier[lockRuleBase] operator[SEP] operator[SEP] operator[SEP] identifier[clearRulebase] operator[SEP] operator[SEP] operator[SEP] identifier[base] operator[SEP] identifier[addKnowledgePackages] operator[SEP] identifier[compiledPackages] operator[SEP] operator[SEP] identifier[unlockRuleBase] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] , identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[start] operator[SEP] operator[SEP]
}
|
public void setPattern(Tag tag, String regex) {
if (Strings.isNullOrEmpty(regex)) {
this.rawPatterns.remove(tag);
this.compiledPatterns.remove(tag);
} else {
this.rawPatterns.put(tag, regex);
this.compiledPatterns.put(tag, Pattern.compile("^\\s*" + regex, PATTERN_COMPILE_OPTIONS)); //$NON-NLS-1$
}
}
|
class class_name[name] begin[{]
method[setPattern, return_type[void], modifier[public], parameter[tag, regex]] begin[{]
if[call[Strings.isNullOrEmpty, parameter[member[.regex]]]] begin[{]
THIS[member[None.rawPatterns]call[None.remove, parameter[member[.tag]]]]
THIS[member[None.compiledPatterns]call[None.remove, parameter[member[.tag]]]]
else begin[{]
THIS[member[None.rawPatterns]call[None.put, parameter[member[.tag], member[.regex]]]]
THIS[member[None.compiledPatterns]call[None.put, parameter[member[.tag], call[Pattern.compile, parameter[binary_operation[literal["^\\s*"], +, member[.regex]], member[.PATTERN_COMPILE_OPTIONS]]]]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setPattern] operator[SEP] identifier[Tag] identifier[tag] , identifier[String] identifier[regex] operator[SEP] {
Keyword[if] operator[SEP] identifier[Strings] operator[SEP] identifier[isNullOrEmpty] operator[SEP] identifier[regex] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[rawPatterns] operator[SEP] identifier[remove] operator[SEP] identifier[tag] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[compiledPatterns] operator[SEP] identifier[remove] operator[SEP] identifier[tag] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[this] operator[SEP] identifier[rawPatterns] operator[SEP] identifier[put] operator[SEP] identifier[tag] , identifier[regex] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[compiledPatterns] operator[SEP] identifier[put] operator[SEP] identifier[tag] , identifier[Pattern] operator[SEP] identifier[compile] operator[SEP] literal[String] operator[+] identifier[regex] , identifier[PATTERN_COMPILE_OPTIONS] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static String getDescription(Class<?> comp, Locale loc) {
Description descr = (Description) comp.getAnnotation(Description.class);
if (descr != null) {
String lang = loc.getLanguage();
Method[] m = descr.getClass().getMethods();
for (Method method : m) {
// System.out.println(method);
if (method.getName().equals(lang)) {
try {
String d = (String) method.invoke(descr, (Object[]) null);
if (d != null && !d.isEmpty()) {
return d;
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
return descr.value();
}
return null;
}
|
class class_name[name] begin[{]
method[getDescription, return_type[type[String]], modifier[public static], parameter[comp, loc]] begin[{]
local_variable[type[Description], descr]
if[binary_operation[member[.descr], !=, literal[null]]] begin[{]
local_variable[type[String], lang]
local_variable[type[Method], m]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[MethodInvocation(arguments=[MemberReference(member=lang, 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=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MethodInvocation(arguments=[MemberReference(member=descr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Cast(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), type=ReferenceType(arguments=None, dimensions=[None], name=Object, sub_type=None))], member=invoke, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), name=d)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=d, 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=d, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=d, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=m, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=method)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Method, sub_type=None))), label=None)
return[call[descr.value, parameter[]]]
else begin[{]
None
end[}]
return[literal[null]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getDescription] operator[SEP] identifier[Class] operator[<] operator[?] operator[>] identifier[comp] , identifier[Locale] identifier[loc] operator[SEP] {
identifier[Description] identifier[descr] operator[=] operator[SEP] identifier[Description] operator[SEP] identifier[comp] operator[SEP] identifier[getAnnotation] operator[SEP] identifier[Description] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[descr] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[lang] operator[=] identifier[loc] operator[SEP] identifier[getLanguage] operator[SEP] operator[SEP] operator[SEP] identifier[Method] operator[SEP] operator[SEP] identifier[m] operator[=] identifier[descr] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[getMethods] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Method] identifier[method] operator[:] identifier[m] operator[SEP] {
Keyword[if] operator[SEP] identifier[method] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[lang] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[String] identifier[d] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[method] operator[SEP] identifier[invoke] operator[SEP] identifier[descr] , operator[SEP] identifier[Object] operator[SEP] operator[SEP] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[d] operator[!=] Other[null] operator[&&] operator[!] identifier[d] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[d] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[ex] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[return] identifier[descr] operator[SEP] identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Other[null] operator[SEP]
}
|
public Date createDate(String dateString) throws ParseException {
Date result = null;
synchronized (cFormatter) {
result = cFormatter.parse(dateString);
}
return result;
}
|
class class_name[name] begin[{]
method[createDate, return_type[type[Date]], modifier[public], parameter[dateString]] begin[{]
local_variable[type[Date], result]
SYNCHRONIZED[member[.cFormatter]] BEGIN[{]
assign[member[.result], call[cFormatter.parse, parameter[member[.dateString]]]]
END[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[public] identifier[Date] identifier[createDate] operator[SEP] identifier[String] identifier[dateString] operator[SEP] Keyword[throws] identifier[ParseException] {
identifier[Date] identifier[result] operator[=] Other[null] operator[SEP] Keyword[synchronized] operator[SEP] identifier[cFormatter] operator[SEP] {
identifier[result] operator[=] identifier[cFormatter] operator[SEP] identifier[parse] operator[SEP] identifier[dateString] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
@Override
public boolean importGeoPackage(String database, InputStream stream) {
return importGeoPackage(database, stream, false, null);
}
|
class class_name[name] begin[{]
method[importGeoPackage, return_type[type[boolean]], modifier[public], parameter[database, stream]] begin[{]
return[call[.importGeoPackage, parameter[member[.database], member[.stream], literal[false], literal[null]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[importGeoPackage] operator[SEP] identifier[String] identifier[database] , identifier[InputStream] identifier[stream] operator[SEP] {
Keyword[return] identifier[importGeoPackage] operator[SEP] identifier[database] , identifier[stream] , literal[boolean] , Other[null] operator[SEP] operator[SEP]
}
|
public static MSColor valueOfKnownColor(final String name) {
for(MSColor color : KNOWN_COLORS) {
if(color.name.equalsIgnoreCase(name)) {
return color;
} else if(color.getLocaleName() != null && color.getLocaleName().equalsIgnoreCase(name)) {
return color;
}
}
return null;
}
|
class class_name[name] begin[{]
method[valueOfKnownColor, return_type[type[MSColor]], modifier[public static], parameter[name]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=color.name, selectors=[], type_arguments=None), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getLocaleName, postfix_operators=[], prefix_operators=[], qualifier=color, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[], member=getLocaleName, postfix_operators=[], prefix_operators=[], qualifier=color, 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), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=color, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=color, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=KNOWN_COLORS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=color)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=MSColor, sub_type=None))), label=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[MSColor] identifier[valueOfKnownColor] operator[SEP] Keyword[final] identifier[String] identifier[name] operator[SEP] {
Keyword[for] operator[SEP] identifier[MSColor] identifier[color] operator[:] identifier[KNOWN_COLORS] operator[SEP] {
Keyword[if] operator[SEP] identifier[color] operator[SEP] identifier[name] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[color] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[color] operator[SEP] identifier[getLocaleName] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[color] operator[SEP] identifier[getLocaleName] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[name] operator[SEP] operator[SEP] {
Keyword[return] identifier[color] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
public static Font getFont (int style, Size size) {
return getFont(getDefaultFont(), size).deriveFont(style);
}
|
class class_name[name] begin[{]
method[getFont, return_type[type[Font]], modifier[public static], parameter[style, size]] begin[{]
return[call[.getFont, parameter[call[.getDefaultFont, parameter[]], member[.size]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Font] identifier[getFont] operator[SEP] Keyword[int] identifier[style] , identifier[Size] identifier[size] operator[SEP] {
Keyword[return] identifier[getFont] operator[SEP] identifier[getDefaultFont] operator[SEP] operator[SEP] , identifier[size] operator[SEP] operator[SEP] identifier[deriveFont] operator[SEP] identifier[style] operator[SEP] operator[SEP]
}
|
public void unreserve(final T bagEntry)
{
if (bagEntry.compareAndSet(STATE_RESERVED, STATE_NOT_IN_USE)) {
// spin until a thread takes it or none are waiting
while (waiters.get() > 0 && !handoffQueue.offer(bagEntry)) {
yield();
}
}
else {
LOGGER.warn("Attempt to relinquish an object to the bag that was not reserved: {}", bagEntry);
}
}
|
class class_name[name] begin[{]
method[unreserve, return_type[void], modifier[public], parameter[bagEntry]] begin[{]
if[call[bagEntry.compareAndSet, parameter[member[.STATE_RESERVED], member[.STATE_NOT_IN_USE]]]] begin[{]
while[binary_operation[binary_operation[call[waiters.get, parameter[]], >, literal[0]], &&, call[handoffQueue.offer, parameter[member[.bagEntry]]]]] begin[{]
call[.yield, parameter[]]
end[}]
else begin[{]
call[LOGGER.warn, parameter[literal["Attempt to relinquish an object to the bag that was not reserved: {}"], member[.bagEntry]]]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[unreserve] operator[SEP] Keyword[final] identifier[T] identifier[bagEntry] operator[SEP] {
Keyword[if] operator[SEP] identifier[bagEntry] operator[SEP] identifier[compareAndSet] operator[SEP] identifier[STATE_RESERVED] , identifier[STATE_NOT_IN_USE] operator[SEP] operator[SEP] {
Keyword[while] operator[SEP] identifier[waiters] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[>] Other[0] operator[&&] operator[!] identifier[handoffQueue] operator[SEP] identifier[offer] operator[SEP] identifier[bagEntry] operator[SEP] operator[SEP] {
identifier[yield] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[bagEntry] operator[SEP] operator[SEP]
}
}
|
private Table buildRtfTable(int type) throws DocumentException {
List<Band> bands = new ArrayList<Band>();
if (type == 1) {
bands.add(getReportLayout().getPageHeaderBand());
} else if (type == 2) {
bands.add(getReportLayout().getPageFooterBand());
} else {
bands = getReportLayout().getDocumentBands();
}
int totalRows = 0;
int totalColumns = 0;
for (Band band : bands) {
totalRows += band.getRowCount();
int cols = band.getColumnCount();
if (cols > totalColumns) {
totalColumns = cols;
}
}
// no page header or no page footer
if (totalColumns == 0) {
return null;
}
Table datatable = new Table(totalColumns);
int[] headerwidths = new int[totalColumns]; // %
int size = 100 / totalColumns;
int totalWidth = 0;
for (int i = 0; i < totalColumns; i++) {
if (bean.getReportLayout().isUseSize()) {
headerwidths[i] = bean.getReportLayout().getColumnsWidth().get(i);
} else {
headerwidths[i] = size;
}
totalWidth += headerwidths[i];
}
if (bean.getReportLayout().isUseSize()) {
float pixels = A4_PORTRAIT_PIXELS;
if (bean.getReportLayout().getOrientation() == LANDSCAPE) {
pixels = A4_LANDSCAPE_PIXELS;
}
float percentage = totalWidth * 100 / pixels;
// do not allow to go outside an A4 frame
if (percentage > 100) {
percentage = 100;
}
if (!ReportLayout.CUSTOM.equals(bean.getReportLayout().getPageFormat())) {
datatable.setWidth(percentage);
}
datatable.setWidths(headerwidths);
} else {
datatable.setWidth(100);
}
datatable.setPadding(2);
if (type == PRINT_DOCUMENT) {
writeHeader(datatable);
}
return datatable;
}
|
class class_name[name] begin[{]
method[buildRtfTable, return_type[type[Table]], modifier[private], parameter[type]] begin[{]
local_variable[type[List], bands]
if[binary_operation[member[.type], ==, literal[1]]] begin[{]
call[bands.add, parameter[call[.getReportLayout, parameter[]]]]
else begin[{]
if[binary_operation[member[.type], ==, literal[2]]] begin[{]
call[bands.add, parameter[call[.getReportLayout, parameter[]]]]
else begin[{]
assign[member[.bands], call[.getReportLayout, parameter[]]]
end[}]
end[}]
local_variable[type[int], totalRows]
local_variable[type[int], totalColumns]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=totalRows, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getRowCount, postfix_operators=[], prefix_operators=[], qualifier=band, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getColumnCount, postfix_operators=[], prefix_operators=[], qualifier=band, selectors=[], type_arguments=None), name=cols)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=totalColumns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=totalColumns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=cols, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=bands, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=band)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Band, sub_type=None))), label=None)
if[binary_operation[member[.totalColumns], ==, literal[0]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[Table], datatable]
local_variable[type[int], headerwidths]
local_variable[type[int], size]
local_variable[type[int], totalWidth]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[], member=getReportLayout, postfix_operators=[], prefix_operators=[], qualifier=bean, selectors=[MethodInvocation(arguments=[], member=isUseSize, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=headerwidths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=headerwidths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MethodInvocation(arguments=[], member=getReportLayout, postfix_operators=[], prefix_operators=[], qualifier=bean, selectors=[MethodInvocation(arguments=[], member=getColumnsWidth, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=totalWidth, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=headerwidths, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=totalColumns, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
if[call[bean.getReportLayout, parameter[]]] begin[{]
local_variable[type[float], pixels]
if[binary_operation[call[bean.getReportLayout, parameter[]], ==, member[.LANDSCAPE]]] begin[{]
assign[member[.pixels], member[.A4_LANDSCAPE_PIXELS]]
else begin[{]
None
end[}]
local_variable[type[float], percentage]
if[binary_operation[member[.percentage], >, literal[100]]] begin[{]
assign[member[.percentage], literal[100]]
else begin[{]
None
end[}]
if[call[ReportLayout.CUSTOM.equals, parameter[call[bean.getReportLayout, parameter[]]]]] begin[{]
call[datatable.setWidth, parameter[member[.percentage]]]
else begin[{]
None
end[}]
call[datatable.setWidths, parameter[member[.headerwidths]]]
else begin[{]
call[datatable.setWidth, parameter[literal[100]]]
end[}]
call[datatable.setPadding, parameter[literal[2]]]
if[binary_operation[member[.type], ==, member[.PRINT_DOCUMENT]]] begin[{]
call[.writeHeader, parameter[member[.datatable]]]
else begin[{]
None
end[}]
return[member[.datatable]]
end[}]
END[}]
|
Keyword[private] identifier[Table] identifier[buildRtfTable] operator[SEP] Keyword[int] identifier[type] operator[SEP] Keyword[throws] identifier[DocumentException] {
identifier[List] operator[<] identifier[Band] operator[>] identifier[bands] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Band] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] Other[1] operator[SEP] {
identifier[bands] operator[SEP] identifier[add] operator[SEP] identifier[getReportLayout] operator[SEP] operator[SEP] operator[SEP] identifier[getPageHeaderBand] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[==] Other[2] operator[SEP] {
identifier[bands] operator[SEP] identifier[add] operator[SEP] identifier[getReportLayout] operator[SEP] operator[SEP] operator[SEP] identifier[getPageFooterBand] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[bands] operator[=] identifier[getReportLayout] operator[SEP] operator[SEP] operator[SEP] identifier[getDocumentBands] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[totalRows] operator[=] Other[0] operator[SEP] Keyword[int] identifier[totalColumns] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[Band] identifier[band] operator[:] identifier[bands] operator[SEP] {
identifier[totalRows] operator[+=] identifier[band] operator[SEP] identifier[getRowCount] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[cols] operator[=] identifier[band] operator[SEP] identifier[getColumnCount] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cols] operator[>] identifier[totalColumns] operator[SEP] {
identifier[totalColumns] operator[=] identifier[cols] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[totalColumns] operator[==] Other[0] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[Table] identifier[datatable] operator[=] Keyword[new] identifier[Table] operator[SEP] identifier[totalColumns] operator[SEP] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[headerwidths] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[totalColumns] operator[SEP] operator[SEP] Keyword[int] identifier[size] operator[=] Other[100] operator[/] identifier[totalColumns] operator[SEP] Keyword[int] identifier[totalWidth] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[totalColumns] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[bean] operator[SEP] identifier[getReportLayout] operator[SEP] operator[SEP] operator[SEP] identifier[isUseSize] operator[SEP] operator[SEP] operator[SEP] {
identifier[headerwidths] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[bean] operator[SEP] identifier[getReportLayout] operator[SEP] operator[SEP] operator[SEP] identifier[getColumnsWidth] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[headerwidths] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[size] operator[SEP]
}
identifier[totalWidth] operator[+=] identifier[headerwidths] operator[SEP] identifier[i] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[bean] operator[SEP] identifier[getReportLayout] operator[SEP] operator[SEP] operator[SEP] identifier[isUseSize] operator[SEP] operator[SEP] operator[SEP] {
Keyword[float] identifier[pixels] operator[=] identifier[A4_PORTRAIT_PIXELS] operator[SEP] Keyword[if] operator[SEP] identifier[bean] operator[SEP] identifier[getReportLayout] operator[SEP] operator[SEP] operator[SEP] identifier[getOrientation] operator[SEP] operator[SEP] operator[==] identifier[LANDSCAPE] operator[SEP] {
identifier[pixels] operator[=] identifier[A4_LANDSCAPE_PIXELS] operator[SEP]
}
Keyword[float] identifier[percentage] operator[=] identifier[totalWidth] operator[*] Other[100] operator[/] identifier[pixels] operator[SEP] Keyword[if] operator[SEP] identifier[percentage] operator[>] Other[100] operator[SEP] {
identifier[percentage] operator[=] Other[100] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[ReportLayout] operator[SEP] identifier[CUSTOM] operator[SEP] identifier[equals] operator[SEP] identifier[bean] operator[SEP] identifier[getReportLayout] operator[SEP] operator[SEP] operator[SEP] identifier[getPageFormat] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[datatable] operator[SEP] identifier[setWidth] operator[SEP] identifier[percentage] operator[SEP] operator[SEP]
}
identifier[datatable] operator[SEP] identifier[setWidths] operator[SEP] identifier[headerwidths] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[datatable] operator[SEP] identifier[setWidth] operator[SEP] Other[100] operator[SEP] operator[SEP]
}
identifier[datatable] operator[SEP] identifier[setPadding] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[PRINT_DOCUMENT] operator[SEP] {
identifier[writeHeader] operator[SEP] identifier[datatable] operator[SEP] operator[SEP]
}
Keyword[return] identifier[datatable] operator[SEP]
}
|
private final T get(int index, List<T> array) {
while (index >= array.size()) {
array.add(this.createNode());
}
return array.get(index);
}
|
class class_name[name] begin[{]
method[get, return_type[type[T]], modifier[final private], parameter[index, array]] begin[{]
while[binary_operation[member[.index], >=, call[array.size, parameter[]]]] begin[{]
call[array.add, parameter[THIS[call[None.createNode, parameter[]]]]]
end[}]
return[call[array.get, parameter[member[.index]]]]
end[}]
END[}]
|
Keyword[private] Keyword[final] identifier[T] identifier[get] operator[SEP] Keyword[int] identifier[index] , identifier[List] operator[<] identifier[T] operator[>] identifier[array] operator[SEP] {
Keyword[while] operator[SEP] identifier[index] operator[>=] identifier[array] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[array] operator[SEP] identifier[add] operator[SEP] Keyword[this] operator[SEP] identifier[createNode] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[array] operator[SEP] identifier[get] operator[SEP] identifier[index] operator[SEP] operator[SEP]
}
|
@Override
public V replace(K key, V value) {
return rMap.replace(key, value);
}
|
class class_name[name] begin[{]
method[replace, return_type[type[V]], modifier[public], parameter[key, value]] begin[{]
return[call[rMap.replace, parameter[member[.key], member[.value]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[V] identifier[replace] operator[SEP] identifier[K] identifier[key] , identifier[V] identifier[value] operator[SEP] {
Keyword[return] identifier[rMap] operator[SEP] identifier[replace] operator[SEP] identifier[key] , identifier[value] operator[SEP] operator[SEP]
}
|
public void end(Point p) {
lastPt.x = endPt.x = p.x;
lastPt.y = endPt.y = p.y;
Graphics2D g = (Graphics2D) component.getGraphics();
if(g != null) {
try {
g.setXORMode(component.getBackground());
drawLast(g);
}
finally {
g.dispose();
}
}
}
|
class class_name[name] begin[{]
method[end, return_type[void], modifier[public], parameter[p]] begin[{]
assign[member[lastPt.x], assign[member[endPt.x], member[p.x]]]
assign[member[lastPt.y], assign[member[endPt.y], member[p.y]]]
local_variable[type[Graphics2D], g]
if[binary_operation[member[.g], !=, literal[null]]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getBackground, postfix_operators=[], prefix_operators=[], qualifier=component, selectors=[], type_arguments=None)], member=setXORMode, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=g, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=drawLast, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=dispose, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[end] operator[SEP] identifier[Point] identifier[p] operator[SEP] {
identifier[lastPt] operator[SEP] identifier[x] operator[=] identifier[endPt] operator[SEP] identifier[x] operator[=] identifier[p] operator[SEP] identifier[x] operator[SEP] identifier[lastPt] operator[SEP] identifier[y] operator[=] identifier[endPt] operator[SEP] identifier[y] operator[=] identifier[p] operator[SEP] identifier[y] operator[SEP] identifier[Graphics2D] identifier[g] operator[=] operator[SEP] identifier[Graphics2D] operator[SEP] identifier[component] operator[SEP] identifier[getGraphics] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[g] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[g] operator[SEP] identifier[setXORMode] operator[SEP] identifier[component] operator[SEP] identifier[getBackground] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[drawLast] operator[SEP] identifier[g] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[g] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
@OneToMany(targetEntity = CountryElement.class, cascade = { CascadeType.ALL })
@JoinColumn(name = "COUNTRY_COUNTRIES_ELEMENT_HJ_0")
public List<CountryElement> getCountry() {
return this.country;
}
|
class class_name[name] begin[{]
method[getCountry, return_type[type[List]], modifier[public], parameter[]] begin[{]
return[THIS[member[None.country]]]
end[}]
END[}]
|
annotation[@] identifier[OneToMany] operator[SEP] identifier[targetEntity] operator[=] identifier[CountryElement] operator[SEP] Keyword[class] , identifier[cascade] operator[=] {
identifier[CascadeType] operator[SEP] identifier[ALL]
} operator[SEP] annotation[@] identifier[JoinColumn] operator[SEP] identifier[name] operator[=] literal[String] operator[SEP] Keyword[public] identifier[List] operator[<] identifier[CountryElement] operator[>] identifier[getCountry] operator[SEP] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP] identifier[country] operator[SEP]
}
|
@XmlElementDecl(namespace = "http://www.opengis.net/gml", name = "OrientableSurface", substitutionHeadNamespace = "http://www.opengis.net/gml", substitutionHeadName = "_Surface")
public JAXBElement<OrientableSurfaceType> createOrientableSurface(OrientableSurfaceType value) {
return new JAXBElement<OrientableSurfaceType>(_OrientableSurface_QNAME, OrientableSurfaceType.class, null, value);
}
|
class class_name[name] begin[{]
method[createOrientableSurface, return_type[type[JAXBElement]], modifier[public], parameter[value]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=_OrientableSurface_QNAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OrientableSurfaceType, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=OrientableSurfaceType, sub_type=None))], dimensions=None, name=JAXBElement, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[XmlElementDecl] operator[SEP] identifier[namespace] operator[=] literal[String] , identifier[name] operator[=] literal[String] , identifier[substitutionHeadNamespace] operator[=] literal[String] , identifier[substitutionHeadName] operator[=] literal[String] operator[SEP] Keyword[public] identifier[JAXBElement] operator[<] identifier[OrientableSurfaceType] operator[>] identifier[createOrientableSurface] operator[SEP] identifier[OrientableSurfaceType] identifier[value] operator[SEP] {
Keyword[return] Keyword[new] identifier[JAXBElement] operator[<] identifier[OrientableSurfaceType] operator[>] operator[SEP] identifier[_OrientableSurface_QNAME] , identifier[OrientableSurfaceType] operator[SEP] Keyword[class] , Other[null] , identifier[value] operator[SEP] operator[SEP]
}
|
public String getValue(final String field)
{
FieldValue fieldValue = Iterables.find
(
fieldValues,
new Predicate<FieldValue>()
{
@Override
public boolean apply(FieldValue fv)
{
return fv.getField().equals(field);
}
},
null
);
return (fieldValue != null) ? fieldValue.getValue() : null;
}
|
class class_name[name] begin[{]
method[getValue, return_type[type[String]], modifier[public], parameter[field]] begin[{]
local_variable[type[FieldValue], fieldValue]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=fieldValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=fieldValue, selectors=[], type_arguments=None))]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getValue] operator[SEP] Keyword[final] identifier[String] identifier[field] operator[SEP] {
identifier[FieldValue] identifier[fieldValue] operator[=] identifier[Iterables] operator[SEP] identifier[find] operator[SEP] identifier[fieldValues] , Keyword[new] identifier[Predicate] operator[<] identifier[FieldValue] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[boolean] identifier[apply] operator[SEP] identifier[FieldValue] identifier[fv] operator[SEP] {
Keyword[return] identifier[fv] operator[SEP] identifier[getField] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[field] operator[SEP] operator[SEP]
}
} , Other[null] operator[SEP] operator[SEP] Keyword[return] operator[SEP] identifier[fieldValue] operator[!=] Other[null] operator[SEP] operator[?] identifier[fieldValue] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP]
}
|
protected String eval(final Object[] _values)
{
final String ret;
if ((_values == null) || (_values.length == 0) || (_values[0] == null)) {
ret = null;
} else if (_values[0] instanceof String) {
ret = (String) _values[0];
} else if (_values[0] != null) {
ret = _values[0].toString();
} else {
ret = null;
}
return ret;
}
|
class class_name[name] begin[{]
method[eval, return_type[type[String]], modifier[protected], parameter[_values]] begin[{]
local_variable[type[String], ret]
if[binary_operation[binary_operation[binary_operation[member[._values], ==, literal[null]], ||, binary_operation[member[_values.length], ==, literal[0]]], ||, binary_operation[member[._values], ==, literal[null]]]] begin[{]
assign[member[.ret], literal[null]]
else begin[{]
if[binary_operation[member[._values], instanceof, type[String]]] begin[{]
assign[member[.ret], Cast(expression=MemberReference(member=_values, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))]), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]
else begin[{]
if[binary_operation[member[._values], !=, literal[null]]] begin[{]
assign[member[.ret], member[._values]]
else begin[{]
assign[member[.ret], literal[null]]
end[}]
end[}]
end[}]
return[member[.ret]]
end[}]
END[}]
|
Keyword[protected] identifier[String] identifier[eval] operator[SEP] Keyword[final] identifier[Object] operator[SEP] operator[SEP] identifier[_values] operator[SEP] {
Keyword[final] identifier[String] identifier[ret] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[_values] operator[==] Other[null] operator[SEP] operator[||] operator[SEP] identifier[_values] operator[SEP] identifier[length] operator[==] Other[0] operator[SEP] operator[||] operator[SEP] identifier[_values] operator[SEP] Other[0] operator[SEP] operator[==] Other[null] operator[SEP] operator[SEP] {
identifier[ret] operator[=] Other[null] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[_values] operator[SEP] Other[0] operator[SEP] Keyword[instanceof] identifier[String] operator[SEP] {
identifier[ret] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[_values] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[_values] operator[SEP] Other[0] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[ret] operator[=] identifier[_values] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[ret] operator[=] Other[null] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP]
}
|
@Override
public void onNext(CreateLocalBlockRequest request) {
final String methodName = request.getOnlyReserveSpace() ? "ReserveSpace" : "CreateBlock";
RpcUtils.streamingRPCAndLog(LOG, new RpcUtils.StreamingRpcCallable<CreateLocalBlockResponse>() {
@Override
public CreateLocalBlockResponse call() throws Exception {
if (request.getOnlyReserveSpace()) {
mBlockWorker.requestSpace(mSessionId, request.getBlockId(), request.getSpaceToReserve());
return CreateLocalBlockResponse.newBuilder().build();
} else {
Preconditions.checkState(mRequest == null);
mRequest = request;
if (mSessionId == INVALID_SESSION_ID) {
mSessionId = IdUtils.createSessionId();
String path = mBlockWorker.createBlock(mSessionId, request.getBlockId(),
mStorageTierAssoc.getAlias(request.getTier()), request.getSpaceToReserve());
CreateLocalBlockResponse response =
CreateLocalBlockResponse.newBuilder().setPath(path).build();
return response;
} else {
LOG.warn("Create block {} without closing the previous session {}.",
request.getBlockId(), mSessionId);
throw new InvalidWorkerStateException(
ExceptionMessage.SESSION_NOT_CLOSED.getMessage(mSessionId));
}
}
}
@Override
public void exceptionCaught(Throwable throwable) {
if (mSessionId != INVALID_SESSION_ID) {
// In case the client is a UfsFallbackDataWriter, DO NOT clean the temp blocks.
if (throwable instanceof alluxio.exception.WorkerOutOfSpaceException
&& request.hasCleanupOnFailure() && !request.getCleanupOnFailure()) {
mResponseObserver.onError(GrpcExceptionUtils.fromThrowable(throwable));
return;
}
mBlockWorker.cleanupSession(mSessionId);
mSessionId = INVALID_SESSION_ID;
}
mResponseObserver.onError(GrpcExceptionUtils.fromThrowable(throwable));
}
}, methodName, true, false, mResponseObserver, "Session=%d, Request=%s", mSessionId, request);
}
|
class class_name[name] begin[{]
method[onNext, return_type[void], modifier[public], parameter[request]] begin[{]
local_variable[type[String], methodName]
call[RpcUtils.streamingRPCAndLog, parameter[member[.LOG], ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=MethodInvocation(arguments=[], member=getOnlyReserveSpace, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=mRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===)], member=checkState, postfix_operators=[], prefix_operators=[], qualifier=Preconditions, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=mSessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=INVALID_SESSION_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Create block {} without closing the previous session {}."), MethodInvocation(arguments=[], member=getBlockId, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), MemberReference(member=mSessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=mSessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=ExceptionMessage.SESSION_NOT_CLOSED, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InvalidWorkerStateException, sub_type=None)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mSessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=createSessionId, postfix_operators=[], prefix_operators=[], qualifier=IdUtils, selectors=[], type_arguments=None)), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=mSessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getBlockId, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getTier, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None)], member=getAlias, postfix_operators=[], prefix_operators=[], qualifier=mStorageTierAssoc, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getSpaceToReserve, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None)], member=createBlock, postfix_operators=[], prefix_operators=[], qualifier=mBlockWorker, selectors=[], type_arguments=None), name=path)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=CreateLocalBlockResponse, selectors=[MethodInvocation(arguments=[MemberReference(member=path, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setPath, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CreateLocalBlockResponse, sub_type=None)), ReturnStatement(expression=MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mSessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getBlockId, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getSpaceToReserve, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None)], member=requestSpace, postfix_operators=[], prefix_operators=[], qualifier=mBlockWorker, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=CreateLocalBlockResponse, selectors=[MethodInvocation(arguments=[], member=build, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]))], documentation=None, modifiers={'public'}, name=call, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=CreateLocalBlockResponse, sub_type=None), throws=['Exception'], type_parameters=None), MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=mSessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=INVALID_SESSION_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=throwable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=alluxio, sub_type=ReferenceType(arguments=None, dimensions=None, name=exception, sub_type=ReferenceType(arguments=None, dimensions=None, name=WorkerOutOfSpaceException, sub_type=None))), operator=instanceof), operandr=MethodInvocation(arguments=[], member=hasCleanupOnFailure, postfix_operators=[], prefix_operators=[], qualifier=request, selectors=[], type_arguments=None), operator=&&), operandr=MethodInvocation(arguments=[], member=getCleanupOnFailure, postfix_operators=[], prefix_operators=['!'], qualifier=request, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=throwable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromThrowable, postfix_operators=[], prefix_operators=[], qualifier=GrpcExceptionUtils, selectors=[], type_arguments=None)], member=onError, postfix_operators=[], prefix_operators=[], qualifier=mResponseObserver, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=mSessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=cleanupSession, postfix_operators=[], prefix_operators=[], qualifier=mBlockWorker, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mSessionId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=INVALID_SESSION_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=throwable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=fromThrowable, postfix_operators=[], prefix_operators=[], qualifier=GrpcExceptionUtils, selectors=[], type_arguments=None)], member=onError, postfix_operators=[], prefix_operators=[], qualifier=mResponseObserver, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=exceptionCaught, parameters=[FormalParameter(annotations=[], modifiers=set(), name=throwable, type=ReferenceType(arguments=None, dimensions=[], name=Throwable, sub_type=None), varargs=False)], return_type=None, throws=None, type_parameters=None)], constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RpcUtils, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=CreateLocalBlockResponse, sub_type=None))], dimensions=None, name=StreamingRpcCallable, sub_type=None))), member[.methodName], literal[true], literal[false], member[.mResponseObserver], literal["Session=%d, Request=%s"], member[.mSessionId], member[.request]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[onNext] operator[SEP] identifier[CreateLocalBlockRequest] identifier[request] operator[SEP] {
Keyword[final] identifier[String] identifier[methodName] operator[=] identifier[request] operator[SEP] identifier[getOnlyReserveSpace] operator[SEP] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] identifier[RpcUtils] operator[SEP] identifier[streamingRPCAndLog] operator[SEP] identifier[LOG] , Keyword[new] identifier[RpcUtils] operator[SEP] identifier[StreamingRpcCallable] operator[<] identifier[CreateLocalBlockResponse] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[CreateLocalBlockResponse] identifier[call] operator[SEP] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getOnlyReserveSpace] operator[SEP] operator[SEP] operator[SEP] {
identifier[mBlockWorker] operator[SEP] identifier[requestSpace] operator[SEP] identifier[mSessionId] , identifier[request] operator[SEP] identifier[getBlockId] operator[SEP] operator[SEP] , identifier[request] operator[SEP] identifier[getSpaceToReserve] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[CreateLocalBlockResponse] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Preconditions] operator[SEP] identifier[checkState] operator[SEP] identifier[mRequest] operator[==] Other[null] operator[SEP] operator[SEP] identifier[mRequest] operator[=] identifier[request] operator[SEP] Keyword[if] operator[SEP] identifier[mSessionId] operator[==] identifier[INVALID_SESSION_ID] operator[SEP] {
identifier[mSessionId] operator[=] identifier[IdUtils] operator[SEP] identifier[createSessionId] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[path] operator[=] identifier[mBlockWorker] operator[SEP] identifier[createBlock] operator[SEP] identifier[mSessionId] , identifier[request] operator[SEP] identifier[getBlockId] operator[SEP] operator[SEP] , identifier[mStorageTierAssoc] operator[SEP] identifier[getAlias] operator[SEP] identifier[request] operator[SEP] identifier[getTier] operator[SEP] operator[SEP] operator[SEP] , identifier[request] operator[SEP] identifier[getSpaceToReserve] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[CreateLocalBlockResponse] identifier[response] operator[=] identifier[CreateLocalBlockResponse] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setPath] operator[SEP] identifier[path] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
Keyword[else] {
identifier[LOG] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[request] operator[SEP] identifier[getBlockId] operator[SEP] operator[SEP] , identifier[mSessionId] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[InvalidWorkerStateException] operator[SEP] identifier[ExceptionMessage] operator[SEP] identifier[SESSION_NOT_CLOSED] operator[SEP] identifier[getMessage] operator[SEP] identifier[mSessionId] operator[SEP] operator[SEP] operator[SEP]
}
}
} annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[exceptionCaught] operator[SEP] identifier[Throwable] identifier[throwable] operator[SEP] {
Keyword[if] operator[SEP] identifier[mSessionId] operator[!=] identifier[INVALID_SESSION_ID] operator[SEP] {
Keyword[if] operator[SEP] identifier[throwable] Keyword[instanceof] identifier[alluxio] operator[SEP] identifier[exception] operator[SEP] identifier[WorkerOutOfSpaceException] operator[&&] identifier[request] operator[SEP] identifier[hasCleanupOnFailure] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[request] operator[SEP] identifier[getCleanupOnFailure] operator[SEP] operator[SEP] operator[SEP] {
identifier[mResponseObserver] operator[SEP] identifier[onError] operator[SEP] identifier[GrpcExceptionUtils] operator[SEP] identifier[fromThrowable] operator[SEP] identifier[throwable] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[mBlockWorker] operator[SEP] identifier[cleanupSession] operator[SEP] identifier[mSessionId] operator[SEP] operator[SEP] identifier[mSessionId] operator[=] identifier[INVALID_SESSION_ID] operator[SEP]
}
identifier[mResponseObserver] operator[SEP] identifier[onError] operator[SEP] identifier[GrpcExceptionUtils] operator[SEP] identifier[fromThrowable] operator[SEP] identifier[throwable] operator[SEP] operator[SEP] operator[SEP]
}
} , identifier[methodName] , literal[boolean] , literal[boolean] , identifier[mResponseObserver] , literal[String] , identifier[mSessionId] , identifier[request] operator[SEP] operator[SEP]
}
|
public void renderInline(String text, Map<String, Object> parameters, Writer out, GlobalScope... extraGlobalScopes) throws IOException, ParseException {
render(loadInline(text), parameters, out, extraGlobalScopes);
}
|
class class_name[name] begin[{]
method[renderInline, return_type[void], modifier[public], parameter[text, parameters, out, extraGlobalScopes]] begin[{]
call[.render, parameter[call[.loadInline, parameter[member[.text]]], member[.parameters], member[.out], member[.extraGlobalScopes]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[renderInline] operator[SEP] identifier[String] identifier[text] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[parameters] , identifier[Writer] identifier[out] , identifier[GlobalScope] operator[...] identifier[extraGlobalScopes] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ParseException] {
identifier[render] operator[SEP] identifier[loadInline] operator[SEP] identifier[text] operator[SEP] , identifier[parameters] , identifier[out] , identifier[extraGlobalScopes] operator[SEP] operator[SEP]
}
|
@Override
public Acceptance lookup(Word<? extends I> word) {
State s = getState(word);
if (s == null) {
return Acceptance.DONT_KNOW;
}
return s.getAcceptance();
}
|
class class_name[name] begin[{]
method[lookup, return_type[type[Acceptance]], modifier[public], parameter[word]] begin[{]
local_variable[type[State], s]
if[binary_operation[member[.s], ==, literal[null]]] begin[{]
return[member[Acceptance.DONT_KNOW]]
else begin[{]
None
end[}]
return[call[s.getAcceptance, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[Acceptance] identifier[lookup] operator[SEP] identifier[Word] operator[<] operator[?] Keyword[extends] identifier[I] operator[>] identifier[word] operator[SEP] {
identifier[State] identifier[s] operator[=] identifier[getState] operator[SEP] identifier[word] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[Acceptance] operator[SEP] identifier[DONT_KNOW] operator[SEP]
}
Keyword[return] identifier[s] operator[SEP] identifier[getAcceptance] operator[SEP] operator[SEP] operator[SEP]
}
|
public synchronized void serverChanged(final HadoopServer location,
final int type) {
switch (type) {
case ServerRegistry.SERVER_STATE_CHANGED: {
this.provider.refresh(map.get(location));
break;
}
case ServerRegistry.SERVER_ADDED: {
DFSLocation dfsLoc = new DFSLocation(provider, location);
map.put(location, dfsLoc);
this.provider.refresh(this);
break;
}
case ServerRegistry.SERVER_REMOVED: {
map.remove(location);
this.provider.refresh(this);
break;
}
}
}
|
class class_name[name] begin[{]
method[serverChanged, return_type[void], modifier[synchronized public], parameter[location, type]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=SERVER_STATE_CHANGED, postfix_operators=[], prefix_operators=[], qualifier=ServerRegistry, selectors=[])], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=provider, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None)], member=refresh, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[MemberReference(member=SERVER_ADDED, postfix_operators=[], prefix_operators=[], qualifier=ServerRegistry, selectors=[])], statements=[BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=provider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=location, 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=DFSLocation, sub_type=None)), name=dfsLoc)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DFSLocation, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=dfsLoc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=provider, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=refresh, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), BreakStatement(goto=None, label=None)])]), SwitchStatementCase(case=[MemberReference(member=SERVER_REMOVED, postfix_operators=[], prefix_operators=[], qualifier=ServerRegistry, selectors=[])], statements=[BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=provider, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=refresh, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None), BreakStatement(goto=None, label=None)])])], expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[void] identifier[serverChanged] operator[SEP] Keyword[final] identifier[HadoopServer] identifier[location] , Keyword[final] Keyword[int] identifier[type] operator[SEP] {
Keyword[switch] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[ServerRegistry] operator[SEP] identifier[SERVER_STATE_CHANGED] operator[:] {
Keyword[this] operator[SEP] identifier[provider] operator[SEP] identifier[refresh] operator[SEP] identifier[map] operator[SEP] identifier[get] operator[SEP] identifier[location] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[case] identifier[ServerRegistry] operator[SEP] identifier[SERVER_ADDED] operator[:] {
identifier[DFSLocation] identifier[dfsLoc] operator[=] Keyword[new] identifier[DFSLocation] operator[SEP] identifier[provider] , identifier[location] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[location] , identifier[dfsLoc] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[provider] operator[SEP] identifier[refresh] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
Keyword[case] identifier[ServerRegistry] operator[SEP] identifier[SERVER_REMOVED] operator[:] {
identifier[map] operator[SEP] identifier[remove] operator[SEP] identifier[location] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[provider] operator[SEP] identifier[refresh] operator[SEP] Keyword[this] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
}
|
private static boolean containsGreekLetter(String s) {
Matcher m = biogreek.matcher(s);
return m.find();
}
|
class class_name[name] begin[{]
method[containsGreekLetter, return_type[type[boolean]], modifier[private static], parameter[s]] begin[{]
local_variable[type[Matcher], m]
return[call[m.find, parameter[]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[containsGreekLetter] operator[SEP] identifier[String] identifier[s] operator[SEP] {
identifier[Matcher] identifier[m] operator[=] identifier[biogreek] operator[SEP] identifier[matcher] operator[SEP] identifier[s] operator[SEP] operator[SEP] Keyword[return] identifier[m] operator[SEP] identifier[find] operator[SEP] operator[SEP] operator[SEP]
}
|
public static AcceptStatus fromValue(int value) {
AcceptStatus status = VALUES.get(value);
if (status == null) {
status = new AcceptStatus(value);
VALUES.put(value, status);
}
return status;
}
|
class class_name[name] begin[{]
method[fromValue, return_type[type[AcceptStatus]], modifier[public static], parameter[value]] begin[{]
local_variable[type[AcceptStatus], status]
if[binary_operation[member[.status], ==, literal[null]]] begin[{]
assign[member[.status], ClassCreator(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=AcceptStatus, sub_type=None))]
call[VALUES.put, parameter[member[.value], member[.status]]]
else begin[{]
None
end[}]
return[member[.status]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[AcceptStatus] identifier[fromValue] operator[SEP] Keyword[int] identifier[value] operator[SEP] {
identifier[AcceptStatus] identifier[status] operator[=] identifier[VALUES] operator[SEP] identifier[get] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[status] operator[==] Other[null] operator[SEP] {
identifier[status] operator[=] Keyword[new] identifier[AcceptStatus] operator[SEP] identifier[value] operator[SEP] operator[SEP] identifier[VALUES] operator[SEP] identifier[put] operator[SEP] identifier[value] , identifier[status] operator[SEP] operator[SEP]
}
Keyword[return] identifier[status] operator[SEP]
}
|
public BinarySparseDataset parse(String name, InputStream stream) throws IOException, ParseException {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
BinarySparseDataset sparse = new BinarySparseDataset(name);
String line = reader.readLine();
if (line == null) {
throw new IOException("Empty data source.");
}
Set<Integer> items = new HashSet<>();
do {
line = line.trim();
if (line.isEmpty()) {
continue;
}
String[] s = line.split("\\s+");
items.clear();
for (int i = 0; i < s.length; i++) {
items.add(Integer.parseInt(s[i]));
}
int j = 0;
int[] point = new int[items.size()];
for (int i : items) {
point[j++] = i;
}
Arrays.sort(point);
sparse.add(point);
line = reader.readLine();
} while (line != null);
return sparse;
}
}
|
class class_name[name] begin[{]
method[parse, return_type[type[BinarySparseDataset]], modifier[public], parameter[name, stream]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BinarySparseDataset, sub_type=None)), name=sparse)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BinarySparseDataset, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None), name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Empty data source.")], 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=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=HashSet, sub_type=None)), name=items)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Integer, sub_type=None))], dimensions=[], name=Set, sub_type=None)), DoStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None)), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\s+")], member=split, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[None], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=clear, postfix_operators=[], prefix_operators=[], qualifier=items, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=parseInt, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=items, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=items, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=int)), name=point)], modifiers=set(), type=BasicType(dimensions=[None], name=int)), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=point, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=j, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=items, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int))), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=point, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=sort, postfix_operators=[], prefix_operators=[], qualifier=Arrays, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=point, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=sparse, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=readLine, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None)), label=None)]), condition=BinaryOperation(operandl=MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None), ReturnStatement(expression=MemberReference(member=sparse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=reader, type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None), value=ClassCreator(arguments=[ClassCreator(arguments=[MemberReference(member=stream, 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=InputStreamReader, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BufferedReader, sub_type=None)))])
end[}]
END[}]
|
Keyword[public] identifier[BinarySparseDataset] identifier[parse] operator[SEP] identifier[String] identifier[name] , identifier[InputStream] identifier[stream] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ParseException] {
Keyword[try] operator[SEP] identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] {
identifier[BinarySparseDataset] identifier[sparse] operator[=] Keyword[new] identifier[BinarySparseDataset] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[String] identifier[line] operator[=] identifier[reader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[line] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Set] operator[<] identifier[Integer] operator[>] identifier[items] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[do] {
identifier[line] operator[=] identifier[line] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[line] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[String] operator[SEP] operator[SEP] identifier[s] operator[=] identifier[line] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[items] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[s] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[items] operator[SEP] identifier[add] operator[SEP] identifier[Integer] operator[SEP] identifier[parseInt] operator[SEP] identifier[s] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[j] operator[=] Other[0] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[point] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[items] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[:] identifier[items] operator[SEP] {
identifier[point] operator[SEP] identifier[j] operator[++] operator[SEP] operator[=] identifier[i] operator[SEP]
}
identifier[Arrays] operator[SEP] identifier[sort] operator[SEP] identifier[point] operator[SEP] operator[SEP] identifier[sparse] operator[SEP] identifier[add] operator[SEP] identifier[point] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[reader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[while] operator[SEP] identifier[line] operator[!=] Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[sparse] operator[SEP]
}
}
|
public static Config loadConfig(String heronHome, String configPath,
String releaseFile, String overrideConfigFile) {
Config defaultConfig = loadDefaults(heronHome, configPath);
Config localConfig = Config.toLocalMode(defaultConfig); //to token-substitute the conf paths
Config.Builder cb = Config.newBuilder()
.putAll(defaultConfig)
.putAll(loadConfig(Context.clusterFile(localConfig)))
.putAll(loadConfig(Context.clientFile(localConfig)))
.putAll(loadConfig(Context.healthmgrFile(localConfig)))
.putAll(loadConfig(Context.packingFile(localConfig)))
.putAll(loadConfig(Context.schedulerFile(localConfig)))
.putAll(loadConfig(Context.stateManagerFile(localConfig)))
.putAll(loadConfig(Context.uploaderFile(localConfig)))
.putAll(loadConfig(Context.downloaderFile(localConfig)))
.putAll(loadConfig(Context.statefulConfigFile(localConfig)))
.putAll(loadConfig(releaseFile))
.putAll(loadConfig(overrideConfigFile));
return cb.build();
}
|
class class_name[name] begin[{]
method[loadConfig, return_type[type[Config]], modifier[public static], parameter[heronHome, configPath, releaseFile, overrideConfigFile]] begin[{]
local_variable[type[Config], defaultConfig]
local_variable[type[Config], localConfig]
local_variable[type[Config], cb]
return[call[cb.build, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Config] identifier[loadConfig] operator[SEP] identifier[String] identifier[heronHome] , identifier[String] identifier[configPath] , identifier[String] identifier[releaseFile] , identifier[String] identifier[overrideConfigFile] operator[SEP] {
identifier[Config] identifier[defaultConfig] operator[=] identifier[loadDefaults] operator[SEP] identifier[heronHome] , identifier[configPath] operator[SEP] operator[SEP] identifier[Config] identifier[localConfig] operator[=] identifier[Config] operator[SEP] identifier[toLocalMode] operator[SEP] identifier[defaultConfig] operator[SEP] operator[SEP] identifier[Config] operator[SEP] identifier[Builder] identifier[cb] operator[=] identifier[Config] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[defaultConfig] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[Context] operator[SEP] identifier[clusterFile] operator[SEP] identifier[localConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[Context] operator[SEP] identifier[clientFile] operator[SEP] identifier[localConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[Context] operator[SEP] identifier[healthmgrFile] operator[SEP] identifier[localConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[Context] operator[SEP] identifier[packingFile] operator[SEP] identifier[localConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[Context] operator[SEP] identifier[schedulerFile] operator[SEP] identifier[localConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[Context] operator[SEP] identifier[stateManagerFile] operator[SEP] identifier[localConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[Context] operator[SEP] identifier[uploaderFile] operator[SEP] identifier[localConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[Context] operator[SEP] identifier[downloaderFile] operator[SEP] identifier[localConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[Context] operator[SEP] identifier[statefulConfigFile] operator[SEP] identifier[localConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[releaseFile] operator[SEP] operator[SEP] operator[SEP] identifier[putAll] operator[SEP] identifier[loadConfig] operator[SEP] identifier[overrideConfigFile] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[cb] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String getOneofNotSetConstantName(Oneof oneof) {
String name = oneof.getName();
String underscored = Formatter.toUnderscoreCase(name);
return Formatter.toUpperCase(underscored) + "_NOT_SET";
}
|
class class_name[name] begin[{]
method[getOneofNotSetConstantName, return_type[type[String]], modifier[public static], parameter[oneof]] begin[{]
local_variable[type[String], name]
local_variable[type[String], underscored]
return[binary_operation[call[Formatter.toUpperCase, parameter[member[.underscored]]], +, literal["_NOT_SET"]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[getOneofNotSetConstantName] operator[SEP] identifier[Oneof] identifier[oneof] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[oneof] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[underscored] operator[=] identifier[Formatter] operator[SEP] identifier[toUnderscoreCase] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[return] identifier[Formatter] operator[SEP] identifier[toUpperCase] operator[SEP] identifier[underscored] operator[SEP] operator[+] literal[String] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.