code
stringlengths 63
466k
| code_sememe
stringlengths 141
3.79M
| token_type
stringlengths 274
1.23M
|
|---|---|---|
public void destroy() {
clear();
this.client.operate(null, key, Operation.put(Bin.asNull(binName)));
}
|
class class_name[name] begin[{]
method[destroy, return_type[void], modifier[public], parameter[]] begin[{]
call[.clear, parameter[]]
THIS[member[None.client]call[None.operate, parameter[literal[null], member[.key], call[Operation.put, parameter[call[Bin.asNull, parameter[member[.binName]]]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[destroy] operator[SEP] operator[SEP] {
identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[operate] operator[SEP] Other[null] , identifier[key] , identifier[Operation] operator[SEP] identifier[put] operator[SEP] identifier[Bin] operator[SEP] identifier[asNull] operator[SEP] identifier[binName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected Map<String, List<Object>> getUserInfoFromIndexResult(final ListIndexResult indexResult) {
val attachment = indexResult.getIndexAttachments().stream().findFirst().orElse(null);
if (attachment == null) {
LOGGER.warn("Index result has no attachments");
return null;
}
val identifier = attachment.getObjectIdentifier();
val listObjectAttributesRequest = CloudDirectoryUtils.getListObjectAttributesRequest(properties.getDirectoryArn(), identifier);
if (listObjectAttributesRequest == null) {
LOGGER.warn("No object attribute request is available for identifier [{}]", identifier);
return null;
}
val attributesResult = amazonCloudDirectory.listObjectAttributes(listObjectAttributesRequest);
if (attributesResult == null || attributesResult.getAttributes() == null || attributesResult.getAttributes().isEmpty()) {
LOGGER.warn("No object attribute result is available for identifier [{}] or not attributes are found", identifier);
return null;
}
return attributesResult.getAttributes()
.stream()
.map(a -> {
var value = (Object) null;
val attributeValue = a.getValue();
LOGGER.debug("Examining attribute [{}]", a);
if (StringUtils.isNotBlank(attributeValue.getNumberValue())) {
value = attributeValue.getNumberValue();
} else if (attributeValue.getDatetimeValue() != null) {
value = DateTimeUtils.zonedDateTimeOf(attributeValue.getDatetimeValue()).toString();
} else if (attributeValue.getBooleanValue() != null) {
value = attributeValue.getBooleanValue().toString();
} else if (attributeValue.getBinaryValue() != null) {
value = new String(attributeValue.getBinaryValue().array(), StandardCharsets.UTF_8);
} else if (StringUtils.isNotBlank(attributeValue.getStringValue())) {
value = attributeValue.getStringValue();
}
return Pair.of(a.getKey().getName(), value);
})
.filter(p -> p.getValue() != null)
.collect(Collectors.toMap(Pair::getKey, s -> CollectionUtils.toCollection(s.getValue(), ArrayList.class)));
}
|
class class_name[name] begin[{]
method[getUserInfoFromIndexResult, return_type[type[Map]], modifier[protected], parameter[indexResult]] begin[{]
local_variable[type[val], attachment]
if[binary_operation[member[.attachment], ==, literal[null]]] begin[{]
call[LOGGER.warn, parameter[literal["Index result has no attachments"]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[val], identifier]
local_variable[type[val], listObjectAttributesRequest]
if[binary_operation[member[.listObjectAttributesRequest], ==, literal[null]]] begin[{]
call[LOGGER.warn, parameter[literal["No object attribute request is available for identifier [{}]"], member[.identifier]]]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[val], attributesResult]
if[binary_operation[binary_operation[binary_operation[member[.attributesResult], ==, literal[null]], ||, binary_operation[call[attributesResult.getAttributes, parameter[]], ==, literal[null]]], ||, call[attributesResult.getAttributes, parameter[]]]] begin[{]
call[LOGGER.warn, parameter[literal["No object attribute result is available for identifier [{}] or not attributes are found"], member[.identifier]]]
return[literal[null]]
else begin[{]
None
end[}]
return[call[attributesResult.getAttributes, parameter[]]]
end[}]
END[}]
|
Keyword[protected] identifier[Map] operator[<] identifier[String] , identifier[List] operator[<] identifier[Object] operator[>] operator[>] identifier[getUserInfoFromIndexResult] operator[SEP] Keyword[final] identifier[ListIndexResult] identifier[indexResult] operator[SEP] {
identifier[val] identifier[attachment] operator[=] identifier[indexResult] operator[SEP] identifier[getIndexAttachments] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[findFirst] operator[SEP] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attachment] operator[==] Other[null] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[val] identifier[identifier] operator[=] identifier[attachment] operator[SEP] identifier[getObjectIdentifier] operator[SEP] operator[SEP] operator[SEP] identifier[val] identifier[listObjectAttributesRequest] operator[=] identifier[CloudDirectoryUtils] operator[SEP] identifier[getListObjectAttributesRequest] operator[SEP] identifier[properties] operator[SEP] identifier[getDirectoryArn] operator[SEP] operator[SEP] , identifier[identifier] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[listObjectAttributesRequest] operator[==] Other[null] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[identifier] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
identifier[val] identifier[attributesResult] operator[=] identifier[amazonCloudDirectory] operator[SEP] identifier[listObjectAttributes] operator[SEP] identifier[listObjectAttributesRequest] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[attributesResult] operator[==] Other[null] operator[||] identifier[attributesResult] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[==] Other[null] operator[||] identifier[attributesResult] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warn] operator[SEP] literal[String] , identifier[identifier] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
Keyword[return] identifier[attributesResult] operator[SEP] identifier[getAttributes] operator[SEP] operator[SEP] operator[SEP] identifier[stream] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[a] operator[->] {
identifier[var] identifier[value] operator[=] operator[SEP] identifier[Object] operator[SEP] Other[null] operator[SEP] identifier[val] identifier[attributeValue] operator[=] identifier[a] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] identifier[LOGGER] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[a] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[attributeValue] operator[SEP] identifier[getNumberValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[value] operator[=] identifier[attributeValue] operator[SEP] identifier[getNumberValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[attributeValue] operator[SEP] identifier[getDatetimeValue] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[value] operator[=] identifier[DateTimeUtils] operator[SEP] identifier[zonedDateTimeOf] operator[SEP] identifier[attributeValue] operator[SEP] identifier[getDatetimeValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[attributeValue] operator[SEP] identifier[getBooleanValue] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[value] operator[=] identifier[attributeValue] operator[SEP] identifier[getBooleanValue] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[attributeValue] operator[SEP] identifier[getBinaryValue] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[value] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[attributeValue] operator[SEP] identifier[getBinaryValue] operator[SEP] operator[SEP] operator[SEP] identifier[array] operator[SEP] operator[SEP] , identifier[StandardCharsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[attributeValue] operator[SEP] identifier[getStringValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[value] operator[=] identifier[attributeValue] operator[SEP] identifier[getStringValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[Pair] operator[SEP] identifier[of] operator[SEP] identifier[a] operator[SEP] identifier[getKey] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[value] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[p] operator[->] identifier[p] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[Collectors] operator[SEP] identifier[toMap] operator[SEP] identifier[Pair] operator[::] identifier[getKey] , identifier[s] operator[->] identifier[CollectionUtils] operator[SEP] identifier[toCollection] operator[SEP] identifier[s] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[ArrayList] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void informAboutEvaluatorFailures(final Set<String> evaluatorIds) {
for (String evaluatorId : evaluatorIds) {
LOG.log(Level.WARNING, "Container [" + evaluatorId +
"] has failed during driver restart process, FailedEvaluatorHandler will be triggered, but " +
"no additional evaluator can be requested due to YARN-2433.");
// trigger a failed evaluator event
this.reefEventHandlers.onResourceStatus(ResourceStatusEventImpl.newBuilder()
.setIdentifier(evaluatorId)
.setState(State.FAILED)
.setExitCode(1)
.setDiagnostics("Container [" + evaluatorId + "] failed during driver restart process.")
.build());
}
}
|
class class_name[name] begin[{]
method[informAboutEvaluatorFailures, return_type[void], modifier[public], parameter[evaluatorIds]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=WARNING, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Container ["), operandr=MemberReference(member=evaluatorId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] has failed during driver restart process, FailedEvaluatorHandler will be triggered, but "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="no additional evaluator can be requested due to YARN-2433."), operator=+)], member=log, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=reefEventHandlers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=newBuilder, postfix_operators=[], prefix_operators=[], qualifier=ResourceStatusEventImpl, selectors=[MethodInvocation(arguments=[MemberReference(member=evaluatorId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setIdentifier, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=FAILED, postfix_operators=[], prefix_operators=[], qualifier=State, selectors=[])], member=setState, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=setExitCode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Container ["), operandr=MemberReference(member=evaluatorId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="] failed during driver restart process."), operator=+)], member=setDiagnostics, 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)], member=onResourceStatus, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=evaluatorIds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=evaluatorId)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[informAboutEvaluatorFailures] operator[SEP] Keyword[final] identifier[Set] operator[<] identifier[String] operator[>] identifier[evaluatorIds] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[evaluatorId] operator[:] identifier[evaluatorIds] operator[SEP] {
identifier[LOG] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[WARNING] , literal[String] operator[+] identifier[evaluatorId] operator[+] literal[String] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[reefEventHandlers] operator[SEP] identifier[onResourceStatus] operator[SEP] identifier[ResourceStatusEventImpl] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setIdentifier] operator[SEP] identifier[evaluatorId] operator[SEP] operator[SEP] identifier[setState] operator[SEP] identifier[State] operator[SEP] identifier[FAILED] operator[SEP] operator[SEP] identifier[setExitCode] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[setDiagnostics] operator[SEP] literal[String] operator[+] identifier[evaluatorId] operator[+] literal[String] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Override
protected String eval(final Object[] _values)
{
final PasswordStore pwd = new PasswordStore();
final String passwd = super.eval(_values);
try {
pwd.setNew(passwd, this.currentValue);
} catch (final EFapsException e) {
PasswordType.LOG.error("Setting PasswordStore: " + pwd.toString());
}
if (PasswordType.LOG.isDebugEnabled()) {
PasswordType.LOG.debug("Setting PasswordStore: " + pwd.toString());
}
return pwd.toString();
}
|
class class_name[name] begin[{]
method[eval, return_type[type[String]], modifier[protected], parameter[_values]] begin[{]
local_variable[type[PasswordStore], pwd]
local_variable[type[String], passwd]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=passwd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=currentValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)])], member=setNew, postfix_operators=[], prefix_operators=[], qualifier=pwd, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Setting PasswordStore: "), operandr=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=pwd, selectors=[], type_arguments=None), operator=+)], member=error, postfix_operators=[], prefix_operators=[], qualifier=PasswordType.LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['EFapsException']))], finally_block=None, label=None, resources=None)
if[call[PasswordType.LOG.isDebugEnabled, parameter[]]] begin[{]
call[PasswordType.LOG.debug, parameter[binary_operation[literal["Setting PasswordStore: "], +, call[pwd.toString, parameter[]]]]]
else begin[{]
None
end[}]
return[call[pwd.toString, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] identifier[String] identifier[eval] operator[SEP] Keyword[final] identifier[Object] operator[SEP] operator[SEP] identifier[_values] operator[SEP] {
Keyword[final] identifier[PasswordStore] identifier[pwd] operator[=] Keyword[new] identifier[PasswordStore] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[passwd] operator[=] Keyword[super] operator[SEP] identifier[eval] operator[SEP] identifier[_values] operator[SEP] operator[SEP] Keyword[try] {
identifier[pwd] operator[SEP] identifier[setNew] operator[SEP] identifier[passwd] , Keyword[this] operator[SEP] identifier[currentValue] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[EFapsException] identifier[e] operator[SEP] {
identifier[PasswordType] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[pwd] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[PasswordType] operator[SEP] identifier[LOG] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[PasswordType] operator[SEP] identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[+] identifier[pwd] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[pwd] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <K, V> Map<K, V> leftShift(Map<K, V> self, Map<K, V> other) {
self.putAll(other);
return self;
}
|
class class_name[name] begin[{]
method[leftShift, return_type[type[Map]], modifier[public static], parameter[self, other]] begin[{]
call[self.putAll, parameter[member[.other]]]
return[member[.self]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[K] , identifier[V] operator[>] identifier[Map] operator[<] identifier[K] , identifier[V] operator[>] identifier[leftShift] operator[SEP] identifier[Map] operator[<] identifier[K] , identifier[V] operator[>] identifier[self] , identifier[Map] operator[<] identifier[K] , identifier[V] operator[>] identifier[other] operator[SEP] {
identifier[self] operator[SEP] identifier[putAll] operator[SEP] identifier[other] operator[SEP] operator[SEP] Keyword[return] identifier[self] operator[SEP]
}
|
private static Object readJsonObject(InputStream stream, Type type) throws IOException {
BufferedReader reader = null;
Json json = Classes.loadService(Json.class);
try {
reader = Files.createBufferedReader(stream);
return json.parse(reader, type);
} finally {
// do not use Files.close because we want to throw IOException is reader close fails
if (reader != null) {
reader.close();
}
}
}
|
class class_name[name] begin[{]
method[readJsonObject, return_type[type[Object]], modifier[private static], parameter[stream, type]] begin[{]
local_variable[type[BufferedReader], reader]
local_variable[type[Json], json]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=stream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createBufferedReader, postfix_operators=[], prefix_operators=[], qualifier=Files, selectors=[], type_arguments=None)), label=None), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parse, postfix_operators=[], prefix_operators=[], qualifier=json, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=reader, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=reader, selectors=[], type_arguments=None), label=None)]))], label=None, resources=None)
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[Object] identifier[readJsonObject] operator[SEP] identifier[InputStream] identifier[stream] , identifier[Type] identifier[type] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[BufferedReader] identifier[reader] operator[=] Other[null] operator[SEP] identifier[Json] identifier[json] operator[=] identifier[Classes] operator[SEP] identifier[loadService] operator[SEP] identifier[Json] operator[SEP] Keyword[class] operator[SEP] operator[SEP] Keyword[try] {
identifier[reader] operator[=] identifier[Files] operator[SEP] identifier[createBufferedReader] operator[SEP] identifier[stream] operator[SEP] operator[SEP] Keyword[return] identifier[json] operator[SEP] identifier[parse] operator[SEP] identifier[reader] , identifier[type] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[reader] operator[!=] Other[null] operator[SEP] {
identifier[reader] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
}
|
public Calendar ceil(Calendar cal) {
Calendar twoYearsFuture = (Calendar) cal.clone();
twoYearsFuture.add(Calendar.YEAR, 2);
OUTER:
while (true) {
if (cal.compareTo(twoYearsFuture) > 0) {
// we went too far into the future
throw new RareOrImpossibleDateException();
}
for (CalendarField f : CalendarField.ADJUST_ORDER) {
int cur = f.valueOf(cal);
int next = f.ceil(this,cur);
if (cur==next) continue; // this field is already in a good shape. move on to next
// we are modifying this field, so clear all the lower level fields
for (CalendarField l=f.lowerField; l!=null; l=l.lowerField)
l.clear(cal);
if (next<0) {
// we need to roll over to the next field.
f.rollUp(cal, 1);
f.setTo(cal,f.first(this));
// since higher order field is affected by this, we need to restart from all over
continue OUTER;
} else {
f.setTo(cal,next);
//check if value was actually set
if (f.valueOf(cal) != next) {
// we need to roll over to the next field.
f.rollUp(cal, 1);
f.setTo(cal,f.first(this));
// since higher order field is affected by this, we need to restart from all over
continue OUTER;
}
if (f.redoAdjustmentIfModified)
continue OUTER; // when we modify DAY_OF_MONTH and DAY_OF_WEEK, do it all over from the top
}
}
return cal; // all fields adjusted
}
}
|
class class_name[name] begin[{]
method[ceil, return_type[type[Calendar]], modifier[public], parameter[cal]] begin[{]
local_variable[type[Calendar], twoYearsFuture]
call[twoYearsFuture.add, parameter[member[Calendar.YEAR], literal[2]]]
while[literal[true]] begin[{]
if[binary_operation[call[cal.compareTo, parameter[member[.twoYearsFuture]]], >, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RareOrImpossibleDateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=cal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), name=cur)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=cur, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=ceil, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), name=next)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=cur, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), ForStatement(body=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=clear, postfix_operators=[], prefix_operators=[], qualifier=l, selectors=[], type_arguments=None), label=None), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=lowerField, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[]), name=l)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CalendarField, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=l, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=lowerField, postfix_operators=[], prefix_operators=[], qualifier=l, selectors=[]))]), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=<), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTo, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=cal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), operandr=MemberReference(member=next, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=rollUp, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=first, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None)], member=setTo, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=OUTER, label=None)])), IfStatement(condition=MemberReference(member=redoAdjustmentIfModified, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[]), else_statement=None, label=None, then_statement=ContinueStatement(goto=OUTER, label=None))]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=rollUp, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=cal, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=first, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None)], member=setTo, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), label=None), ContinueStatement(goto=OUTER, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=ADJUST_ORDER, postfix_operators=[], prefix_operators=[], qualifier=CalendarField, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=CalendarField, sub_type=None))), label=None)
return[member[.cal]]
end[}]
end[}]
END[}]
|
Keyword[public] identifier[Calendar] identifier[ceil] operator[SEP] identifier[Calendar] identifier[cal] operator[SEP] {
identifier[Calendar] identifier[twoYearsFuture] operator[=] operator[SEP] identifier[Calendar] operator[SEP] identifier[cal] operator[SEP] identifier[clone] operator[SEP] operator[SEP] operator[SEP] identifier[twoYearsFuture] operator[SEP] identifier[add] operator[SEP] identifier[Calendar] operator[SEP] identifier[YEAR] , Other[2] operator[SEP] operator[SEP] identifier[OUTER] operator[:] Keyword[while] operator[SEP] literal[boolean] operator[SEP] {
Keyword[if] operator[SEP] identifier[cal] operator[SEP] identifier[compareTo] operator[SEP] identifier[twoYearsFuture] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RareOrImpossibleDateException] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[CalendarField] identifier[f] operator[:] identifier[CalendarField] operator[SEP] identifier[ADJUST_ORDER] operator[SEP] {
Keyword[int] identifier[cur] operator[=] identifier[f] operator[SEP] identifier[valueOf] operator[SEP] identifier[cal] operator[SEP] operator[SEP] Keyword[int] identifier[next] operator[=] identifier[f] operator[SEP] identifier[ceil] operator[SEP] Keyword[this] , identifier[cur] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cur] operator[==] identifier[next] operator[SEP] Keyword[continue] operator[SEP] Keyword[for] operator[SEP] identifier[CalendarField] identifier[l] operator[=] identifier[f] operator[SEP] identifier[lowerField] operator[SEP] identifier[l] operator[!=] Other[null] operator[SEP] identifier[l] operator[=] identifier[l] operator[SEP] identifier[lowerField] operator[SEP] identifier[l] operator[SEP] identifier[clear] operator[SEP] identifier[cal] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[next] operator[<] Other[0] operator[SEP] {
identifier[f] operator[SEP] identifier[rollUp] operator[SEP] identifier[cal] , Other[1] operator[SEP] operator[SEP] identifier[f] operator[SEP] identifier[setTo] operator[SEP] identifier[cal] , identifier[f] operator[SEP] identifier[first] operator[SEP] Keyword[this] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] identifier[OUTER] operator[SEP]
}
Keyword[else] {
identifier[f] operator[SEP] identifier[setTo] operator[SEP] identifier[cal] , identifier[next] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[f] operator[SEP] identifier[valueOf] operator[SEP] identifier[cal] operator[SEP] operator[!=] identifier[next] operator[SEP] {
identifier[f] operator[SEP] identifier[rollUp] operator[SEP] identifier[cal] , Other[1] operator[SEP] operator[SEP] identifier[f] operator[SEP] identifier[setTo] operator[SEP] identifier[cal] , identifier[f] operator[SEP] identifier[first] operator[SEP] Keyword[this] operator[SEP] operator[SEP] operator[SEP] Keyword[continue] identifier[OUTER] operator[SEP]
}
Keyword[if] operator[SEP] identifier[f] operator[SEP] identifier[redoAdjustmentIfModified] operator[SEP] Keyword[continue] identifier[OUTER] operator[SEP]
}
}
Keyword[return] identifier[cal] operator[SEP]
}
}
|
public synchronized void postNotification(final String name, Object... args) {
postNotification(name, ObjectUtils.toMap(args));
}
|
class class_name[name] begin[{]
method[postNotification, return_type[void], modifier[synchronized public], parameter[name, args]] begin[{]
call[.postNotification, parameter[member[.name], call[ObjectUtils.toMap, parameter[member[.args]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[void] identifier[postNotification] operator[SEP] Keyword[final] identifier[String] identifier[name] , identifier[Object] operator[...] identifier[args] operator[SEP] {
identifier[postNotification] operator[SEP] identifier[name] , identifier[ObjectUtils] operator[SEP] identifier[toMap] operator[SEP] identifier[args] operator[SEP] operator[SEP] operator[SEP]
}
|
public GeneralsApi onEvent(String event, Consumer<Object[]> listener, boolean onlyOnce) {
Consumer<Object[]> socketListener = args -> {
LOGGER.trace("Received {}: {}", event, Arrays.toString(args));
listener.accept(args);
};
if (onlyOnce) {
socket.once(event, socketListener);
} else {
socket.on(event, socketListener);
}
return this;
}
|
class class_name[name] begin[{]
method[onEvent, return_type[type[GeneralsApi]], modifier[public], parameter[event, listener, onlyOnce]] begin[{]
local_variable[type[Consumer], socketListener]
if[member[.onlyOnce]] begin[{]
call[socket.once, parameter[member[.event], member[.socketListener]]]
else begin[{]
call[socket.on, parameter[member[.event], member[.socketListener]]]
end[}]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[GeneralsApi] identifier[onEvent] operator[SEP] identifier[String] identifier[event] , identifier[Consumer] operator[<] identifier[Object] operator[SEP] operator[SEP] operator[>] identifier[listener] , Keyword[boolean] identifier[onlyOnce] operator[SEP] {
identifier[Consumer] operator[<] identifier[Object] operator[SEP] operator[SEP] operator[>] identifier[socketListener] operator[=] identifier[args] operator[->] {
identifier[LOGGER] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[event] , identifier[Arrays] operator[SEP] identifier[toString] operator[SEP] identifier[args] operator[SEP] operator[SEP] operator[SEP] identifier[listener] operator[SEP] identifier[accept] operator[SEP] identifier[args] operator[SEP] operator[SEP]
} operator[SEP] Keyword[if] operator[SEP] identifier[onlyOnce] operator[SEP] {
identifier[socket] operator[SEP] identifier[once] operator[SEP] identifier[event] , identifier[socketListener] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[socket] operator[SEP] identifier[on] operator[SEP] identifier[event] , identifier[socketListener] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public String convertPluginTypeToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
|
class class_name[name] begin[{]
method[convertPluginTypeToString, return_type[type[String]], modifier[public], parameter[eDataType, instanceValue]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=instanceValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=instanceValue, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[convertPluginTypeToString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[Object] identifier[instanceValue] operator[SEP] {
Keyword[return] identifier[instanceValue] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[instanceValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<FieldRef> getFields() {
Map<String,FieldRef> fields = new LinkedHashMap<String,FieldRef>();
for (Klass<?> k = this; k!=null; k=k.getSuperClass()) {
for (FieldRef f : k.getDeclaredFields()) {
String name = f.getName();
if (!fields.containsKey(name) && f.isRoutable()) {
fields.put(name,f);
}
}
}
return new ArrayList<FieldRef>(fields.values());
}
|
class class_name[name] begin[{]
method[getFields, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[Map], fields]
ForStatement(body=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), name=name)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=containsKey, postfix_operators=[], prefix_operators=['!'], qualifier=fields, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=isRoutable, postfix_operators=[], prefix_operators=[], qualifier=f, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=f, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getDeclaredFields, postfix_operators=[], prefix_operators=[], qualifier=k, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=f)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FieldRef, sub_type=None))), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), name=k)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Klass, sub_type=None)), update=[Assignment(expressionl=MemberReference(member=k, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getSuperClass, postfix_operators=[], prefix_operators=[], qualifier=k, selectors=[], type_arguments=None))]), label=None)
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=values, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=FieldRef, sub_type=None))], dimensions=None, name=ArrayList, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[FieldRef] operator[>] identifier[getFields] operator[SEP] operator[SEP] {
identifier[Map] operator[<] identifier[String] , identifier[FieldRef] operator[>] identifier[fields] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[FieldRef] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Klass] operator[<] operator[?] operator[>] identifier[k] operator[=] Keyword[this] operator[SEP] identifier[k] operator[!=] Other[null] operator[SEP] identifier[k] operator[=] identifier[k] operator[SEP] identifier[getSuperClass] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[FieldRef] identifier[f] operator[:] identifier[k] operator[SEP] identifier[getDeclaredFields] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[name] operator[=] identifier[f] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[fields] operator[SEP] identifier[containsKey] operator[SEP] identifier[name] operator[SEP] operator[&&] identifier[f] operator[SEP] identifier[isRoutable] operator[SEP] operator[SEP] operator[SEP] {
identifier[fields] operator[SEP] identifier[put] operator[SEP] identifier[name] , identifier[f] operator[SEP] operator[SEP]
}
}
}
Keyword[return] Keyword[new] identifier[ArrayList] operator[<] identifier[FieldRef] operator[>] operator[SEP] identifier[fields] operator[SEP] identifier[values] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public String encode(String name, String value) {
return encode(new DefaultCookie(name, value));
}
|
class class_name[name] begin[{]
method[encode, return_type[type[String]], modifier[public], parameter[name, value]] begin[{]
return[call[.encode, parameter[ClassCreator(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), 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=DefaultCookie, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[encode] operator[SEP] identifier[String] identifier[name] , identifier[String] identifier[value] operator[SEP] {
Keyword[return] identifier[encode] operator[SEP] Keyword[new] identifier[DefaultCookie] operator[SEP] identifier[name] , identifier[value] operator[SEP] operator[SEP] operator[SEP]
}
|
public boolean addIfOpen(E element) {
requireNonNull(element);
lock.lock();
try {
if (open) {
elements.addLast(element);
if (elements.size() == 1) {
nonEmpty.signalAll();
}
}
return open;
} finally {
lock.unlock();
}
}
|
class class_name[name] begin[{]
method[addIfOpen, return_type[type[boolean]], modifier[public], parameter[element]] begin[{]
call[.requireNonNull, parameter[member[.element]]]
call[lock.lock, parameter[]]
TryStatement(block=[IfStatement(condition=MemberReference(member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addLast, postfix_operators=[], prefix_operators=[], qualifier=elements, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=elements, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=signalAll, postfix_operators=[], prefix_operators=[], qualifier=nonEmpty, selectors=[], type_arguments=None), label=None)]))])), ReturnStatement(expression=MemberReference(member=open, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=unlock, postfix_operators=[], prefix_operators=[], qualifier=lock, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[addIfOpen] operator[SEP] identifier[E] identifier[element] operator[SEP] {
identifier[requireNonNull] operator[SEP] identifier[element] operator[SEP] operator[SEP] identifier[lock] operator[SEP] identifier[lock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] identifier[open] operator[SEP] {
identifier[elements] operator[SEP] identifier[addLast] operator[SEP] identifier[element] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[elements] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[==] Other[1] operator[SEP] {
identifier[nonEmpty] operator[SEP] identifier[signalAll] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[open] operator[SEP]
}
Keyword[finally] {
identifier[lock] operator[SEP] identifier[unlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Provides
@Named(JanusConfig.DEFAULT_SPACE_ID_NAME)
public static UUID getSpaceID() {
final String v = JanusConfig.getSystemProperty(JanusConfig.DEFAULT_SPACE_ID_NAME, JanusConfig.DEFAULT_SPACE_ID_VALUE);
return UUID.fromString(v);
}
|
class class_name[name] begin[{]
method[getSpaceID, return_type[type[UUID]], modifier[public static], parameter[]] begin[{]
local_variable[type[String], v]
return[call[UUID.fromString, parameter[member[.v]]]]
end[}]
END[}]
|
annotation[@] identifier[Provides] annotation[@] identifier[Named] operator[SEP] identifier[JanusConfig] operator[SEP] identifier[DEFAULT_SPACE_ID_NAME] operator[SEP] Keyword[public] Keyword[static] identifier[UUID] identifier[getSpaceID] operator[SEP] operator[SEP] {
Keyword[final] identifier[String] identifier[v] operator[=] identifier[JanusConfig] operator[SEP] identifier[getSystemProperty] operator[SEP] identifier[JanusConfig] operator[SEP] identifier[DEFAULT_SPACE_ID_NAME] , identifier[JanusConfig] operator[SEP] identifier[DEFAULT_SPACE_ID_VALUE] operator[SEP] operator[SEP] Keyword[return] identifier[UUID] operator[SEP] identifier[fromString] operator[SEP] identifier[v] operator[SEP] operator[SEP]
}
|
public void marshall(ListPoliciesRequest listPoliciesRequest, ProtocolMarshaller protocolMarshaller) {
if (listPoliciesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listPoliciesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listPoliciesRequest.getMaxResults(), MAXRESULTS_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[listPoliciesRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.listPoliciesRequest], ==, 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=getNextToken, postfix_operators=[], prefix_operators=[], qualifier=listPoliciesRequest, selectors=[], type_arguments=None), MemberReference(member=NEXTTOKEN_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=getMaxResults, postfix_operators=[], prefix_operators=[], qualifier=listPoliciesRequest, selectors=[], type_arguments=None), MemberReference(member=MAXRESULTS_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[ListPoliciesRequest] identifier[listPoliciesRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[listPoliciesRequest] 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[listPoliciesRequest] operator[SEP] identifier[getNextToken] operator[SEP] operator[SEP] , identifier[NEXTTOKEN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[listPoliciesRequest] operator[SEP] identifier[getMaxResults] operator[SEP] operator[SEP] , identifier[MAXRESULTS_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 double trace( DMatrixSparseCSC A ) {
double output = 0;
int o = Math.min(A.numCols,A.numRows);
for (int col = 0; col < o; col++) {
int idx0 = A.col_idx[col];
int idx1 = A.col_idx[col+1];
for (int i = idx0; i < idx1; i++) {
if( A.nz_rows[i] == col ) {
output += A.nz_values[i];
break;
}
}
}
return output;
}
|
class class_name[name] begin[{]
method[trace, return_type[type[double]], modifier[public static], parameter[A]] begin[{]
local_variable[type[double], output]
local_variable[type[int], o]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=col_idx, postfix_operators=[], prefix_operators=[], qualifier=A, selectors=[ArraySelector(index=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), name=idx0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=col_idx, postfix_operators=[], prefix_operators=[], qualifier=A, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+))]), name=idx1)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=nz_rows, postfix_operators=[], prefix_operators=[], qualifier=A, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operandr=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=output, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=nz_values, postfix_operators=[], prefix_operators=[], qualifier=A, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])), label=None), BreakStatement(goto=None, label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=idx1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=idx0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=col, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=o, 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=col)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=col, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.output]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[double] identifier[trace] operator[SEP] identifier[DMatrixSparseCSC] identifier[A] operator[SEP] {
Keyword[double] identifier[output] operator[=] Other[0] operator[SEP] Keyword[int] identifier[o] operator[=] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[A] operator[SEP] identifier[numCols] , identifier[A] operator[SEP] identifier[numRows] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[col] operator[=] Other[0] operator[SEP] identifier[col] operator[<] identifier[o] operator[SEP] identifier[col] operator[++] operator[SEP] {
Keyword[int] identifier[idx0] operator[=] identifier[A] operator[SEP] identifier[col_idx] operator[SEP] identifier[col] operator[SEP] operator[SEP] Keyword[int] identifier[idx1] operator[=] identifier[A] operator[SEP] identifier[col_idx] operator[SEP] identifier[col] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[idx0] operator[SEP] identifier[i] operator[<] identifier[idx1] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[A] operator[SEP] identifier[nz_rows] operator[SEP] identifier[i] operator[SEP] operator[==] identifier[col] operator[SEP] {
identifier[output] operator[+=] identifier[A] operator[SEP] identifier[nz_values] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[break] operator[SEP]
}
}
}
Keyword[return] identifier[output] operator[SEP]
}
|
private static List<CampaignFeed> getCampaignFeeds(AdWordsServicesInterface adWordsServices,
AdWordsSession session, Feed feed, int placeholderType) throws RemoteException {
// Get the CampaignFeedService.
CampaignFeedServiceInterface campaignFeedService =
adWordsServices.get(session, CampaignFeedServiceInterface.class);
String query = String.format(
"SELECT CampaignId, MatchingFunction, PlaceholderTypes WHERE Status = 'ENABLED' "
+ "AND FeedId = %d AND PlaceholderTypes CONTAINS_ANY [%d]", feed.getId(), placeholderType);
List<CampaignFeed> campaignFeeds = new ArrayList<>();
int offset = 0;
CampaignFeedPage campaignFeedPage;
do {
String pageQuery = String.format(query + " LIMIT %d, %d", offset, PAGE_SIZE);
campaignFeedPage = campaignFeedService.query(pageQuery);
if (campaignFeedPage.getEntries() != null) {
campaignFeeds.addAll(Arrays.asList(campaignFeedPage.getEntries()));
}
offset += PAGE_SIZE;
} while (offset < campaignFeedPage.getTotalNumEntries());
return campaignFeeds;
}
|
class class_name[name] begin[{]
method[getCampaignFeeds, return_type[type[List]], modifier[private static], parameter[adWordsServices, session, feed, placeholderType]] begin[{]
local_variable[type[CampaignFeedServiceInterface], campaignFeedService]
local_variable[type[String], query]
local_variable[type[List], campaignFeeds]
local_variable[type[int], offset]
local_variable[type[CampaignFeedPage], campaignFeedPage]
do[binary_operation[member[.offset], <, call[campaignFeedPage.getTotalNumEntries, parameter[]]]] begin[{]
local_variable[type[String], pageQuery]
assign[member[.campaignFeedPage], call[campaignFeedService.query, parameter[member[.pageQuery]]]]
if[binary_operation[call[campaignFeedPage.getEntries, parameter[]], !=, literal[null]]] begin[{]
call[campaignFeeds.addAll, parameter[call[Arrays.asList, parameter[call[campaignFeedPage.getEntries, parameter[]]]]]]
else begin[{]
None
end[}]
assign[member[.offset], member[.PAGE_SIZE]]
end[}]
return[member[.campaignFeeds]]
end[}]
END[}]
|
Keyword[private] Keyword[static] identifier[List] operator[<] identifier[CampaignFeed] operator[>] identifier[getCampaignFeeds] operator[SEP] identifier[AdWordsServicesInterface] identifier[adWordsServices] , identifier[AdWordsSession] identifier[session] , identifier[Feed] identifier[feed] , Keyword[int] identifier[placeholderType] operator[SEP] Keyword[throws] identifier[RemoteException] {
identifier[CampaignFeedServiceInterface] identifier[campaignFeedService] operator[=] identifier[adWordsServices] operator[SEP] identifier[get] operator[SEP] identifier[session] , identifier[CampaignFeedServiceInterface] operator[SEP] Keyword[class] operator[SEP] operator[SEP] identifier[String] identifier[query] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] literal[String] , identifier[feed] operator[SEP] identifier[getId] operator[SEP] operator[SEP] , identifier[placeholderType] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[CampaignFeed] operator[>] identifier[campaignFeeds] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[offset] operator[=] Other[0] operator[SEP] identifier[CampaignFeedPage] identifier[campaignFeedPage] operator[SEP] Keyword[do] {
identifier[String] identifier[pageQuery] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] identifier[query] operator[+] literal[String] , identifier[offset] , identifier[PAGE_SIZE] operator[SEP] operator[SEP] identifier[campaignFeedPage] operator[=] identifier[campaignFeedService] operator[SEP] identifier[query] operator[SEP] identifier[pageQuery] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[campaignFeedPage] operator[SEP] identifier[getEntries] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[campaignFeeds] operator[SEP] identifier[addAll] operator[SEP] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[campaignFeedPage] operator[SEP] identifier[getEntries] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[offset] operator[+=] identifier[PAGE_SIZE] operator[SEP]
}
Keyword[while] operator[SEP] identifier[offset] operator[<] identifier[campaignFeedPage] operator[SEP] identifier[getTotalNumEntries] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[campaignFeeds] operator[SEP]
}
|
@Nonnull
public static GenericodeReader <com.helger.genericode.v04.CodeListSetDocument> gc04CodeListSet ()
{
return new GenericodeReader<> (EGenericodeDocumentType.GC04_CODE_LIST_SET,
com.helger.genericode.v04.CodeListSetDocument.class);
}
|
class class_name[name] begin[{]
method[gc04CodeListSet, return_type[type[GenericodeReader]], modifier[public static], parameter[]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=GC04_CODE_LIST_SET, postfix_operators=[], prefix_operators=[], qualifier=EGenericodeDocumentType, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=com.helger.genericode.v04, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CodeListSetDocument, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=GenericodeReader, sub_type=None))]
end[}]
END[}]
|
annotation[@] identifier[Nonnull] Keyword[public] Keyword[static] identifier[GenericodeReader] operator[<] identifier[com] operator[SEP] identifier[helger] operator[SEP] identifier[genericode] operator[SEP] identifier[v04] operator[SEP] identifier[CodeListSetDocument] operator[>] identifier[gc04CodeListSet] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[GenericodeReader] operator[<] operator[>] operator[SEP] identifier[EGenericodeDocumentType] operator[SEP] identifier[GC04_CODE_LIST_SET] , identifier[com] operator[SEP] identifier[helger] operator[SEP] identifier[genericode] operator[SEP] identifier[v04] operator[SEP] identifier[CodeListSetDocument] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
public static LongBinding round(final ObservableDoubleValue a) {
return createLongBinding(() -> Math.round(a.get()), a);
}
|
class class_name[name] begin[{]
method[round, return_type[type[LongBinding]], modifier[public static], parameter[a]] begin[{]
return[call[.createLongBinding, parameter[LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=get, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None)], member=round, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), parameters=[]), member[.a]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[LongBinding] identifier[round] operator[SEP] Keyword[final] identifier[ObservableDoubleValue] identifier[a] operator[SEP] {
Keyword[return] identifier[createLongBinding] operator[SEP] operator[SEP] operator[SEP] operator[->] identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[a] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] , identifier[a] operator[SEP] operator[SEP]
}
|
private <T> List<Object> getDependents(T extension) {
return new ArrayList<>(evaluateAnnotatedClasses(extension, DependedUpon.class));
}
|
class class_name[name] begin[{]
method[getDependents, return_type[type[List]], modifier[private], parameter[extension]] begin[{]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MemberReference(member=extension, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DependedUpon, sub_type=None))], member=evaluateAnnotatedClasses, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))]
end[}]
END[}]
|
Keyword[private] operator[<] identifier[T] operator[>] identifier[List] operator[<] identifier[Object] operator[>] identifier[getDependents] operator[SEP] identifier[T] identifier[extension] operator[SEP] {
Keyword[return] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[evaluateAnnotatedClasses] operator[SEP] identifier[extension] , identifier[DependedUpon] operator[SEP] Keyword[class] operator[SEP] operator[SEP] operator[SEP]
}
|
public static SSLContext getSSLServerContext(String certificateString, String keyString) throws CertificateException, KeyStoreException, IOException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyManagementException, InvalidKeySpecException {
byte[] certBytes = parseDERFromPEM(certificateString, CERT_START, CERT_END);
byte[] keyBytes = parseDERFromPEM(keyString, P8_KEY_START, P8_KEY_END);
X509Certificate cert = generateCertificateFromDER(certBytes);
PrivateKey key = generatePrivateKeyFromPKCS8DER(keyBytes);
KeyStore keystore = KeyStore.getInstance("JKS");
keystore.load(null);
keystore.setCertificateEntry("cert-alias", cert);
keystore.setKeyEntry("key-alias", key, "changeit".toCharArray(), new Certificate[]{cert});
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
kmf.init(keystore, "changeit".toCharArray());
KeyManager[] km = kmf.getKeyManagers();
SSLContext context = SSLContext.getInstance("TLS");
context.init(km, null, null);
return context;
}
|
class class_name[name] begin[{]
method[getSSLServerContext, return_type[type[SSLContext]], modifier[public static], parameter[certificateString, keyString]] begin[{]
local_variable[type[byte], certBytes]
local_variable[type[byte], keyBytes]
local_variable[type[X509Certificate], cert]
local_variable[type[PrivateKey], key]
local_variable[type[KeyStore], keystore]
call[keystore.load, parameter[literal[null]]]
call[keystore.setCertificateEntry, parameter[literal["cert-alias"], member[.cert]]]
call[keystore.setKeyEntry, parameter[literal["key-alias"], member[.key], literal["changeit"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=cert, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Certificate, sub_type=None))]]
local_variable[type[KeyManagerFactory], kmf]
call[kmf.init, parameter[member[.keystore], literal["changeit"]]]
local_variable[type[KeyManager], km]
local_variable[type[SSLContext], context]
call[context.init, parameter[member[.km], literal[null], literal[null]]]
return[member[.context]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[SSLContext] identifier[getSSLServerContext] operator[SEP] identifier[String] identifier[certificateString] , identifier[String] identifier[keyString] operator[SEP] Keyword[throws] identifier[CertificateException] , identifier[KeyStoreException] , identifier[IOException] , identifier[NoSuchAlgorithmException] , identifier[UnrecoverableKeyException] , identifier[KeyManagementException] , identifier[InvalidKeySpecException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[certBytes] operator[=] identifier[parseDERFromPEM] operator[SEP] identifier[certificateString] , identifier[CERT_START] , identifier[CERT_END] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[keyBytes] operator[=] identifier[parseDERFromPEM] operator[SEP] identifier[keyString] , identifier[P8_KEY_START] , identifier[P8_KEY_END] operator[SEP] operator[SEP] identifier[X509Certificate] identifier[cert] operator[=] identifier[generateCertificateFromDER] operator[SEP] identifier[certBytes] operator[SEP] operator[SEP] identifier[PrivateKey] identifier[key] operator[=] identifier[generatePrivateKeyFromPKCS8DER] operator[SEP] identifier[keyBytes] operator[SEP] operator[SEP] identifier[KeyStore] identifier[keystore] operator[=] identifier[KeyStore] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[keystore] operator[SEP] identifier[load] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[keystore] operator[SEP] identifier[setCertificateEntry] operator[SEP] literal[String] , identifier[cert] operator[SEP] operator[SEP] identifier[keystore] operator[SEP] identifier[setKeyEntry] operator[SEP] literal[String] , identifier[key] , literal[String] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] , Keyword[new] identifier[Certificate] operator[SEP] operator[SEP] {
identifier[cert]
} operator[SEP] operator[SEP] identifier[KeyManagerFactory] identifier[kmf] operator[=] identifier[KeyManagerFactory] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[kmf] operator[SEP] identifier[init] operator[SEP] identifier[keystore] , literal[String] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[KeyManager] operator[SEP] operator[SEP] identifier[km] operator[=] identifier[kmf] operator[SEP] identifier[getKeyManagers] operator[SEP] operator[SEP] operator[SEP] identifier[SSLContext] identifier[context] operator[=] identifier[SSLContext] operator[SEP] identifier[getInstance] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[context] operator[SEP] identifier[init] operator[SEP] identifier[km] , Other[null] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[context] operator[SEP]
}
|
public void setColumns(String columns) throws PageException {
this.columns = ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(columns, ","));
}
|
class class_name[name] begin[{]
method[setColumns, return_type[void], modifier[public], parameter[columns]] begin[{]
assign[THIS[member[None.columns]], call[ListUtil.toStringArray, parameter[call[ListUtil.listToArrayRemoveEmpty, parameter[member[.columns], literal[","]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setColumns] operator[SEP] identifier[String] identifier[columns] operator[SEP] Keyword[throws] identifier[PageException] {
Keyword[this] operator[SEP] identifier[columns] operator[=] identifier[ListUtil] operator[SEP] identifier[toStringArray] operator[SEP] identifier[ListUtil] operator[SEP] identifier[listToArrayRemoveEmpty] operator[SEP] identifier[columns] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
public <T> I addPageNames(Collection<T> webPages, Function<T, String> mapper) {
for (T element : webPages) {
addPage(WebPage.of(mapper.apply(element)));
}
return getThis();
}
|
class class_name[name] begin[{]
method[addPageNames, return_type[type[I]], modifier[public], parameter[webPages, mapper]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=element, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None)], member=of, postfix_operators=[], prefix_operators=[], qualifier=WebPage, selectors=[], type_arguments=None)], member=addPage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=webPages, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=element)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))), label=None)
return[call[.getThis, parameter[]]]
end[}]
END[}]
|
Keyword[public] operator[<] identifier[T] operator[>] identifier[I] identifier[addPageNames] operator[SEP] identifier[Collection] operator[<] identifier[T] operator[>] identifier[webPages] , identifier[Function] operator[<] identifier[T] , identifier[String] operator[>] identifier[mapper] operator[SEP] {
Keyword[for] operator[SEP] identifier[T] identifier[element] operator[:] identifier[webPages] operator[SEP] {
identifier[addPage] operator[SEP] identifier[WebPage] operator[SEP] identifier[of] operator[SEP] identifier[mapper] operator[SEP] identifier[apply] operator[SEP] identifier[element] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[getThis] operator[SEP] operator[SEP] operator[SEP]
}
|
public static ns add(nitro_service client, ns resource) throws Exception
{
resource.validate("add");
return ((ns[]) resource.perform_operation(client, "add"))[0];
}
|
class class_name[name] begin[{]
method[add, return_type[type[ns]], modifier[public static], parameter[client, resource]] begin[{]
call[resource.validate, parameter[literal["add"]]]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=client, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="add")], member=perform_operation, postfix_operators=[], prefix_operators=[], qualifier=resource, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[None], name=ns, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[ns] identifier[add] operator[SEP] identifier[nitro_service] identifier[client] , identifier[ns] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[resource] operator[SEP] identifier[validate] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP] operator[SEP] identifier[ns] operator[SEP] operator[SEP] operator[SEP] identifier[resource] operator[SEP] identifier[perform_operation] operator[SEP] identifier[client] , literal[String] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
|
public void stopServer()
{
// _heartbeatState.notifyHeartbeatStop();
SocketPool pool = _clusterSocketPool.get();
if (pool != null) {
pool.getFactory().notifyHeartbeatStop();
}
}
|
class class_name[name] begin[{]
method[stopServer, return_type[void], modifier[public], parameter[]] begin[{]
local_variable[type[SocketPool], pool]
if[binary_operation[member[.pool], !=, literal[null]]] begin[{]
call[pool.getFactory, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[stopServer] operator[SEP] operator[SEP] {
identifier[SocketPool] identifier[pool] operator[=] identifier[_clusterSocketPool] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[pool] operator[!=] Other[null] operator[SEP] {
identifier[pool] operator[SEP] identifier[getFactory] operator[SEP] operator[SEP] operator[SEP] identifier[notifyHeartbeatStop] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private Path getHost( String id, long version ) {
Path ret = root;
for( String part : id.split( "-" ) ) {
ret = ret.resolve( part );
}
return ret.resolve( "" + version );
}
|
class class_name[name] begin[{]
method[getHost, return_type[type[Path]], modifier[private], parameter[id, version]] begin[{]
local_variable[type[Path], ret]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=ret, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=part, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=resolve, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="-")], member=split, postfix_operators=[], prefix_operators=[], qualifier=id, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=part)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[call[ret.resolve, parameter[binary_operation[literal[""], +, member[.version]]]]]
end[}]
END[}]
|
Keyword[private] identifier[Path] identifier[getHost] operator[SEP] identifier[String] identifier[id] , Keyword[long] identifier[version] operator[SEP] {
identifier[Path] identifier[ret] operator[=] identifier[root] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[part] operator[:] identifier[id] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[ret] operator[=] identifier[ret] operator[SEP] identifier[resolve] operator[SEP] identifier[part] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ret] operator[SEP] identifier[resolve] operator[SEP] literal[String] operator[+] identifier[version] operator[SEP] operator[SEP]
}
|
private static void checkCreateStatementSupported(
int resultSetType, int resultSetConcurrency, int resultSetHoldability)
throws SQLException
{
if ( ( (resultSetType != ResultSet.TYPE_SCROLL_INSENSITIVE
&& resultSetType != ResultSet.TYPE_FORWARD_ONLY))
|| resultSetConcurrency != ResultSet.CONCUR_READ_ONLY
|| resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
throw SQLError.noSupport();
}
}
|
class class_name[name] begin[{]
method[checkCreateStatementSupported, return_type[void], modifier[private static], parameter[resultSetType, resultSetConcurrency, resultSetHoldability]] begin[{]
if[binary_operation[binary_operation[binary_operation[binary_operation[member[.resultSetType], !=, member[ResultSet.TYPE_SCROLL_INSENSITIVE]], &&, binary_operation[member[.resultSetType], !=, member[ResultSet.TYPE_FORWARD_ONLY]]], ||, binary_operation[member[.resultSetConcurrency], !=, member[ResultSet.CONCUR_READ_ONLY]]], ||, binary_operation[member[.resultSetHoldability], !=, member[ResultSet.CLOSE_CURSORS_AT_COMMIT]]]] begin[{]
ThrowStatement(expression=MethodInvocation(arguments=[], member=noSupport, postfix_operators=[], prefix_operators=[], qualifier=SQLError, selectors=[], type_arguments=None), label=None)
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[checkCreateStatementSupported] operator[SEP] Keyword[int] identifier[resultSetType] , Keyword[int] identifier[resultSetConcurrency] , Keyword[int] identifier[resultSetHoldability] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[if] operator[SEP] operator[SEP] operator[SEP] identifier[resultSetType] operator[!=] identifier[ResultSet] operator[SEP] identifier[TYPE_SCROLL_INSENSITIVE] operator[&&] identifier[resultSetType] operator[!=] identifier[ResultSet] operator[SEP] identifier[TYPE_FORWARD_ONLY] operator[SEP] operator[SEP] operator[||] identifier[resultSetConcurrency] operator[!=] identifier[ResultSet] operator[SEP] identifier[CONCUR_READ_ONLY] operator[||] identifier[resultSetHoldability] operator[!=] identifier[ResultSet] operator[SEP] identifier[CLOSE_CURSORS_AT_COMMIT] operator[SEP] {
Keyword[throw] identifier[SQLError] operator[SEP] identifier[noSupport] operator[SEP] operator[SEP] operator[SEP]
}
}
|
protected void modified(Map<?, ?> properties) {
if (properties instanceof Dictionary) {
processConfig((Dictionary<?, ?>) properties);
} else {
Dictionary<?, ?> newconfig = new Hashtable<Object, Object>(properties);
processConfig(newconfig);
}
}
|
class class_name[name] begin[{]
method[modified, return_type[void], modifier[protected], parameter[properties]] begin[{]
if[binary_operation[member[.properties], instanceof, type[Dictionary]]] begin[{]
call[.processConfig, parameter[Cast(expression=MemberReference(member=properties, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None), TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Dictionary, sub_type=None))]]
else begin[{]
local_variable[type[Dictionary], newconfig]
call[.processConfig, parameter[member[.newconfig]]]
end[}]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[modified] operator[SEP] identifier[Map] operator[<] operator[?] , operator[?] operator[>] identifier[properties] operator[SEP] {
Keyword[if] operator[SEP] identifier[properties] Keyword[instanceof] identifier[Dictionary] operator[SEP] {
identifier[processConfig] operator[SEP] operator[SEP] identifier[Dictionary] operator[<] operator[?] , operator[?] operator[>] operator[SEP] identifier[properties] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[Dictionary] operator[<] operator[?] , operator[?] operator[>] identifier[newconfig] operator[=] Keyword[new] identifier[Hashtable] operator[<] identifier[Object] , identifier[Object] operator[>] operator[SEP] identifier[properties] operator[SEP] operator[SEP] identifier[processConfig] operator[SEP] identifier[newconfig] operator[SEP] operator[SEP]
}
}
|
private long overflowFree(long delay) {
Delayed head = (Delayed) super.getQueue().peek();
if (head != null) {
long headDelay = head.getDelay(NANOSECONDS);
if (headDelay < 0 && (delay - headDelay < 0))
delay = Long.MAX_VALUE + headDelay;
}
return delay;
}
|
class class_name[name] begin[{]
method[overflowFree, return_type[type[long]], modifier[private], parameter[delay]] begin[{]
local_variable[type[Delayed], head]
if[binary_operation[member[.head], !=, literal[null]]] begin[{]
local_variable[type[long], headDelay]
if[binary_operation[binary_operation[member[.headDelay], <, literal[0]], &&, binary_operation[binary_operation[member[.delay], -, member[.headDelay]], <, literal[0]]]] begin[{]
assign[member[.delay], binary_operation[member[Long.MAX_VALUE], +, member[.headDelay]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
return[member[.delay]]
end[}]
END[}]
|
Keyword[private] Keyword[long] identifier[overflowFree] operator[SEP] Keyword[long] identifier[delay] operator[SEP] {
identifier[Delayed] identifier[head] operator[=] operator[SEP] identifier[Delayed] operator[SEP] Keyword[super] operator[SEP] identifier[getQueue] operator[SEP] operator[SEP] operator[SEP] identifier[peek] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[head] operator[!=] Other[null] operator[SEP] {
Keyword[long] identifier[headDelay] operator[=] identifier[head] operator[SEP] identifier[getDelay] operator[SEP] identifier[NANOSECONDS] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[headDelay] operator[<] Other[0] operator[&&] operator[SEP] identifier[delay] operator[-] identifier[headDelay] operator[<] Other[0] operator[SEP] operator[SEP] identifier[delay] operator[=] identifier[Long] operator[SEP] identifier[MAX_VALUE] operator[+] identifier[headDelay] operator[SEP]
}
Keyword[return] identifier[delay] operator[SEP]
}
|
public ArrayList<OvhInputAction> serviceName_input_inputId_action_GET(String serviceName, String inputId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/input/{inputId}/action";
StringBuilder sb = path(qPath, serviceName, inputId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
}
|
class class_name[name] begin[{]
method[serviceName_input_inputId_action_GET, return_type[type[ArrayList]], modifier[public], parameter[serviceName, inputId]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], member[.t3]]]]
end[}]
END[}]
|
Keyword[public] identifier[ArrayList] operator[<] identifier[OvhInputAction] operator[>] identifier[serviceName_input_inputId_action_GET] operator[SEP] identifier[String] identifier[serviceName] , identifier[String] identifier[inputId] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[serviceName] , identifier[inputId] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[t3] operator[SEP] operator[SEP]
}
|
private static void addClassProxyHashCodeMethod(ClassWriter cw,
String implClassName)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, INDENT + "adding method : hashCode ()I");
// -----------------------------------------------------------------------
// public boolean equals(Object other)
// {
// -----------------------------------------------------------------------
final String desc = "()I";
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "hashCode", desc, null, null);
mv.visitCode();
// -----------------------------------------------------------------------
// return this.ivProxy.hashCode();
// -----------------------------------------------------------------------
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, implClassName,
LOCAL_BEAN_PROXY_FIELD, LOCAL_BEAN_PROXY_FIELD_TYPE_NAME);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object",
"hashCode", desc);
mv.visitInsn(IRETURN);
// -----------------------------------------------------------------------
// }
// -----------------------------------------------------------------------
mv.visitMaxs(1, 2);
mv.visitEnd();
}
|
class class_name[name] begin[{]
method[addClassProxyHashCodeMethod, return_type[void], modifier[private static], parameter[cw, implClassName]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], binary_operation[member[.INDENT], +, literal["adding method : hashCode ()I"]]]]
else begin[{]
None
end[}]
local_variable[type[String], desc]
local_variable[type[MethodVisitor], mv]
call[mv.visitCode, parameter[]]
call[mv.visitVarInsn, parameter[member[.ALOAD], literal[0]]]
call[mv.visitFieldInsn, parameter[member[.GETFIELD], member[.implClassName], member[.LOCAL_BEAN_PROXY_FIELD], member[.LOCAL_BEAN_PROXY_FIELD_TYPE_NAME]]]
call[mv.visitMethodInsn, parameter[member[.INVOKEVIRTUAL], literal["java/lang/Object"], literal["hashCode"], member[.desc]]]
call[mv.visitInsn, parameter[member[.IRETURN]]]
call[mv.visitMaxs, parameter[literal[1], literal[2]]]
call[mv.visitEnd, parameter[]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[void] identifier[addClassProxyHashCodeMethod] operator[SEP] identifier[ClassWriter] identifier[cw] , identifier[String] identifier[implClassName] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , identifier[INDENT] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[desc] operator[=] literal[String] operator[SEP] identifier[MethodVisitor] identifier[mv] operator[=] identifier[cw] operator[SEP] identifier[visitMethod] operator[SEP] identifier[ACC_PUBLIC] , literal[String] , identifier[desc] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitCode] operator[SEP] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitVarInsn] operator[SEP] identifier[ALOAD] , Other[0] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitFieldInsn] operator[SEP] identifier[GETFIELD] , identifier[implClassName] , identifier[LOCAL_BEAN_PROXY_FIELD] , identifier[LOCAL_BEAN_PROXY_FIELD_TYPE_NAME] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitMethodInsn] operator[SEP] identifier[INVOKEVIRTUAL] , literal[String] , literal[String] , identifier[desc] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitInsn] operator[SEP] identifier[IRETURN] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitMaxs] operator[SEP] Other[1] , Other[2] operator[SEP] operator[SEP] identifier[mv] operator[SEP] identifier[visitEnd] operator[SEP] operator[SEP] operator[SEP]
}
|
public static int executeCommand(
final Logger logger,
final String[] command,
final File workingDir,
final Map<String,String> environmentVars,
final String applicationName,
final String scopedInstancePath)
throws IOException, InterruptedException {
ExecutionResult result = executeCommandWithResult( logger, command, workingDir, environmentVars, applicationName, scopedInstancePath);
if( ! Utils.isEmptyOrWhitespaces( result.getNormalOutput()))
logger.fine( result.getNormalOutput());
if( ! Utils.isEmptyOrWhitespaces( result.getErrorOutput()))
logger.warning( result.getErrorOutput());
return result.getExitValue();
}
|
class class_name[name] begin[{]
method[executeCommand, return_type[type[int]], modifier[public static], parameter[logger, command, workingDir, environmentVars, applicationName, scopedInstancePath]] begin[{]
local_variable[type[ExecutionResult], result]
if[call[Utils.isEmptyOrWhitespaces, parameter[call[result.getNormalOutput, parameter[]]]]] begin[{]
call[logger.fine, parameter[call[result.getNormalOutput, parameter[]]]]
else begin[{]
None
end[}]
if[call[Utils.isEmptyOrWhitespaces, parameter[call[result.getErrorOutput, parameter[]]]]] begin[{]
call[logger.warning, parameter[call[result.getErrorOutput, parameter[]]]]
else begin[{]
None
end[}]
return[call[result.getExitValue, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[int] identifier[executeCommand] operator[SEP] Keyword[final] identifier[Logger] identifier[logger] , Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[command] , Keyword[final] identifier[File] identifier[workingDir] , Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[environmentVars] , Keyword[final] identifier[String] identifier[applicationName] , Keyword[final] identifier[String] identifier[scopedInstancePath] operator[SEP] Keyword[throws] identifier[IOException] , identifier[InterruptedException] {
identifier[ExecutionResult] identifier[result] operator[=] identifier[executeCommandWithResult] operator[SEP] identifier[logger] , identifier[command] , identifier[workingDir] , identifier[environmentVars] , identifier[applicationName] , identifier[scopedInstancePath] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Utils] operator[SEP] identifier[isEmptyOrWhitespaces] operator[SEP] identifier[result] operator[SEP] identifier[getNormalOutput] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[fine] operator[SEP] identifier[result] operator[SEP] identifier[getNormalOutput] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[Utils] operator[SEP] identifier[isEmptyOrWhitespaces] operator[SEP] identifier[result] operator[SEP] identifier[getErrorOutput] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[warning] operator[SEP] identifier[result] operator[SEP] identifier[getErrorOutput] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[getExitValue] operator[SEP] operator[SEP] operator[SEP]
}
|
public SparseDoubleVector combine(SparseDoubleVector v1,
SparseDoubleVector v2) {
return (SparseDoubleVector) VectorMath.add(v1, v2);
}
|
class class_name[name] begin[{]
method[combine, return_type[type[SparseDoubleVector]], modifier[public], parameter[v1, v2]] begin[{]
return[Cast(expression=MethodInvocation(arguments=[MemberReference(member=v1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=v2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=VectorMath, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SparseDoubleVector, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[SparseDoubleVector] identifier[combine] operator[SEP] identifier[SparseDoubleVector] identifier[v1] , identifier[SparseDoubleVector] identifier[v2] operator[SEP] {
Keyword[return] operator[SEP] identifier[SparseDoubleVector] operator[SEP] identifier[VectorMath] operator[SEP] identifier[add] operator[SEP] identifier[v1] , identifier[v2] operator[SEP] operator[SEP]
}
|
private Set<String> getConstraintNameList(){
Set<String> result = new HashSet<>();
String propertyValue = getProperty(ConstraintContextProperty.ALL_CONSTRAINTS);
if(propertyValue == null)
return result;
StringTokenizer attributeTokens = StringUtils.splitArrayString(propertyValue, String.valueOf(ArrayUtils.VALUE_SEPARATION));
while(attributeTokens.hasMoreTokens()){
String nextToken = attributeTokens.nextToken();
result.add(nextToken);
}
return result;
}
|
class class_name[name] begin[{]
method[getConstraintNameList, return_type[type[Set]], modifier[private], parameter[]] begin[{]
local_variable[type[Set], result]
local_variable[type[String], propertyValue]
if[binary_operation[member[.propertyValue], ==, literal[null]]] begin[{]
return[member[.result]]
else begin[{]
None
end[}]
local_variable[type[StringTokenizer], attributeTokens]
while[call[attributeTokens.hasMoreTokens, parameter[]]] begin[{]
local_variable[type[String], nextToken]
call[result.add, parameter[member[.nextToken]]]
end[}]
return[member[.result]]
end[}]
END[}]
|
Keyword[private] identifier[Set] operator[<] identifier[String] operator[>] identifier[getConstraintNameList] operator[SEP] operator[SEP] {
identifier[Set] operator[<] identifier[String] operator[>] identifier[result] operator[=] Keyword[new] identifier[HashSet] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[propertyValue] operator[=] identifier[getProperty] operator[SEP] identifier[ConstraintContextProperty] operator[SEP] identifier[ALL_CONSTRAINTS] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[propertyValue] operator[==] Other[null] operator[SEP] Keyword[return] identifier[result] operator[SEP] identifier[StringTokenizer] identifier[attributeTokens] operator[=] identifier[StringUtils] operator[SEP] identifier[splitArrayString] operator[SEP] identifier[propertyValue] , identifier[String] operator[SEP] identifier[valueOf] operator[SEP] identifier[ArrayUtils] operator[SEP] identifier[VALUE_SEPARATION] operator[SEP] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[attributeTokens] operator[SEP] identifier[hasMoreTokens] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[nextToken] operator[=] identifier[attributeTokens] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP] operator[SEP] identifier[result] operator[SEP] identifier[add] operator[SEP] identifier[nextToken] operator[SEP] operator[SEP]
}
Keyword[return] identifier[result] operator[SEP]
}
|
public void marshall(KeyMetadata keyMetadata, ProtocolMarshaller protocolMarshaller) {
if (keyMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(keyMetadata.getAWSAccountId(), AWSACCOUNTID_BINDING);
protocolMarshaller.marshall(keyMetadata.getKeyId(), KEYID_BINDING);
protocolMarshaller.marshall(keyMetadata.getArn(), ARN_BINDING);
protocolMarshaller.marshall(keyMetadata.getCreationDate(), CREATIONDATE_BINDING);
protocolMarshaller.marshall(keyMetadata.getEnabled(), ENABLED_BINDING);
protocolMarshaller.marshall(keyMetadata.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(keyMetadata.getKeyUsage(), KEYUSAGE_BINDING);
protocolMarshaller.marshall(keyMetadata.getKeyState(), KEYSTATE_BINDING);
protocolMarshaller.marshall(keyMetadata.getDeletionDate(), DELETIONDATE_BINDING);
protocolMarshaller.marshall(keyMetadata.getValidTo(), VALIDTO_BINDING);
protocolMarshaller.marshall(keyMetadata.getOrigin(), ORIGIN_BINDING);
protocolMarshaller.marshall(keyMetadata.getExpirationModel(), EXPIRATIONMODEL_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[keyMetadata, protocolMarshaller]] begin[{]
if[binary_operation[member[.keyMetadata], ==, 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=getAWSAccountId, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=AWSACCOUNTID_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=getKeyId, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=KEYID_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=getArn, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=ARN_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=keyMetadata, 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=getEnabled, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=ENABLED_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=getDescription, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=DESCRIPTION_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=getKeyUsage, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=KEYUSAGE_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=getKeyState, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=KEYSTATE_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=getDeletionDate, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=DELETIONDATE_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=getValidTo, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=VALIDTO_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=getOrigin, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=ORIGIN_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=getExpirationModel, postfix_operators=[], prefix_operators=[], qualifier=keyMetadata, selectors=[], type_arguments=None), MemberReference(member=EXPIRATIONMODEL_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[KeyMetadata] identifier[keyMetadata] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[keyMetadata] 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[keyMetadata] operator[SEP] identifier[getAWSAccountId] operator[SEP] operator[SEP] , identifier[AWSACCOUNTID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getKeyId] operator[SEP] operator[SEP] , identifier[KEYID_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getArn] operator[SEP] operator[SEP] , identifier[ARN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getCreationDate] operator[SEP] operator[SEP] , identifier[CREATIONDATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getEnabled] operator[SEP] operator[SEP] , identifier[ENABLED_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getDescription] operator[SEP] operator[SEP] , identifier[DESCRIPTION_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getKeyUsage] operator[SEP] operator[SEP] , identifier[KEYUSAGE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getKeyState] operator[SEP] operator[SEP] , identifier[KEYSTATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getDeletionDate] operator[SEP] operator[SEP] , identifier[DELETIONDATE_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getValidTo] operator[SEP] operator[SEP] , identifier[VALIDTO_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getOrigin] operator[SEP] operator[SEP] , identifier[ORIGIN_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[keyMetadata] operator[SEP] identifier[getExpirationModel] operator[SEP] operator[SEP] , identifier[EXPIRATIONMODEL_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 OvhRouteHttp serviceName_http_route_routeId_GET(String serviceName, Long routeId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/http/route/{routeId}";
StringBuilder sb = path(qPath, serviceName, routeId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRouteHttp.class);
}
|
class class_name[name] begin[{]
method[serviceName_http_route_routeId_GET, return_type[type[OvhRouteHttp]], modifier[public], parameter[serviceName, routeId]] begin[{]
local_variable[type[String], qPath]
local_variable[type[StringBuilder], sb]
local_variable[type[String], resp]
return[call[.convertTo, parameter[member[.resp], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OvhRouteHttp, sub_type=None))]]]
end[}]
END[}]
|
Keyword[public] identifier[OvhRouteHttp] identifier[serviceName_http_route_routeId_GET] operator[SEP] identifier[String] identifier[serviceName] , identifier[Long] identifier[routeId] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[String] identifier[qPath] operator[=] literal[String] operator[SEP] identifier[StringBuilder] identifier[sb] operator[=] identifier[path] operator[SEP] identifier[qPath] , identifier[serviceName] , identifier[routeId] operator[SEP] operator[SEP] identifier[String] identifier[resp] operator[=] identifier[exec] operator[SEP] identifier[qPath] , literal[String] , identifier[sb] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[convertTo] operator[SEP] identifier[resp] , identifier[OvhRouteHttp] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
protected String getExpectedMessage() {
StringBuilder syntax = new StringBuilder("<tag> ");
syntax.append(getName());
String args = getArgSyntax();
if (args != null && args.length() > 0) {
syntax.append(' ');
syntax.append(args);
}
return syntax.toString();
}
|
class class_name[name] begin[{]
method[getExpectedMessage, return_type[type[String]], modifier[protected], parameter[]] begin[{]
local_variable[type[StringBuilder], syntax]
call[syntax.append, parameter[call[.getName, parameter[]]]]
local_variable[type[String], args]
if[binary_operation[binary_operation[member[.args], !=, literal[null]], &&, binary_operation[call[args.length, parameter[]], >, literal[0]]]] begin[{]
call[syntax.append, parameter[literal[' ']]]
call[syntax.append, parameter[member[.args]]]
else begin[{]
None
end[}]
return[call[syntax.toString, parameter[]]]
end[}]
END[}]
|
Keyword[protected] identifier[String] identifier[getExpectedMessage] operator[SEP] operator[SEP] {
identifier[StringBuilder] identifier[syntax] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[syntax] operator[SEP] identifier[append] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[args] operator[=] identifier[getArgSyntax] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[args] operator[!=] Other[null] operator[&&] identifier[args] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[syntax] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[syntax] operator[SEP] identifier[append] operator[SEP] identifier[args] operator[SEP] operator[SEP]
}
Keyword[return] identifier[syntax] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private static boolean isMaybeRecursive(final Object o) {
return o.getClass().isArray() || o instanceof Map || o instanceof Collection;
}
|
class class_name[name] begin[{]
method[isMaybeRecursive, return_type[type[boolean]], modifier[private static], parameter[o]] begin[{]
return[binary_operation[binary_operation[call[o.getClass, parameter[]], ||, binary_operation[member[.o], instanceof, type[Map]]], ||, binary_operation[member[.o], instanceof, type[Collection]]]]
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[isMaybeRecursive] operator[SEP] Keyword[final] identifier[Object] identifier[o] operator[SEP] {
Keyword[return] identifier[o] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[isArray] operator[SEP] operator[SEP] operator[||] identifier[o] Keyword[instanceof] identifier[Map] operator[||] identifier[o] Keyword[instanceof] identifier[Collection] operator[SEP]
}
|
public static boolean isRegularQueue(final Jedis jedis, final String key) {
return LIST.equalsIgnoreCase(jedis.type(key));
}
|
class class_name[name] begin[{]
method[isRegularQueue, return_type[type[boolean]], modifier[public static], parameter[jedis, key]] begin[{]
return[call[LIST.equalsIgnoreCase, parameter[call[jedis.type, parameter[member[.key]]]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[boolean] identifier[isRegularQueue] operator[SEP] Keyword[final] identifier[Jedis] identifier[jedis] , Keyword[final] identifier[String] identifier[key] operator[SEP] {
Keyword[return] identifier[LIST] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[jedis] operator[SEP] identifier[type] operator[SEP] identifier[key] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
protected AbstractMessage retrieveMessage(int handle) throws JMSException
{
byte[] rawMsg = (byte[])dataStore.retrieve(handle);
return MessageSerializer.unserialize(rawMsg, true);
}
|
class class_name[name] begin[{]
method[retrieveMessage, return_type[type[AbstractMessage]], modifier[protected], parameter[handle]] begin[{]
local_variable[type[byte], rawMsg]
return[call[MessageSerializer.unserialize, parameter[member[.rawMsg], literal[true]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[protected] identifier[AbstractMessage] identifier[retrieveMessage] operator[SEP] Keyword[int] identifier[handle] operator[SEP] Keyword[throws] identifier[JMSException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[rawMsg] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[dataStore] operator[SEP] identifier[retrieve] operator[SEP] identifier[handle] operator[SEP] operator[SEP] Keyword[return] identifier[MessageSerializer] operator[SEP] identifier[unserialize] operator[SEP] identifier[rawMsg] , literal[boolean] operator[SEP] operator[SEP]
}
|
public boolean isCompatible(MediaType other) {
if (other == null)
return false;
if (type.equals(MEDIA_TYPE_WILDCARD) || other.type.equals(MEDIA_TYPE_WILDCARD))
return true;
else if (type.equalsIgnoreCase(other.type) && (subtype.equals(MEDIA_TYPE_WILDCARD) || other.subtype.equals(MEDIA_TYPE_WILDCARD)))
return true;
else
return this.type.equalsIgnoreCase(other.type)
&& this.subtype.equalsIgnoreCase(other.subtype);
}
|
class class_name[name] begin[{]
method[isCompatible, return_type[type[boolean]], modifier[public], parameter[other]] begin[{]
if[binary_operation[member[.other], ==, literal[null]]] begin[{]
return[literal[false]]
else begin[{]
None
end[}]
if[binary_operation[call[type.equals, parameter[member[.MEDIA_TYPE_WILDCARD]]], ||, call[other.type.equals, parameter[member[.MEDIA_TYPE_WILDCARD]]]]] begin[{]
return[literal[true]]
else begin[{]
if[binary_operation[call[type.equalsIgnoreCase, parameter[member[other.type]]], &&, binary_operation[call[subtype.equals, parameter[member[.MEDIA_TYPE_WILDCARD]]], ||, call[other.subtype.equals, parameter[member[.MEDIA_TYPE_WILDCARD]]]]]] begin[{]
return[literal[true]]
else begin[{]
return[binary_operation[THIS[member[None.type]call[None.equalsIgnoreCase, parameter[member[other.type]]]], &&, THIS[member[None.subtype]call[None.equalsIgnoreCase, parameter[member[other.subtype]]]]]]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isCompatible] operator[SEP] identifier[MediaType] identifier[other] operator[SEP] {
Keyword[if] operator[SEP] identifier[other] operator[==] Other[null] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[equals] operator[SEP] identifier[MEDIA_TYPE_WILDCARD] operator[SEP] operator[||] identifier[other] operator[SEP] identifier[type] operator[SEP] identifier[equals] operator[SEP] identifier[MEDIA_TYPE_WILDCARD] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[else] Keyword[if] operator[SEP] identifier[type] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[other] operator[SEP] identifier[type] operator[SEP] operator[&&] operator[SEP] identifier[subtype] operator[SEP] identifier[equals] operator[SEP] identifier[MEDIA_TYPE_WILDCARD] operator[SEP] operator[||] identifier[other] operator[SEP] identifier[subtype] operator[SEP] identifier[equals] operator[SEP] identifier[MEDIA_TYPE_WILDCARD] operator[SEP] operator[SEP] operator[SEP] Keyword[return] literal[boolean] operator[SEP] Keyword[else] Keyword[return] Keyword[this] operator[SEP] identifier[type] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[other] operator[SEP] identifier[type] operator[SEP] operator[&&] Keyword[this] operator[SEP] identifier[subtype] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[other] operator[SEP] identifier[subtype] operator[SEP] operator[SEP]
}
|
public static <T> T createNicePartialMock(Class<T> type, String methodName, Class<?>[] methodParameterTypes,
Object... constructorArguments) {
Constructor<?> constructor = WhiteboxImpl.findUniqueConstructorOrThrowException(type, constructorArguments);
ConstructorArgs constructorArgs = new ConstructorArgs(constructor, constructorArguments);
return doMockSpecific(type, new NiceMockStrategy(), new String[]{methodName}, constructorArgs,
methodParameterTypes);
}
|
class class_name[name] begin[{]
method[createNicePartialMock, return_type[type[T]], modifier[public static], parameter[type, methodName, methodParameterTypes, constructorArguments]] begin[{]
local_variable[type[Constructor], constructor]
local_variable[type[ConstructorArgs], constructorArgs]
return[call[.doMockSpecific, parameter[member[.type], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NiceMockStrategy, sub_type=None)), ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=methodName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None)), member[.constructorArgs], member[.methodParameterTypes]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[createNicePartialMock] operator[SEP] identifier[Class] operator[<] identifier[T] operator[>] identifier[type] , identifier[String] identifier[methodName] , identifier[Class] operator[<] operator[?] operator[>] operator[SEP] operator[SEP] identifier[methodParameterTypes] , identifier[Object] operator[...] identifier[constructorArguments] operator[SEP] {
identifier[Constructor] operator[<] operator[?] operator[>] identifier[constructor] operator[=] identifier[WhiteboxImpl] operator[SEP] identifier[findUniqueConstructorOrThrowException] operator[SEP] identifier[type] , identifier[constructorArguments] operator[SEP] operator[SEP] identifier[ConstructorArgs] identifier[constructorArgs] operator[=] Keyword[new] identifier[ConstructorArgs] operator[SEP] identifier[constructor] , identifier[constructorArguments] operator[SEP] operator[SEP] Keyword[return] identifier[doMockSpecific] operator[SEP] identifier[type] , Keyword[new] identifier[NiceMockStrategy] operator[SEP] operator[SEP] , Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[methodName]
} , identifier[constructorArgs] , identifier[methodParameterTypes] operator[SEP] operator[SEP]
}
|
public java.awt.Graphics2D createGraphics(float width, float height) {
return new PdfGraphics2D(this, width, height, null, false, false, 0);
}
|
class class_name[name] begin[{]
method[createGraphics, return_type[type[java]], modifier[public], parameter[width, height]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=width, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=height, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PdfGraphics2D, sub_type=None))]
end[}]
END[}]
|
Keyword[public] identifier[java] operator[SEP] identifier[awt] operator[SEP] identifier[Graphics2D] identifier[createGraphics] operator[SEP] Keyword[float] identifier[width] , Keyword[float] identifier[height] operator[SEP] {
Keyword[return] Keyword[new] identifier[PdfGraphics2D] operator[SEP] Keyword[this] , identifier[width] , identifier[height] , Other[null] , literal[boolean] , literal[boolean] , Other[0] operator[SEP] operator[SEP]
}
|
protected void parseComment() {
int commentEndPos = sql.indexOf("*/", position);
int commentEndPos2 = sql.indexOf("*#", position);
if (0 < commentEndPos2 && commentEndPos2 < commentEndPos) {
commentEndPos = commentEndPos2;
}
if (commentEndPos < 0) {
throw new TwoWaySQLException(String.format(
"%s is not closed with %s.", sql.substring(position), "*/"));
}
token = sql.substring(position, commentEndPos);
nextTokenType = TokenType.SQL;
position = commentEndPos + 2;
tokenType = TokenType.COMMENT;
}
|
class class_name[name] begin[{]
method[parseComment, return_type[void], modifier[protected], parameter[]] begin[{]
local_variable[type[int], commentEndPos]
local_variable[type[int], commentEndPos2]
if[binary_operation[binary_operation[literal[0], <, member[.commentEndPos2]], &&, binary_operation[member[.commentEndPos2], <, member[.commentEndPos]]]] begin[{]
assign[member[.commentEndPos], member[.commentEndPos2]]
else begin[{]
None
end[}]
if[binary_operation[member[.commentEndPos], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s is not closed with %s."), MethodInvocation(arguments=[MemberReference(member=position, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=sql, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="*/")], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TwoWaySQLException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.token], call[sql.substring, parameter[member[.position], member[.commentEndPos]]]]
assign[member[.nextTokenType], member[TokenType.SQL]]
assign[member[.position], binary_operation[member[.commentEndPos], +, literal[2]]]
assign[member[.tokenType], member[TokenType.COMMENT]]
end[}]
END[}]
|
Keyword[protected] Keyword[void] identifier[parseComment] operator[SEP] operator[SEP] {
Keyword[int] identifier[commentEndPos] operator[=] identifier[sql] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[position] operator[SEP] operator[SEP] Keyword[int] identifier[commentEndPos2] operator[=] identifier[sql] operator[SEP] identifier[indexOf] operator[SEP] literal[String] , identifier[position] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[0] operator[<] identifier[commentEndPos2] operator[&&] identifier[commentEndPos2] operator[<] identifier[commentEndPos] operator[SEP] {
identifier[commentEndPos] operator[=] identifier[commentEndPos2] operator[SEP]
}
Keyword[if] operator[SEP] identifier[commentEndPos] operator[<] Other[0] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TwoWaySQLException] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[sql] operator[SEP] identifier[substring] operator[SEP] identifier[position] operator[SEP] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
identifier[token] operator[=] identifier[sql] operator[SEP] identifier[substring] operator[SEP] identifier[position] , identifier[commentEndPos] operator[SEP] operator[SEP] identifier[nextTokenType] operator[=] identifier[TokenType] operator[SEP] identifier[SQL] operator[SEP] identifier[position] operator[=] identifier[commentEndPos] operator[+] Other[2] operator[SEP] identifier[tokenType] operator[=] identifier[TokenType] operator[SEP] identifier[COMMENT] operator[SEP]
}
|
public static void expandAllFixedHeight(JTree tree)
{
// Determine a suitable row height for the tree, based on the
// size of the component that is used for rendering the root
TreeCellRenderer cellRenderer = tree.getCellRenderer();
Component treeCellRendererComponent =
cellRenderer.getTreeCellRendererComponent(
tree, tree.getModel().getRoot(), false, false, false, 1, false);
int rowHeight = treeCellRendererComponent.getPreferredSize().height + 2;
tree.setRowHeight(rowHeight);
// Temporarily remove all listeners that would otherwise
// be flooded with TreeExpansionEvents
List<TreeExpansionListener> expansionListeners =
Arrays.asList(tree.getTreeExpansionListeners());
for (TreeExpansionListener expansionListener : expansionListeners)
{
tree.removeTreeExpansionListener(expansionListener);
}
// Recursively expand all nodes of the tree
TreePath rootPath = new TreePath(tree.getModel().getRoot());
expandAllRecursively(tree, rootPath);
// Restore the listeners that the tree originally had
for (TreeExpansionListener expansionListener : expansionListeners)
{
tree.addTreeExpansionListener(expansionListener);
}
// Trigger an update for the TreeExpansionListeners
tree.collapsePath(rootPath);
tree.expandPath(rootPath);
}
|
class class_name[name] begin[{]
method[expandAllFixedHeight, return_type[void], modifier[public static], parameter[tree]] begin[{]
local_variable[type[TreeCellRenderer], cellRenderer]
local_variable[type[Component], treeCellRendererComponent]
local_variable[type[int], rowHeight]
call[tree.setRowHeight, parameter[member[.rowHeight]]]
local_variable[type[List], expansionListeners]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=expansionListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeTreeExpansionListener, postfix_operators=[], prefix_operators=[], qualifier=tree, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=expansionListeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=expansionListener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TreeExpansionListener, sub_type=None))), label=None)
local_variable[type[TreePath], rootPath]
call[.expandAllRecursively, parameter[member[.tree], member[.rootPath]]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=expansionListener, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addTreeExpansionListener, postfix_operators=[], prefix_operators=[], qualifier=tree, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=expansionListeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=expansionListener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TreeExpansionListener, sub_type=None))), label=None)
call[tree.collapsePath, parameter[member[.rootPath]]]
call[tree.expandPath, parameter[member[.rootPath]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[void] identifier[expandAllFixedHeight] operator[SEP] identifier[JTree] identifier[tree] operator[SEP] {
identifier[TreeCellRenderer] identifier[cellRenderer] operator[=] identifier[tree] operator[SEP] identifier[getCellRenderer] operator[SEP] operator[SEP] operator[SEP] identifier[Component] identifier[treeCellRendererComponent] operator[=] identifier[cellRenderer] operator[SEP] identifier[getTreeCellRendererComponent] operator[SEP] identifier[tree] , identifier[tree] operator[SEP] identifier[getModel] operator[SEP] operator[SEP] operator[SEP] identifier[getRoot] operator[SEP] operator[SEP] , literal[boolean] , literal[boolean] , literal[boolean] , Other[1] , literal[boolean] operator[SEP] operator[SEP] Keyword[int] identifier[rowHeight] operator[=] identifier[treeCellRendererComponent] operator[SEP] identifier[getPreferredSize] operator[SEP] operator[SEP] operator[SEP] identifier[height] operator[+] Other[2] operator[SEP] identifier[tree] operator[SEP] identifier[setRowHeight] operator[SEP] identifier[rowHeight] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[TreeExpansionListener] operator[>] identifier[expansionListeners] operator[=] identifier[Arrays] operator[SEP] identifier[asList] operator[SEP] identifier[tree] operator[SEP] identifier[getTreeExpansionListeners] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TreeExpansionListener] identifier[expansionListener] operator[:] identifier[expansionListeners] operator[SEP] {
identifier[tree] operator[SEP] identifier[removeTreeExpansionListener] operator[SEP] identifier[expansionListener] operator[SEP] operator[SEP]
}
identifier[TreePath] identifier[rootPath] operator[=] Keyword[new] identifier[TreePath] operator[SEP] identifier[tree] operator[SEP] identifier[getModel] operator[SEP] operator[SEP] operator[SEP] identifier[getRoot] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[expandAllRecursively] operator[SEP] identifier[tree] , identifier[rootPath] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[TreeExpansionListener] identifier[expansionListener] operator[:] identifier[expansionListeners] operator[SEP] {
identifier[tree] operator[SEP] identifier[addTreeExpansionListener] operator[SEP] identifier[expansionListener] operator[SEP] operator[SEP]
}
identifier[tree] operator[SEP] identifier[collapsePath] operator[SEP] identifier[rootPath] operator[SEP] operator[SEP] identifier[tree] operator[SEP] identifier[expandPath] operator[SEP] identifier[rootPath] operator[SEP] operator[SEP]
}
|
public void exploreFrom(int root, BitSet visited) {
int first = 0;
int last = 0;
int i = root;
fifo[last++] = i;
visited.set(i);
while (first < last) {
i = fifo[first++];
for (int j : g.getPotNeighOf(i)) {
if (!visited.get(j)) {
visited.set(j);
fifo[last++] = j;
}
}
}
}
|
class class_name[name] begin[{]
method[exploreFrom, return_type[void], modifier[public], parameter[root, visited]] begin[{]
local_variable[type[int], first]
local_variable[type[int], last]
local_variable[type[int], i]
assign[member[.fifo], member[.i]]
call[visited.set, parameter[member[.i]]]
while[binary_operation[member[.first], <, member[.last]]] begin[{]
assign[member[.i], member[.fifo]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=['!'], qualifier=visited, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=set, postfix_operators=[], prefix_operators=[], qualifier=visited, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=fifo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=last, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=j, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPotNeighOf, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=j)], modifiers=set(), type=BasicType(dimensions=[], name=int))), label=None)
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[exploreFrom] operator[SEP] Keyword[int] identifier[root] , identifier[BitSet] identifier[visited] operator[SEP] {
Keyword[int] identifier[first] operator[=] Other[0] operator[SEP] Keyword[int] identifier[last] operator[=] Other[0] operator[SEP] Keyword[int] identifier[i] operator[=] identifier[root] operator[SEP] identifier[fifo] operator[SEP] identifier[last] operator[++] operator[SEP] operator[=] identifier[i] operator[SEP] identifier[visited] operator[SEP] identifier[set] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[first] operator[<] identifier[last] operator[SEP] {
identifier[i] operator[=] identifier[fifo] operator[SEP] identifier[first] operator[++] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[j] operator[:] identifier[g] operator[SEP] identifier[getPotNeighOf] operator[SEP] identifier[i] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[visited] operator[SEP] identifier[get] operator[SEP] identifier[j] operator[SEP] operator[SEP] {
identifier[visited] operator[SEP] identifier[set] operator[SEP] identifier[j] operator[SEP] operator[SEP] identifier[fifo] operator[SEP] identifier[last] operator[++] operator[SEP] operator[=] identifier[j] operator[SEP]
}
}
}
}
|
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case TypesPackage.JVM_TYPE_PARAMETER__CONSTRAINTS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getConstraints()).basicAdd(otherEnd, msgs);
case TypesPackage.JVM_TYPE_PARAMETER__DECLARATOR:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetDeclarator((JvmTypeParameterDeclarator)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
|
class class_name[name] begin[{]
method[eInverseAdd, return_type[type[NotificationChain]], modifier[public], parameter[otherEnd, featureID, msgs]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[MemberReference(member=JVM_TYPE_PARAMETER__CONSTRAINTS, postfix_operators=[], prefix_operators=[], qualifier=TypesPackage, selectors=[])], statements=[ReturnStatement(expression=Cast(expression=Cast(expression=MethodInvocation(arguments=[], member=getConstraints, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=InternalEList, sub_type=None)), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=InternalEObject, sub_type=None))], dimensions=[], name=InternalEList, sub_type=None)), label=None)]), SwitchStatementCase(case=[MemberReference(member=JVM_TYPE_PARAMETER__DECLARATOR, postfix_operators=[], prefix_operators=[], qualifier=TypesPackage, selectors=[])], statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=eInternalContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eBasicRemoveFromContainer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None)), ReturnStatement(expression=MethodInvocation(arguments=[Cast(expression=MemberReference(member=otherEnd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JvmTypeParameterDeclarator, sub_type=None)), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=basicSetDeclarator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])], expression=MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
return[SuperMethodInvocation(arguments=[MemberReference(member=otherEnd, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=featureID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=msgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=eInverseAdd, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)]
end[}]
END[}]
|
annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] annotation[@] identifier[Override] Keyword[public] identifier[NotificationChain] identifier[eInverseAdd] operator[SEP] identifier[InternalEObject] identifier[otherEnd] , Keyword[int] identifier[featureID] , identifier[NotificationChain] identifier[msgs] operator[SEP] {
Keyword[switch] operator[SEP] identifier[featureID] operator[SEP] {
Keyword[case] identifier[TypesPackage] operator[SEP] identifier[JVM_TYPE_PARAMETER__CONSTRAINTS] operator[:] Keyword[return] operator[SEP] operator[SEP] identifier[InternalEList] operator[<] identifier[InternalEObject] operator[>] operator[SEP] operator[SEP] identifier[InternalEList] operator[<] operator[?] operator[>] operator[SEP] identifier[getConstraints] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[basicAdd] operator[SEP] identifier[otherEnd] , identifier[msgs] operator[SEP] operator[SEP] Keyword[case] identifier[TypesPackage] operator[SEP] identifier[JVM_TYPE_PARAMETER__DECLARATOR] operator[:] Keyword[if] operator[SEP] identifier[eInternalContainer] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[msgs] operator[=] identifier[eBasicRemoveFromContainer] operator[SEP] identifier[msgs] operator[SEP] operator[SEP] Keyword[return] identifier[basicSetDeclarator] operator[SEP] operator[SEP] identifier[JvmTypeParameterDeclarator] operator[SEP] identifier[otherEnd] , identifier[msgs] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[super] operator[SEP] identifier[eInverseAdd] operator[SEP] identifier[otherEnd] , identifier[featureID] , identifier[msgs] operator[SEP] operator[SEP]
}
|
public void setRoles(java.util.Collection<Role> roles) {
if (roles == null) {
this.roles = null;
return;
}
this.roles = new com.amazonaws.internal.SdkInternalList<Role>(roles);
}
|
class class_name[name] begin[{]
method[setRoles, return_type[void], modifier[public], parameter[roles]] begin[{]
if[binary_operation[member[.roles], ==, literal[null]]] begin[{]
assign[THIS[member[None.roles]], literal[null]]
return[None]
else begin[{]
None
end[}]
assign[THIS[member[None.roles]], ClassCreator(arguments=[MemberReference(member=roles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=com, sub_type=ReferenceType(arguments=None, dimensions=None, name=amazonaws, sub_type=ReferenceType(arguments=None, dimensions=None, name=internal, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Role, sub_type=None))], dimensions=None, name=SdkInternalList, sub_type=None)))))]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[setRoles] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Collection] operator[<] identifier[Role] operator[>] identifier[roles] operator[SEP] {
Keyword[if] operator[SEP] identifier[roles] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[roles] operator[=] Other[null] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[this] operator[SEP] identifier[roles] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[Role] operator[>] operator[SEP] identifier[roles] operator[SEP] operator[SEP]
}
|
public boolean exists(VirtualFile mountPoint, VirtualFile target) {
final File file = getFile(mountPoint, target);
return privileged ? doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.valueOf(VFSUtils.exists(file));
}
}).booleanValue() : VFSUtils.exists(file);
}
|
class class_name[name] begin[{]
method[exists, return_type[type[boolean]], modifier[public], parameter[mountPoint, target]] begin[{]
local_variable[type[File], file]
return[TernaryExpression(condition=MemberReference(member=privileged, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exists, postfix_operators=[], prefix_operators=[], qualifier=VFSUtils, selectors=[], type_arguments=None), if_true=MethodInvocation(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[], body=[ReturnStatement(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=exists, postfix_operators=[], prefix_operators=[], qualifier=VFSUtils, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Boolean, selectors=[], type_arguments=None), label=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], return_type=ReferenceType(arguments=None, dimensions=[], name=Boolean, 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=Boolean, sub_type=None))], dimensions=None, name=PrivilegedAction, sub_type=None))], member=doPrivileged, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=booleanValue, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None))]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[exists] operator[SEP] identifier[VirtualFile] identifier[mountPoint] , identifier[VirtualFile] identifier[target] operator[SEP] {
Keyword[final] identifier[File] identifier[file] operator[=] identifier[getFile] operator[SEP] identifier[mountPoint] , identifier[target] operator[SEP] operator[SEP] Keyword[return] identifier[privileged] operator[?] identifier[doPrivileged] operator[SEP] Keyword[new] identifier[PrivilegedAction] operator[<] identifier[Boolean] operator[>] operator[SEP] operator[SEP] {
Keyword[public] identifier[Boolean] identifier[run] operator[SEP] operator[SEP] {
Keyword[return] identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[VFSUtils] operator[SEP] identifier[exists] operator[SEP] identifier[file] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] operator[SEP] identifier[booleanValue] operator[SEP] operator[SEP] operator[:] identifier[VFSUtils] operator[SEP] identifier[exists] operator[SEP] identifier[file] operator[SEP] operator[SEP]
}
|
@NotNull
protected Map<String, Map<String, Object>> toTypeArguments(ParameterElement... parameters) {
final LinkedHashMap<String, Map<String, Object>> map = new LinkedHashMap<>(parameters.length);
for (ParameterElement ce : parameters) {
final ClassElement type = ce.getType();
if (type == null) {
continue;
}
final Map<String, ClassElement> subArgs = type.getTypeArguments();
if (CollectionUtils.isNotEmpty(subArgs)) {
map.put(ce.getName(), toTypeArguments(subArgs));
}
}
return map;
}
|
class class_name[name] begin[{]
method[toTypeArguments, return_type[type[Map]], modifier[protected], parameter[parameters]] begin[{]
local_variable[type[LinkedHashMap], map]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getType, postfix_operators=[], prefix_operators=[], qualifier=ce, selectors=[], type_arguments=None), name=type)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ClassElement, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=type, 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=[ContinueStatement(goto=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getTypeArguments, postfix_operators=[], prefix_operators=[], qualifier=type, selectors=[], type_arguments=None), name=subArgs)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ClassElement, sub_type=None))], dimensions=[], name=Map, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=subArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotEmpty, postfix_operators=[], prefix_operators=[], qualifier=CollectionUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=ce, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=subArgs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=toTypeArguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=put, postfix_operators=[], prefix_operators=[], qualifier=map, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=parameters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=ce)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ParameterElement, sub_type=None))), label=None)
return[member[.map]]
end[}]
END[}]
|
annotation[@] identifier[NotNull] Keyword[protected] identifier[Map] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[toTypeArguments] operator[SEP] identifier[ParameterElement] operator[...] identifier[parameters] operator[SEP] {
Keyword[final] identifier[LinkedHashMap] operator[<] identifier[String] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] operator[>] identifier[map] operator[=] Keyword[new] identifier[LinkedHashMap] operator[<] operator[>] operator[SEP] identifier[parameters] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ParameterElement] identifier[ce] operator[:] identifier[parameters] operator[SEP] {
Keyword[final] identifier[ClassElement] identifier[type] operator[=] identifier[ce] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[ClassElement] operator[>] identifier[subArgs] operator[=] identifier[type] operator[SEP] identifier[getTypeArguments] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[CollectionUtils] operator[SEP] identifier[isNotEmpty] operator[SEP] identifier[subArgs] operator[SEP] operator[SEP] {
identifier[map] operator[SEP] identifier[put] operator[SEP] identifier[ce] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , identifier[toTypeArguments] operator[SEP] identifier[subArgs] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[map] operator[SEP]
}
|
@Override
public <T> T getOrDefine(final String key, final T defaultValue, DomainResolver resolver, String description) {
T value = get(key, resolver);
if (value != null) {
return value;
}
set(key, defaultValue, description);
return defaultValue;
}
|
class class_name[name] begin[{]
method[getOrDefine, return_type[type[T]], modifier[public], parameter[key, defaultValue, resolver, description]] begin[{]
local_variable[type[T], value]
if[binary_operation[member[.value], !=, literal[null]]] begin[{]
return[member[.value]]
else begin[{]
None
end[}]
call[.set, parameter[member[.key], member[.defaultValue], member[.description]]]
return[member[.defaultValue]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[getOrDefine] operator[SEP] Keyword[final] identifier[String] identifier[key] , Keyword[final] identifier[T] identifier[defaultValue] , identifier[DomainResolver] identifier[resolver] , identifier[String] identifier[description] operator[SEP] {
identifier[T] identifier[value] operator[=] identifier[get] operator[SEP] identifier[key] , identifier[resolver] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[value] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[value] operator[SEP]
}
identifier[set] operator[SEP] identifier[key] , identifier[defaultValue] , identifier[description] operator[SEP] operator[SEP] Keyword[return] identifier[defaultValue] operator[SEP]
}
|
public Observable<ServiceResponse<Page<VpnConnectionInner>>> listByVpnGatewayNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.listByVpnGatewayNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<VpnConnectionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<VpnConnectionInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<VpnConnectionInner>> result = listByVpnGatewayNextDelegate(response);
return Observable.just(new ServiceResponse<Page<VpnConnectionInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
|
class class_name[name] begin[{]
method[listByVpnGatewayNextSinglePageAsync, return_type[type[Observable]], modifier[public], parameter[nextPageLink]] begin[{]
if[binary_operation[member[.nextPageLink], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Parameter nextPageLink is required and cannot be null.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
local_variable[type[String], nextUrl]
return[call[service.listByVpnGatewayNext, parameter[member[.nextUrl], THIS[member[None.client]call[None.acceptLanguage, parameter[]]], THIS[member[None.client]call[None.userAgent, parameter[]]]]]]
end[}]
END[}]
|
Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[VpnConnectionInner] operator[>] operator[>] operator[>] identifier[listByVpnGatewayNextSinglePageAsync] operator[SEP] Keyword[final] identifier[String] identifier[nextPageLink] operator[SEP] {
Keyword[if] operator[SEP] identifier[nextPageLink] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[String] identifier[nextUrl] operator[=] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[nextPageLink] operator[SEP] operator[SEP] Keyword[return] identifier[service] operator[SEP] identifier[listByVpnGatewayNext] operator[SEP] identifier[nextUrl] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[acceptLanguage] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[userAgent] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[flatMap] operator[SEP] Keyword[new] identifier[Func1] operator[<] identifier[Response] operator[<] identifier[ResponseBody] operator[>] , identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[VpnConnectionInner] operator[>] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] identifier[Observable] operator[<] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[VpnConnectionInner] operator[>] operator[>] operator[>] identifier[call] operator[SEP] identifier[Response] operator[<] identifier[ResponseBody] operator[>] identifier[response] operator[SEP] {
Keyword[try] {
identifier[ServiceResponse] operator[<] identifier[PageImpl] operator[<] identifier[VpnConnectionInner] operator[>] operator[>] identifier[result] operator[=] identifier[listByVpnGatewayNextDelegate] operator[SEP] identifier[response] operator[SEP] operator[SEP] Keyword[return] identifier[Observable] operator[SEP] identifier[just] operator[SEP] Keyword[new] identifier[ServiceResponse] operator[<] identifier[Page] operator[<] identifier[VpnConnectionInner] operator[>] operator[>] operator[SEP] identifier[result] operator[SEP] identifier[body] operator[SEP] operator[SEP] , identifier[result] operator[SEP] identifier[response] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
Keyword[return] identifier[Observable] operator[SEP] identifier[error] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
public static <T> Collector<T, ?, IntMoments>
toIntMoments(final ToIntFunction<? super T> mapper) {
requireNonNull(mapper);
return Collector.of(
IntMomentStatistics::new,
(a, b) -> a.accept(mapper.applyAsInt(b)),
IntMomentStatistics::combine,
IntMoments::of
);
}
|
class class_name[name] begin[{]
method[toIntMoments, return_type[type[Collector]], modifier[public static], parameter[mapper]] begin[{]
call[.requireNonNull, parameter[member[.mapper]]]
return[call[Collector.of, parameter[MethodReference(expression=MemberReference(member=IntMomentStatistics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=new, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), type_arguments=[]), LambdaExpression(body=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=b, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=applyAsInt, postfix_operators=[], prefix_operators=[], qualifier=mapper, selectors=[], type_arguments=None)], member=accept, postfix_operators=[], prefix_operators=[], qualifier=a, selectors=[], type_arguments=None), parameters=[InferredFormalParameter(name=a), InferredFormalParameter(name=b)]), MethodReference(expression=MemberReference(member=IntMomentStatistics, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=combine, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[]), MethodReference(expression=MemberReference(member=IntMoments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), method=MemberReference(member=of, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type_arguments=[])]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[Collector] operator[<] identifier[T] , operator[?] , identifier[IntMoments] operator[>] identifier[toIntMoments] operator[SEP] Keyword[final] identifier[ToIntFunction] operator[<] operator[?] Keyword[super] identifier[T] operator[>] identifier[mapper] operator[SEP] {
identifier[requireNonNull] operator[SEP] identifier[mapper] operator[SEP] operator[SEP] Keyword[return] identifier[Collector] operator[SEP] identifier[of] operator[SEP] identifier[IntMomentStatistics] operator[::] Keyword[new] , operator[SEP] identifier[a] , identifier[b] operator[SEP] operator[->] identifier[a] operator[SEP] identifier[accept] operator[SEP] identifier[mapper] operator[SEP] identifier[applyAsInt] operator[SEP] identifier[b] operator[SEP] operator[SEP] , identifier[IntMomentStatistics] operator[::] identifier[combine] , identifier[IntMoments] operator[::] identifier[of] operator[SEP] operator[SEP]
}
|
@NotNull
@Deprecated
@ObjectiveCName("requestStartAnonymousAuthWithUserName:")
public Command<AuthState> requestStartAnonymousAuth(String userName) {
return modules.getAuthModule().requestStartAnonymousAuth(userName);
}
|
class class_name[name] begin[{]
method[requestStartAnonymousAuth, return_type[type[Command]], modifier[public], parameter[userName]] begin[{]
return[call[modules.getAuthModule, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[NotNull] annotation[@] identifier[Deprecated] annotation[@] identifier[ObjectiveCName] operator[SEP] literal[String] operator[SEP] Keyword[public] identifier[Command] operator[<] identifier[AuthState] operator[>] identifier[requestStartAnonymousAuth] operator[SEP] identifier[String] identifier[userName] operator[SEP] {
Keyword[return] identifier[modules] operator[SEP] identifier[getAuthModule] operator[SEP] operator[SEP] operator[SEP] identifier[requestStartAnonymousAuth] operator[SEP] identifier[userName] operator[SEP] operator[SEP]
}
|
public synchronized final void setClassShutter(ClassShutter shutter)
{
if (sealed) onSealedMutation();
if (shutter == null) throw new IllegalArgumentException();
if (hasClassShutter) {
throw new SecurityException("Cannot overwrite existing " +
"ClassShutter object");
}
classShutter = shutter;
hasClassShutter = true;
}
|
class class_name[name] begin[{]
method[setClassShutter, return_type[void], modifier[synchronized final public], parameter[shutter]] begin[{]
if[member[.sealed]] begin[{]
call[.onSealedMutation, parameter[]]
else begin[{]
None
end[}]
if[binary_operation[member[.shutter], ==, 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=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[member[.hasClassShutter]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Cannot overwrite existing "), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="ClassShutter object"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SecurityException, sub_type=None)), label=None)
else begin[{]
None
end[}]
assign[member[.classShutter], member[.shutter]]
assign[member[.hasClassShutter], literal[true]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[final] Keyword[void] identifier[setClassShutter] operator[SEP] identifier[ClassShutter] identifier[shutter] operator[SEP] {
Keyword[if] operator[SEP] identifier[sealed] operator[SEP] identifier[onSealedMutation] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[shutter] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[hasClassShutter] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SecurityException] operator[SEP] literal[String] operator[+] literal[String] operator[SEP] operator[SEP]
}
identifier[classShutter] operator[=] identifier[shutter] operator[SEP] identifier[hasClassShutter] operator[=] literal[boolean] operator[SEP]
}
|
public ResourceChange withScope(ResourceAttribute... scope) {
com.amazonaws.internal.SdkInternalList<String> scopeCopy = new com.amazonaws.internal.SdkInternalList<String>(scope.length);
for (ResourceAttribute value : scope) {
scopeCopy.add(value.toString());
}
if (getScope() == null) {
setScope(scopeCopy);
} else {
getScope().addAll(scopeCopy);
}
return this;
}
|
class class_name[name] begin[{]
method[withScope, return_type[type[ResourceChange]], modifier[public], parameter[scope]] begin[{]
local_variable[type[com], scopeCopy]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=value, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=scopeCopy, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=scope, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=value)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ResourceAttribute, sub_type=None))), label=None)
if[binary_operation[call[.getScope, parameter[]], ==, literal[null]]] begin[{]
call[.setScope, parameter[member[.scopeCopy]]]
else begin[{]
call[.getScope, parameter[]]
end[}]
return[THIS[]]
end[}]
END[}]
|
Keyword[public] identifier[ResourceChange] identifier[withScope] operator[SEP] identifier[ResourceAttribute] operator[...] identifier[scope] operator[SEP] {
identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] identifier[scopeCopy] operator[=] Keyword[new] identifier[com] operator[SEP] identifier[amazonaws] operator[SEP] identifier[internal] operator[SEP] identifier[SdkInternalList] operator[<] identifier[String] operator[>] operator[SEP] identifier[scope] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[ResourceAttribute] identifier[value] operator[:] identifier[scope] operator[SEP] {
identifier[scopeCopy] operator[SEP] identifier[add] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[getScope] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[setScope] operator[SEP] identifier[scopeCopy] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[getScope] operator[SEP] operator[SEP] operator[SEP] identifier[addAll] operator[SEP] identifier[scopeCopy] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
@Override
public GetAppLaunchConfigurationResult getAppLaunchConfiguration(GetAppLaunchConfigurationRequest request) {
request = beforeClientExecution(request);
return executeGetAppLaunchConfiguration(request);
}
|
class class_name[name] begin[{]
method[getAppLaunchConfiguration, return_type[type[GetAppLaunchConfigurationResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeGetAppLaunchConfiguration, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[GetAppLaunchConfigurationResult] identifier[getAppLaunchConfiguration] operator[SEP] identifier[GetAppLaunchConfigurationRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeGetAppLaunchConfiguration] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public boolean isDirectChildOfAccount(final Account effectiveAccount,
final Account operatedAccount) {
return operatedAccount.getParentSid().equals(effectiveAccount.getSid());
}
|
class class_name[name] begin[{]
method[isDirectChildOfAccount, return_type[type[boolean]], modifier[public], parameter[effectiveAccount, operatedAccount]] begin[{]
return[call[operatedAccount.getParentSid, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[isDirectChildOfAccount] operator[SEP] Keyword[final] identifier[Account] identifier[effectiveAccount] , Keyword[final] identifier[Account] identifier[operatedAccount] operator[SEP] {
Keyword[return] identifier[operatedAccount] operator[SEP] identifier[getParentSid] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[effectiveAccount] operator[SEP] identifier[getSid] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public VariableInner update(String resourceGroupName, String automationAccountName, String variableName, VariableUpdateParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName, parameters).toBlocking().single().body();
}
|
class class_name[name] begin[{]
method[update, return_type[type[VariableInner]], modifier[public], parameter[resourceGroupName, automationAccountName, variableName, parameters]] begin[{]
return[call[.updateWithServiceResponseAsync, parameter[member[.resourceGroupName], member[.automationAccountName], member[.variableName], member[.parameters]]]]
end[}]
END[}]
|
Keyword[public] identifier[VariableInner] identifier[update] operator[SEP] identifier[String] identifier[resourceGroupName] , identifier[String] identifier[automationAccountName] , identifier[String] identifier[variableName] , identifier[VariableUpdateParameters] identifier[parameters] operator[SEP] {
Keyword[return] identifier[updateWithServiceResponseAsync] operator[SEP] identifier[resourceGroupName] , identifier[automationAccountName] , identifier[variableName] , identifier[parameters] 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 String convertIfcLoadGroupTypeEnumToString(EDataType eDataType, Object instanceValue) {
return instanceValue == null ? null : instanceValue.toString();
}
|
class class_name[name] begin[{]
method[convertIfcLoadGroupTypeEnumToString, return_type[type[String]], modifier[public], parameter[eDataType, instanceValue]] begin[{]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=instanceValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=instanceValue, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null))]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[convertIfcLoadGroupTypeEnumToString] operator[SEP] identifier[EDataType] identifier[eDataType] , identifier[Object] identifier[instanceValue] operator[SEP] {
Keyword[return] identifier[instanceValue] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[instanceValue] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
public static <T> boolean matchAtLeastOnce(final T object, final List<Filter<T>> filters) {
// Check sanity
Validate.notNull(filters, "filters");
boolean acceptedByAtLeastOneFilter = false;
for (Filter<T> current : filters) {
if (current.accept(object)) {
acceptedByAtLeastOneFilter = true;
break;
}
}
// All done.
return acceptedByAtLeastOneFilter;
}
|
class class_name[name] begin[{]
method[matchAtLeastOnce, return_type[type[boolean]], modifier[public static], parameter[object, filters]] begin[{]
call[Validate.notNull, parameter[member[.filters], literal["filters"]]]
local_variable[type[boolean], acceptedByAtLeastOneFilter]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=accept, postfix_operators=[], prefix_operators=[], qualifier=current, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=acceptedByAtLeastOneFilter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=filters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=current)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=Filter, sub_type=None))), label=None)
return[member[.acceptedByAtLeastOneFilter]]
end[}]
END[}]
|
Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] Keyword[boolean] identifier[matchAtLeastOnce] operator[SEP] Keyword[final] identifier[T] identifier[object] , Keyword[final] identifier[List] operator[<] identifier[Filter] operator[<] identifier[T] operator[>] operator[>] identifier[filters] operator[SEP] {
identifier[Validate] operator[SEP] identifier[notNull] operator[SEP] identifier[filters] , literal[String] operator[SEP] operator[SEP] Keyword[boolean] identifier[acceptedByAtLeastOneFilter] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[Filter] operator[<] identifier[T] operator[>] identifier[current] operator[:] identifier[filters] operator[SEP] {
Keyword[if] operator[SEP] identifier[current] operator[SEP] identifier[accept] operator[SEP] identifier[object] operator[SEP] operator[SEP] {
identifier[acceptedByAtLeastOneFilter] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[return] identifier[acceptedByAtLeastOneFilter] operator[SEP]
}
|
private int computeRequiredBufferNum(int numChildNodes, int combineDegree)
{
// numChildrenForLastNode used to determine that the last node is needed for the current level.
// Please see buildCombineTree() for more details.
final int numChildrenForLastNode = numChildNodes % combineDegree;
final int numCurLevelNodes = numChildNodes / combineDegree + (numChildrenForLastNode > 1 ? 1 : 0);
final int numChildOfParentNodes = numCurLevelNodes + (numChildrenForLastNode == 1 ? 1 : 0);
if (numChildOfParentNodes == 1) {
return numCurLevelNodes;
} else {
return numCurLevelNodes +
computeRequiredBufferNum(numChildOfParentNodes, intermediateCombineDegree);
}
}
|
class class_name[name] begin[{]
method[computeRequiredBufferNum, return_type[type[int]], modifier[private], parameter[numChildNodes, combineDegree]] begin[{]
local_variable[type[int], numChildrenForLastNode]
local_variable[type[int], numCurLevelNodes]
local_variable[type[int], numChildOfParentNodes]
if[binary_operation[member[.numChildOfParentNodes], ==, literal[1]]] begin[{]
return[member[.numCurLevelNodes]]
else begin[{]
return[binary_operation[member[.numCurLevelNodes], +, call[.computeRequiredBufferNum, parameter[member[.numChildOfParentNodes], member[.intermediateCombineDegree]]]]]
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[int] identifier[computeRequiredBufferNum] operator[SEP] Keyword[int] identifier[numChildNodes] , Keyword[int] identifier[combineDegree] operator[SEP] {
Keyword[final] Keyword[int] identifier[numChildrenForLastNode] operator[=] identifier[numChildNodes] operator[%] identifier[combineDegree] operator[SEP] Keyword[final] Keyword[int] identifier[numCurLevelNodes] operator[=] identifier[numChildNodes] operator[/] identifier[combineDegree] operator[+] operator[SEP] identifier[numChildrenForLastNode] operator[>] Other[1] operator[?] Other[1] operator[:] Other[0] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[numChildOfParentNodes] operator[=] identifier[numCurLevelNodes] operator[+] operator[SEP] identifier[numChildrenForLastNode] operator[==] Other[1] operator[?] Other[1] operator[:] Other[0] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[numChildOfParentNodes] operator[==] Other[1] operator[SEP] {
Keyword[return] identifier[numCurLevelNodes] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[numCurLevelNodes] operator[+] identifier[computeRequiredBufferNum] operator[SEP] identifier[numChildOfParentNodes] , identifier[intermediateCombineDegree] operator[SEP] operator[SEP]
}
}
|
public static EntitySet getAndCheckEntitySet(EntityDataModel entityDataModel, String entitySetName) {
EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(entitySetName);
if (entitySet == null) {
throw new ODataSystemException("Entity set not found in the entity data model: " + entitySetName);
}
return entitySet;
}
|
class class_name[name] begin[{]
method[getAndCheckEntitySet, return_type[type[EntitySet]], modifier[public static], parameter[entityDataModel, entitySetName]] begin[{]
local_variable[type[EntitySet], entitySet]
if[binary_operation[member[.entitySet], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Entity set not found in the entity data model: "), operandr=MemberReference(member=entitySetName, 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=ODataSystemException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.entitySet]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[EntitySet] identifier[getAndCheckEntitySet] operator[SEP] identifier[EntityDataModel] identifier[entityDataModel] , identifier[String] identifier[entitySetName] operator[SEP] {
identifier[EntitySet] identifier[entitySet] operator[=] identifier[entityDataModel] operator[SEP] identifier[getEntityContainer] operator[SEP] operator[SEP] operator[SEP] identifier[getEntitySet] operator[SEP] identifier[entitySetName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[entitySet] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ODataSystemException] operator[SEP] literal[String] operator[+] identifier[entitySetName] operator[SEP] operator[SEP]
}
Keyword[return] identifier[entitySet] operator[SEP]
}
|
public Matrix4x3f scaleXY(float x, float y, Matrix4x3f dest) {
return scale(x, y, 1.0f, dest);
}
|
class class_name[name] begin[{]
method[scaleXY, return_type[type[Matrix4x3f]], modifier[public], parameter[x, y, dest]] begin[{]
return[call[.scale, parameter[member[.x], member[.y], literal[1.0f], member[.dest]]]]
end[}]
END[}]
|
Keyword[public] identifier[Matrix4x3f] identifier[scaleXY] operator[SEP] Keyword[float] identifier[x] , Keyword[float] identifier[y] , identifier[Matrix4x3f] identifier[dest] operator[SEP] {
Keyword[return] identifier[scale] operator[SEP] identifier[x] , identifier[y] , literal[Float] , identifier[dest] operator[SEP] operator[SEP]
}
|
public boolean removeUpdate(final Password password) throws IOException, ServletException {
if (!singelton.can(CFMLEngine.CAN_UPDATE, password)) throw new IOException("access denied to update CFMLEngine");
return removeUpdate();
}
|
class class_name[name] begin[{]
method[removeUpdate, return_type[type[boolean]], modifier[public], parameter[password]] begin[{]
if[call[singelton.can, parameter[member[CFMLEngine.CAN_UPDATE], member[.password]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="access denied to update CFMLEngine")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.removeUpdate, parameter[]]]
end[}]
END[}]
|
Keyword[public] Keyword[boolean] identifier[removeUpdate] operator[SEP] Keyword[final] identifier[Password] identifier[password] operator[SEP] Keyword[throws] identifier[IOException] , identifier[ServletException] {
Keyword[if] operator[SEP] operator[!] identifier[singelton] operator[SEP] identifier[can] operator[SEP] identifier[CFMLEngine] operator[SEP] identifier[CAN_UPDATE] , identifier[password] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[removeUpdate] operator[SEP] operator[SEP] operator[SEP]
}
|
private void updateLinkedFields(
Table referenceTable,
ObjectNode exemplarEntity,
String linkedTableName,
String keyField,
String ...linkedFieldsToUpdate
) throws SQLException {
boolean updatingStopTimes = "stop_times".equals(linkedTableName);
// Collect fields, the JSON values for these fields, and the strings to add to the prepared statement into Lists.
List<Field> fields = new ArrayList<>();
List<JsonNode> values = new ArrayList<>();
List<String> fieldStrings = new ArrayList<>();
for (String field : linkedFieldsToUpdate) {
fields.add(referenceTable.getFieldForName(field));
values.add(exemplarEntity.get(field));
fieldStrings.add(String.format("%s = ?", field));
}
String setFields = String.join(", ", fieldStrings);
// If updating stop_times, use a more complex query that joins trips to stop_times in order to match on pattern_id
Field orderField = updatingStopTimes ? referenceTable.getFieldForName(referenceTable.getOrderFieldName()) : null;
String sql = updatingStopTimes
? String.format(
"update %s.stop_times st set %s from %s.trips t " +
"where st.trip_id = t.trip_id AND t.%s = ? AND st.%s = ?",
tablePrefix,
setFields,
tablePrefix,
keyField,
orderField.name
)
: String.format("update %s.%s set %s where %s = ?", tablePrefix, linkedTableName, setFields, keyField);
// Prepare the statement and set statement parameters
PreparedStatement statement = connection.prepareStatement(sql);
int oneBasedIndex = 1;
// Iterate over list of fields that need to be updated and set params.
for (int i = 0; i < fields.size(); i++) {
Field field = fields.get(i);
String newValue = values.get(i).isNull() ? null : values.get(i).asText();
if (newValue == null) field.setNull(statement, oneBasedIndex++);
else field.setParameter(statement, oneBasedIndex++, newValue);
}
// Set "where clause" with value for key field (e.g., set values where pattern_id = '3')
statement.setString(oneBasedIndex++, exemplarEntity.get(keyField).asText());
if (updatingStopTimes) {
// If updating stop times set the order field parameter (stop_sequence)
String orderValue = exemplarEntity.get(orderField.name).asText();
orderField.setParameter(statement, oneBasedIndex++, orderValue);
}
// Log query, execute statement, and log result.
LOG.debug(statement.toString());
int entitiesUpdated = statement.executeUpdate();
LOG.debug("{} {} linked fields updated", entitiesUpdated, linkedTableName);
}
|
class class_name[name] begin[{]
method[updateLinkedFields, return_type[void], modifier[private], parameter[referenceTable, exemplarEntity, linkedTableName, keyField, linkedFieldsToUpdate]] begin[{]
local_variable[type[boolean], updatingStopTimes]
local_variable[type[List], fields]
local_variable[type[List], values]
local_variable[type[List], fieldStrings]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFieldForName, postfix_operators=[], prefix_operators=[], qualifier=referenceTable, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=exemplarEntity, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="%s = ?"), MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=format, postfix_operators=[], prefix_operators=[], qualifier=String, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=fieldStrings, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=linkedFieldsToUpdate, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
local_variable[type[String], setFields]
local_variable[type[Field], orderField]
local_variable[type[String], sql]
local_variable[type[PreparedStatement], statement]
local_variable[type[int], oneBasedIndex]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=fields, selectors=[], type_arguments=None), name=field)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Field, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[MethodInvocation(arguments=[], member=isNull, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_false=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=values, selectors=[MethodInvocation(arguments=[], member=asText, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), name=newValue)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=statement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=oneBasedIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newValue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setParameter, postfix_operators=[], prefix_operators=[], qualifier=field, selectors=[], type_arguments=None), label=None), label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=statement, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=oneBasedIndex, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])], member=setNull, postfix_operators=[], prefix_operators=[], qualifier=field, 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=fields, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[statement.setString, parameter[member[.oneBasedIndex], call[exemplarEntity.get, parameter[member[.keyField]]]]]
if[member[.updatingStopTimes]] begin[{]
local_variable[type[String], orderValue]
call[orderField.setParameter, parameter[member[.statement], member[.oneBasedIndex], member[.orderValue]]]
else begin[{]
None
end[}]
call[LOG.debug, parameter[call[statement.toString, parameter[]]]]
local_variable[type[int], entitiesUpdated]
call[LOG.debug, parameter[literal["{} {} linked fields updated"], member[.entitiesUpdated], member[.linkedTableName]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[updateLinkedFields] operator[SEP] identifier[Table] identifier[referenceTable] , identifier[ObjectNode] identifier[exemplarEntity] , identifier[String] identifier[linkedTableName] , identifier[String] identifier[keyField] , identifier[String] operator[...] identifier[linkedFieldsToUpdate] operator[SEP] Keyword[throws] identifier[SQLException] {
Keyword[boolean] identifier[updatingStopTimes] operator[=] literal[String] operator[SEP] identifier[equals] operator[SEP] identifier[linkedTableName] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Field] operator[>] identifier[fields] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[JsonNode] operator[>] identifier[values] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[fieldStrings] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[field] operator[:] identifier[linkedFieldsToUpdate] operator[SEP] {
identifier[fields] operator[SEP] identifier[add] operator[SEP] identifier[referenceTable] operator[SEP] identifier[getFieldForName] operator[SEP] identifier[field] operator[SEP] operator[SEP] operator[SEP] identifier[values] operator[SEP] identifier[add] operator[SEP] identifier[exemplarEntity] operator[SEP] identifier[get] operator[SEP] identifier[field] operator[SEP] operator[SEP] operator[SEP] identifier[fieldStrings] operator[SEP] identifier[add] operator[SEP] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[field] operator[SEP] operator[SEP] operator[SEP]
}
identifier[String] identifier[setFields] operator[=] identifier[String] operator[SEP] identifier[join] operator[SEP] literal[String] , identifier[fieldStrings] operator[SEP] operator[SEP] identifier[Field] identifier[orderField] operator[=] identifier[updatingStopTimes] operator[?] identifier[referenceTable] operator[SEP] identifier[getFieldForName] operator[SEP] identifier[referenceTable] operator[SEP] identifier[getOrderFieldName] operator[SEP] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] identifier[String] identifier[sql] operator[=] identifier[updatingStopTimes] operator[?] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] operator[+] literal[String] , identifier[tablePrefix] , identifier[setFields] , identifier[tablePrefix] , identifier[keyField] , identifier[orderField] operator[SEP] identifier[name] operator[SEP] operator[:] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[tablePrefix] , identifier[linkedTableName] , identifier[setFields] , identifier[keyField] operator[SEP] operator[SEP] identifier[PreparedStatement] identifier[statement] operator[=] identifier[connection] operator[SEP] identifier[prepareStatement] operator[SEP] identifier[sql] operator[SEP] operator[SEP] Keyword[int] identifier[oneBasedIndex] operator[=] Other[1] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[fields] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Field] identifier[field] operator[=] identifier[fields] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[String] identifier[newValue] operator[=] identifier[values] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[isNull] operator[SEP] operator[SEP] operator[?] Other[null] operator[:] identifier[values] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[newValue] operator[==] Other[null] operator[SEP] identifier[field] operator[SEP] identifier[setNull] operator[SEP] identifier[statement] , identifier[oneBasedIndex] operator[++] operator[SEP] operator[SEP] Keyword[else] identifier[field] operator[SEP] identifier[setParameter] operator[SEP] identifier[statement] , identifier[oneBasedIndex] operator[++] , identifier[newValue] operator[SEP] operator[SEP]
}
identifier[statement] operator[SEP] identifier[setString] operator[SEP] identifier[oneBasedIndex] operator[++] , identifier[exemplarEntity] operator[SEP] identifier[get] operator[SEP] identifier[keyField] operator[SEP] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[updatingStopTimes] operator[SEP] {
identifier[String] identifier[orderValue] operator[=] identifier[exemplarEntity] operator[SEP] identifier[get] operator[SEP] identifier[orderField] operator[SEP] identifier[name] operator[SEP] operator[SEP] identifier[asText] operator[SEP] operator[SEP] operator[SEP] identifier[orderField] operator[SEP] identifier[setParameter] operator[SEP] identifier[statement] , identifier[oneBasedIndex] operator[++] , identifier[orderValue] operator[SEP] operator[SEP]
}
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] identifier[statement] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[entitiesUpdated] operator[=] identifier[statement] operator[SEP] identifier[executeUpdate] operator[SEP] operator[SEP] operator[SEP] identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[entitiesUpdated] , identifier[linkedTableName] operator[SEP] operator[SEP]
}
|
private static boolean isORC(Path file, FileSystem fs)
throws IOException {
try {
FSDataInputStream inputStream = fs.open(file);
long size = fs.getFileStatus(file).getLen();
byte[] buffer = new byte[Math.toIntExact(Math.min(size, EXPECTED_FOOTER_SIZE))];
if (size < buffer.length) {
return false;
}
inputStream.readFully(size - buffer.length, buffer);
// get length of PostScript - last byte of the file
int postScriptSize = buffer[buffer.length - 1] & 0xff;
int magicLen = MAGIC_BUFFER.remaining();
if (postScriptSize < magicLen + 1 || postScriptSize >= buffer.length) {
return false;
}
if (!MAGIC_BUFFER.equals(ByteBuffer.wrap(buffer, buffer.length - 1 - magicLen, magicLen))) {
// Old versions of ORC (0.11) wrote the magic to the head of the file
byte[] headerMagic = new byte[magicLen];
inputStream.readFully(0, headerMagic);
// if it isn't there, this isn't an ORC file
if (!MAGIC_BUFFER.equals(ByteBuffer.wrap(headerMagic))) {
return false;
}
}
return true;
} catch (Exception e) {
throw new RuntimeException("Error occured when checking the type of file:" + file);
}
}
|
class class_name[name] begin[{]
method[isORC, return_type[type[boolean]], modifier[private static], parameter[file, fs]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=open, postfix_operators=[], prefix_operators=[], qualifier=fs, selectors=[], type_arguments=None), name=inputStream)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FSDataInputStream, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=file, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getFileStatus, postfix_operators=[], prefix_operators=[], qualifier=fs, selectors=[MethodInvocation(arguments=[], member=getLen, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=size)], modifiers=set(), type=BasicType(dimensions=[], name=long)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=EXPECTED_FOOTER_SIZE, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=min, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)], member=toIntExact, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte)), name=buffer)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=size, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[]), operator=-), MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readFully, postfix_operators=[], prefix_operators=[], qualifier=inputStream, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-))]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0xff), operator=&), name=postScriptSize)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=remaining, postfix_operators=[], prefix_operators=[], qualifier=MAGIC_BUFFER, selectors=[], type_arguments=None), name=magicLen)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=postScriptSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MemberReference(member=magicLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+), operator=<), operandr=BinaryOperation(operandl=MemberReference(member=postScriptSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[]), operator=>=), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false), label=None)])), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=buffer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=buffer, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operandr=MemberReference(member=magicLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-), MemberReference(member=magicLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wrap, postfix_operators=[], prefix_operators=[], qualifier=ByteBuffer, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=MAGIC_BUFFER, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ArrayCreator(dimensions=[MemberReference(member=magicLen, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=BasicType(dimensions=None, name=byte)), name=headerMagic)], modifiers=set(), type=BasicType(dimensions=[None], name=byte)), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), MemberReference(member=headerMagic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=readFully, postfix_operators=[], prefix_operators=[], qualifier=inputStream, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=headerMagic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=wrap, postfix_operators=[], prefix_operators=[], qualifier=ByteBuffer, selectors=[], type_arguments=None)], member=equals, postfix_operators=[], prefix_operators=['!'], qualifier=MAGIC_BUFFER, 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=false), label=None)]))])), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error occured when checking the type of file:"), operandr=MemberReference(member=file, 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=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[private] Keyword[static] Keyword[boolean] identifier[isORC] operator[SEP] identifier[Path] identifier[file] , identifier[FileSystem] identifier[fs] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[try] {
identifier[FSDataInputStream] identifier[inputStream] operator[=] identifier[fs] operator[SEP] identifier[open] operator[SEP] identifier[file] operator[SEP] operator[SEP] Keyword[long] identifier[size] operator[=] identifier[fs] operator[SEP] identifier[getFileStatus] operator[SEP] identifier[file] operator[SEP] operator[SEP] identifier[getLen] operator[SEP] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[Math] operator[SEP] identifier[toIntExact] operator[SEP] identifier[Math] operator[SEP] identifier[min] operator[SEP] identifier[size] , identifier[EXPECTED_FOOTER_SIZE] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[size] operator[<] identifier[buffer] operator[SEP] identifier[length] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
identifier[inputStream] operator[SEP] identifier[readFully] operator[SEP] identifier[size] operator[-] identifier[buffer] operator[SEP] identifier[length] , identifier[buffer] operator[SEP] operator[SEP] Keyword[int] identifier[postScriptSize] operator[=] identifier[buffer] operator[SEP] identifier[buffer] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[&] literal[Integer] operator[SEP] Keyword[int] identifier[magicLen] operator[=] identifier[MAGIC_BUFFER] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[postScriptSize] operator[<] identifier[magicLen] operator[+] Other[1] operator[||] identifier[postScriptSize] operator[>=] identifier[buffer] operator[SEP] identifier[length] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[MAGIC_BUFFER] operator[SEP] identifier[equals] operator[SEP] identifier[ByteBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[buffer] , identifier[buffer] operator[SEP] identifier[length] operator[-] Other[1] operator[-] identifier[magicLen] , identifier[magicLen] operator[SEP] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[headerMagic] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[magicLen] operator[SEP] operator[SEP] identifier[inputStream] operator[SEP] identifier[readFully] operator[SEP] Other[0] , identifier[headerMagic] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[MAGIC_BUFFER] operator[SEP] identifier[equals] operator[SEP] identifier[ByteBuffer] operator[SEP] identifier[wrap] operator[SEP] identifier[headerMagic] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] operator[+] identifier[file] operator[SEP] operator[SEP]
}
}
|
@Nullable
@OverrideOnDemand
protected String getQueryString (@Nonnull final LECTYPE aLEC)
{
return aLEC.params ().getAsString (PARAM_QUERY);
}
|
class class_name[name] begin[{]
method[getQueryString, return_type[type[String]], modifier[protected], parameter[aLEC]] begin[{]
return[call[aLEC.params, parameter[]]]
end[}]
END[}]
|
annotation[@] identifier[Nullable] annotation[@] identifier[OverrideOnDemand] Keyword[protected] identifier[String] identifier[getQueryString] operator[SEP] annotation[@] identifier[Nonnull] Keyword[final] identifier[LECTYPE] identifier[aLEC] operator[SEP] {
Keyword[return] identifier[aLEC] operator[SEP] identifier[params] operator[SEP] operator[SEP] operator[SEP] identifier[getAsString] operator[SEP] identifier[PARAM_QUERY] operator[SEP] operator[SEP]
}
|
public static final BigInteger printPriority(Priority priority)
{
int result = Priority.MEDIUM;
if (priority != null)
{
result = priority.getValue();
}
return (BigInteger.valueOf(result));
}
|
class class_name[name] begin[{]
method[printPriority, return_type[type[BigInteger]], modifier[final public static], parameter[priority]] begin[{]
local_variable[type[int], result]
if[binary_operation[member[.priority], !=, literal[null]]] begin[{]
assign[member[.result], call[priority.getValue, parameter[]]]
else begin[{]
None
end[}]
return[call[BigInteger.valueOf, parameter[member[.result]]]]
end[}]
END[}]
|
Keyword[public] Keyword[static] Keyword[final] identifier[BigInteger] identifier[printPriority] operator[SEP] identifier[Priority] identifier[priority] operator[SEP] {
Keyword[int] identifier[result] operator[=] identifier[Priority] operator[SEP] identifier[MEDIUM] operator[SEP] Keyword[if] operator[SEP] identifier[priority] operator[!=] Other[null] operator[SEP] {
identifier[result] operator[=] identifier[priority] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] operator[SEP] identifier[BigInteger] operator[SEP] identifier[valueOf] operator[SEP] identifier[result] operator[SEP] operator[SEP] operator[SEP]
}
|
public static Executor createExecutor(int threadPoolSize, int threadPriority,
QueueProcessingType tasksProcessingType) {
boolean lifo = tasksProcessingType == QueueProcessingType.LIFO;
BlockingQueue<Runnable> taskQueue =
lifo ? new LIFOLinkedBlockingDeque<Runnable>() : new LinkedBlockingQueue<Runnable>();
return new ThreadPoolExecutor(threadPoolSize, threadPoolSize, 0L, TimeUnit.MILLISECONDS, taskQueue,
createThreadFactory(threadPriority, "uil-pool-"));
}
|
class class_name[name] begin[{]
method[createExecutor, return_type[type[Executor]], modifier[public static], parameter[threadPoolSize, threadPriority, tasksProcessingType]] begin[{]
local_variable[type[boolean], lifo]
local_variable[type[BlockingQueue], taskQueue]
return[ClassCreator(arguments=[MemberReference(member=threadPoolSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=threadPoolSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0L), MemberReference(member=MILLISECONDS, postfix_operators=[], prefix_operators=[], qualifier=TimeUnit, selectors=[]), MemberReference(member=taskQueue, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=threadPriority, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="uil-pool-")], member=createThreadFactory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ThreadPoolExecutor, sub_type=None))]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[Executor] identifier[createExecutor] operator[SEP] Keyword[int] identifier[threadPoolSize] , Keyword[int] identifier[threadPriority] , identifier[QueueProcessingType] identifier[tasksProcessingType] operator[SEP] {
Keyword[boolean] identifier[lifo] operator[=] identifier[tasksProcessingType] operator[==] identifier[QueueProcessingType] operator[SEP] identifier[LIFO] operator[SEP] identifier[BlockingQueue] operator[<] identifier[Runnable] operator[>] identifier[taskQueue] operator[=] identifier[lifo] operator[?] Keyword[new] identifier[LIFOLinkedBlockingDeque] operator[<] identifier[Runnable] operator[>] operator[SEP] operator[SEP] operator[:] Keyword[new] identifier[LinkedBlockingQueue] operator[<] identifier[Runnable] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ThreadPoolExecutor] operator[SEP] identifier[threadPoolSize] , identifier[threadPoolSize] , Other[0L] , identifier[TimeUnit] operator[SEP] identifier[MILLISECONDS] , identifier[taskQueue] , identifier[createThreadFactory] operator[SEP] identifier[threadPriority] , literal[String] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public void destroyWorkspace(boolean extended) {
if (workspace.getHostPointer() != null && workspace.getHostPointer().getOriginalPointer() != null
&& workspace.getHostPointer().getOriginalPointer() instanceof BytePointer)
workspace.getHostPointer().getOriginalPointer().deallocate();
workspace.setHostPointer(null);
currentSize.set(0);
reset();
if (extended) {
clearExternalAllocations();
}
//cycleAllocations.set(0);
//maxCycle.set(0);
}
|
class class_name[name] begin[{]
method[destroyWorkspace, return_type[void], modifier[public], parameter[extended]] begin[{]
if[binary_operation[binary_operation[binary_operation[call[workspace.getHostPointer, parameter[]], !=, literal[null]], &&, binary_operation[call[workspace.getHostPointer, parameter[]], !=, literal[null]]], &&, binary_operation[call[workspace.getHostPointer, parameter[]], instanceof, type[BytePointer]]]] begin[{]
call[workspace.getHostPointer, parameter[]]
else begin[{]
None
end[}]
call[workspace.setHostPointer, parameter[literal[null]]]
call[currentSize.set, parameter[literal[0]]]
call[.reset, parameter[]]
if[member[.extended]] begin[{]
call[.clearExternalAllocations, parameter[]]
else begin[{]
None
end[}]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[destroyWorkspace] operator[SEP] Keyword[boolean] identifier[extended] operator[SEP] {
Keyword[if] operator[SEP] identifier[workspace] operator[SEP] identifier[getHostPointer] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[workspace] operator[SEP] identifier[getHostPointer] operator[SEP] operator[SEP] operator[SEP] identifier[getOriginalPointer] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[workspace] operator[SEP] identifier[getHostPointer] operator[SEP] operator[SEP] operator[SEP] identifier[getOriginalPointer] operator[SEP] operator[SEP] Keyword[instanceof] identifier[BytePointer] operator[SEP] identifier[workspace] operator[SEP] identifier[getHostPointer] operator[SEP] operator[SEP] operator[SEP] identifier[getOriginalPointer] operator[SEP] operator[SEP] operator[SEP] identifier[deallocate] operator[SEP] operator[SEP] operator[SEP] identifier[workspace] operator[SEP] identifier[setHostPointer] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[currentSize] operator[SEP] identifier[set] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[extended] operator[SEP] {
identifier[clearExternalAllocations] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public List<FilterDefinition> getFilters() {
try {
if (isStarted()) {
final FilterAcknowledger acknowledger = new FilterAcknowledger();
// Be sure that the emit/ack is synchronous to get the filters before the test are run
new Thread(new Runnable() {
@Override
public void run() {
try {
LOGGER.finest("Retrieve filters");
socket.emit("filters:get", acknowledger);
}
catch (Exception e) {
LOGGER.finest("Unable to get the filters: " + e.getMessage());
synchronized (acknowledger) {
acknowledger.notify();
}
}
}
}).start();
synchronized (acknowledger) {
acknowledger.wait();
}
if (!acknowledger.hasFilters()) {
for (FilterDefinition filter : acknowledger.getFilters()) {
LOGGER.info("Filter element: " + filter);
}
}
return acknowledger.getFilters();
}
}
catch (Exception e) {
LOGGER.warning("Unable to retrieve the filters from the agent. Cause: " + e.getMessage());
e.printStackTrace();
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception: ", e);
}
}
return null;
}
|
class class_name[name] begin[{]
method[getFilters, return_type[type[List]], modifier[public], parameter[]] begin[{]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isStarted, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FilterAcknowledger, sub_type=None)), name=acknowledger)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=FilterAcknowledger, sub_type=None)), StatementExpression(expression=ClassCreator(arguments=[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Retrieve filters")], member=finest, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="filters:get"), MemberReference(member=acknowledger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=emit, postfix_operators=[], prefix_operators=[], qualifier=socket, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to get the filters: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], member=finest, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), SynchronizedStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=notify, postfix_operators=[], prefix_operators=[], qualifier=acknowledger, selectors=[], type_arguments=None), label=None)], label=None, lock=MemberReference(member=acknowledger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], 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=Runnable, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[], member=start, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Thread, sub_type=None)), label=None), SynchronizedStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=wait, postfix_operators=[], prefix_operators=[], qualifier=acknowledger, selectors=[], type_arguments=None), label=None)], label=None, lock=MemberReference(member=acknowledger, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), IfStatement(condition=MethodInvocation(arguments=[], member=hasFilters, postfix_operators=[], prefix_operators=['!'], qualifier=acknowledger, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Filter element: "), operandr=MemberReference(member=filter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getFilters, postfix_operators=[], prefix_operators=[], qualifier=acknowledger, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=filter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=FilterDefinition, sub_type=None))), label=None)])), ReturnStatement(expression=MethodInvocation(arguments=[], member=getFilters, postfix_operators=[], prefix_operators=[], qualifier=acknowledger, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to retrieve the filters from the agent. Cause: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], member=warning, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getLevel, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), operandr=MemberReference(member=FINEST, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINEST, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Exception: "), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=log, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
return[literal[null]]
end[}]
END[}]
|
Keyword[public] identifier[List] operator[<] identifier[FilterDefinition] operator[>] identifier[getFilters] operator[SEP] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[isStarted] operator[SEP] operator[SEP] operator[SEP] {
Keyword[final] identifier[FilterAcknowledger] identifier[acknowledger] operator[=] Keyword[new] identifier[FilterAcknowledger] operator[SEP] operator[SEP] operator[SEP] Keyword[new] identifier[Thread] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[LOGGER] operator[SEP] identifier[finest] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[socket] operator[SEP] identifier[emit] operator[SEP] literal[String] , identifier[acknowledger] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[finest] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[acknowledger] operator[SEP] {
identifier[acknowledger] operator[SEP] identifier[notify] operator[SEP] operator[SEP] operator[SEP]
}
}
}
} operator[SEP] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[acknowledger] operator[SEP] {
identifier[acknowledger] operator[SEP] identifier[wait] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[acknowledger] operator[SEP] identifier[hasFilters] operator[SEP] operator[SEP] operator[SEP] {
Keyword[for] operator[SEP] identifier[FilterDefinition] identifier[filter] operator[:] identifier[acknowledger] operator[SEP] identifier[getFilters] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[filter] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[acknowledger] operator[SEP] identifier[getFilters] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[warning] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[LOGGER] operator[SEP] identifier[getLevel] operator[SEP] operator[SEP] operator[==] identifier[Level] operator[SEP] identifier[FINEST] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[log] operator[SEP] identifier[Level] operator[SEP] identifier[FINEST] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[return] Other[null] operator[SEP]
}
|
private LiftingStepResults convertIntoLiftingStepResults(
ImmutableList<IQTree> liftedChildren, IQTree selectedGrandChild, int selectedChildPosition,
Optional<ImmutableExpression> newCondition, ImmutableSubstitution<ImmutableTerm> ascendingSubstitution,
ImmutableSubstitution<? extends VariableOrGroundTerm> descendingSubstitution) {
ImmutableList<IQTree> newChildren = IntStream.range(0, liftedChildren.size())
.boxed()
.map(i -> i == selectedChildPosition
? selectedGrandChild.applyDescendingSubstitution(descendingSubstitution, newCondition)
: liftedChildren.get(i).applyDescendingSubstitution(descendingSubstitution, newCondition))
.collect(ImmutableCollectors.toList());
return new LiftingStepResults(ascendingSubstitution, newChildren, newCondition, false);
}
|
class class_name[name] begin[{]
method[convertIntoLiftingStepResults, return_type[type[LiftingStepResults]], modifier[private], parameter[liftedChildren, selectedGrandChild, selectedChildPosition, newCondition, ascendingSubstitution, descendingSubstitution]] begin[{]
local_variable[type[ImmutableList], newChildren]
return[ClassCreator(arguments=[MemberReference(member=ascendingSubstitution, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newChildren, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=newCondition, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LiftingStepResults, sub_type=None))]
end[}]
END[}]
|
Keyword[private] identifier[LiftingStepResults] identifier[convertIntoLiftingStepResults] operator[SEP] identifier[ImmutableList] operator[<] identifier[IQTree] operator[>] identifier[liftedChildren] , identifier[IQTree] identifier[selectedGrandChild] , Keyword[int] identifier[selectedChildPosition] , identifier[Optional] operator[<] identifier[ImmutableExpression] operator[>] identifier[newCondition] , identifier[ImmutableSubstitution] operator[<] identifier[ImmutableTerm] operator[>] identifier[ascendingSubstitution] , identifier[ImmutableSubstitution] operator[<] operator[?] Keyword[extends] identifier[VariableOrGroundTerm] operator[>] identifier[descendingSubstitution] operator[SEP] {
identifier[ImmutableList] operator[<] identifier[IQTree] operator[>] identifier[newChildren] operator[=] identifier[IntStream] operator[SEP] identifier[range] operator[SEP] Other[0] , identifier[liftedChildren] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[boxed] operator[SEP] operator[SEP] operator[SEP] identifier[map] operator[SEP] identifier[i] operator[->] identifier[i] operator[==] identifier[selectedChildPosition] operator[?] identifier[selectedGrandChild] operator[SEP] identifier[applyDescendingSubstitution] operator[SEP] identifier[descendingSubstitution] , identifier[newCondition] operator[SEP] operator[:] identifier[liftedChildren] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[applyDescendingSubstitution] operator[SEP] identifier[descendingSubstitution] , identifier[newCondition] operator[SEP] operator[SEP] operator[SEP] identifier[collect] operator[SEP] identifier[ImmutableCollectors] operator[SEP] identifier[toList] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[LiftingStepResults] operator[SEP] identifier[ascendingSubstitution] , identifier[newChildren] , identifier[newCondition] , literal[boolean] operator[SEP] operator[SEP]
}
|
public String getDependencyJsonModel() throws IOException {
final Artifact artifact = DataModelFactory.createArtifact("","","","","","","");
return JsonUtils.serialize(DataModelFactory.createDependency(artifact, Scope.COMPILE));
}
|
class class_name[name] begin[{]
method[getDependencyJsonModel, return_type[type[String]], modifier[public], parameter[]] begin[{]
local_variable[type[Artifact], artifact]
return[call[JsonUtils.serialize, parameter[call[DataModelFactory.createDependency, parameter[member[.artifact], member[Scope.COMPILE]]]]]]
end[}]
END[}]
|
Keyword[public] identifier[String] identifier[getDependencyJsonModel] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[final] identifier[Artifact] identifier[artifact] operator[=] identifier[DataModelFactory] operator[SEP] identifier[createArtifact] operator[SEP] literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[JsonUtils] operator[SEP] identifier[serialize] operator[SEP] identifier[DataModelFactory] operator[SEP] identifier[createDependency] operator[SEP] identifier[artifact] , identifier[Scope] operator[SEP] identifier[COMPILE] operator[SEP] operator[SEP] operator[SEP]
}
|
public InitiateMultipartUploadResponse initiateMultipartUpload(InitiateMultipartUploadRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST);
internalRequest.addParameter("uploads", null);
if (request.getStorageClass() != null) {
internalRequest.addHeader(Headers.BCE_STORAGE_CLASS, request.getStorageClass());
}
this.setZeroContentLength(internalRequest);
if (request.getObjectMetadata() != null) {
populateRequestMetadata(internalRequest, request.getObjectMetadata());
}
return this.invokeHttpClient(internalRequest, InitiateMultipartUploadResponse.class);
}
|
class class_name[name] begin[{]
method[initiateMultipartUpload, return_type[type[InitiateMultipartUploadResponse]], modifier[public], parameter[request]] begin[{]
call[.checkNotNull, parameter[member[.request], literal["request should not be null."]]]
local_variable[type[InternalRequest], internalRequest]
call[internalRequest.addParameter, parameter[literal["uploads"], literal[null]]]
if[binary_operation[call[request.getStorageClass, parameter[]], !=, literal[null]]] begin[{]
call[internalRequest.addHeader, parameter[member[Headers.BCE_STORAGE_CLASS], call[request.getStorageClass, parameter[]]]]
else begin[{]
None
end[}]
THIS[call[None.setZeroContentLength, parameter[member[.internalRequest]]]]
if[binary_operation[call[request.getObjectMetadata, parameter[]], !=, literal[null]]] begin[{]
call[.populateRequestMetadata, parameter[member[.internalRequest], call[request.getObjectMetadata, parameter[]]]]
else begin[{]
None
end[}]
return[THIS[call[None.invokeHttpClient, parameter[member[.internalRequest], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InitiateMultipartUploadResponse, sub_type=None))]]]]
end[}]
END[}]
|
Keyword[public] identifier[InitiateMultipartUploadResponse] identifier[initiateMultipartUpload] operator[SEP] identifier[InitiateMultipartUploadRequest] identifier[request] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[request] , literal[String] operator[SEP] operator[SEP] identifier[InternalRequest] identifier[internalRequest] operator[=] Keyword[this] operator[SEP] identifier[createRequest] operator[SEP] identifier[request] , identifier[HttpMethodName] operator[SEP] identifier[POST] operator[SEP] operator[SEP] identifier[internalRequest] operator[SEP] identifier[addParameter] operator[SEP] literal[String] , Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getStorageClass] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[internalRequest] operator[SEP] identifier[addHeader] operator[SEP] identifier[Headers] operator[SEP] identifier[BCE_STORAGE_CLASS] , identifier[request] operator[SEP] identifier[getStorageClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[setZeroContentLength] operator[SEP] identifier[internalRequest] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getObjectMetadata] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[populateRequestMetadata] operator[SEP] identifier[internalRequest] , identifier[request] operator[SEP] identifier[getObjectMetadata] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP] identifier[invokeHttpClient] operator[SEP] identifier[internalRequest] , identifier[InitiateMultipartUploadResponse] operator[SEP] Keyword[class] operator[SEP] operator[SEP]
}
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static boolean hasFakeTouchFeature(PackageManager manager) {
return manager.hasSystemFeature(PackageManager.FEATURE_FAKETOUCH);
}
|
class class_name[name] begin[{]
method[hasFakeTouchFeature, return_type[type[boolean]], modifier[public static], parameter[manager]] begin[{]
return[call[manager.hasSystemFeature, parameter[member[PackageManager.FEATURE_FAKETOUCH]]]]
end[}]
END[}]
|
annotation[@] identifier[TargetApi] operator[SEP] identifier[Build] operator[SEP] identifier[VERSION_CODES] operator[SEP] identifier[HONEYCOMB] operator[SEP] Keyword[public] Keyword[static] Keyword[boolean] identifier[hasFakeTouchFeature] operator[SEP] identifier[PackageManager] identifier[manager] operator[SEP] {
Keyword[return] identifier[manager] operator[SEP] identifier[hasSystemFeature] operator[SEP] identifier[PackageManager] operator[SEP] identifier[FEATURE_FAKETOUCH] operator[SEP] operator[SEP]
}
|
public void addTables(Collection<VoltTable> tables) {
if (m_readOnly) {
throw new IllegalStateException("Table is read-only. Make a copy before changing.");
}
try {
// Allow the buffer to grow to max capacity
m_buffer.limit(m_buffer.capacity());
Collection<ByteBuffer> rawTables = new ArrayList<>(tables.size());
int totalRawSize = 0;
int newRowCounts = 0;
for (VoltTable table : tables) {
if (table == null) {
continue;
}
checkHasExactSchema(table);
ByteBuffer rawTable = table.getAllRowsRaw();
rawTables.add(rawTable);
totalRawSize += rawTable.remaining();
newRowCounts += table.getRowCount();
}
if (m_buffer.remaining() < totalRawSize) {
expandBufferTo(m_buffer.position() + totalRawSize);
}
for (ByteBuffer rawTable : rawTables) {
m_buffer.put(rawTable);
}
// increment the rowcount in the member var and in the buffer
m_rowCount += newRowCounts;
m_buffer.putInt(m_rowStart, m_rowCount);
} finally {
// constrain buffer limit back to the new position
m_buffer.limit(m_buffer.position());
}
}
|
class class_name[name] begin[{]
method[addTables, return_type[void], modifier[public], parameter[tables]] begin[{]
if[member[.m_readOnly]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Table is read-only. Make a copy before changing.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=capacity, postfix_operators=[], prefix_operators=[], qualifier=m_buffer, selectors=[], type_arguments=None)], member=limit, postfix_operators=[], prefix_operators=[], qualifier=m_buffer, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=tables, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None)), name=rawTables)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None))], dimensions=[], name=Collection, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=totalRawSize)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=newRowCounts)], modifiers=set(), type=BasicType(dimensions=[], name=int)), ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=table, 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=[ContinueStatement(goto=None, label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=checkHasExactSchema, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getAllRowsRaw, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), name=rawTable)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rawTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=rawTables, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=totalRawSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=remaining, postfix_operators=[], prefix_operators=[], qualifier=rawTable, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=newRowCounts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=getRowCount, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None)), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=tables, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=table)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VoltTable, sub_type=None))), label=None), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=remaining, postfix_operators=[], prefix_operators=[], qualifier=m_buffer, selectors=[], type_arguments=None), operandr=MemberReference(member=totalRawSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=position, postfix_operators=[], prefix_operators=[], qualifier=m_buffer, selectors=[], type_arguments=None), operandr=MemberReference(member=totalRawSize, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], member=expandBufferTo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=rawTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=put, postfix_operators=[], prefix_operators=[], qualifier=m_buffer, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=rawTables, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=rawTable)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=ByteBuffer, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=m_rowCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MemberReference(member=newRowCounts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=m_rowStart, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=m_rowCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=putInt, postfix_operators=[], prefix_operators=[], qualifier=m_buffer, selectors=[], type_arguments=None), label=None)], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=position, postfix_operators=[], prefix_operators=[], qualifier=m_buffer, selectors=[], type_arguments=None)], member=limit, postfix_operators=[], prefix_operators=[], qualifier=m_buffer, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[addTables] operator[SEP] identifier[Collection] operator[<] identifier[VoltTable] operator[>] identifier[tables] operator[SEP] {
Keyword[if] operator[SEP] identifier[m_readOnly] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[m_buffer] operator[SEP] identifier[limit] operator[SEP] identifier[m_buffer] operator[SEP] identifier[capacity] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[Collection] operator[<] identifier[ByteBuffer] operator[>] identifier[rawTables] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[tables] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[totalRawSize] operator[=] Other[0] operator[SEP] Keyword[int] identifier[newRowCounts] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] identifier[VoltTable] identifier[table] operator[:] identifier[tables] operator[SEP] {
Keyword[if] operator[SEP] identifier[table] operator[==] Other[null] operator[SEP] {
Keyword[continue] operator[SEP]
}
identifier[checkHasExactSchema] operator[SEP] identifier[table] operator[SEP] operator[SEP] identifier[ByteBuffer] identifier[rawTable] operator[=] identifier[table] operator[SEP] identifier[getAllRowsRaw] operator[SEP] operator[SEP] operator[SEP] identifier[rawTables] operator[SEP] identifier[add] operator[SEP] identifier[rawTable] operator[SEP] operator[SEP] identifier[totalRawSize] operator[+=] identifier[rawTable] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[SEP] identifier[newRowCounts] operator[+=] identifier[table] operator[SEP] identifier[getRowCount] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[m_buffer] operator[SEP] identifier[remaining] operator[SEP] operator[SEP] operator[<] identifier[totalRawSize] operator[SEP] {
identifier[expandBufferTo] operator[SEP] identifier[m_buffer] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[+] identifier[totalRawSize] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[ByteBuffer] identifier[rawTable] operator[:] identifier[rawTables] operator[SEP] {
identifier[m_buffer] operator[SEP] identifier[put] operator[SEP] identifier[rawTable] operator[SEP] operator[SEP]
}
identifier[m_rowCount] operator[+=] identifier[newRowCounts] operator[SEP] identifier[m_buffer] operator[SEP] identifier[putInt] operator[SEP] identifier[m_rowStart] , identifier[m_rowCount] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[m_buffer] operator[SEP] identifier[limit] operator[SEP] identifier[m_buffer] operator[SEP] identifier[position] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public int getIncrementalMinResultSizeAndReset() {
int retval = m_workerTask.m_incrMinResultSize;
m_workerTask.m_incrMinResultSize = Integer.MAX_VALUE;
if (isCoordinatorStatsUsable(true)) {
m_coordinatorTask.m_incrMinResultSize = Integer.MAX_VALUE;
}
return retval;
}
|
class class_name[name] begin[{]
method[getIncrementalMinResultSizeAndReset, return_type[type[int]], modifier[public], parameter[]] begin[{]
local_variable[type[int], retval]
assign[member[m_workerTask.m_incrMinResultSize], member[Integer.MAX_VALUE]]
if[call[.isCoordinatorStatsUsable, parameter[literal[true]]]] begin[{]
assign[member[m_coordinatorTask.m_incrMinResultSize], member[Integer.MAX_VALUE]]
else begin[{]
None
end[}]
return[member[.retval]]
end[}]
END[}]
|
Keyword[public] Keyword[int] identifier[getIncrementalMinResultSizeAndReset] operator[SEP] operator[SEP] {
Keyword[int] identifier[retval] operator[=] identifier[m_workerTask] operator[SEP] identifier[m_incrMinResultSize] operator[SEP] identifier[m_workerTask] operator[SEP] identifier[m_incrMinResultSize] operator[=] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP] Keyword[if] operator[SEP] identifier[isCoordinatorStatsUsable] operator[SEP] literal[boolean] operator[SEP] operator[SEP] {
identifier[m_coordinatorTask] operator[SEP] identifier[m_incrMinResultSize] operator[=] identifier[Integer] operator[SEP] identifier[MAX_VALUE] operator[SEP]
}
Keyword[return] identifier[retval] operator[SEP]
}
|
public T push(T element) {
int i;
Object[] els;
if ((i = size++) >= (els = elements).length) {
System.arraycopy(els, 0, els = elements = new Object[i << 1], 0, i);
}
els[i] = element;
return element;
}
|
class class_name[name] begin[{]
method[push, return_type[type[T]], modifier[public], parameter[element]] begin[{]
local_variable[type[int], i]
local_variable[type[Object], els]
if[binary_operation[assign[member[.i], member[.size]], >=, assign[member[.els], member[.elements]]]] begin[{]
call[System.arraycopy, parameter[member[.els], literal[0], assign[member[.els], assign[member[.elements], ArrayCreator(dimensions=[BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=<<)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]], literal[0], member[.i]]]
else begin[{]
None
end[}]
assign[member[.els], member[.element]]
return[member[.element]]
end[}]
END[}]
|
Keyword[public] identifier[T] identifier[push] operator[SEP] identifier[T] identifier[element] operator[SEP] {
Keyword[int] identifier[i] operator[SEP] identifier[Object] operator[SEP] operator[SEP] identifier[els] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[i] operator[=] identifier[size] operator[++] operator[SEP] operator[>=] operator[SEP] identifier[els] operator[=] identifier[elements] operator[SEP] operator[SEP] identifier[length] operator[SEP] {
identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[els] , Other[0] , identifier[els] operator[=] identifier[elements] operator[=] Keyword[new] identifier[Object] operator[SEP] identifier[i] operator[<<] Other[1] operator[SEP] , Other[0] , identifier[i] operator[SEP] operator[SEP]
}
identifier[els] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[element] operator[SEP] Keyword[return] identifier[element] operator[SEP]
}
|
@Override
public final void setLang(final Languages pLang) {
this.lang = pLang;
if (this.itsId == null) {
this.itsId = new IdI18nServiceToSale();
}
this.itsId.setLang(this.lang);
}
|
class class_name[name] begin[{]
method[setLang, return_type[void], modifier[final public], parameter[pLang]] begin[{]
assign[THIS[member[None.lang]], member[.pLang]]
if[binary_operation[THIS[member[None.itsId]], ==, literal[null]]] begin[{]
assign[THIS[member[None.itsId]], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IdI18nServiceToSale, sub_type=None))]
else begin[{]
None
end[}]
THIS[member[None.itsId]call[None.setLang, parameter[THIS[member[None.lang]]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[final] Keyword[void] identifier[setLang] operator[SEP] Keyword[final] identifier[Languages] identifier[pLang] operator[SEP] {
Keyword[this] operator[SEP] identifier[lang] operator[=] identifier[pLang] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[itsId] operator[==] Other[null] operator[SEP] {
Keyword[this] operator[SEP] identifier[itsId] operator[=] Keyword[new] identifier[IdI18nServiceToSale] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[this] operator[SEP] identifier[itsId] operator[SEP] identifier[setLang] operator[SEP] Keyword[this] operator[SEP] identifier[lang] operator[SEP] operator[SEP]
}
|
@Override
public void setProperty(String name, Object value)
{
switch(name) {
case "js.template.serialize.prolog":
serializeProlog = (Boolean)value;
break;
case "js.template.serialize.operator":
serializeOperators = (Boolean)value;
break;
}
}
|
class class_name[name] begin[{]
method[setProperty, return_type[void], modifier[public], parameter[name, value]] begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="js.template.serialize.prolog")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=serializeProlog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="js.template.serialize.operator")], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=serializeOperators, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Boolean, sub_type=None))), label=None), BreakStatement(goto=None, label=None)])], expression=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[setProperty] operator[SEP] identifier[String] identifier[name] , identifier[Object] identifier[value] operator[SEP] {
Keyword[switch] operator[SEP] identifier[name] operator[SEP] {
Keyword[case] literal[String] operator[:] identifier[serializeProlog] operator[=] operator[SEP] identifier[Boolean] operator[SEP] identifier[value] operator[SEP] Keyword[break] operator[SEP] Keyword[case] literal[String] operator[:] identifier[serializeOperators] operator[=] operator[SEP] identifier[Boolean] operator[SEP] identifier[value] operator[SEP] Keyword[break] operator[SEP]
}
}
|
public FaceletTaglibTagAttributeType<FaceletTaglibTagType<T>> getOrCreateAttribute()
{
List<Node> nodeList = childNode.get("attribute");
if (nodeList != null && nodeList.size() > 0)
{
return new FaceletTaglibTagAttributeTypeImpl<FaceletTaglibTagType<T>>(this, "attribute", childNode, nodeList.get(0));
}
return createAttribute();
}
|
class class_name[name] begin[{]
method[getOrCreateAttribute, return_type[type[FaceletTaglibTagAttributeType]], modifier[public], parameter[]] begin[{]
local_variable[type[List], nodeList]
if[binary_operation[binary_operation[member[.nodeList], !=, literal[null]], &&, binary_operation[call[nodeList.size, parameter[]], >, literal[0]]]] begin[{]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="attribute"), MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=get, postfix_operators=[], prefix_operators=[], qualifier=nodeList, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=FaceletTaglibTagType, sub_type=None))], dimensions=None, name=FaceletTaglibTagAttributeTypeImpl, sub_type=None))]
else begin[{]
None
end[}]
return[call[.createAttribute, parameter[]]]
end[}]
END[}]
|
Keyword[public] identifier[FaceletTaglibTagAttributeType] operator[<] identifier[FaceletTaglibTagType] operator[<] identifier[T] operator[>] operator[>] identifier[getOrCreateAttribute] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[childNode] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodeList] operator[!=] Other[null] operator[&&] identifier[nodeList] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
Keyword[return] Keyword[new] identifier[FaceletTaglibTagAttributeTypeImpl] operator[<] identifier[FaceletTaglibTagType] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[nodeList] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[createAttribute] operator[SEP] operator[SEP] operator[SEP]
}
|
private void extractItemsets(DBIDs[] idx, int start, int minsupp, List<Itemset> solution) {
int[] buf = new int[idx.length];
DBIDs iset = idx[start];
if(iset == null || iset.size() < minsupp) {
return;
}
if(minlength <= 1) {
solution.add(new OneItemset(start, iset.size()));
}
if(maxlength > 1) {
buf[0] = start;
extractItemsets(iset, idx, buf, 1, start + 1, minsupp, solution);
}
}
|
class class_name[name] begin[{]
method[extractItemsets, return_type[void], modifier[private], parameter[idx, start, minsupp, solution]] begin[{]
local_variable[type[int], buf]
local_variable[type[DBIDs], iset]
if[binary_operation[binary_operation[member[.iset], ==, literal[null]], ||, binary_operation[call[iset.size, parameter[]], <, member[.minsupp]]]] begin[{]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.minlength], <=, literal[1]]] begin[{]
call[solution.add, parameter[ClassCreator(arguments=[MemberReference(member=start, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=iset, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OneItemset, sub_type=None))]]
else begin[{]
None
end[}]
if[binary_operation[member[.maxlength], >, literal[1]]] begin[{]
assign[member[.buf], member[.start]]
call[.extractItemsets, parameter[member[.iset], member[.idx], member[.buf], literal[1], binary_operation[member[.start], +, literal[1]], member[.minsupp], member[.solution]]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[extractItemsets] operator[SEP] identifier[DBIDs] operator[SEP] operator[SEP] identifier[idx] , Keyword[int] identifier[start] , Keyword[int] identifier[minsupp] , identifier[List] operator[<] identifier[Itemset] operator[>] identifier[solution] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[buf] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[idx] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[DBIDs] identifier[iset] operator[=] identifier[idx] operator[SEP] identifier[start] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[iset] operator[==] Other[null] operator[||] identifier[iset] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] identifier[minsupp] operator[SEP] {
Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[minlength] operator[<=] Other[1] operator[SEP] {
identifier[solution] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[OneItemset] operator[SEP] identifier[start] , identifier[iset] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[maxlength] operator[>] Other[1] operator[SEP] {
identifier[buf] operator[SEP] Other[0] operator[SEP] operator[=] identifier[start] operator[SEP] identifier[extractItemsets] operator[SEP] identifier[iset] , identifier[idx] , identifier[buf] , Other[1] , identifier[start] operator[+] Other[1] , identifier[minsupp] , identifier[solution] operator[SEP] operator[SEP]
}
}
|
public void start() {
executor.submit(new Runnable() {
@Override
public void run() {
try {
process = new ProcessBuilder().redirectErrorStream(true).command(command).start();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
output.add(line);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
}
|
class class_name[name] begin[{]
method[start, return_type[void], modifier[public], parameter[]] begin[{]
call[executor.submit, parameter[ClassCreator(arguments=[], body=[MethodDeclaration(annotations=[Annotation(element=None, name=Override)], body=[TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=process, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)], member=redirectErrorStream, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=command, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=command, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=start, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ProcessBuilder, sub_type=None))), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getInputStream, postfix_operators=[], prefix_operators=[], qualifier=process, selectors=[], type_arguments=None)], 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)), name=reader)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=BufferedReader, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=None, name=line)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=line, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=output, selectors=[], type_arguments=None), label=None)]), condition=BinaryOperation(operandl=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)), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException']))], finally_block=None, label=None, resources=None)], documentation=None, modifiers={'public'}, name=run, parameters=[], 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=Runnable, sub_type=None))]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[start] operator[SEP] operator[SEP] {
identifier[executor] operator[SEP] identifier[submit] operator[SEP] Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[process] operator[=] Keyword[new] identifier[ProcessBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[redirectErrorStream] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[command] operator[SEP] identifier[command] operator[SEP] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[BufferedReader] identifier[reader] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] Keyword[new] identifier[InputStreamReader] operator[SEP] identifier[process] operator[SEP] identifier[getInputStream] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[line] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[reader] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[output] operator[SEP] identifier[add] operator[SEP] identifier[line] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
} operator[SEP] operator[SEP]
}
|
private Point getCellPoint() {
double x1 = (minX + cellI * deltaX) + (deltaX / 2d);
double y1 = (minY + cellJ * deltaY) + (deltaY / 2d);
cellI++;
return GF.createPoint(new Coordinate(x1, y1));
}
|
class class_name[name] begin[{]
method[getCellPoint, return_type[type[Point]], modifier[private], parameter[]] begin[{]
local_variable[type[double], x1]
local_variable[type[double], y1]
member[.cellI]
return[call[GF.createPoint, parameter[ClassCreator(arguments=[MemberReference(member=x1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=y1, 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=Coordinate, sub_type=None))]]]
end[}]
END[}]
|
Keyword[private] identifier[Point] identifier[getCellPoint] operator[SEP] operator[SEP] {
Keyword[double] identifier[x1] operator[=] operator[SEP] identifier[minX] operator[+] identifier[cellI] operator[*] identifier[deltaX] operator[SEP] operator[+] operator[SEP] identifier[deltaX] operator[/] literal[Float] operator[SEP] operator[SEP] Keyword[double] identifier[y1] operator[=] operator[SEP] identifier[minY] operator[+] identifier[cellJ] operator[*] identifier[deltaY] operator[SEP] operator[+] operator[SEP] identifier[deltaY] operator[/] literal[Float] operator[SEP] operator[SEP] identifier[cellI] operator[++] operator[SEP] Keyword[return] identifier[GF] operator[SEP] identifier[createPoint] operator[SEP] Keyword[new] identifier[Coordinate] operator[SEP] identifier[x1] , identifier[y1] operator[SEP] operator[SEP] operator[SEP]
}
|
public final AntlrDatatypeRuleToken ruleQualifiedName() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
AntlrDatatypeRuleToken this_ValidID_0 = null;
AntlrDatatypeRuleToken this_ValidID_2 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:5794:2: ( (this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )* ) )
// InternalXbaseWithAnnotations.g:5795:2: (this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )* )
{
// InternalXbaseWithAnnotations.g:5795:2: (this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )* )
// InternalXbaseWithAnnotations.g:5796:3: this_ValidID_0= ruleValidID ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getQualifiedNameAccess().getValidIDParserRuleCall_0());
}
pushFollow(FOLLOW_72);
this_ValidID_0=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(this_ValidID_0);
}
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
// InternalXbaseWithAnnotations.g:5806:3: ( ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID )*
loop99:
do {
int alt99=2;
int LA99_0 = input.LA(1);
if ( (LA99_0==52) ) {
int LA99_2 = input.LA(2);
if ( (LA99_2==RULE_ID) ) {
int LA99_3 = input.LA(3);
if ( (synpred48_InternalXbaseWithAnnotations()) ) {
alt99=1;
}
}
}
switch (alt99) {
case 1 :
// InternalXbaseWithAnnotations.g:5807:4: ( ( '.' )=>kw= '.' ) this_ValidID_2= ruleValidID
{
// InternalXbaseWithAnnotations.g:5807:4: ( ( '.' )=>kw= '.' )
// InternalXbaseWithAnnotations.g:5808:5: ( '.' )=>kw= '.'
{
kw=(Token)match(input,52,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getQualifiedNameAccess().getFullStopKeyword_1_0());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getQualifiedNameAccess().getValidIDParserRuleCall_1_1());
}
pushFollow(FOLLOW_72);
this_ValidID_2=ruleValidID();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(this_ValidID_2);
}
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
break;
default :
break loop99;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
}
|
class class_name[name] begin[{]
method[ruleQualifiedName, return_type[type[AntlrDatatypeRuleToken]], modifier[final public], parameter[]] begin[{]
local_variable[type[AntlrDatatypeRuleToken], current]
local_variable[type[Token], kw]
local_variable[type[AntlrDatatypeRuleToken], this_ValidID_0]
local_variable[type[AntlrDatatypeRuleToken], this_ValidID_2]
call[.enterRule, parameter[]]
TryStatement(block=[BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getQualifiedNameAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getValidIDParserRuleCall_0, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=newCompositeNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_72, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=this_ValidID_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=ruleValidID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=this_ValidID_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=merge, postfix_operators=[], prefix_operators=[], qualifier=current, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=afterParserOrEnumRuleCall, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), DoStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2), name=alt99)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA99_0)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=LA99_0, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=52), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA99_2)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=LA99_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=RULE_ID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3)], member=LA, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), name=LA99_3)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=MethodInvocation(arguments=[], member=synpred48_InternalXbaseWithAnnotations, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=alt99, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)]))]))])), SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[BlockStatement(label=None, statements=[BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=kw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Cast(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=52), MemberReference(member=FOLLOW_3, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=match, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=Token, sub_type=None))), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=kw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=merge, postfix_operators=[], prefix_operators=[], qualifier=current, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=kw, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getQualifiedNameAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getFullStopKeyword_1_0, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=newLeafNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getQualifiedNameAccess, postfix_operators=[], prefix_operators=[], qualifier=grammarAccess, selectors=[MethodInvocation(arguments=[], member=getValidIDParserRuleCall_1_1, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=newCompositeNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FOLLOW_72, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushFollow, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=this_ValidID_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=ruleValidID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=MemberReference(member=_fsp, postfix_operators=['--'], prefix_operators=[], qualifier=state, selectors=[]), label=None), IfStatement(condition=MemberReference(member=failed, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), else_statement=None, label=None, then_statement=ReturnStatement(expression=MemberReference(member=current, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=this_ValidID_2, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=merge, postfix_operators=[], prefix_operators=[], qualifier=current, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=afterParserOrEnumRuleCall, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))]), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[BreakStatement(goto=loop99, label=None)])], expression=MemberReference(member=alt99, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), condition=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=loop99)])]), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=backtracking, postfix_operators=[], prefix_operators=[], qualifier=state, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=leaveRule, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=re, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=recover, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=appendSkippedTokens, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=re, types=['RecognitionException']))], finally_block=[], label=None, resources=None)
return[member[.current]]
end[}]
END[}]
|
Keyword[public] Keyword[final] identifier[AntlrDatatypeRuleToken] identifier[ruleQualifiedName] operator[SEP] operator[SEP] Keyword[throws] identifier[RecognitionException] {
identifier[AntlrDatatypeRuleToken] identifier[current] operator[=] Keyword[new] identifier[AntlrDatatypeRuleToken] operator[SEP] operator[SEP] operator[SEP] identifier[Token] identifier[kw] operator[=] Other[null] operator[SEP] identifier[AntlrDatatypeRuleToken] identifier[this_ValidID_0] operator[=] Other[null] operator[SEP] identifier[AntlrDatatypeRuleToken] identifier[this_ValidID_2] operator[=] Other[null] operator[SEP] identifier[enterRule] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
{
{
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[newCompositeNode] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getQualifiedNameAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getValidIDParserRuleCall_0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[pushFollow] operator[SEP] identifier[FOLLOW_72] operator[SEP] operator[SEP] identifier[this_ValidID_0] operator[=] identifier[ruleValidID] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] identifier[current] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[current] operator[SEP] identifier[merge] operator[SEP] identifier[this_ValidID_0] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[afterParserOrEnumRuleCall] operator[SEP] operator[SEP] operator[SEP]
}
identifier[loop99] operator[:] Keyword[do] {
Keyword[int] identifier[alt99] operator[=] Other[2] operator[SEP] Keyword[int] identifier[LA99_0] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[LA99_0] operator[==] Other[52] operator[SEP] operator[SEP] {
Keyword[int] identifier[LA99_2] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[2] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[LA99_2] operator[==] identifier[RULE_ID] operator[SEP] operator[SEP] {
Keyword[int] identifier[LA99_3] operator[=] identifier[input] operator[SEP] identifier[LA] operator[SEP] Other[3] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[synpred48_InternalXbaseWithAnnotations] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[alt99] operator[=] Other[1] operator[SEP]
}
}
}
Keyword[switch] operator[SEP] identifier[alt99] operator[SEP] {
Keyword[case] Other[1] operator[:] {
{
identifier[kw] operator[=] operator[SEP] identifier[Token] operator[SEP] identifier[match] operator[SEP] identifier[input] , Other[52] , identifier[FOLLOW_3] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] identifier[current] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[current] operator[SEP] identifier[merge] operator[SEP] identifier[kw] operator[SEP] operator[SEP] identifier[newLeafNode] operator[SEP] identifier[kw] , identifier[grammarAccess] operator[SEP] identifier[getQualifiedNameAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getFullStopKeyword_1_0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[newCompositeNode] operator[SEP] identifier[grammarAccess] operator[SEP] identifier[getQualifiedNameAccess] operator[SEP] operator[SEP] operator[SEP] identifier[getValidIDParserRuleCall_1_1] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[pushFollow] operator[SEP] identifier[FOLLOW_72] operator[SEP] operator[SEP] identifier[this_ValidID_2] operator[=] identifier[ruleValidID] operator[SEP] operator[SEP] operator[SEP] identifier[state] operator[SEP] identifier[_fsp] operator[--] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[failed] operator[SEP] Keyword[return] identifier[current] operator[SEP] Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[current] operator[SEP] identifier[merge] operator[SEP] identifier[this_ValidID_2] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[afterParserOrEnumRuleCall] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[break] identifier[loop99] operator[SEP]
}
}
Keyword[while] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[state] operator[SEP] identifier[backtracking] operator[==] Other[0] operator[SEP] {
identifier[leaveRule] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[RecognitionException] identifier[re] operator[SEP] {
identifier[recover] operator[SEP] identifier[input] , identifier[re] operator[SEP] operator[SEP] identifier[appendSkippedTokens] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[finally] {
}
Keyword[return] identifier[current] operator[SEP]
}
|
protected static DcerpcBinding parseBinding ( String str ) throws DcerpcException {
int state, mark, si;
char[] arr = str.toCharArray();
String proto = null, key = null;
DcerpcBinding binding = null;
state = mark = si = 0;
do {
char ch = arr[ si ];
switch ( state ) {
case 0:
if ( ch == ':' ) {
proto = str.substring(mark, si);
mark = si + 1;
state = 1;
}
break;
case 1:
if ( ch == '\\' ) {
mark = si + 1;
break;
}
state = 2;
case 2:
if ( ch == '[' ) {
String server = str.substring(mark, si).trim();
if ( server.length() == 0 )
server = "127.0.0.1";
binding = new DcerpcBinding(proto, str.substring(mark, si));
mark = si + 1;
state = 5;
}
break;
case 5:
if ( ch == '=' ) {
key = str.substring(mark, si).trim();
mark = si + 1;
}
else if ( ch == ',' || ch == ']' ) {
String val = str.substring(mark, si).trim();
mark = si + 1;
if ( key == null )
key = "endpoint";
if ( binding != null ) {
binding.setOption(key, val);
}
key = null;
}
break;
default:
si = arr.length;
}
si++;
}
while ( si < arr.length );
if ( binding == null || binding.getEndpoint() == null )
throw new DcerpcException("Invalid binding URL: " + str);
return binding;
}
|
class class_name[name] begin[{]
method[parseBinding, return_type[type[DcerpcBinding]], modifier[static protected], parameter[str]] begin[{]
local_variable[type[int], state]
local_variable[type[char], arr]
local_variable[type[String], proto]
local_variable[type[DcerpcBinding], binding]
assign[member[.state], assign[member[.mark], assign[member[.si], literal[0]]]]
do[binary_operation[member[.si], <, member[arr.length]]] begin[{]
local_variable[type[char], ch]
SwitchStatement(cases=[SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=':'), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=proto, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1)], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='\\'), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), BreakStatement(goto=None, label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)), label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=2)], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='['), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[MethodInvocation(arguments=[], member=trim, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=server)], 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=server, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=server, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="127.0.0.1")), label=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=binding, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[MemberReference(member=proto, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DcerpcBinding, sub_type=None))), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5)], statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='='), operator===), else_statement=IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=','), operator===), operandr=BinaryOperation(operandl=MemberReference(member=ch, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=']'), operator===), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[MethodInvocation(arguments=[], member=trim, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=val)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="endpoint")), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=binding, 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=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=val, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setOption, postfix_operators=[], prefix_operators=[], qualifier=binding, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=substring, postfix_operators=[], prefix_operators=[], qualifier=str, selectors=[MethodInvocation(arguments=[], member=trim, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=mark, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=BinaryOperation(operandl=MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=+)), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=si, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=arr, selectors=[])), label=None)])], expression=MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
member[.si]
end[}]
if[binary_operation[binary_operation[member[.binding], ==, literal[null]], ||, binary_operation[call[binding.getEndpoint, parameter[]], ==, literal[null]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid binding URL: "), operandr=MemberReference(member=str, 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=DcerpcException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[member[.binding]]
end[}]
END[}]
|
Keyword[protected] Keyword[static] identifier[DcerpcBinding] identifier[parseBinding] operator[SEP] identifier[String] identifier[str] operator[SEP] Keyword[throws] identifier[DcerpcException] {
Keyword[int] identifier[state] , identifier[mark] , identifier[si] operator[SEP] Keyword[char] operator[SEP] operator[SEP] identifier[arr] operator[=] identifier[str] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[proto] operator[=] Other[null] , identifier[key] operator[=] Other[null] operator[SEP] identifier[DcerpcBinding] identifier[binding] operator[=] Other[null] operator[SEP] identifier[state] operator[=] identifier[mark] operator[=] identifier[si] operator[=] Other[0] operator[SEP] Keyword[do] {
Keyword[char] identifier[ch] operator[=] identifier[arr] operator[SEP] identifier[si] operator[SEP] operator[SEP] Keyword[switch] operator[SEP] identifier[state] operator[SEP] {
Keyword[case] Other[0] operator[:] Keyword[if] operator[SEP] identifier[ch] operator[==] literal[String] operator[SEP] {
identifier[proto] operator[=] identifier[str] operator[SEP] identifier[substring] operator[SEP] identifier[mark] , identifier[si] operator[SEP] operator[SEP] identifier[mark] operator[=] identifier[si] operator[+] Other[1] operator[SEP] identifier[state] operator[=] Other[1] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] Other[1] operator[:] Keyword[if] operator[SEP] identifier[ch] operator[==] literal[String] operator[SEP] {
identifier[mark] operator[=] identifier[si] operator[+] Other[1] operator[SEP] Keyword[break] operator[SEP]
}
identifier[state] operator[=] Other[2] operator[SEP] Keyword[case] Other[2] operator[:] Keyword[if] operator[SEP] identifier[ch] operator[==] literal[String] operator[SEP] {
identifier[String] identifier[server] operator[=] identifier[str] operator[SEP] identifier[substring] operator[SEP] identifier[mark] , identifier[si] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[server] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] identifier[server] operator[=] literal[String] operator[SEP] identifier[binding] operator[=] Keyword[new] identifier[DcerpcBinding] operator[SEP] identifier[proto] , identifier[str] operator[SEP] identifier[substring] operator[SEP] identifier[mark] , identifier[si] operator[SEP] operator[SEP] operator[SEP] identifier[mark] operator[=] identifier[si] operator[+] Other[1] operator[SEP] identifier[state] operator[=] Other[5] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[case] Other[5] operator[:] Keyword[if] operator[SEP] identifier[ch] operator[==] literal[String] operator[SEP] {
identifier[key] operator[=] identifier[str] operator[SEP] identifier[substring] operator[SEP] identifier[mark] , identifier[si] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[mark] operator[=] identifier[si] operator[+] Other[1] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[ch] operator[==] literal[String] operator[||] identifier[ch] operator[==] literal[String] operator[SEP] {
identifier[String] identifier[val] operator[=] identifier[str] operator[SEP] identifier[substring] operator[SEP] identifier[mark] , identifier[si] operator[SEP] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] identifier[mark] operator[=] identifier[si] operator[+] Other[1] operator[SEP] Keyword[if] operator[SEP] identifier[key] operator[==] Other[null] operator[SEP] identifier[key] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] identifier[binding] operator[!=] Other[null] operator[SEP] {
identifier[binding] operator[SEP] identifier[setOption] operator[SEP] identifier[key] , identifier[val] operator[SEP] operator[SEP]
}
identifier[key] operator[=] Other[null] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[default] operator[:] identifier[si] operator[=] identifier[arr] operator[SEP] identifier[length] operator[SEP]
}
identifier[si] operator[++] operator[SEP]
}
Keyword[while] operator[SEP] identifier[si] operator[<] identifier[arr] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[binding] operator[==] Other[null] operator[||] identifier[binding] operator[SEP] identifier[getEndpoint] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[DcerpcException] operator[SEP] literal[String] operator[+] identifier[str] operator[SEP] operator[SEP] Keyword[return] identifier[binding] operator[SEP]
}
|
static private ServiceType checkIfDods(String location) throws IOException {
int len = location.length();
// Strip off any trailing .dds, .das, or .dods
if (location.endsWith(".dds"))
location = location.substring(0, len - ".dds".length());
if (location.endsWith(".das"))
location = location.substring(0, len - ".das".length());
if (location.endsWith(".dods"))
location = location.substring(0, len - ".dods".length());
// Opendap assumes that the caller has properly escaped the url
try (
// For some reason, the head method is not using credentials
// method = session.newMethodHead(location + ".dds");
HTTPMethod method = HTTPFactory.Get(location + ".dds")) {
int status = method.execute();
if (status == 200) {
Header h = method.getResponseHeader("Content-Description");
if ((h != null) && (h.getValue() != null)) {
String v = h.getValue();
if (v.equalsIgnoreCase("dods-dds") || v.equalsIgnoreCase("dods_dds"))
return ServiceType.OPENDAP;
else
throw new IOException("OPeNDAP Server Error= " + method.getResponseAsString());
}
}
if (status == HttpStatus.SC_UNAUTHORIZED || status == HttpStatus.SC_FORBIDDEN)
throw new IOException("Unauthorized to open dataset " + location);
// not dods
return null;
}
}
|
class class_name[name] begin[{]
method[checkIfDods, return_type[type[ServiceType]], modifier[private static], parameter[location]] begin[{]
local_variable[type[int], len]
if[call[location.endsWith, parameter[literal[".dds"]]]] begin[{]
assign[member[.location], call[location.substring, parameter[literal[0], binary_operation[member[.len], -, literal[".dds"]]]]]
else begin[{]
None
end[}]
if[call[location.endsWith, parameter[literal[".das"]]]] begin[{]
assign[member[.location], call[location.substring, parameter[literal[0], binary_operation[member[.len], -, literal[".das"]]]]]
else begin[{]
None
end[}]
if[call[location.endsWith, parameter[literal[".dods"]]]] begin[{]
assign[member[.location], call[location.substring, parameter[literal[0], binary_operation[member[.len], -, literal[".dods"]]]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=execute, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), name=status)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=200), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Content-Description")], member=getResponseHeader, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), name=h)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Header, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=h, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=h, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=h, selectors=[], type_arguments=None), name=v)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dods-dds")], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="dods_dds")], member=equalsIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=v, selectors=[], type_arguments=None), operator=||), else_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="OPeNDAP Server Error= "), operandr=MethodInvocation(arguments=[], member=getResponseAsString, postfix_operators=[], prefix_operators=[], qualifier=method, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None), label=None, then_statement=ReturnStatement(expression=MemberReference(member=OPENDAP, postfix_operators=[], prefix_operators=[], qualifier=ServiceType, selectors=[]), label=None))]))])), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SC_UNAUTHORIZED, postfix_operators=[], prefix_operators=[], qualifier=HttpStatus, selectors=[]), operator===), operandr=BinaryOperation(operandl=MemberReference(member=status, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=SC_FORBIDDEN, postfix_operators=[], prefix_operators=[], qualifier=HttpStatus, selectors=[]), operator===), operator=||), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unauthorized to open dataset "), operandr=MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), label=None)), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], catches=None, finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=method, type=ReferenceType(arguments=None, dimensions=[], name=HTTPMethod, sub_type=None), value=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=location, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".dds"), operator=+)], member=Get, postfix_operators=[], prefix_operators=[], qualifier=HTTPFactory, selectors=[], type_arguments=None))])
end[}]
END[}]
|
Keyword[static] Keyword[private] identifier[ServiceType] identifier[checkIfDods] operator[SEP] identifier[String] identifier[location] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[int] identifier[len] operator[=] identifier[location] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[location] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[location] operator[=] identifier[location] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[len] operator[-] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[location] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[location] operator[=] identifier[location] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[len] operator[-] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[location] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[location] operator[=] identifier[location] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[len] operator[-] literal[String] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[try] operator[SEP] identifier[HTTPMethod] identifier[method] operator[=] identifier[HTTPFactory] operator[SEP] identifier[Get] operator[SEP] identifier[location] operator[+] literal[String] operator[SEP] operator[SEP] {
Keyword[int] identifier[status] operator[=] identifier[method] operator[SEP] identifier[execute] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[status] operator[==] Other[200] operator[SEP] {
identifier[Header] identifier[h] operator[=] identifier[method] operator[SEP] identifier[getResponseHeader] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[h] operator[!=] Other[null] operator[SEP] operator[&&] operator[SEP] identifier[h] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] operator[SEP] {
identifier[String] identifier[v] operator[=] identifier[h] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[v] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[||] identifier[v] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[ServiceType] operator[SEP] identifier[OPENDAP] operator[SEP] Keyword[else] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[method] operator[SEP] identifier[getResponseAsString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[status] operator[==] identifier[HttpStatus] operator[SEP] identifier[SC_UNAUTHORIZED] operator[||] identifier[status] operator[==] identifier[HttpStatus] operator[SEP] identifier[SC_FORBIDDEN] operator[SEP] Keyword[throw] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[location] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
public static String formatDuration(long durationInMs) {
if (durationInMs < 1000) {
return String.format("%sms", durationInMs);
} else {
long sec = durationInMs / 1000;
if (sec < 60) {
return String.format("%ss", sec);
} else {
long min = sec / 60;
long remainingSec = sec - (min * 60);
if (remainingSec > 0) {
return String.format("%smin %ss", min, remainingSec);
} else {
return String.format("%smin", min);
}
}
}
}
|
class class_name[name] begin[{]
method[formatDuration, return_type[type[String]], modifier[public static], parameter[durationInMs]] begin[{]
if[binary_operation[member[.durationInMs], <, literal[1000]]] begin[{]
return[call[String.format, parameter[literal["%sms"], member[.durationInMs]]]]
else begin[{]
local_variable[type[long], sec]
if[binary_operation[member[.sec], <, literal[60]]] begin[{]
return[call[String.format, parameter[literal["%ss"], member[.sec]]]]
else begin[{]
local_variable[type[long], min]
local_variable[type[long], remainingSec]
if[binary_operation[member[.remainingSec], >, literal[0]]] begin[{]
return[call[String.format, parameter[literal["%smin %ss"], member[.min], member[.remainingSec]]]]
else begin[{]
return[call[String.format, parameter[literal["%smin"], member[.min]]]]
end[}]
end[}]
end[}]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[String] identifier[formatDuration] operator[SEP] Keyword[long] identifier[durationInMs] operator[SEP] {
Keyword[if] operator[SEP] identifier[durationInMs] operator[<] Other[1000] operator[SEP] {
Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[durationInMs] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[long] identifier[sec] operator[=] identifier[durationInMs] operator[/] Other[1000] operator[SEP] Keyword[if] operator[SEP] identifier[sec] operator[<] Other[60] operator[SEP] {
Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[sec] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[long] identifier[min] operator[=] identifier[sec] operator[/] Other[60] operator[SEP] Keyword[long] identifier[remainingSec] operator[=] identifier[sec] operator[-] operator[SEP] identifier[min] operator[*] Other[60] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[remainingSec] operator[>] Other[0] operator[SEP] {
Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[min] , identifier[remainingSec] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[min] operator[SEP] operator[SEP]
}
}
}
}
|
private boolean saveForest(Document doc,
String revID,
Map<String, Object> properties)
throws ForestException {
// after insertRevision, the selected revision is inserted revision.
// need to select current revision.
doc.selectCurrentRev();
// Is the new revision the winner?
boolean isWinner = doc.getSelectedRevID().equalsIgnoreCase(revID);
// Update the documentType:
if (!isWinner)
properties = ForestBridge.bodyOfSelectedRevision(doc);
if (properties != null && properties.containsKey("type") &&
properties.get("type") instanceof String)
doc.setType((String) properties.get("type"));
// save
doc.save(maxRevTreeDepth);
return isWinner;
}
|
class class_name[name] begin[{]
method[saveForest, return_type[type[boolean]], modifier[private], parameter[doc, revID, properties]] begin[{]
call[doc.selectCurrentRev, parameter[]]
local_variable[type[boolean], isWinner]
if[member[.isWinner]] begin[{]
assign[member[.properties], call[ForestBridge.bodyOfSelectedRevision, parameter[member[.doc]]]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[binary_operation[member[.properties], !=, literal[null]], &&, call[properties.containsKey, parameter[literal["type"]]]], &&, binary_operation[call[properties.get, parameter[literal["type"]]], instanceof, type[String]]]] begin[{]
call[doc.setType, parameter[Cast(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="type")], member=get, postfix_operators=[], prefix_operators=[], qualifier=properties, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))]]
else begin[{]
None
end[}]
call[doc.save, parameter[member[.maxRevTreeDepth]]]
return[member[.isWinner]]
end[}]
END[}]
|
Keyword[private] Keyword[boolean] identifier[saveForest] operator[SEP] identifier[Document] identifier[doc] , identifier[String] identifier[revID] , identifier[Map] operator[<] identifier[String] , identifier[Object] operator[>] identifier[properties] operator[SEP] Keyword[throws] identifier[ForestException] {
identifier[doc] operator[SEP] identifier[selectCurrentRev] operator[SEP] operator[SEP] operator[SEP] Keyword[boolean] identifier[isWinner] operator[=] identifier[doc] operator[SEP] identifier[getSelectedRevID] operator[SEP] operator[SEP] operator[SEP] identifier[equalsIgnoreCase] operator[SEP] identifier[revID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[isWinner] operator[SEP] identifier[properties] operator[=] identifier[ForestBridge] operator[SEP] identifier[bodyOfSelectedRevision] operator[SEP] identifier[doc] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[properties] operator[!=] Other[null] operator[&&] identifier[properties] operator[SEP] identifier[containsKey] operator[SEP] literal[String] operator[SEP] operator[&&] identifier[properties] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] Keyword[instanceof] identifier[String] operator[SEP] identifier[doc] operator[SEP] identifier[setType] operator[SEP] operator[SEP] identifier[String] operator[SEP] identifier[properties] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[doc] operator[SEP] identifier[save] operator[SEP] identifier[maxRevTreeDepth] operator[SEP] operator[SEP] Keyword[return] identifier[isWinner] operator[SEP]
}
|
private void init(TableDesc tableDesc, boolean read) {
Configuration cfg = getConf();
// NB: we can't just merge the table properties in, we need to save them per input/output otherwise clashes occur which confuse Hive
Settings settings = HadoopSettingsManager.loadFrom(cfg);
//settings.setProperty((read ? HiveConstants.INPUT_TBL_PROPERTIES : HiveConstants.OUTPUT_TBL_PROPERTIES), IOUtils.propsToString(tableDesc.getProperties()));
if (read) {
// no generic setting
}
else {
// replace the default committer when using the old API
HadoopCfgUtils.setOutputCommitterClass(cfg, EsOutputFormat.EsOutputCommitter.class.getName());
}
Assert.hasText(tableDesc.getProperties().getProperty(TABLE_LOCATION), String.format(
"no table location [%s] declared by Hive resulting in abnormal execution;", TABLE_LOCATION));
}
|
class class_name[name] begin[{]
method[init, return_type[void], modifier[private], parameter[tableDesc, read]] begin[{]
local_variable[type[Configuration], cfg]
local_variable[type[Settings], settings]
if[member[.read]] begin[{]
else begin[{]
call[HadoopCfgUtils.setOutputCommitterClass, parameter[member[.cfg], ClassReference(postfix_operators=[], prefix_operators=[], qualifier=EsOutputFormat, 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=EsOutputCommitter, sub_type=None))]]
end[}]
call[Assert.hasText, parameter[call[tableDesc.getProperties, parameter[]], call[String.format, parameter[literal["no table location [%s] declared by Hive resulting in abnormal execution;"], member[.TABLE_LOCATION]]]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[init] operator[SEP] identifier[TableDesc] identifier[tableDesc] , Keyword[boolean] identifier[read] operator[SEP] {
identifier[Configuration] identifier[cfg] operator[=] identifier[getConf] operator[SEP] operator[SEP] operator[SEP] identifier[Settings] identifier[settings] operator[=] identifier[HadoopSettingsManager] operator[SEP] identifier[loadFrom] operator[SEP] identifier[cfg] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[read] operator[SEP] {
}
Keyword[else] {
identifier[HadoopCfgUtils] operator[SEP] identifier[setOutputCommitterClass] operator[SEP] identifier[cfg] , identifier[EsOutputFormat] operator[SEP] identifier[EsOutputCommitter] operator[SEP] Keyword[class] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Assert] operator[SEP] identifier[hasText] operator[SEP] identifier[tableDesc] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[getProperty] operator[SEP] identifier[TABLE_LOCATION] operator[SEP] , identifier[String] operator[SEP] identifier[format] operator[SEP] literal[String] , identifier[TABLE_LOCATION] operator[SEP] operator[SEP] operator[SEP]
}
|
public void initialize(final int appId, final String appSecret, final String bridgeId,
final ServerInfo serverInfo, final CallStatsInitListener callStatsInitListener) {
if (StringUtils.isBlank(appSecret)) {
logger.error("intialize: Arguments cannot be null ");
throw new IllegalArgumentException("intialize: Arguments cannot be null");
}
initialize(appId, new TokenGeneratorHs256(appSecret.toCharArray(), appId, bridgeId), bridgeId,
serverInfo, callStatsInitListener);
}
|
class class_name[name] begin[{]
method[initialize, return_type[void], modifier[public], parameter[appId, appSecret, bridgeId, serverInfo, callStatsInitListener]] begin[{]
if[call[StringUtils.isBlank, parameter[member[.appSecret]]]] begin[{]
call[logger.error, parameter[literal["intialize: Arguments cannot be null "]]]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="intialize: Arguments cannot be null")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[.initialize, parameter[member[.appId], ClassCreator(arguments=[MethodInvocation(arguments=[], member=toCharArray, postfix_operators=[], prefix_operators=[], qualifier=appSecret, selectors=[], type_arguments=None), MemberReference(member=appId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=bridgeId, 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=TokenGeneratorHs256, sub_type=None)), member[.bridgeId], member[.serverInfo], member[.callStatsInitListener]]]
end[}]
END[}]
|
Keyword[public] Keyword[void] identifier[initialize] operator[SEP] Keyword[final] Keyword[int] identifier[appId] , Keyword[final] identifier[String] identifier[appSecret] , Keyword[final] identifier[String] identifier[bridgeId] , Keyword[final] identifier[ServerInfo] identifier[serverInfo] , Keyword[final] identifier[CallStatsInitListener] identifier[callStatsInitListener] operator[SEP] {
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isBlank] operator[SEP] identifier[appSecret] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[initialize] operator[SEP] identifier[appId] , Keyword[new] identifier[TokenGeneratorHs256] operator[SEP] identifier[appSecret] operator[SEP] identifier[toCharArray] operator[SEP] operator[SEP] , identifier[appId] , identifier[bridgeId] operator[SEP] , identifier[bridgeId] , identifier[serverInfo] , identifier[callStatsInitListener] operator[SEP] operator[SEP]
}
|
private void cancelConnectionLostTimer() {
if( connectionLostCheckerService != null ) {
connectionLostCheckerService.shutdownNow();
connectionLostCheckerService = null;
}
if( connectionLostCheckerFuture != null ) {
connectionLostCheckerFuture.cancel(false);
connectionLostCheckerFuture = null;
}
}
|
class class_name[name] begin[{]
method[cancelConnectionLostTimer, return_type[void], modifier[private], parameter[]] begin[{]
if[binary_operation[member[.connectionLostCheckerService], !=, literal[null]]] begin[{]
call[connectionLostCheckerService.shutdownNow, parameter[]]
assign[member[.connectionLostCheckerService], literal[null]]
else begin[{]
None
end[}]
if[binary_operation[member[.connectionLostCheckerFuture], !=, literal[null]]] begin[{]
call[connectionLostCheckerFuture.cancel, parameter[literal[false]]]
assign[member[.connectionLostCheckerFuture], literal[null]]
else begin[{]
None
end[}]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[cancelConnectionLostTimer] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[connectionLostCheckerService] operator[!=] Other[null] operator[SEP] {
identifier[connectionLostCheckerService] operator[SEP] identifier[shutdownNow] operator[SEP] operator[SEP] operator[SEP] identifier[connectionLostCheckerService] operator[=] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[connectionLostCheckerFuture] operator[!=] Other[null] operator[SEP] {
identifier[connectionLostCheckerFuture] operator[SEP] identifier[cancel] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[connectionLostCheckerFuture] operator[=] Other[null] operator[SEP]
}
}
|
@Override
public GetRunResult getRun(GetRunRequest request) {
request = beforeClientExecution(request);
return executeGetRun(request);
}
|
class class_name[name] begin[{]
method[getRun, return_type[type[GetRunResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeGetRun, parameter[member[.request]]]]
end[}]
END[}]
|
annotation[@] identifier[Override] Keyword[public] identifier[GetRunResult] identifier[getRun] operator[SEP] identifier[GetRunRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeGetRun] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
protected <T extends RaftRequest, U extends RaftResponse> void sendRequest(T request, BiFunction<MemberId, T, CompletableFuture<U>> sender, int count, CompletableFuture<U> future) {
MemberId node = next();
if (node != null) {
log.trace("Sending {} to {}", request, node);
int selectionId = this.selectionId;
sender.apply(node, request).whenCompleteAsync((r, e) -> {
if (e != null || r != null) {
handleResponse(request, sender, count, selectionId, node, r, e, future);
} else {
future.complete(null);
}
}, context);
} else {
future.completeExceptionally(new ConnectException("Failed to connect to the cluster"));
}
}
|
class class_name[name] begin[{]
method[sendRequest, return_type[void], modifier[protected], parameter[request, sender, count, future]] begin[{]
local_variable[type[MemberId], node]
if[binary_operation[member[.node], !=, literal[null]]] begin[{]
call[log.trace, parameter[literal["Sending {} to {}"], member[.request], member[.node]]]
local_variable[type[int], selectionId]
call[sender.apply, parameter[member[.node], member[.request]]]
else begin[{]
call[future.completeExceptionally, parameter[ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to connect to the cluster")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ConnectException, sub_type=None))]]
end[}]
end[}]
END[}]
|
Keyword[protected] operator[<] identifier[T] Keyword[extends] identifier[RaftRequest] , identifier[U] Keyword[extends] identifier[RaftResponse] operator[>] Keyword[void] identifier[sendRequest] operator[SEP] identifier[T] identifier[request] , identifier[BiFunction] operator[<] identifier[MemberId] , identifier[T] , identifier[CompletableFuture] operator[<] identifier[U] operator[>] operator[>] identifier[sender] , Keyword[int] identifier[count] , identifier[CompletableFuture] operator[<] identifier[U] operator[>] identifier[future] operator[SEP] {
identifier[MemberId] identifier[node] operator[=] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[node] operator[!=] Other[null] operator[SEP] {
identifier[log] operator[SEP] identifier[trace] operator[SEP] literal[String] , identifier[request] , identifier[node] operator[SEP] operator[SEP] Keyword[int] identifier[selectionId] operator[=] Keyword[this] operator[SEP] identifier[selectionId] operator[SEP] identifier[sender] operator[SEP] identifier[apply] operator[SEP] identifier[node] , identifier[request] operator[SEP] operator[SEP] identifier[whenCompleteAsync] operator[SEP] operator[SEP] identifier[r] , identifier[e] operator[SEP] operator[->] {
Keyword[if] operator[SEP] identifier[e] operator[!=] Other[null] operator[||] identifier[r] operator[!=] Other[null] operator[SEP] {
identifier[handleResponse] operator[SEP] identifier[request] , identifier[sender] , identifier[count] , identifier[selectionId] , identifier[node] , identifier[r] , identifier[e] , identifier[future] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[future] operator[SEP] identifier[complete] operator[SEP] Other[null] operator[SEP] operator[SEP]
}
} , identifier[context] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[future] operator[SEP] identifier[completeExceptionally] operator[SEP] Keyword[new] identifier[ConnectException] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
}
|
private void fillDetailResources(CmsListItem item, String detailId) {
CmsSearchManager searchManager = OpenCms.getSearchManager();
StringBuffer html = new StringBuffer();
// search for the corresponding CmsSearchIndexSource:
String idxSourceName = (String)item.get(LIST_COLUMN_NAME);
CmsSearchIndexSource idxSource = searchManager.getIndexSource(idxSourceName);
// get the index sources resource strings
List<String> resources = idxSource.getResourcesNames();
// output of found index sources
Iterator<String> itResources = resources.iterator();
html.append("<ul>\n");
while (itResources.hasNext()) {
html.append(" <li>\n").append(" ").append(itResources.next()).append("\n");
html.append(" </li>");
}
html.append("</ul>\n");
item.set(detailId, html.toString());
}
|
class class_name[name] begin[{]
method[fillDetailResources, return_type[void], modifier[private], parameter[item, detailId]] begin[{]
local_variable[type[CmsSearchManager], searchManager]
local_variable[type[StringBuffer], html]
local_variable[type[String], idxSourceName]
local_variable[type[CmsSearchIndexSource], idxSource]
local_variable[type[List], resources]
local_variable[type[Iterator], itResources]
call[html.append, parameter[literal["<ul>\n"]]]
while[call[itResources.hasNext, parameter[]]] begin[{]
call[html.append, parameter[literal[" <li>\n"]]]
call[html.append, parameter[literal[" </li>"]]]
end[}]
call[html.append, parameter[literal["</ul>\n"]]]
call[item.set, parameter[member[.detailId], call[html.toString, parameter[]]]]
end[}]
END[}]
|
Keyword[private] Keyword[void] identifier[fillDetailResources] operator[SEP] identifier[CmsListItem] identifier[item] , identifier[String] identifier[detailId] operator[SEP] {
identifier[CmsSearchManager] identifier[searchManager] operator[=] identifier[OpenCms] operator[SEP] identifier[getSearchManager] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[html] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[idxSourceName] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[item] operator[SEP] identifier[get] operator[SEP] identifier[LIST_COLUMN_NAME] operator[SEP] operator[SEP] identifier[CmsSearchIndexSource] identifier[idxSource] operator[=] identifier[searchManager] operator[SEP] identifier[getIndexSource] operator[SEP] identifier[idxSourceName] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[resources] operator[=] identifier[idxSource] operator[SEP] identifier[getResourcesNames] operator[SEP] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[itResources] operator[=] identifier[resources] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[itResources] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] {
identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[itResources] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[html] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[item] operator[SEP] identifier[set] operator[SEP] identifier[detailId] , identifier[html] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static policymap get(nitro_service service, String mappolicyname) throws Exception{
policymap obj = new policymap();
obj.set_mappolicyname(mappolicyname);
policymap response = (policymap) obj.get_resource(service);
return response;
}
|
class class_name[name] begin[{]
method[get, return_type[type[policymap]], modifier[public static], parameter[service, mappolicyname]] begin[{]
local_variable[type[policymap], obj]
call[obj.set_mappolicyname, parameter[member[.mappolicyname]]]
local_variable[type[policymap], response]
return[member[.response]]
end[}]
END[}]
|
Keyword[public] Keyword[static] identifier[policymap] identifier[get] operator[SEP] identifier[nitro_service] identifier[service] , identifier[String] identifier[mappolicyname] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[policymap] identifier[obj] operator[=] Keyword[new] identifier[policymap] operator[SEP] operator[SEP] operator[SEP] identifier[obj] operator[SEP] identifier[set_mappolicyname] operator[SEP] identifier[mappolicyname] operator[SEP] operator[SEP] identifier[policymap] identifier[response] operator[=] operator[SEP] identifier[policymap] operator[SEP] identifier[obj] operator[SEP] identifier[get_resource] operator[SEP] identifier[service] operator[SEP] operator[SEP] Keyword[return] identifier[response] operator[SEP]
}
|
public synchronized void deserialize(DataInputStream source,
ServerVersion sv,
StatusUI statusUI)
throws IOException,
EOFException,
DataReadException {
// Because arrays of primitive types (ie int32, float32, byte, etc) are
// handled in the C++ core using the XDR package we must read the
// length twice for those types. For BaseType vectors, we should read
// it only once. This is in effect a work around for a bug in the C++
// core as the C++ core does not consume 2 length values for the
// BaseType vectors. Bummer...
int length;
length = source.readInt();
if (!(vals instanceof BaseTypePrimitiveVector)) {
// because both XDR and OPeNDAP write the length, we must read it twice
int length2 = source.readInt();
//LogStream.out.println("array1 length read: "+getName()+" "+length+ " -- "+length2);
//LogStream.out.println(" array type = : "+vals.getClass().getName());
// QC the second length
if (length != length2) {
throw new DataReadException("Inconsistent array length read: " + length + " != " + length2);
}
} /* else {
LogStream.dbg.println("array2 length read: "+getName()+" "+length);
LogStream.dbg.println(" array type = : "+vals.getClass().getName());
} */
if (length < 0)
throw new DataReadException("Negative array length read.");
if (statusUI != null)
statusUI.incrementByteCount(8);
vals.setLength(length);
vals.deserialize(source, sv, statusUI);
}
|
class class_name[name] begin[{]
method[deserialize, return_type[void], modifier[synchronized public], parameter[source, sv, statusUI]] begin[{]
local_variable[type[int], length]
assign[member[.length], call[source.readInt, parameter[]]]
if[binary_operation[member[.vals], instanceof, type[BaseTypePrimitiveVector]]] begin[{]
local_variable[type[int], length2]
if[binary_operation[member[.length], !=, member[.length2]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Inconsistent array length read: "), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" != "), operator=+), operandr=MemberReference(member=length2, 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=DataReadException, sub_type=None)), label=None)
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.length], <, literal[0]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Negative array length read.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DataReadException, sub_type=None)), label=None)
else begin[{]
None
end[}]
if[binary_operation[member[.statusUI], !=, literal[null]]] begin[{]
call[statusUI.incrementByteCount, parameter[literal[8]]]
else begin[{]
None
end[}]
call[vals.setLength, parameter[member[.length]]]
call[vals.deserialize, parameter[member[.source], member[.sv], member[.statusUI]]]
end[}]
END[}]
|
Keyword[public] Keyword[synchronized] Keyword[void] identifier[deserialize] operator[SEP] identifier[DataInputStream] identifier[source] , identifier[ServerVersion] identifier[sv] , identifier[StatusUI] identifier[statusUI] operator[SEP] Keyword[throws] identifier[IOException] , identifier[EOFException] , identifier[DataReadException] {
Keyword[int] identifier[length] operator[SEP] identifier[length] operator[=] identifier[source] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] operator[SEP] identifier[vals] Keyword[instanceof] identifier[BaseTypePrimitiveVector] operator[SEP] operator[SEP] {
Keyword[int] identifier[length2] operator[=] identifier[source] operator[SEP] identifier[readInt] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[length] operator[!=] identifier[length2] operator[SEP] {
Keyword[throw] Keyword[new] identifier[DataReadException] operator[SEP] literal[String] operator[+] identifier[length] operator[+] literal[String] operator[+] identifier[length2] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[length] operator[<] Other[0] operator[SEP] Keyword[throw] Keyword[new] identifier[DataReadException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[statusUI] operator[!=] Other[null] operator[SEP] identifier[statusUI] operator[SEP] identifier[incrementByteCount] operator[SEP] Other[8] operator[SEP] operator[SEP] identifier[vals] operator[SEP] identifier[setLength] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[vals] operator[SEP] identifier[deserialize] operator[SEP] identifier[source] , identifier[sv] , identifier[statusUI] operator[SEP] operator[SEP]
}
|
Motion selectCoordinateBase(View view ) {
double bestScore = 0;
Motion best = null;
if( verbose != null )
verbose.println("selectCoordinateBase");
for (int i = 0; i < view.connections.size(); i++) {
Motion e = view.connections.get(i);
double s = e.scoreTriangulation();
if( verbose != null )
verbose.printf(" [%2d] score = %s\n",i,s);
if( s > bestScore ) {
bestScore = s;
best = e;
}
}
return best;
}
|
class class_name[name] begin[{]
method[selectCoordinateBase, return_type[type[Motion]], modifier[default], parameter[view]] begin[{]
local_variable[type[double], bestScore]
local_variable[type[Motion], best]
if[binary_operation[member[.verbose], !=, literal[null]]] begin[{]
call[verbose.println, parameter[literal["selectCoordinateBase"]]]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=view.connections, selectors=[], type_arguments=None), name=e)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Motion, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=scoreTriangulation, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), name=s)], modifiers=set(), type=BasicType(dimensions=[], name=double)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=verbose, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" [%2d] score = %s\n"), MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printf, postfix_operators=[], prefix_operators=[], qualifier=verbose, selectors=[], type_arguments=None), label=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=bestScore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=bestScore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=best, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=view.connections, 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[.best]]
end[}]
END[}]
|
identifier[Motion] identifier[selectCoordinateBase] operator[SEP] identifier[View] identifier[view] operator[SEP] {
Keyword[double] identifier[bestScore] operator[=] Other[0] operator[SEP] identifier[Motion] identifier[best] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[verbose] operator[!=] Other[null] operator[SEP] identifier[verbose] operator[SEP] identifier[println] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[view] operator[SEP] identifier[connections] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[Motion] identifier[e] operator[=] identifier[view] operator[SEP] identifier[connections] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[double] identifier[s] operator[=] identifier[e] operator[SEP] identifier[scoreTriangulation] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[verbose] operator[!=] Other[null] operator[SEP] identifier[verbose] operator[SEP] identifier[printf] operator[SEP] literal[String] , identifier[i] , identifier[s] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[s] operator[>] identifier[bestScore] operator[SEP] {
identifier[bestScore] operator[=] identifier[s] operator[SEP] identifier[best] operator[=] identifier[e] operator[SEP]
}
}
Keyword[return] identifier[best] operator[SEP]
}
|
public byte[] transform(ClassLoader loader,
String className,
Class<?> classBeingRedefined,
ProtectionDomain protectionDomain,
byte[] classfileBuffer) throws IllegalClassFormatException {
// Don't modify our own package
if (className.startsWith(Transformer.class.getPackage().getName().replaceAll("\\.", "/"))) {
return null;
}
// Don't modify the java.util.logging classes
if (className.startsWith("java/util/logging/")) {
return null;
}
boolean include = false;
for (String s : includesList) {
if (className.startsWith(s) || s.equals("/")) {
include = true;
break;
}
}
for (String s : excludesList) {
if (className.startsWith(s) || s.equals("/")) {
include = false;
break;
}
}
if (include == false) {
return null;
}
String internalPackageName = className.replaceAll("/[^/]+$", "");
PackageInfo packageInfo = getPackageInfo(internalPackageName);
if (packageInfo == null && loader != null) {
String packageInfoResourceName = internalPackageName + "/package-info.class";
InputStream is = loader.getResourceAsStream(packageInfoResourceName);
packageInfo = processPackageInfo(is);
addPackageInfo(packageInfo);
}
try {
return transform(new ByteArrayInputStream(classfileBuffer));
} catch (Throwable t) {
t.printStackTrace();
return null;
}
}
|
class class_name[name] begin[{]
method[transform, return_type[type[byte]], modifier[public], parameter[loader, className, classBeingRedefined, protectionDomain, classfileBuffer]] begin[{]
if[call[className.startsWith, parameter[ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getPackage, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\\."), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=replaceAll, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=Transformer, sub_type=None))]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
if[call[className.startsWith, parameter[literal["java/util/logging/"]]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[boolean], include]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=className, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=include, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=includesList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=s, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=className, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="/")], member=equals, postfix_operators=[], prefix_operators=[], qualifier=s, selectors=[], type_arguments=None), operator=||), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=include, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None), BreakStatement(goto=None, label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=excludesList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=s)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
if[binary_operation[member[.include], ==, literal[false]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
local_variable[type[String], internalPackageName]
local_variable[type[PackageInfo], packageInfo]
if[binary_operation[binary_operation[member[.packageInfo], ==, literal[null]], &&, binary_operation[member[.loader], !=, literal[null]]]] begin[{]
local_variable[type[String], packageInfoResourceName]
local_variable[type[InputStream], is]
assign[member[.packageInfo], call[.processPackageInfo, parameter[member[.is]]]]
call[.addPackageInfo, parameter[member[.packageInfo]]]
else begin[{]
None
end[}]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=classfileBuffer, 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=ByteArrayInputStream, sub_type=None))], member=transform, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=t, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}]
|
Keyword[public] Keyword[byte] operator[SEP] operator[SEP] identifier[transform] operator[SEP] identifier[ClassLoader] identifier[loader] , identifier[String] identifier[className] , identifier[Class] operator[<] operator[?] operator[>] identifier[classBeingRedefined] , identifier[ProtectionDomain] identifier[protectionDomain] , Keyword[byte] operator[SEP] operator[SEP] identifier[classfileBuffer] operator[SEP] Keyword[throws] identifier[IllegalClassFormatException] {
Keyword[if] operator[SEP] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] identifier[Transformer] operator[SEP] Keyword[class] operator[SEP] identifier[getPackage] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[if] operator[SEP] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] literal[String] operator[SEP] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
Keyword[boolean] identifier[include] operator[=] literal[boolean] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[s] operator[:] identifier[includesList] operator[SEP] {
Keyword[if] operator[SEP] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] identifier[s] operator[SEP] operator[||] identifier[s] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[include] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[for] operator[SEP] identifier[String] identifier[s] operator[:] identifier[excludesList] operator[SEP] {
Keyword[if] operator[SEP] identifier[className] operator[SEP] identifier[startsWith] operator[SEP] identifier[s] operator[SEP] operator[||] identifier[s] operator[SEP] identifier[equals] operator[SEP] literal[String] operator[SEP] operator[SEP] {
identifier[include] operator[=] literal[boolean] operator[SEP] Keyword[break] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[include] operator[==] literal[boolean] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[String] identifier[internalPackageName] operator[=] identifier[className] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[PackageInfo] identifier[packageInfo] operator[=] identifier[getPackageInfo] operator[SEP] identifier[internalPackageName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[packageInfo] operator[==] Other[null] operator[&&] identifier[loader] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[packageInfoResourceName] operator[=] identifier[internalPackageName] operator[+] literal[String] operator[SEP] identifier[InputStream] identifier[is] operator[=] identifier[loader] operator[SEP] identifier[getResourceAsStream] operator[SEP] identifier[packageInfoResourceName] operator[SEP] operator[SEP] identifier[packageInfo] operator[=] identifier[processPackageInfo] operator[SEP] identifier[is] operator[SEP] operator[SEP] identifier[addPackageInfo] operator[SEP] identifier[packageInfo] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[return] identifier[transform] operator[SEP] Keyword[new] identifier[ByteArrayInputStream] operator[SEP] identifier[classfileBuffer] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[t] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Other[null] operator[SEP]
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.